1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl This Source Code Form is subject to the terms of the Mozilla Public
4 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
5 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 dnl Process this file with autoconf to produce a configure script.
8 dnl ========================================================
10 AC_INIT(config/config.mk)
11 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
14 dnl ========================================================
16 dnl = Don't change the following two lines. Doing so breaks:
18 dnl = CFLAGS="-foo" ./configure
20 dnl ========================================================
22 CPPFLAGS="${CPPFLAGS=}"
23 CXXFLAGS="${CXXFLAGS=}"
25 HOST_CFLAGS="${HOST_CFLAGS=}"
26 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
27 HOST_LDFLAGS="${HOST_LDFLAGS=}"
28 RUSTFLAGS="${RUSTFLAGS=}"
30 dnl ========================================================
31 dnl = Preserve certain environment flags passed to configure
32 dnl = We want sub projects to receive the same flags
33 dnl = untainted by this configure script
34 dnl ========================================================
37 _SUBDIR_CFLAGS="$CFLAGS"
38 _SUBDIR_CPPFLAGS="$CPPFLAGS"
39 _SUBDIR_CXXFLAGS="$CXXFLAGS"
40 _SUBDIR_LDFLAGS="$LDFLAGS"
41 _SUBDIR_HOST_CC="$HOST_CC"
42 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
43 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
44 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
45 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
47 dnl Set the version number of the libs included with mozilla
48 dnl ========================================================
55 dnl Set the minimum version of toolkit libs used by mozilla
56 dnl ========================================================
58 # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
59 # The macro won't be used when compiling with earlier versions anyway.
60 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
66 GDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4
67 WINDRES_VERSION=2.14.90
71 STARTUP_NOTIFICATION_VERSION=0.8
74 FONTCONFIG_VERSION=2.7.0
78 dnl Set various checks
79 dnl ========================================================
82 dnl Initialize the Pthread test variables early so they can be
83 dnl overridden by each platform.
84 dnl ========================================================
88 dnl Do not allow objdir == srcdir builds.
89 dnl ==============================================================
90 _topsrcdir=`cd \`dirname $0\`; pwd -W 2>/dev/null || pwd -P`
93 MOZ_BUILD_ROOT=`pwd -W 2>/dev/null || pwd -P`
94 DIST="$MOZ_BUILD_ROOT/dist"
98 if test "$COMPILE_ENVIRONMENT"; then
100 fi # COMPILE_ENVIRONMENT
102 if test -n "$gonkdir"; then
103 dnl export for js/src/configure. We can't pass the option down normally,
104 dnl because it's a `--enable-project=b2g`-only option.
106 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
107 android_source="$gonkdir"
108 ANDROID_SOURCE="$android_source"
110 case "$android_version" in
112 CPPFLAGS="-I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/frameworks/base/include -I$gonkdir/frameworks/base/services/camera -I$gonkdir/frameworks/base/include/media/ -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib -I$gonkdir/dalvik/libnativehelper/include/nativehelper $CPPFLAGS"
116 AC_SUBST(MOZ_OMX_DECODER)
121 CPPFLAGS="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include $CPPFLAGS"
126 AC_SUBST(MOZ_OMX_DECODER)
128 AC_SUBST(MOZ_OMX_ENCODER)
129 AC_DEFINE(MOZ_OMX_ENCODER)
133 CPPFLAGS="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include $CPPFLAGS"
139 AC_DEFINE(MOZ_OMX_ENCODER)
142 AC_SUBST(MOZ_AUDIO_OFFLOAD)
143 AC_DEFINE(MOZ_AUDIO_OFFLOAD)
146 CPPFLAGS="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include $CPPFLAGS"
150 AC_DEFINE(MOZ_OMX_ENCODER)
151 AC_SUBST(MOZ_AUDIO_OFFLOAD)
152 AC_DEFINE(MOZ_AUDIO_OFFLOAD)
158 AC_MSG_ERROR([Unsupported platform version: $android_version])
162 dnl Enable Bluetooth backends depending on available drivers
163 if test -d "$gonkdir/system/bluetoothd"; then
167 if test -d "$gonkdir/external/bluetooth/bluez"; then
172 CPPFLAGS="-I$gonkdir/system -I$gonkdir/system/core/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/external/valgrind/fxos-include $CPPFLAGS"
173 LDFLAGS="-L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib $LDFLAGS"
176 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
177 AC_DEFINE(HAVE_SYS_UIO_H)
178 AC_DEFINE(HAVE_PTHREADS)
180 dnl ANDROID_VERSION is only required for the AC_SUBST below
181 ANDROID_VERSION=$android_version
182 AC_SUBST(ANDROID_VERSION)
188 *-android*|*-linuxandroid*)
193 AC_PATH_PROG(OBJCOPY,objcopy)
204 AC_SUBST(ANDROID_SOURCE)
205 AC_SUBST(ANDROID_PACKAGE_NAME)
208 dnl ========================================================
209 dnl Checks for compilers.
210 dnl ========================================================
212 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
215 if test "$COMPILE_ENVIRONMENT"; then
217 if test "$target" != "$host"; then
223 # Work around the conftest.exe access problem on Windows
228 MOZ_PATH_PROGS(AS, $AS as, $CC)
229 AC_CHECK_PROGS(AR, ar, :)
230 AC_CHECK_PROGS(LD, ld, :)
231 AC_CHECK_PROGS(STRIP, strip, :)
232 AC_CHECK_PROGS(WINDRES, windres, :)
233 AC_CHECK_PROGS(OTOOL, otool, :)
234 if test -z "$HOST_RANLIB"; then
235 HOST_RANLIB="$RANLIB"
237 if test -z "$HOST_AR"; then
240 if test -z "$HOST_AR_FLAGS"; then
241 HOST_AR_FLAGS="$AR_FLAGS"
245 if test -n "$MOZ_WINCONSOLE"; then
246 AC_DEFINE(MOZ_WINCONSOLE)
254 dnl ========================================================
255 dnl Special win32 checks
256 dnl ========================================================
258 # Target the Windows 8.1 SDK by default
262 MOZ_ARG_WITH_STRING(windows-version,
263 [ --with-windows-version=WINSDK_TARGETVER
264 Windows SDK version to target. Win8.1 (603) is
265 currently the minimum supported version.],
266 WINSDK_TARGETVER=$withval)
268 # Currently only version 603 is allowed
269 case "$WINSDK_TARGETVER" in
271 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
275 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
281 if test "$GCC" != "yes"; then
282 # Check to see if we are really running in a msvc environemnt
284 AC_CHECK_PROGS(MIDL, midl)
286 # Make sure compilers are valid
287 CFLAGS="$CFLAGS -TC -nologo"
288 CXXFLAGS="$CXXFLAGS -TP -nologo"
291 AC_TRY_COMPILE([#include <stdio.h>],
292 [ printf("Hello World\n"); ],,
293 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
296 AC_TRY_COMPILE([#include <new.h>],
297 [ unsigned *test = new unsigned(42); ],,
298 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
302 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
305 _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
307 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
308 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
309 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
311 case "$CC_VERSION" in
315 MSVC_C_RUNTIME_DLL=vcruntime140.dll
316 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
318 MOZ_CHECK_HEADER(dia2.h, MSVC_HAS_DIA_SDK=1)
319 if test -n "$MSVC_HAS_DIA_SDK"; then
320 AC_DEFINE(MSVC_HAS_DIA_SDK)
323 # C5026: move constructor was implicitly defined as deleted
324 CXXFLAGS="$CXXFLAGS -wd5026"
326 # C5027: move assignment operator was implicitly defined as deleted
327 CXXFLAGS="$CXXFLAGS -wd5027"
329 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
330 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
332 # Disable C++11 thread-safe statics due to crashes on XP (bug 1204752)
333 # See https://connect.microsoft.com/VisualStudio/feedback/details/1789709/visual-c-2015-runtime-broken-on-windows-server-2003-c-11-magic-statics
334 CXXFLAGS="$CXXFLAGS -Zc:threadSafeInit-"
336 # https://connect.microsoft.com/VisualStudio/feedback/details/888527/warnings-on-dbghelp-h
337 # for dbghelp.h, imagehlp.h, and shobj.h
338 # C4091: 'typedef ': ignored on left of '' when no variable is declared
339 CFLAGS="$CFLAGS -wd4091"
340 CXXFLAGS="$CXXFLAGS -wd4091"
342 # This is intended as a temporary hack to support building with VS2015.
343 # 'noexcept' used with no exception handling mode specified;
344 # termination on exception is not guaranteed. Specify /EHsc
345 CXXFLAGS="$CXXFLAGS -wd4577"
347 if test -n "$WIN_UCRT_REDIST_DIR"; then
348 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
349 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
351 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
355 AC_SUBST(MSVS_VERSION)
356 AC_SUBST(MSVC_HAS_DIA_SDK)
357 AC_SUBST(MSVC_C_RUNTIME_DLL)
358 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
360 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
362 if test -n "$WIN32_REDIST_DIR"; then
363 if test ! -d "$WIN32_REDIST_DIR"; then
364 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
366 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
369 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
370 dnl not something else like "magnetic tape manipulation utility".
371 MSMT_TOOL=`${MT-mt} 2>&1|grep 'Microsoft (R) Manifest Tool'`
372 if test -z "$MSMT_TOOL"; then
373 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
377 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
379 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
380 if test -z "$MSMANIFEST_TOOL_VERSION"; then
381 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
387 # Check linker version
388 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
389 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
390 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
391 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
396 # Set midl environment
399 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
402 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
406 unset _MSVC_VER_FILTER
408 AC_CACHE_CHECK(for overridable _RAISE,
413 _SAVE_CXXFLAGS="$CXXFLAGS"
414 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
415 AC_TRY_COMPILE([#include <xstddef>
417 #define _RAISE(x) externallyDefinedFunction((x).what())
420 [std::vector<int> v; return v.at(1);],
421 ac_cv_have__RAISE="no",
422 ac_cv_have__RAISE="yes")
423 CXXFLAGS="$_SAVE_CXXFLAGS"
426 if test "$ac_cv_have__RAISE" = "yes"; then
428 MOZ_MSVC_STL_WRAP_RAISE=1
429 AC_DEFINE(MOZ_MSVC_STL_WRAP_RAISE)
431 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
434 if test "$WRAP_STL_INCLUDES" = "1"; then
435 STL_FLAGS="-I${DIST}/stl_wrappers"
437 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
438 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
440 # Check w32api version
441 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
442 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
443 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
444 AC_TRY_COMPILE([#include <w32api.h>],
445 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
446 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
447 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
448 #error "test failed."
450 , [ res=yes ], [ res=no ])
451 AC_MSG_RESULT([$res])
452 if test "$res" != "yes"; then
453 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
455 # Check windres version
456 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
457 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
458 AC_MSG_RESULT([$_WINDRES_VERSION])
459 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
460 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
461 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
462 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
463 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
464 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
465 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
466 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
467 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
468 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
469 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
470 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
472 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
475 AC_CHECK_PROGS(MIDL, $target-widl widl)
476 if test -n "$MIDL"; then
479 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
482 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
487 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
488 # causing problems with local implementations with the same name.
489 AC_DEFINE(STRSAFE_NO_DEPRECATE)
492 MOZ_FIND_WINSDK_VERSION
493 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
494 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
495 # Require OS features provided by IE 6.0 SP2 (XP SP2)
496 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
498 # If the maximum version supported by this SDK is lower than the target
500 AC_MSG_CHECKING([for Windows SDK being recent enough])
501 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
505 AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
508 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
509 AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
510 AC_SUBST(MOZ_WINSDK_MAXVER)
514 if test -n "$_WIN32_MSVC"; then
516 SKIP_COMPILER_CHECKS=1
517 SKIP_LIBRARY_CHECKS=1
519 # Since we're skipping compiler and library checks, hard-code
522 AC_DEFINE(HAVE_ISATTY)
525 fi # COMPILE_ENVIRONMENT
536 AC_SUBST(WRAP_STL_INCLUDES)
537 AC_SUBST(MOZ_MSVC_STL_WRAP_RAISE)
539 dnl ========================================================
540 dnl Checks for programs.
541 dnl ========================================================
542 if test -z "$COMPILE_ENVIRONMENT"; then
543 NSINSTALL_BIN='$(PYTHON) $(MOZILLA_DIR)/config/nsinstall.py'
545 AC_SUBST(NSINSTALL_BIN)
547 if test "$COMPILE_ENVIRONMENT"; then
549 dnl ========================================================
550 dnl = Mac OS X toolchain support
551 dnl ========================================================
553 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
554 dnl that a universal binary is being produced.
555 AC_SUBST(UNIVERSAL_BINARY)
557 MOZ_ARG_WITH_STRING(unify-dist,
558 [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
560 if test -n "$UNIVERSAL_BINARY"; then
561 if test -z "$UNIFY_DIST"; then
562 AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
564 case "$UNIFY_DIST" in
568 UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
574 dnl ========================================================
575 dnl = Mac OS X SDK support
576 dnl ========================================================
578 MOZ_ARG_WITH_STRING(macos-sdk,
579 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
580 MACOS_SDK_DIR=$withval)
582 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
583 MOZ_ARG_WITH_STRING(macos-private-frameworks,
584 [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)],
585 MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
586 MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
587 MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
589 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
590 if test -z "$CROSS_COMPILE"; then
591 AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
593 if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
594 AC_MSG_ERROR([PrivateFrameworks directory not found.])
598 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
599 AC_SUBST(MACOS_SDK_DIR)
600 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
602 if test "$MACOS_SDK_DIR"; then
603 dnl Sync this section with the ones in NSPR and NSS.
604 dnl Changes to the cross environment here need to be accounted for in
605 dnl the libIDL checks (below) and xpidl build.
607 if test ! -d "$MACOS_SDK_DIR"; then
608 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
609 specify a valid SDK. SDKs are installed when the optional cross-development
610 tools are selected during the Xcode/Developer Tools installation.])
613 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
614 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
616 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
617 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
618 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
621 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
623 AC_TRY_COMPILE([#include <new>],[],
627 AC_MSG_RESULT($result)
629 if test "$result" = "no" ; then
630 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
634 fi # COMPILE_ENVIRONMENT
636 if test -n "$MAKE"; then
637 if test `echo $MAKE | grep -c make.py` != 1; then
644 MOZ_PATH_PROGS(GMAKE, $GMAKE mingw32-make $NOT_PYMAKE make gmake, :)
647 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
650 if test "$GMAKE" = ":"; then
651 AC_MSG_ERROR([GNU make not found])
655 if test -z "$MAKE"; then
659 if test "$COMPILE_ENVIRONMENT"; then
665 fi # COMPILE_ENVIRONMENT
667 dnl ========================================================
668 dnl set the defaults first
669 dnl ========================================================
681 MOZ_USER_DIR=".mozilla"
683 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
687 dnl Configure platform-specific CPU architecture compiler options.
688 dnl ==============================================================
689 if test "$COMPILE_ENVIRONMENT"; then
692 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
693 dnl Default Android builds to ARMv7.
696 fi # COMPILE_ENVIRONMENT
698 dnl =================================================================
699 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
700 dnl which is bad when cross compiling.
701 dnl =================================================================
702 if test "$COMPILE_ENVIRONMENT"; then
703 configure_static_assert_macros='
704 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
705 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
706 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
709 dnl test that the macros actually work:
710 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
711 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
714 ac_cv_static_assertion_macros_work="yes"
715 AC_TRY_COMPILE([$configure_static_assert_macros],
716 [CONFIGURE_STATIC_ASSERT(1)],
718 ac_cv_static_assertion_macros_work="no")
719 AC_TRY_COMPILE([$configure_static_assert_macros],
720 [CONFIGURE_STATIC_ASSERT(0)],
721 ac_cv_static_assertion_macros_work="no",
724 AC_TRY_COMPILE([$configure_static_assert_macros],
725 [CONFIGURE_STATIC_ASSERT(1)],
727 ac_cv_static_assertion_macros_work="no")
728 AC_TRY_COMPILE([$configure_static_assert_macros],
729 [CONFIGURE_STATIC_ASSERT(0)],
730 ac_cv_static_assertion_macros_work="no",
734 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
735 if test "$ac_cv_static_assertion_macros_work" = "no"; then
736 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
738 fi # COMPILE_ENVIRONMENT
740 dnl ========================================================
741 dnl Android libstdc++, placed here so it can use MOZ_ARCH
743 dnl ========================================================
746 if test "$COMPILE_ENVIRONMENT"; then
748 fi # COMPILE_ENVIRONMENT
750 dnl ========================================================
751 dnl Suppress Clang Argument Warnings
752 dnl ========================================================
753 if test -n "${CLANG_CC}${CLANG_CL}"; then
754 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
755 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
757 if test -n "${CLANG_CXX}${CLANG_CL}"; then
758 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
763 dnl ========================================================
764 dnl = Enable treating compiler warnings as errors
765 dnl ========================================================
766 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
767 [ --enable-warnings-as-errors
768 Enable treating warnings as errors],
769 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
770 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
772 dnl ========================================================
773 dnl GNU specific defaults
774 dnl ========================================================
775 if test "$GNU_CC"; then
779 SSSE3_FLAGS="-mssse3"
780 # FIXME: Let us build with strict aliasing. bug 414641.
781 CFLAGS="$CFLAGS -fno-strict-aliasing"
782 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
783 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
784 WARNINGS_AS_ERRORS='-Werror'
786 DSO_PIC_CFLAGS='-fPIC'
787 ASFLAGS="$ASFLAGS -fPIC"
788 AC_MSG_CHECKING([for --noexecstack option to as])
790 CFLAGS="$CFLAGS -Wa,--noexecstack"
791 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
792 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
795 AC_MSG_CHECKING([for -z noexecstack option to ld])
796 _SAVE_LDFLAGS=$LDFLAGS
797 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
798 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
800 LDFLAGS=$_SAVE_LDFLAGS)
802 AC_MSG_CHECKING([for -z text option to ld])
803 _SAVE_LDFLAGS=$LDFLAGS
804 LDFLAGS="$LDFLAGS -Wl,-z,text"
805 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
806 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
808 LDFLAGS=$_SAVE_LDFLAGS)
810 AC_MSG_CHECKING([for --build-id option to ld])
811 _SAVE_LDFLAGS=$LDFLAGS
812 LDFLAGS="$LDFLAGS -Wl,--build-id"
813 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
814 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
816 LDFLAGS=$_SAVE_LDFLAGS)
818 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
819 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
820 _SAVE_LDFLAGS=$LDFLAGS
821 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
822 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
823 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
825 LDFLAGS=$_SAVE_LDFLAGS
827 # Check for -mssse3 on $CC
828 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
829 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
831 CFLAGS="$CFLAGS -mssse3"
832 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
833 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
837 # Check for -msse4.1 on $CC
838 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
839 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
841 CFLAGS="$CFLAGS -msse4.1"
842 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
843 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
847 case "${CPU_ARCH}" in
849 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
851 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
852 result="yes", result="no")
853 AC_MSG_RESULT("$result")
854 if test "$result" = "yes"; then
860 if test "$GCC_USE_GNU_LD"; then
861 # Some tools like ASan use a runtime library that is only
862 # linked against executables, so we must allow undefined
863 # symbols for shared objects in some cases.
864 if test -z "$MOZ_NO_WLZDEFS"; then
865 # Don't allow undefined symbols in libraries
866 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
868 # BSDs need `environ' exposed for posix_spawn (bug 753046)
870 DragonFly|FreeBSD|NetBSD|OpenBSD)
871 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
872 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
874 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
881 MOZ_SET_WARNINGS_CFLAGS
883 _DEFINES_CFLAGS='-include $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT'
884 _USE_CPP_INCLUDE_FLAG=1
886 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
889 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
890 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
893 if test "$GNU_LD"; then
894 # Don't allow undefined symbols in libraries
895 DSO_LDOPTS="$DSO_LDOPTS -z defs"
899 DSO_PIC_CFLAGS='-KPIC'
900 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
903 if test "$GNU_CXX"; then
904 # FIXME: Let us build with strict aliasing. bug 414641.
905 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
907 MOZ_SET_WARNINGS_CXXFLAGS
909 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(topobjdir)/mozilla-config.h'
910 _USE_CPP_INCLUDE_FLAG=1
913 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
916 dnl ========================================================
917 dnl Checking for 64-bit OS
918 dnl ========================================================
919 if test "$COMPILE_ENVIRONMENT"; then
922 AC_MSG_CHECKING(for 64-bit OS)
923 AC_TRY_COMPILE([$configure_static_assert_macros],
924 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
925 result="yes", result="no")
926 AC_MSG_RESULT("$result")
927 if test "$result" = "yes"; then
928 AC_DEFINE(HAVE_64BIT_BUILD)
931 AC_SUBST(HAVE_64BIT_BUILD)
933 fi # COMPILE_ENVIRONMENT
936 dnl ========================================================
938 dnl ========================================================
939 MOZ_ARG_ENABLE_BOOL(valgrind,
940 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
943 if test -n "$MOZ_VALGRIND"; then
944 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
946 [--enable-valgrind specified but Valgrind is not installed]))
947 AC_DEFINE(MOZ_VALGRIND)
949 AC_SUBST(MOZ_VALGRIND)
951 # For profiling builds keep the symbol information
952 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
954 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
955 STRIP_FLAGS="--strip-debug"
960 dnl ========================================================
961 dnl = Enable Gecko integrated IPC fuzzer
962 dnl ========================================================
963 MOZ_ARG_ENABLE_BOOL(ipc-fuzzer,
964 [ --enable-ipc-fuzzer Enable IPC fuzzer (default=no)],
969 if test -n "$MOZ_FAULTY" && test "$OS_ARCH" = "WINNT"; then
970 AC_MSG_ERROR([--enable-ipc-fuzzer is not supported on this platform.])
973 if test -n "$MOZ_FAULTY"; then
975 AC_DEFINE(MOZ_FAULTY)
978 dnl ========================================================
980 dnl ========================================================
982 if test "$MOZ_DMD"; then
983 if test "${CPU_ARCH}" = "arm"; then
984 CFLAGS="$CFLAGS -funwind-tables"
985 CXXFLAGS="$CXXFLAGS -funwind-tables"
989 dnl ========================================================
990 dnl System overrides of the defaults for host
991 dnl ========================================================
994 if test -n "$_WIN32_MSVC"; then
996 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
997 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
998 HOST_RANLIB='echo ranlib'
1000 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1002 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
1003 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1004 HOST_BIN_SUFFIX=.exe
1006 case "${host_cpu}" in
1008 if test -n "$_WIN32_MSVC"; then
1009 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1013 if test -n "$_WIN32_MSVC"; then
1014 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1016 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1022 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
1023 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1026 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1027 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1028 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1032 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1033 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1037 dnl ==============================================================
1038 dnl Get mozilla version from central milestone file
1039 dnl ==============================================================
1040 MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
1041 MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
1042 MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
1043 if test -z "$MOZILLA_VERSION"; then
1044 AC_MSG_ERROR([failed to read version info from milestone file])
1047 dnl Get version of various core apps from the version files.
1048 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1049 FIREFOX_VERSION_DISPLAY=`cat $_topsrcdir/browser/config/version_display.txt`
1051 if test -z "$FIREFOX_VERSION"; then
1052 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1055 if test -z "$FIREFOX_VERSION_DISPLAY"; then
1056 AC_MSG_ERROR([FIREFOX_VERSION_DISPLAY is unexpectedly blank.])
1059 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1060 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1061 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1062 AC_SUBST(MOZILLA_SYMBOLVERSION)
1064 MOZ_DOING_LTO(lto_is_enabled)
1066 dnl ========================================================
1067 dnl System overrides of the defaults for target
1068 dnl ========================================================
1072 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1073 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1074 MOZ_OPTIMIZE_FLAGS="-O3"
1075 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
1078 STRIP_FLAGS="$STRIP_FLAGS -x -S"
1079 # Ensure that if we're targeting iOS an SDK was provided.
1080 AC_CACHE_CHECK(for iOS target,
1082 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1083 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1087 ac_cv_ios_target="yes",
1088 ac_cv_ios_target="no")])
1089 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
1090 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
1092 if test -n "$MOZ_IOS"; then
1093 direct_nspr_config=1
1095 # The ExceptionHandling framework is needed for Objective-C exception
1096 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1098 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1101 if test "x$lto_is_enabled" = "xyes"; then
1102 echo "Skipping -dead_strip because lto is enabled."
1103 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1104 dnl ===================================================================
1105 elif test "x$enable_dtrace" = "xyes"; then
1106 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1108 dnl check for the presence of the -dead_strip linker flag
1109 AC_MSG_CHECKING([for -dead_strip option to ld])
1110 _SAVE_LDFLAGS=$LDFLAGS
1111 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1112 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1113 if test -n "$_HAVE_DEAD_STRIP" ; then
1114 AC_MSG_RESULT([yes])
1115 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1120 LDFLAGS=$_SAVE_LDFLAGS
1123 dnl With newer linkers we need to pass -allow_heap_execute because of
1124 dnl Microsoft Silverlight (5.1.10411.0 at least).
1125 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1126 _SAVE_LDFLAGS=$LDFLAGS
1127 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1128 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1129 _HAVE_ALLOW_HEAP_EXECUTE=)
1130 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1131 AC_MSG_RESULT([yes])
1132 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1136 LDFLAGS=$_SAVE_LDFLAGS
1138 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
1141 *-android*|*-linuxandroid*)
1142 AC_DEFINE(NO_PW_GECOS)
1143 if test -n "$gonkdir"; then
1144 _PLATFORM_HAVE_RIL=1
1148 if test "$COMPILE_ENVIRONMENT"; then
1153 MOZ_GFX_OPTIMIZE_MOBILE=1
1154 MOZ_OPTIMIZE_FLAGS="-Os"
1155 if test -z "$CLANG_CC"; then
1156 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_FLAGS"
1161 if test "$GNU_CC" -o "$GNU_CXX"; then
1162 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
1163 MOZ_OPTIMIZE_FLAGS="-Os"
1164 if test -z "$CLANG_CC"; then
1165 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
1169 case "${target_cpu}" in
1171 CFLAGS="$CFLAGS -mieee"
1172 CXXFLAGS="$CXXFLAGS -mieee"
1181 # certain versions of cygwin's makedepend barf on the
1182 # #include <string> vs -I./dist/include/string issue so don't use it
1183 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
1185 CXX="$CXX -mwindows"
1186 CPP="$CPP -mwindows"
1187 CFLAGS="$CFLAGS -mms-bitfields"
1188 CXXFLAGS="$CXXFLAGS -mms-bitfields"
1189 DSO_LDOPTS='-shared'
1190 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1191 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1193 # Use static libgcc and libstdc++
1194 LDFLAGS="$LDFLAGS -static"
1195 NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
1196 # Use temp file for windres (bug 213281)
1197 RCFLAGS='-O coff --use-temp-file'
1198 # mingw doesn't require kernel32, user32, and advapi32 explicitly
1199 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
1204 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
1205 WIN32_GUI_EXE_LDFLAGS=-mwindows
1207 # GCC/binutils can't link to a function if we try to include dllexport function
1208 # in the same library as dllimport caller. To work around it, we build NSPR
1209 # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
1210 # function thunks need to be generated for cross-DLL calls.
1211 MOZ_FOLD_LIBS_FLAGS=-mnop-fun-dllimport
1213 # We use mix of both POSIX and Win32 printf format across the tree, so format
1214 # warnings are useless on mingw.
1215 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
1216 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
1218 TARGET_COMPILER_ABI=msvc
1220 if test "$AS_BIN"; then
1221 AS="$(basename "$AS_BIN")"
1224 AR_FLAGS='-NOLOGO -OUT:$@'
1226 RANLIB='echo not_ranlib'
1227 STRIP='echo not_strip'
1233 IMPORT_LIB_SUFFIX=lib
1234 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1235 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1236 dnl Set subsystem version 5 for Windows XP.
1237 if test "$CPU_ARCH" = "x86"; then
1238 WIN32_SUBSYSTEM_VERSION=5.01
1240 WIN32_SUBSYSTEM_VERSION=6.01
1242 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
1243 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
1244 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
1245 _USE_CPP_INCLUDE_FLAG=1
1246 _DEFINES_CFLAGS='-FI $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT'
1247 _DEFINES_CXXFLAGS='-FI $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT'
1248 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
1249 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
1250 if test "$CPU_ARCH" = "x86"; then
1251 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
1252 dnl more recent, so set that explicitly here unless another
1253 dnl target arch has already been set.
1254 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
1255 CFLAGS="$CFLAGS -arch:SSE2"
1257 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
1258 CXXFLAGS="$CXXFLAGS -arch:SSE2"
1260 SSE_FLAGS="-arch:SSE"
1261 SSE2_FLAGS="-arch:SSE2"
1262 dnl MSVC allows the use of intrinsics without any flags
1263 dnl and doesn't have a separate arch for SSSE3
1264 SSSE3_FLAGS="-arch:SSE2"
1266 dnl VS2013+ requires -FS when parallel building by make -jN.
1267 dnl If nothing, compiler sometimes causes C1041 error.
1268 CFLAGS="$CFLAGS -FS"
1269 CXXFLAGS="$CXXFLAGS -FS"
1270 # khuey says we can safely ignore MSVC warning C4251
1271 # MSVC warning C4244 (implicit type conversion may lose data) warns
1272 # and requires workarounds for perfectly valid code. Also, GCC/clang
1273 # don't warn about it by default. So for consistency/sanity, we turn
1274 # it off on MSVC, too.
1275 # MSVC warning C4267 warns for narrowing type conversions from size_t
1276 # to 32-bit integer types on 64-bit platforms. Since this is virtually
1277 # the same thing as C4244, we disable C4267, too.
1278 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
1279 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
1280 # MSVC warning C4800 warns when a value is implicitly cast to bool,
1281 # because this also forces narrowing to a single byte, which can be a
1282 # perf hit. But this matters so little in practice (and often we want
1283 # that behavior) that it's better to turn it off.
1284 # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
1285 # on non-Western system locales even if it is in a comment.
1286 # MSVC warning wd4595 warns non-member operator new or delete functions
1287 # may not be declared inline, as of VS2015 Update 2.
1288 CFLAGS="$CFLAGS -wd4244 -wd4267 -wd4819"
1289 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4345 -wd4351 -wd4800 -wd4819 -wd4595"
1290 if test -n "$CLANG_CL"; then
1291 # XXX We should combine some of these with our generic GCC-style
1294 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
1295 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
1296 # We use offsetof on non-POD objects all the time.
1297 # We also suppress this warning on other platforms.
1298 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
1299 # MFBT thinks clang-cl supports constexpr, which it does, but
1300 # not everything in Windows C++ headers supports constexpr
1301 # as we might expect until MSVC 2015, so turn off this warning
1303 CXXFLAGS="$CXXFLAGS -Wno-invalid-constexpr"
1304 # This warns for reasonable things like:
1305 # enum { X = 0xffffffffU };
1306 # which is annoying for IDL headers.
1307 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
1308 # This warns for cases that would be reached by the Microsoft
1309 # #include rules, but also currently warns on cases that would
1310 # *also* be reached by standard C++ include rules. That
1311 # behavior doesn't seem useful, so we turn it off.
1312 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
1313 # We normally error out on unknown pragmas, but since clang-cl
1314 # claims to be MSVC, it would be difficult to add
1315 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
1316 # use such pragmas, so just ignore them.
1317 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
1318 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
1319 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
1320 # as __attribute((__deprecated__)). This is nice to know,
1321 # but since we don't get the equivalent warning from MSVC,
1322 # let's just ignore it.
1323 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
1324 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
1325 # We use a function like:
1326 # __declspec(noreturn) __inline void f() {}
1327 # which -Winvalid-noreturn complains about. Again, MSVC seems
1328 # OK with it, so let's silence the warning.
1329 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
1330 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
1331 # Missing |override| on virtual function declarations isn't
1332 # something that MSVC currently warns about.
1333 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
1334 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
1335 # declaration on |operator delete(void*)|. However, clang-cl
1336 # must internally declare |operator delete(void*)| differently,
1337 # which causes this warning for virtually every file in the
1338 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
1339 # so there doesn't seem to be any way to convince clang-cl to
1340 # declare |delete| differently. Therefore, suppress this
1342 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
1343 # At least one MSVC header and several headers in-tree have
1344 # unused typedefs, so turn this on.
1345 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
1346 # Several JS engine header files use __declspec(dllimport) on
1347 # classes, and clang-cl helpfully warns about its non-support
1348 # for such cases. We're not particularly worried about that,
1349 # so ignore that warning.
1350 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
1352 # make 'foo == bar;' error out
1353 CFLAGS="$CFLAGS -we4553"
1354 CXXFLAGS="$CXXFLAGS -we4553"
1355 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
1356 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1357 WARNINGS_AS_ERRORS='-WX'
1358 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
1360 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
1361 if test -z "$DEVELOPER_OPTIONS"; then
1362 LDFLAGS="$LDFLAGS -RELEASE"
1364 dnl For profile-guided optimization
1365 PROFILE_GEN_CFLAGS="-GL"
1366 num_cores=$($PYTHON -c 'import multiprocessing; print(min(8,multiprocessing.cpu_count()))')
1367 cgthreads="-CGTHREADS:${num_cores}"
1368 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT -PogoSafeMode $cgthreads"
1369 dnl XXX: PGO builds can fail with warnings treated as errors,
1370 dnl specifically "no profile data available" appears to be
1371 dnl treated as an error sometimes. This might be a consequence
1372 dnl of using WARNINGS_AS_ERRORS in some modules, combined
1373 dnl with the linker doing most of the work in the whole-program
1374 dnl optimization/PGO case. I think it's probably a compiler bug,
1375 dnl but we work around it here.
1376 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
1377 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
1378 dnl Probably also a compiler bug, but what can you do?
1379 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE $cgthreads"
1380 LDFLAGS="$LDFLAGS -DYNAMICBASE"
1382 if test "$CC_VERSION" = "18.00.31101"; then
1383 dnl Use MaxILKSize as a workaround for LNK1248 in VS2013update4
1384 dnl See https://connect.microsoft.com/VisualStudio/feedback/details/1044914/fatal-error-lnk1248
1385 LDFLAGS="$LDFLAGS -MaxILKSize:0x7FF00000"
1387 dnl Minimum reqiurement of Gecko is VS2010 or later which supports
1388 dnl both SSSE3 and SSE4.1.
1389 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
1390 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
1391 dnl allow AVX2 code from VS2012
1394 AC_DEFINE(STDC_HEADERS)
1395 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1396 dnl See http://support.microsoft.com/kb/143208 to use STL
1399 MOZ_USER_DIR="Mozilla"
1403 AC_MSG_ERROR([Using a Cygwin build environment is unsupported. Configure cannot check for presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
1409 if test "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
1410 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
1413 if test -n "$GNU_CC"; then
1414 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
1415 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
1416 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
1418 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1419 LDFLAGS="$LDFLAGS -SAFESEH"
1425 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
1426 AC_MSG_ERROR([You are targeting 64-bit but using the 32-bit compiler.])
1428 if test -n "$_WIN32_MSVC"; then
1429 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1434 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1441 CFLAGS="$CFLAGS -Dunix"
1442 CXXFLAGS="$CXXFLAGS -Dunix"
1443 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1445 DSO_PIC_CFLAGS='-fPIC -DPIC'
1446 DSO_LDOPTS='-shared'
1447 BIN_FLAGS='-Wl,--export-dynamic'
1449 DSO_PIC_CFLAGS='-fPIC -DPIC'
1450 DLL_SUFFIX=".so.1.0"
1451 DSO_LDOPTS='-shared'
1453 # This will fail on a.out systems prior to 1.5.1_ALPHA.
1454 if test "$LIBRUNPATH"; then
1455 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1457 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1458 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1462 if test "$SO_VERSION"; then
1463 DLL_SUFFIX=".so.$SO_VERSION"
1465 DLL_SUFFIX=".so.1.0"
1467 if test -z "$X11BASE"; then
1470 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
1472 DSO_PIC_CFLAGS='-fPIC'
1473 DSO_LDOPTS='-shared -fPIC'
1474 if test "$LIBRUNPATH"; then
1475 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1481 AC_SUBST_LIST(MMX_FLAGS)
1482 AC_SUBST_LIST(SSE_FLAGS)
1483 AC_SUBST_LIST(SSE2_FLAGS)
1484 AC_SUBST_LIST(SSSE3_FLAGS)
1486 AC_SUBST(MOZ_LINKER)
1487 if test -n "$MOZ_LINKER"; then
1488 AC_DEFINE(MOZ_LINKER)
1491 dnl Only one oddball right now (QNX), but this gives us flexibility
1492 dnl if any other platforms need to override this in the future.
1493 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
1495 dnl ========================================================
1496 dnl = Flags to strip unused symbols from .so components and
1497 dnl = to export jemalloc symbols when linking a program
1498 dnl ========================================================
1500 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1501 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1504 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
1507 if test -n "$GNU_CC"; then
1508 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1513 if test -z "$COMPILE_ENVIRONMENT"; then
1514 SKIP_COMPILER_CHECKS=1
1515 SKIP_LIBRARY_CHECKS=1
1519 fi # COMPILE_ENVIRONMENT
1521 if test -z "$SKIP_COMPILER_CHECKS"; then
1522 dnl Checks for typedefs, structures, and compiler characteristics.
1523 dnl ========================================================
1539 dnl Check for .hidden assembler directive and visibility attribute.
1540 dnl Borrowed from glibc configure.in
1541 dnl ===============================================================
1542 if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
1543 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
1544 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
1545 case "$OS_TARGET" in
1547 VISIBILITY_FLAGS='-fvisibility=hidden -fvisibility-inlines-hidden'
1550 VISIBILITY_FLAGS="-I${DIST}/system_wrappers -include ${_topsrcdir}/config/gcc_hidden.h"
1551 WRAP_SYSTEM_INCLUDES=1
1556 case "${OS_TARGET}" in
1560 STL_FLAGS="-I${DIST}/stl_wrappers"
1565 AC_SUBST(WRAP_SYSTEM_INCLUDES)
1566 AC_SUBST_LIST(VISIBILITY_FLAGS)
1568 dnl Checks for header files.
1569 dnl ========================================================
1571 case "$target_os" in
1573 # for stuff like -lXshm
1574 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1577 MOZ_CHECK_COMMON_HEADERS
1579 dnl These are all the places some variant of statfs can be hiding.
1580 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
1583 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
1584 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
1586 dnl SCTP support - needs various network include headers
1587 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
1588 MOZ_CHECK_HEADERS(sys/queue.h)
1590 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
1592 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1593 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1594 ac_cv_sockaddr_in_sin_len,
1595 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1596 #include <sys/types.h>
1598 #include <netinet/in.h>
1599 struct sockaddr_in x;
1600 void *foo = (void*) &x.sin_len;],
1602 [ac_cv_sockaddr_in_sin_len=true],
1603 [ac_cv_sockaddr_in_sin_len=false])])
1604 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1605 AC_DEFINE(HAVE_SIN_LEN)
1606 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1607 AC_DEFINE(HAVE_SCONN_LEN)
1610 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1611 ac_cv_sockaddr_in6_sin6_len,
1612 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1613 #include <sys/types.h>
1615 #include <netinet/in.h>
1616 struct sockaddr_in6 x;
1617 void *foo = (void*) &x.sin6_len;],
1619 [ac_cv_sockaddr_in6_sin6_len=true],
1620 [ac_cv_sockaddr_in6_sin6_len=false])])
1621 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1622 AC_DEFINE(HAVE_SIN6_LEN)
1625 AC_CACHE_CHECK(for sockaddr.sa_len,
1626 ac_cv_sockaddr_sa_len,
1627 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1628 #include <sys/types.h>
1630 #include <sys/socket.h>
1632 void *foo = (void*) &x.sa_len;],
1634 [ac_cv_sockaddr_sa_len=true],
1635 [ac_cv_sockaddr_sa_len=false])])
1636 if test "$ac_cv_sockaddr_sa_len" = true ; then
1637 AC_DEFINE(HAVE_SA_LEN)
1640 MOZ_ARG_ENABLE_BOOL(dtrace,
1641 [ --enable-dtrace build with dtrace support if available (default=no)],
1642 [enable_dtrace="yes"],)
1643 if test "x$enable_dtrace" = "xyes"; then
1644 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1645 if test -n "$HAVE_DTRACE"; then
1646 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1648 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1651 AC_SUBST(HAVE_DTRACE)
1653 MOZ_LINUX_PERF_EVENT
1655 dnl Checks for libraries.
1656 dnl ========================================================
1657 AC_CHECK_LIB(c_r, gethostbyname_r)
1659 dnl We don't want to link with libdl even if it's present on OS X, since
1660 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1662 dnl We don't want to link against libm or libpthread on Darwin since
1663 dnl they both are just symlinks to libSystem and explicitly linking
1664 dnl against libSystem causes issues when debugging (see bug 299601).
1669 AC_SEARCH_LIBS(dlopen, dl,
1670 MOZ_CHECK_HEADER(dlfcn.h,
1671 AC_DEFINE(HAVE_DLOPEN)))
1675 _SAVE_CFLAGS="$CFLAGS"
1676 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1677 AC_CHECK_FUNCS(dladdr memmem)
1678 CFLAGS="$_SAVE_CFLAGS"
1680 if test ! "$GNU_CXX"; then
1681 AC_CHECK_LIB(C, demangle)
1684 AC_CHECK_LIB(socket, socket)
1687 XLIBS="$X_EXTRA_LIBS"
1689 dnl ========================================================
1690 dnl Checks for X libraries.
1691 dnl Ordering is important.
1692 dnl Xt is dependent upon SM as of X11R6
1693 dnl ========================================================
1694 if test -n "$MOZ_X11"; then
1695 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1696 XLIBS="-lX11-xcb -lX11 -lxcb-shm -lxcb $XLIBS"
1697 _SAVE_LDFLAGS="$LDFLAGS"
1699 LDFLAGS="$XLDFLAGS $LDFLAGS"
1700 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
1701 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1702 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1703 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1705 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1706 unset ac_cv_lib_Xt_XtFree
1707 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1708 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1709 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1710 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1713 dnl ========================================================
1715 dnl ========================================================
1716 AC_CHECK_LIB(X11-xcb, XGetXCBConnection,, [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1717 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version,, [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1718 AC_CHECK_LIB(xcb, xcb_connect,, [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1720 dnl ========================================================
1722 dnl ========================================================
1723 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
1724 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
1725 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
1726 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
1728 LDFLAGS="$_SAVE_LDFLAGS"
1732 AC_SUBST_LIST(XCFLAGS)
1733 AC_SUBST_LIST(XLDFLAGS)
1734 AC_SUBST_LIST(XLIBS)
1735 AC_SUBST_LIST(XEXT_LIBS)
1736 AC_SUBST_LIST(XT_LIBS)
1737 AC_SUBST_LIST(XSS_LIBS)
1739 dnl ========================================================
1740 dnl = pthread support
1741 dnl = Start by checking whether the system support pthreads
1742 dnl ========================================================
1743 case "$target_os" in
1748 AC_CHECK_LIB(pthreads, pthread_create,
1749 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1750 AC_CHECK_LIB(pthread, pthread_create,
1751 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1752 AC_CHECK_LIB(c_r, pthread_create,
1753 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1754 AC_CHECK_LIB(c, pthread_create,
1763 dnl ========================================================
1764 dnl Check the command line for --with-pthreads
1765 dnl ========================================================
1766 MOZ_ARG_WITH_BOOL(pthreads,
1767 [ --with-pthreads Force use of system pthread library with NSPR ],
1768 [ if test "$MOZ_USE_PTHREADS"x = x; then
1769 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
1775 dnl ========================================================
1776 dnl Do the platform specific pthread hackery
1777 dnl ========================================================
1778 if test "$MOZ_USE_PTHREADS"x != x
1781 dnl See if -pthread is supported.
1784 ac_cv_have_dash_pthread=no
1785 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1786 echo 'int main() { return 0; }' | cat > conftest.c
1787 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1788 if test $? -eq 0; then
1789 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1790 ac_cv_have_dash_pthread=yes
1791 case "$target_os" in
1793 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1796 CFLAGS="$CFLAGS -pthread"
1797 CXXFLAGS="$CXXFLAGS -pthread"
1803 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1806 dnl See if -pthreads is supported.
1808 ac_cv_have_dash_pthreads=no
1809 if test "$ac_cv_have_dash_pthread" = "no"; then
1810 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1811 echo 'int main() { return 0; }' | cat > conftest.c
1812 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1813 if test $? -eq 0; then
1814 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1815 ac_cv_have_dash_pthreads=yes
1816 CFLAGS="$CFLAGS -pthreads"
1817 CXXFLAGS="$CXXFLAGS -pthreads"
1821 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1826 AC_DEFINE(_REENTRANT)
1827 AC_DEFINE(_THREAD_SAFE)
1828 dnl -pthread links in -lpthread, so don't specify it explicitly.
1829 if test "$ac_cv_have_dash_pthread" = "yes"; then
1830 _PTHREAD_LDFLAGS="-pthread"
1834 *-*-openbsd*|*-*-bsdi*)
1835 AC_DEFINE(_REENTRANT)
1836 AC_DEFINE(_THREAD_SAFE)
1837 dnl -pthread links in -lc_r, so don't specify it explicitly.
1838 if test "$ac_cv_have_dash_pthread" = "yes"; then
1839 _PTHREAD_LDFLAGS="-pthread"
1843 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1844 AC_DEFINE(_REENTRANT)
1848 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1849 AC_SUBST(MOZ_USE_PTHREADS)
1850 MOZ_CHECK_HEADERS(pthread.h)
1854 dnl Checks for library functions.
1855 dnl ========================================================
1856 AC_PROG_GCC_TRADITIONAL
1858 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1860 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1861 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1862 ac_cv_clock_monotonic,
1863 [for libs in "" -lrt; do
1866 AC_TRY_LINK([#include <time.h>],
1867 [ struct timespec ts;
1868 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1869 ac_cv_clock_monotonic=$libs
1872 ac_cv_clock_monotonic=no)
1875 if test "$ac_cv_clock_monotonic" != "no"; then
1876 HAVE_CLOCK_MONOTONIC=1
1877 REALTIME_LIBS=$ac_cv_clock_monotonic
1878 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1879 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1880 AC_SUBST_LIST(REALTIME_LIBS)
1883 dnl check for wcrtomb/mbrtowc
1884 dnl =======================================================================
1885 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
1888 AC_CACHE_CHECK(for wcrtomb,
1890 [AC_TRY_LINK([#include <wchar.h>],
1891 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
1892 ac_cv_have_wcrtomb="yes",
1893 ac_cv_have_wcrtomb="no")])
1894 if test "$ac_cv_have_wcrtomb" = "yes"; then
1895 AC_DEFINE(HAVE_WCRTOMB)
1897 AC_CACHE_CHECK(for mbrtowc,
1899 [AC_TRY_LINK([#include <wchar.h>],
1900 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
1901 ac_cv_have_mbrtowc="yes",
1902 ac_cv_have_mbrtowc="no")])
1903 if test "$ac_cv_have_mbrtowc" = "yes"; then
1904 AC_DEFINE(HAVE_MBRTOWC)
1911 ac_cv_func_res_ninit,
1912 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1913 dnl no need for res_ninit() on NetBSD and OpenBSD
1914 ac_cv_func_res_ninit=no
1918 #define _BSD_SOURCE 1
1920 #include <sys/types.h>
1921 #include <netinet/in.h>
1922 #include <arpa/nameser.h>
1925 [int foo = res_ninit(&_res);],
1926 [ac_cv_func_res_ninit=yes],
1927 [ac_cv_func_res_ninit=no])
1931 if test "$ac_cv_func_res_ninit" = "yes"; then
1932 AC_DEFINE(HAVE_RES_NINIT)
1933 dnl must add the link line we do something as foolish as this... dougt
1935 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1936 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1948 AC_CHECK_LIB(c, iconv, [ICONV_LIBS=],
1949 AC_CHECK_LIB(iconv, iconv, [ICONV_LIBS="-liconv"],
1950 AC_CHECK_LIB(iconv, libiconv, [ICONV_LIBS="-liconv"])))
1952 LIBS="$LIBS $ICONV_LIBS"
1961 iconv_t h = iconv_open("", "");
1962 iconv(h, NULL, NULL, NULL, NULL);
1965 [ac_cv_func_iconv=yes],
1966 [ac_cv_func_iconv=no]
1969 if test "$ac_cv_func_iconv" = "yes"; then
1970 AC_DEFINE(HAVE_ICONV)
1971 LIBICONV="$ICONV_LIBS"
1973 [for iconv() with const input],
1974 ac_cv_func_const_iconv,
1980 const char *input = "testing";
1981 iconv_t h = iconv_open("", "");
1982 iconv(h, &input, NULL, NULL, NULL);
1985 [ac_cv_func_const_iconv=yes],
1986 [ac_cv_func_const_iconv=no]
1989 if test "$ac_cv_func_const_iconv" = "yes"; then
1990 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
1998 AC_SUBST_LIST(ICONV_LIBS)
2004 dnl **********************
2005 dnl *** va_copy checks ***
2006 AC_CACHE_CHECK([for an implementation of va_copy()],
2008 [AC_TRY_COMPILE([#include <stdarg.h>
2010 void f (int i, ...) {
2011 va_list args1, args2;
2012 va_start (args1, i);
2013 va_copy (args2, args1);
2014 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2016 va_end (args1); va_end (args2);
2018 [f(0, 42); return 0],
2019 [ac_cv_va_copy=yes],
2023 AC_CACHE_CHECK([whether va_list can be copied by value],
2025 [AC_TRY_COMPILE([#include <stdarg.h>
2027 void f (int i, ...) {
2028 va_list args1, args2;
2029 va_start (args1, i);
2031 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2033 va_end (args1); va_end (args2);
2035 [f(0, 42); return 0],
2036 [ac_cv_va_val_copy=yes],
2037 [ac_cv_va_val_copy=no],
2040 if test "x$ac_cv_va_copy" = "xyes"; then
2041 AC_DEFINE(VA_COPY, va_copy)
2042 AC_DEFINE(HAVE_VA_COPY)
2045 if test "x$ac_cv_va_val_copy" = "xno"; then
2046 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2049 dnl ===================================================================
2050 dnl ========================================================
2051 dnl Put your C++ language/feature checks below
2052 dnl ========================================================
2056 if test "$GNU_CC"; then
2057 if test "$CPU_ARCH" = "arm" ; then
2058 AC_CACHE_CHECK(for ARM EABI,
2062 #if defined(__ARM_EABI__)
2065 #error Not ARM EABI.
2068 ac_cv_gcc_arm_eabi="yes",
2069 ac_cv_gcc_arm_eabi="no")])
2070 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
2072 ARM_ABI_PREFIX=eabi-
2074 ARM_ABI_PREFIX=oabi-
2078 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
2081 dnl Check to see if we can resolve ambiguity with |using|.
2082 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
2083 ac_cv_cpp_ambiguity_resolving_using,
2084 [AC_TRY_COMPILE(class X {
2085 public: int go(const X&) {return 3;}
2086 int jo(const X&) {return 3;}
2088 class Y : public X {
2089 public: int go(int) {return 2;}
2090 int jo(int) {return 2;}
2092 private: using X::go;
2095 ac_cv_cpp_ambiguity_resolving_using=yes,
2096 ac_cv_cpp_ambiguity_resolving_using=no)])
2097 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
2098 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
2101 dnl See if a dynamic_cast to void* gives the most derived object.
2102 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
2103 ac_cv_cpp_dynamic_cast_void_ptr,
2104 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
2105 class Y { int j; public: virtual ~Y() { } };
2106 class Z : public X, public Y { int k; };
2112 return !((((void*)&mdo != (void*)subx) &&
2113 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
2114 (((void*)&mdo != (void*)suby) &&
2115 ((void*)&mdo == dynamic_cast<void*>(suby))));
2117 ac_cv_cpp_dynamic_cast_void_ptr=yes,
2118 ac_cv_cpp_dynamic_cast_void_ptr=no,
2119 ac_cv_cpp_dynamic_cast_void_ptr=no)])
2120 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
2121 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
2125 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
2126 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
2127 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
2129 _SAVE_LDFLAGS=$LDFLAGS
2130 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
2131 AC_CACHE_CHECK(for __thread keyword for TLS variables,
2132 ac_cv_thread_keyword,
2133 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
2134 [return tlsIsMainThread;],
2135 ac_cv_thread_keyword=yes,
2136 ac_cv_thread_keyword=no)])
2137 LDFLAGS=$_SAVE_LDFLAGS
2138 # The custom dynamic linker doesn't support TLS variables
2140 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
2141 # mips builds fail with TLS variables because of a binutils bug.
2143 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
2148 *-android*|*-linuxandroid*)
2155 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
2161 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
2162 if test -n "$MOZ_LINKER"; then
2163 if test "$CPU_ARCH" = arm; then
2164 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
2165 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
2166 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
2167 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
2171 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
2172 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
2173 dnl Since the linker only understands the sysv ones, no need to build the
2174 dnl gnu style tables anyways.
2175 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
2178 dnl The custom linker doesn't support text relocations, but NDK >= r6b
2179 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
2180 dnl We however want to avoid these text relocations, and this can be done
2181 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
2182 dnl doesn't contain anything at all, beside placeholders for some sections,
2183 dnl and crtbegin only contains a finalizer function that calls
2184 dnl __cxa_finalize. The custom linker actually takes care of calling
2185 dnl __cxa_finalize when the library doesn't call it itself, which makes it
2186 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
2187 dnl link crtbegin and crtend at all.
2188 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
2189 AC_CACHE_CHECK([whether the CRT objects have text relocations],
2190 ac_cv_crt_has_text_relocations,
2191 [echo 'int foo() { return 0; }' > conftest.cpp
2192 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
2193 test -s conftest${DLL_SUFFIX}; then
2194 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
2195 ac_cv_crt_has_text_relocations=yes
2197 ac_cv_crt_has_text_relocations=no
2200 AC_ERROR([couldn't compile a simple C file])
2203 if test "$ac_cv_crt_has_text_relocations" = yes; then
2204 dnl While we want libraries to skip the CRT files, we don't want
2205 dnl executables to be treated the same way. We thus set the flag
2206 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
2207 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
2208 dnl Using LDFLAGS in nspr is safe, since we only really build
2209 dnl libraries there.
2210 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
2211 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
2215 dnl See if compiler supports some gcc-style attributes
2217 AC_CACHE_CHECK(for __attribute__((always_inline)),
2218 ac_cv_attribute_always_inline,
2219 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
2221 ac_cv_attribute_always_inline=yes,
2222 ac_cv_attribute_always_inline=no)])
2224 dnl End of C++ language/feature checks
2227 dnl ========================================================
2228 dnl = Internationalization checks
2229 dnl ========================================================
2231 dnl Internationalization and Locale support is different
2232 dnl on various UNIX platforms. Checks for specific i18n
2233 dnl features go here.
2235 dnl check for LC_MESSAGES
2236 AC_CACHE_CHECK(for LC_MESSAGES,
2237 ac_cv_i18n_lc_messages,
2238 [AC_TRY_COMPILE([#include <locale.h>],
2239 [int category = LC_MESSAGES;],
2240 ac_cv_i18n_lc_messages=yes,
2241 ac_cv_i18n_lc_messages=no)])
2242 if test "$ac_cv_i18n_lc_messages" = yes; then
2243 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
2246 AC_HAVE_FUNCS(localeconv)
2247 fi # ! SKIP_COMPILER_CHECKS
2252 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
2253 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
2254 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
2257 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
2258 dnl features that Windows actually does support.
2260 if test -n "$SKIP_COMPILER_CHECKS"; then
2261 dnl Windows has malloc.h
2262 AC_DEFINE(MALLOC_H, [<malloc.h>])
2263 AC_DEFINE(HAVE_FORCEINLINE)
2264 AC_DEFINE(HAVE_LOCALECONV)
2265 fi # SKIP_COMPILER_CHECKS
2267 dnl Mozilla specific options
2268 dnl ========================================================
2269 dnl The macros used for command line options
2270 dnl are defined in build/autoconf/altoptions.m4.
2272 dnl ========================================================
2274 dnl = Check for external package dependencies
2276 dnl ========================================================
2277 MOZ_ARG_HEADER(External Packages)
2279 case "$OS_TARGET" in
2280 WINNT|Darwin|Android)
2290 dnl ========================================================
2291 dnl system libevent Support
2292 dnl ========================================================
2293 MOZ_ARG_WITH_STRING(system-libevent,
2294 [ --with-system-libevent[=PFX]
2295 Use system libevent [installed at prefix PFX]],
2296 LIBEVENT_DIR=$withval)
2298 _SAVE_CFLAGS=$CFLAGS
2299 _SAVE_LDFLAGS=$LDFLAGS
2301 if test "$LIBEVENT_DIR" = yes; then
2302 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
2303 MOZ_SYSTEM_LIBEVENT=1,
2306 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
2307 MOZ_SYSTEM_LIBEVENT=
2308 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
2309 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
2310 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
2311 MOZ_CHECK_HEADER(event.h,
2312 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
2313 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
2315 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
2316 AC_CHECK_LIB(event, event_init,
2317 [MOZ_SYSTEM_LIBEVENT=1
2318 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
2319 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
2320 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
2322 CFLAGS=$_SAVE_CFLAGS
2323 LDFLAGS=$_SAVE_LDFLAGS
2326 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
2328 dnl ========================================================
2329 dnl = If NSS was not detected in the system,
2330 dnl = use the one in the source tree (mozilla/security/nss)
2331 dnl ========================================================
2333 MOZ_ARG_WITH_BOOL(system-nss,
2334 [ --with-system-nss Use system installed NSS],
2337 if test -n "$_USE_SYSTEM_NSS"; then
2338 AM_PATH_NSS(3.26, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
2341 if test -n "$MOZ_SYSTEM_NSS"; then
2342 NSS_LIBS="$NSS_LIBS -lcrmf"
2344 NSS_CFLAGS="-I${DIST}/include/nss"
2347 if test -z "$SKIP_LIBRARY_CHECKS"; then
2348 dnl system JPEG support
2349 dnl ========================================================
2350 MOZ_ARG_WITH_STRING(system-jpeg,
2351 [ --with-system-jpeg[=PFX]
2352 Use system libjpeg [installed at prefix PFX]],
2355 _SAVE_CFLAGS=$CFLAGS
2356 _SAVE_LDFLAGS=$LDFLAGS
2358 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
2359 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
2360 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
2362 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
2365 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_SYSTEM_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_SYSTEM_JPEG=)
2368 if test "$MOZ_SYSTEM_JPEG" = 1; then
2369 AC_TRY_COMPILE([ #include <stdio.h>
2370 #include <sys/types.h>
2371 #include <jpeglib.h> ],
2372 [ #if JPEG_LIB_VERSION < $MOZJPEG
2373 #error "Insufficient JPEG library version ($MOZJPEG required)."
2375 #ifndef JCS_EXTENSIONS
2376 #error "libjpeg-turbo JCS_EXTENSIONS required"
2380 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
2382 CFLAGS=$_SAVE_CFLAGS
2383 LDFLAGS=$_SAVE_LDFLAGS
2386 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_SYSTEM_JPEG" = 1; then
2387 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
2388 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
2390 fi # SKIP_LIBRARY_CHECKS
2392 dnl system ZLIB support
2393 dnl ========================================================
2394 MOZ_ZLIB_CHECK([1.2.3])
2396 if test "$MOZ_LINKER" = 1 -a "$MOZ_SYSTEM_ZLIB" != 1; then
2397 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
2402 if test -z "$SKIP_LIBRARY_CHECKS"; then
2403 dnl system BZIP2 Support
2404 dnl ========================================================
2405 MOZ_ARG_WITH_STRING(system-bz2,
2406 [ --with-system-bz2[=PFX]
2407 Use system libbz2 [installed at prefix PFX]],
2410 _SAVE_CFLAGS=$CFLAGS
2411 _SAVE_LDFLAGS=$LDFLAGS
2413 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
2414 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
2415 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
2417 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
2420 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_SYSTEM_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
2421 [MOZ_SYSTEM_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
2423 CFLAGS=$_SAVE_CFLAGS
2424 LDFLAGS=$_SAVE_LDFLAGS
2427 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_SYSTEM_BZ2" = 1; then
2428 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
2429 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
2432 dnl ========================================================
2433 dnl system PNG Support
2434 dnl ========================================================
2435 MOZ_ARG_WITH_STRING(system-png,
2436 [ --with-system-png[=PFX]
2437 Use system libpng [installed at prefix PFX]],
2440 _SAVE_CFLAGS=$CFLAGS
2441 _SAVE_LDFLAGS=$LDFLAGS
2443 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
2444 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
2445 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
2447 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
2450 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
2451 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
2452 AC_CHECK_LIB(png, png_get_acTL, ,
2453 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
2455 if test "$MOZ_SYSTEM_PNG" = 1; then
2456 AC_TRY_COMPILE([ #include <stdio.h>
2457 #include <sys/types.h>
2459 [ #if PNG_LIBPNG_VER < $MOZPNG
2460 #error "Insufficient libpng version ($MOZPNG required)."
2462 #ifndef PNG_UINT_31_MAX
2463 #error "Insufficient libpng version."
2466 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
2468 CFLAGS=$_SAVE_CFLAGS
2469 LDFLAGS=$_SAVE_LDFLAGS
2472 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
2473 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
2474 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
2477 if test "$MOZ_SYSTEM_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
2478 MOZ_ARG_ENABLE_STRING(png-arm-neon-support,
2479 [ --enable-png-arm-neon-support=TYPE
2483 nocheck (faster but unsafe)],
2484 [MOZ_PNG_ARM_NEON_SUPPORT=$enableval ] )
2485 case "$MOZ_PNG_ARM_NEON_SUPPORT" in
2487 # enable-png-arm-neon-support = no
2490 # enable-png-arm-neon-support = nocheck
2499 fi # SKIP_LIBRARY_CHECKS
2501 AC_SUBST(MOZ_PNG_ARM_NEON)
2503 dnl ========================================================
2504 dnl system libffi Support
2505 dnl ========================================================
2508 dnl ========================================================
2512 dnl ========================================================
2514 MOZ_ARG_HEADER(Application)
2516 ENABLE_SYSTEM_EXTENSION_DIRS=1
2517 MOZ_BRANDING_DIRECTORY=
2518 MOZ_OFFICIAL_BRANDING=
2520 MOZ_AUTH_EXTENSION=1
2521 if test "$MOZ_IOS"; then
2527 MOZ_SAMPLE_TYPE_FLOAT32=
2528 MOZ_SAMPLE_TYPE_S16=
2533 MOZ_WEBRTC_SIGNALING=
2534 MOZ_WEBRTC_ASSERT_ALWAYS=1
2535 MOZ_WEBRTC_HARDWARE_AEC_NS=
2539 MOZ_VPX_ERROR_CONCEALMENT=
2541 MOZ_WEBSPEECH_MODELS=
2542 MOZ_WEBSPEECH_POCKETSPHINX=
2543 MOZ_WEBSPEECH_TEST_BACKEND=1
2550 LIBJPEG_TURBO_ASFLAGS=
2552 MOZ_PREF_EXTENSIONS=1
2557 MOZ_TOOLKIT_SEARCH=1
2559 MOZ_UNIVERSALCHARDET=1
2564 if test "$MOZ_IOS"; then
2570 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
2571 if test -n "$MOZ_RTSP"; then
2572 NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp"
2575 MOZ_USE_NATIVE_POPUP_WINDOWS=
2577 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
2578 MOZ_INSTALL_TRACKING=
2583 MOZ_AUDIO_CHANNEL_MANAGER=
2584 MOZ_CONTENT_SANDBOX=
2587 MOZ_BINARY_EXTENSIONS=
2590 case "$target_os" in
2593 AC_DEFINE(NS_ENABLE_TSF)
2598 *-android*|*-linuxandroid*)
2600 MOZ_THEME_FASTSTRIPE=1
2607 # Allow to specify a Mozilla API key file that contains the secret key to be
2608 # used for various Mozilla API requests.
2609 MOZ_ARG_WITH_STRING(mozilla-api-keyfile,
2610 [ --with-mozilla-api-keyfile=file Use the secret key contained in the given keyfile for Mozilla API requests],
2611 MOZ_MOZILLA_API_KEY=`cat $withval`)
2612 if test -z "$MOZ_MOZILLA_API_KEY"; then
2613 MOZ_MOZILLA_API_KEY=no-mozilla-api-key
2615 AC_SUBST(MOZ_MOZILLA_API_KEY)
2617 # Allow to specify a Google API key file that contains the secret key to be
2618 # used for various Google API requests.
2619 MOZ_ARG_WITH_STRING(google-api-keyfile,
2620 [ --with-google-api-keyfile=file Use the secret key contained in the given keyfile for Google API requests],
2621 MOZ_GOOGLE_API_KEY=`cat $withval`)
2622 if test -z "$MOZ_GOOGLE_API_KEY"; then
2623 MOZ_GOOGLE_API_KEY=no-google-api-key
2625 AC_SUBST(MOZ_GOOGLE_API_KEY)
2627 # Allow to specify a Google OAuth API key file that contains the client ID and
2628 # the secret key to be used for various Google OAuth API requests.
2629 MOZ_ARG_WITH_STRING(google-oauth-api-keyfile,
2630 [ --with-google-oauth-api-keyfile=file Use the client id and secret key contained in the given keyfile for Google OAuth API requests],
2631 [MOZ_GOOGLE_OAUTH_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
2632 MOZ_GOOGLE_OAUTH_API_KEY=`cat $withval | cut -f 2 -d " "`])
2633 if test -z "$MOZ_GOOGLE_OAUTH_API_CLIENTID"; then
2634 MOZ_GOOGLE_OAUTH_API_CLIENTID=no-google-oauth-api-clientid
2635 MOZ_GOOGLE_OAUTH_API_KEY=no-google-oauth-api-key
2637 AC_SUBST(MOZ_GOOGLE_OAUTH_API_CLIENTID)
2638 AC_SUBST(MOZ_GOOGLE_OAUTH_API_KEY)
2640 # Allow specifying a Bing API key file that contains the client ID and the
2641 # secret key to be used for the Bing Translation API requests.
2642 MOZ_ARG_WITH_STRING(bing-api-keyfile,
2643 [ --with-bing-api-keyfile=file Use the client id and secret key contained in the given keyfile for Bing API requests],
2644 [MOZ_BING_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
2645 MOZ_BING_API_KEY=`cat $withval | cut -f 2 -d " "`])
2646 if test -z "$MOZ_BING_API_CLIENTID"; then
2647 MOZ_BING_API_CLIENTID=no-bing-api-clientid
2648 MOZ_BING_API_KEY=no-bing-api-key
2650 AC_SUBST(MOZ_BING_API_CLIENTID)
2651 AC_SUBST(MOZ_BING_API_KEY)
2653 # Allow specifying an Adjust SDK key file that contains the app token used for
2654 # Adjust SDK requests.
2655 MOZ_ARG_WITH_STRING(adjust-sdk-keyfile,
2656 [ --with-adjust-sdk-keyfile=file Use the app token contained in the given keyfile for Adjust SDK requests],
2657 MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN=`cat $withval`)
2658 AC_SUBST(MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN)
2660 # Optional Firefox for Android partner distribution directory.
2661 MOZ_ARG_WITH_STRING(android-distribution-directory,
2662 [ --with-android-distribution-directory=dir
2663 Optional Firefox for Android partner distribution directory.],
2664 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
2666 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
2667 # A distribution directory must have an assets/distribution directory.
2668 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
2669 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
2670 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
2671 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
2674 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
2676 dnl ========================================================
2677 dnl = Trademarked Branding
2678 dnl ========================================================
2679 MOZ_ARG_ENABLE_BOOL(official-branding,
2680 [ --enable-official-branding
2681 Enable Official mozilla.org Branding
2682 Do not distribute builds with
2683 --enable-official-branding unless you have
2684 permission to use trademarks per
2685 http://www.mozilla.org/foundation/trademarks/ .],
2686 MOZ_OFFICIAL_BRANDING=1,
2687 MOZ_OFFICIAL_BRANDING=)
2689 # Allow the application to influence configure with a confvars.sh script.
2690 AC_MSG_CHECKING([if app-specific confvars.sh exists])
2691 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
2692 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
2693 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
2698 # Allow influencing configure with a defines.sh script.
2699 . "${srcdir}/build/defines.sh"
2701 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
2703 if test "$BUILDING_RELEASE"; then
2704 # Override value in defines.sh, if any
2705 EARLY_BETA_OR_EARLIER=
2706 elif test "$EARLY_BETA_OR_EARLIER"; then
2707 AC_DEFINE(EARLY_BETA_OR_EARLIER)
2709 AC_SUBST(EARLY_BETA_OR_EARLIER)
2711 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
2712 MOZ_ARG_WITH_STRING(app-name,
2713 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
2714 WITH_APP_NAME=$withval,
2717 if test -n "$WITH_APP_NAME" ; then
2718 MOZ_APP_NAME="$WITH_APP_NAME"
2721 MOZ_ARG_WITH_STRING(app-basename,
2722 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
2723 WITH_APP_BASENAME=$withval,
2726 if test -n "$WITH_APP_BASENAME" ; then
2727 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
2730 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
2731 # that haven't made a confvars.sh yet. Don't add new stuff here, use
2733 case "$MOZ_BUILD_APP" in
2735 AC_DEFINE(MOZ_PHOENIX)
2739 AC_DEFINE(MOZ_XULRUNNER)
2743 if test -n "$MOZ_B2G"; then
2747 # Graphene is a desktop runtime for running applications with a HTML UI.
2748 if test -n "$MOZ_GRAPHENE"; then
2749 AC_DEFINE(MOZ_GRAPHENE)
2752 if test -n "$MOZ_MULET"; then
2753 AC_DEFINE(MOZ_MULET)
2756 # Propagate feature switches for code written in rust from confvars.sh
2757 if test -n "$MOZ_RUST"; then
2758 if test -n "$MOZ_RUST_MP4PARSE"; then
2759 AC_DEFINE(MOZ_RUST_MP4PARSE)
2763 AC_SUBST(MOZ_PHOENIX)
2764 AC_SUBST(MOZ_XULRUNNER)
2767 AC_SUBST(MOZ_B2G_VERSION)
2769 dnl ========================================================
2770 dnl Ensure Android SDK and build-tools versions depending on
2772 dnl ========================================================
2774 if test -z "$gonkdir" ; then
2775 case "$MOZ_BUILD_APP" in
2777 MOZ_ANDROID_SDK(23, 23.0.3)
2782 dnl ========================================================
2784 dnl = Toolkit Options
2786 dnl ========================================================
2787 MOZ_ARG_HEADER(Toolkit Options)
2789 dnl ========================================================
2790 dnl = Enable the toolkit as needed =
2791 dnl ========================================================
2793 case "$MOZ_WIDGET_TOOLKIT" in
2796 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
2797 # Use -Wl as a trick to avoid -framework and framework names from
2798 # being separated by AC_SUBST_LIST.
2799 TK_LIBS='-Wl,-framework,CoreLocation -Wl,-framework,QuartzCore -Wl,-framework,Carbon -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,AddressBook -Wl,-framework,OpenGL -Wl,-framework,Security -Wl,-framework,ServiceManagement'
2801 CFLAGS="$CFLAGS $TK_CFLAGS"
2802 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2803 MOZ_USER_DIR="Mozilla"
2804 MOZ_FS_LAYOUT=bundle
2808 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
2810 TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText -Wl,-framework,AVFoundation -Wl,-framework,AudioToolbox -Wl,-framework,CoreMedia -Wl,-framework,CoreVideo -Wl,-framework,OpenGLES -Wl,-framework,QuartzCore'
2811 CFLAGS="$CFLAGS $TK_CFLAGS"
2812 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2813 MOZ_USER_DIR="Mozilla"
2814 MOZ_FS_LAYOUT=bundle
2819 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
2820 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
2821 case "$MOZ_WIDGET_TOOLKIT" in
2827 if test "$COMPILE_ENVIRONMENT"; then
2828 if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
2829 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
2830 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
2831 TK_CFLAGS=$MOZ_GTK3_CFLAGS
2832 TK_LIBS=$MOZ_GTK3_LIBS
2833 AC_DEFINE_UNQUOTED(GDK_VERSION_MIN_REQUIRED,$GDK_VERSION_MIN_REQUIRED)
2834 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MIN_REQUIRED)
2835 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
2837 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2838 GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
2840 if test "$MOZ_ENABLE_GTK"; then
2841 if test "$MOZ_X11"; then
2842 GDK_PACKAGES=gdk-x11-2.0
2844 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
2845 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
2847 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 $GDK_PACKAGES)
2848 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
2850 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2851 TK_CFLAGS=$MOZ_GTK2_CFLAGS
2852 TK_LIBS=$MOZ_GTK2_LIBS
2854 fi # COMPILE_ENVIRONMENT
2856 AC_SUBST(MOZ_FS_LAYOUT)
2858 dnl ========================================================
2859 dnl = startup-notification support module
2860 dnl ========================================================
2862 if test "$MOZ_ENABLE_GTK"
2864 MOZ_ENABLE_STARTUP_NOTIFICATION=
2866 MOZ_ARG_ENABLE_BOOL(startup-notification,
2867 [ --enable-startup-notification
2868 Enable startup-notification support (default: disabled) ],
2869 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
2870 MOZ_ENABLE_STARTUP_NOTIFICATION=)
2871 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
2873 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
2874 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
2875 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
2876 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
2878 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
2880 MOZ_ENABLE_STARTUP_NOTIFICATION=
2884 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
2885 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
2888 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
2890 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
2892 dnl ========================================================
2893 dnl Disable printing
2894 dnl ========================================================
2895 MOZ_ARG_DISABLE_BOOL(printing,
2896 [ --disable-printing Disable printing support],
2900 if test -n "$MOZ_IOS" -a -n "$NS_PRINTING"; then
2901 AC_MSG_ERROR([Printing is not supported on iOS.])
2904 if test "$NS_PRINTING"; then
2905 AC_DEFINE(NS_PRINTING)
2906 AC_DEFINE(NS_PRINT_PREVIEW)
2909 AC_SUBST_LIST(TK_CFLAGS)
2910 AC_SUBST_LIST(TK_LIBS)
2915 dnl ========================================================
2917 dnl = Components & Features
2919 dnl ========================================================
2920 MOZ_ARG_HEADER(Components and Features)
2922 dnl ========================================================
2924 dnl ========================================================
2925 MOZ_ARG_ENABLE_STRING(ui-locale,
2926 [ --enable-ui-locale=ab-CD
2927 Select the user interface locale (default: en-US)],
2928 MOZ_UI_LOCALE=$enableval )
2929 AC_SUBST(MOZ_UI_LOCALE)
2931 AC_SUBST(MOZ_OFFICIAL_BRANDING)
2932 if test -n "$MOZ_OFFICIAL_BRANDING"; then
2933 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
2934 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
2936 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
2937 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
2941 MOZ_ARG_WITH_STRING(branding,
2942 [ --with-branding=dir Use branding from the specified directory.],
2943 MOZ_BRANDING_DIRECTORY=$withval)
2945 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
2946 if test -z "$REAL_BRANDING_DIRECTORY"; then
2947 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
2950 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2951 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
2952 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2953 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
2956 AC_SUBST(MOZ_BRANDING_DIRECTORY)
2958 dnl ========================================================
2959 dnl = Distribution ID
2960 dnl ========================================================
2961 MOZ_ARG_WITH_STRING(distribution-id,
2962 [ --with-distribution-id=ID
2963 Set distribution-specific id (default=org.mozilla)],
2964 [ val=`echo $withval`
2965 MOZ_DISTRIBUTION_ID="$val"])
2967 if test -z "$MOZ_DISTRIBUTION_ID"; then
2968 MOZ_DISTRIBUTION_ID="org.mozilla"
2971 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
2972 AC_SUBST(MOZ_DISTRIBUTION_ID)
2975 dnl ========================================================
2976 dnl Google Play Services, placed here so it can depend on
2977 dnl values set by configure.sh above.
2978 dnl ========================================================
2980 MOZ_ANDROID_GOOGLE_PLAY_SERVICES
2981 MOZ_ANDROID_GOOGLE_CLOUD_MESSAGING
2982 MOZ_ANDROID_INSTALL_TRACKING
2985 dnl ========================================================
2987 dnl ========================================================
2988 if test "$MOZ_ENABLE_GTK"
2990 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
2992 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
2995 dnl ========================================================
2996 dnl = GIO and GConf support module
2997 dnl ========================================================
3001 dnl build the GIO extension by default only when the
3002 dnl GTK2 toolkit is in use.
3003 if test "$MOZ_ENABLE_GTK"
3009 dnl ========================================================
3010 dnl = GIO support module
3011 dnl ========================================================
3012 MOZ_ARG_DISABLE_BOOL(gio,
3013 [ --disable-gio Disable GIO support],
3015 MOZ_ENABLE_GIO=force)
3017 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
3019 if test "$MOZ_WIDGET_TOOLKIT" = gtk2
3021 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
3022 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
3024 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
3025 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
3027 AC_DEFINE(MOZ_ENABLE_GIO)
3029 if test "$MOZ_ENABLE_GIO" = "force"
3031 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
3037 AC_SUBST(MOZ_ENABLE_GIO)
3039 dnl ========================================================
3040 dnl = GConf support module
3041 dnl ========================================================
3042 MOZ_ARG_DISABLE_BOOL(gconf,
3043 [ --disable-gconf Disable Gconf support ],
3047 if test "$MOZ_ENABLE_GCONF"
3049 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
3050 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
3053 if test -n "$MOZ_ENABLE_GCONF";
3055 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
3057 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
3062 if test "$MOZ_ENABLE_GCONF"; then
3063 AC_DEFINE(MOZ_ENABLE_GCONF)
3066 AC_SUBST(MOZ_ENABLE_GCONF)
3069 dnl ========================================================
3070 dnl = libproxy support
3071 dnl ========================================================
3073 if test "$MOZ_ENABLE_GTK"
3075 MOZ_ENABLE_LIBPROXY=
3077 MOZ_ARG_ENABLE_BOOL(libproxy,
3078 [ --enable-libproxy Enable libproxy support ],
3079 MOZ_ENABLE_LIBPROXY=1,
3080 MOZ_ENABLE_LIBPROXY=)
3082 if test "$MOZ_ENABLE_LIBPROXY"
3084 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
3085 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
3088 AC_SUBST(MOZ_ENABLE_LIBPROXY)
3090 dnl ========================================================
3091 dnl = libgnomeui support module
3092 dnl ========================================================
3094 if test "$MOZ_ENABLE_GTK"
3096 MOZ_ARG_ENABLE_BOOL(gnomeui,
3097 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
3098 MOZ_ENABLE_GNOMEUI=force,
3099 MOZ_ENABLE_GNOMEUI=)
3101 if test "$MOZ_ENABLE_GNOMEUI"
3103 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
3105 MOZ_ENABLE_GNOMEUI=1
3107 if test "$MOZ_ENABLE_GNOMEUI" = "force"
3109 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
3115 if test "$MOZ_ENABLE_GNOMEUI"; then
3116 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
3120 AC_SUBST(MOZ_ENABLE_GNOMEUI)
3122 dnl ========================================================
3124 dnl ========================================================
3126 if test "$MOZ_ENABLE_GTK"
3130 MOZ_ARG_DISABLE_BOOL(dbus,
3131 [ --disable-dbus Disable dbus support ],
3135 if test "$MOZ_ENABLE_DBUS"
3137 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
3138 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
3139 AC_DEFINE(MOZ_ENABLE_DBUS)
3142 AC_SUBST(MOZ_ENABLE_DBUS)
3144 dnl ========================================================
3145 dnl = speech-dispatcher support
3146 dnl ========================================================
3148 if test "$MOZ_ENABLE_GTK"
3152 MOZ_ARG_DISABLE_BOOL(synth-speechd,
3153 [ --disable-synth-speechd Disable speech-dispatcher support ],
3155 MOZ_SYNTH_SPEECHD=1)
3157 AC_SUBST(MOZ_SYNTH_SPEECHD)
3159 dnl ========================================================
3160 dnl = Disable WebSMS backend
3161 dnl ========================================================
3162 MOZ_ARG_DISABLE_BOOL(websms-backend,
3163 [ --disable-websms-backend
3164 Disable WebSMS backend],
3165 MOZ_WEBSMS_BACKEND=,
3166 MOZ_WEBSMS_BACKEND=1)
3168 if test -n "$MOZ_WEBSMS_BACKEND"; then
3169 AC_DEFINE(MOZ_WEBSMS_BACKEND)
3172 dnl =========================================================
3173 dnl = Whether to exclude hyphenations files in the build
3174 dnl =========================================================
3175 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
3176 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
3179 dnl ========================================================
3180 dnl = Include install tracking on Android
3181 dnl ========================================================
3182 if test -n "$MOZ_INSTALL_TRACKING"; then
3183 if test -z "$MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN"; then
3184 AC_MSG_ERROR([Must specify --with-adjust-sdk-keyfile when MOZ_INSTALL_TRACKING is defined!])
3188 dnl ========================================================
3189 dnl = Enable IPDL's "expensive" unit tests
3190 dnl ========================================================
3193 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
3194 [ --enable-ipdl-tests Enable expensive IPDL tests],
3198 if test -n "$MOZ_IPDL_TESTS"; then
3199 AC_DEFINE(MOZ_IPDL_TESTS)
3202 AC_SUBST(MOZ_IPDL_TESTS)
3204 dnl ========================================================
3205 dnl = Disable building dbm
3206 dnl ========================================================
3207 MOZ_ARG_DISABLE_BOOL(dbm,
3208 [ --disable-dbm Disable building dbm],
3212 dnl ========================================================
3213 dnl accessibility support on by default on all platforms
3214 dnl ========================================================
3215 MOZ_ARG_DISABLE_BOOL(accessibility,
3216 [ --disable-accessibility Disable accessibility support],
3219 if test "$ACCESSIBILITY"; then
3222 if test -z "$MIDL"; then
3223 if test "$GCC" != "yes"; then
3224 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
3226 AC_MSG_ERROR([You have accessibility enabled, but widl could not be found. Add --disable-accessibility to your mozconfig or install widl. See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details.])
3230 AC_DEFINE(ACCESSIBILITY)
3233 dnl ========================================================
3234 dnl Accessibility is required for the linuxgl widget
3236 dnl ========================================================
3237 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
3238 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
3241 dnl Turn off webrtc for OS's we don't handle yet, but allow
3242 dnl --enable-webrtc to override. Can disable for everything in
3243 dnl the master list above.
3244 if test -n "$MOZ_WEBRTC"; then
3246 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
3250 dnl default to disabled for all others
3256 AC_TRY_COMPILE([#include <linux/ethtool.h>],
3257 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
3258 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
3260 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
3262 # target_arch is from {ia32|x64|arm|ppc}
3264 x86_64 | arm | aarch64 | x86 | ppc* | ia64)
3268 # unsupported arch for webrtc
3274 dnl ========================================================
3275 dnl = Disable WebRTC code
3276 dnl ========================================================
3277 MOZ_ARG_DISABLE_BOOL(webrtc,
3278 [ --disable-webrtc Disable support for WebRTC],
3282 if test -n "$MOZ_WEBRTC"; then
3283 AC_DEFINE(MOZ_WEBRTC)
3284 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
3285 dnl opt/production builds (via MOZ_CRASH())
3286 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
3288 MOZ_VPX_ERROR_CONCEALMENT=1
3290 dnl enable once Signaling lands
3291 MOZ_WEBRTC_SIGNALING=1
3292 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
3293 dnl enable once PeerConnection lands
3294 MOZ_PEERCONNECTION=1
3295 AC_DEFINE(MOZ_PEERCONNECTION)
3300 if test -n "$MOZ_X11"; then
3301 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
3307 dnl ========================================================
3308 dnl = Force hardware AEC, disable webrtc.org AEC
3309 dnl ========================================================
3310 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
3311 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
3312 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
3313 MOZ_WEBRTC_HARDWARE_AEC_NS=)
3315 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
3316 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
3319 AC_SUBST(MOZ_WEBRTC)
3320 AC_SUBST(MOZ_WEBRTC_SIGNALING)
3321 AC_SUBST(MOZ_PEERCONNECTION)
3322 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
3323 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
3326 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
3328 dnl Use integers over floats for audio on B2G and Android
3329 dnl (regarless of the CPU architecture, because audio
3330 dnl backends for those platforms don't support floats. We also
3331 dnl use integers on ARM with other OS, because it's more efficient.
3332 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
3333 MOZ_SAMPLE_TYPE_S16=1
3334 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
3335 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
3337 MOZ_SAMPLE_TYPE_FLOAT32=1
3338 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
3339 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
3342 dnl ========================================================
3343 dnl = Disable Speech API pocketsphinx backend
3344 dnl ========================================================
3345 if test -n "$MOZ_WEBSPEECH_POCKETSPHINX"; then
3346 AC_DEFINE(MOZ_WEBSPEECH_POCKETSPHINX)
3349 AC_SUBST(MOZ_WEBSPEECH_POCKETSPHINX)
3351 dnl ========================================================
3352 dnl = Disable Speech API code
3353 dnl ========================================================
3354 MOZ_ARG_DISABLE_BOOL(webspeech,
3355 [ --disable-webspeech Disable support for HTML Speech API],
3359 if test -n "$MOZ_WEBSPEECH"; then
3360 AC_DEFINE(MOZ_WEBSPEECH)
3363 AC_SUBST(MOZ_WEBSPEECH)
3365 dnl ========================================================
3366 dnl = Disable Speech API test backend
3367 dnl ========================================================
3368 MOZ_ARG_DISABLE_BOOL(webspeechtestbackend,
3369 [ --disable-webspeechtestbackend Disable support for HTML Speech API Test Backend],
3370 MOZ_WEBSPEECH_TEST_BACKEND=,
3371 MOZ_WEBSPEECH_TEST_BACKEND=1)
3373 if test -z "$MOZ_WEBSPEECH"; then
3374 MOZ_WEBSPEECH_TEST_BACKEND=
3377 if test -n "$MOZ_WEBSPEECH_TEST_BACKEND"; then
3378 AC_DEFINE(MOZ_WEBSPEECH_TEST_BACKEND)
3381 AC_SUBST(MOZ_WEBSPEECH_TEST_BACKEND)
3383 dnl ========================================================
3384 dnl = Disable Speech API models
3385 dnl ========================================================
3386 if test -z "$MOZ_WEBSPEECH"; then
3387 MOZ_WEBSPEECH_MODELS=
3390 if test -n "$MOZ_WEBSPEECH_MODELS"; then
3391 AC_DEFINE(MOZ_WEBSPEECH_MODELS)
3394 AC_SUBST(MOZ_WEBSPEECH_MODELS)
3396 dnl ========================================================
3397 dnl = Enable Raw Codecs
3398 dnl ========================================================
3399 MOZ_ARG_ENABLE_BOOL(raw,
3400 [ --enable-raw Enable support for RAW media],
3404 if test -n "$MOZ_RAW"; then
3410 dnl Checks for __attribute__(aligned()) directive need by libogg
3411 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
3412 [ac_cv_c_attribute_aligned],
3413 [ac_cv_c_attribute_aligned=0
3414 CFLAGS_save="${CFLAGS}"
3415 CFLAGS="${CFLAGS} -Werror"
3416 for ac_cv_c_attr_align_try in 64 32 16 8; do
3417 echo "trying $ac_cv_c_attr_align_try"
3419 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
3420 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
3421 if test "$ac_cv_c_attribute_aligned" != 0; then
3425 CFLAGS="${CFLAGS_save}"])
3426 if test "${ac_cv_c_attribute_aligned}" != "0"; then
3427 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
3428 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
3431 dnl ========================================================
3432 dnl = Apple platform decoder support
3433 dnl ========================================================
3434 if test "$COMPILE_ENVIRONMENT"; then
3435 if test -n "$MOZ_APPLEMEDIA"; then
3436 # hack in frameworks for fmp4 - see bug 1029974
3437 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
3438 LDFLAGS="$LDFLAGS -framework AudioToolbox"
3439 dnl Verify CoreMedia is available.
3440 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
3441 [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
3443 fi # COMPILE_ENVIRONMENT
3445 dnl ========================================================
3446 dnl = DirectShow support
3447 dnl ========================================================
3448 if test "$OS_ARCH" = "WINNT"; then
3449 dnl Enable DirectShow support by default.
3453 MOZ_ARG_DISABLE_BOOL(directshow,
3454 [ --disable-directshow Disable support for DirectShow],
3458 if test -n "$MOZ_DIRECTSHOW"; then
3459 AC_DEFINE(MOZ_DIRECTSHOW)
3462 dnl ========================================================
3463 dnl = Built-in fragmented MP4 support.
3464 dnl ========================================================
3466 if test x"$MOZ_WIDGET_TOOLKIT" = x"gonk" -a -n "$MOZ_FMP4" -a -n "$android_version"; then
3467 # we now know for sure that $android_version is not an empty string!
3468 if test "$android_version" -ge "18"; then
3469 MOZ_GONK_MEDIACODEC=1
3470 AC_SUBST(MOZ_GONK_MEDIACODEC)
3475 dnl ========================================================
3476 dnl = Enable media plugin support
3477 dnl ========================================================
3478 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
3479 dnl Enable support on android by default
3483 MOZ_ARG_ENABLE_BOOL(android-omx,
3484 [ --enable-android-omx Enable support for Android OMX media backend],
3488 if test -n "$MOZ_ANDROID_OMX"; then
3489 AC_DEFINE(MOZ_ANDROID_OMX)
3492 dnl ========================================================
3493 dnl = Enable building OMX media plugin (B2G or Android)
3494 dnl ========================================================
3495 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
3496 dnl Enable support on android by default
3500 MOZ_ARG_ENABLE_BOOL(omx-plugin,
3501 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
3505 if test -n "$MOZ_OMX_PLUGIN"; then
3506 if test "$OS_TARGET" = "Android"; then
3507 dnl Only allow building OMX plugin on Gonk (B2G) or Android
3508 AC_DEFINE(MOZ_OMX_PLUGIN)
3510 dnl fail if we're not building on Gonk or Android
3511 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
3515 dnl system libvpx Support
3516 dnl ========================================================
3517 MOZ_ARG_WITH_BOOL(system-libvpx,
3518 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
3519 MOZ_SYSTEM_LIBVPX=1)
3524 if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
3525 AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
3528 _SAVE_CFLAGS=$CFLAGS
3530 if test -n "$MOZ_SYSTEM_LIBVPX"; then
3531 dnl ============================
3532 dnl === libvpx Version check ===
3533 dnl ============================
3534 dnl Check to see if we have a system libvpx package.
3535 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0)
3537 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
3538 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
3540 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
3541 [AC_MSG_ERROR([Couldn't find vpx/vpx_decoder.h which is required for build with system libvpx. Use --without-system-libvpx to build with in-tree libvpx.])])
3543 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
3544 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
3546 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
3547 [AC_CHECK_FUNC(vpx_mem_set_functions)])
3548 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
3549 "$ac_cv_func_vpx_mem_set_functions" = no; then
3550 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
3553 CFLAGS=$_SAVE_CFLAGS
3556 AC_SUBST(MOZ_SYSTEM_LIBVPX)
3557 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
3558 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
3560 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
3566 if test -z "$MOZ_SYSTEM_LIBVPX"; then
3568 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
3569 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
3570 dnl We currently require gcc on all arm platforms.
3572 dnl See if we have assembly on this platform.
3573 case "$OS_ARCH:$CPU_ARCH" in
3587 dnl Check for yasm 1.1 or greater.
3588 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
3589 AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but it appears not to be installed. Install it (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
3590 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
3591 AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION. Upgrade to the newest version (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
3595 dnl The encoder needs obj_int_extract to get asm offsets.
3596 fi # COMPILE_ENVIRONMENT and others
3599 if test -n "$GNU_AS" ; then
3600 dnl These flags are a lie; they're just used to enable the requisite
3601 dnl opcodes; actual arch detection is done at runtime.
3602 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
3603 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
3605 dnl Building with -mfpu=neon requires either the "softfp" or the
3606 dnl "hardfp" ABI. Depending on the compiler's default target, and the
3607 dnl CFLAGS, the default ABI might be neither, in which case it is the
3608 dnl "softfloat" ABI.
3609 dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
3610 dnl we can safely mix code built with both ABIs. So, if we detect
3611 dnl that compiling uses the "softfloat" ABI, force the use of the
3612 dnl "softfp" ABI instead.
3613 dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the
3614 dnl "softfloat" ABI, not the "softfp" ABI.
3615 dnl Note: VPX_ASFLAGS is also used in CFLAGS.
3618 #error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
3620 VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp"
3625 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3631 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3638 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
3639 AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
3640 fi # COMPILE_ENVIRONMENT and others
3642 if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
3646 if test -n "$VPX_X86_ASM"; then
3647 AC_DEFINE(VPX_X86_ASM)
3648 elif test -n "$VPX_ARM_ASM"; then
3649 AC_DEFINE(VPX_ARM_ASM)
3651 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
3654 dnl native libvpx no longer has vpx_mem_set_functions
3655 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
3658 dnl ========================================================
3659 dnl = Handle dependent MEDIA defines
3660 dnl ========================================================
3662 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
3663 AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive! The build system should not allow them both to be set, but they are. Please file a bug at https://bugzilla.mozilla.org/])
3666 if test -n "$MOZ_VORBIS"; then
3667 AC_DEFINE(MOZ_VORBIS)
3670 if test -n "$MOZ_TREMOR"; then
3671 AC_DEFINE(MOZ_TREMOR)
3675 AC_DEFINE(MOZ_WEBM_ENCODER)
3676 AC_SUBST(MOZ_WEBM_ENCODER)
3678 dnl ==================================
3679 dnl = Check alsa availability on Linux
3680 dnl ==================================
3682 dnl If using Linux, ensure that the alsa library is available
3683 if test "$OS_TARGET" = "Linux"; then
3687 MOZ_ARG_ENABLE_BOOL(alsa,
3688 [ --enable-alsa Enable Alsa support (default on Linux)],
3692 if test -n "$MOZ_ALSA"; then
3693 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
3694 [echo "$MOZ_ALSA_PKG_ERRORS"
3695 AC_MSG_ERROR([Need alsa for audio output on Linux. (On Ubuntu, you might try installing the package libasound2-dev.)])])
3700 dnl ========================================================
3701 dnl = Disable PulseAudio
3702 dnl ========================================================
3704 dnl If using Desktop Linux, ensure that the PA library is available
3705 case "$OS_TARGET" in
3706 WINNT|Darwin|Android|OpenBSD)
3713 MOZ_ARG_DISABLE_BOOL(pulseaudio,
3714 [ --disable-pulseaudio Disable PulseAudio support],
3718 if test -n "$MOZ_PULSEAUDIO"; then
3719 if test -z "$gonkdir"; then
3720 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
3721 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
3722 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
3724 MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
3728 AC_SUBST(MOZ_PULSEAUDIO)
3730 dnl ========================================================
3731 dnl Permissions System
3732 dnl ========================================================
3733 MOZ_ARG_DISABLE_BOOL(permissions,
3734 [ --disable-permissions Disable permissions (popup and cookie blocking)],
3739 AC_SUBST(MOZ_PERMISSIONS)
3740 if test -n "$MOZ_PERMISSIONS"; then
3741 AC_DEFINE(MOZ_PERMISSIONS)
3744 dnl ========================================================
3746 dnl ========================================================
3748 MOZ_ARG_DISABLE_BOOL(negotiateauth,
3749 [ --disable-negotiateauth Disable GSS-API negotiation ],
3750 MOZ_AUTH_EXTENSION=,
3751 MOZ_AUTH_EXTENSION=1 )
3753 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
3754 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
3757 dnl ========================================================
3758 dnl Pref extensions (autoconfig)
3759 dnl ========================================================
3760 MOZ_ARG_DISABLE_BOOL(pref-extensions,
3761 [ --disable-pref-extensions
3762 Disable pref extensions such as autoconfig],
3763 MOZ_PREF_EXTENSIONS=,
3764 MOZ_PREF_EXTENSIONS=1 )
3766 dnl ========================================================
3767 dnl Searching of system directories for extensions.
3768 dnl Note: this switch is meant to be used for test builds
3769 dnl whose behavior should not depend on what happens to be
3770 dnl installed on the local machine.
3771 dnl ========================================================
3772 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
3773 [ --disable-system-extension-dirs
3774 Disable searching system- and account-global
3775 directories for extensions of any kind; use
3776 only profile-specific extension directories],
3777 ENABLE_SYSTEM_EXTENSION_DIRS=,
3778 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
3779 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
3780 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
3783 dnl ========================================================
3784 dnl = Universalchardet
3785 dnl ========================================================
3786 MOZ_ARG_DISABLE_BOOL(universalchardet,
3787 [ --disable-universalchardet
3788 Disable universal encoding detection],
3789 MOZ_UNIVERSALCHARDET=,
3790 MOZ_UNIVERSALCHARDET=1 )
3792 dnl ========================================================
3793 dnl = ANGLE OpenGL->D3D translator for WebGL
3794 dnl = * only applies to win32
3795 dnl ========================================================
3799 MOZ_HAS_WINSDK_WITH_D3D=
3800 MOZ_D3DCOMPILER_VISTA_DLL=
3801 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
3802 MOZ_DIRECTX_SDK_PATH=
3803 MOZ_D3DCOMPILER_XP_DLL=
3804 MOZ_D3DCOMPILER_XP_CAB=
3806 if test "$COMPILE_ENVIRONMENT" ; then
3807 case "$target_os" in
3809 MOZ_ANGLE_RENDERER=1
3813 # The DirectX SDK libraries are split into x86 and x64 sub-directories
3814 case "${target_cpu}" in
3816 MOZ_D3D_CPU_SUFFIX=x86
3819 MOZ_D3D_CPU_SUFFIX=x64
3823 MOZ_ARG_ENABLE_BOOL(require-all-d3dc-versions,
3824 [ --enable-require-all-d3dc-versions Require all versions of the D3D compiler needed for supported Windows systems.],
3825 MOZ_REQUIRE_ALL_D3DCS=1,
3826 MOZ_REQUIRE_ALL_D3DCS=)
3828 # This is potentially set in external mozconfig files; if it's set,
3829 # then the build exposes the "webgl" context name, which is reserved
3830 # for conformant implementations.
3831 if test -n "$MOZ_WEBGL_CONFORMANT"; then
3832 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
3835 dnl ========================================================
3836 dnl D3D compiler DLL
3837 dnl ========================================================
3838 MOZ_FOUND_D3D_COMPILERS=
3840 if test -n "$MOZ_ANGLE_RENDERER"; then
3841 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
3842 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
3845 ######################################
3846 # Find _46+ for use by Vista+.
3848 # Find a D3D compiler DLL in a Windows SDK.
3849 MOZ_D3DCOMPILER_VISTA_DLL=
3850 case "$MOZ_WINSDK_MAXVER" in
3852 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
3853 AC_MSG_RESULT([Found D3D compiler in Windows SDK.])
3857 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
3858 # We have a name, now track down the path.
3859 if test -n "$WINDOWSSDKDIR"; then
3860 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
3861 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
3862 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
3863 MOZ_HAS_WINSDK_WITH_D3D=1
3865 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
3866 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
3867 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
3870 AC_MSG_RESULT([Windows SDK not found.])
3873 AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
3876 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
3877 MOZ_D3DCOMPILER_VISTA_DLL=
3880 # On mingw, check if headers are provided by toolchain.
3881 if test -n "$GNU_CC"; then
3882 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
3885 ######################################
3886 # Find _43 for use by XP.
3888 if test "$HAVE_64BIT_BUILD"; then
3889 AC_MSG_RESULT([We are building a 64-bit binary, skip checking d3dcompiler_43.])
3891 # Get the SDK path from the registry.
3892 # First try to get the June 2010 SDK
3893 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
3894 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
3895 # Otherwise just take whatever comes first
3896 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
3898 MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/' | sed 's,\\\\,/,g'`
3900 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
3901 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/dxguid.lib ; then
3902 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
3904 AC_MSG_RESULT([DirectX SDK not found.])
3905 MOZ_DIRECTX_SDK_PATH=
3908 # Check that our DirectX SDK is acceptable.
3909 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
3910 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
3911 AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
3912 MOZ_DIRECTX_SDK_PATH=
3916 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
3917 # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
3918 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
3919 MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
3921 if test -n "$MOZ_D3DX9_VERSION" ; then
3922 MOZ_D3DCOMPILER_XP_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_D3D_CPU_SUFFIX}.cab | head -n1`
3924 if test -n "$MOZ_D3DCOMPILER_XP_CAB"; then
3925 MOZ_D3DCOMPILER_XP_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
3927 AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
3928 AC_MSG_ERROR([DirectX SDK at "$MOZ_DIRECTX_SDK_PATH" appears broken.])
3929 MOZ_DIRECTX_SDK_PATH=
3932 AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
3933 MOZ_DIRECTX_SDK_PATH=
3936 AC_MSG_RESULT([Couldn't find an acceptable DirectX SDK for ANGLE, needed for d3dcompiler_43.])
3940 ######################################
3941 # Check that we found what we needed.
3942 MOZ_FOUND_A_D3D_COMPILER=
3943 MOZ_FOUND_BOTH_D3D_COMPILERS=1
3945 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
3946 MOZ_FOUND_A_D3D_COMPILER=1
3947 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
3949 MOZ_FOUND_BOTH_D3D_COMPILERS=
3952 if test -n "$MOZ_D3DCOMPILER_XP_DLL"; then
3953 MOZ_FOUND_A_D3D_COMPILER=1
3954 AC_MSG_RESULT([Found d3dcompiler DLL for XP: $MOZ_D3DCOMPILER_XP_DLL])
3956 MOZ_FOUND_BOTH_D3D_COMPILERS=
3959 if test -z "$CROSS_COMPILE"; then
3960 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
3961 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
3964 if test -n "$MOZ_REQUIRE_ALL_D3DCS" -a -z "$MOZ_FOUND_BOTH_D3D_COMPILERS"; then
3965 AC_MSG_ERROR([Both D3D compilers _43 and _46+ are required by --enable-require-d3d-compilers.])
3966 AC_MSG_ERROR([ Install Windows SDK 8.0+, as well as DirectX SDK (June 2010 version or newer), or reconfigure without this flag.])
3969 fi # MOZ_ANGLE_RENDERER
3971 fi # COMPILE_ENVIRONMENT
3974 dnl ========================================================
3976 dnl ========================================================
3978 MOZ_GAMEPAD_BACKEND=stub
3980 # Gamepad DOM is built on supported platforms by default.
3981 case "$OS_TARGET" in
3986 if test -z "$MOZ_IOS"; then
3991 if test "$MOZ_WIDGET_TOOLKIT" != "gonk"; then
3999 MOZ_ARG_DISABLE_BOOL(gamepad,
4000 [ --disable-gamepad Disable gamepad support],
4004 if test "$MOZ_GAMEPAD"; then
4005 case "$OS_TARGET" in
4007 if test -z "$MOZ_IOS"; then
4008 MOZ_GAMEPAD_BACKEND=cocoa
4012 MOZ_GAMEPAD_BACKEND=windows
4015 MOZ_CHECK_HEADER([linux/joystick.h])
4016 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
4017 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers or reconfigure with --disable-gamepad to disable gamepad support.])
4019 MOZ_GAMEPAD_BACKEND=linux
4022 MOZ_GAMEPAD_BACKEND=android
4028 AC_DEFINE(MOZ_GAMEPAD)
4030 AC_SUBST(MOZ_GAMEPAD)
4031 AC_SUBST(MOZ_GAMEPAD_BACKEND)
4033 dnl ========================================================
4034 dnl = Breakpad crash reporting (on by default on supported platforms)
4035 dnl ========================================================
4038 i?86-*-mingw*|x86_64-*-mingw*)
4041 i?86-apple-darwin*|x86_64-apple-darwin*)
4042 if test -z "$MOZ_IOS"; then
4046 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
4047 if test "$MOZ_ENABLE_GTK"; then
4051 *-android*|*-linuxandroid*)
4056 MOZ_ARG_DISABLE_BOOL(crashreporter,
4057 [ --disable-crashreporter Disable breakpad crash reporting],
4058 [MOZ_CRASHREPORTER=],
4059 [MOZ_CRASHREPORTER=F # Force enable breakpad])
4061 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
4062 if test "$MOZ_CRASHREPORTER" = F; then
4063 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
4068 if test -n "$MOZ_CRASHREPORTER"; then
4069 AC_DEFINE(MOZ_CRASHREPORTER)
4071 if test "$OS_TARGET" = "Linux" && \
4072 test -z "$SKIP_LIBRARY_CHECKS"; then
4073 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
4076 if test "$OS_ARCH" = "WINNT"; then
4077 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
4078 MOZ_CRASHREPORTER_INJECTOR=1
4079 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
4084 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
4085 [ --with-crashreporter-enable-percent=NN
4086 Enable sending crash reports by default on NN% of users. (default=100)],
4087 [ val=`echo $withval | sed 's/[^0-9]//g'`
4088 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
4090 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
4091 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
4093 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
4095 dnl ========================================================
4096 dnl = libjpeg-turbo configuration
4097 dnl ========================================================
4099 LIBJPEG_TURBO_USE_YASM=
4100 if test -z "$MOZ_SYSTEM_JPEG"; then
4104 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
4105 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
4107 MOZ_LIBJPEG_TURBO=1)
4109 if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
4110 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
4113 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
4116 if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
4118 dnl Do we support libjpeg-turbo on this platform?
4119 case "$OS_ARCH:$CPU_ARCH" in
4121 LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
4124 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
4129 LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
4132 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
4135 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
4138 LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
4141 LIBJPEG_TURBO_ASFLAGS="-mdspr2"
4144 if $CC -E -dM -</dev/null | grep -q __ELF__; then
4145 LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
4149 if $CC -E -dM -</dev/null | grep -q __ELF__; then
4150 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
4156 if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
4158 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
4159 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
4160 dnl it doesn't exist or we have too old of a version.
4162 LIBJPEG_TURBO_USE_YASM=1
4164 if test -z "$YASM" ; then
4165 AC_MSG_ERROR([Yasm is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you do not appear to have Yasm installed. Either install it or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
4168 dnl Check that we have the right yasm version. We require 1.0.1 or newer
4169 dnl on Linux and 1.1 or newer everywhere else.
4170 if test "$OS_ARCH" = "Linux" ; then
4171 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
4172 AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.$_YASM_RELEASE. Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
4175 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
4176 AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION. Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
4183 dnl ========================================================
4184 dnl = libav-fft configuration
4185 dnl ========================================================
4189 dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
4190 dnl 32-bit linux/os x have text relocation issues.
4192 case "$OS_ARCH:$CPU_ARCH" in
4201 dnl Detect if we can use yasm to compile libav's assembly
4203 if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
4204 AC_DEFINE(MOZ_LIBAV_FFT)
4205 dnl Do we support libav-fft on this platform?
4206 case "$OS_ARCH:$CPU_ARCH" in
4208 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
4211 LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
4214 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
4217 if $CC -E -dM -</dev/null | grep -q __ELF__; then
4218 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
4222 AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
4227 if test -n "$LIBAV_FFT_ASFLAGS"; then
4228 dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
4229 dnl check for Yasm, and error out if it doesn't exist or we have too old of a
4231 if test -z "$YASM" ; then
4232 AC_MSG_ERROR([Yasm is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
4234 dnl Check that we have the right yasm version. We require 1.0.1 or newer
4235 dnl on Linux and 1.1 or newer everywhere else.
4236 if test "$OS_ARCH" = "Linux" ; then
4237 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
4238 AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
4241 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
4242 AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
4245 elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
4246 dnl Warn if we're not building either libav or opendl-max optimized routines.
4247 AC_MSG_WARN([No assembler or assembly support for libav-fft. Using unoptimized C routines.])
4250 dnl ========================================================
4251 dnl = FFmpeg's ffvpx configuration
4252 dnl ========================================================
4264 dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
4265 if test -n "$MOZ_LIBAV_FFT"; then
4266 FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
4268 if test -n "$MOZ_FFVPX"; then
4269 AC_DEFINE(MOZ_FFVPX)
4272 dnl ========================================================
4273 dnl = Enable compilation of specific extension modules
4274 dnl ========================================================
4276 MOZ_ARG_ENABLE_STRING(extensions,
4277 [ --enable-extensions Enable extensions],
4278 [ for option in `echo $enableval | sed 's/,/ /g'`; do
4279 if test "$option" = "yes" -o "$option" = "all"; then
4280 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
4281 elif test "$option" = "no" -o "$option" = "none"; then
4283 elif test "$option" = "default"; then
4284 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
4285 elif test `echo "$option" | grep -c \^-` != 0; then
4286 option=`echo $option | sed 's/^-//'`
4287 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
4289 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
4292 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
4294 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
4295 # Suppress warning on non-X11 platforms
4296 if test -n "$MOZ_X11"; then
4297 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
4299 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
4302 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
4304 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
4306 AC_SUBST(MOZ_GIO_COMPONENT)
4308 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
4309 dnl when trying to build a nonexistent extension.
4310 for extension in $MOZ_EXTENSIONS; do
4311 if test ! -d "${srcdir}/extensions/${extension}"; then
4312 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
4316 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
4317 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
4320 dnl ========================================================
4321 dnl Build Freetype in the tree
4322 dnl ========================================================
4323 MOZ_ARG_ENABLE_BOOL(tree-freetype,
4324 [ --enable-tree-freetype Enable Tree FreeType],
4325 MOZ_TREE_FREETYPE=1,
4326 MOZ_TREE_FREETYPE= )
4327 if test -n "$MOZ_TREE_FREETYPE"; then
4328 if test -n "$_WIN32_MSVC"; then
4329 AC_ERROR("building with in-tree freetype is not supported on MSVC")
4331 AC_DEFINE(MOZ_TREE_FREETYPE)
4332 AC_SUBST(MOZ_TREE_FREETYPE)
4333 MOZ_ENABLE_CAIRO_FT=1
4334 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
4335 FT2_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
4336 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
4338 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
4339 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
4340 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
4341 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
4344 dnl ========================================================
4346 dnl ========================================================
4347 dnl Abort Windows build if the required major version and
4348 dnl minimum minor version of Unicode NSIS isn't in the path
4349 dnl (unless in case of cross compiling, for which Unicode
4350 dnl is not yet sufficient).
4351 if test "$OS_ARCH" = "WINNT"; then
4352 MIN_NSIS_MAJOR_VER=3
4353 MIN_NSIS_MINOR_VER=0
4354 MIN_NSIS_PRERELEASE_TYPE=b
4355 MIN_NSIS_PRERELEASE_VER=1
4356 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensis-3.0b3.exe makensis-3.0b1.exe makensis)
4357 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
4358 AC_MSG_RESULT([yes])
4359 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null`
4361 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
4363 MAKENSISU_MAJOR_VER=0
4364 MAKENSISU_MINOR_VER=0
4365 MAKENSISU_PRERELEASE_TYPE=$MIN_NSIS_PRERELEASE_TYPE
4366 MAKENSISU_PRERELEASE_VER=$MIN_NSIS_PRERELEASE_VER
4367 if test ! "$MAKENSISU_PARSED_VER" = ""; then
4368 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'`
4369 MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'`
4371 MAKENSISU_PARSED_PRERELEASE=`echo "$MAKENSISU_VER" | sed -e 's/^v[0-9]\+\.[0-9]\+\([^0-9]\+\)\([0-9]\+\).*$/\1.\2/g'`
4373 if test ! "$MAKENSISU_PARSED_PRERELEASE" = "$MAKENSISU_VER"; then
4374 MAKENSISU_PRERELEASE_TYPE=`echo $MAKENSISU_PARSED_PRERELEASE | $AWK -F\. '{ print $1 }'`
4375 MAKENSISU_PRERELEASE_VER=`echo $MAKENSISU_PARSED_PRERELEASE | $AWK -F\. '{ print $2 }'`
4378 AC_MSG_CHECKING([for NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER$MIN_NSIS_PRERELEASE_TYPE$MIN_NSIS_PRERELEASE_VER or greater])
4379 if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \
4380 "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER -a \
4381 "$MAKENSISU_PRERELEASE_TYPE" = "$MIN_NSIS_PRERELEASE_TYPE" -a \
4382 "$MAKENSISU_PRERELEASE_VER" -ge $MIN_NSIS_PRERELEASE_VER; then
4383 AC_MSG_RESULT([yes])
4384 AC_MSG_RESULT([Found NSIS Version: $MAKENSISU_VER])
4387 if test -z "$CROSS_COMPILE"; then
4388 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER$MIN_NSIS_PRERELEASE_TYPE$MIN_NSIS_PRERELEASE_VER or greater in your path.])
4393 elif test -z "$CROSS_COMPILE"; then
4394 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER$MIN_NSIS_PRERELEASE_TYPE$MIN_NSIS_PRERELEASE_VER or greater in your path.])
4400 AC_CHECK_PROGS(WGET, wget, "")
4403 dnl ========================================================
4404 dnl Maintenance Service
4405 dnl ========================================================
4407 MOZ_ARG_ENABLE_BOOL(maintenance-service,
4408 [ --enable-maintenance-service Enable building of maintenanceservice],
4409 MOZ_MAINTENANCE_SERVICE=1,
4410 MOZ_MAINTENANCE_SERVICE= )
4412 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
4413 if test "$OS_ARCH" = "WINNT"; then
4414 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
4416 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
4420 dnl ========================================================
4421 dnl Bundled fonts on desktop platforms
4422 dnl ========================================================
4424 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
4425 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
4426 MOZ_BUNDLED_FONTS=1,
4429 if test -n "$MOZ_BUNDLED_FONTS"; then
4430 AC_DEFINE(MOZ_BUNDLED_FONTS)
4433 dnl ========================================================
4434 dnl Verify MAR signatures
4435 dnl ========================================================
4437 MOZ_ARG_ENABLE_BOOL(verify-mar,
4438 [ --enable-verify-mar Enable verifying MAR signatures],
4439 MOZ_VERIFY_MAR_SIGNATURE=1,
4440 MOZ_VERIFY_MAR_SIGNATURE= )
4442 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
4443 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
4446 dnl ========================================================
4447 dnl Enable building the signmar program.
4448 dnl This option is much different than the --enable-verify-mar option.
4449 dnl --enable-verify-mar is for enabling the verification check on MAR
4450 dnl files in the updater. The --enable-signmar option is for building
4451 dnl the signmar program.
4452 dnl ========================================================
4454 MOZ_ARG_ENABLE_BOOL(signmar,
4455 [ --enable-signmar Enable building the signmar program],
4456 MOZ_ENABLE_SIGNMAR=1,
4457 MOZ_ENABLE_SIGNMAR= )
4459 if test -n "$MOZ_ENABLE_SIGNMAR"; then
4460 if test -z "$COMPILE_ENVIRONMENT" ; then
4461 AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
4464 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
4468 dnl ========================================================
4470 dnl ========================================================
4472 if test "$MOZ_IOS"; then
4476 MOZ_ARG_DISABLE_BOOL(updater,
4477 [ --disable-updater Disable building of updater],
4481 if test -n "$MOZ_UPDATER"; then
4482 AC_DEFINE(MOZ_UPDATER)
4485 dnl ========================================================
4486 dnl parental controls (for Windows Vista)
4487 dnl ========================================================
4488 MOZ_ARG_DISABLE_BOOL(parental-controls,
4489 [ --disable-parental-controls
4490 Do not build parental controls],
4491 MOZ_DISABLE_PARENTAL_CONTROLS=1,
4492 MOZ_DISABLE_PARENTAL_CONTROLS=)
4493 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
4494 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
4497 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
4499 dnl ========================================================
4500 dnl = Disable smartcard support
4501 dnl ========================================================
4502 if test -n "$MOZ_NO_SMART_CARDS"; then
4503 AC_DEFINE(MOZ_NO_SMART_CARDS)
4505 AC_SUBST(MOZ_NO_SMART_CARDS)
4507 dnl ========================================================
4508 dnl = Disable EV certificate verification
4509 dnl ========================================================
4510 if test -n "$MOZ_NO_EV_CERTS"; then
4511 AC_DEFINE(MOZ_NO_EV_CERTS)
4513 AC_SUBST(MOZ_NO_EV_CERTS)
4515 dnl ========================================================
4516 dnl = Sandboxing support
4517 dnl ========================================================
4518 if test -n "$MOZ_TSAN"; then
4519 # Bug 1182565: TSan conflicts with sandboxing on Linux.
4527 MOZ_ARG_DISABLE_BOOL(sandbox,
4528 [ --disable-sandbox Disable sandboxing support],
4532 dnl ========================================================
4533 dnl = Content process sandboxing
4534 dnl ========================================================
4535 if test -n "$gonkdir"; then
4536 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
4539 case "$OS_TARGET:$NIGHTLY_BUILD" in
4541 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
4544 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
4547 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
4551 MOZ_ARG_ENABLE_BOOL(content-sandbox,
4552 [ --enable-content-sandbox Enable sandboxing support for content-processes
4553 --disable-content-sandbox Disable sandboxing support for content-processes],
4554 MOZ_CONTENT_SANDBOX=1,
4555 MOZ_CONTENT_SANDBOX=)
4557 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
4558 AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
4561 if test -n "$MOZ_CONTENT_SANDBOX"; then
4562 AC_DEFINE(MOZ_CONTENT_SANDBOX)
4565 AC_SUBST(MOZ_CONTENT_SANDBOX)
4567 dnl ========================================================
4568 dnl = Gecko Media Plugin sandboxing
4569 dnl ========================================================
4572 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
4577 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
4582 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
4586 if test -n "$MOZ_GMP_SANDBOX"; then
4587 AC_DEFINE(MOZ_GMP_SANDBOX)
4590 AC_SUBST(MOZ_GMP_SANDBOX)
4592 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
4596 if test -n "$MOZ_SANDBOX"; then
4597 AC_DEFINE(MOZ_SANDBOX)
4600 AC_SUBST(MOZ_SANDBOX)
4603 dnl ========================================================
4605 dnl = Module specific options
4607 dnl ========================================================
4608 MOZ_ARG_HEADER(Individual module options)
4610 dnl ========================================================
4611 dnl = Disable feed handling components
4612 dnl ========================================================
4613 MOZ_ARG_DISABLE_BOOL(feeds,
4614 [ --disable-feeds Disable feed handling and processing components],
4617 if test -n "$MOZ_FEEDS"; then
4618 AC_DEFINE(MOZ_FEEDS)
4620 if test "$MOZ_BUILD_APP" = "browser"; then
4621 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
4625 dnl ========================================================
4626 dnl Check for sqlite
4627 dnl ========================================================
4630 MOZ_ARG_ENABLE_BOOL(system-sqlite,
4631 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
4632 MOZ_SYSTEM_SQLITE=1,
4633 MOZ_SYSTEM_SQLITE= )
4635 if test -n "$MOZ_SYSTEM_SQLITE"
4637 dnl ============================
4638 dnl === SQLite Version check ===
4639 dnl ============================
4640 dnl Check to see if the system SQLite package is new enough.
4641 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
4643 dnl ==================================
4644 dnl === SQLITE_SECURE_DELETE check ===
4645 dnl ==================================
4646 dnl Check to see if the system SQLite package is compiled with
4647 dnl SQLITE_SECURE_DELETE enabled.
4648 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
4649 _SAVE_CFLAGS="$CFLAGS"
4650 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
4652 LIBS="$LIBS $SQLITE_LIBS"
4653 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
4655 #include "sqlite3.h"
4657 int main(int argc, char **argv){
4658 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
4660 ac_cv_sqlite_secure_delete=yes,
4661 ac_cv_sqlite_secure_delete=no,
4662 ac_cv_sqlite_secure_delete=no
4665 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
4666 CFLAGS="$_SAVE_CFLAGS"
4668 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
4669 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
4672 dnl ===============================
4673 dnl === SQLITE_THREADSAFE check ===
4674 dnl ===============================
4675 dnl Check to see if the system SQLite package is compiled with
4676 dnl SQLITE_THREADSAFE enabled.
4677 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
4678 _SAVE_CFLAGS="$CFLAGS"
4679 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
4681 LIBS="$LIBS $SQLITE_LIBS"
4682 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
4684 #include "sqlite3.h"
4686 int main(int argc, char **argv){
4687 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
4689 ac_cv_sqlite_threadsafe=yes,
4690 ac_cv_sqlite_threadsafe=no,
4691 ac_cv_sqlite_threadsafe=no
4694 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
4695 CFLAGS="$_SAVE_CFLAGS"
4697 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
4698 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
4701 dnl ================================
4702 dnl === SQLITE_ENABLE_FTS3 check ===
4703 dnl ================================
4704 dnl check to see if the system SQLite package is compiled with
4705 dnl SQLITE_ENABLE_FTS3 enabled.
4706 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
4707 _SAVE_CFLAGS="$CFLAGS"
4708 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
4710 LIBS="$LIBS $SQLITE_LIBS"
4711 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
4713 #include "sqlite3.h"
4715 int main(int argc, char **argv){
4716 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
4718 ac_cv_sqlite_enable_fts3=yes,
4719 ac_cv_sqlite_enable_fts3=no,
4720 ac_cv_sqlite_enable_fts3=no
4723 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
4724 CFLAGS="$_SAVE_CFLAGS"
4726 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
4727 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
4730 dnl =========================================
4731 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
4732 dnl =========================================
4733 dnl check to see if the system SQLite package is compiled with
4734 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
4735 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
4736 _SAVE_CFLAGS="$CFLAGS"
4737 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
4739 LIBS="$LIBS $SQLITE_LIBS"
4740 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
4742 #include "sqlite3.h"
4744 int main(int argc, char **argv){
4745 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
4747 ac_cv_sqlite_enable_unlock_notify=yes,
4748 ac_cv_sqlite_enable_unlock_notify=no,
4749 ac_cv_sqlite_enable_unlock_notify=no
4752 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
4753 CFLAGS="$_SAVE_CFLAGS"
4755 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
4756 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
4759 dnl =========================================
4760 dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
4761 dnl =========================================
4762 dnl check to see if the system SQLite package is compiled with
4763 dnl SQLITE_ENABLE_DBSTAT_VTAB.
4764 AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
4765 _SAVE_CFLAGS="$CFLAGS"
4766 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
4768 LIBS="$LIBS $SQLITE_LIBS"
4769 AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
4771 #include "sqlite3.h"
4773 int main(int argc, char **argv){
4774 return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
4776 ac_cv_sqlite_dbstat_vtab=yes,
4777 ac_cv_sqlite_dbstat_vtab=no,
4778 ac_cv_sqlite_dbstat_vtab=no
4781 AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
4782 CFLAGS="$_SAVE_CFLAGS"
4784 if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
4785 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
4789 if test -n "$MOZ_SYSTEM_SQLITE"; then
4790 AC_DEFINE(MOZ_SYSTEM_SQLITE)
4792 AC_SUBST(MOZ_SYSTEM_SQLITE)
4794 dnl ========================================================
4795 dnl = Enable help viewer (off by default)
4796 dnl ========================================================
4797 if test -n "$MOZ_HELP_VIEWER"; then
4798 dnl Do this if defined in confvars.sh
4799 AC_DEFINE(MOZ_HELP_VIEWER)
4802 dnl ========================================================
4803 dnl = Enable safe browsing (anti-phishing)
4804 dnl ========================================================
4805 MOZ_ARG_ENABLE_BOOL(safe-browsing,
4806 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
4807 MOZ_SAFE_BROWSING=1,
4808 MOZ_SAFE_BROWSING= )
4809 if test -n "$MOZ_SAFE_BROWSING"; then
4810 AC_DEFINE(MOZ_SAFE_BROWSING)
4812 AC_SUBST(MOZ_SAFE_BROWSING)
4814 dnl ========================================================
4815 dnl = Enable url-classifier
4816 dnl ========================================================
4817 dnl Implicitly enabled by default if building with safe-browsing
4818 if test -n "$MOZ_SAFE_BROWSING"; then
4819 MOZ_URL_CLASSIFIER=1
4821 MOZ_ARG_ENABLE_BOOL(url-classifier,
4822 [ --enable-url-classifier Enable url classifier module],
4823 MOZ_URL_CLASSIFIER=1,
4824 MOZ_URL_CLASSIFIER= )
4825 if test -n "$MOZ_URL_CLASSIFIER"; then
4826 AC_DEFINE(MOZ_URL_CLASSIFIER)
4828 AC_SUBST(MOZ_URL_CLASSIFIER)
4830 dnl ========================================================
4831 dnl = Disable zipwriter
4832 dnl ========================================================
4833 MOZ_ARG_DISABLE_BOOL(zipwriter,
4834 [ --disable-zipwriter Disable zipwriter component],
4837 AC_SUBST(MOZ_ZIPWRITER)
4839 dnl ========================================================
4840 dnl = faststripe theme
4841 dnl ========================================================
4842 MOZ_ARG_ENABLE_BOOL(faststripe,
4843 [ --enable-faststripe Use faststripe theme],
4844 MOZ_THEME_FASTSTRIPE=1,
4845 MOZ_THEME_FASTSTRIPE= )
4846 AC_SUBST(MOZ_THEME_FASTSTRIPE)
4848 dnl ========================================================
4850 dnl = Feature options that require extra sources to be pulled
4852 dnl ========================================================
4853 dnl MOZ_ARG_HEADER(Features that require extra sources)
4855 dnl ========================================================
4857 dnl = Runtime debugging and Optimization Options
4859 dnl ========================================================
4860 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
4862 dnl ========================================================
4863 dnl enable mobile optimizations
4864 dnl ========================================================
4865 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
4866 [ --enable-mobile-optimize
4867 Enable mobile optimizations],
4868 MOZ_GFX_OPTIMIZE_MOBILE=1)
4870 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
4872 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
4873 # We ignore paint will resample on mobile for performance.
4874 # We may want to revisit this later.
4875 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
4877 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
4878 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
4881 dnl ========================================================
4882 dnl = Enable code optimization. ON by default.
4883 dnl ========================================================
4884 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
4885 MOZ_OPTIMIZE_FLAGS="-O"
4888 if test -z "$MOZ_OPTIMIZE_RUSTFLAGS"; then
4889 MOZ_OPTIMIZE_RUSTFLAGS="-O"
4892 MOZ_ARG_ENABLE_STRING(optimize,
4893 [ --disable-optimize Disable compiler optimization
4894 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
4895 [ if test "$enableval" != "no"; then
4897 if test -n "$enableval" -a "$enableval" != "yes"; then
4898 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
4903 fi ], MOZ_OPTIMIZE=1)
4905 MOZ_SET_FRAMEPTR_FLAGS
4907 if test "$COMPILE_ENVIRONMENT"; then
4908 if test -n "$MOZ_OPTIMIZE"; then
4909 AC_MSG_CHECKING([for valid C compiler optimization flags])
4910 _SAVE_CFLAGS=$CFLAGS
4911 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
4912 AC_TRY_COMPILE([#include <stdio.h>],
4913 [printf("Hello World\n");],
4916 AC_MSG_RESULT([$_results])
4917 if test "$_results" = "no"; then
4918 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
4920 CFLAGS=$_SAVE_CFLAGS
4922 fi # COMPILE_ENVIRONMENT
4924 AC_SUBST(MOZ_OPTIMIZE)
4925 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
4926 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
4927 AC_SUBST(MOZ_OPTIMIZE_RUSTFLAGS)
4928 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
4929 AC_SUBST_LIST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
4931 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
4933 dnl ========================================================
4934 dnl = Enable NS_StackWalk.
4935 dnl ========================================================
4937 # On Windows, NS_StackWalk will only work correctly if we have frame pointers
4938 # available. That will only be true for non-optimized builds, debug builds or
4939 # builds with --enable-profiling in the .mozconfig (which is turned on in
4940 # Nightly by default.)
4941 case "$OS_TARGET" in
4943 if test -z "$MOZ_OPTIMIZE" -o -n "$MOZ_PROFILING" -o -n "$MOZ_DEBUG"; then
4954 if test -n "$MOZ_STACKWALKING"; then
4955 AC_DEFINE(MOZ_STACKWALKING)
4958 AC_SUBST(MOZ_STACKWALKING)
4960 dnl ========================================================
4961 dnl = Disable treating compiler warnings as errors
4962 dnl ========================================================
4963 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
4964 WARNINGS_AS_ERRORS=''
4967 dnl ========================================================
4968 dnl = Enable runtime logging
4969 dnl ========================================================
4970 AC_DEFINE(MOZ_LOGGING)
4971 AC_DEFINE(FORCE_PR_LOG)
4973 dnl ========================================================
4974 dnl = This will enable logging of addref, release, ctor, dtor.
4975 dnl ========================================================
4976 _ENABLE_LOGREFCNT=42
4977 MOZ_ARG_ENABLE_BOOL(logrefcnt,
4978 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
4979 _ENABLE_LOGREFCNT=1,
4980 _ENABLE_LOGREFCNT= )
4981 if test "$_ENABLE_LOGREFCNT" = "1"; then
4982 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
4983 elif test -z "$_ENABLE_LOGREFCNT"; then
4984 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
4987 dnl ========================================================
4988 dnl moz_dump_painting
4989 dnl ========================================================
4990 MOZ_ARG_ENABLE_BOOL(dump-painting,
4991 [ --enable-dump-painting Enable paint debugging.],
4992 MOZ_DUMP_PAINTING=1,
4993 MOZ_DUMP_PAINTING= )
4994 if test -n "$MOZ_DUMP_PAINTING"; then
4995 AC_DEFINE(MOZ_DUMP_PAINTING)
4996 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
4998 if test -n "$MOZ_DEBUG"; then
4999 AC_DEFINE(MOZ_DUMP_PAINTING)
5002 case "${OS_TARGET}" in
5003 Android|WINNT|Darwin)
5004 MOZ_GLUE_IN_PROGRAM=
5007 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
5008 MOZ_GLUE_IN_PROGRAM=1
5009 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
5013 if test -n "$MOZ_REPLACE_MALLOC"; then
5014 MOZ_SYSTEM_JEMALLOC=
5016 dnl Replace-malloc Mac linkage quirks
5017 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
5018 AC_CACHE_CHECK([how to do weak dynamic linking],
5019 ac_cv_weak_dynamic_linking,
5020 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
5021 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
5022 test -s conftest${DLL_SUFFIX}; then
5023 dnl There are several ways the linker can put link edit rules in a binary:
5024 dnl - classic info only (for OSX < 10.6)
5025 dnl - dyld info only
5027 if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
5032 if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
5037 dnl With classic info, we need to build with -flat_namespace.
5038 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
5039 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
5040 dnl forgets to set the weak flag in the dyld info.
5041 dnl See http://glandium.org/blog/?p=2764 for more details.
5043 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
5044 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
5045 dnl - "flat namespace" when -flat_namespace alone is needed
5046 dnl - "dummy library" when a dummy library and -flat_namespace are needed
5047 dnl - "compiler support" when nothing is needed
5048 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
5049 if test -n "$_CLASSIC_INFO"; then
5050 ac_cv_weak_dynamic_linking="flat namespace"
5052 ac_cv_weak_dynamic_linking="compiler support"
5055 if test -n "$_DYLD_INFO"; then
5056 ac_cv_weak_dynamic_linking="dummy library"
5058 ac_cv_weak_dynamic_linking="flat namespace"
5062 AC_ERROR([couldn't compile a simple C file])
5065 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
5068 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
5070 dnl ========================================================
5071 dnl = Jemalloc build setup
5072 dnl ========================================================
5073 if test -z "$MOZ_MEMORY"; then
5076 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
5077 AC_MSG_WARN([When not building jemalloc, you need to set WIN32_REDIST_DIR to the path to the Visual C++ Redist (usually VCINSTALLDIR\redist\x86\Microsoft.VC80.CRT, for VC++ v8) if you intend to distribute your build.])
5082 if test -n "$MOZ_JEMALLOC4" -a -z "$MOZ_REPLACE_MALLOC"; then
5083 MOZ_SYSTEM_JEMALLOC=1
5084 AC_CHECK_FUNCS(mallctl nallocx,,
5085 [MOZ_SYSTEM_JEMALLOC=
5087 if test -n "$MOZ_SYSTEM_JEMALLOC"; then
5088 AC_DEFINE(MOZ_SYSTEM_JEMALLOC)
5091 if test "x$MOZ_DEBUG" = "x1"; then
5092 AC_DEFINE(MOZ_MEMORY_DEBUG)
5094 dnl The generic feature tests that determine how to compute ncpus are long and
5095 dnl complicated. Therefore, simply define special cpp variables for the
5096 dnl platforms we have special knowledge of.
5099 export MOZ_NO_DEBUG_RTL=1
5103 AC_SUBST(MOZ_SYSTEM_JEMALLOC)
5104 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
5106 # Allow the application to provide a subconfigure script.
5107 # This should be after 'export MOZ_NO_DEBUG_RTL=1' since
5108 # ldap/c-sdk/configure refers to the enviroment value.
5109 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
5110 do_output_subdirs() {
5111 if test -n "$_subconfigure_subdirs"; then
5112 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
5114 _subconfigure_subdir="$1"
5115 _subconfigure_config_args="$ac_configure_args"
5117 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
5118 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
5119 "${srcdir}/build/autoconf/altoptions.m4" \
5120 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
5125 dnl We need to wrap dlopen and related functions on Android because we use
5127 dnl This configuration will only work on Android SDK 11 and above: Bug 1220184.
5128 if test "$OS_TARGET" = Android; then
5129 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
5130 MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=pthread_create,--wrap=epoll_wait,--wrap=poll,--wrap=pthread_cond_timedwait,--wrap=pthread_cond_wait,--wrap=epoll_create,--wrap=epoll_ctl,--wrap=close,--wrap=pthread_key_create,--wrap=pthread_key_delete,--wrap=socketpair,--wrap=pthread_self,--wrap=pthread_mutex_lock,--wrap=pthread_mutex_trylock,--wrap=pthread_join,--wrap=pipe,--wrap=pipe2"
5134 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
5135 export MOZ_GLUE_WRAP_LDFLAGS
5137 dnl ========================================================
5138 dnl = Enable using the clang plugin to build
5139 dnl ========================================================
5141 MOZ_CONFIG_CLANG_PLUGIN
5143 dnl ========================================================
5144 dnl = Enable stripping of libs & executables
5145 dnl ========================================================
5146 MOZ_ARG_ENABLE_BOOL(strip,
5147 [ --enable-strip Enable stripping of libs & executables ],
5151 dnl ========================================================
5152 dnl = Enable stripping of libs & executables when packaging
5153 dnl ========================================================
5154 MOZ_ARG_ENABLE_BOOL(install-strip,
5155 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
5159 dnl ========================================================
5160 dnl = --disable-elf-hack
5161 dnl ========================================================
5164 MOZ_ARG_DISABLE_BOOL(elf-hack,
5165 [ --disable-elf-hack Disable elf hacks],
5169 # Only enable elfhack where supported
5170 if test "$USE_ELF_HACK" = 1; then
5171 case "${HOST_OS_ARCH},${OS_ARCH}" in
5173 case "${CPU_ARCH}" in
5188 if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
5189 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
5190 dnl memory addresses it maps to. The result is that by the time elfhack
5191 dnl kicks in, it is not possible to apply relocations because of that,
5192 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
5193 dnl segment. It makes elfhack mostly useless, so considering the problems
5194 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
5195 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
5196 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
5197 dnl elfhack enabled, disable PT_GNU_RELRO instead.
5198 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
5199 LINK_WITH_PT_GNU_RELRO,
5200 [echo "int main() {return 0;}" > conftest.${ac_ext}
5201 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
5202 test -s conftest${ac_exeext}; then
5203 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
5204 LINK_WITH_PT_GNU_RELRO=yes
5206 LINK_WITH_PT_GNU_RELRO=no
5209 dnl We really don't expect to get here, but just in case
5210 AC_ERROR([couldn't compile a simple C file])
5213 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
5214 if test "$USE_ELF_HACK" = F; then
5215 AC_MSG_CHECKING([for -z norelro option to ld])
5216 _SAVE_LDFLAGS=$LDFLAGS
5217 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
5218 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
5219 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
5220 AC_ERROR([--enable-elf-hack is not compatible with a linker creating a PT_GNU_RELRO segment and that doesn't support the "-z norelro" option.]))
5223 AC_MSG_WARN([Disabling elfhack])
5227 fi # COMPILE_ENVIRONMENT and others.
5229 dnl ========================================================
5230 dnl = libstdc++ compatibility hacks
5231 dnl ========================================================
5234 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
5235 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
5238 if test -n "$STDCXX_COMPAT"; then
5239 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
5240 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
5241 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
5242 CXXFLAGS="$CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
5243 HOST_CXXFLAGS="$HOST_CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
5246 dnl ========================================================
5247 dnl = frontend JS debug mode
5248 dnl ========================================================
5250 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
5251 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
5255 AC_SUBST(DEBUG_JS_MODULES)
5257 dnl ========================================================
5259 dnl = Profiling and Instrumenting
5261 dnl ========================================================
5262 MOZ_ARG_HEADER(Profiling and Instrumenting)
5264 dnl ========================================================
5265 dnl = Enable TaskTracer
5266 dnl ========================================================
5267 MOZ_ARG_ENABLE_BOOL(tasktracer,
5268 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
5271 if test -n "$MOZ_TASK_TRACER"; then
5272 AC_DEFINE(MOZ_TASK_TRACER)
5273 AC_SUBST(MOZ_TASK_TRACER)
5276 dnl ========================================================
5277 dnl Turn on reflow counting
5278 dnl ========================================================
5279 MOZ_ARG_ENABLE_BOOL(reflow-perf,
5280 [ --enable-reflow-perf Enable reflow performance tracing],
5283 if test -n "$MOZ_REFLOW_PERF"; then
5284 AC_DEFINE(MOZ_REFLOW_PERF)
5287 dnl ========================================================
5288 dnl = Horizon build options - set default preferences for
5289 dnl the horizon project. Horizon is a browser built on
5290 dnl top of the graphene runtime.
5291 dnl ========================================================
5292 if test -n "$MOZ_HORIZON"; then
5293 AC_DEFINE(MOZ_HORIZON)
5295 AC_SUBST(MOZ_HORIZON)
5297 dnl ========================================================
5298 dnl = Offer a way to disable the startup cache
5299 dnl ========================================================
5301 MOZ_ARG_DISABLE_BOOL(startupcache,
5302 [ --disable-startupcache Disable startup cache ],
5303 MOZ_DISABLE_STARTUPCACHE=1,
5304 MOZ_DISABLE_STARTUPCACHE=)
5306 dnl bug 988880: disable startup cache on b2g
5307 if test -n "$MOZ_B2G"; then
5308 MOZ_DISABLE_STARTUPCACHE=1
5310 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
5311 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
5313 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
5315 dnl =========================================
5316 dnl = Enable packaging Gaia with B2G desktop
5317 dnl =========================================
5318 if test x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5319 if test -n "$GAIADIR" -a ! -d "$GAIADIR" ; then
5320 AC_MSG_ERROR([GAIADIR '$GAIADIR' isn't a valid directory])
5324 if test -n "$GAIADIR" ; then
5325 AC_DEFINE(PACKAGE_GAIA)
5328 if test -n "$FXOS_SIMULATOR" -a -z "$GAIADIR" ; then
5329 AC_MSG_ERROR([FXOS_SIMULATOR=1 requires GAIADIR to be defined])
5332 if test -n "$FXOS_SIMULATOR" ; then
5333 AC_DEFINE(FXOS_SIMULATOR)
5334 AC_SUBST(FXOS_SIMULATOR)
5338 dnl ========================================================
5339 dnl = Enable Radio Interface for B2G (Gonk usually)
5340 dnl ========================================================
5341 MOZ_ARG_ENABLE_BOOL(b2g-ril,
5342 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
5345 MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL )
5346 if test -n "$MOZ_B2G_RIL"; then
5347 if test -n "$_PLATFORM_HAVE_RIL"; then
5348 AC_DEFINE(MOZ_B2G_RIL)
5350 AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.])
5353 AC_SUBST(MOZ_B2G_RIL)
5355 dnl ========================================================
5356 dnl = Enable Radio FM for B2G (Gonk usually)
5357 dnl ========================================================
5358 if test -n "$MOZ_B2G_FM"; then
5359 AC_DEFINE(MOZ_B2G_FM)
5361 AC_SUBST(MOZ_B2G_FM)
5363 dnl ========================================================
5364 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
5365 dnl ========================================================
5366 MOZ_ARG_ENABLE_BOOL(b2g-bt,
5367 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
5370 if test -n "$MOZ_B2G_BT"; then
5371 AC_DEFINE(MOZ_B2G_BT)
5373 AC_SUBST(MOZ_B2G_BT)
5374 AC_SUBST(MOZ_B2G_BT_BLUEZ)
5375 AC_SUBST(MOZ_B2G_BT_DAEMON)
5377 dnl ========================================================
5378 dnl = Enable NFC Interface for B2G (Gonk usually)
5379 dnl ========================================================
5380 MOZ_ARG_ENABLE_BOOL(nfc,
5381 [ --enable-nfc Set compile flags necessary for compiling NFC API ],
5384 if test -n "$MOZ_NFC"; then
5389 dnl ========================================================
5390 dnl = Enable Pico Speech Synthesis (Gonk usually)
5391 dnl ========================================================
5392 MOZ_ARG_ENABLE_BOOL(synth-pico,
5393 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
5396 if test -n "$MOZ_SYNTH_PICO"; then
5397 AC_DEFINE(MOZ_SYNTH_PICO)
5399 AC_SUBST(MOZ_SYNTH_PICO)
5401 dnl ========================================================
5402 dnl = Enable Support for Time Manager API
5403 dnl ========================================================
5404 if test -n "$MOZ_TIME_MANAGER"; then
5405 AC_DEFINE(MOZ_TIME_MANAGER)
5407 AC_SUBST(MOZ_TIME_MANAGER)
5409 dnl ========================================================
5410 dnl = Enable Camera Interface for B2G (Gonk usually)
5411 dnl ========================================================
5412 MOZ_ARG_ENABLE_BOOL(b2g-camera,
5413 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
5416 if test -n "$MOZ_B2G_CAMERA"; then
5417 AC_DEFINE(MOZ_B2G_CAMERA)
5419 AC_SUBST(MOZ_B2G_CAMERA)
5421 dnl ========================================================
5422 dnl = Enable Support for SimplePush (Gonk usually)
5423 dnl This will disable the Push API.
5424 dnl ========================================================
5425 if test -n "$MOZ_SIMPLEPUSH"; then
5426 AC_DEFINE(MOZ_SIMPLEPUSH)
5428 AC_SUBST(MOZ_SIMPLEPUSH)
5430 dnl ========================================================
5431 dnl = Enable Support for Payment API
5432 dnl ========================================================
5433 if test -n "$MOZ_PAY"; then
5438 dnl ========================================================
5439 dnl = Enable Support for AudioChannelManager API
5440 dnl ========================================================
5441 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
5442 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
5444 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
5446 dnl ========================================================
5447 dnl = Enable Support for Secure Element API
5448 dnl ========================================================
5449 MOZ_SECUREELEMENT=1,
5450 if test -n "$MOZ_SECUREELEMENT"; then
5451 AC_DEFINE(MOZ_SECUREELEMENT)
5453 AC_SUBST(MOZ_SECUREELEMENT)
5455 dnl ========================================================
5456 dnl = Support for demangling undefined symbols
5457 dnl ========================================================
5458 if test -z "$SKIP_LIBRARY_CHECKS"; then
5461 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
5465 # Demangle only for debug or DMD builds
5466 MOZ_DEMANGLE_SYMBOLS=
5467 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
5468 MOZ_DEMANGLE_SYMBOLS=1
5469 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
5471 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
5473 dnl ========================================================
5474 dnl = Support for gcc stack unwinding (from gcc 3.3)
5475 dnl ========================================================
5476 if test -z "$SKIP_LIBRARY_CHECKS"; then
5479 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
5483 dnl ========================================================
5485 dnl ========================================================
5487 MOZ_ARG_WITH_STRING(jitreport-granularity,
5488 [ --jitreport-granularity=N
5489 Default granularity at which to report JIT code
5492 1 - code ranges for whole functions only
5493 2 - per-line information
5494 3 - per-op information],
5495 JITREPORT_GRANULARITY=$withval,
5496 JITREPORT_GRANULARITY=3)
5498 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
5500 dnl ========================================================
5501 dnl = Disable Mozilla's versions of RIL and Geolocation
5502 dnl ========================================================
5503 MOZ_ARG_DISABLE_BOOL(mozril-geoloc,
5504 [ --disable-mozril-geoloc Disable Mozilla's RIL and geolocation],
5505 DISABLE_MOZ_RIL_GEOLOC=1,
5506 DISABLE_MOZ_RIL_GEOLOC= )
5507 if test -n "$DISABLE_MOZ_RIL_GEOLOC"; then
5508 AC_DEFINE(DISABLE_MOZ_RIL_GEOLOC)
5510 AC_SUBST(DISABLE_MOZ_RIL_GEOLOC)
5512 dnl ========================================================
5513 dnl = Use the Servo Style System for Gecko.
5515 dnl = This linkage setup is temporary, and for experimental
5516 dnl = purposes. We will vendor servo and integrate the build
5517 dnl = systems before actually shipping anything.
5518 dnl ========================================================
5519 MOZ_ARG_WITH_STRING(servo,
5520 [ --with-servo=SERVO_TARGET_DIR
5521 Absolute path of the target directory where libgeckoservo can
5522 be found. This is generally servo_src_dir/target/release.
5523 Passing this flag enables experimental integration with the
5524 servo style system],
5525 SERVO_TARGET_DIR=$withval,
5527 if test -n "$SERVO_TARGET_DIR"; then
5528 if test -n "$_WIN32_MSVC"; then
5529 MOZ_SERVO_LIBS="${SERVO_TARGET_DIR}/geckoservo"
5531 MOZ_SERVO_LIBS="-L${SERVO_TARGET_DIR} -lgeckoservo"
5533 AC_DEFINE(MOZ_STYLO)
5534 AC_SUBST_LIST(MOZ_SERVO_LIBS)
5537 dnl ========================================================
5541 dnl ========================================================
5542 MOZ_ARG_HEADER(Misc. Options)
5544 dnl ========================================================
5545 dnl = Define default location for MOZILLA_FIVE_HOME
5546 dnl ========================================================
5547 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
5548 [ --with-default-mozilla-five-home
5549 Set the default value for MOZILLA_FIVE_HOME],
5550 [ val=`echo $withval`
5551 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
5553 dnl ========================================================
5554 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
5555 dnl ========================================================
5556 MOZ_ARG_WITH_STRING(user-appdir,
5557 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
5558 [ val=`echo $withval`
5559 if echo "$val" | grep "\/" >/dev/null; then
5560 AC_MSG_ERROR("Homedir must be single relative path.")
5565 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
5567 dnl ========================================================
5568 dnl = Doxygen configuration
5569 dnl ========================================================
5570 dnl Use commas to specify multiple dirs to this arg
5571 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
5572 MOZ_ARG_WITH_STRING(doc-input-dirs,
5573 [ --with-doc-input-dirs=DIRS
5574 Header/idl dirs to create docs from],
5575 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
5576 AC_SUBST(MOZ_DOC_INPUT_DIRS)
5578 dnl Use commas to specify multiple dirs to this arg
5579 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
5580 MOZ_ARG_WITH_STRING(doc-include-dirs,
5581 [ --with-doc-include-dirs=DIRS
5582 Include dirs to preprocess doc headers],
5583 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
5584 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
5586 MOZ_DOC_OUTPUT_DIR='./dist/docs'
5587 MOZ_ARG_WITH_STRING(doc-output-dir,
5588 [ --with-doc-output-dir=DIR
5589 Dir to generate docs into],
5590 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
5591 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
5593 if test -z "$SKIP_COMPILER_CHECKS"; then
5594 dnl ========================================================
5596 dnl = Compiler Options
5598 dnl ========================================================
5599 MOZ_ARG_HEADER(Compiler Options)
5601 dnl ========================================================
5602 dnl Check for gcc -pipe support
5603 dnl ========================================================
5604 AC_MSG_CHECKING([for -pipe support])
5605 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
5606 dnl Any gcc that supports firefox supports -pipe.
5607 CFLAGS="$CFLAGS -pipe"
5608 CXXFLAGS="$CXXFLAGS -pipe"
5609 AC_MSG_RESULT([yes])
5614 dnl ========================================================
5615 dnl Profile guided optimization (gcc checks)
5616 dnl ========================================================
5617 dnl Test for profiling options
5618 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
5620 _SAVE_CFLAGS="$CFLAGS"
5621 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
5623 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
5624 AC_TRY_COMPILE([], [return 0;],
5625 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
5626 result="yes" ], result="no")
5627 AC_MSG_RESULT([$result])
5629 if test $result = "yes"; then
5630 PROFILE_GEN_LDFLAGS="-fprofile-generate"
5631 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
5632 PROFILE_USE_LDFLAGS="-fprofile-use"
5635 CFLAGS="$_SAVE_CFLAGS"
5637 AC_SUBST(PROFILE_GEN_CFLAGS)
5638 AC_SUBST(PROFILE_GEN_LDFLAGS)
5639 AC_SUBST(PROFILE_USE_CFLAGS)
5640 AC_SUBST(PROFILE_USE_LDFLAGS)
5642 fi # ! SKIP_COMPILER_CHECKS
5644 AC_DEFINE(CPP_THROW_NEW, [throw()])
5647 if test "$COMPILE_ENVIRONMENT"; then
5649 fi # COMPILE_ENVIRONMENT
5651 dnl ========================================================
5653 dnl = Build depencency options
5655 dnl ========================================================
5656 MOZ_ARG_HEADER(Build dependencies)
5658 if test "$GNU_CC" -a "$GNU_CXX"; then
5659 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
5661 dnl Don't override this for MSVC
5662 if test -z "$_WIN32_MSVC"; then
5663 _USE_CPP_INCLUDE_FLAG=
5664 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
5665 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
5667 echo '#include <stdio.h>' > dummy-hello.c
5669 dnl This output is localized, split at the first double space or colon and space.
5670 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
5671 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
5672 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
5674 if ! test -e "$_CL_STDIO_PATH"; then
5675 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
5677 if test -z "$CL_INCLUDES_PREFIX"; then
5678 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
5680 AC_SUBST(CL_INCLUDES_PREFIX)
5683 dnl Make sure that the build system can handle non-ASCII characters
5684 dnl in environment variables to prevent it from breaking silently on
5685 dnl non-English systems.
5686 NONASCII=$'\241\241'
5691 dnl ========================================================
5693 dnl = Static Build Options
5695 dnl ========================================================
5696 MOZ_ARG_HEADER(Static build options)
5698 if test -z "$MOZ_SYSTEM_ZLIB"; then
5699 if test -n "$JS_SHARED_LIBRARY"; then
5701 AC_DEFINE(ZLIB_IN_MOZGLUE)
5705 AC_SUBST(ZLIB_IN_MOZGLUE)
5707 dnl ========================================================
5709 dnl = Standalone module options
5711 dnl ========================================================
5712 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
5715 dnl ========================================================
5717 if test -z "$SKIP_PATH_CHECKS"; then
5718 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
5719 if test "$MOZ_ENABLE_GTK" ; then
5720 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
5725 if test -z "${GLIB_GMODULE_LIBS}" \
5726 -a -n "${GLIB_CONFIG}"\
5727 -a "${GLIB_CONFIG}" != no\
5729 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
5732 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
5734 dnl ========================================================
5735 dnl Graphics checks.
5736 dnl ========================================================
5738 if test "${OS_TARGET}" = "WINNT" -o \
5739 "${OS_ARCH}" = "Darwin" -o \
5740 "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
5741 "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
5742 "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
5743 "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
5744 case "${CPU_ARCH}" in
5756 MOZ_ARG_ENABLE_BOOL(skia,
5757 [ --enable-skia Enable use of Skia],
5761 dnl Skia GPU support may not reliably build on certain *BSDs (see bug 1234494).
5762 if test "${OS_TARGET}" = "OpenBSD" -o \
5763 "${OS_TARGET}" = "NetBSD"; then \
5764 MOZ_DISABLE_SKIA_GPU=1
5766 MOZ_DISABLE_SKIA_GPU=
5769 MOZ_ARG_DISABLE_BOOL(skia-gpu,
5770 [ --disable-skia-gpu Disable use of Skia-GPU],
5771 MOZ_DISABLE_SKIA_GPU=1,
5772 MOZ_DISABLE_SKIA_GPU=)
5774 if test "$USE_FC_FREETYPE"; then
5775 if test "$COMPILE_ENVIRONMENT"; then
5776 dnl ========================================================
5777 dnl = Check for freetype2 and its functionality
5778 dnl ========================================================
5779 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
5781 if test "$_HAVE_FREETYPE2"; then
5783 _SAVE_CFLAGS="$CFLAGS"
5784 LIBS="$LIBS $FT2_LIBS"
5785 CFLAGS="$CFLAGS $FT2_CFLAGS"
5787 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
5788 ac_cv_member_FT_Bitmap_Size_y_ppem,
5789 [AC_TRY_COMPILE([#include <ft2build.h>
5790 #include FT_FREETYPE_H],
5792 if (sizeof s.y_ppem) return 0;
5794 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
5795 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
5796 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
5797 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
5799 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
5801 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
5802 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
5803 [FT_Bitmap_Size structure includes y_ppem field])
5805 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
5808 CFLAGS="$_SAVE_CFLAGS"
5811 _SAVE_CPPFLAGS="$CPPFLAGS"
5812 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
5813 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
5814 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
5815 CPPFLAGS="$_SAVE_CPPFLAGS"
5817 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
5820 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig >= $FONTCONFIG_VERSION,
5822 if test "$MOZ_PANGO"; then
5823 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
5824 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
5826 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
5827 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
5832 dnl ========================================================
5833 dnl Check for pixman and cairo
5834 dnl ========================================================
5837 MOZ_ARG_ENABLE_BOOL(system-cairo,
5838 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
5843 MOZ_ARG_ENABLE_BOOL(system-pixman,
5844 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
5846 MOZ_TREE_PIXMAN=force,
5849 # System cairo depends on system pixman
5850 if test "$MOZ_TREE_PIXMAN" = "force"; then
5851 if test -z "$MOZ_TREE_CAIRO"; then
5852 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
5856 elif test -z "$MOZ_TREE_CAIRO"; then
5860 if test "$MOZ_TREE_PIXMAN"; then
5861 AC_DEFINE(MOZ_TREE_PIXMAN)
5863 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
5866 # Check for headers defining standard int types.
5867 if test -n "$COMPILE_ENVIRONMENT"; then
5868 MOZ_CHECK_HEADERS(stdint.h inttypes.h)
5870 if test "${ac_cv_header_inttypes_h}" = "yes"; then
5875 AC_SUBST(HAVE_INTTYPES_H)
5877 if test "$MOZ_TREE_CAIRO"; then
5878 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
5879 AC_DEFINE(MOZ_TREE_CAIRO)
5881 if test "$OS_ARCH" = "WINNT"; then
5882 # For now we assume that we will have a uint64_t available through
5883 # one of the above headers or mozstdint.h.
5884 AC_DEFINE(HAVE_UINT64_T)
5887 # Define macros for cairo-features.h
5888 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
5889 if test "$MOZ_X11"; then
5890 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
5891 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
5892 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
5894 if test "$_HAVE_FREETYPE2"; then
5895 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
5896 MOZ_ENABLE_CAIRO_FT=1
5897 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
5900 case "$MOZ_WIDGET_TOOLKIT" in
5902 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
5903 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
5904 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
5907 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
5908 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
5909 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
5910 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
5911 MOZ_ENABLE_D2D_SURFACE=1
5912 MOZ_ENABLE_DWRITE_FONT=1
5914 if test "$COMPILE_ENVIRONMENT"; then
5916 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
5918 dnl D3D10 Layers depend on D2D Surfaces.
5919 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
5920 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
5925 if test "$USE_FC_FREETYPE"; then
5926 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
5928 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
5929 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
5930 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
5931 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
5932 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
5934 AC_SUBST(PS_SURFACE_FEATURE)
5935 AC_SUBST(SVG_SURFACE_FEATURE)
5936 AC_SUBST(XLIB_SURFACE_FEATURE)
5937 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
5938 AC_SUBST(QUARTZ_SURFACE_FEATURE)
5939 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
5940 AC_SUBST(WIN32_SURFACE_FEATURE)
5941 AC_SUBST(OS2_SURFACE_FEATURE)
5942 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
5943 AC_SUBST(FT_FONT_FEATURE)
5944 AC_SUBST(FC_FONT_FEATURE)
5945 AC_SUBST(WIN32_FONT_FEATURE)
5946 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
5947 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
5948 AC_SUBST(QUARTZ_FONT_FEATURE)
5949 AC_SUBST(PNG_FUNCTIONS_FEATURE)
5950 AC_SUBST(QT_SURFACE_FEATURE)
5951 AC_SUBST(TEE_SURFACE_FEATURE)
5953 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
5955 if test "$MOZ_X11"; then
5956 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
5959 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
5961 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
5962 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
5963 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
5964 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
5965 if test "$MOZ_X11"; then
5966 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
5967 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
5968 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
5969 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
5973 case "$MOZ_WIDGET_TOOLKIT" in
5975 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
5976 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
5980 AC_SUBST(MOZ_TREE_CAIRO)
5981 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
5982 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
5983 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
5984 AC_SUBST(MOZ_TREE_PIXMAN)
5986 dnl ========================================================
5988 dnl ========================================================
5989 if test "$MOZ_ENABLE_SKIA"; then
5990 SKIA_INCLUDES="/gfx/skia /gfx/skia/skia/include/config /gfx/skia/skia/include/core"
5991 AC_DEFINE(MOZ_ENABLE_SKIA)
5993 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
5994 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
5997 if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" -a "${CPU_ARCH}" != "sparc64" -a -z "$MOZ_DISABLE_SKIA_GPU" ; then
5998 SKIA_INCLUDES="$SKIA_INCLUDES /gfx/skia/skia/include/gpu /gfx/skia/skia/include/utils"
5999 MOZ_ENABLE_SKIA_GPU=1
6000 AC_DEFINE(USE_SKIA_GPU)
6001 AC_SUBST(MOZ_ENABLE_SKIA_GPU)
6004 AC_SUBST(MOZ_ENABLE_SKIA)
6005 AC_SUBST_LIST(SKIA_INCLUDES)
6007 dnl ========================================================
6009 dnl ========================================================
6010 MOZ_ARG_DISABLE_BOOL(xul,
6011 [ --disable-xul Disable XUL],
6013 if test "$MOZ_XUL"; then
6016 dnl remove extensions that require XUL
6017 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
6022 dnl ========================================================
6023 dnl necko configuration options
6024 dnl ========================================================
6027 dnl option to disable various necko protocols
6029 MOZ_ARG_ENABLE_STRING(necko-protocols,
6030 [ --enable-necko-protocols[={http,ftp,default,all,none}]
6031 Enable/disable specific protocol handlers],
6032 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6033 if test "$option" = "yes" -o "$option" = "all"; then
6034 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
6035 elif test "$option" = "no" -o "$option" = "none"; then
6037 elif test "$option" = "default"; then
6038 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
6039 elif test `echo "$option" | grep -c \^-` != 0; then
6040 option=`echo $option | sed 's/^-//'`
6041 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
6043 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
6046 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
6047 AC_SUBST_SET(NECKO_PROTOCOLS)
6048 for p in $NECKO_PROTOCOLS; do
6049 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
6050 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
6054 dnl option to disable necko's wifi scanner
6057 case "$OS_TARGET" in
6059 if test -n "$gonkdir"; then
6064 if test -z "$MOZ_IOS"; then
6068 DragonFly|FreeBSD|WINNT)
6077 MOZ_ARG_DISABLE_BOOL(necko-wifi,
6078 [ --disable-necko-wifi Disable necko wifi scanner],
6082 if test "$NECKO_WIFI"; then
6083 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
6084 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
6086 AC_DEFINE(NECKO_WIFI)
6087 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
6089 AC_SUBST(NECKO_WIFI)
6090 AC_SUBST(NECKO_WIFI_DBUS)
6093 dnl option to disable cookies
6095 MOZ_ARG_DISABLE_BOOL(cookies,
6096 [ --disable-cookies Disable cookie support],
6099 AC_SUBST(NECKO_COOKIES)
6100 if test "$NECKO_COOKIES"; then
6101 AC_DEFINE(NECKO_COOKIES)
6102 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
6106 dnl Always build Marionette if not Android or B2G
6108 if test "$OS_TARGET" != Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
6109 AC_DEFINE(ENABLE_MARIONETTE)
6111 AC_SUBST(ENABLE_MARIONETTE)
6112 if test "$ENABLE_MARIONETTE"; then
6113 AC_DEFINE(ENABLE_MARIONETTE)
6117 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
6119 MOZ_ARG_DISABLE_BOOL(ctypes,
6120 [ --disable-ctypes Disable js-ctypes],
6123 AC_SUBST(BUILD_CTYPES)
6124 if test "$BUILD_CTYPES"; then
6125 AC_DEFINE(BUILD_CTYPES)
6128 dnl ========================================================
6129 if test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
6130 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6133 dnl ========================================================
6135 dnl = Maintainer debug option (no --enable equivalent)
6137 dnl ========================================================
6141 AC_SUBST(AR_EXTRACT)
6144 AC_SUBST(AS_DASH_C_FLAG)
6152 AC_SUBST(MOZ_AUTH_EXTENSION)
6153 AC_SUBST(MOZ_PREF_EXTENSIONS)
6155 AC_SUBST(MOZ_DEBUG_LDFLAGS)
6156 AC_SUBST(WARNINGS_AS_ERRORS)
6157 AC_SUBST_SET(MOZ_EXTENSIONS)
6159 AC_SUBST(MOZ_TOOLKIT_SEARCH)
6161 AC_SUBST(NS_PRINTING)
6162 AC_SUBST(MOZ_HELP_VIEWER)
6164 AC_SUBST(MOZ_UNIVERSALCHARDET)
6165 AC_SUBST(ACCESSIBILITY)
6166 AC_SUBST(MOZ_SPELLCHECK)
6167 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
6168 AC_SUBST(MOZ_CRASHREPORTER)
6169 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
6170 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
6171 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
6172 AC_SUBST(MOZ_STUB_INSTALLER)
6173 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
6174 AC_SUBST(MOZ_ENABLE_SIGNMAR)
6175 AC_SUBST(MOZ_UPDATER)
6177 AC_SUBST(MOZ_ANGLE_RENDERER)
6178 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
6179 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
6180 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
6181 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
6182 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
6183 AC_SUBST(MOZ_D3DCOMPILER_XP_DLL)
6184 AC_SUBST(MOZ_D3DCOMPILER_XP_CAB)
6186 AC_SUBST(MOZ_WEBSMS_BACKEND)
6187 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
6188 AC_SUBST(MOZ_ANDROID_GECKOLIBS_AAR)
6189 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
6190 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
6191 AC_SUBST(MOZ_ANDROID_SEARCH_INTENT_CLASS)
6192 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
6193 AC_SUBST(MOZ_INSTALL_TRACKING)
6194 AC_SUBST(ENABLE_STRIP)
6195 AC_SUBST(PKG_SKIP_STRIP)
6196 AC_SUBST(STRIP_FLAGS)
6197 AC_SUBST(USE_ELF_HACK)
6198 AC_SUBST(INCREMENTAL_LINKER)
6199 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
6201 AC_SUBST(MOZ_FIX_LINK_PATHS)
6203 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
6204 AC_SUBST(MOZ_LINKER_EXTRACT)
6206 if test -n "$MOZ_BINARY_EXTENSIONS"; then
6207 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
6210 AC_SUBST(MOZ_ADDON_SIGNING)
6211 if test "$MOZ_ADDON_SIGNING" = 1; then
6212 AC_DEFINE(MOZ_ADDON_SIGNING)
6214 AC_SUBST(MOZ_REQUIRE_SIGNING)
6215 if test "$MOZ_REQUIRE_SIGNING" = 1; then
6216 AC_DEFINE(MOZ_REQUIRE_SIGNING)
6219 AC_SUBST(MOZ_JSDOWNLOADS)
6220 if test -n "$MOZ_JSDOWNLOADS"; then
6221 AC_DEFINE(MOZ_JSDOWNLOADS)
6224 dnl ========================================================
6225 dnl = Mac bundle name prefix
6226 dnl ========================================================
6227 MOZ_ARG_WITH_STRING(macbundlename-prefix,
6228 [ --with-macbundlename-prefix=prefix
6229 Prefix for MOZ_MACBUNDLE_NAME],
6230 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
6232 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
6233 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
6234 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
6237 if test "$MOZ_DEBUG"; then
6238 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
6240 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
6242 AC_SUBST(MOZ_MACBUNDLE_NAME)
6244 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
6245 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
6246 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
6247 if test "$MOZ_DEBUG"; then
6248 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
6251 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
6252 AC_SUBST(MOZ_MACBUNDLE_ID)
6254 dnl ========================================================
6255 dnl = Child Process Name for IPC
6256 dnl ========================================================
6257 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
6258 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
6260 # We want to let Android unpack the file at install time, but it only does
6261 # so if the file is named libsomething.so. The lib/ path is also required
6262 # because the unpacked file will be under the lib/ subdirectory and will
6263 # need to be executed from that path.
6264 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
6265 MOZ_CHILD_PROCESS_NAME_PIE="libplugin-container-pie.so"
6266 AC_SUBST(MOZ_CHILD_PROCESS_NAME_PIE)
6268 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
6270 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
6271 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
6273 # The following variables are available to branding and application
6274 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
6275 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
6276 # impacts profile location and user-visible fields.
6277 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
6278 # versions of a given application (e.g. Aurora and Firefox both use
6279 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
6280 # for application.ini's "Name" field, which controls profile location in
6281 # the absence of a "Profile" field (see below), and various system
6282 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
6283 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
6284 # Mac Bundle name, Updater, Installer), it is typically used for nightly
6285 # builds (e.g. Aurora for Firefox).
6286 # - MOZ_APP_VERSION: Defines the application version number.
6287 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
6288 # in the "About" window. If not set, defaults to MOZ_APP_VERSION.
6289 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
6290 # defaults to a lowercase form of MOZ_APP_BASENAME.
6291 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
6292 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
6293 # - MOZ_APP_PROFILE: When set, used for application.ini's
6294 # "Profile" field, which controls profile location.
6295 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
6296 # crash reporter server url.
6297 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
6298 # the main application is set to the value of this variable. If not
6299 # set, it falls back to a Mozilla-specific value derived from the
6301 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
6302 # packages produced.
6303 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
6304 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
6305 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
6307 if test -z "$MOZ_APP_NAME"; then
6308 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
6311 if test -z "$MOZ_APP_REMOTINGNAME"; then
6312 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
6315 if test -z "$MOZ_APP_VERSION_DISPLAY"; then
6316 MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
6319 if test -z "$ANDROID_PACKAGE_NAME" ; then
6320 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
6323 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
6324 # the public with specific common shared IDs and we need to keep them
6325 # consistent forever. The specific common values are set by per-channel
6326 # branding; all other channels use a generic sharedID, set below.
6327 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
6328 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
6331 # For extensions and langpacks, we require a max version that is compatible
6332 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
6333 # 24.0a1 and 24.0a2 aren't affected
6335 # 24.1.1 becomes 24.*
6336 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
6337 if test -z "$IS_ALPHA"; then
6339 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
6340 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
6342 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
6346 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
6349 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
6350 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
6351 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
6353 AC_SUBST(MOZ_APP_NAME)
6354 AC_SUBST(MOZ_APP_REMOTINGNAME)
6355 AC_SUBST(MOZ_APP_DISPLAYNAME)
6356 AC_SUBST(MOZ_APP_BASENAME)
6357 AC_SUBST(MOZ_APP_VENDOR)
6358 AC_SUBST(MOZ_APP_PROFILE)
6359 AC_SUBST(MOZ_APP_ID)
6360 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
6361 AC_SUBST(MOZ_ANDROID_SHARED_ID)
6362 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
6363 AC_SUBST(MAR_CHANNEL_ID)
6364 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
6365 AC_SUBST(MOZ_PROFILE_MIGRATOR)
6366 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
6367 AC_SUBST(MOZ_APP_UA_NAME)
6368 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
6369 AC_SUBST(MOZ_APP_VERSION)
6370 AC_SUBST(MOZ_APP_VERSION_DISPLAY)
6371 AC_SUBST(MOZ_APP_MAXVERSION)
6372 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
6373 AC_SUBST(FIREFOX_VERSION)
6374 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
6375 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
6376 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
6379 AC_SUBST(MOZ_APP_STATIC_INI)
6381 AC_SUBST(MOZ_PKG_SPECIAL)
6382 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
6384 AC_SUBST(MOZILLA_OFFICIAL)
6385 if test "$MOZILLA_OFFICIAL"; then
6386 AC_DEFINE(MOZILLA_OFFICIAL)
6387 # Build revisions should always be present in official builds
6388 MOZ_INCLUDE_SOURCE_INFO=1
6391 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
6392 # explicitly set the repository and changeset information in.
6393 AC_SUBST(MOZ_SOURCE_REPO)
6394 AC_SUBST(MOZ_SOURCE_CHANGESET)
6395 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
6397 if test "$MOZ_TELEMETRY_REPORTING"; then
6398 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
6400 # Enable Telemetry by default for nightly and aurora channels
6401 if test -z "$RELEASE_BUILD"; then
6402 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
6406 dnl If we have any service that uploads data (and requires data submission
6407 dnl policy alert), set MOZ_DATA_REPORTING.
6408 dnl We need SUBST for build system and DEFINE for xul preprocessor.
6409 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
6410 MOZ_DATA_REPORTING=1
6411 AC_DEFINE(MOZ_DATA_REPORTING)
6412 AC_SUBST(MOZ_DATA_REPORTING)
6416 AC_SUBST(WIN32_REDIST_DIR)
6417 AC_SUBST(WIN_UCRT_REDIST_DIR)
6420 dnl Echo the CFLAGS to remove extra whitespace.
6426 $_WARNINGS_CXXFLAGS \
6429 COMPILE_CFLAGS=`echo \
6433 COMPILE_CXXFLAGS=`echo \
6434 $_DEFINES_CXXFLAGS \
6440 HOST_CXXFLAGS=`echo \
6443 AC_SUBST(_DEPEND_CFLAGS)
6444 AC_SUBST(MOZ_SYSTEM_JPEG)
6445 AC_SUBST(MOZ_SYSTEM_PNG)
6446 AC_SUBST(MOZ_SYSTEM_BZ2)
6448 AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
6449 AC_SUBST_LIST(MOZ_JPEG_LIBS)
6450 AC_SUBST_LIST(MOZ_BZ2_CFLAGS)
6451 AC_SUBST_LIST(MOZ_BZ2_LIBS)
6452 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
6453 AC_SUBST_LIST(MOZ_PNG_LIBS)
6455 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
6456 export MOZ_NUWA_PROCESS
6457 AC_DEFINE(MOZ_NUWA_PROCESS)
6459 AC_SUBST(MOZ_NUWA_PROCESS)
6460 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_B2G_LOADER"; then
6461 if test -z "$MOZ_NUWA_PROCESS"; then
6462 AC_MSG_ERROR([B2G loader works with Nuwa]);
6464 export MOZ_B2G_LOADER
6465 AC_DEFINE(MOZ_B2G_LOADER)
6467 AC_SUBST(MOZ_B2G_LOADER)
6469 AC_SUBST(MOZ_SYSTEM_NSPR)
6471 AC_SUBST(MOZ_SYSTEM_NSS)
6472 AC_SUBST(NSS_DISABLE_DBM)
6474 HOST_CMFLAGS=-fobjc-exceptions
6475 HOST_CMMFLAGS=-fobjc-exceptions
6476 OS_COMPILE_CMFLAGS=-fobjc-exceptions
6477 OS_COMPILE_CMMFLAGS=-fobjc-exceptions
6478 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
6479 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
6480 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
6482 AC_SUBST(HOST_CMFLAGS)
6483 AC_SUBST(HOST_CMMFLAGS)
6484 AC_SUBST(OS_COMPILE_CMFLAGS)
6485 AC_SUBST(OS_COMPILE_CMMFLAGS)
6488 OS_CXXFLAGS="$CXXFLAGS"
6489 OS_CPPFLAGS="$CPPFLAGS"
6490 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
6491 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
6492 OS_LDFLAGS="$LDFLAGS"
6495 AC_SUBST(OS_CXXFLAGS)
6496 AC_SUBST(OS_CPPFLAGS)
6497 AC_SUBST(OS_COMPILE_CFLAGS)
6498 AC_SUBST(OS_COMPILE_CXXFLAGS)
6499 AC_SUBST(OS_LDFLAGS)
6504 AC_SUBST(HOST_CFLAGS)
6505 AC_SUBST(HOST_CPPFLAGS)
6506 AC_SUBST(HOST_CXXFLAGS)
6507 AC_SUBST(HOST_LDFLAGS)
6508 AC_SUBST(HOST_OPTIMIZE_FLAGS)
6510 AC_SUBST(HOST_AR_FLAGS)
6512 AC_SUBST(HOST_RANLIB)
6513 AC_SUBST(HOST_BIN_SUFFIX)
6517 AC_SUBST(TARGET_XPCOM_ABI)
6518 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
6519 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
6520 AC_SUBST(HAVE_X86_AVX2)
6521 AC_SUBST(GCC_USE_GNU_LD)
6523 AC_SUBST(WRAP_LDFLAGS)
6526 AC_SUBST(DSO_CFLAGS)
6527 AC_SUBST(DSO_PIC_CFLAGS)
6528 AC_SUBST(DSO_LDOPTS)
6529 AC_SUBST(LIB_PREFIX)
6530 AC_SUBST(DLL_PREFIX)
6531 AC_SUBST(DLL_SUFFIX)
6532 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
6533 AC_SUBST(LIB_SUFFIX)
6534 AC_SUBST(OBJ_SUFFIX)
6535 AC_SUBST(BIN_SUFFIX)
6536 AC_SUBST(IMPORT_LIB_SUFFIX)
6538 AC_SUBST(CC_VERSION)
6539 AC_SUBST(MSMANIFEST_TOOL)
6540 AC_SUBST(NS_ENABLE_TSF)
6541 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
6542 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
6544 AC_SUBST(MOZ_VORBIS)
6545 AC_SUBST(MOZ_TREMOR)
6547 AC_SUBST_LIST(FFVPX_ASFLAGS)
6548 AC_SUBST(MOZ_DIRECTSHOW)
6549 AC_SUBST(MOZ_ANDROID_OMX)
6550 AC_SUBST(MOZ_OMX_PLUGIN)
6551 AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
6552 AC_SUBST(VPX_USE_YASM)
6553 AC_SUBST_LIST(VPX_ASFLAGS)
6554 AC_SUBST(VPX_AS_CONVERSION)
6555 AC_SUBST(VPX_X86_ASM)
6556 AC_SUBST(VPX_ARM_ASM)
6557 AC_SUBST(MOZ_CODE_COVERAGE)
6558 AC_SUBST(LIBJPEG_TURBO_USE_YASM)
6559 AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
6560 AC_SUBST(MOZ_LIBAV_FFT)
6561 AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
6562 AC_SUBST(MOZ_DEVTOOLS)
6564 AC_SUBST(MOZ_PACKAGE_JSSHELL)
6565 AC_SUBST(MOZ_FOLD_LIBS)
6566 AC_SUBST(MOZ_FOLD_LIBS_FLAGS)
6567 AC_SUBST(SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE)
6569 AC_SUBST(MOZ_ENABLE_SZIP)
6570 AC_SUBST(MOZ_SZIP_FLAGS)
6574 dnl Host JavaScript runtime, if any, to use during cross compiles.
6577 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
6579 if test -n "$COMPILE_ENVIRONMENT"; then
6580 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
6582 dnl Check for missing components
6583 if test "$MOZ_X11"; then
6584 dnl ====================================================
6585 dnl = Check if X headers exist
6586 dnl ====================================================
6587 _SAVE_CFLAGS=$CFLAGS
6588 CFLAGS="$CFLAGS $XCFLAGS"
6592 #include <X11/Xlib.h>
6593 #include <X11/Intrinsic.h>
6594 #include <X11/extensions/XShm.h>
6598 if ((dpy = XOpenDisplay(NULL)) == NULL) {
6599 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
6603 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
6604 CFLAGS="$_SAVE_CFLAGS"
6606 if test -n "$MISSING_X"; then
6607 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
6612 fi # COMPILE_ENVIRONMENT
6614 dnl Set various defines and substitutions
6615 dnl ========================================================
6617 if test "$MOZ_DEBUG"; then
6618 AC_DEFINE(MOZ_REFLOW_PERF)
6619 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
6622 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
6623 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
6624 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
6625 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
6626 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
6627 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
6628 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
6629 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
6630 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
6633 if test -n "$MOZ_DEV_EDITION"; then
6634 AC_DEFINE(MOZ_DEV_EDITION)
6637 if test "$MOZ_DEBUG"; then
6640 case "$MOZ_UPDATE_CHANNEL" in
6641 aurora|beta|release|esr)
6648 if test -n "$A11Y_LOG"; then
6652 AC_SUBST(MOZILLA_VERSION)
6654 dnl Spit out some output
6655 dnl ========================================================
6657 dnl The following defines are used by xpcom
6658 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
6660 HAVE_CPP_AMBIGUITY_RESOLVING_USING
6661 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
6662 HAVE_CPP_PARTIAL_SPECIALIZATION
6665 HAVE_ICONV_WITH_CONST_INPUT
6678 dnl ========================================================
6679 dnl Determine options to use for running the preprocessor.
6680 dnl ========================================================
6682 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
6683 PREPROCESS_OPTION="-P -Fi"
6685 PREPROCESS_OPTION="-E -o "
6688 AC_SUBST(PREPROCESS_OPTION)
6690 dnl ========================================================
6692 dnl ========================================================
6694 # Internationalization is not built or exposed on Fennec.
6697 if test "$MOZ_BUILD_APP" = "mobile/android"; then
6703 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
6709 dnl ========================================================
6710 dnl mask as short hand property
6711 dnl ========================================================
6712 dnl Uncommenting the next line would enable mask-as-shorthand feature.
6713 dnl MOZ_ENABLE_MASK_AS_SHORTHAND=1
6714 if test "$MOZ_ENABLE_MASK_AS_SHORTHAND"; then
6715 AC_DEFINE(MOZ_ENABLE_MASK_AS_SHORTHAND)
6717 AC_SUBST(MOZ_ENABLE_MASK_AS_SHORTHAND)
6719 # Avoid using obsolete NSPR features
6720 AC_DEFINE(NO_NSPR_10_SUPPORT)
6722 MOZ_CREATE_CONFIG_STATUS()
6724 if test "$COMPILE_ENVIRONMENT"; then
6725 MOZ_SUBCONFIGURE_FFI()
6726 MOZ_SUBCONFIGURE_JEMALLOC()
6729 # Run freetype configure script
6731 if test "$MOZ_TREE_FREETYPE"; then
6732 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
6733 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
6734 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
6735 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
6736 # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
6737 # to force freetype to use our settings rather than autodetecting
6738 if test -n "$MOZ_SYSTEM_PNG"; then
6739 export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
6741 export LIBPNG_CFLAGS="-I$_objdir/dist/include"
6743 export LIBPNG_LIBS="$MOZ_PNG_LIBS "
6744 export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
6745 export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
6746 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
6747 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
6749 if ! test -e modules; then
6752 # Only export CC, CXX and RANLIB for the subconfigure, and avoid spilling
6753 # that further down the road.
6754 (export CC CXX RANLIB;
6755 AC_OUTPUT_SUBDIRS(modules/freetype2)
6759 if test -z "$direct_nspr_config"; then
6760 dnl ========================================================
6761 dnl = Setup a nice relatively clean build environment for
6762 dnl = sub-configures.
6763 dnl ========================================================
6766 CFLAGS="$_SUBDIR_CFLAGS"
6767 CPPFLAGS="$_SUBDIR_CPPFLAGS"
6768 CXXFLAGS="$_SUBDIR_CXXFLAGS"
6769 LDFLAGS="$_SUBDIR_LDFLAGS"
6770 HOST_CC="$_SUBDIR_HOST_CC"
6771 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
6772 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
6773 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
6780 # Run all configure scripts specified by a subconfigure
6781 if test -n "$_subconfigure_subdir"; then
6782 _save_srcdir="$srcdir"
6784 _save_ac_configure_args="$ac_configure_args"
6785 ac_configure_args="$_subconfigure_config_args"
6786 AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
6787 ac_configure_args="$_save_ac_configure_args"
6788 srcdir="$_save_srcdir"
6791 if test "$COMPILE_ENVIRONMENT"; then
6795 dnl ========================================================
6796 dnl = Setup a nice relatively clean build environment for
6797 dnl = sub-configures.
6798 dnl ========================================================
6801 CFLAGS="$_SUBDIR_CFLAGS"
6802 CPPFLAGS="$_SUBDIR_CPPFLAGS"
6803 CXXFLAGS="$_SUBDIR_CXXFLAGS"
6804 LDFLAGS="$_SUBDIR_LDFLAGS"
6805 HOST_CC="$_SUBDIR_HOST_CC"
6806 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
6807 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
6808 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
6811 # Run the SpiderMonkey 'configure' script.
6812 dist=$MOZ_BUILD_ROOT/dist
6813 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
6815 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
6817 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
6819 if test "$_INTL_API" = no; then
6820 ac_configure_args="$ac_configure_args --without-intl-api"
6823 if test "$BUILD_CTYPES"; then
6824 # Build js-ctypes on the platforms we can.
6825 ac_configure_args="$ac_configure_args --enable-ctypes"
6827 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
6828 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
6829 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
6831 ac_configure_args="$ac_configure_args --prefix=$dist"
6832 if test -n "$ZLIB_IN_MOZGLUE"; then
6835 export MOZ_SYSTEM_ZLIB
6836 export MOZ_ZLIB_CFLAGS
6837 export MOZ_ZLIB_LIBS
6839 export MOZ_APP_REMOTINGNAME
6841 export MOZILLA_CENTRAL_PATH=$_topsrcdir
6842 export STLPORT_CPPFLAGS
6844 export JS_STANDALONE=
6848 export ZLIB_IN_MOZGLUE
6864 export HOST_CPPFLAGS
6865 export HOST_CXXFLAGS
6868 if ! test -e js; then
6872 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
6873 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
6875 fi # COMPILE_ENVIRONMENT
6877 dnl we need to run config.status after js/src subconfigure because we're
6878 dnl traversing its moz.build and we need its config.status for that.
6879 dnl However, writing our own config.status needs to happen before
6880 dnl subconfigures because the setup surrounding subconfigures alters
6881 dnl many AC_SUBSTed variables.
6882 MOZ_RUN_ALL_SUBCONFIGURES()
6884 rm -fr confdefs* $ac_clean_files