Bug 1256988 - Move X11 and MOZ_WIDGET_TOOLKIT-related things to moz.configure. r=chmanchester
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 16 Mar 2016 14:56:24 +0900
changeset 289144 730733acaf713e9aba4a11502dbafb65d990f00d
parent 289143 63064e69b81e8f39a6fbc8c265568f317b79b7fc
child 289145 b1a590ee3dfd3bc57849ef28c727d89394d7a5c9
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1256988
milestone48.0a1
Bug 1256988 - Move X11 and MOZ_WIDGET_TOOLKIT-related things to moz.configure. r=chmanchester
build/moz.configure/init.configure
build/moz.configure/old.configure
old-configure.in
toolkit/moz.configure
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -257,16 +257,17 @@ def wanted_mozconfig_variables(help):
          'GENISOIMAGE',
          'MOZILLABUILD',
          'MOZ_ARTIFACT_BUILDS',
          'MOZ_BUILD_APP',
          'PERL',
          'RPMBUILD',
          'TAR',
          'UNZIP',
+         'WITHOUT_X',
          'XARGS',
          'ZIP',
      ])
 
 
 @depends(mozconfig, wanted_mozconfig_variables)
 def mozconfig_options(mozconfig, wanted_mozconfig_variables):
     if mozconfig['path']:
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -365,17 +365,16 @@ def old_configure_options(*options):
     '--with-system-nss',
     '--with-system-png',
     '--with-system-zlib',
     '--with-thumb',
     '--with-thumb-interwork',
     '--with-unify-dist',
     '--with-user-appdir',
     '--with-windows-version',
-    '--with-x',
     '--with-xulrunner-stub-name',
     '--x-includes',
     '--x-libraries',
 
     # Below are the configure flags used by comm-central.
     '--enable-ldap',
     '--enable-mapi',
     '--enable-calendar',
--- a/old-configure.in
+++ b/old-configure.in
@@ -1527,17 +1527,16 @@ case "$target" in
     fi
     LDFLAGS=$_SAVE_LDFLAGS
 
     MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
     ;;
 
 *-android*|*-linuxandroid*)
     AC_DEFINE(NO_PW_GECOS)
-    no_x=yes
     if test -n "$gonkdir"; then
         _PLATFORM_HAVE_RIL=1
         MOZ_B2G_FM=1
         MOZ_SYNTH_PICO=1
     else
         if test "$COMPILE_ENVIRONMENT"; then
             MOZ_LINKER=1
         fi
@@ -1798,18 +1797,16 @@ case "$target" in
     AC_DEFINE(HW_THREADS)
     AC_DEFINE(STDC_HEADERS)
     AC_DEFINE(WIN32_LEAN_AND_MEAN)
     dnl See http://support.microsoft.com/kb/143208 to use STL
     AC_DEFINE(NOMINMAX)
     BIN_SUFFIX='.exe'
     MOZ_USER_DIR="Mozilla"
 
-    no_x=yes
-
     case "$host" in
     *-mingw*)
         if test -n "$L10NBASEDIR"; then
             L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
         fi
         ;;
     esac
 
@@ -2107,17 +2104,17 @@ AC_CHECK_LIB(socket, socket)
 XLDFLAGS="$X_LIBS"
 XLIBS="$X_EXTRA_LIBS"
 
 dnl ========================================================
 dnl Checks for X libraries.
 dnl Ordering is important.
 dnl Xt is dependent upon SM as of X11R6
 dnl ========================================================
-if test "$no_x" != "yes"; then
+if test -n "$MOZ_X11"; then
     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
     XLIBS="-lX11 $XLIBS"
     _SAVE_LDFLAGS="$LDFLAGS"
     LDFLAGS="$XLDFLAGS $LDFLAGS"
     AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
         [MISSING_X="$MISSING_X -lX11"], $XLIBS)
     AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
         [MISSING_X="$MISSING_X -lXext"], $XLIBS)
@@ -2142,17 +2139,17 @@ if test "$no_x" != "yes"; then
     dnl = Check for Xss
     dnl ========================================================
     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
 
     LDFLAGS="$_SAVE_LDFLAGS"
-fi # $no_x
+fi # $MOZ_X11
 
 AC_SUBST_LIST(XCFLAGS)
 AC_SUBST_LIST(XLDFLAGS)
 AC_SUBST_LIST(XLIBS)
 AC_SUBST_LIST(XEXT_LIBS)
 AC_SUBST_LIST(XT_LIBS)
 AC_SUBST_LIST(XSS_LIBS)
 
@@ -3406,63 +3403,43 @@ fi
 
 dnl ========================================================
 dnl =
 dnl = Toolkit Options
 dnl =
 dnl ========================================================
 MOZ_ARG_HEADER(Toolkit Options)
 
-MOZ_ARG_WITHOUT_BOOL(x,
-[  --without-x              Build without X11],
-    WITHOUT_X11=1)
-
 dnl ========================================================
 dnl = Enable the toolkit as needed                         =
 dnl ========================================================
 
 case "$MOZ_WIDGET_TOOLKIT" in
 
 windows)
     MOZ_PDF_PRINTING=1
     MOZ_INSTRUMENT_EVENT_LOOP=1
     ;;
 
 gtk3)
