diff --git a/gfx/angle/moz.build.common b/gfx/angle/moz.build.common index ea2a94dd334d..71b80785ec35 100644 --- a/gfx/angle/moz.build.common +++ b/gfx/angle/moz.build.common @@ -7,7 +7,7 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'): '-Wno-range-loop-construct', ] -CXXFLAGS += CONFIG['XCFLAGS'] +CXXFLAGS += CONFIG['MOZ_X11_CFLAGS'] if CONFIG['INTEL_ARCHITECTURE']: CXXFLAGS += CONFIG['SSE2_FLAGS'] diff --git a/gfx/cairo/cairo/src/moz.build b/gfx/cairo/cairo/src/moz.build index a6153093f7dc..db57d54cf8cf 100755 --- a/gfx/cairo/cairo/src/moz.build +++ b/gfx/cairo/cairo/src/moz.build @@ -284,7 +284,7 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc') and CONFIG['OS_TARGET'] == 'Android' an CXXFLAGS += ['-O2'] if CONFIG['MOZ_X11']: - CFLAGS += CONFIG['XCFLAGS'] + CFLAGS += CONFIG['MOZ_X11_CFLAGS'] if CONFIG['MOZ_ENABLE_CAIRO_FT']: CFLAGS += CONFIG['CAIRO_FT_CFLAGS'] diff --git a/old-configure.in b/old-configure.in index be80b2309331..13f72e6e61da 100644 --- a/old-configure.in +++ b/old-configure.in @@ -240,24 +240,6 @@ AC_SUBST(GNU_CXX) AC_SUBST_LIST(STL_FLAGS) AC_SUBST(WRAP_STL_INCLUDES) -dnl ======================================================== -dnl Checks for programs. -dnl ======================================================== -if test "$COMPILE_ENVIRONMENT"; then - -dnl autoconf's xmkmf test tries to find X11 headers and libraries via -dnl running xmkmf if it's available. This doesn't take into account -dnl sysroots, so we're better off without the test. Moreover, most of -dnl the time, xmkmf is not available, and things work just fine anyway. -dnl This avoids breaking the build when xmkmf _is_ available and a -dnl sysroot is used. -define([AC_PATH_X_XMKMF], []) -AC_PATH_XTRA - -XCFLAGS="$X_CFLAGS" - -fi # COMPILE_ENVIRONMENT - dnl ======================================================== dnl set the defaults first dnl ======================================================== @@ -980,41 +962,6 @@ fi AC_CHECK_LIB(socket, socket) -XLDFLAGS="$X_LIBS" -XLIBS="$X_EXTRA_LIBS" - -dnl ======================================================== -dnl Checks for X libraries. -dnl ======================================================== -if test -n "$MOZ_X11"; then - AC_DEFINE_UNQUOTED(FUNCPROTO,15) - _SAVE_LDFLAGS="$LDFLAGS" - _SAVE_LIBS="$LIBS" - LDFLAGS="$XLDFLAGS $LDFLAGS" - AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"], - [MISSING_X="$MISSING_X -lX11"], $XLIBS) - AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"], - [MISSING_X="$MISSING_X -lXext"], $XLIBS) - - dnl ======================================================== - dnl = Check for xcb - dnl ======================================================== - AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"], - [MISSING_X="$MISSING_X -lxcb"], $XLIBS) - AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"], - [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS) - AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"], - [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS) - - LDFLAGS="$_SAVE_LDFLAGS" - LIBS="$_SAVE_LIBS" -fi # $MOZ_X11 - -AC_SUBST_LIST(XCFLAGS) -AC_SUBST_LIST(XLDFLAGS) -AC_SUBST_LIST(XLIBS) -AC_SUBST_LIST(XEXT_LIBS) - dnl ======================================================== dnl = pthread support dnl = Start by checking whether the system support pthreads @@ -2258,7 +2205,7 @@ if test "$USE_FC_FREETYPE"; then fi _SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS" + CPPFLAGS="$CPPFLAGS $FT2_CFLAGS" MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], , [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include ]) CPPFLAGS="$_SAVE_CPPFLAGS" @@ -2627,37 +2574,6 @@ 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 - dnl ==================================================== - dnl = Check if X headers exist - dnl ==================================================== - _SAVE_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS $XCFLAGS" - AC_TRY_COMPILE([ - #include - #include - #include - #include - #include - ], - [ - Display *dpy = 0; - if ((dpy = XOpenDisplay(NULL)) == NULL) { - fprintf(stderr, ": can't open %s\n", XDisplayName(NULL)); - exit(1); - } - ], [], - [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ]) - CFLAGS="$_SAVE_CFLAGS" - - if test -n "$MISSING_X"; then - AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]); - fi - -fi # MOZ_X11 - fi # COMPILE_ENVIRONMENT dnl Set various defines and substitutions diff --git a/testing/tools/screenshot/moz.build b/testing/tools/screenshot/moz.build index 996e25643a2b..2a7bfce846df 100644 --- a/testing/tools/screenshot/moz.build +++ b/testing/tools/screenshot/moz.build @@ -10,7 +10,6 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk" and CONFIG["MOZ_X11"]: "gdk-screenshot.cpp", ] CXXFLAGS += CONFIG["TK_CFLAGS"] - LDFLAGS += CONFIG["XLDFLAGS"] OS_LIBS += CONFIG["TK_LIBS"] if CONFIG["MOZ_ENABLE_DBUS"]: OS_LIBS += CONFIG["MOZ_DBUS_GLIB_LIBS"] diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build index 9558c7f3d225..5e2d8cb4cde4 100644 --- a/toolkit/library/moz.build +++ b/toolkit/library/moz.build @@ -278,13 +278,8 @@ if CONFIG["MOZ_ENABLE_DBUS"]: if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": OS_LIBS += [l for l in CONFIG["TK_LIBS"] if l not in ("-lgtk-3", "-lgdk-3")] - OS_LIBS += CONFIG["XLDFLAGS"] - OS_LIBS += CONFIG["XLIBS"] - OS_LIBS += CONFIG["XEXT_LIBS"] + OS_LIBS += CONFIG["MOZ_X11_LIBS"] OS_LIBS += CONFIG["MOZ_PANGO_LIBS"] - OS_LIBS += [ - "Xrender", - ] if CONFIG["MOZ_ENABLE_LIBPROXY"]: OS_LIBS += CONFIG["MOZ_LIBPROXY_LIBS"] diff --git a/toolkit/moz.configure b/toolkit/moz.configure index a0d685a42be4..04741ab3fb5f 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -314,10 +314,6 @@ def toolkit_gtk(toolkit): return toolkit == "gtk" -set_config("MOZ_X11", True, when=toolkit_gtk) -set_define("MOZ_X11", True, when=toolkit_gtk) -add_old_configure_assignment("MOZ_X11", True, when=toolkit_gtk) - # Wayland support # ============================================================== wayland_headers = pkg_check_modules( @@ -1171,6 +1167,39 @@ option( set_config("MOZ_RAW", depends_if("--enable-raw")(lambda _: True)) set_define("MOZ_RAW", depends_if("--enable-raw")(lambda _: True)) + +# X11 +# ============================================================== +set_config("MOZ_X11", True, when=toolkit_gtk) +set_define("MOZ_X11", True, when=toolkit_gtk) + + +@depends(webrtc, when=toolkit_gtk) +def x11_libs(webrtc): + libs = [ + "x11", + "xcb", + "xcb-shm", + "x11-xcb", + "xext", + "xrender", + ] + if webrtc: + # third_party/libwebrtc/webrtc/webrtc_gn/moz.build adds those + # manually, ensure they're available. + libs += [ + "xcomposite", + "xcursor", + "xdamage", + "xfixes", + "xi", + ] + return " ".join(libs) + + +pkg_check_modules("MOZ_X11", x11_libs, when=toolkit_gtk) + + # ASan Reporter Addon # ============================================================== option( diff --git a/widget/gtk/mozgtk/moz.build b/widget/gtk/mozgtk/moz.build index a76c530b5f9a..f860f8217879 100644 --- a/widget/gtk/mozgtk/moz.build +++ b/widget/gtk/mozgtk/moz.build @@ -10,7 +10,7 @@ SOURCES += [ "mozgtk.c", ] -CFLAGS += CONFIG["XCFLAGS"] +CFLAGS += CONFIG["MOZ_X11_CFLAGS"] # If LDFLAGS contains -Wl,--as-needed or if it's the default for the toolchain, # we need to add -Wl,--no-as-needed before the gtk libraries, otherwise the diff --git a/widget/x11/moz.build b/widget/x11/moz.build index e1a49d31f935..81d345c0af6c 100644 --- a/widget/x11/moz.build +++ b/widget/x11/moz.build @@ -13,4 +13,4 @@ SOURCES += [ FINAL_LIBRARY = "xul" -CFLAGS += CONFIG["XCFLAGS"] +CFLAGS += CONFIG["MOZ_X11_CFLAGS"]