-    MOZ_ENABLE_XREMOTE=1
-    MOZ_GL_DEFAULT_PROVIDER=GLX
-
-    AC_DEFINE(MOZ_X11)
-    MOZ_X11=1
     USE_FC_FREETYPE=1
 
     MOZ_PDF_PRINTING=1
     MOZ_INSTRUMENT_EVENT_LOOP=1
     ;;
 
 gtk2)
-    MOZ_ENABLE_XREMOTE=1
-    MOZ_GL_DEFAULT_PROVIDER=GLX
-
-    AC_DEFINE(MOZ_X11)
-    MOZ_X11=1
     USE_FC_FREETYPE=1
 
     MOZ_PDF_PRINTING=1
     MOZ_INSTRUMENT_EVENT_LOOP=1
     ;;
 
 qt)
     MOZ_ENABLE_QT=1
-    if test -z "$WITHOUT_X11"; then
-      MOZ_ENABLE_XREMOTE=1
-      MOZ_GL_DEFAULT_PROVIDER=GLX
-      MOZ_X11=1
-      AC_DEFINE(MOZ_X11)
-    fi
 
     USE_FC_FREETYPE=1
     MOZ_PDF_PRINTING=1
     AC_DEFINE(QT_NO_KEYWORDS)
     ;;
 
 cocoa)
     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
@@ -3502,20 +3479,16 @@ gonk)
 esac
 
 AC_SUBST(MOZ_PDF_PRINTING)
 if test "$MOZ_PDF_PRINTING"; then
    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
    AC_DEFINE(MOZ_PDF_PRINTING)
 fi
 
-if test "$MOZ_ENABLE_XREMOTE"; then
-    AC_DEFINE(MOZ_ENABLE_XREMOTE)
-fi
-
 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
 fi
 
 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
 case "$MOZ_WIDGET_TOOLKIT" in
 gtk*)
@@ -3782,25 +3755,22 @@ fi
 AC_SUBST(GTK_CONFIG)
 AC_SUBST_LIST(TK_CFLAGS)
 AC_SUBST_LIST(TK_LIBS)
 
 AC_SUBST(MOZ_ENABLE_QT)
 AC_SUBST(MOZ_ENABLE_QTNETWORK)
 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
-AC_SUBST(MOZ_ENABLE_XREMOTE)
 AC_SUBST_LIST(MOZ_QT_CFLAGS)
 AC_SUBST_LIST(MOZ_QT_LIBS)
 
 AC_SUBST(MOC)
 AC_SUBST(RCC)
 
-AC_SUBST(MOZ_X11)
-
 dnl ========================================================
 dnl =
 dnl = Components & Features
 dnl =
 dnl ========================================================
 MOZ_ARG_HEADER(Components and Features)
 
 dnl ========================================================
@@ -8151,19 +8121,16 @@ AC_SUBST(JS_BINARY)
 
 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
 
 if test -n "$COMPILE_ENVIRONMENT"; then
 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
 
 dnl Check for missing components
 if test "$MOZ_X11"; then
-    if test "$WITHOUT_X11"; then
-        AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
-    fi
     dnl ====================================================
     dnl = Check if X headers exist
     dnl ====================================================
     _SAVE_CFLAGS=$CFLAGS
     CFLAGS="$CFLAGS $XCFLAGS"
     AC_TRY_COMPILE([
         #include <stdio.h>
         #include <stdlib.h>
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -64,8 +64,31 @@ def toolkit(toolkit):
     if widget_toolkit == 'gtk2':
         set_define('MOZ_WIDGET_GTK', '2')
     elif widget_toolkit == 'gtk3':
         set_define('MOZ_WIDGET_GTK', '3')
     elif widget_toolkit != 'windows':
         set_define('MOZ_WIDGET_%s' % widget_toolkit.upper(), '1')
 
     return widget_toolkit
+
+
+option('--without-x', env='WITHOUT_X', help='Disable X11 support')
+
+@depends('--without-x', toolkit)
+def x11(value, toolkit):
+    if not value and toolkit != 'qt':
+        error('--without-x is only valid with --enable-default-toolkit=qt')
+
+    x11_toolkits = ('gtk2', 'gtk3', 'qt')
+    if value and value.origin != 'default' and toolkit not in x11_toolkits:
+        error('--with-x is only valid with --enable-default-toolkit={%s}'
+              % ','.join(x11_toolkits))
+
+    if value and toolkit in x11_toolkits:
+        set_config('MOZ_ENABLE_XREMOTE', '1')
+        set_define('MOZ_ENABLE_XREMOTE', '1')
+        set_config('MOZ_X11', '1')
+        set_define('MOZ_X11', '1')
+        add_old_configure_assignment('MOZ_X11', '1')
+        add_old_configure_assignment('MOZ_GL_DEFAULT_PROVIDER', 'GLX')
+
+    return value and toolkit in x11_toolkits