2 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
3 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
4 dnl This Source Code Form is subject to the terms of the Mozilla Public
5 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
6 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 dnl Process this file with autoconf to produce a configure script.
9 dnl ========================================================
12 AC_INIT(config/config.mk)
13 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
15 TARGET_CPU="${target_cpu}"
16 TARGET_VENDOR="${target_vendor}"
17 TARGET_OS="${target_os}"
19 dnl ========================================================
21 dnl = Don't change the following two lines. Doing so breaks:
23 dnl = CFLAGS="-foo" ./configure
25 dnl ========================================================
27 CPPFLAGS="${CPPFLAGS=}"
28 CXXFLAGS="${CXXFLAGS=}"
30 HOST_CFLAGS="${HOST_CFLAGS=}"
31 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
32 HOST_LDFLAGS="${HOST_LDFLAGS=}"
34 dnl ========================================================
35 dnl = Preserve certain environment flags passed to configure
36 dnl = We want sub projects to receive the same flags
37 dnl = untainted by this configure script
38 dnl ========================================================
41 _SUBDIR_CFLAGS="$CFLAGS"
42 _SUBDIR_CPPFLAGS="$CPPFLAGS"
43 _SUBDIR_CXXFLAGS="$CXXFLAGS"
44 _SUBDIR_LDFLAGS="$LDFLAGS"
45 _SUBDIR_HOST_CC="$HOST_CC"
46 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
47 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
48 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
49 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
51 dnl Set the version number of the libs included with mozilla
52 dnl ========================================================
59 dnl Set the minimum version of toolkit libs used by mozilla
60 dnl ========================================================
67 WINDRES_VERSION=2.14.90
73 STARTUP_NOTIFICATION_VERSION=0.8
79 dnl Set various checks
80 dnl ========================================================
84 dnl Initialize the Pthread test variables early so they can be
85 dnl overridden by each platform.
86 dnl ========================================================
90 dnl Do not allow objdir == srcdir builds.
91 dnl ==============================================================
92 _topsrcdir=`cd \`dirname $0\`; pwd`
96 dnl TODO Don't exempt L10N builds once bug 842760 is resolved.
97 if test "$_topsrcdir" = "$_objdir" -a "${with_l10n_base+set}" != set; then
99 echo " * Building directly in the main source directory is not allowed."
101 echo " * To build, you must run configure from a separate directory"
102 echo " * (referred to as an object directory)."
104 echo " * If you are building with a mozconfig, you will need to change your"
105 echo " * mozconfig to point to a different object directory."
110 # Check for a couple representative files in the source tree
112 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
113 if test -f $file; then
114 _conflict_files="$_conflict_files $file"
117 if test "$_conflict_files"; then
119 echo "* Your source tree contains these files:"
120 for file in $_conflict_files; do
124 * This indicates that you previously built in the source tree.
125 * A source tree build can confuse the separate objdir build.
127 * To clean up the source tree:
135 MOZ_BUILD_ROOT=`pwd -W 2>/dev/null || pwd`
141 COMPILE_ENVIRONMENT=1
142 MOZ_ARG_DISABLE_BOOL(compile-environment,
143 [ --disable-compile-environment
144 Disable compiler/library checks.],
145 COMPILE_ENVIRONMENT= )
146 AC_SUBST(COMPILE_ENVIRONMENT)
148 MOZ_ARG_WITH_STRING(l10n-base,
149 [ --with-l10n-base=DIR path to l10n repositories],
150 L10NBASEDIR=$withval)
151 if test -n "$L10NBASEDIR"; then
152 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
153 AC_MSG_ERROR([--with-l10n-base must specify a path])
154 elif test -d "$L10NBASEDIR"; then
155 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
157 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
160 AC_SUBST(L10NBASEDIR)
162 dnl Check for Perl first -- needed for win32 SDK checks
163 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
164 if test -z "$PERL" -o "$PERL" = ":"; then
165 AC_MSG_ERROR([perl not found in \$PATH])
168 if test -n "$GAIADIR" -a ! -d "$GAIADIR" ; then
169 AC_MSG_ERROR([GAIADIR '$GAIADIR' isn't a valid directory])
173 if test -n "$GAIADIR" ; then
174 AC_DEFINE(PACKAGE_GAIA)
177 if test -n "$FXOS_SIMULATOR" -a -z "$GAIADIR" ; then
178 AC_MSG_ERROR([FXOS_SIMULATOR=1 requires GAIADIR to be defined])
181 if test -n "$FXOS_SIMULATOR" ; then
182 AC_DEFINE(FXOS_SIMULATOR)
183 AC_SUBST(FXOS_SIMULATOR)
186 MOZ_ARG_WITH_STRING(gonk,
188 location of gonk dir],
191 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
192 [ --with-gonk-toolchain-prefix=DIR
193 prefix to gonk toolchain commands],
194 gonk_toolchain_prefix=$withval)
196 if test -n "$gonkdir" ; then
197 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
198 android_source="$gonkdir"
199 ANDROID_SOURCE="$android_source"
200 ANDROID_NDK="${ANDROID_SOURCE}/ndk"
203 if test -n "${PLATFORM_SDK_VERSION}"; then
204 ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
208 TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
209 AS="$gonk_toolchain_prefix"as
210 CC="$gonk_toolchain_prefix"gcc
211 CXX="$gonk_toolchain_prefix"g++
212 CPP="$gonk_toolchain_prefix"cpp
213 LD="$gonk_toolchain_prefix"ld
214 AR="$gonk_toolchain_prefix"ar
215 RANLIB="$gonk_toolchain_prefix"ranlib
216 STRIP="$gonk_toolchain_prefix"strip
217 OBJCOPY="$gonk_toolchain_prefix"objcopy
219 if ! test -e "$gonkdir/ndk/sources/cxx-stl/stlport/src/iostream.cpp"; then
220 AC_MSG_ERROR([Couldn't find path to stlport sources in the gonk tree])
222 STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include"
223 STLPORT_LIBS="$_objdir/build/stlport/libstlport_static.a"
225 case "$target_cpu" in
234 case "$ANDROID_VERSION" in
236 GONK_INCLUDES="-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"
242 AC_SUBST(MOZ_OMX_DECODER)
246 GONK_INCLUDES="-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"
247 if test -d "$gonkdir/external/bluetooth/bluez"; then
248 GONK_INCLUDES="$GONK_INCLUDES -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
251 elif test -d "$gonkdir/external/bluetooth/bluedroid"; then
253 MOZ_B2G_BT_BLUEDROID=1
260 AC_SUBST(MOZ_OMX_DECODER)
262 AC_SUBST(MOZ_OMX_ENCODER)
263 AC_DEFINE(MOZ_OMX_ENCODER)
266 GONK_INCLUDES="-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"
269 MOZ_B2G_BT_BLUEDROID=1
274 AC_DEFINE(MOZ_OMX_ENCODER)
276 AC_SUBST(MOZ_AUDIO_OFFLOAD)
277 AC_DEFINE(MOZ_AUDIO_OFFLOAD)
281 AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
284 CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/hardware/libhardware/include -I$gonkdir/external/valgrind/fxos-include $GONK_INCLUDES $CPPFLAGS"
285 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
286 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
287 dnl Add -llog by default, since we use it all over the place.
290 LDFLAGS="-mandroid -L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ $LDFLAGS"
292 dnl prevent cross compile section from using these flags as host flags
293 if test -z "$HOST_CPPFLAGS" ; then
296 if test -z "$HOST_CFLAGS" ; then
299 if test -z "$HOST_CXXFLAGS" ; then
302 if test -z "$HOST_LDFLAGS" ; then
307 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
308 AC_SUBST(ANDROID_VERSION)
309 AC_DEFINE(HAVE_SYS_UIO_H)
310 AC_DEFINE(HAVE_PTHREADS)
311 MOZ_CHROME_FILE_FORMAT=omni
317 *-android*|*-linuxandroid*)
318 if test -z "$ANDROID_PACKAGE_NAME" ; then
319 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
321 MOZ_CHROME_FILE_FORMAT=omni
325 AC_PATH_PROG(OBJCOPY,objcopy)
330 AC_SUBST(ANDROID_SOURCE)
331 AC_SUBST(ANDROID_PACKAGE_NAME)
334 dnl ========================================================
335 dnl Checks for compilers.
336 dnl ========================================================
338 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
341 if test "$COMPILE_ENVIRONMENT"; then
343 if test "$target" != "$host"; then
349 # Work around the conftest.exe access problem on Windows
354 MOZ_PATH_PROGS(AS, $AS as, $CC)
355 AC_CHECK_PROGS(AR, ar, :)
356 AC_CHECK_PROGS(LD, ld, :)
357 AC_CHECK_PROGS(STRIP, strip, :)
358 AC_CHECK_PROGS(WINDRES, windres, :)
359 if test -z "$HOST_CC"; then
362 if test -z "$HOST_CFLAGS"; then
363 HOST_CFLAGS="$CFLAGS"
365 if test -z "$HOST_CXX"; then
368 if test -z "$HOST_CXXFLAGS"; then
369 HOST_CXXFLAGS="$CXXFLAGS"
371 if test -z "$HOST_LDFLAGS"; then
372 HOST_LDFLAGS="$LDFLAGS"
374 if test -z "$HOST_RANLIB"; then
375 HOST_RANLIB="$RANLIB"
377 if test -z "$HOST_AR"; then
380 if test -z "$HOST_AR_FLAGS"; then
381 HOST_AR_FLAGS="$AR_FLAGS"
385 if test -n "$MOZ_WINCONSOLE"; then
386 AC_DEFINE(MOZ_WINCONSOLE)
391 MOZ_CHECK_COMPILER_WRAPPER
393 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
394 if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
395 test "$GCC_MAJOR_VERSION" -lt 4; then
396 AC_MSG_ERROR([Only GCC 4.4 or newer supported])
400 dnl ========================================================
401 dnl Special win32 checks
402 dnl ========================================================
404 MOZ_ARG_ENABLE_BOOL(metro,
405 [ --enable-metro Enable Windows Metro build targets],
408 if test -n "$MOZ_METRO"; then
410 # Target the Windows 8 Kit
413 # toolkit/library/makefile.in needs these, see nsDllMain.
415 CRTEXPDLLVERSION=1-1-0
417 # Target the Windows 7 SDK by default
422 AC_SUBST(CRTDLLVERSION)
423 AC_SUBST(CRTEXPDLLVERSION)
425 MOZ_ARG_WITH_STRING(windows-version,
426 [ --with-windows-version=WINSDK_TARGETVER
427 Windows SDK version to target. Lowest version
428 currently allowed is 601 (Win7), highest is 602 (Win8)],
429 WINSDK_TARGETVER=$withval)
431 # Currently only two sdk versions allowed, 601 and 602
432 case "$WINSDK_TARGETVER" in
434 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
438 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
444 if test "$GCC" != "yes"; then
445 # Check to see if we are really running in a msvc environemnt
447 AC_CHECK_PROGS(MIDL, midl)
449 # Make sure compilers are valid
450 CFLAGS="$CFLAGS -TC -nologo"
451 CXXFLAGS="$CXXFLAGS -TP -nologo"
454 AC_TRY_COMPILE([#include <stdio.h>],
455 [ printf("Hello World\n"); ],,
456 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
459 AC_TRY_COMPILE([#include <new.h>],
460 [ unsigned *test = new unsigned(42); ],,
461 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
465 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
468 # Determine compiler version
469 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | cut -c 1-2`
470 _CC_MINOR_VERSION=`echo ${CC_VERSION} | cut -c 3-4`
471 _MSC_VER=${CC_VERSION}
473 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | cut -c 1-2`
475 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
476 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
479 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
480 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
482 if test "$_CC_MAJOR_VERSION" = "16"; then
485 MSVC_C_RUNTIME_DLL=msvcr100.dll
486 MSVC_CXX_RUNTIME_DLL=msvcp100.dll
487 elif test "$_CC_MAJOR_VERSION" = "17"; then
490 MSVC_C_RUNTIME_DLL=msvcr110.dll
491 MSVC_CXX_RUNTIME_DLL=msvcp110.dll
492 elif test "$_CC_MAJOR_VERSION" = "18"; then
495 MSVC_C_RUNTIME_DLL=msvcr120.dll
496 MSVC_CXX_RUNTIME_DLL=msvcp120.dll
498 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
500 AC_SUBST(MSVS_VERSION)
501 AC_SUBST(MSVC_C_RUNTIME_DLL)
502 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
504 # Disable SEH on clang-cl because it doesn't implement them yet.
505 if test -z "$CLANG_CL"; then
506 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
508 AC_DEFINE_UNQUOTED(GTEST_HAS_SEH, 0)
511 if test -n "$WIN32_REDIST_DIR"; then
512 if test ! -d "$WIN32_REDIST_DIR"; then
513 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
515 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
518 dnl Confirm we have the pri tools on win8 builds
519 if test -n "$MOZ_METRO"; then
520 AC_MSG_CHECKING([for makepri])
521 AC_CHECK_PROGS(MAKEPRI, makepri, "")
522 if test -z "MAKEPRI" ; then
523 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
528 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
529 dnl not something else like "magnetic tape manipulation utility".
530 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
531 if test -z "$MSMT_TOOL"; then
532 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
536 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
538 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
539 if test -z "$MSMANIFEST_TOOL_VERSION"; then
540 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
546 # Check linker version
547 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
548 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
549 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
550 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
555 # Set midl environment
558 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
561 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
565 unset _MSVC_VER_FILTER
567 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
571 _SAVE_CXXFLAGS="$CXXFLAGS"
572 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
573 AC_TRY_COMPILE([#include <exception>],
574 [std::_Throw(std::exception()); return 0;],
575 ac_cv_have_std__Throw="yes",
576 ac_cv_have_std__Throw="no")
577 CXXFLAGS="$_SAVE_CXXFLAGS"
581 if test "$ac_cv_have_std__Throw" = "yes"; then
582 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
583 ac_cv_have_dllimport_exception_bug,
587 _SAVE_CXXFLAGS="$CXXFLAGS"
588 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
589 AC_TRY_LINK([#include <vector>],
590 [std::vector<int> v; return v.at(1);],
591 ac_cv_have_dllimport_exception_bug="no",
592 ac_cv_have_dllimport_exception_bug="yes")
593 CXXFLAGS="$_SAVE_CXXFLAGS"
596 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
598 MOZ_MSVC_STL_WRAP__Throw=1
599 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
602 AC_CACHE_CHECK(for overridable _RAISE,
607 _SAVE_CXXFLAGS="$CXXFLAGS"
608 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
609 AC_TRY_COMPILE([#include <xstddef>
611 #define _RAISE(x) externallyDefinedFunction((x).what())
614 [std::vector<int> v; return v.at(1);],
615 ac_cv_have__RAISE="no",
616 ac_cv_have__RAISE="yes")
617 CXXFLAGS="$_SAVE_CXXFLAGS"
620 if test "$ac_cv_have__RAISE" = "yes"; then
622 MOZ_MSVC_STL_WRAP__RAISE=1
623 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
625 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
629 if test "$WRAP_STL_INCLUDES" = "1"; then
630 STL_FLAGS='-I$(DIST)/stl_wrappers'
632 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
633 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
635 MOZ_FIND_WINSDK_VERSION
637 # Check w32api version
638 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
639 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
640 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
641 AC_TRY_COMPILE([#include <w32api.h>],
642 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
643 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
644 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
645 #error "test failed."
647 , [ res=yes ], [ res=no ])
648 AC_MSG_RESULT([$res])
649 if test "$res" != "yes"; then
650 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
652 # Check windres version
653 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
654 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
655 AC_MSG_RESULT([$_WINDRES_VERSION])
656 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
657 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
658 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
659 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
660 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
661 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
662 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
663 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
664 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
665 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
666 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
667 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
669 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
672 AC_CHECK_PROGS(MIDL, $target-widl widl)
673 if test -n "$MIDL"; then
676 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
679 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
684 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
685 # causing problems with local implementations with the same name.
686 AC_DEFINE(STRSAFE_NO_DEPRECATE)
688 MOZ_WINSDK_MAXVER=0x06020000
691 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
692 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
693 # Require OS features provided by IE 6.0 SP2 (XP SP2)
694 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
696 # If the maximum version supported by this SDK is lower than the target
698 AC_MSG_CHECKING([for Windows SDK being recent enough])
699 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
703 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.])
706 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
707 # Definitions matching sdkddkver.h
708 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
709 AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
710 AC_SUBST(MOZ_WINSDK_MAXVER)
717 if test -n "$_WIN32_MSVC"; then
719 SKIP_COMPILER_CHECKS=1
720 SKIP_LIBRARY_CHECKS=1
722 # Since we're skipping compiler and library checks, hard-code
725 AC_DEFINE(HAVE_SETBUF)
726 AC_DEFINE(HAVE_ISATTY)
729 fi # COMPILE_ENVIRONMENT
742 AC_SUBST(WRAP_STL_INCLUDES)
743 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
744 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
746 dnl ========================================================
747 dnl Checks for programs.
748 dnl ========================================================
752 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
753 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
754 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
756 AC_MSG_RESULT([$_perl_version])
758 if test "$_perl_res" != 0; then
759 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
763 AC_MSG_CHECKING([for full perl installation])
764 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
766 if test "$_perl_res" != 0; then
768 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
773 if test -z "$COMPILE_ENVIRONMENT"; then
774 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
776 AC_SUBST(NSINSTALL_BIN)
778 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
779 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
780 MOZ_PATH_PROGS(UNZIP, unzip)
781 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
782 AC_MSG_ERROR([unzip not found in \$PATH])
784 MOZ_PATH_PROGS(ZIP, zip)
785 if test -z "$ZIP" -o "$ZIP" = ":"; then
786 AC_MSG_ERROR([zip not found in \$PATH])
788 MOZ_PATH_PROG(XARGS, xargs)
789 if test -z "$XARGS" -o "$XARGS" = ":"; then
790 AC_MSG_ERROR([xargs not found in \$PATH .])
793 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
796 if test "$COMPILE_ENVIRONMENT"; then
798 dnl ========================================================
799 dnl = Mac OS X toolchain support
800 dnl ========================================================
802 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
803 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
804 dnl when we can run target binaries.
805 AC_SUBST(UNIVERSAL_BINARY)
806 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
808 MOZ_ARG_WITH_STRING(unify-dist,
809 [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
811 if test -n "$UNIVERSAL_BINARY"; then
812 if test -z "$UNIFY_DIST"; then
813 AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
815 case "$UNIFY_DIST" in
819 UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
825 dnl ========================================================
826 dnl Check for MacOS deployment target version
827 dnl ========================================================
829 MOZ_ARG_ENABLE_STRING(macos-target,
830 [ --enable-macos-target=VER (default=10.6)
831 Set the minimum MacOS version needed at runtime],
832 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
836 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
837 dnl Use the specified value
838 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
840 dnl No value specified on the command line or in the environment,
841 dnl use architecture minimum.
842 export MACOSX_DEPLOYMENT_TARGET=10.6
847 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
849 dnl ========================================================
850 dnl = Mac OS X SDK support
851 dnl ========================================================
853 MOZ_ARG_WITH_STRING(macos-sdk,
854 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
855 MACOS_SDK_DIR=$withval)
857 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
858 MOZ_ARG_WITH_STRING(macos-private-frameworks,
859 [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)],
860 MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
861 MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
862 MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
864 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
865 if test -z "$CROSS_COMPILE"; then
866 AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
868 if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
869 AC_MSG_ERROR([PrivateFrameworks directory not found.])
873 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
874 AC_SUBST(MACOS_SDK_DIR)
875 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
877 if test "$MACOS_SDK_DIR"; then
878 dnl Sync this section with the ones in NSPR and NSS.
879 dnl Changes to the cross environment here need to be accounted for in
880 dnl the libIDL checks (below) and xpidl build.
882 if test ! -d "$MACOS_SDK_DIR"; then
883 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
884 specify a valid SDK. SDKs are installed when the optional cross-development
885 tools are selected during the Xcode/Developer Tools installation.])
888 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
889 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
891 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
892 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
893 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
896 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
898 AC_TRY_COMPILE([#include <new>],[],
902 AC_MSG_RESULT($result)
904 if test "$result" = "no" ; then
905 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
909 fi # COMPILE_ENVIRONMENT
911 if test -n "$MAKE"; then
912 if test `echo $MAKE | grep -c make.py` != 1; then
919 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
922 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
925 if test "$GMAKE" = ":"; then
926 AC_MSG_ERROR([GNU make not found])
930 if test -z "$MAKE"; then
934 if test "$COMPILE_ENVIRONMENT"; then
940 fi # COMPILE_ENVIRONMENT
942 dnl ========================================================
943 dnl set the defaults first
944 dnl ========================================================
960 MOZ_USER_DIR=".mozilla"
963 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
965 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
966 MOZ_PNG_CFLAGS="-I$_objdir/dist/include" # needed for freetype compilation
967 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
969 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
970 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
971 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
972 XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/bin)'
973 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)'
974 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
975 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
977 # These are specially defined on Windows only
980 XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
981 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
984 XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
985 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
991 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
995 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
997 if test -n "$CROSS_COMPILE"; then
998 OS_TARGET="${target_os}"
999 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1001 case "${target_os}" in
1002 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1003 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU/kFreeBSD ;;
1004 gnu*) OS_ARCH=GNU ;;
1005 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1006 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
1007 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1008 dragonfly*) OS_ARCH=DragonFly OS_TARGET=DragonFly ;;
1009 freebsd*) OS_ARCH=FreeBSD OS_TARGET=FreeBSD ;;
1010 netbsd*) OS_ARCH=NetBSD OS_TARGET=NetBSD ;;
1011 openbsd*) OS_ARCH=OpenBSD OS_TARGET=OpenBSD ;;
1014 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1017 OS_TARGET=`uname -s`
1018 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1019 OS_RELEASE=`uname -r`
1022 # Before this used `uname -m` when not cross compiling
1023 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1024 OS_TEST="${target_cpu}"
1026 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1028 #######################################################################
1029 # Master "Core Components" macros for getting the OS target #
1030 #######################################################################
1033 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1034 # cross-compilation.
1038 # Define and override various archtecture-specific variables, including
1047 case "$HOST_OS_ARCH" in
1058 HOST_OS_ARCH=GNU_kFreeBSD
1064 HOST_OS_ARCH=DragonFly
1067 HOST_OS_ARCH=FreeBSD
1073 HOST_OS_ARCH=OpenBSD
1079 if test -z "$GNU_CC"; then
1080 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1085 if test -z "$GNU_CXX"; then
1086 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1087 SOLARIS_SUNPRO_CXX=1
1090 AC_SUBST(SOLARIS_SUNPRO_CC)
1091 AC_SUBST(SOLARIS_SUNPRO_CXX)
1097 if test -z "$CROSS_COMPILE" ; then
1103 # If uname -s returns "Windows_NT", we assume that we are using
1104 # the uname.exe in MKS toolkit.
1106 # The -r option of MKS uname only returns the major version number.
1107 # So we need to use its -v option to get the minor version number.
1108 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1112 OS_MINOR_RELEASE=`uname -v`
1113 if test "$OS_MINOR_RELEASE" = "00"; then
1116 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1120 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1121 # the uname.exe in the MSYS tools.
1123 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1128 OS_RELEASE=`uname -v`.`uname -r`
1129 OS_TEST=${target_cpu}
1132 case "${target_cpu}" in
1143 if test -z "$CROSS_COMPILE" ; then
1151 # Only set CPU_ARCH if we recognize the value of OS_TEST
1158 powerpc64 | ppc64 | powerpc64le | ppc64le)
1162 powerpc | ppc | rs6000)
1166 Alpha | alpha | ALPHA)
1203 if test -z "$OS_TARGET"; then
1206 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1208 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1209 dnl ===============================================================
1213 INTEL_ARCHITECTURE=1
1216 dnl Configure platform-specific CPU architecture compiler options.
1217 dnl ==============================================================
1220 dnl =================================================================
1221 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1222 dnl which is bad when cross compiling.
1223 dnl =================================================================
1224 if test "$COMPILE_ENVIRONMENT"; then
1225 configure_static_assert_macros='
1226 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1227 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1228 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1231 dnl test that the macros actually work:
1232 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1233 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1236 ac_cv_static_assertion_macros_work="yes"
1237 AC_TRY_COMPILE([$configure_static_assert_macros],
1238 [CONFIGURE_STATIC_ASSERT(1)],
1240 ac_cv_static_assertion_macros_work="no")
1241 AC_TRY_COMPILE([$configure_static_assert_macros],
1242 [CONFIGURE_STATIC_ASSERT(0)],
1243 ac_cv_static_assertion_macros_work="no",
1246 AC_TRY_COMPILE([$configure_static_assert_macros],
1247 [CONFIGURE_STATIC_ASSERT(1)],
1249 ac_cv_static_assertion_macros_work="no")
1250 AC_TRY_COMPILE([$configure_static_assert_macros],
1251 [CONFIGURE_STATIC_ASSERT(0)],
1252 ac_cv_static_assertion_macros_work="no",
1256 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1257 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1258 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1260 fi # COMPILE_ENVIRONMENT
1262 dnl ========================================================
1263 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1265 dnl ========================================================
1269 dnl ========================================================
1270 dnl Suppress Clang Argument Warnings
1271 dnl ========================================================
1272 if test -n "$CLANG_CC"; then
1273 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1274 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1276 if test -n "$CLANG_CXX"; then
1277 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1280 dnl ========================================================
1281 dnl = Use Address Sanitizer
1282 dnl ========================================================
1283 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1284 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1287 if test -n "$MOZ_ASAN"; then
1290 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1293 AC_SUBST(LLVM_SYMBOLIZER)
1295 dnl ========================================================
1296 dnl = Enable hacks required for LLVM instrumentations
1297 dnl ========================================================
1298 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1299 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1302 if test -n "$MOZ_LLVM_HACKS"; then
1306 AC_SUBST(MOZ_NO_WLZDEFS)
1307 AC_SUBST(MOZ_CFLAGS_NSS)
1309 dnl ========================================================
1310 dnl GNU specific defaults
1311 dnl ========================================================
1312 if test "$GNU_CC"; then
1316 # Per bug 719659 comment 2, some of the headers on ancient build machines
1317 # may require gnu89 inline semantics. But otherwise, we use C99.
1318 # But on OS X we just use C99 plus GNU extensions, in order to fix
1320 CFLAGS="$CFLAGS -std=gnu99"
1321 if test "${OS_ARCH}" != Darwin; then
1322 CFLAGS="$CFLAGS -fgnu89-inline"
1324 # FIXME: Let us build with strict aliasing. bug 414641.
1325 CFLAGS="$CFLAGS -fno-strict-aliasing"
1326 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1327 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1328 WARNINGS_AS_ERRORS='-Werror'
1330 DSO_PIC_CFLAGS='-fPIC'
1331 ASFLAGS="$ASFLAGS -fPIC"
1332 AC_MSG_CHECKING([for --noexecstack option to as])
1333 _SAVE_CFLAGS=$CFLAGS
1334 CFLAGS="$CFLAGS -Wa,--noexecstack"
1335 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1336 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1337 AC_MSG_RESULT([no]))
1338 CFLAGS=$_SAVE_CFLAGS
1339 AC_MSG_CHECKING([for -z noexecstack option to ld])
1340 _SAVE_LDFLAGS=$LDFLAGS
1341 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1342 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1344 LDFLAGS=$_SAVE_LDFLAGS)
1346 AC_MSG_CHECKING([for -z text option to ld])
1347 _SAVE_LDFLAGS=$LDFLAGS
1348 LDFLAGS="$LDFLAGS -Wl,-z,text"
1349 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1350 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1352 LDFLAGS=$_SAVE_LDFLAGS)
1354 AC_MSG_CHECKING([for --build-id option to ld])
1355 _SAVE_LDFLAGS=$LDFLAGS
1356 LDFLAGS="$LDFLAGS -Wl,--build-id"
1357 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1358 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1360 LDFLAGS=$_SAVE_LDFLAGS)
1362 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
1363 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
1364 _SAVE_LDFLAGS=$LDFLAGS
1365 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
1366 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1367 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
1368 AC_MSG_RESULT([no]))
1369 LDFLAGS=$_SAVE_LDFLAGS
1371 # Check for -mssse3 on $CC
1372 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1373 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1374 _SAVE_CFLAGS=$CFLAGS
1375 CFLAGS="$CFLAGS -mssse3"
1376 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1377 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1378 AC_MSG_RESULT([no]))
1379 CFLAGS=$_SAVE_CFLAGS
1381 # Check for -msse4.1 on $CC
1382 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1383 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1384 _SAVE_CFLAGS=$CFLAGS
1385 CFLAGS="$CFLAGS -msse4.1"
1386 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1387 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1388 AC_MSG_RESULT([no]))
1389 CFLAGS=$_SAVE_CFLAGS
1391 case "${CPU_ARCH}" in
1393 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
1395 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
1396 result="yes", result="no")
1397 AC_MSG_RESULT("$result")
1398 if test "$result" = "yes"; then
1400 AC_DEFINE(HAVE_X86_AVX2)
1401 AC_SUBST(HAVE_X86_AVX2)
1405 DSO_LDOPTS='-shared'
1406 if test "$GCC_USE_GNU_LD"; then
1407 # Some tools like ASan use a runtime library that is only
1408 # linked against executables, so we must allow undefined
1409 # symbols for shared objects in some cases.
1410 if test -z "$MOZ_NO_WLZDEFS"; then
1411 # Don't allow undefined symbols in libraries
1412 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1414 # BSDs need `environ' exposed for posix_spawn (bug 753046)
1415 case "$OS_TARGET" in
1416 DragonFly|FreeBSD|NetBSD|OpenBSD)
1417 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
1418 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
1420 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
1427 # Turn on GNU-specific warnings:
1428 # -Wall - turn on a lot of warnings
1429 # -Wpointer-arith - good to have
1430 # -Wdeclaration-after-statement - MSVC doesn't like these
1431 # -Werror=return-type - catches missing returns, zero false positives
1432 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
1433 # -Wtype-limits - catches overflow bugs, few false positives
1434 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1435 # -Wsign-compare - catches comparison of signed and unsigned types
1437 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1438 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1439 MOZ_C_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_c_has_werror_int_to_pointer_cast)
1440 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1441 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1442 MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1444 # Turn off the following warnings that -Wall turns on:
1445 # -Wno-unused - lots of violations in third-party code
1447 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1449 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1450 # Don't use -Wcast-align with ICC or clang
1452 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1453 hppa | ia64 | sparc | arm)
1456 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1461 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1462 _USE_CPP_INCLUDE_FLAG=1
1463 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1465 elif test "$SOLARIS_SUNPRO_CC"; then
1467 if test "$CPU_ARCH" = "sparc"; then
1468 # for Sun Studio on Solaris/SPARC
1469 DSO_PIC_CFLAGS='-xcode=pic32'
1471 DSO_PIC_CFLAGS='-KPIC'
1473 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1475 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1476 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1478 DSO_LDOPTS='-shared'
1479 if test "$GNU_LD"; then
1480 # Don't allow undefined symbols in libraries
1481 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1485 DSO_PIC_CFLAGS='-KPIC'
1486 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1489 if test "$GNU_CXX"; then
1490 # FIXME: Let us build with strict aliasing. bug 414641.
1491 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1493 # Turn on GNU-specific warnings:
1494 # -Wall - turn on a lot of warnings
1495 # -Wpointer-arith - good to have
1496 # -Woverloaded-virtual - ???
1497 # -Werror=return-type - catches missing returns, zero false positives
1498 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
1499 # -Wtype-limits - catches overflow bugs, few false positives
1500 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1501 # -Wsign-compare - catches comparison of signed and unsigned types
1503 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1504 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1505 MOZ_CXX_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_cxx_has_werror_int_to_pointer_cast)
1506 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1507 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1508 MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1510 # Turn off the following warnings that -Wall turns on:
1511 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1512 # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc
1513 # for performance reasons, and because GCC and clang accept it (though
1514 # clang warns about it).
1516 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1517 MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete)
1519 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1520 # Don't use -Wcast-align with ICC or clang
1522 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1523 hppa | ia64 | sparc | arm)
1526 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1531 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1532 _USE_CPP_INCLUDE_FLAG=1
1534 # Recent clang and gcc support C++11 deleted functions without warnings if
1535 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1536 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1537 # unused. But clang's warning can be disabled, so when compiling with clang
1538 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1539 # deleted function syntax.
1540 if test "$CLANG_CXX"; then
1541 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1542 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1546 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1549 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1550 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1551 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1552 dnl normal behavior.
1553 dnl ========================================================
1555 MKSHLIB_UNFORCE_ALL=
1557 if test "$COMPILE_ENVIRONMENT"; then
1558 if test "$GNU_CC"; then
1559 AC_MSG_CHECKING(whether ld has archive extraction flags)
1560 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1561 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1562 ac_cv_mkshlib_force_and_unforce="no"
1563 exec 3<&0 <<LOOP_INPUT
1564 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1565 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1566 force="-Wl,-all"; unforce="-Wl,-none"
1573 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1576 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1578 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1582 eval $ac_cv_mkshlib_force_and_unforce
1583 MKSHLIB_FORCE_ALL=$force
1584 MKSHLIB_UNFORCE_ALL=$unforce
1587 fi # COMPILE_ENVIRONMENT
1589 dnl ========================================================
1590 dnl Checking for 64-bit OS
1591 dnl ========================================================
1592 if test "$COMPILE_ENVIRONMENT"; then
1595 AC_MSG_CHECKING(for 64-bit OS)
1596 AC_TRY_COMPILE([$configure_static_assert_macros],
1597 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1598 result="yes", result="no")
1599 AC_MSG_RESULT("$result")
1600 if test "$result" = "yes"; then
1601 AC_DEFINE(HAVE_64BIT_BUILD)
1604 AC_SUBST(HAVE_64BIT_BUILD)
1606 fi # COMPILE_ENVIRONMENT
1608 dnl ========================================================
1609 dnl = Use profiling compile flags
1610 dnl ========================================================
1611 MOZ_ARG_ENABLE_BOOL(profiling,
1612 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1616 dnl ========================================================
1617 dnl = Turn on systrace for android/b2g.
1618 dnl ========================================================
1619 MOZ_ARG_ENABLE_BOOL(systrace,
1620 [ --enable-systrace Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1623 if test -n "$MOZ_USE_SYSTRACE"; then
1624 AC_DEFINE(MOZ_USE_SYSTRACE)
1627 # For profiling builds keep the symbol information
1628 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1629 case "$OS_TARGET" in
1630 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1631 STRIP_FLAGS="--strip-debug"
1636 dnl ========================================================
1638 dnl ========================================================
1639 MOZ_ARG_ENABLE_BOOL(valgrind,
1640 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1643 if test -n "$MOZ_VALGRIND"; then
1644 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1646 [--enable-valgrind specified but Valgrind is not installed]))
1647 AC_DEFINE(MOZ_VALGRIND)
1649 AC_SUBST(MOZ_VALGRIND)
1651 dnl ========================================================
1653 dnl ========================================================
1654 MOZ_ARG_ENABLE_BOOL(jprof,
1655 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1658 if test -n "$MOZ_JPROF"; then
1660 AC_DEFINE(MOZ_JPROF)
1663 dnl ========================================================
1665 dnl ========================================================
1666 MOZ_ENABLE_PROFILER_SPS=1
1668 case "${OS_TARGET}" in
1670 case "${CPU_ARCH}" in
1673 MOZ_ENABLE_PROFILER_SPS=
1677 case "${CPU_ARCH}" in
1680 MOZ_ENABLE_PROFILER_SPS=
1685 MOZ_ENABLE_PROFILER_SPS=
1689 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1690 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1693 dnl ========================================================
1695 dnl ========================================================
1696 MOZ_ARG_ENABLE_BOOL(shark,
1697 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1700 if test -n "$MOZ_SHARK"; then
1702 AC_DEFINE(MOZ_SHARK)
1705 dnl ========================================================
1707 dnl ========================================================
1708 MOZ_ARG_ENABLE_BOOL(instruments,
1709 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
1712 if test -n "$MOZ_INSTRUMENTS"; then
1714 AC_DEFINE(MOZ_INSTRUMENTS)
1717 dnl ========================================================
1719 dnl ========================================================
1720 MOZ_ARG_ENABLE_BOOL(callgrind,
1721 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1724 if test -n "$MOZ_CALLGRIND"; then
1726 AC_DEFINE(MOZ_CALLGRIND)
1729 dnl ========================================================
1731 dnl ========================================================
1732 MOZ_ARG_ENABLE_BOOL(vtune,
1733 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1736 if test -n "$MOZ_VTUNE"; then
1738 AC_DEFINE(MOZ_VTUNE)
1741 dnl ========================================================
1743 dnl ========================================================
1744 if test -n "$MOZ_PROFILING"; then
1745 AC_DEFINE(MOZ_PROFILING)
1748 dnl ========================================================
1749 dnl System overrides of the defaults for host
1750 dnl ========================================================
1753 if test -n "$_WIN32_MSVC"; then
1755 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
1756 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
1757 HOST_RANLIB='echo ranlib'
1759 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1761 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1762 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1763 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1764 HOST_BIN_SUFFIX=.exe
1767 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1771 case "${host_cpu}" in
1773 if test -n "$_WIN32_MSVC"; then
1774 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1778 if test -n "$_WIN32_MSVC"; then
1779 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1781 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1787 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1788 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1789 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1792 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1793 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1794 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1795 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1799 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1800 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1804 dnl Check for using a custom <inttypes.h> implementation
1805 dnl ========================================================
1806 AC_MSG_CHECKING(for custom <inttypes.h> implementation)
1807 if test "$MOZ_CUSTOM_INTTYPES_H"; then
1808 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
1809 AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
1811 AC_MSG_RESULT(none specified)
1814 dnl Get mozilla version from central milestone file
1815 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1816 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1817 MOZILLA_SYMBOLVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -symbolversion`
1819 dnl Get version of various core apps from the version files.
1820 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1822 if test -z "$FIREFOX_VERSION"; then
1823 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1826 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1827 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1828 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1829 AC_SUBST(MOZILLA_SYMBOLVERSION)
1831 MOZ_DOING_LTO(lto_is_enabled)
1833 dnl ========================================================
1834 dnl System overrides of the defaults for target
1835 dnl ========================================================
1840 if test ! "$GNU_CC"; then
1841 if test ! "$HAVE_64BIT_BUILD"; then
1842 # Compiling with Visual Age C++ object model compat is the
1843 # default. To compile with object model ibm, add
1844 # AIX_OBJMODEL=ibm to .mozconfig.
1845 if test "$AIX_OBJMODEL" = "ibm"; then
1846 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1853 AC_SUBST(AIX_OBJMODEL)
1854 DSO_LDOPTS='-qmkshrobj=1'
1855 DSO_CFLAGS='-qflag=w:w'
1857 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1859 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1860 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1861 if test "$COMPILE_ENVIRONMENT"; then
1864 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1866 [#if (__IBMCPP__ < 900)
1867 #error "Bad compiler"
1869 _BAD_COMPILER=,_BAD_COMPILER=1)
1870 if test -n "$_BAD_COMPILER"; then
1872 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1874 AC_MSG_RESULT([yes])
1877 TARGET_COMPILER_ABI="ibmc"
1878 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1879 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1882 case "${target_os}" in
1887 if test "$COMPILE_ENVIRONMENT"; then
1888 MOZ_CHECK_HEADERS(sys/inttypes.h)
1890 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1894 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1895 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1896 MOZ_OPTIMIZE_FLAGS="-O3"
1897 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1898 if test "$HAVE_64BIT_BUILD"; then
1903 STRIP_FLAGS="$STRIP_FLAGS -x -S"
1904 # Check whether we're targeting OS X or iOS
1905 AC_CACHE_CHECK(for iOS target,
1907 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1908 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1912 ac_cv_ios_target="yes",
1913 ac_cv_ios_target="no")])
1914 if test "$ac_cv_ios_target" = "yes"; then
1916 AC_DEFINE(XP_DARWIN)
1917 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1919 AC_DEFINE(XP_MACOSX)
1920 AC_DEFINE(XP_DARWIN)
1921 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1922 # The ExceptionHandling framework is needed for Objective-C exception
1923 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1925 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1927 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1929 if test "x$lto_is_enabled" = "xyes"; then
1930 echo "Skipping -dead_strip because lto is enabled."
1931 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1932 dnl ===================================================================
1933 elif test "x$enable_dtrace" = "xyes"; then
1934 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1936 dnl check for the presence of the -dead_strip linker flag
1937 AC_MSG_CHECKING([for -dead_strip option to ld])
1938 _SAVE_LDFLAGS=$LDFLAGS
1939 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1940 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1941 if test -n "$_HAVE_DEAD_STRIP" ; then
1942 AC_MSG_RESULT([yes])
1943 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1948 LDFLAGS=$_SAVE_LDFLAGS
1951 dnl With newer linkers we need to pass -allow_heap_execute because of
1952 dnl Microsoft Silverlight (5.1.10411.0 at least).
1953 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1954 _SAVE_LDFLAGS=$LDFLAGS
1955 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1956 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1957 _HAVE_ALLOW_HEAP_EXECUTE=)
1958 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1959 AC_MSG_RESULT([yes])
1960 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1964 LDFLAGS=$_SAVE_LDFLAGS
1966 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1971 if test ! "$GNU_CC"; then
1975 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1976 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1977 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1980 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1981 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1984 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1985 AC_DEFINE(_LARGEFILE64_SOURCE)
1990 if test ! "$GNU_CC"; then
1991 DSO_LDOPTS='-b -Wl,+s'
1994 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1995 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1996 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1998 DSO_LDOPTS='-b -E +s'
1999 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2000 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2002 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2003 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2006 *-android*|*-linuxandroid*)
2007 AC_DEFINE(NO_PW_GECOS)
2009 if test -n "$gonkdir"; then
2010 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2011 _PLATFORM_HAVE_RIL=1
2015 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2018 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2020 MOZ_GFX_OPTIMIZE_MOBILE=1
2021 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2025 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2026 # Similarly for GNU_CXX and INTEL_CXX.
2027 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2028 # -Os has been broken on Intel's C/C++ compilers for quite a
2029 # while; Intel recommends against using it.
2030 MOZ_OPTIMIZE_FLAGS="-O2"
2031 elif test "$GNU_CC" -o "$GNU_CXX"; then
2032 case $GCC_VERSION in
2034 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
2035 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2037 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2038 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2041 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2045 case "${target_cpu}" in
2047 CFLAGS="$CFLAGS -mieee"
2048 CXXFLAGS="$CXXFLAGS -mieee"
2052 if test -z "$MC"; then
2062 # certain versions of cygwin's makedepend barf on the
2063 # #include <string> vs -I./dist/include/string issue so don't use it
2064 XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)'
2065 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
2067 CXX="$CXX -mwindows"
2068 CPP="$CPP -mwindows"
2069 CFLAGS="$CFLAGS -mms-bitfields"
2070 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2071 DSO_LDOPTS='-shared'
2072 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2073 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2075 # Use static libgcc and libstdc++
2076 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
2077 NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
2078 # Use temp file for windres (bug 213281)
2079 RCFLAGS='-O coff --use-temp-file'
2080 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2081 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2084 IMPORT_LIB_SUFFIX=dll.a
2086 # We use mix of both POSIX and Win32 printf format across the tree, so format
2087 # warnings are useless on mingw.
2088 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2089 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2091 TARGET_COMPILER_ABI=msvc
2095 if test "$AS_BIN"; then
2096 AS="$(basename "$AS_BIN")"
2099 AR_FLAGS='-NOLOGO -OUT:$@'
2101 RANLIB='echo not_ranlib'
2102 STRIP='echo not_strip'
2113 IMPORT_LIB_SUFFIX=lib
2114 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2115 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2117 MKSHLIB_UNFORCE_ALL=
2118 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2119 _USE_CPP_INCLUDE_FLAG=1
2120 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2121 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2122 CFLAGS="$CFLAGS -W3 -Gy"
2123 CXXFLAGS="$CXXFLAGS -W3 -Gy"
2124 if test "$_CC_SUITE" -ge "11"; then
2125 dnl VS2012+ defaults to -arch:SSE2.
2126 CFLAGS="$CFLAGS -arch:IA32"
2127 CXXFLAGS="$CXXFLAGS -arch:IA32"
2129 if test "$_CC_SUITE" -ge "12"; then
2130 dnl VS2013+ requires -FS when parallel building by make -jN.
2131 dnl If nothing, compiler sometimes causes C1041 error.
2133 dnl Visual Studio 2013 supports -Gw flags
2134 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
2135 CFLAGS="$CFLAGS -FS -Gw"
2136 CXXFLAGS="$CXXFLAGS -FS -Gw"
2138 # khuey says we can safely ignore MSVC warning C4251
2139 # MSVC warning C4244 (implicit type conversion may lose data) warns
2140 # and requires workarounds for perfectly valid code. Also, GCC/clang
2141 # don't warn about it by default. So for consistency/sanity, we turn
2142 # it off on MSVC, too.
2143 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2144 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2145 # MSVC warning C4482 warns when an enum value is refered specifing the
2146 # name of the enum itself. This behavior is allowed in C++11, and the
2147 # warning has been removed in VS2012.
2148 # MSVC warning C4800 warns when a value is implicitly cast to bool,
2149 # because this also forces narrowing to a single byte, which can be a
2150 # perf hit. But this matters so little in practice (and often we want
2151 # that behavior) that it's better to turn it off.
2152 # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2153 # on non-Western system locales even if it is in a comment.
2154 CFLAGS="$CFLAGS -wd4244 -wd4819"
2155 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2156 # make 'foo == bar;' error out
2157 CFLAGS="$CFLAGS -we4553"
2158 CXXFLAGS="$CXXFLAGS -we4553"
2159 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2160 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2161 WARNINGS_AS_ERRORS='-WX'
2162 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
2164 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2165 # Disable these flags on clang-cl since it doesn't ignore unknown arguments by default, and
2166 # autoconf insists on passing $LDFLAGS to the compiler.
2167 if test -z "$CLANG_CL"; then
2168 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2169 if test -z "$DEVELOPER_OPTIONS"; then
2170 LDFLAGS="$LDFLAGS -RELEASE"
2173 dnl For profile-guided optimization
2174 PROFILE_GEN_CFLAGS="-GL"
2175 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2176 dnl XXX: PGO builds can fail with warnings treated as errors,
2177 dnl specifically "no profile data available" appears to be
2178 dnl treated as an error sometimes. This might be a consequence
2179 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2180 dnl with the linker doing most of the work in the whole-program
2181 dnl optimization/PGO case. I think it's probably a compiler bug,
2182 dnl but we work around it here.
2183 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2184 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2185 dnl Probably also a compiler bug, but what can you do?
2186 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2187 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2188 dnl Minimum reqiurement of Gecko is VS2010 or later which supports
2189 dnl both SSSE3 and SSE4.1.
2190 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2191 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
2194 AC_DEFINE(HAVE_SNPRINTF)
2199 AC_DEFINE(HW_THREADS)
2200 AC_DEFINE(STDC_HEADERS)
2201 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2202 TARGET_MD_ARCH=win32
2203 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2205 MOZ_USER_DIR="Mozilla"
2207 dnl Hardcode to win95 for now - cls
2208 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2210 dnl set NO_X11 defines here as the general check is skipped on win32
2216 if test -n "$L10NBASEDIR"; then
2217 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2224 if test -z "$MOZ_TOOLS"; then
2225 AC_MSG_ERROR([MOZ_TOOLS is not set])
2227 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2228 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2229 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2231 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2232 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2233 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2240 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.])
2246 if test "$HAVE_64BIT_BUILD"; then
2247 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2250 if test -n "$GNU_CC"; then
2251 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2252 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2253 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2255 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2256 # Disable this flag on clang-cl since it doesn't ignore unknown arguments by default, and
2257 # autoconf insists on passing $LDFLAGS to the compiler.
2258 if test -z "$CLANG_CL"; then
2259 LDFLAGS="$LDFLAGS -SAFESEH"
2266 if test -n "$_WIN32_MSVC"; then
2267 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2272 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2279 CFLAGS="$CFLAGS -Dunix"
2280 CXXFLAGS="$CXXFLAGS -Dunix"
2281 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2283 DSO_PIC_CFLAGS='-fPIC -DPIC'
2284 DSO_LDOPTS='-shared'
2285 BIN_FLAGS='-Wl,--export-dynamic'
2287 DSO_PIC_CFLAGS='-fPIC -DPIC'
2288 DLL_SUFFIX=".so.1.0"
2289 DSO_LDOPTS='-shared'
2291 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2292 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2293 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2294 if test "$LIBRUNPATH"; then
2295 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2297 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2298 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2302 if test "$SO_VERSION"; then
2303 DLL_SUFFIX=".so.$SO_VERSION"
2305 DLL_SUFFIX=".so.1.0"
2307 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2309 DSO_PIC_CFLAGS='-fPIC'
2310 DSO_LDOPTS='-shared -fPIC'
2311 if test "$LIBRUNPATH"; then
2312 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2318 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2320 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2321 # libraries one level up (e.g. libnspr4.so)
2322 if test "$SOLARIS_SUNPRO_CC"; then
2323 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2324 LIBS="-lCrun -lCstd -lc $LIBS"
2325 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2326 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2327 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2328 LDFLAGS="-xildoff $LDFLAGS"
2329 MMX_FLAGS="-xarch=mmx -xO4"
2330 SSE_FLAGS="-xarch=sse"
2331 SSE2_FLAGS="-xarch=ssei2 -xO4"
2332 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2333 _SAVE_LDFLAGS=$LDFLAGS
2334 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2335 AC_TRY_LINK([#include <stdio.h>],
2336 [printf("Hello World\n");],
2338 [LDFLAGS=$_SAVE_LDFLAGS])
2340 MOZ_OPTIMIZE_FLAGS="-xO4"
2341 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2342 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2343 MKSHLIB_FORCE_ALL='-z allextract'
2344 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2351 AS='/usr/ccs/bin/as'
2352 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2354 TARGET_COMPILER_ABI="sunc"
2355 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2356 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2357 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2361 [#if (__SUNPRO_CC < 0x590)
2364 _BAD_COMPILER=,_BAD_COMPILER=1)
2365 if test -n "$_BAD_COMPILER"; then
2367 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2372 [#if (__SUNPRO_CC >= 0x5100)
2373 #error "Sun C++ 5.10 or above"
2375 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2376 if test "$_ABOVE_SS12U1"; then
2378 CXXFLAGS="$CXXFLAGS -xannotate=no"
2380 AC_MSG_RESULT([$_res])
2383 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2385 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2386 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2387 ASFLAGS="$ASFLAGS -fPIC"
2388 DSO_LDOPTS='-shared'
2389 WARNINGS_AS_ERRORS='-Werror'
2391 _WARNINGS_CXXFLAGS=''
2392 if test "$OS_RELEASE" = "5.3"; then
2393 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2396 if test "$OS_RELEASE" = "5.5.1"; then
2397 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2402 DSO_LDOPTS='-Bdynamic'
2403 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2404 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2406 AC_DEFINE(SPRINTF_RETURNS_STRING)
2407 case "$(target_os)" in
2409 DLL_SUFFIX='.so.1.0'
2416 AC_SUBST_LIST(MMX_FLAGS)
2417 AC_SUBST_LIST(SSE_FLAGS)
2418 AC_SUBST_LIST(SSE2_FLAGS)
2422 # Includes linux-android
2427 AC_SUBST(MOZ_LINKER)
2428 if test -n "$MOZ_LINKER"; then
2429 AC_DEFINE(MOZ_LINKER)
2432 dnl Only one oddball right now (QNX), but this gives us flexibility
2433 dnl if any other platforms need to override this in the future.
2434 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2436 dnl ========================================================
2437 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2438 dnl by now will not have any way to link most binaries (tests
2439 dnl as well as viewer, apprunner, etc.), because some symbols
2440 dnl will be left out of the "composite" .so's by ld as unneeded.
2441 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2442 dnl they can link in the static libs that provide the missing
2444 dnl ========================================================
2445 NO_LD_ARCHIVE_FLAGS=
2446 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2447 NO_LD_ARCHIVE_FLAGS=1
2451 NO_LD_ARCHIVE_FLAGS=
2454 if test -z "$GNU_CC"; then
2455 NO_LD_ARCHIVE_FLAGS=
2459 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2461 dnl ========================================================
2462 dnl = Flags to strip unused symbols from .so components and
2463 dnl = to export jemalloc symbols when linking a program
2464 dnl ========================================================
2466 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2467 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2470 if test -z "$GNU_CC"; then
2471 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2473 if test -z "$GCC_USE_GNU_LD"; then
2474 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2476 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2481 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2484 if test -n "$GNU_CC"; then
2485 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2490 if test -z "$COMPILE_ENVIRONMENT"; then
2491 SKIP_COMPILER_CHECKS=1
2492 SKIP_LIBRARY_CHECKS=1
2497 if test -z "$SKIP_COMPILER_CHECKS"; then
2498 dnl Checks for typedefs, structures, and compiler characteristics.
2499 dnl ========================================================
2508 AC_MSG_CHECKING(for ssize_t)
2509 AC_CACHE_VAL(ac_cv_type_ssize_t,
2510 [AC_TRY_COMPILE([#include <stdio.h>
2511 #include <sys/types.h>],
2513 [ac_cv_type_ssize_t=true],
2514 [ac_cv_type_ssize_t=false])])
2515 if test "$ac_cv_type_ssize_t" = true ; then
2516 AC_DEFINE(HAVE_SSIZE_T)
2521 AC_STRUCT_ST_BLKSIZE
2522 AC_MSG_CHECKING(for siginfo_t)
2523 AC_CACHE_VAL(ac_cv_siginfo_t,
2524 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2525 #include <signal.h>],
2527 [ac_cv_siginfo_t=true],
2528 [ac_cv_siginfo_t=false])])
2529 if test "$ac_cv_siginfo_t" = true ; then
2530 AC_DEFINE(HAVE_SIGINFO_T)
2542 dnl Check for .hidden assembler directive and visibility attribute.
2543 dnl Borrowed from glibc configure.in
2544 dnl ===============================================================
2545 if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
2546 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2547 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2548 case "$OS_TARGET" in
2550 VISIBILITY_FLAGS='-fvisibility=hidden'
2553 case $GCC_VERSION in
2555 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden_dso_handle.h'
2558 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2561 WRAP_SYSTEM_INCLUDES=1
2566 # visibility hidden flag for Sun Studio on Solaris
2567 if test "$SOLARIS_SUNPRO_CC"; then
2568 VISIBILITY_FLAGS='-xldscope=hidden'
2569 fi # Sun Studio on Solaris
2571 case "${OS_TARGET}" in
2572 WINNT|Darwin|Android)
2575 STL_FLAGS='-I$(DIST)/stl_wrappers'
2580 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2581 AC_SUBST(VISIBILITY_FLAGS)
2585 if test "$OS_TARGET" != WINNT; then
2586 # Only run this test with clang on non-Windows platforms, because clang
2587 # cannot do enough code gen for now to make this test work correctly.
2591 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2592 dnl ========================================================
2593 if test "$GNU_CC"; then
2594 CFLAGS_save="${CFLAGS}"
2595 CFLAGS="${CFLAGS} -Werror"
2596 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2597 ac_cv_force_align_arg_pointer,
2598 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2600 ac_cv_force_align_arg_pointer="yes",
2601 ac_cv_force_align_arg_pointer="no")])
2602 CFLAGS="${CFLAGS_save}"
2603 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2604 HAVE_GCC_ALIGN_ARG_POINTER=1
2606 HAVE_GCC_ALIGN_ARG_POINTER=
2609 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2611 dnl Checks for header files.
2612 dnl ========================================================
2614 case "$target_os" in
2616 # for stuff like -lXshm
2617 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2620 MOZ_CHECK_COMMON_HEADERS
2622 dnl These are all the places some variant of statfs can be hiding.
2623 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2626 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2627 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2629 dnl SCTP support - needs various network include headers
2630 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2632 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2634 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2635 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2636 ac_cv_sockaddr_in_sin_len,
2637 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2638 #include <sys/types.h>
2640 #include <netinet/in.h>
2641 struct sockaddr_in x;
2642 void *foo = (void*) &x.sin_len;],
2644 [ac_cv_sockaddr_in_sin_len=true],
2645 [ac_cv_sockaddr_in_sin_len=false])])
2646 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2647 AC_DEFINE(HAVE_SIN_LEN)
2648 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2649 AC_DEFINE(HAVE_SCONN_LEN)
2652 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2653 ac_cv_sockaddr_in6_sin6_len,
2654 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2655 #include <sys/types.h>
2657 #include <netinet/in.h>
2658 struct sockaddr_in6 x;
2659 void *foo = (void*) &x.sin6_len;],
2661 [ac_cv_sockaddr_in6_sin6_len=true],
2662 [ac_cv_sockaddr_in6_sin6_len=false])])
2663 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2664 AC_DEFINE(HAVE_SIN6_LEN)
2667 AC_CACHE_CHECK(for sockaddr.sa_len,
2668 ac_cv_sockaddr_sa_len,
2669 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2670 #include <sys/types.h>
2672 #include <sys/socket.h>
2674 void *foo = (void*) &x.sa_len;],
2676 [ac_cv_sockaddr_sa_len=true],
2677 [ac_cv_sockaddr_sa_len=false])])
2678 if test "$ac_cv_sockaddr_sa_len" = true ; then
2679 AC_DEFINE(HAVE_SA_LEN)
2682 AC_ARG_ENABLE(dtrace,
2683 [ --enable-dtrace build with dtrace support if available (default=no)],
2684 [enable_dtrace="yes"],)
2685 if test "x$enable_dtrace" = "xyes"; then
2686 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2687 if test -n "$HAVE_DTRACE"; then
2688 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2690 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2693 AC_SUBST(HAVE_DTRACE)
2699 MOZ_CHECK_HEADERS(sys/cdefs.h)
2703 MOZ_LINUX_PERF_EVENT
2705 dnl Checks for libraries.
2706 dnl ========================================================
2711 AC_CHECK_LIB(c_r, gethostbyname_r)
2715 dnl We don't want to link with libdl even if it's present on OS X, since
2716 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2718 dnl We don't want to link against libm or libpthread on Darwin since
2719 dnl they both are just symlinks to libSystem and explicitly linking
2720 dnl against libSystem causes issues when debugging (see bug 299601).
2725 AC_SEARCH_LIBS(dlopen, dl,
2726 MOZ_CHECK_HEADER(dlfcn.h,
2727 AC_DEFINE(HAVE_DLOPEN)))
2731 _SAVE_CFLAGS="$CFLAGS"
2732 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2733 AC_CHECK_FUNCS(dladdr memmem)
2734 CFLAGS="$_SAVE_CFLAGS"
2736 if test ! "$GNU_CXX"; then
2740 AC_CHECK_LIB(C_r, demangle)
2743 AC_CHECK_LIB(C, demangle)
2748 AC_CHECK_LIB(socket, socket)
2751 XLIBS="$X_EXTRA_LIBS"
2753 dnl ========================================================
2754 dnl Checks for X libraries.
2755 dnl Ordering is important.
2756 dnl Xt is dependent upon SM as of X11R6
2757 dnl ========================================================
2758 if test "$no_x" = "yes"; then
2761 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2762 XLIBS="-lX11 $XLIBS"
2763 _SAVE_LDFLAGS="$LDFLAGS"
2764 LDFLAGS="$XLDFLAGS $LDFLAGS"
2765 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2766 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2767 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2768 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2770 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2771 unset ac_cv_lib_Xt_XtFree
2772 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2773 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
2774 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2775 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2778 # AIX needs the motif library linked before libXt to prevent
2779 # crashes in plugins linked against Motif - Bug #98892
2780 case "${target_os}" in
2782 XT_LIBS="-lXm $XT_LIBS"
2786 dnl ========================================================
2787 dnl = Check for XShm
2788 dnl ========================================================
2789 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
2792 dnl ========================================================
2794 dnl ========================================================
2795 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
2796 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
2797 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
2798 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
2800 LDFLAGS="$_SAVE_LDFLAGS"
2810 dnl ========================================================
2811 dnl = pthread support
2812 dnl = Start by checking whether the system support pthreads
2813 dnl ========================================================
2814 case "$target_os" in
2819 AC_CHECK_LIB(pthreads, pthread_create,
2820 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2821 AC_CHECK_LIB(pthread, pthread_create,
2822 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2823 AC_CHECK_LIB(c_r, pthread_create,
2824 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2825 AC_CHECK_LIB(c, pthread_create,
2834 dnl ========================================================
2835 dnl Check the command line for --with-pthreads
2836 dnl ========================================================
2837 MOZ_ARG_WITH_BOOL(pthreads,
2838 [ --with-pthreads Force use of system pthread library with NSPR ],
2839 [ if test "$MOZ_USE_PTHREADS"x = x; then
2840 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2846 dnl ========================================================
2847 dnl Do the platform specific pthread hackery
2848 dnl ========================================================
2849 if test "$MOZ_USE_PTHREADS"x != x
2852 dnl See if -pthread is supported.
2855 ac_cv_have_dash_pthread=no
2856 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2857 echo 'int main() { return 0; }' | cat > conftest.c
2858 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2859 if test $? -eq 0; then
2860 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2861 ac_cv_have_dash_pthread=yes
2862 case "$target_os" in
2864 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2867 CFLAGS="$CFLAGS -pthread"
2868 CXXFLAGS="$CXXFLAGS -pthread"
2874 AC_MSG_RESULT($ac_cv_have_dash_pthread)
2877 dnl See if -pthreads is supported.
2879 ac_cv_have_dash_pthreads=no
2880 if test "$ac_cv_have_dash_pthread" = "no"; then
2881 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2882 echo 'int main() { return 0; }' | cat > conftest.c
2883 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2884 if test $? -eq 0; then
2885 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2886 ac_cv_have_dash_pthreads=yes
2887 CFLAGS="$CFLAGS -pthreads"
2888 CXXFLAGS="$CXXFLAGS -pthreads"
2892 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2897 AC_DEFINE(_REENTRANT)
2898 AC_DEFINE(_THREAD_SAFE)
2899 dnl -pthread links in -lpthread, so don't specify it explicitly.
2900 if test "$ac_cv_have_dash_pthread" = "yes"; then
2901 _PTHREAD_LDFLAGS="-pthread"
2905 *-*-openbsd*|*-*-bsdi*)
2906 AC_DEFINE(_REENTRANT)
2907 AC_DEFINE(_THREAD_SAFE)
2908 dnl -pthread links in -lc_r, so don't specify it explicitly.
2909 if test "$ac_cv_have_dash_pthread" = "yes"; then
2910 _PTHREAD_LDFLAGS="-pthread"
2914 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
2915 AC_DEFINE(_REENTRANT)
2919 AC_DEFINE(_REENTRANT)
2923 AC_DEFINE(_REENTRANT)
2927 AC_DEFINE(_REENTRANT)
2928 if test "$SOLARIS_SUNPRO_CC"; then
2929 CFLAGS="$CFLAGS -mt"
2930 CXXFLAGS="$CXXFLAGS -mt"
2934 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
2935 AC_SUBST(MOZ_USE_PTHREADS)
2939 dnl Checks for library functions.
2940 dnl ========================================================
2941 AC_PROG_GCC_TRADITIONAL
2943 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r arc4random arc4random_buf)
2945 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
2946 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
2947 ac_cv_clock_monotonic,
2948 [for libs in "" -lrt; do
2951 AC_TRY_LINK([#include <time.h>],
2952 [ struct timespec ts;
2953 clock_gettime(CLOCK_MONOTONIC, &ts); ],
2954 ac_cv_clock_monotonic=$libs
2957 ac_cv_clock_monotonic=no)
2960 if test "$ac_cv_clock_monotonic" != "no"; then
2961 HAVE_CLOCK_MONOTONIC=1
2962 REALTIME_LIBS=$ac_cv_clock_monotonic
2963 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
2964 AC_SUBST(HAVE_CLOCK_MONOTONIC)
2965 AC_SUBST(REALTIME_LIBS)
2968 dnl check for wcrtomb/mbrtowc
2969 dnl =======================================================================
2970 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
2973 AC_CACHE_CHECK(for wcrtomb,
2975 [AC_TRY_LINK([#include <wchar.h>],
2976 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
2977 ac_cv_have_wcrtomb="yes",
2978 ac_cv_have_wcrtomb="no")])
2979 if test "$ac_cv_have_wcrtomb" = "yes"; then
2980 AC_DEFINE(HAVE_WCRTOMB)
2982 AC_CACHE_CHECK(for mbrtowc,
2984 [AC_TRY_LINK([#include <wchar.h>],
2985 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
2986 ac_cv_have_mbrtowc="yes",
2987 ac_cv_have_mbrtowc="no")])
2988 if test "$ac_cv_have_mbrtowc" = "yes"; then
2989 AC_DEFINE(HAVE_MBRTOWC)
2996 ac_cv_func_res_ninit,
2997 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
2998 dnl no need for res_ninit() on NetBSD and OpenBSD
2999 ac_cv_func_res_ninit=no
3003 #define _BSD_SOURCE 1
3005 #include <sys/types.h>
3006 #include <netinet/in.h>
3007 #include <arpa/nameser.h>
3010 [int foo = res_ninit(&_res);],
3011 [ac_cv_func_res_ninit=yes],
3012 [ac_cv_func_res_ninit=no])
3016 if test "$ac_cv_func_res_ninit" = "yes"; then
3017 AC_DEFINE(HAVE_RES_NINIT)
3018 dnl must add the link line we do something as foolish as this... dougt
3020 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3021 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3031 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3032 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3033 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3035 LIBS="$LIBS $_ICONV_LIBS"
3044 iconv_t h = iconv_open("", "");
3045 iconv(h, NULL, NULL, NULL, NULL);
3048 [ac_cv_func_iconv=yes],
3049 [ac_cv_func_iconv=no]
3052 if test "$ac_cv_func_iconv" = "yes"; then
3053 AC_DEFINE(HAVE_ICONV)
3054 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3055 LIBICONV="$_ICONV_LIBS"
3057 [for iconv() with const input],
3058 ac_cv_func_const_iconv,
3064 const char *input = "testing";
3065 iconv_t h = iconv_open("", "");
3066 iconv(h, &input, NULL, NULL, NULL);
3069 [ac_cv_func_const_iconv=yes],
3070 [ac_cv_func_const_iconv=no]
3073 if test "$ac_cv_func_const_iconv" = "yes"; then
3074 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3086 dnl **********************
3087 dnl *** va_copy checks ***
3088 AC_CACHE_CHECK([for an implementation of va_copy()],
3090 [AC_TRY_COMPILE([#include <stdarg.h>
3092 void f (int i, ...) {
3093 va_list args1, args2;
3094 va_start (args1, i);
3095 va_copy (args2, args1);
3096 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3098 va_end (args1); va_end (args2);
3100 [f(0, 42); return 0],
3101 [ac_cv_va_copy=yes],
3105 AC_CACHE_CHECK([whether va_list can be copied by value],
3107 [AC_TRY_COMPILE([#include <stdarg.h>
3109 void f (int i, ...) {
3110 va_list args1, args2;
3111 va_start (args1, i);
3113 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3115 va_end (args1); va_end (args2);
3117 [f(0, 42); return 0],
3118 [ac_cv_va_val_copy=yes],
3119 [ac_cv_va_val_copy=no],
3122 if test "x$ac_cv_va_copy" = "xyes"; then
3123 AC_DEFINE(VA_COPY, va_copy)
3124 AC_DEFINE(HAVE_VA_COPY)
3127 if test "x$ac_cv_va_val_copy" = "xno"; then
3128 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3131 dnl ===================================================================
3132 dnl ========================================================
3133 dnl Put your C++ language/feature checks below
3134 dnl ========================================================
3138 if test "$GNU_CC"; then
3139 if test "$CPU_ARCH" = "arm" ; then
3140 AC_CACHE_CHECK(for ARM EABI,
3144 #if defined(__ARM_EABI__)
3147 #error Not ARM EABI.
3150 ac_cv_gcc_arm_eabi="yes",
3151 ac_cv_gcc_arm_eabi="no")])
3152 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3154 ARM_ABI_PREFIX=eabi-
3156 ARM_ABI_PREFIX=oabi-
3160 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3163 dnl Check to see if we can resolve ambiguity with |using|.
3164 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3165 ac_cv_cpp_ambiguity_resolving_using,
3166 [AC_TRY_COMPILE(class X {
3167 public: int go(const X&) {return 3;}
3168 int jo(const X&) {return 3;}
3170 class Y : public X {
3171 public: int go(int) {return 2;}
3172 int jo(int) {return 2;}
3174 private: using X::go;
3177 ac_cv_cpp_ambiguity_resolving_using=yes,
3178 ac_cv_cpp_ambiguity_resolving_using=no)])
3179 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3180 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3183 dnl See if a dynamic_cast to void* gives the most derived object.
3184 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3185 ac_cv_cpp_dynamic_cast_void_ptr,
3186 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3187 class Y { int j; public: virtual ~Y() { } };
3188 class Z : public X, public Y { int k; };
3194 return !((((void*)&mdo != (void*)subx) &&
3195 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3196 (((void*)&mdo != (void*)suby) &&
3197 ((void*)&mdo == dynamic_cast<void*>(suby))));
3199 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3200 ac_cv_cpp_dynamic_cast_void_ptr=no,
3201 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3202 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3203 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3206 dnl note that this one is reversed - if the test fails, then
3207 dnl we require implementations of unused virtual methods. Which
3208 dnl really blows because it means we'll have useless vtable
3210 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3211 ac_cv_cpp_unused_required,
3212 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3214 ac_cv_cpp_unused_required=no,
3215 ac_cv_cpp_unused_required=yes)])
3216 if test "$ac_cv_cpp_unused_required" = yes ; then
3217 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3221 dnl Some compilers have trouble comparing a constant reference to a templatized
3222 dnl class to zero, and require an explicit operator==() to be defined that takes
3223 dnl an int. This test separates the strong from the weak.
3225 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3226 ac_cv_trouble_comparing_to_zero,
3227 [AC_TRY_COMPILE([#include <algorithm>
3228 template <class T> class Foo {};
3230 template <class T> int operator==(const T2*, const T&) { return 0; }
3231 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3232 [Foo<int> f; return (0 != f);],
3233 ac_cv_trouble_comparing_to_zero=no,
3234 ac_cv_trouble_comparing_to_zero=yes)])
3235 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3236 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3239 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3240 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3241 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3243 _SAVE_LDFLAGS=$LDFLAGS
3244 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3245 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3246 ac_cv_thread_keyword,
3247 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3248 [return tlsIsMainThread;],
3249 ac_cv_thread_keyword=yes,
3250 ac_cv_thread_keyword=no)])
3251 LDFLAGS=$_SAVE_LDFLAGS
3252 # The custom dynamic linker doesn't support TLS variables
3254 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3255 # mips builds fail with TLS variables because of a binutils bug.
3257 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3262 *-android*|*-linuxandroid*)
3269 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3275 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3276 if test -n "$MOZ_LINKER"; then
3277 if test "$CPU_ARCH" = arm; then
3278 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3279 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3280 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3281 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3286 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3287 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3288 dnl We however want to avoid these text relocations, and this can be done
3289 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3290 dnl doesn't contain anything at all, beside placeholders for some sections,
3291 dnl and crtbegin only contains a finalizer function that calls
3292 dnl __cxa_finalize. The custom linker actually takes care of calling
3293 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3294 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3295 dnl link crtbegin and crtend at all.
3296 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3297 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3298 ac_cv_crt_has_text_relocations,
3299 [echo 'int foo() { return 0; }' > conftest.cpp
3300 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3301 test -s conftest${DLL_SUFFIX}; then
3302 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3303 ac_cv_crt_has_text_relocations=yes
3305 ac_cv_crt_has_text_relocations=no
3308 AC_ERROR([couldn't compile a simple C file])
3311 if test "$ac_cv_crt_has_text_relocations" = yes; then
3312 dnl While we want libraries to skip the CRT files, we don't want
3313 dnl executables to be treated the same way. We thus set the flag
3314 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3315 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3316 dnl Using LDFLAGS in nspr is safe, since we only really build
3317 dnl libraries there.
3318 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3319 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3323 dnl Check for the existence of various allocation headers/functions
3325 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3328 for file in $MALLOC_HEADERS; do
3329 MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3330 if test "$MALLOC_H" != ""; then
3331 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3336 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3338 AC_CHECK_FUNCS(malloc_usable_size)
3340 dnl See if compiler supports some gcc-style attributes
3342 AC_CACHE_CHECK(for __attribute__((always_inline)),
3343 ac_cv_attribute_always_inline,
3344 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3346 ac_cv_attribute_always_inline=yes,
3347 ac_cv_attribute_always_inline=no)])
3349 AC_CACHE_CHECK(for __attribute__((malloc)),
3350 ac_cv_attribute_malloc,
3351 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3353 ac_cv_attribute_malloc=yes,
3354 ac_cv_attribute_malloc=no)])
3356 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3357 ac_cv_attribute_warn_unused,
3358 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3360 ac_cv_attribute_warn_unused=yes,
3361 ac_cv_attribute_warn_unused=no)])
3363 dnl End of C++ language/feature checks
3366 dnl ========================================================
3367 dnl = Internationalization checks
3368 dnl ========================================================
3370 dnl Internationalization and Locale support is different
3371 dnl on various UNIX platforms. Checks for specific i18n
3372 dnl features go here.
3374 dnl check for LC_MESSAGES
3375 AC_CACHE_CHECK(for LC_MESSAGES,
3376 ac_cv_i18n_lc_messages,
3377 [AC_TRY_COMPILE([#include <locale.h>],
3378 [int category = LC_MESSAGES;],
3379 ac_cv_i18n_lc_messages=yes,
3380 ac_cv_i18n_lc_messages=no)])
3381 if test "$ac_cv_i18n_lc_messages" = yes; then
3382 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3385 AC_HAVE_FUNCS(localeconv)
3386 fi # ! SKIP_COMPILER_CHECKS
3389 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3390 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3391 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
3394 dnl Mozilla specific options
3395 dnl ========================================================
3396 dnl The macros used for command line options
3397 dnl are defined in build/autoconf/altoptions.m4.
3399 dnl If the compiler supports these attributes, define them as
3400 dnl convenience macros.
3401 if test "$ac_cv_attribute_malloc" = yes ; then
3402 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3404 AC_DEFINE(NS_ATTR_MALLOC,)
3407 if test "$ac_cv_attribute_warn_unused" = yes ; then
3408 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3410 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3413 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3414 dnl features that Windows actually does support.
3416 if test -n "$SKIP_COMPILER_CHECKS"; then
3417 dnl Windows has malloc.h
3418 AC_DEFINE(MALLOC_H, [<malloc.h>])
3419 AC_DEFINE(HAVE_FORCEINLINE)
3420 AC_DEFINE(HAVE_LOCALECONV)
3421 fi # SKIP_COMPILER_CHECKS
3423 dnl ========================================================
3425 dnl = Check for external package dependencies
3427 dnl ========================================================
3428 MOZ_ARG_HEADER(External Packages)
3430 MOZ_ARG_WITH_STRING(libxul-sdk,
3431 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3432 AC_MSG_ERROR([--with-libxul-sdk is not supported anymore.]))
3434 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3435 AC_SUBST(LIBXUL_DIST)
3439 dnl set GRE_MILESTONE
3440 dnl ========================================================
3441 if test -n "$LIBXUL_SDK"; then
3442 GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3444 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3446 AC_SUBST(GRE_MILESTONE)
3448 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3449 # The logic works like this:
3450 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3451 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3452 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3453 case "$GRE_MILESTONE" in
3456 AC_DEFINE(NIGHTLY_BUILD)
3462 AC_DEFINE(RELEASE_BUILD)
3465 AC_SUBST(NIGHTLY_BUILD)
3466 AC_SUBST(RELEASE_BUILD)
3468 dnl ========================================================
3469 dnl Disable compiling sources in unified mode.
3470 dnl ========================================================
3472 if test -z "$NIGHTLY_BUILD"; then
3473 MOZ_DISABLE_UNIFIED_COMPILATION=1
3476 MOZ_ARG_DISABLE_BOOL(unified-compilation,
3477 [ --disable-unified-compilation
3478 Disable unified compilation of some C/C++ sources],
3479 MOZ_DISABLE_UNIFIED_COMPILATION=1,
3480 MOZ_DISABLE_UNIFIED_COMPILATION=)
3481 AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
3483 dnl ========================================================
3484 dnl Multiprocess Firefox Nightly Testing UI
3485 dnl To be removed in Bug 1003313
3486 dnl ========================================================
3487 if test -z "$NIGHTLY_BUILD"; then
3491 AC_SUBST(E10S_TESTING_ONLY)
3493 dnl ========================================================
3494 dnl system libevent Support
3495 dnl ========================================================
3496 MOZ_ARG_WITH_STRING(system-libevent,
3497 [ --with-system-libevent[=PFX]
3498 Use system libevent [installed at prefix PFX]],
3499 LIBEVENT_DIR=$withval)
3501 _SAVE_CFLAGS=$CFLAGS
3502 _SAVE_LDFLAGS=$LDFLAGS
3504 if test "$LIBEVENT_DIR" = yes; then
3505 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3506 MOZ_NATIVE_LIBEVENT=1,
3509 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3510 MOZ_NATIVE_LIBEVENT=
3511 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3512 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3513 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3514 MOZ_CHECK_HEADER(event.h,
3515 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3516 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3518 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3519 AC_CHECK_LIB(event, event_init,
3520 [MOZ_NATIVE_LIBEVENT=1
3521 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3522 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3523 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3525 CFLAGS=$_SAVE_CFLAGS
3526 LDFLAGS=$_SAVE_LDFLAGS
3529 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3530 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
3531 AC_SUBST(MOZ_LIBEVENT_LIBS)
3533 dnl ========================================================
3534 dnl = If NSS was not detected in the system,
3535 dnl = use the one in the source tree (mozilla/security/nss)
3536 dnl ========================================================
3538 MOZ_ARG_WITH_BOOL(system-nss,
3539 [ --with-system-nss Use system installed NSS],
3542 if test -n "$_USE_SYSTEM_NSS"; then
3543 AM_PATH_NSS(3.16.1, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3546 if test -n "$MOZ_NATIVE_NSS"; then
3547 NSS_LIBS="$NSS_LIBS -lcrmf"
3549 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3551 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
3553 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3554 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3555 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3556 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3557 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3559 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3563 dnl ======================
3565 dnl ======================
3567 AC_MSG_CHECKING([for YASM assembler])
3568 AC_CHECK_PROGS(YASM, yasm, "")
3570 if test -n "$YASM"; then
3571 dnl Pull out yasm's version string
3572 YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3573 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3574 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3575 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3576 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3579 if test -z "$SKIP_LIBRARY_CHECKS"; then
3580 dnl system JPEG support
3581 dnl ========================================================
3582 MOZ_ARG_WITH_STRING(system-jpeg,
3583 [ --with-system-jpeg[=PFX]
3584 Use system libjpeg [installed at prefix PFX]],
3587 _SAVE_CFLAGS=$CFLAGS
3588 _SAVE_LDFLAGS=$LDFLAGS
3590 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3591 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3592 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3594 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3597 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3600 if test "$MOZ_NATIVE_JPEG" = 1; then
3601 AC_TRY_COMPILE([ #include <stdio.h>
3602 #include <sys/types.h>
3603 #include <jpeglib.h> ],
3604 [ #if JPEG_LIB_VERSION < $MOZJPEG
3605 #error "Insufficient JPEG library version ($MOZJPEG required)."
3607 #ifndef JCS_EXTENSIONS
3608 #error "libjpeg-turbo JCS_EXTENSIONS required"
3612 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3614 CFLAGS=$_SAVE_CFLAGS
3615 LDFLAGS=$_SAVE_LDFLAGS
3618 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3619 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3620 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3622 fi # SKIP_LIBRARY_CHECKS
3624 dnl system ZLIB support
3625 dnl ========================================================
3626 MOZ_ZLIB_CHECK([1.2.3])
3628 if test "$MOZ_NATIVE_ZLIB" != 1; then
3629 MOZ_ZLIB_CFLAGS="-I${_topsrcdir}/modules/zlib/src"
3630 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
3633 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
3634 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
3639 if test -z "$SKIP_LIBRARY_CHECKS"; then
3640 dnl system BZIP2 Support
3641 dnl ========================================================
3642 MOZ_ARG_WITH_STRING(system-bz2,
3643 [ --with-system-bz2[=PFX]
3644 Use system libbz2 [installed at prefix PFX]],
3647 _SAVE_CFLAGS=$CFLAGS
3648 _SAVE_LDFLAGS=$LDFLAGS
3650 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
3651 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
3652 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
3654 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
3657 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
3658 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
3660 CFLAGS=$_SAVE_CFLAGS
3661 LDFLAGS=$_SAVE_LDFLAGS
3664 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
3665 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
3666 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
3669 dnl ========================================================
3670 dnl system PNG Support
3671 dnl ========================================================
3672 MOZ_ARG_WITH_STRING(system-png,
3673 [ --with-system-png[=PFX]
3674 Use system libpng [installed at prefix PFX]],
3677 _SAVE_CFLAGS=$CFLAGS
3678 _SAVE_LDFLAGS=$LDFLAGS
3680 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
3681 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
3682 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
3684 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
3687 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
3688 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3689 AC_CHECK_LIB(png, png_get_acTL, ,
3690 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
3692 if test "$MOZ_NATIVE_PNG" = 1; then
3693 AC_TRY_COMPILE([ #include <stdio.h>
3694 #include <sys/types.h>
3696 [ #if PNG_LIBPNG_VER < $MOZPNG
3697 #error "Insufficient libpng version ($MOZPNG required)."
3699 #ifndef PNG_UINT_31_MAX
3700 #error "Insufficient libpng version."
3703 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3705 CFLAGS=$_SAVE_CFLAGS
3706 LDFLAGS=$_SAVE_LDFLAGS
3709 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
3710 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
3711 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
3714 MOZ_PNG_ARM_NEON_CHECK=
3715 if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
3716 MOZ_ARG_ENABLE_STRING(png-arm-neon-support,
3717 [ --enable-png-arm-neon-support=TYPE
3721 nocheck (faster but unsafe)],
3722 [MOZ_PNG_ARM_NEON_SUPPORT=$enableval ] )
3723 case "$MOZ_PNG_ARM_NEON_SUPPORT" in
3725 # enable-png-arm-neon-support = no
3728 # enable-png-arm-neon-support = nocheck
3733 MOZ_PNG_ARM_NEON_CHECK=1
3738 AC_SUBST(MOZ_PNG_ARM_NEON_CHECK)
3740 fi # SKIP_LIBRARY_CHECKS
3742 AC_SUBST(MOZ_PNG_ARM_NEON)
3744 dnl ========================================================
3745 dnl system HunSpell Support
3746 dnl ========================================================
3747 MOZ_ARG_ENABLE_BOOL(system-hunspell,
3748 [ --enable-system-hunspell
3749 Use system hunspell (located with pkgconfig)],
3750 MOZ_NATIVE_HUNSPELL=1 )
3752 if test -n "$MOZ_NATIVE_HUNSPELL"; then
3753 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
3756 AC_SUBST(MOZ_NATIVE_HUNSPELL)
3758 dnl ========================================================
3759 dnl system libffi Support
3760 dnl ========================================================
3763 if test -n "$MOZ_NATIVE_FFI"; then
3764 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
3767 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
3768 if test "$OS_ARCH" = "WINNT"; then
3772 MOZ_ARG_ENABLE_BOOL(shared-js,
3773 [ --enable-shared-js
3774 Create a shared JavaScript library.],
3775 JS_SHARED_LIBRARY=1,
3778 dnl ========================================================
3779 dnl Java SDK support
3780 dnl ========================================================
3783 MOZ_ARG_WITH_STRING(java-bin-path,
3784 [ --with-java-bin-path=dir
3785 Location of Java binaries (java, javac, jar)],
3786 JAVA_BIN_PATH=$withval)
3788 dnl ========================================================
3792 dnl ========================================================
3794 MOZ_ARG_HEADER(Application)
3797 ENABLE_SYSTEM_EXTENSION_DIRS=1
3798 MOZ_BRANDING_DIRECTORY=
3799 MOZ_OFFICIAL_BRANDING=
3802 MOZ_AUTH_EXTENSION=1
3807 MOZ_SAMPLE_TYPE_FLOAT32=
3808 MOZ_SAMPLE_TYPE_S16=
3820 MOZ_WEBRTC_SIGNALING=
3821 MOZ_WEBRTC_ASSERT_ALWAYS=1
3824 MOZ_MEDIA_NAVIGATOR=
3827 MOZ_VPX_ERROR_CONCEALMENT=
3837 LIBJPEG_TURBO_ASFLAGS=
3838 LIBJPEG_TURBO_X86_ASM=
3839 LIBJPEG_TURBO_X64_ASM=
3840 LIBJPEG_TURBO_ARM_ASM=
3844 MOZ_PREF_EXTENSIONS=1
3845 MOZ_PROFILELOCKING=1
3851 MOZ_TOOLKIT_SEARCH=1
3853 MOZ_UNIVERSALCHARDET=1
3859 MOZ_DISABLE_CRYPTOLEGACY=
3862 NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device"
3863 if test -n "$MOZ_RTSP"; then
3864 NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp"
3868 MOZ_USE_NATIVE_POPUP_WINDOWS=
3869 MOZ_ANDROID_HISTORY=
3872 MOZ_LOCALE_SWITCHER=
3873 MOZ_ANDROID_SEARCH_ACTIVITY=
3874 MOZ_ANDROID_MLS_STUMBLER=
3878 MOZ_AUDIO_CHANNEL_MANAGER=
3880 MOZ_CONTENT_SANDBOX=
3881 JSGC_USE_EXACT_ROOTING=
3884 case "$target_os" in
3887 AC_DEFINE(NS_ENABLE_TSF)
3892 *-android*|*-linuxandroid*)
3893 if test "$CPU_ARCH" = "arm" ; then
3898 MOZ_THEME_FASTSTRIPE=1
3906 MOZ_ARG_WITH_STRING(external-source-dir,
3907 [ --with-external-source-dir=dir
3908 External directory containing additional build files.],
3909 [ EXTERNAL_SOURCE_DIR=$withval])
3910 AC_SUBST(EXTERNAL_SOURCE_DIR)
3912 MOZ_ARG_ENABLE_STRING(application,
3913 [ --enable-application=APP
3917 tools/update-packaging (AUS-related packaging tools)],
3918 [ MOZ_BUILD_APP=$enableval ] )
3920 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
3921 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
3922 XULRUNNER_STUB_NAME=$withval)
3924 if test -z "$XULRUNNER_STUB_NAME"; then
3925 case "$target_os" in
3927 XULRUNNER_STUB_NAME=xulrunner
3930 XULRUNNER_STUB_NAME=xulrunner-stub
3933 AC_SUBST(XULRUNNER_STUB_NAME)
3935 AC_MSG_CHECKING([for application to build])
3936 if test -z "$MOZ_BUILD_APP"; then
3937 AC_MSG_RESULT([browser])
3938 MOZ_BUILD_APP=browser
3940 # "mobile" no longer exists.
3941 if test "$MOZ_BUILD_APP" = "mobile" ; then
3942 AC_MSG_RESULT([none])
3943 AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
3945 # We have a valid application only if it has a build.mk file in its top
3947 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
3948 AC_MSG_RESULT([none])
3949 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
3951 AC_MSG_RESULT([$MOZ_BUILD_APP])
3955 # The app update channel is 'default' when not supplied. The value is used in
3956 # the application's confvars.sh so it must be set before confvars.sh is called.
3957 MOZ_ARG_ENABLE_STRING([update-channel],
3958 [ --enable-update-channel=CHANNEL
3959 Select application update channel (default=default)],
3960 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
3962 if test -z "$MOZ_UPDATE_CHANNEL"; then
3963 MOZ_UPDATE_CHANNEL=default
3965 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
3966 AC_SUBST(MOZ_UPDATE_CHANNEL)
3968 # Allow to specify a Mozilla API key file that contains the secret key to be
3969 # used for various Mozilla API requests.
3970 MOZ_ARG_WITH_STRING(mozilla-api-keyfile,
3971 [ --with-mozilla-api-keyfile=file Use the secret key contained in the given keyfile for Mozilla API requests],
3972 MOZ_MOZILLA_API_KEY=`cat $withval`)
3973 if test -z "$MOZ_MOZILLA_API_KEY"; then
3974 MOZ_MOZILLA_API_KEY=no-mozilla-api-key
3976 AC_SUBST(MOZ_MOZILLA_API_KEY)
3978 # Allow to specify a Google API key file that contains the secret key to be
3979 # used for various Google API requests.
3980 MOZ_ARG_WITH_STRING(google-api-keyfile,
3981 [ --with-google-api-keyfile=file Use the secret key contained in the given keyfile for Google API requests],
3982 MOZ_GOOGLE_API_KEY=`cat $withval`)
3983 if test -z "$MOZ_GOOGLE_API_KEY"; then
3984 MOZ_GOOGLE_API_KEY=no-google-api-key
3986 AC_SUBST(MOZ_GOOGLE_API_KEY)
3988 # Allow specifying a Bing API key file that contains the client ID and the
3989 # secret key to be used for the Bing Translation API requests.
3990 MOZ_ARG_WITH_STRING(bing-api-keyfile,
3991 [ --with-bing-api-keyfile=file Use the client id and secret key contained in the given keyfile for Bing API requests],
3992 [MOZ_BING_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
3993 MOZ_BING_API_KEY=`cat $withval | cut -f 2 -d " "`])
3994 if test -z "$MOZ_BING_API_CLIENTID"; then
3995 MOZ_BING_API_CLIENTID=no-bing-api-clientid
3996 MOZ_BING_API_KEY=no-bing-api-key
3998 AC_SUBST(MOZ_BING_API_CLIENTID)
3999 AC_SUBST(MOZ_BING_API_KEY)
4001 # Allow the application to influence configure with a confvars.sh script.
4002 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4003 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4004 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4005 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4010 # Allow influencing configure with a defines.sh script.
4011 . "${srcdir}/build/defines.sh"
4013 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
4015 if test "$BUILDING_RELEASE"; then
4016 # Override value in defines.sh, if any
4017 EARLY_BETA_OR_EARLIER=
4018 elif test "$EARLY_BETA_OR_EARLIER"; then
4019 AC_DEFINE(EARLY_BETA_OR_EARLIER)
4021 AC_SUBST(EARLY_BETA_OR_EARLIER)
4023 # Allow the application to provide a subconfigure script
4024 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4025 do_output_subdirs() {
4026 if test -n "$_subconfigure_subdirs"; then
4027 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4029 _subconfigure_subdir="$1"
4030 _subconfigure_config_args="$ac_configure_args"
4032 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4033 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4034 "${srcdir}/build/autoconf/altoptions.m4" \
4035 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4040 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4041 MOZ_ARG_WITH_STRING(app-name,
4042 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4043 WITH_APP_NAME=$withval,
4046 if test -n "$WITH_APP_NAME" ; then
4047 MOZ_APP_NAME="$WITH_APP_NAME"
4050 MOZ_ARG_WITH_STRING(app-basename,
4051 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4052 WITH_APP_BASENAME=$withval,
4055 if test -n "$WITH_APP_BASENAME" ; then
4056 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4059 # Now is a good time to test for logic errors, define mismatches, etc.
4060 case "$MOZ_BUILD_APP" in
4062 if test "$LIBXUL_SDK"; then
4063 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4068 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4069 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4071 case "$MOZ_BUILD_APP" in
4073 AC_DEFINE(MOZ_PHOENIX)
4077 AC_DEFINE(MOZ_XULRUNNER)
4084 AC_DEFINE(MOZ_MULET)
4088 AC_SUBST(MOZ_BUILD_APP)
4089 AC_SUBST(MOZ_PHOENIX)
4090 AC_SUBST(MOZ_XULRUNNER)
4093 AC_SUBST(MOZ_B2G_VERSION)
4095 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4097 dnl ========================================================
4098 dnl Check Android SDK version depending on mobile target.
4099 dnl ========================================================
4101 if test -z "$gonkdir" ; then
4102 # Minimum Android SDK API Level we require.
4103 case "$MOZ_BUILD_APP" in
4105 android_min_api_level=17
4107 *-android*|*-linuxandroid*)
4111 AC_MSG_ERROR([You must specify --target=arm-linux-androideabi (or some other valid android target) when building with --enable-application=mobile/android. See https://wiki.mozilla.org/Mobile/Fennec/Android#Setup_Fennec_mozconfig for more information about the necessary options])
4117 MOZ_ANDROID_SDK($android_min_api_level)
4120 dnl ========================================================
4122 dnl = Toolkit Options
4124 dnl ========================================================
4125 MOZ_ARG_HEADER(Toolkit Options)
4127 dnl ========================================================
4128 dnl = Select the default toolkit
4129 dnl ========================================================
4130 MOZ_ARG_ENABLE_STRING(default-toolkit,
4131 [ --enable-default-toolkit=TK
4132 Select default toolkit
4133 Platform specific defaults:
4134 Mac OS X - cairo-cocoa
4135 Win32 - cairo-windows
4139 [ _DEFAULT_TOOLKIT=$enableval ],
4140 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4142 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4143 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4144 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4145 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4146 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4147 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4148 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4149 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4150 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4152 dnl nglayout only supports building with one toolkit,
4153 dnl so ignore everything after the first comma (",").
4154 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4156 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4159 MOZ_ARG_WITHOUT_BOOL(x,
4160 [ --without-x Build without X11],
4163 dnl ========================================================
4164 dnl = Enable the toolkit as needed =
4165 dnl ========================================================
4169 case "$MOZ_WIDGET_TOOLKIT" in
4172 MOZ_WIDGET_TOOLKIT=windows
4175 MOZ_INSTRUMENT_EVENT_LOOP=1
4176 if test -n "$GNU_CC"; then
4182 MOZ_WIDGET_TOOLKIT=gtk3
4185 MOZ_ENABLE_XREMOTE=1
4187 MOZ_GL_DEFAULT_PROVIDER=GLX
4193 TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4194 TK_LIBS='$(MOZ_GTK3_LIBS)'
4196 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4198 MOZ_INSTRUMENT_EVENT_LOOP=1
4201 cairo-gtk2|cairo-gtk2-x11)
4202 MOZ_WIDGET_TOOLKIT=gtk2
4205 MOZ_ENABLE_XREMOTE=1
4207 MOZ_GL_DEFAULT_PROVIDER=GLX
4213 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4214 TK_LIBS='$(MOZ_GTK2_LIBS)'
4215 AC_DEFINE(MOZ_WIDGET_GTK2)
4217 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4219 MOZ_INSTRUMENT_EVENT_LOOP=1
4223 MOZ_WIDGET_TOOLKIT=qt
4225 if test -z "$WITHOUT_X11"; then
4226 MOZ_ENABLE_XREMOTE=1
4227 MOZ_GL_DEFAULT_PROVIDER=GLX
4235 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4236 TK_LIBS='$(MOZ_QT_LIBS)'
4237 AC_DEFINE(MOZ_WIDGET_QT)
4239 AC_DEFINE(QT_NO_KEYWORDS)
4243 MOZ_WIDGET_TOOLKIT=cocoa
4244 AC_DEFINE(MOZ_WIDGET_COCOA)
4245 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4246 TK_LIBS='-framework CoreLocation -framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4247 TK_CFLAGS="-DNO_X11"
4248 CFLAGS="$CFLAGS $TK_CFLAGS"
4249 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4250 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)'
4251 MOZ_USER_DIR="Mozilla"
4252 MOZ_FS_LAYOUT=bundle
4254 MOZ_INSTRUMENT_EVENT_LOOP=1
4258 MOZ_WIDGET_TOOLKIT=uikit
4259 AC_DEFINE(MOZ_WIDGET_UIKIT)
4260 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4261 TK_CFLAGS="-DNO_X11"
4262 TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4263 CFLAGS="$CFLAGS $TK_CFLAGS"
4264 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4265 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)'
4266 MOZ_USER_DIR="Mozilla"
4267 MOZ_FS_LAYOUT=bundle
4271 AC_DEFINE(MOZ_WIDGET_ANDROID)
4272 MOZ_WIDGET_TOOLKIT=android
4273 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4274 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4277 MOZ_INSTRUMENT_EVENT_LOOP=1
4281 XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)'
4282 AC_DEFINE(MOZ_WIDGET_GONK)
4283 AC_DEFINE(MOZ_TOUCH)
4284 MOZ_WIDGET_TOOLKIT=gonk
4285 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4286 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4290 MOZ_INSTRUMENT_EVENT_LOOP=1
4295 AC_SUBST(MOZ_PDF_PRINTING)
4296 if test "$MOZ_PDF_PRINTING"; then
4297 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4298 AC_DEFINE(MOZ_PDF_PRINTING)
4301 if test "$MOZ_ENABLE_XREMOTE"; then
4302 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4305 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4306 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4309 if test "$COMPILE_ENVIRONMENT"; then
4310 if test "$MOZ_ENABLE_GTK3"; then
4311 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4313 if test "$MOZ_ENABLE_GTK"; then
4314 if test "$MOZ_X11"; then
4315 GDK_PACKAGES=gdk-x11-2.0
4318 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4321 fi # COMPILE_ENVIRONMENT
4323 AC_SUBST(MOZ_FS_LAYOUT)
4325 dnl ========================================================
4326 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4327 dnl their usage and use them in spidermonkey.
4328 dnl ========================================================
4329 MOZ_ARG_WITH_BOOL(arm-kuser,
4330 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4332 if test -n "$USE_ARM_KUSER"; then
4333 AC_DEFINE(USE_ARM_KUSER)
4336 dnl ========================================================
4337 dnl = startup-notification support module
4338 dnl ========================================================
4340 if test "$MOZ_ENABLE_GTK"
4342 MOZ_ENABLE_STARTUP_NOTIFICATION=
4344 MOZ_ARG_ENABLE_BOOL(startup-notification,
4345 [ --enable-startup-notification
4346 Enable startup-notification support (default: disabled) ],
4347 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4348 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4349 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4351 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4352 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4353 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4354 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4356 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4358 MOZ_ENABLE_STARTUP_NOTIFICATION=
4362 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4363 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4366 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4368 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4369 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4370 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4372 dnl ========================================================
4373 dnl Disable printing
4374 dnl ========================================================
4375 MOZ_ARG_DISABLE_BOOL(printing,
4376 [ --disable-printing Disable printing support],
4380 if test "$NS_PRINTING"; then
4381 AC_DEFINE(NS_PRINTING)
4382 AC_DEFINE(NS_PRINT_PREVIEW)
4385 dnl ========================================================
4387 dnl ========================================================
4388 if test "$MOZ_ENABLE_QT"
4390 MOZ_ARG_WITH_STRING(qtdir,
4391 [ --with-qtdir=\$dir Specify Qt directory ],
4394 if test -z "$QTDIR"; then
4395 AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4397 HOST_QMAKE="$QTDIR/bin/qmake"
4399 QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4401 if test -z "$QTDIR"; then
4404 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4405 PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5Quick, ,
4407 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4409 QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4410 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4411 if test "$NS_PRINTING"; then
4412 PKG_CHECK_MODULES(MOZ_QT_WIDGETS, Qt5PrintSupport, ,
4414 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase widgets development package])
4416 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT_WIDGETS_LIBS"
4417 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT_WIDGETS_CFLAGS"
4421 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4425 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4426 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4428 MOZ_QT_CFLAGS="-DQT_SHARED"
4429 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4430 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4431 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4432 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4433 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4434 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4437 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4438 MOZ_QT_LIBS="$MOZ_QT_LIBS -L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml"
4439 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4440 if test "$NS_PRINTING"; then
4441 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4442 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4446 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4450 HOST_MOC="$QTDIR/bin/moc"
4451 HOST_RCC="$QTDIR/bin/rcc"
4453 if test -z "$HOST_MOC"; then
4454 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4456 if test -z "$HOST_RCC"; then
4457 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4463 MOZ_ENABLE_QMSYSTEM2=
4464 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4465 MOZ_ENABLE_QMSYSTEM2=1,
4466 MOZ_ENABLE_QMSYSTEM2=)
4468 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4469 MOZ_ENABLE_QMSYSTEM2=1
4470 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4471 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4472 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4475 MOZ_ENABLE_QTNETWORK=
4476 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4477 MOZ_ENABLE_QTNETWORK=1,
4478 MOZ_ENABLE_QTNETWORK=)
4480 if test "$MOZ_ENABLE_QTNETWORK"; then
4481 MOZ_ENABLE_QTNETWORK=1
4482 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4485 MOZ_ENABLE_QTMOBILITY=
4486 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4487 MOZ_ENABLE_QTMOBILITY=1,
4488 MOZ_ENABLE_QTMOBILITY=)
4489 if test "$MOZ_ENABLE_QTMOBILITY"; then
4490 MOZ_ENABLE_QTMOBILITY=1
4491 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4492 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4493 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4494 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4496 AC_CHECK_LIB(QtSensors, main, [
4497 MOZ_ENABLE_QTMOBILITY=1
4498 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4499 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4500 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4501 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4502 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4506 MOZ_ENABLE_QT5FEEDBACK=
4507 PKG_CHECK_MODULES(_QT5FEEDBACK, Qt0Feedback,
4508 MOZ_ENABLE_QT5FEEDBACK=1,
4509 MOZ_ENABLE_QT5FEEDBACK=)
4510 if test "$MOZ_ENABLE_QT5FEEDBACK"; then
4511 MOZ_ENABLE_QT5FEEDBACK=1
4512 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5FEEDBACK_CFLAGS"
4513 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5FEEDBACK_LIBS"
4514 AC_DEFINE(MOZ_ENABLE_QT5FEEDBACK)
4515 AC_SUBST(MOZ_ENABLE_QT5FEEDBACK)
4518 MOZ_ENABLE_QT5GEOPOSITION=
4519 PKG_CHECK_MODULES(_QT5GEOPOSITION, Qt5Positioning,
4520 MOZ_ENABLE_QT5GEOPOSITION=1,
4521 MOZ_ENABLE_QT5GEOPOSITION=)
4522 if test "$MOZ_ENABLE_QT5GEOPOSITION"; then
4523 MOZ_ENABLE_QT5GEOPOSITION=1
4524 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5GEOPOSITION_CFLAGS"
4525 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5GEOPOSITION_LIBS"
4526 AC_DEFINE(MOZ_ENABLE_QT5GEOPOSITION)
4527 AC_SUBST(MOZ_ENABLE_QT5GEOPOSITION)
4530 if test "$MOZ_ENABLE_CONTENTACTION"; then
4531 MOZ_ENABLE_CONTENTACTION=1
4532 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4535 MOZ_ENABLE_CONTENTACTION=
4536 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
4537 if test "$MOZ_ENABLE_CONTENTACTION"; then
4538 MOZ_ENABLE_CONTENTACTION=1
4539 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
4540 MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
4541 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4542 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
4546 AC_SUBST(GTK_CONFIG)
4550 AC_SUBST(MOZ_ENABLE_GTK2)
4551 AC_SUBST(MOZ_ENABLE_GTK3)
4552 AC_SUBST(MOZ_ENABLE_GTK)
4553 AC_SUBST(MOZ_ENABLE_QT)
4554 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4555 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4556 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4557 AC_SUBST(MOZ_ENABLE_XREMOTE)
4558 AC_SUBST(MOZ_GTK2_CFLAGS)
4559 AC_SUBST(MOZ_GTK2_LIBS)
4560 AC_SUBST(MOZ_GTK3_CFLAGS)
4561 AC_SUBST(MOZ_GTK3_LIBS)
4562 AC_SUBST(MOZ_WIDGET_GTK)
4563 AC_SUBST(MOZ_QT_CFLAGS)
4564 AC_SUBST(MOZ_QT_LIBS)
4571 dnl ========================================================
4573 dnl = Components & Features
4575 dnl ========================================================
4576 MOZ_ARG_HEADER(Components and Features)
4578 dnl ========================================================
4580 dnl ========================================================
4581 MOZ_ARG_ENABLE_STRING(ui-locale,
4582 [ --enable-ui-locale=ab-CD
4583 Select the user interface locale (default: en-US)],
4584 MOZ_UI_LOCALE=$enableval )
4585 AC_SUBST(MOZ_UI_LOCALE)
4587 dnl ========================================================
4588 dnl = Trademarked Branding
4589 dnl ========================================================
4590 MOZ_ARG_ENABLE_BOOL(official-branding,
4591 [ --enable-official-branding
4592 Enable Official mozilla.org Branding
4593 Do not distribute builds with
4594 --enable-official-branding unless you have
4595 permission to use trademarks per
4596 http://www.mozilla.org/foundation/trademarks/ .],
4598 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4599 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4601 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4602 MOZ_OFFICIAL_BRANDING=1
4604 ], MOZ_OFFICIAL_BRANDING=)
4606 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4607 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4608 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4611 MOZ_ARG_WITH_STRING(branding,
4612 [ --with-branding=dir Use branding from the specified directory.],
4613 MOZ_BRANDING_DIRECTORY=$withval)
4615 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4616 if test -z "$REAL_BRANDING_DIRECTORY"; then
4617 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4620 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4621 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4624 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4626 dnl ========================================================
4627 dnl = Distribution ID
4628 dnl ========================================================
4629 MOZ_ARG_WITH_STRING(distribution-id,
4630 [ --with-distribution-id=ID
4631 Set distribution-specific id (default=org.mozilla)],
4632 [ val=`echo $withval`
4633 MOZ_DISTRIBUTION_ID="$val"])
4635 if test -z "$MOZ_DISTRIBUTION_ID"; then
4636 MOZ_DISTRIBUTION_ID="org.mozilla"
4639 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4640 AC_SUBST(MOZ_DISTRIBUTION_ID)
4643 dnl ========================================================
4645 dnl ========================================================
4646 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4648 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4650 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4651 AC_SUBST(MOZ_PANGO_CFLAGS)
4652 AC_SUBST(MOZ_PANGO_LIBS)
4655 dnl ========================================================
4656 dnl = GnomeVFS, GIO and GConf support module
4657 dnl ========================================================
4661 dnl build the GIO extension by default only when the
4662 dnl GTK2 toolkit is in use.
4663 if test "$MOZ_ENABLE_GTK"
4669 dnl ========================================================
4670 dnl = GnomeVFS support module
4671 dnl ========================================================
4672 MOZ_ARG_ENABLE_BOOL(gnomevfs,
4673 [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
4674 MOZ_ENABLE_GNOMEVFS=force,
4675 MOZ_ENABLE_GNOMEVFS=)
4677 if test "$MOZ_ENABLE_GNOMEVFS"
4679 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4680 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4681 MOZ_ENABLE_GNOMEVFS=1
4682 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4684 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4686 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4688 MOZ_ENABLE_GNOMEVFS=
4692 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4693 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4694 AC_SUBST(MOZ_GNOMEVFS_LIBS)
4696 dnl ========================================================
4697 dnl = GIO support module
4698 dnl ========================================================
4699 MOZ_ARG_DISABLE_BOOL(gio,
4700 [ --disable-gio Disable GIO support],
4702 MOZ_ENABLE_GIO=force)
4704 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
4706 if test "$MOZ_ENABLE_GTK2"
4708 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4709 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4711 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4712 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4714 AC_DEFINE(MOZ_ENABLE_GIO)
4716 if test "$MOZ_ENABLE_GIO" = "force"
4718 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4724 AC_SUBST(MOZ_ENABLE_GIO)
4725 AC_SUBST(MOZ_GIO_CFLAGS)
4726 AC_SUBST(MOZ_GIO_LIBS)
4728 dnl ========================================================
4729 dnl = GConf support module
4730 dnl ========================================================
4731 MOZ_ARG_DISABLE_BOOL(gconf,
4732 [ --disable-gconf Disable Gconf support ],
4734 MOZ_ENABLE_GCONF=force)
4736 if test "$MOZ_ENABLE_GCONF"
4738 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4739 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4742 if test "$MOZ_ENABLE_GCONF" = "force"
4744 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4750 if test "$MOZ_ENABLE_GCONF"; then
4751 AC_DEFINE(MOZ_ENABLE_GCONF)
4754 AC_SUBST(MOZ_ENABLE_GCONF)
4755 AC_SUBST(MOZ_GCONF_CFLAGS)
4756 AC_SUBST(MOZ_GCONF_LIBS)
4759 dnl ========================================================
4760 dnl = libproxy support
4761 dnl ========================================================
4763 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4765 MOZ_ENABLE_LIBPROXY=
4767 MOZ_ARG_ENABLE_BOOL(libproxy,
4768 [ --enable-libproxy Enable libproxy support ],
4769 MOZ_ENABLE_LIBPROXY=1,
4770 MOZ_ENABLE_LIBPROXY=)
4772 if test "$MOZ_ENABLE_LIBPROXY"
4774 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4775 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4778 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4779 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
4780 AC_SUBST(MOZ_LIBPROXY_LIBS)
4782 dnl ========================================================
4783 dnl = GNOME component (mozgnome)
4784 dnl ========================================================
4786 if test "$MOZ_ENABLE_GTK"
4788 MOZ_ENABLE_GNOME_COMPONENT=1
4790 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4792 dnl ========================================================
4793 dnl = libgnomeui support module
4794 dnl ========================================================
4796 if test "$MOZ_ENABLE_GTK"
4798 MOZ_ARG_ENABLE_BOOL(gnomeui,
4799 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
4800 MOZ_ENABLE_GNOMEUI=force,
4801 MOZ_ENABLE_GNOMEUI=)
4803 if test "$MOZ_ENABLE_GNOMEUI"
4805 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4807 MOZ_ENABLE_GNOMEUI=1
4809 if test "$MOZ_ENABLE_GNOMEUI" = "force"
4811 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4817 if test "$MOZ_ENABLE_GNOMEUI"; then
4818 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4822 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4823 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
4825 dnl ========================================================
4827 dnl ========================================================
4829 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4833 MOZ_ARG_DISABLE_BOOL(dbus,
4834 [ --disable-dbus Disable dbus support ],
4838 if test "$MOZ_ENABLE_DBUS"
4840 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
4841 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
4842 AC_DEFINE(MOZ_ENABLE_DBUS)
4845 AC_SUBST(MOZ_ENABLE_DBUS)
4846 AC_SUBST(MOZ_DBUS_CFLAGS)
4847 AC_SUBST(MOZ_DBUS_LIBS)
4848 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
4849 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
4851 dnl ========================================================
4852 dnl = Enable Android History instead of Places
4853 dnl ========================================================
4854 if test -n "$MOZ_ANDROID_HISTORY"; then
4855 if test -z "$MOZ_PLACES"; then
4856 AC_DEFINE(MOZ_ANDROID_HISTORY)
4858 AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
4862 dnl ========================================================
4863 dnl = Build with the Android compositor
4864 dnl ========================================================
4865 if test -n "$MOZ_ANDROID_OMTC"; then
4866 dnl Do this if defined in confvars.sh
4867 AC_DEFINE(MOZ_ANDROID_OMTC)
4870 dnl ========================================================
4871 dnl = Disable WebSMS backend
4872 dnl ========================================================
4873 MOZ_ARG_DISABLE_BOOL(websms-backend,
4874 [ --disable-websms-backend
4875 Disable WebSMS backend],
4876 MOZ_WEBSMS_BACKEND=,
4877 MOZ_WEBSMS_BACKEND=1)
4879 if test -n "$MOZ_WEBSMS_BACKEND"; then
4880 AC_DEFINE(MOZ_WEBSMS_BACKEND)
4883 dnl ========================================================
4884 dnl = Enable runtime locale switching on Android
4885 dnl ========================================================
4886 if test -n "$MOZ_LOCALE_SWITCHER"; then
4887 AC_DEFINE(MOZ_LOCALE_SWITCHER)
4890 dnl ========================================================
4891 dnl = Enable NFC permission on Android
4892 dnl ========================================================
4893 if test -n "$MOZ_ANDROID_BEAM"; then
4894 AC_DEFINE(MOZ_ANDROID_BEAM)
4897 dnl ========================================================
4898 dnl = Include Search Activity on Android
4899 dnl ========================================================
4900 if test -n "$MOZ_ANDROID_SEARCH_ACTIVITY"; then
4901 AC_DEFINE(MOZ_ANDROID_SEARCH_ACTIVITY)
4904 dnl ========================================================
4905 dnl = Include Mozilla Location Service Stumbler on Android
4906 dnl ========================================================
4907 if test -n "$MOZ_ANDROID_MLS_STUMBLER"; then
4908 AC_DEFINE(MOZ_ANDROID_MLS_STUMBLER)
4911 dnl ========================================================
4912 dnl = Enable IPDL's "expensive" unit tests
4913 dnl ========================================================
4916 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
4917 [ --enable-ipdl-tests Enable expensive IPDL tests],
4921 if test -n "$MOZ_IPDL_TESTS"; then
4922 AC_DEFINE(MOZ_IPDL_TESTS)
4925 AC_SUBST(MOZ_IPDL_TESTS)
4927 dnl ========================================================
4928 dnl = Disable building dbm
4929 dnl ========================================================
4930 MOZ_ARG_DISABLE_BOOL(dbm,
4931 [ --disable-dbm Disable building dbm],
4935 dnl ========================================================
4936 dnl accessibility support on by default on all platforms
4937 dnl ========================================================
4938 MOZ_ARG_DISABLE_BOOL(accessibility,
4939 [ --disable-accessibility Disable accessibility support],
4942 if test "$ACCESSIBILITY"; then
4945 if test -z "$MIDL"; then
4946 if test "$GCC" != "yes"; then
4947 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
4949 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.])
4953 AC_DEFINE(ACCESSIBILITY)
4956 dnl ========================================================
4957 dnl Accessibility is required for the linuxgl widget
4959 dnl ========================================================
4960 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
4961 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
4964 dnl Turn off webrtc for OS's we don't handle yet, but allow
4965 dnl --enable-webrtc to override. Can disable for everything in
4966 dnl the master list above.
4967 if test -n "$MOZ_WEBRTC"; then
4969 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
4973 dnl default to disabled for all others
4979 AC_TRY_COMPILE([#include <linux/ethtool.h>],
4980 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
4981 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
4983 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
4985 # target_arch is from {ia32|x64|arm|ppc}
4987 x86_64 | arm | x86 | ppc* | ia64)
4991 # unsupported arch for webrtc
4997 dnl ========================================================
4998 dnl = Disable WebRTC code
4999 dnl ========================================================
5000 MOZ_ARG_DISABLE_BOOL(webrtc,
5001 [ --disable-webrtc Disable support for WebRTC],
5005 if test -n "$MOZ_WEBRTC"; then
5006 AC_DEFINE(MOZ_WEBRTC)
5007 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
5008 dnl opt/production builds (via MOZ_CRASH())
5009 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
5012 MOZ_VPX_ERROR_CONCEALMENT=1
5014 dnl enable once Signaling lands
5015 MOZ_WEBRTC_SIGNALING=1
5016 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5017 dnl enable once PeerConnection lands
5018 MOZ_PEERCONNECTION=1
5019 AC_DEFINE(MOZ_PEERCONNECTION)
5024 if test -n "$MOZ_X11"; then
5025 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
5031 AC_SUBST(MOZ_WEBRTC)
5032 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5033 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5034 AC_SUBST(MOZ_PEERCONNECTION)
5035 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5038 AC_SUBST(MOZ_WEBRTC_X11_LIBS)
5040 dnl Use integers over floats for audio on B2G and Android, because audio
5041 dnl backends for those platforms don't support floats.
5042 if test "$OS_TARGET" = "Android"; then
5043 MOZ_SAMPLE_TYPE_S16=1
5044 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5045 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5047 MOZ_SAMPLE_TYPE_FLOAT32=1
5048 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5049 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5052 dnl ========================================================
5053 dnl = Disable Speech API code
5054 dnl ========================================================
5055 MOZ_ARG_DISABLE_BOOL(webspeech,
5056 [ --disable-webspeech Disable support for HTML Speech API],
5060 if test -n "$MOZ_WEBSPEECH"; then
5061 AC_DEFINE(MOZ_WEBSPEECH)
5064 AC_SUBST(MOZ_WEBSPEECH)
5066 dnl ========================================================
5067 dnl = Enable Raw Codecs
5068 dnl ========================================================
5069 MOZ_ARG_ENABLE_BOOL(raw,
5070 [ --enable-raw Enable support for RAW media],
5074 if test -n "$MOZ_RAW"; then
5080 dnl Checks for __attribute__(aligned()) directive need by libogg
5081 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5082 [ac_cv_c_attribute_aligned],
5083 [ac_cv_c_attribute_aligned=0
5084 CFLAGS_save="${CFLAGS}"
5085 CFLAGS="${CFLAGS} -Werror"
5086 for ac_cv_c_attr_align_try in 64 32 16 8; do
5087 echo "trying $ac_cv_c_attr_align_try"
5089 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5090 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5091 if test "$ac_cv_c_attribute_aligned" != 0; then
5095 CFLAGS="${CFLAGS_save}"])
5096 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5097 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5098 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5101 dnl ========================================================
5102 dnl = Disable Opus audio codec support
5103 dnl ========================================================
5104 MOZ_ARG_DISABLE_BOOL(opus,
5105 [ --disable-opus Disable support for Opus audio],
5109 dnl ========================================================
5110 dnl = Disable VP8 decoder support
5111 dnl ========================================================
5112 MOZ_ARG_DISABLE_BOOL(webm,
5113 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5117 if test -n "$MOZ_WEBM"; then
5122 dnl ========================================================
5123 dnl = DirectShow support
5124 dnl ========================================================
5125 if test "$OS_ARCH" = "WINNT"; then
5126 dnl Enable DirectShow support by default.
5130 MOZ_ARG_DISABLE_BOOL(directshow,
5131 [ --disable-directshow Disable support for DirectShow],
5135 if test -n "$MOZ_DIRECTSHOW"; then
5136 AC_DEFINE(MOZ_DIRECTSHOW)
5139 dnl ========================================================
5140 dnl = Windows Media Foundation support
5141 dnl ========================================================
5142 if test "$OS_ARCH" = "WINNT"; then
5143 dnl Enable Windows Media Foundation support by default.
5144 dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5145 dnl guaranteed to have a recent-enough SDK to build WMF.
5149 MOZ_ARG_DISABLE_BOOL(wmf,
5150 [ --disable-wmf Disable support for Windows Media Foundation],
5154 if test -n "$MOZ_WMF"; then
5158 dnl ========================================================
5159 dnl FFmpeg H264/AAC Decoding Support
5160 dnl ========================================================
5161 case "$OS_TARGET" in
5162 WINNT|Darwin|Android)
5169 MOZ_ARG_DISABLE_BOOL(ffmpeg,
5170 [ --disable-ffmpeg Disable FFmpeg for fragmented H264/AAC decoding],
5175 if test -n "$MOZ_FFMPEG"; then
5176 AC_DEFINE(MOZ_FFMPEG)
5179 dnl ========================================================
5180 dnl = Built-in fragmented MP4 support.
5181 dnl ========================================================
5182 if test -n "$MOZ_WMF" -o -n "$MOZ_FFMPEG"; then
5183 dnl Enable fragmented MP4 parser on Windows by default.
5184 dnl We will also need to enable it on other platforms as we implement
5185 dnl platform decoder support there too.
5189 MOZ_ARG_DISABLE_BOOL(fmp4,
5190 [ --disable-fmp4 Disable support for in built Fragmented MP4 parsing],
5194 if test -n "$MOZ_FMP4"; then
5198 dnl ========================================================
5200 dnl ========================================================
5202 MOZ_ARG_DISABLE_BOOL(eme,
5203 [ --disable-eme Disable support for Encrypted Media Extensions],
5207 if test -n "$MOZ_EME"; then
5211 dnl ========================================================
5212 dnl = Enable media plugin support
5213 dnl ========================================================
5214 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5215 dnl Enable support on android by default
5219 MOZ_ARG_ENABLE_BOOL(android-omx,
5220 [ --enable-android-omx Enable support for Android OMX media backend],
5224 if test -n "$MOZ_ANDROID_OMX"; then
5225 AC_DEFINE(MOZ_ANDROID_OMX)
5228 dnl ========================================================
5229 dnl = Disable platform MP3 decoder on OSX
5230 dnl ========================================================
5231 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5235 MOZ_ARG_DISABLE_BOOL(apple-media,
5236 [ --disable-apple-media Disable support for Apple AudioToolbox/VideoToolbox],
5240 if test -n "$MOZ_APPLEMEDIA"; then
5241 AC_DEFINE(MOZ_APPLEMEDIA)
5244 dnl ========================================================
5245 dnl = Enable getUserMedia support
5246 dnl ========================================================
5247 MOZ_ARG_ENABLE_BOOL(media-navigator,
5248 [ --enable-media-navigator Enable support for getUserMedia],
5249 MOZ_MEDIA_NAVIGATOR=1,
5250 MOZ_MEDIA_NAVIGATOR=)
5252 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5253 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5256 dnl ========================================================
5257 dnl = Enable building OMX media plugin (B2G or Android)
5258 dnl ========================================================
5259 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5260 dnl Enable support on android by default
5264 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5265 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5269 if test -n "$MOZ_OMX_PLUGIN"; then
5270 if test "$OS_TARGET" = "Android"; then
5271 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5272 AC_DEFINE(MOZ_OMX_PLUGIN)
5274 dnl fail if we're not building on Gonk or Android
5275 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5279 dnl system libvpx Support
5280 dnl ========================================================
5281 MOZ_ARG_WITH_BOOL(system-libvpx,
5282 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5283 MOZ_NATIVE_LIBVPX=1)
5288 if test -n "$MOZ_VPX"; then
5290 if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
5291 AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
5294 _SAVE_CFLAGS=$CFLAGS
5296 if test -n "$MOZ_NATIVE_LIBVPX"; then
5297 dnl ============================
5298 dnl === libvpx Version check ===
5299 dnl ============================
5300 dnl Check to see if we have a system libvpx package.
5301 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.3.0)
5303 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
5304 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
5306 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5307 [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.])])
5309 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5310 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5312 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
5313 [AC_CHECK_FUNC(vpx_mem_set_functions)])
5314 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
5315 "$ac_cv_func_vpx_mem_set_functions" = no; then
5316 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
5319 CFLAGS=$_SAVE_CFLAGS
5323 AC_SUBST(MOZ_NATIVE_LIBVPX)
5324 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5325 AC_SUBST(MOZ_LIBVPX_LIBS)
5327 if test "$MOZ_WEBM"; then
5328 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5335 if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then
5337 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5338 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5339 dnl We currently require gcc on all arm platforms.
5342 VPX_NEED_OBJ_INT_EXTRACT=
5344 dnl See if we have assembly on this platform.
5345 case "$OS_ARCH:$CPU_ARCH" in
5347 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5351 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5355 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5359 dnl Check for yasm 1.1 or greater.
5360 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5361 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.])
5362 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5363 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.])
5365 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5367 dnl The encoder needs obj_int_extract to get asm offsets.
5371 if test -n "$GNU_AS" ; then
5373 dnl These flags are a lie; they're just used to enable the requisite
5374 dnl opcodes; actual arch detection is done at runtime.
5375 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5376 VPX_DASH_C_FLAG="-c"
5377 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5378 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5383 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5384 VPX_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC"
5389 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5390 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5396 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5397 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.])
5400 if test -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5401 dnl We prefer to get asm offsets using inline assembler, which the above
5402 dnl compilers can do. When we're not using one of those, we have to fall
5403 dnl back to obj_int_extract, which reads them from a compiled object
5404 dnl file. Unfortunately, that only works if we're compiling on a system
5405 dnl with the header files for the appropriate object file format.
5406 VPX_NEED_OBJ_INT_EXTRACT=1
5409 if test -n "$VPX_X86_ASM"; then
5410 AC_DEFINE(VPX_X86_ASM)
5411 elif test -n "$VPX_ARM_ASM"; then
5412 AC_DEFINE(VPX_ARM_ASM)
5414 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5418 dnl ========================================================
5419 dnl = Disable Wave decoder support
5420 dnl ========================================================
5421 MOZ_ARG_DISABLE_BOOL(wave,
5422 [ --disable-wave Disable Wave decoder support],
5426 if test -n "$MOZ_WAVE"; then
5430 dnl ========================================================
5431 dnl = Handle dependent MEDIA defines
5432 dnl ========================================================
5434 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5435 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/])
5438 if test -n "$MOZ_WEBRTC" -a -z "$MOZ_OPUS"; then
5439 AC_MSG_ERROR([MOZ_WEBRTC requires MOZ_OPUS which is disabled.])
5442 if test -n "$MOZ_VORBIS"; then
5443 AC_DEFINE(MOZ_VORBIS)
5446 if test -n "$MOZ_TREMOR"; then
5447 AC_DEFINE(MOZ_TREMOR)
5450 if test -n "$MOZ_OPUS"; then
5454 if test -n "$MOZ_WEBM_ENCODER"; then
5455 AC_DEFINE(MOZ_WEBM_ENCODER)
5457 AC_SUBST(MOZ_WEBM_ENCODER)
5459 dnl ==================================
5460 dnl = Check alsa availability on Linux
5461 dnl ==================================
5463 dnl If using Linux, ensure that the alsa library is available
5464 if test "$OS_TARGET" = "Linux"; then
5468 MOZ_ARG_ENABLE_BOOL(alsa,
5469 [ --enable-alsa Enable Alsa support (default on Linux)],
5473 if test -n "$MOZ_ALSA"; then
5474 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5475 [echo "$MOZ_ALSA_PKG_ERRORS"
5476 AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux. Disable with --disable-ogg --disable-wave --disable-webm. (On Ubuntu, you might try installing the package libasound2-dev.)])])
5480 AC_SUBST(MOZ_ALSA_CFLAGS)
5481 AC_SUBST(MOZ_ALSA_LIBS)
5483 dnl ========================================================
5484 dnl = Disable PulseAudio
5485 dnl ========================================================
5487 dnl If using Linux, ensure that the PA library is available
5488 case "$OS_TARGET" in
5489 WINNT|Darwin|Android|OpenBSD)
5492 if test -z "$MOZ_B2G"; then
5498 MOZ_ARG_DISABLE_BOOL(pulseaudio,
5499 [ --disable-pulseaudio Disable PulseAudio support],
5503 if test -n "$MOZ_PULSEAUDIO"; then
5504 if test -z "$gonkdir"; then
5505 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5506 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5507 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
5509 MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
5513 AC_SUBST(MOZ_PULSEAUDIO)
5514 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5516 dnl ========================================================
5517 dnl = Enable GStreamer
5518 dnl ========================================================
5519 case "$OS_TARGET" in
5520 WINNT|Darwin|Android)
5524 GST_API_VERSION=0.10
5528 MOZ_ARG_ENABLE_STRING(gstreamer,
5529 [ --enable-gstreamer[=0.10] Enable GStreamer support],
5531 # API version, eg 0.10, 1.0 etc
5532 if test -z "$enableval" -o "$enableval" = "yes"; then
5533 GST_API_VERSION=0.10
5534 elif test "$enableval" = "no"; then
5537 GST_API_VERSION=$enableval
5541 if test -n "$MOZ_GSTREAMER"; then
5542 # core/base release number
5543 if test "$GST_API_VERSION" = "1.0"; then
5549 PKG_CHECK_MODULES(GSTREAMER,
5550 gstreamer-$GST_API_VERSION >= $GST_VERSION
5551 gstreamer-app-$GST_API_VERSION
5552 gstreamer-plugins-base-$GST_API_VERSION,
5553 [_HAVE_GSTREAMER=1],
5555 if test -z "$_HAVE_GSTREAMER"; then
5556 AC_MSG_ERROR([gstreamer and gstreamer-plugins-base development packages are needed to build gstreamer backend. Install them or disable gstreamer support with --disable-gstreamer])
5559 _SAVE_LDFLAGS=$LDFLAGS
5560 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5561 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5562 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5563 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5565 AC_MSG_ERROR([gstreamer-plugins-base found, but no libgstvideo. Something has gone terribly wrong. Try reinstalling gstreamer-plugins-base; failing that, disable the gstreamer backend with --disable-gstreamer.])
5567 LDFLAGS=$_SAVE_LDFLAGS
5569 AC_SUBST(GSTREAMER_CFLAGS)
5570 AC_SUBST(GSTREAMER_LIBS)
5573 AC_SUBST(MOZ_GSTREAMER)
5574 AC_SUBST(GST_API_VERSION)
5576 if test -n "$MOZ_GSTREAMER"; then
5577 AC_DEFINE(MOZ_GSTREAMER)
5578 AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION")
5582 dnl ========================================================
5583 dnl Permissions System
5584 dnl ========================================================
5585 MOZ_ARG_DISABLE_BOOL(permissions,
5586 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5591 dnl ========================================================
5592 dnl Child permissions, currently only used for b2g
5593 dnl ========================================================
5594 if test -n "$MOZ_B2G"; then
5595 if test -n "$MOZ_PERMISSIONS"; then
5596 MOZ_CHILD_PERMISSIONS=1
5598 AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
5601 AC_SUBST(MOZ_CHILD_PERMISSIONS)
5603 dnl ========================================================
5605 dnl ========================================================
5606 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5607 [ --disable-negotiateauth Disable GSS-API negotiation ],
5608 MOZ_AUTH_EXTENSION=,
5609 MOZ_AUTH_EXTENSION=1 )
5611 dnl ========================================================
5612 dnl Pref extensions (autoconfig)
5613 dnl ========================================================
5614 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5615 [ --disable-pref-extensions
5616 Disable pref extensions such as autoconfig],
5617 MOZ_PREF_EXTENSIONS=,
5618 MOZ_PREF_EXTENSIONS=1 )
5620 dnl ========================================================
5621 dnl Searching of system directories for extensions.
5622 dnl Note: this switch is meant to be used for test builds
5623 dnl whose behavior should not depend on what happens to be
5624 dnl installed on the local machine.
5625 dnl ========================================================
5626 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5627 [ --disable-system-extension-dirs
5628 Disable searching system- and account-global
5629 directories for extensions of any kind; use
5630 only profile-specific extension directories],
5631 ENABLE_SYSTEM_EXTENSION_DIRS=,
5632 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5633 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5634 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5637 dnl ========================================================
5638 dnl = Universalchardet
5639 dnl ========================================================
5640 MOZ_ARG_DISABLE_BOOL(universalchardet,
5641 [ --disable-universalchardet
5642 Disable universal encoding detection],
5643 MOZ_UNIVERSALCHARDET=,
5644 MOZ_UNIVERSALCHARDET=1 )
5646 if test -n "${JAVA_BIN_PATH}"; then
5647 dnl Look for javac and jar in the specified path.
5648 JAVA_PATH="$JAVA_BIN_PATH"
5650 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5651 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5654 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5655 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5656 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5657 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5658 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5659 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5661 if test -n "${JAVA_BIN_PATH}" -o \
5662 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5663 if test -z "$JAVA" -o "$JAVA" = ":"; then
5664 AC_MSG_ERROR([The program java was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5666 if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5667 AC_MSG_ERROR([The program javac was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5669 if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5670 AC_MSG_ERROR([The program javah was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5672 if test -z "$JAR" -o "$JAR" = ":"; then
5673 AC_MSG_ERROR([The program jar was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5675 if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5676 AC_MSG_ERROR([The program jarsigner was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5678 if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5679 AC_MSG_ERROR([The program keytool was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5683 dnl ========================================================
5684 dnl = ANGLE OpenGL->D3D translator for WebGL
5685 dnl = * only applies to win32
5686 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5687 dnl ========================================================
5691 MOZ_HAS_WINSDK_WITH_D3D=
5692 MOZ_D3DCOMPILER_VISTA_DLL=
5693 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5694 MOZ_DIRECTX_SDK_PATH=
5695 MOZ_D3DCOMPILER_XP_DLL=
5696 MOZ_D3DCOMPILER_XP_CAB=
5698 case "$target_os" in
5700 MOZ_ANGLE_RENDERER=1
5704 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5705 case "${target_cpu}" in
5707 MOZ_D3D_CPU_SUFFIX=x86
5710 MOZ_D3D_CPU_SUFFIX=x64
5714 MOZ_ARG_DISABLE_BOOL(webgl,
5715 [ --disable-webgl Disable building of the WebGL implementation],
5716 MOZ_WEBGL_DISABLED=1,
5717 MOZ_WEBGL_DISABLED=)
5719 MOZ_ARG_ENABLE_BOOL(require-all-d3dc-versions,
5720 [ --enable-require-all-d3dc-versions Require all versions of the D3D compiler needed for supported Windows systems.],
5721 MOZ_REQUIRE_ALL_D3DCS=1,
5722 MOZ_REQUIRE_ALL_D3DCS=)
5724 if test -n "$MOZ_WEBGL_DISABLED"; then
5729 if test -n "$MOZ_WEBGL"; then
5730 AC_DEFINE(MOZ_WEBGL)
5733 if test -n "$MOZ_WEBGL_CONFORMANT"; then
5734 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
5737 dnl ========================================================
5738 dnl D3D compiler DLL
5739 dnl ========================================================
5740 MOZ_FOUND_D3D_COMPILERS=
5742 if test -n "$MOZ_ANGLE_RENDERER"; then
5743 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
5744 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
5747 ######################################
5748 # Find _46+ for use by Vista+.
5750 # Find a D3D compiler DLL in a Windows SDK.
5751 MOZ_D3DCOMPILER_VISTA_DLL=
5752 case "$MOZ_WINSDK_MAXVER" in
5754 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
5755 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
5758 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_46.dll
5759 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.0.])
5763 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5764 # We have a name, now track down the path.
5765 if test -n "$WINDOWSSDKDIR"; then
5766 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
5767 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5768 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5769 MOZ_HAS_WINSDK_WITH_D3D=1
5771 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5772 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
5773 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5776 AC_MSG_RESULT([Windows SDK not found.])
5780 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5781 MOZ_D3DCOMPILER_VISTA_DLL=
5784 # On mingw, check if headers are provided by toolchain.
5785 if test -n "$GNU_CC"; then
5786 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
5789 ######################################
5790 # Find _43 for use by XP.
5792 # Get the SDK path from the registry.
5793 # First try to get the June 2010 SDK
5794 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5795 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5796 # Otherwise just take whatever comes first
5797 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5799 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'`
5801 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5802 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/dxguid.lib ; then
5803 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5805 AC_MSG_RESULT([DirectX SDK not found.])
5806 MOZ_DIRECTX_SDK_PATH=
5809 # Check that our DirectX SDK is acceptable.
5810 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5811 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5812 AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
5813 MOZ_DIRECTX_SDK_PATH=
5817 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5818 # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
5819 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5820 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'`
5822 if test -n "$MOZ_D3DX9_VERSION" ; then
5823 MOZ_D3DCOMPILER_XP_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_D3D_CPU_SUFFIX}.cab | head -n1`
5825 if test -n "$MOZ_D3DCOMPILER_XP_CAB"; then
5826 MOZ_D3DCOMPILER_XP_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5828 AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
5829 AC_MSG_ERROR([DirectX SDK at "$MOZ_DIRECTX_SDK_PATH" appears broken.])
5830 MOZ_DIRECTX_SDK_PATH=
5833 AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
5834 MOZ_DIRECTX_SDK_PATH=
5837 AC_MSG_RESULT([Couldn't find an acceptable DirectX SDK for ANGLE, needed for d3dcompiler_43.])
5838 AC_MSG_RESULT([ Either ignore, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5841 ######################################
5842 # Check that we found what we needed.
5843 MOZ_FOUND_A_D3D_COMPILER=
5844 MOZ_FOUND_BOTH_D3D_COMPILERS=1
5846 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5847 MOZ_FOUND_A_D3D_COMPILER=1
5848 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
5850 MOZ_FOUND_BOTH_D3D_COMPILERS=
5853 if test -n "$MOZ_D3DCOMPILER_XP_DLL"; then
5854 MOZ_FOUND_A_D3D_COMPILER=1
5855 AC_MSG_RESULT([Found d3dcompiler DLL for XP: $MOZ_D3DCOMPILER_XP_DLL])
5857 MOZ_FOUND_BOTH_D3D_COMPILERS=
5860 if test -z "$CROSS_COMPILE"; then
5861 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
5862 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
5863 AC_MSG_ERROR([ Either install Windows SDK 8.0+, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5866 if test -n "$MOZ_REQUIRE_ALL_D3DCS" -a -z "$MOZ_FOUND_BOTH_D3D_COMPILERS"; then
5867 AC_MSG_ERROR([Both D3D compilers _43 and _46+ are required by --enable-require-d3d-compilers.])
5868 AC_MSG_ERROR([ Install Windows SDK 8.0+, as well as DirectX SDK (June 2010 version or newer), or reconfigure without this flag.])
5874 dnl ========================================================
5876 dnl ========================================================
5878 MOZ_GAMEPAD_BACKEND=stub
5880 # Gamepad DOM is built on supported platforms by default.
5881 case "$OS_TARGET" in
5886 if test "$MOZ_WIDGET_TOOLKIT" != "gonk"; then
5894 MOZ_ARG_DISABLE_BOOL(gamepad,
5895 [ --disable-gamepad Disable gamepad support],
5899 if test "$MOZ_GAMEPAD"; then
5900 case "$OS_TARGET" in
5902 MOZ_GAMEPAD_BACKEND=cocoa
5905 case "$MOZ_WINSDK_MAXVER" in
5906 # We support building with the Windows 7 SDK otherwise, but
5907 # Gamepad support requires the Windows 8 SDK for some HID headers.
5909 AC_MSG_ERROR([The Windows 8 SDK or newer is required to build Gamepad support. Please install a newer Windows SDK or reconfigure with --disable-gamepad to disable gamepad support.])
5914 MOZ_GAMEPAD_BACKEND=windows
5917 MOZ_CHECK_HEADER([linux/joystick.h])
5918 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5919 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.])
5921 MOZ_GAMEPAD_BACKEND=linux
5924 MOZ_GAMEPAD_BACKEND=android
5930 AC_DEFINE(MOZ_GAMEPAD)
5932 AC_SUBST(MOZ_GAMEPAD)
5933 AC_SUBST(MOZ_GAMEPAD_BACKEND)
5935 dnl ========================================================
5936 dnl = Breakpad crash reporting (on by default on supported platforms)
5937 dnl ========================================================
5940 i?86-*-mingw*|x86_64-*-mingw*)
5943 i?86-apple-darwin*|x86_64-apple-darwin*)
5946 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5947 if test "$MOZ_ENABLE_GTK"; then
5951 *-android*|*-linuxandroid*)
5959 MOZ_ARG_DISABLE_BOOL(crashreporter,
5960 [ --disable-crashreporter Disable breakpad crash reporting],
5961 [MOZ_CRASHREPORTER=],
5962 [MOZ_CRASHREPORTER=F # Force enable breakpad])
5964 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
5965 if test "$MOZ_CRASHREPORTER" = F; then
5966 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
5971 if test -n "$MOZ_CRASHREPORTER"; then
5972 AC_DEFINE(MOZ_CRASHREPORTER)
5974 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5975 test -z "$SKIP_LIBRARY_CHECKS"; then
5976 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5977 AC_SUBST(MOZ_GTHREAD_CFLAGS)
5978 AC_SUBST(MOZ_GTHREAD_LIBS)
5981 if test "$OS_ARCH" = "WINNT"; then
5982 if test -z "$HAVE_64BIT_BUILD"; then
5983 MOZ_CRASHREPORTER_INJECTOR=1
5984 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5989 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5990 [ --with-crashreporter-enable-percent=NN
5991 Enable sending crash reports by default on NN% of users. (default=100)],
5992 [ val=`echo $withval | sed 's/[^0-9]//g'`
5993 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5995 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5996 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5998 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6000 dnl ========================================================
6001 dnl = libjpeg-turbo configuration
6002 dnl ========================================================
6004 if test -z "$MOZ_NATIVE_JPEG"; then
6008 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6009 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
6011 MOZ_LIBJPEG_TURBO=1)
6013 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6014 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6017 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6020 if test -n "$MOZ_LIBJPEG_TURBO"; then
6022 dnl Do we support libjpeg-turbo on this platform?
6023 case "$OS_ARCH:$OS_TEST" in
6025 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6026 LIBJPEG_TURBO_X86_ASM=1
6029 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6030 LIBJPEG_TURBO_X64_ASM=1
6032 WINNT:x86|WINNT:i?86)
6033 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6034 LIBJPEG_TURBO_X86_ASM=1
6037 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6038 LIBJPEG_TURBO_X64_ASM=1
6041 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6042 LIBJPEG_TURBO_ARM_ASM=1
6045 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6046 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6047 LIBJPEG_TURBO_X86_ASM=1
6051 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6052 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6053 LIBJPEG_TURBO_X64_ASM=1
6060 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6061 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6062 dnl it doesn't exist or we have too old of a version.
6063 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6064 LIBJPEG_TURBO_AS=$YASM
6066 if test -z "$LIBJPEG_TURBO_AS" ; then
6067 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.])
6070 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6071 dnl on Linux and 1.1 or newer everywhere else.
6072 if test "$OS_ARCH" = "Linux" ; then
6073 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
6074 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.])
6077 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6078 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.])
6083 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6084 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6085 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6086 echo "Using $AS as the assembler for ARM code."
6087 LIBJPEG_TURBO_AS=$AS
6090 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6091 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6092 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6093 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6094 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6095 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6096 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6097 dnl Warn if we're not building the optimized routines, even though the user
6098 dnl didn't specify --disable-libjpeg-turbo.
6099 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6102 dnl ========================================================
6103 dnl = Enable compilation of specific extension modules
6104 dnl ========================================================
6106 MOZ_ARG_ENABLE_STRING(extensions,
6107 [ --enable-extensions Enable extensions],
6108 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6109 if test "$option" = "yes" -o "$option" = "all"; then
6110 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6111 elif test "$option" = "no" -o "$option" = "none"; then
6113 elif test "$option" = "default"; then
6114 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6115 elif test `echo "$option" | grep -c \^-` != 0; then
6116 option=`echo $option | sed 's/^-//'`
6117 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6119 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6122 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6124 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6125 # Suppress warning on non-X11 platforms
6126 if test -n "$MOZ_X11"; then
6127 AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6129 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6132 dnl Do not build gnomevfs with libxul based apps
6133 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6134 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6137 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6138 # Suppress warning on non-X11 platforms
6139 if test -n "$MOZ_X11"; then
6140 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6142 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6145 dnl Do not build gio with libxul based apps
6146 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6147 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6150 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6152 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6154 AC_SUBST(MOZ_GIO_COMPONENT)
6157 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6159 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6160 dnl when trying to build a nonexistent extension.
6161 for extension in $MOZ_EXTENSIONS; do
6162 if test ! -d "${srcdir}/extensions/${extension}"; then
6163 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6167 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6168 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6171 dnl ========================================================
6172 dnl Build Freetype in the tree
6173 dnl ========================================================
6174 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6175 [ --enable-tree-freetype Enable Tree FreeType],
6176 MOZ_TREE_FREETYPE=1,
6177 MOZ_TREE_FREETYPE= )
6178 if test -n "$MOZ_TREE_FREETYPE"; then
6179 if test -n "$_WIN32_MSVC"; then
6180 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6182 AC_DEFINE(MOZ_TREE_FREETYPE)
6183 AC_SUBST(MOZ_TREE_FREETYPE)
6184 MOZ_ENABLE_CAIRO_FT=1
6185 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6186 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6187 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6188 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6190 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6191 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6192 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6193 AC_SUBST(CAIRO_FT_CFLAGS)
6196 dnl ========================================================
6198 dnl ========================================================
6199 dnl Abort Windows build if the required major version and
6200 dnl minimum minor version of Unicode NSIS isn't in the path
6201 dnl (unless in case of cross compiling, for which Unicode
6202 dnl is not yet sufficient).
6203 if test "$OS_ARCH" = "WINNT"; then
6204 MIN_NSIS_MAJOR_VER=2
6205 MIN_NSIS_MINOR_VER=46
6206 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-3.0a2.exe makensisu-2.46.exe makensis)
6207 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6208 AC_MSG_RESULT([yes])
6209 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null`
6211 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6213 if test "$MAKENSISU_PARSED_VER" = ""; then
6215 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
6218 MAKENSISU_MAJOR_VER=0
6219 MAKENSISU_MINOR_VER=0
6220 if test ! "$MAKENSISU_PARSED_VER" = ""; then
6221 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'`
6222 MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'`
6224 AC_MSG_CHECKING([for Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater])
6225 if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \
6226 "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER ||
6227 test "$MAKENSISU_MAJOR_VER" -gt $MIN_NSIS_MAJOR_VER; then
6228 AC_MSG_RESULT([yes])
6231 if test -z "$CROSS_COMPILE"; then
6232 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $REQ_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.])
6237 elif test -z "$CROSS_COMPILE"; then
6238 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $REQ_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.])
6244 dnl ========================================================
6246 dnl ========================================================
6247 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6248 [ --disable-webapp-runtime Disable Web App Runtime],
6249 MOZ_WEBAPP_RUNTIME=,
6250 MOZ_WEBAPP_RUNTIME=1)
6251 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a -z "$MOZ_WIDGET_GTK" ; then
6254 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6257 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6258 if test "$MOZ_WEBAPP_RUNTIME"; then
6259 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6262 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6263 if test -z "$TAR"; then
6264 AC_MSG_ERROR([no tar archiver found in \$PATH])
6268 AC_CHECK_PROGS(WGET, wget, "")
6271 dnl ========================================================
6273 dnl ========================================================
6275 if test -n "$MOZ_SIGN_CMD"; then
6276 AC_DEFINE(MOZ_SIGNING)
6279 dnl ========================================================
6280 dnl Maintenance Service
6281 dnl ========================================================
6283 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6284 [ --enable-maintenance-service Enable building of maintenanceservice],
6285 MOZ_MAINTENANCE_SERVICE=1,
6286 MOZ_MAINTENANCE_SERVICE= )
6288 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6289 if test "$OS_ARCH" = "WINNT"; then
6290 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6292 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6296 dnl ========================================================
6297 dnl Bundled fonts on desktop platforms
6298 dnl ========================================================
6300 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
6301 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
6302 MOZ_BUNDLED_FONTS=1,
6305 if test -n "$MOZ_BUNDLED_FONTS"; then
6306 AC_DEFINE(MOZ_BUNDLED_FONTS)
6309 dnl ========================================================
6310 dnl Verify MAR signatures
6311 dnl ========================================================
6313 MOZ_ARG_ENABLE_BOOL(verify-mar,
6314 [ --enable-verify-mar Enable verifying MAR signatures],
6315 MOZ_VERIFY_MAR_SIGNATURE=1,
6316 MOZ_VERIFY_MAR_SIGNATURE= )
6318 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6319 if test "$OS_ARCH" = "WINNT"; then
6320 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6322 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6326 dnl ========================================================
6327 dnl Enable building the signmar program.
6328 dnl This option is much different than the --enable-verify-mar option.
6329 dnl --enable-verify-mar is for enabling the verification check on MAR
6330 dnl files in the updater. The --enable-signmar option is for building
6331 dnl the signmar program.
6332 dnl ========================================================
6334 MOZ_ARG_ENABLE_BOOL(signmar,
6335 [ --enable-signmar Enable building the signmar program],
6336 MOZ_ENABLE_SIGNMAR=1,
6337 MOZ_ENABLE_SIGNMAR= )
6339 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6340 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6343 dnl ========================================================
6345 dnl ========================================================
6347 MOZ_ARG_DISABLE_BOOL(updater,
6348 [ --disable-updater Disable building of updater],
6352 if test -n "$MOZ_UPDATER"; then
6353 AC_DEFINE(MOZ_UPDATER)
6356 # tools/update-packaging is not checked out by default.
6357 MOZ_ARG_ENABLE_BOOL(update-packaging,
6358 [ --enable-update-packaging
6359 Enable tools/update-packaging],
6360 MOZ_UPDATE_PACKAGING=1,
6361 MOZ_UPDATE_PACKAGING= )
6362 AC_SUBST(MOZ_UPDATE_PACKAGING)
6364 dnl ========================================================
6365 dnl build the tests by default
6366 dnl ========================================================
6367 MOZ_ARG_DISABLE_BOOL(tests,
6368 [ --disable-tests Do not build test libraries & programs],
6372 if test -n "$ENABLE_TESTS"; then
6374 AC_DEFINE(ENABLE_TESTS)
6375 AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6376 AC_SUBST(GTEST_HAS_RTTI)
6377 if test -n "$_WIN32_MSVC"; then
6378 AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6380 if test "${OS_TARGET}" = "Android"; then
6381 AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6382 AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6383 AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6384 AC_SUBST(GTEST_OS_LINUX_ANDROID)
6385 AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6386 AC_SUBST(GTEST_HAS_CLONE)
6390 dnl ========================================================
6391 dnl parental controls (for Windows Vista)
6392 dnl ========================================================
6393 MOZ_ARG_DISABLE_BOOL(parental-controls,
6394 [ --disable-parental-controls
6395 Do not build parental controls],
6396 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6397 MOZ_DISABLE_PARENTAL_CONTROLS=)
6398 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6399 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6402 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6404 dnl ========================================================
6405 dnl = Disable DOMCrypto
6406 dnl ========================================================
6407 if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
6408 AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
6410 AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
6412 dnl ========================================================
6413 dnl = Disable EV certificate verification
6414 dnl ========================================================
6415 if test -n "$MOZ_NO_EV_CERTS"; then
6416 AC_DEFINE(MOZ_NO_EV_CERTS)
6418 AC_SUBST(MOZ_NO_EV_CERTS)
6420 dnl ========================================================
6421 dnl = Disable libpkix
6422 dnl ========================================================
6423 if test -n "$NSS_NO_LIBPKIX"; then
6424 AC_DEFINE(NSS_NO_LIBPKIX)
6426 AC_SUBST(NSS_NO_LIBPKIX)
6428 dnl ========================================================
6429 dnl = Content process sandboxing
6430 dnl ========================================================
6431 if test -n "$gonkdir"; then
6432 MOZ_CONTENT_SANDBOX=1
6435 MOZ_ARG_ENABLE_BOOL(content-sandbox,
6436 [ --enable-content-sandbox Enable sandboxing support for content-processes],
6437 MOZ_CONTENT_SANDBOX=1,
6438 MOZ_CONTENT_SANDBOX=)
6440 if test -n "$MOZ_CONTENT_SANDBOX"; then
6441 AC_DEFINE(MOZ_CONTENT_SANDBOX)
6444 AC_SUBST(MOZ_CONTENT_SANDBOX)
6446 dnl ========================================================
6448 dnl = Module specific options
6450 dnl ========================================================
6451 MOZ_ARG_HEADER(Individual module options)
6453 dnl ========================================================
6454 dnl = Disable feed handling components
6455 dnl ========================================================
6456 MOZ_ARG_DISABLE_BOOL(feeds,
6457 [ --disable-feeds Disable feed handling and processing components],
6460 if test -n "$MOZ_FEEDS"; then
6461 AC_DEFINE(MOZ_FEEDS)
6463 if test "$MOZ_BUILD_APP" = "browser"; then
6464 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6468 dnl ========================================================
6469 dnl Check for sqlite
6470 dnl ========================================================
6473 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6474 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6475 MOZ_NATIVE_SQLITE=1,
6476 MOZ_NATIVE_SQLITE= )
6478 if test -z "$MOZ_NATIVE_SQLITE"
6481 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6483 dnl ============================
6484 dnl === SQLite Version check ===
6485 dnl ============================
6486 dnl Check to see if the system SQLite package is new enough.
6487 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6489 dnl ==================================
6490 dnl === SQLITE_SECURE_DELETE check ===
6491 dnl ==================================
6492 dnl Check to see if the system SQLite package is compiled with
6493 dnl SQLITE_SECURE_DELETE enabled.
6494 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6495 _SAVE_CFLAGS="$CFLAGS"
6496 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6498 LIBS="$LIBS $SQLITE_LIBS"
6499 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6501 #include "sqlite3.h"
6503 int main(int argc, char **argv){
6504 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6506 ac_cv_sqlite_secure_delete=yes,
6507 ac_cv_sqlite_secure_delete=no,
6508 ac_cv_sqlite_secure_delete=no
6511 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6512 CFLAGS="$_SAVE_CFLAGS"
6514 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6515 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6518 dnl ===============================
6519 dnl === SQLITE_THREADSAFE check ===
6520 dnl ===============================
6521 dnl Check to see if the system SQLite package is compiled with
6522 dnl SQLITE_THREADSAFE enabled.
6523 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6524 _SAVE_CFLAGS="$CFLAGS"
6525 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6527 LIBS="$LIBS $SQLITE_LIBS"
6528 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6530 #include "sqlite3.h"
6532 int main(int argc, char **argv){
6533 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6535 ac_cv_sqlite_threadsafe=yes,
6536 ac_cv_sqlite_threadsafe=no,
6537 ac_cv_sqlite_threadsafe=no
6540 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6541 CFLAGS="$_SAVE_CFLAGS"
6543 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6544 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6547 dnl ================================
6548 dnl === SQLITE_ENABLE_FTS3 check ===
6549 dnl ================================
6550 dnl check to see if the system SQLite package is compiled with
6551 dnl SQLITE_ENABLE_FTS3 enabled.
6552 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6553 _SAVE_CFLAGS="$CFLAGS"
6554 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6556 LIBS="$LIBS $SQLITE_LIBS"
6557 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6559 #include "sqlite3.h"
6561 int main(int argc, char **argv){
6562 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6564 ac_cv_sqlite_enable_fts3=yes,
6565 ac_cv_sqlite_enable_fts3=no,
6566 ac_cv_sqlite_enable_fts3=no
6569 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6570 CFLAGS="$_SAVE_CFLAGS"
6572 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6573 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6576 dnl =========================================
6577 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6578 dnl =========================================
6579 dnl check to see if the system SQLite package is compiled with
6580 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6581 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6582 _SAVE_CFLAGS="$CFLAGS"
6583 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6585 LIBS="$LIBS $SQLITE_LIBS"
6586 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6588 #include "sqlite3.h"
6590 int main(int argc, char **argv){
6591 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6593 ac_cv_sqlite_enable_unlock_notify=yes,
6594 ac_cv_sqlite_enable_unlock_notify=no,
6595 ac_cv_sqlite_enable_unlock_notify=no
6598 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6599 CFLAGS="$_SAVE_CFLAGS"
6601 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6602 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6606 if test -n "$MOZ_NATIVE_SQLITE"; then
6607 AC_DEFINE(MOZ_NATIVE_SQLITE)
6609 AC_SUBST(MOZ_NATIVE_SQLITE)
6611 dnl ========================================================
6612 dnl = Enable help viewer (off by default)
6613 dnl ========================================================
6614 if test -n "$MOZ_HELP_VIEWER"; then
6615 dnl Do this if defined in confvars.sh
6616 AC_DEFINE(MOZ_HELP_VIEWER)
6619 dnl ========================================================
6620 dnl = Enable safe browsing (anti-phishing)
6621 dnl ========================================================
6622 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6623 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6624 MOZ_SAFE_BROWSING=1,
6625 MOZ_SAFE_BROWSING= )
6626 if test -n "$MOZ_SAFE_BROWSING"; then
6627 AC_DEFINE(MOZ_SAFE_BROWSING)
6629 AC_SUBST(MOZ_SAFE_BROWSING)
6631 dnl ========================================================
6632 dnl = Enable url-classifier
6633 dnl ========================================================
6634 dnl Implicitly enabled by default if building with safe-browsing
6635 if test -n "$MOZ_SAFE_BROWSING"; then
6636 MOZ_URL_CLASSIFIER=1
6638 MOZ_ARG_ENABLE_BOOL(url-classifier,
6639 [ --enable-url-classifier Enable url classifier module],
6640 MOZ_URL_CLASSIFIER=1,
6641 MOZ_URL_CLASSIFIER= )
6642 if test -n "$MOZ_URL_CLASSIFIER"; then
6643 AC_DEFINE(MOZ_URL_CLASSIFIER)
6645 AC_SUBST(MOZ_URL_CLASSIFIER)
6647 dnl ========================================================
6648 dnl = Disable zipwriter
6649 dnl ========================================================
6650 MOZ_ARG_DISABLE_BOOL(zipwriter,
6651 [ --disable-zipwriter Disable zipwriter component],
6654 AC_SUBST(MOZ_ZIPWRITER)
6656 dnl ========================================================
6658 dnl ========================================================
6660 MOZ_ARG_WITH_STRING(gl-provider,
6661 [ --with-gl-provider=ID
6662 Set GL provider backend type],
6663 [ val=`echo $withval`
6664 MOZ_GL_PROVIDER="$val"])
6666 if test -n "$MOZ_GL_PROVIDER"; then
6667 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6668 AC_SUBST(MOZ_GL_PROVIDER)
6669 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6671 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6672 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6674 dnl ========================================================
6675 dnl = faststripe theme
6676 dnl ========================================================
6677 MOZ_ARG_ENABLE_BOOL(faststripe,
6678 [ --enable-faststripe Use faststripe theme],
6679 MOZ_THEME_FASTSTRIPE=1,
6680 MOZ_THEME_FASTSTRIPE= )
6681 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6683 dnl ========================================================
6685 dnl = Feature options that require extra sources to be pulled
6687 dnl ========================================================
6688 dnl MOZ_ARG_HEADER(Features that require extra sources)
6690 dnl ========================================================
6692 dnl = Runtime debugging and Optimization Options
6694 dnl ========================================================
6695 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
6697 dnl ========================================================
6698 dnl enable mobile optimizations
6699 dnl ========================================================
6700 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6701 [ --enable-mobile-optimize
6702 Enable mobile optimizations],
6703 MOZ_GFX_OPTIMIZE_MOBILE=1)
6705 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6707 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6708 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6711 dnl ========================================================
6712 dnl = Enable code optimization. ON by default.
6713 dnl ========================================================
6714 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6715 MOZ_OPTIMIZE_FLAGS="-O"
6718 MOZ_ARG_ENABLE_STRING(optimize,
6719 [ --disable-optimize Disable compiler optimization
6720 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6721 [ if test "$enableval" != "no"; then
6723 if test -n "$enableval" -a "$enableval" != "yes"; then
6724 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6729 fi ], MOZ_OPTIMIZE=1)
6731 MOZ_SET_FRAMEPTR_FLAGS
6733 if test "$COMPILE_ENVIRONMENT"; then
6734 if test -n "$MOZ_OPTIMIZE"; then
6735 AC_MSG_CHECKING([for valid optimization flags])
6736 _SAVE_CFLAGS=$CFLAGS
6737 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6738 AC_TRY_COMPILE([#include <stdio.h>],
6739 [printf("Hello World\n");],
6742 AC_MSG_RESULT([$_results])
6743 if test "$_results" = "no"; then
6744 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6746 CFLAGS=$_SAVE_CFLAGS
6748 fi # COMPILE_ENVIRONMENT
6750 AC_SUBST(MOZ_OPTIMIZE)
6751 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6752 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6753 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6754 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6755 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6757 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6759 dnl ========================================================
6760 dnl = Enable any treating of compile warnings as errors
6761 dnl ========================================================
6762 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6763 [ --enable-warnings-as-errors
6764 Enable treating of warnings as errors],
6765 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6766 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6767 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6768 WARNINGS_AS_ERRORS=''
6769 elif test "$GNU_CC"; then
6770 # Prevent the following GCC warnings from being treated as errors:
6771 # -Wuninitialized - too many false positives
6772 # -Wmaybe-uninitialized - too many false positives
6773 # -Wdeprecated-declarations - we don't want our builds held hostage when a
6774 # platform-specific API becomes deprecated.
6775 MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
6776 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
6777 MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
6778 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
6779 MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
6780 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
6782 if test -n "$MOZ_PGO"; then
6783 MOZ_C_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_c_has_noerror_coverage_mismatch)
6784 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_cxx_has_noerror_coverage_mismatch)
6788 dnl ========================================================
6789 dnl = Disable runtime logging checks
6790 dnl ========================================================
6791 MOZ_ARG_DISABLE_BOOL(logging,
6792 [ --disable-logging Disable logging facilities],
6793 NS_DISABLE_LOGGING=1,
6794 NS_DISABLE_LOGGING= )
6795 if test "$NS_DISABLE_LOGGING"; then
6796 AC_DEFINE(NS_DISABLE_LOGGING)
6798 AC_DEFINE(MOZ_LOGGING)
6801 dnl ========================================================
6802 dnl = This will enable logging of addref, release, ctor, dtor.
6803 dnl ========================================================
6804 _ENABLE_LOGREFCNT=42
6805 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6806 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6807 _ENABLE_LOGREFCNT=1,
6808 _ENABLE_LOGREFCNT= )
6809 if test "$_ENABLE_LOGREFCNT" = "1"; then
6810 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6811 elif test -z "$_ENABLE_LOGREFCNT"; then
6812 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6815 dnl ========================================================
6816 dnl moz_dump_painting
6817 dnl ========================================================
6818 MOZ_ARG_ENABLE_BOOL(dump-painting,
6819 [ --enable-dump-painting Enable paint debugging.],
6820 MOZ_DUMP_PAINTING=1,
6821 MOZ_DUMP_PAINTING= )
6822 if test -n "$MOZ_DUMP_PAINTING"; then
6823 AC_DEFINE(MOZ_DUMP_PAINTING)
6824 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6826 if test -n "$MOZ_DEBUG"; then
6827 AC_DEFINE(MOZ_DUMP_PAINTING)
6830 dnl ========================================================
6831 dnl = Enable trace malloc
6832 dnl ========================================================
6833 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6834 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6835 [ --enable-trace-malloc Enable malloc tracing; also disables DMD and jemalloc],
6838 if test "$NS_TRACE_MALLOC"; then
6839 # Please, Mr. Linker Man, don't take away our symbol names
6840 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6841 AC_DEFINE(NS_TRACE_MALLOC)
6843 AC_SUBST(NS_TRACE_MALLOC)
6845 dnl ========================================================
6847 dnl ========================================================
6849 MOZ_ARG_ENABLE_BOOL(dmd,
6850 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
6854 dnl The two options are conflicting. Fails the configure to alert the user.
6855 if test "$NS_TRACE_MALLOC" -a "$MOZ_DMD"; then
6856 AC_MSG_ERROR([--enable-trace-malloc and --enable-dmd are conflicting options])
6859 if test "$MOZ_DMD"; then
6862 if test "${CPU_ARCH}" = "arm"; then
6863 CFLAGS="$CFLAGS -funwind-tables"
6864 CXXFLAGS="$CXXFLAGS -funwind-tables"
6867 MOZ_MEMORY=1 # DMD enables jemalloc
6868 MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
6872 dnl ========================================================
6873 dnl = Enable jemalloc
6874 dnl ========================================================
6875 MOZ_ARG_ENABLE_BOOL(jemalloc,
6876 [ --enable-jemalloc Replace memory allocator with jemalloc],
6880 if test "$NS_TRACE_MALLOC"; then
6884 if test "${OS_TARGET}" = "Android"; then
6885 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6887 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin"; then
6888 dnl On Windows and OSX, we want to link all our binaries against mozglue
6889 if test -z "$GNU_CC"; then
6890 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6892 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6895 dnl On other Unix systems, we only want to link executables against mozglue
6896 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6897 dnl On other Unix systems, where mozglue is a static library, jemalloc is
6898 dnl separated for the SDK, so we need to add it here.
6899 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6900 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6902 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6903 if test -n "$GNU_CC"; then
6904 dnl And we need mozglue symbols to be exported.
6905 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6907 if test "$MOZ_LINKER" = 1; then
6908 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
6912 dnl ========================================================
6913 dnl = Enable dynamic replacement of malloc implementation
6914 dnl ========================================================
6915 if test -n "$NIGHTLY_BUILD" -a -n "$MOZ_MEMORY"; then
6916 # Enable on central for the debugging opportunities it adds.
6917 MOZ_REPLACE_MALLOC=1
6919 MOZ_ARG_ENABLE_BOOL(replace-malloc,
6920 [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
6921 MOZ_REPLACE_MALLOC=1,
6922 MOZ_REPLACE_MALLOC= )
6924 dnl The two options are conflicting. Fails the configure to alert the user.
6925 if test "$NS_TRACE_MALLOC" -a "$MOZ_REPLACE_MALLOC"; then
6926 AC_MSG_ERROR([--enable-trace-malloc and --enable-replace-malloc are conflicting options])
6929 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
6930 dnl We don't want to enable jemalloc unconditionally because it may be a
6931 dnl deliberate choice not to enable it (bug 702250, for instance)
6932 AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
6933 elif test -n "$MOZ_REPLACE_MALLOC"; then
6934 MOZ_NATIVE_JEMALLOC=
6936 dnl Replace-malloc Mac linkage quirks
6937 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
6938 AC_CACHE_CHECK([how to do weak dynamic linking],
6939 ac_cv_weak_dynamic_linking,
6940 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
6941 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
6942 test -s conftest${DLL_SUFFIX}; then
6943 dnl There are several ways the linker can put link edit rules in a binary:
6944 dnl - classic info only (for OSX < 10.6)
6945 dnl - dyld info only
6947 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
6952 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
6957 dnl With classic info, we need to build with -flat_namespace.
6958 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
6959 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
6960 dnl forgets to set the weak flag in the dyld info.
6961 dnl See http://glandium.org/blog/?p=2764 for more details.
6963 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
6964 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
6965 dnl - "flat namespace" when -flat_namespace alone is needed
6966 dnl - "dummy library" when a dummy library and -flat_namespace are needed
6967 dnl - "compiler support" when nothing is needed
6968 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
6969 if test -n "$_CLASSIC_INFO"; then
6970 ac_cv_weak_dynamic_linking="flat namespace"
6972 ac_cv_weak_dynamic_linking="compiler support"
6975 if test -n "$_DYLD_INFO"; then
6976 ac_cv_weak_dynamic_linking="dummy library"
6978 ac_cv_weak_dynamic_linking="flat namespace"
6982 AC_ERROR([couldn't compile a simple C file])
6985 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
6988 AC_SUBST(MOZ_REPLACE_MALLOC)
6989 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
6991 dnl ========================================================
6992 dnl = Jemalloc build setup
6993 dnl ========================================================
6994 if test -z "$MOZ_MEMORY"; then
6995 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
6996 MOZ_NATIVE_JEMALLOC=1
6997 AC_CHECK_FUNCS(mallctl nallocm,,
6998 [MOZ_NATIVE_JEMALLOC=
7000 if test -n "$MOZ_NATIVE_JEMALLOC"; then
7002 AC_DEFINE(MOZ_MEMORY)
7003 AC_DEFINE(MOZ_JEMALLOC3)
7004 AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7009 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7010 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.])
7015 AC_DEFINE(MOZ_MEMORY)
7016 if test -n "$MOZ_JEMALLOC3"; then
7017 AC_DEFINE(MOZ_JEMALLOC3)
7019 if test "x$MOZ_DEBUG" = "x1"; then
7020 AC_DEFINE(MOZ_MEMORY_DEBUG)
7022 dnl The generic feature tests that determine how to compute ncpus are long and
7023 dnl complicated. Therefore, simply define special cpp variables for the
7024 dnl platforms we have special knowledge of.
7027 AC_DEFINE(MOZ_MEMORY_DARWIN)
7030 AC_DEFINE(MOZ_MEMORY_BSD)
7032 *-android*|*-linuxandroid*)
7033 AC_DEFINE(MOZ_MEMORY_LINUX)
7034 AC_DEFINE(MOZ_MEMORY_ANDROID)
7035 if test -z "$gonkdir"; then
7038 AC_DEFINE(MOZ_MEMORY_GONK)
7043 AC_DEFINE(MOZ_MEMORY_LINUX)
7046 AC_DEFINE(MOZ_MEMORY_BSD)
7049 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7052 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7053 export MOZ_NO_DEBUG_RTL=1
7054 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7055 dnl Look for a broken crtdll.obj
7056 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7057 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7058 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7059 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcprt -DEFAULTLIB:mozcrt'
7060 dnl Also pass this to NSPR/NSS
7061 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7063 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7070 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7074 AC_SUBST(MOZ_MEMORY)
7075 AC_SUBST(MOZ_JEMALLOC3)
7076 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7077 AC_SUBST(MOZ_GLUE_LDFLAGS)
7078 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7079 AC_SUBST(WIN32_CRT_LIBS)
7080 dnl Need to set this for make because NSS doesn't have configure
7083 dnl We need to wrap dlopen and related functions on Android because we use
7085 if test "$OS_TARGET" = Android; then
7086 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7087 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7088 if test "$MOZ_WIDGET_TOOLKIT" = android; then
7089 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7091 if test -z "$gonkdir"; then
7092 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7093 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=memccpy,--wrap=memchr,--wrap=memrchr,--wrap=memcmp,--wrap=memcpy,--wrap=memmove,--wrap=memset,--wrap=memmem,--wrap=index,--wrap=strchr,--wrap=strrchr,--wrap=strlen,--wrap=strcmp,--wrap=strcpy,--wrap=strcat,--wrap=strcasecmp,--wrap=strncasecmp,--wrap=strstr,--wrap=strcasestr,--wrap=strtok,--wrap=strtok_r,--wrap=strerror,--wrap=strerror_r,--wrap=strnlen,--wrap=strncat,--wrap=strncmp,--wrap=strncpy,--wrap=strlcat,--wrap=strlcpy,--wrap=strcspn,--wrap=strpbrk,--wrap=strsep,--wrap=strspn,--wrap=strcoll,--wrap=strxfrm"
7095 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
7096 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=pthread_create,--wrap=epoll_wait,--wrap=poll,--wrap=pthread_cond_timedwait,--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_join,--wrap=pipe,--wrap=pipe2,--wrap=tgkill"
7100 dnl ========================================================
7101 dnl = Use malloc wrapper lib
7102 dnl ========================================================
7103 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7104 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7108 if test -n "$_WRAP_MALLOC"; then
7109 if test -n "$GNU_CC"; then
7110 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7111 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7112 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7113 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=vasprintf,--wrap=asprintf"
7114 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7115 dnl Wrap operator new and operator delete on Android.
7116 if test "$OS_TARGET" = "Android"; then
7117 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7118 dnl Wrap the nothrow variants too.
7119 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7122 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7126 dnl ========================================================
7127 dnl = Location of malloc wrapper lib
7128 dnl ========================================================
7129 MOZ_ARG_WITH_STRING(wrap-malloc,
7130 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7131 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7133 dnl ========================================================
7134 dnl = Use JS Call tracing
7135 dnl ========================================================
7136 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7137 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7138 MOZ_TRACE_JSCALLS=1,
7139 MOZ_TRACE_JSCALLS= )
7140 if test -n "$MOZ_TRACE_JSCALLS"; then
7141 AC_DEFINE(MOZ_TRACE_JSCALLS)
7144 dnl ========================================================
7145 dnl JS opt-mode assertions and minidump instrumentation
7146 dnl ========================================================
7147 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7148 [ --enable-js-diagnostics
7149 Enable JS diagnostic assertions and breakpad data],
7150 JS_CRASH_DIAGNOSTICS=1,
7151 JS_CRASH_DIAGNOSTICS= )
7152 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7153 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7156 dnl ========================================================
7157 dnl = Use incremental GC
7158 dnl ========================================================
7160 MOZ_ARG_DISABLE_BOOL(gcincremental,
7161 [ --disable-gcincremental Disable incremental GC],
7163 if test -n "$JSGC_INCREMENTAL"; then
7164 AC_DEFINE(JSGC_INCREMENTAL)
7167 dnl ========================================================
7168 dnl = Use exact stack rooting for GC
7169 dnl ========================================================
7170 MOZ_ARG_DISABLE_BOOL(exact-rooting,
7171 [ --disable-exact-rooting Enable use of conservative stack scanning for GC],
7172 JSGC_USE_EXACT_ROOTING= ,
7173 JSGC_USE_EXACT_ROOTING=1 )
7174 if test -n "$JSGC_USE_EXACT_ROOTING"; then
7175 AC_DEFINE(JSGC_USE_EXACT_ROOTING)
7178 dnl ========================================================
7179 dnl = Use generational GC
7180 dnl ========================================================
7181 MOZ_ARG_DISABLE_BOOL(gcgenerational,
7182 [ --disable-gcgenerational Disable generational GC],
7183 JSGC_GENERATIONAL= ,
7184 JSGC_GENERATIONAL=1 )
7185 if test -n "$JSGC_GENERATIONAL"; then
7186 AC_DEFINE(JSGC_GENERATIONAL)
7189 dnl ========================================================
7190 dnl = Use a smaller chunk size for GC chunks
7191 dnl ========================================================
7192 MOZ_ARG_ENABLE_BOOL(small-chunk-size,
7193 [ --enable-small-chunk-size Allocate memory for JS GC things in smaller chunks],
7194 JS_GC_SMALL_CHUNK_SIZE=1,
7195 JS_GC_SMALL_CHUNK_SIZE= )
7196 if test -n "$JS_GC_SMALL_CHUNK_SIZE"; then
7197 AC_DEFINE(JS_GC_SMALL_CHUNK_SIZE)
7200 dnl ========================================================
7201 dnl Zealous JavaScript GC
7202 dnl ========================================================
7203 MOZ_ARG_ENABLE_BOOL(gczeal,
7204 [ --enable-gczeal Enable zealous JavaScript GCing],
7207 if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then
7208 AC_DEFINE(JS_GC_ZEAL)
7211 dnl ========================================================
7212 dnl = Perform moving GC stack rooting analysis
7213 dnl ========================================================
7214 MOZ_ARG_ENABLE_BOOL(root-analysis,
7215 [ --enable-root-analysis Enable moving GC stack root analysis],
7216 JSGC_ROOT_ANALYSIS=1,
7217 JSGC_ROOT_ANALYSIS= )
7218 if test -n "$JSGC_ROOT_ANALYSIS"; then
7219 AC_DEFINE(JSGC_ROOT_ANALYSIS)
7224 dnl ========================================================
7225 dnl = Enable static checking using gcc-dehydra
7226 dnl ========================================================
7228 MOZ_ARG_WITH_STRING(static-checking,
7229 [ --with-static-checking=path/to/gcc_dehydra.so
7230 Enable static checking of code using GCC-dehydra],
7231 DEHYDRA_PATH=$withval,
7234 if test -n "$DEHYDRA_PATH"; then
7235 if test ! -f "$DEHYDRA_PATH"; then
7236 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7238 AC_DEFINE(NS_STATIC_CHECKING)
7240 AC_SUBST(DEHYDRA_PATH)
7242 dnl ========================================================
7243 dnl = Enable using the clang plugin to build
7244 dnl ========================================================
7246 MOZ_ARG_ENABLE_BOOL(clang-plugin,
7247 [ --enable-clang-plugin Enable building with the mozilla clang plugin ],
7248 ENABLE_CLANG_PLUGIN=1,
7249 ENABLE_CLANG_PLUGIN= )
7250 if test -n "$ENABLE_CLANG_PLUGIN"; then
7251 if test -z "$CLANG_CC"; then
7252 AC_MSG_ERROR([Can't use clang plugin without clang.])
7254 AC_DEFINE(MOZ_CLANG_PLUGIN)
7257 AC_SUBST(ENABLE_CLANG_PLUGIN)
7259 dnl ========================================================
7260 dnl = Enable stripping of libs & executables
7261 dnl ========================================================
7262 MOZ_ARG_ENABLE_BOOL(strip,
7263 [ --enable-strip Enable stripping of libs & executables ],
7267 dnl ========================================================
7268 dnl = Enable stripping of libs & executables when packaging
7269 dnl ========================================================
7270 MOZ_ARG_ENABLE_BOOL(install-strip,
7271 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7275 dnl ========================================================
7276 dnl = --disable-elf-hack
7277 dnl ========================================================
7280 MOZ_ARG_DISABLE_BOOL(elf-hack,
7281 [ --disable-elf-hack Disable elf hacks],
7283 [USE_ELF_HACK=F # Force enable elf-hack])
7285 # Disable elf hack for profiling because the built in profiler
7286 # doesn't read the segments properly with elf hack. This is
7287 # temporary and should be fixed soon in the profiler.
7288 if test "$MOZ_PROFILING" = 1; then
7289 if test "$USE_ELF_HACK" = F; then
7290 AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
7295 # Only enable elfhack where supported
7296 if test "$USE_ELF_HACK" = 1; then
7297 case "${HOST_OS_ARCH},${OS_ARCH}" in
7299 case "${CPU_ARCH}" in
7314 if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
7315 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7316 dnl memory addresses it maps to. The result is that by the time elfhack
7317 dnl kicks in, it is not possible to apply relocations because of that,
7318 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7319 dnl segment. It makes elfhack mostly useless, so considering the problems
7320 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7321 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7322 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
7323 dnl elfhack enabled, disable PT_GNU_RELRO instead.
7324 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7325 LINK_WITH_PT_GNU_RELRO,
7326 [echo "int main() {return 0;}" > conftest.${ac_ext}
7327 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7328 test -s conftest${ac_exeext}; then
7329 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7330 LINK_WITH_PT_GNU_RELRO=yes
7332 LINK_WITH_PT_GNU_RELRO=no
7335 dnl We really don't expect to get here, but just in case
7336 AC_ERROR([couldn't compile a simple C file])
7339 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7340 if test "$USE_ELF_HACK" = F; then
7341 AC_MSG_CHECKING([for -z norelro option to ld])
7342 _SAVE_LDFLAGS=$LDFLAGS
7343 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
7344 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
7345 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
7346 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.]))
7349 AC_MSG_WARN([Disabling elfhack])
7355 dnl ========================================================
7356 dnl = libstdc++ compatibility hacks
7357 dnl ========================================================
7360 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7361 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7364 if test -n "$STDCXX_COMPAT"; then
7365 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
7366 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7367 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7370 dnl ========================================================
7372 dnl = Profiling and Instrumenting
7374 dnl ========================================================
7375 MOZ_ARG_HEADER(Profiling and Instrumenting)
7377 dnl ========================================================
7378 dnl = Enable runtime visual profiling logger
7379 dnl ========================================================
7380 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7381 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7382 MOZ_VISUAL_EVENT_TRACER=1,
7383 MOZ_VISUAL_EVENT_TRACER=)
7384 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7385 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7388 dnl ========================================================
7389 dnl = Enable TaskTracer
7390 dnl ========================================================
7391 MOZ_ARG_ENABLE_BOOL(tasktracer,
7392 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
7395 if test "$MOZ_WIDGET_TOOLKIT" = "gonk" -a -n "$MOZ_TASK_TRACER"; then
7396 AC_DEFINE(MOZ_TASK_TRACER)
7397 AC_SUBST(MOZ_TASK_TRACER)
7400 dnl ========================================================
7401 dnl Turn on reflow counting
7402 dnl ========================================================
7403 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7404 [ --enable-reflow-perf Enable reflow performance tracing],
7407 if test -n "$MOZ_REFLOW_PERF"; then
7408 AC_DEFINE(MOZ_REFLOW_PERF)
7411 dnl ========================================================
7412 dnl = Offer a way to disable the startup cache
7413 dnl ========================================================
7414 MOZ_DISABLE_STARTUPCACHE=
7416 MOZ_ARG_DISABLE_BOOL(startupcache,
7417 [ --disable-startupcache Disable startup cache ],
7418 MOZ_DISABLE_STARTUPCACHE=1,
7419 MOZ_DISABLE_STARTUPCACHE=)
7421 dnl bug 988880: disable startup cache on b2g
7422 if test -n "$MOZ_B2G"; then
7423 MOZ_DISABLE_STARTUPCACHE=1
7426 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
7428 dnl ========================================================
7429 dnl = Enable Radio Interface for B2G (Gonk usually)
7430 dnl ========================================================
7431 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7432 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7435 MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL )
7436 if test -n "$MOZ_B2G_RIL"; then
7437 if test -n "$_PLATFORM_HAVE_RIL"; then
7438 AC_DEFINE(MOZ_B2G_RIL)
7440 AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.])
7443 AC_SUBST(MOZ_B2G_RIL)
7445 dnl ========================================================
7446 dnl = Enable Radio FM for B2G (Gonk usually)
7447 dnl ========================================================
7448 if test -n "$MOZ_B2G_FM"; then
7449 AC_DEFINE(MOZ_B2G_FM)
7451 AC_SUBST(MOZ_B2G_FM)
7453 dnl ========================================================
7454 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7455 dnl ========================================================
7456 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7457 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7460 if test -n "$MOZ_B2G_BT"; then
7461 AC_DEFINE(MOZ_B2G_BT)
7463 AC_SUBST(MOZ_B2G_BT)
7464 AC_SUBST(MOZ_B2G_BT_BLUEZ)
7465 AC_SUBST(MOZ_B2G_BT_BLUEDROID)
7467 dnl ========================================================
7468 dnl = Enable NFC Interface for B2G (Gonk usually)
7469 dnl ========================================================
7470 MOZ_ARG_ENABLE_BOOL(nfc,
7471 [ --enable-nfc Set compile flags necessary for compiling NFC API ],
7474 if test -n "$MOZ_NFC"; then
7479 dnl ========================================================
7480 dnl = Enable Pico Speech Synthesis (Gonk usually)
7481 dnl ========================================================
7482 MOZ_ARG_ENABLE_BOOL(synth-pico,
7483 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
7486 if test -n "$MOZ_SYNTH_PICO"; then
7487 AC_DEFINE(MOZ_SYNTH_PICO)
7489 AC_SUBST(MOZ_SYNTH_PICO)
7491 dnl ========================================================
7492 dnl = Enable Support for Time Manager API
7493 dnl ========================================================
7494 if test -n "$MOZ_TIME_MANAGER"; then
7495 AC_DEFINE(MOZ_TIME_MANAGER)
7497 AC_SUBST(MOZ_TIME_MANAGER)
7499 dnl ========================================================
7500 dnl = Enable Camera Interface for B2G (Gonk usually)
7501 dnl ========================================================
7502 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7503 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7506 if test -n "$MOZ_B2G_CAMERA"; then
7507 AC_DEFINE(MOZ_B2G_CAMERA)
7509 AC_SUBST(MOZ_B2G_CAMERA)
7511 dnl ========================================================
7512 dnl = Enable Support for Payment API
7513 dnl ========================================================
7514 if test -n "$MOZ_PAY"; then
7519 dnl ========================================================
7520 dnl = Enable Browser Support for Activities
7521 dnl ========================================================
7522 if test -n "$MOZ_ACTIVITIES"; then
7523 AC_DEFINE(MOZ_ACTIVITIES)
7525 AC_SUBST(MOZ_ACTIVITIES)
7527 dnl ========================================================
7528 dnl = Enable Support for AudioChannelManager API
7529 dnl ========================================================
7530 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7531 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7533 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7535 dnl ========================================================
7536 dnl = Support for demangling undefined symbols
7537 dnl ========================================================
7538 if test -z "$SKIP_LIBRARY_CHECKS"; then
7541 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7545 # Demangle only for debug or trace-malloc or DMD builds
7546 MOZ_DEMANGLE_SYMBOLS=
7547 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7548 MOZ_DEMANGLE_SYMBOLS=1
7549 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7551 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7553 dnl ========================================================
7554 dnl = Support for gcc stack unwinding (from gcc 3.3)
7555 dnl ========================================================
7556 if test -z "$SKIP_LIBRARY_CHECKS"; then
7559 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7563 dnl ========================================================
7565 dnl ========================================================
7567 MOZ_ARG_WITH_STRING(jitreport-granularity,
7568 [ --jitreport-granularity=N
7569 Default granularity at which to report JIT code
7572 1 - code ranges for whole functions only
7573 2 - per-line information
7574 3 - per-op information],
7575 JITREPORT_GRANULARITY=$withval,
7576 JITREPORT_GRANULARITY=3)
7578 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7580 dnl ========================================================
7584 dnl ========================================================
7585 MOZ_ARG_HEADER(Misc. Options)
7587 dnl ========================================================
7588 dnl update xterm title
7589 dnl ========================================================
7590 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7591 [ --enable-xterm-updates Update XTERM titles with current command.],
7595 dnl =========================================================
7597 dnl =========================================================
7598 MOZ_ARG_ENABLE_STRING([chrome-format],
7599 [ --enable-chrome-format=jar|flat|omni
7600 Select FORMAT of chrome files during packaging],
7601 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7603 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7604 MOZ_CHROME_FILE_FORMAT=jar
7607 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7608 AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7611 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7612 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7613 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7614 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7617 dnl =========================================================
7618 dnl Omnijar packaging (bug 552121)
7619 dnl =========================================================
7620 dnl Omnijar packaging is compatible with flat packaging.
7621 dnl In unpackaged builds, omnijar looks for files as if
7622 dnl things were flat packaged. After packaging, all files
7623 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7624 dnl is set to flat since putting files into jars is only
7625 dnl done during packaging with omnijar.
7626 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7628 AC_DEFINE(MOZ_OMNIJAR)
7630 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7631 if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7632 MOZ_CHROME_FILE_FORMAT=flat
7634 MOZ_CHROME_FILE_FORMAT=symlink
7637 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7638 dnl Fennec's static resources live in the assets/ folder of the
7639 dnl APK. Adding a path to the name here works because we only
7640 dnl have one omnijar file in the final package (which is not the
7641 dnl case on desktop), and necessitates some contortions during
7642 dnl packaging so that the resources in the omnijar are considered
7643 dnl as rooted at / and not as rooted at assets/ (which again is
7644 dnl not the case on desktop: there are omnijars rooted at webrtc/,
7645 dnl etc). packager.mk handles changing the rooting of the single
7647 OMNIJAR_NAME=assets/omni.ja
7649 OMNIJAR_NAME=omni.ja
7652 AC_SUBST(OMNIJAR_NAME)
7653 AC_SUBST(MOZ_OMNIJAR)
7654 AC_SUBST(MOZ_PACKAGER_FORMAT)
7656 dnl ========================================================
7657 dnl = Define default location for MOZILLA_FIVE_HOME
7658 dnl ========================================================
7659 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7660 [ --with-default-mozilla-five-home
7661 Set the default value for MOZILLA_FIVE_HOME],
7662 [ val=`echo $withval`
7663 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7665 dnl ========================================================
7666 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7667 dnl ========================================================
7668 MOZ_ARG_WITH_STRING(user-appdir,
7669 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7670 [ val=`echo $withval`
7671 if echo "$val" | grep "\/" >/dev/null; then
7672 AC_MSG_ERROR("Homedir must be single relative path.")
7677 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7679 dnl ========================================================
7680 dnl = Doxygen configuration
7681 dnl ========================================================
7682 dnl Use commas to specify multiple dirs to this arg
7683 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7684 MOZ_ARG_WITH_STRING(doc-input-dirs,
7685 [ --with-doc-input-dirs=DIRS
7686 Header/idl dirs to create docs from],
7687 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7688 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7690 dnl Use commas to specify multiple dirs to this arg
7691 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7692 MOZ_ARG_WITH_STRING(doc-include-dirs,
7693 [ --with-doc-include-dirs=DIRS
7694 Include dirs to preprocess doc headers],
7695 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7696 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7698 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7699 MOZ_ARG_WITH_STRING(doc-output-dir,
7700 [ --with-doc-output-dir=DIR
7701 Dir to generate docs into],
7702 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7703 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7705 if test -z "$SKIP_COMPILER_CHECKS"; then
7706 dnl ========================================================
7708 dnl = Compiler Options
7710 dnl ========================================================
7711 MOZ_ARG_HEADER(Compiler Options)
7713 dnl ========================================================
7714 dnl Check for gcc -pipe support
7715 dnl ========================================================
7716 AC_MSG_CHECKING([for -pipe support])
7717 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7718 dnl Any gcc that supports firefox supports -pipe.
7719 CFLAGS="$CFLAGS -pipe"
7720 CXXFLAGS="$CXXFLAGS -pipe"
7721 AC_MSG_RESULT([yes])
7726 dnl ========================================================
7727 dnl Profile guided optimization (gcc checks)
7728 dnl ========================================================
7729 dnl Test for profiling options
7730 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7732 _SAVE_CFLAGS="$CFLAGS"
7733 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7735 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7736 AC_TRY_COMPILE([], [return 0;],
7737 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7738 result="yes" ], result="no")
7739 AC_MSG_RESULT([$result])
7741 if test $result = "yes"; then
7742 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7743 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7744 PROFILE_USE_LDFLAGS="-fprofile-use"
7747 CFLAGS="$_SAVE_CFLAGS"
7749 if test -n "$INTEL_CC"; then
7750 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7751 PROFILE_GEN_LDFLAGS=
7752 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7753 PROFILE_USE_LDFLAGS=
7756 dnl Sun Studio on Solaris
7757 if test "$SOLARIS_SUNPRO_CC"; then
7758 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7759 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7760 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7761 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7764 AC_SUBST(PROFILE_GEN_CFLAGS)
7765 AC_SUBST(PROFILE_GEN_LDFLAGS)
7766 AC_SUBST(PROFILE_USE_CFLAGS)
7767 AC_SUBST(PROFILE_USE_LDFLAGS)
7769 dnl =============================================
7770 dnl Support for -fno-integrated-as (recent clang)
7771 dnl =============================================
7772 dnl Under clang 3.4+, use -fno-integrated-as to
7773 dnl build libvpx's vp8_asm_enc_offsets.c
7775 _SAVE_CFLAGS="$CFLAGS"
7776 CFLAGS="$CFLAGS -fno-integrated-as"
7778 AC_MSG_CHECKING([whether C compiler supports -fno-integrated-as])
7779 AC_TRY_COMPILE([], [return 0;],
7780 [ NO_INTEGRATED_AS_CFLAGS="-fno-integrated-as"
7781 result="yes" ], result="no")
7782 AC_MSG_RESULT([$result])
7784 CFLAGS="$_SAVE_CFLAGS"
7786 AC_SUBST(NO_INTEGRATED_AS_CFLAGS)
7788 fi # ! SKIP_COMPILER_CHECKS
7790 AC_DEFINE(CPP_THROW_NEW, [throw()])
7793 if test "$COMPILE_ENVIRONMENT"; then
7795 fi # COMPILE_ENVIRONMENT
7797 dnl ========================================================
7799 dnl = Build depencency options
7801 dnl ========================================================
7802 MOZ_ARG_HEADER(Build dependencies)
7804 if test "$GNU_CC" -a "$GNU_CXX"; then
7805 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7806 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7807 elif test "$SOLARIS_SUNPRO_CC"; then
7810 dnl Don't override this for MSVC
7811 if test -z "$_WIN32_MSVC"; then
7812 _USE_CPP_INCLUDE_FLAG=
7813 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7814 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7816 echo '#include <stdio.h>' > dummy-hello.c
7818 dnl This output is localized, split at the first double space or colon and space.
7819 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
7820 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
7821 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
7823 if ! test -e "$_CL_STDIO_PATH"; then
7824 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
7826 if test -z "$CL_INCLUDES_PREFIX"; then
7827 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7829 AC_SUBST(CL_INCLUDES_PREFIX)
7832 dnl Make sure that the build system can handle non-ASCII characters
7833 dnl in environment variables to prevent it from breaking silently on
7834 dnl non-English systems.
7835 NONASCII=$'\241\241'
7840 dnl ========================================================
7842 dnl = Static Build Options
7844 dnl ========================================================
7845 MOZ_ARG_HEADER(Static build options)
7847 AC_SUBST(LIBXUL_LIBS)
7848 XPCOM_LIBS="$LIBXUL_LIBS"
7850 if test "$OS_ARCH" = "WINNT"; then
7851 GKMEDIAS_SHARED_LIBRARY=1
7852 AC_DEFINE(GKMEDIAS_SHARED_LIBRARY)
7854 AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
7856 if test -z "$MOZ_NATIVE_ZLIB"; then
7857 if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
7859 AC_DEFINE(ZLIB_IN_MOZGLUE)
7863 AC_SUBST(ZLIB_IN_MOZGLUE)
7865 dnl ========================================================
7867 dnl = Standalone module options
7869 dnl ========================================================
7870 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7873 dnl ========================================================
7875 if test -z "$SKIP_PATH_CHECKS"; then
7876 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7877 if test "$MOZ_ENABLE_GTK" ; then
7878 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7883 if test -z "${GLIB_GMODULE_LIBS}" \
7884 -a -n "${GLIB_CONFIG}"\
7885 -a "${GLIB_CONFIG}" != no\
7887 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7890 AC_SUBST(GLIB_CFLAGS)
7892 AC_SUBST(GLIB_GMODULE_LIBS)
7894 dnl ========================================================
7895 dnl Graphics checks.
7896 dnl ========================================================
7898 if test "${OS_TARGET}" = "WINNT"; then
7899 if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then
7900 MOZ_ENABLE_DIRECT2D1_1=1
7901 AC_SUBST(MOZ_ENABLE_DIRECT2D1_1)
7905 if test "${OS_TARGET}" = "WINNT" -o \
7906 "${OS_ARCH}" = "Darwin" -o \
7907 "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
7908 "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
7909 "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
7910 "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
7911 case "${target_cpu}" in
7923 MOZ_ARG_ENABLE_BOOL(skia,
7924 [ --enable-skia Enable use of Skia],
7928 if test "$USE_FC_FREETYPE"; then
7929 if test "$COMPILE_ENVIRONMENT"; then
7930 dnl ========================================================
7931 dnl = Check for freetype2 and its functionality
7932 dnl ========================================================
7933 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7935 if test "$_HAVE_FREETYPE2"; then
7937 _SAVE_CFLAGS="$CFLAGS"
7938 LIBS="$LIBS $FT2_LIBS"
7939 CFLAGS="$CFLAGS $FT2_CFLAGS"
7941 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7942 ac_cv_member_FT_Bitmap_Size_y_ppem,
7943 [AC_TRY_COMPILE([#include <ft2build.h>
7944 #include FT_FREETYPE_H],
7946 if (sizeof s.y_ppem) return 0;
7948 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7949 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7950 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7951 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7953 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7955 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7956 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7957 [FT_Bitmap_Size structure includes y_ppem field])
7959 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
7962 CFLAGS="$_SAVE_CFLAGS"
7965 _SAVE_CPPFLAGS="$CPPFLAGS"
7966 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7967 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7968 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7969 CPPFLAGS="$_SAVE_CPPFLAGS"
7971 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7974 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
7976 if test "$MOZ_PANGO"; then
7977 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
7978 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
7980 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
7981 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
7986 dnl ========================================================
7987 dnl Check for pixman and cairo
7988 dnl ========================================================
7990 if test "$MOZ_WIDGET_TOOLKIT" = "gtk3" ; then
7991 # cairo-gtk3 can be build with system-cairo only
7997 MOZ_ARG_ENABLE_BOOL(system-cairo,
7998 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8003 MOZ_ARG_ENABLE_BOOL(system-pixman,
8004 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8006 MOZ_TREE_PIXMAN=force,
8009 # System cairo depends on system pixman
8010 if test "$MOZ_TREE_PIXMAN" = "force"; then
8011 if test -z "$MOZ_TREE_CAIRO"; then
8012 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
8016 elif test -z "$MOZ_TREE_CAIRO"; then
8020 if test "$MOZ_TREE_PIXMAN"; then
8021 AC_DEFINE(MOZ_TREE_PIXMAN)
8022 MOZ_PIXMAN_CFLAGS=""
8023 MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8025 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8026 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8027 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8029 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8030 AC_SUBST(MOZ_PIXMAN_LIBS)
8032 # Check for headers defining standard int types.
8033 if test -n "$COMPILE_ENVIRONMENT"; then
8034 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8036 if test "${ac_cv_header_inttypes_h}" = "yes"; then
8041 AC_SUBST(HAVE_INTTYPES_H)
8043 if test "$MOZ_TREE_CAIRO"; then
8044 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8045 AC_DEFINE(MOZ_TREE_CAIRO)
8047 if test "$OS_ARCH" = "WINNT"; then
8048 # For now we assume that we will have a uint64_t available through
8049 # one of the above headers or mozstdint.h.
8050 AC_DEFINE(HAVE_UINT64_T)
8053 # Define macros for cairo-features.h
8054 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8055 if test "$MOZ_X11"; then
8056 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8057 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8058 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8059 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8060 MOZ_ENABLE_CAIRO_FT=1
8061 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8063 case "$MOZ_WIDGET_TOOLKIT" in
8065 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8068 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8069 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8070 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8073 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8074 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8075 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8076 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8077 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8078 MOZ_ENABLE_D2D_SURFACE=1
8079 MOZ_ENABLE_DWRITE_FONT=1
8081 WIN32_DWRITE_FONT_FEATURE=
8082 WIN32_D2D_SURFACE_FEATURE=
8085 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8087 dnl D3D10 Layers depend on D2D Surfaces.
8088 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8089 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8093 AC_MSG_ERROR([cairo-gtk3 toolkit is incompatible with in-tree cairo. Please add --enable-system-cairo to your build config.])
8096 if test "$USE_FC_FREETYPE"; then
8097 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8099 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8100 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8101 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8102 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8103 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8104 AC_SUBST(CAIRO_FT_CFLAGS)
8106 AC_SUBST(PS_SURFACE_FEATURE)
8107 AC_SUBST(PDF_SURFACE_FEATURE)
8108 AC_SUBST(SVG_SURFACE_FEATURE)
8109 AC_SUBST(XLIB_SURFACE_FEATURE)
8110 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8111 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8112 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8113 AC_SUBST(WIN32_SURFACE_FEATURE)
8114 AC_SUBST(OS2_SURFACE_FEATURE)
8115 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8116 AC_SUBST(FT_FONT_FEATURE)
8117 AC_SUBST(FC_FONT_FEATURE)
8118 AC_SUBST(WIN32_FONT_FEATURE)
8119 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8120 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8121 AC_SUBST(QUARTZ_FONT_FEATURE)
8122 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8123 AC_SUBST(QT_SURFACE_FEATURE)
8124 AC_SUBST(TEE_SURFACE_FEATURE)
8126 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8128 if test "$MOZ_X11"; then
8129 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8132 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8134 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8135 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8136 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8137 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8138 if test "$MOZ_X11"; then
8139 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8140 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8141 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8142 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8146 AC_SUBST(MOZ_TREE_CAIRO)
8147 AC_SUBST(MOZ_CAIRO_CFLAGS)
8148 AC_SUBST(MOZ_CAIRO_LIBS)
8149 AC_SUBST(MOZ_CAIRO_OSLIBS)
8150 AC_SUBST(MOZ_TREE_PIXMAN)
8152 dnl ========================================================
8154 dnl ========================================================
8155 if test "$MOZ_ENABLE_SKIA"; then
8156 AC_DEFINE(MOZ_ENABLE_SKIA)
8158 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8159 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8162 if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" ; then
8163 MOZ_ENABLE_SKIA_GPU=1
8164 AC_DEFINE(USE_SKIA_GPU)
8165 AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8168 AC_SUBST(MOZ_ENABLE_SKIA)
8170 dnl ========================================================
8172 dnl ========================================================
8173 MOZ_ARG_DISABLE_BOOL(xul,
8174 [ --disable-xul Disable XUL],
8176 if test "$MOZ_XUL"; then
8179 dnl remove extensions that require XUL
8180 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
8185 dnl ========================================================
8186 dnl disable profile locking
8187 dnl do no use this in applications that can have more than
8188 dnl one process accessing the profile directory.
8189 dnl ========================================================
8190 MOZ_ARG_DISABLE_BOOL(profilelocking,
8191 [ --disable-profilelocking
8192 Disable profile locking],
8193 MOZ_PROFILELOCKING=,
8194 MOZ_PROFILELOCKING=1 )
8195 if test "$MOZ_PROFILELOCKING"; then
8196 AC_DEFINE(MOZ_PROFILELOCKING)
8199 dnl ========================================================
8200 dnl necko configuration options
8201 dnl ========================================================
8204 dnl option to disable various necko protocols
8206 MOZ_ARG_ENABLE_STRING(necko-protocols,
8207 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8208 Enable/disable specific protocol handlers],
8209 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8210 if test "$option" = "yes" -o "$option" = "all"; then
8211 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8212 elif test "$option" = "no" -o "$option" = "none"; then
8214 elif test "$option" = "default"; then
8215 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8216 elif test `echo "$option" | grep -c \^-` != 0; then
8217 option=`echo $option | sed 's/^-//'`
8218 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8220 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8223 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8225 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8226 AC_SUBST_SET(NECKO_PROTOCOLS)
8227 for p in $NECKO_PROTOCOLS; do
8228 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8229 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8233 dnl option to disable necko's wifi scanner
8236 case "$OS_TARGET" in
8238 if test -n "$gonkdir"; then
8242 Darwin|FreeBSD|SunOS|WINNT)
8251 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8252 [ --disable-necko-wifi Disable necko wifi scanner],
8256 if test "$NECKO_WIFI"; then
8257 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
8258 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
8260 AC_DEFINE(NECKO_WIFI)
8261 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8263 AC_SUBST(NECKO_WIFI)
8264 AC_SUBST(NECKO_WIFI_DBUS)
8267 dnl option to disable cookies
8269 MOZ_ARG_DISABLE_BOOL(cookies,
8270 [ --disable-cookies Disable cookie support],
8273 AC_SUBST(NECKO_COOKIES)
8274 if test "$NECKO_COOKIES"; then
8275 AC_DEFINE(NECKO_COOKIES)
8276 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8280 dnl Always build Marionette if not Android or B2G
8282 if test "$OS_TARGET" != Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
8283 AC_DEFINE(ENABLE_MARIONETTE)
8285 AC_SUBST(ENABLE_MARIONETTE)
8286 if test "$ENABLE_MARIONETTE"; then
8287 AC_DEFINE(ENABLE_MARIONETTE)
8291 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8293 MOZ_ARG_DISABLE_BOOL(ctypes,
8294 [ --disable-ctypes Disable js-ctypes],
8297 AC_SUBST(BUILD_CTYPES)
8298 if test "$BUILD_CTYPES"; then
8299 AC_DEFINE(BUILD_CTYPES)
8302 dnl Build Places if required
8303 if test "$MOZ_PLACES"; then
8304 AC_DEFINE(MOZ_PLACES)
8307 dnl Build SocialAPI if required
8308 if test "$MOZ_SOCIAL"; then
8309 AC_DEFINE(MOZ_SOCIAL)
8312 dnl Build Common JS modules provided by services.
8313 AC_SUBST(MOZ_SERVICES_COMMON)
8314 if test -n "$MOZ_SERVICES_COMMON"; then
8315 AC_DEFINE(MOZ_SERVICES_COMMON)
8318 dnl Build Services crypto component (used by Sync)
8319 AC_SUBST(MOZ_SERVICES_CRYPTO)
8320 if test -n "$MOZ_SERVICES_CRYPTO"; then
8321 AC_DEFINE(MOZ_SERVICES_CRYPTO)
8324 dnl Build Firefox Health Reporter Service
8325 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8326 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8327 AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8330 dnl Build Services metrics component
8331 AC_SUBST(MOZ_SERVICES_METRICS)
8332 if test -n "$MOZ_SERVICES_METRICS"; then
8333 AC_DEFINE(MOZ_SERVICES_METRICS)
8336 dnl Build Notifications if required
8337 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8338 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8339 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8342 dnl Build Sync Services if required
8343 AC_SUBST(MOZ_SERVICES_SYNC)
8344 if test -n "$MOZ_SERVICES_SYNC"; then
8345 AC_DEFINE(MOZ_SERVICES_SYNC)
8348 dnl Build Captive Portal Detector if required
8349 AC_SUBST(MOZ_CAPTIVEDETECT)
8350 if test -n "$MOZ_CAPTIVEDETECT"; then
8351 AC_DEFINE(MOZ_CAPTIVEDETECT)
8354 dnl Build second screen and casting features for external devices if required
8355 AC_SUBST(MOZ_DEVICES)
8356 if test -n "$MOZ_DEVICES"; then
8357 AC_DEFINE(MOZ_DEVICES)
8360 dnl ========================================================
8361 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8362 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8365 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8366 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8369 if test "$MOZ_APP_COMPONENT_MODULES"; then
8370 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8373 dnl ========================================================
8375 dnl = Maintainer debug option (no --enable equivalent)
8377 dnl ========================================================
8382 AC_SUBST(AR_EXTRACT)
8386 AC_SUBST(AS_DASH_C_FLAG)
8395 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8396 AC_SUBST(MOZ_UPDATE_XTERM)
8397 AC_SUBST(MOZ_AUTH_EXTENSION)
8398 AC_SUBST(MOZ_PERMISSIONS)
8399 AC_SUBST(MOZ_PREF_EXTENSIONS)
8400 AC_SUBST(MOZ_JS_LIBS)
8402 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8403 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8404 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8405 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8406 AC_SUBST(WARNINGS_AS_ERRORS)
8407 AC_SUBST(MOZ_EXTENSIONS)
8408 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8411 AC_SUBST(MOZ_INSTRUMENTS)
8412 AC_SUBST(MOZ_CALLGRIND)
8414 AC_SUBST(MOZ_PROFILING)
8416 AC_SUBST(MOZ_PLACES)
8417 AC_SUBST(MOZ_SOCIAL)
8418 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8420 AC_SUBST(NS_PRINTING)
8422 AC_SUBST(MOZ_HELP_VIEWER)
8423 AC_SUBST(TOOLCHAIN_PREFIX)
8432 AC_SUBST(MOZ_PROFILELOCKING)
8434 AC_SUBST(ENABLE_TESTS)
8435 AC_SUBST(MOZ_UNIVERSALCHARDET)
8436 AC_SUBST(ACCESSIBILITY)
8437 AC_SUBST(MOZ_SPELLCHECK)
8438 AC_SUBST(MOZ_ANDROID_OMTC)
8439 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8440 AC_SUBST(MOZ_CRASHREPORTER)
8441 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8442 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8443 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8444 AC_SUBST(MOZ_STUB_INSTALLER)
8445 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8446 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8447 AC_SUBST(MOZ_UPDATER)
8449 AC_SUBST(MOZ_ANGLE_RENDERER)
8450 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
8451 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
8452 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
8453 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
8454 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8455 AC_SUBST(MOZ_D3DCOMPILER_XP_DLL)
8456 AC_SUBST(MOZ_D3DCOMPILER_XP_CAB)
8460 AC_SUBST(MOZ_ANDROID_HISTORY)
8461 AC_SUBST(MOZ_WEBSMS_BACKEND)
8462 AC_SUBST(MOZ_ANDROID_BEAM)
8463 AC_SUBST(MOZ_LOCALE_SWITCHER)
8464 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
8465 AC_SUBST(MOZ_ANDROID_SEARCH_ACTIVITY)
8466 AC_SUBST(MOZ_ANDROID_MLS_STUMBLER)
8467 AC_SUBST(ENABLE_STRIP)
8468 AC_SUBST(PKG_SKIP_STRIP)
8469 AC_SUBST(STRIP_FLAGS)
8470 AC_SUBST(USE_ELF_HACK)
8471 AC_SUBST(INCREMENTAL_LINKER)
8472 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8473 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8475 AC_SUBST(MOZ_FIX_LINK_PATHS)
8476 AC_SUBST(XPCOM_LIBS)
8477 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8478 AC_SUBST(XPCOM_GLUE_LDOPTS)
8479 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8480 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8481 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8483 AC_SUBST(USE_DEPENDENT_LIBS)
8485 AC_SUBST(MOZ_BUILD_ROOT)
8487 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8488 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8489 AC_SUBST(MOZ_LINKER_EXTRACT)
8491 AC_SUBST(MOZ_JSDOWNLOADS)
8492 if test -n "$MOZ_JSDOWNLOADS"; then
8493 AC_DEFINE(MOZ_JSDOWNLOADS)
8496 dnl ========================================================
8497 dnl = Mac bundle name prefix
8498 dnl ========================================================
8499 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8500 [ --with-macbundlename-prefix=prefix
8501 Prefix for MOZ_MACBUNDLE_NAME],
8502 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8504 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8505 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8506 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8509 if test "$MOZ_DEBUG"; then
8510 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8512 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8514 AC_SUBST(MOZ_MACBUNDLE_NAME)
8516 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8517 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8518 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8519 if test "$MOZ_DEBUG"; then
8520 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8523 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8524 AC_SUBST(MOZ_MACBUNDLE_ID)
8526 dnl ========================================================
8527 dnl = Child Process Name for IPC
8528 dnl ========================================================
8529 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8530 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8532 # We want to let Android unpack the file at install time, but it only does
8533 # so if the file is named libsomething.so. The lib/ path is also required
8534 # because the unpacked file will be under the lib/ subdirectory and will
8535 # need to be executed from that path.
8536 MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8538 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8540 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8541 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8543 # The following variables are available to branding and application
8544 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8545 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8546 # impacts profile location and user-visible fields.
8547 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8548 # versions of a given application (e.g. Aurora and Firefox both use
8549 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8550 # for application.ini's "Name" field, which controls profile location in
8551 # the absence of a "Profile" field (see below), and various system
8552 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8553 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8554 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8555 # builds (e.g. Aurora for Firefox).
8556 # - MOZ_APP_VERSION: Defines the application version number.
8557 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8558 # defaults to a lowercase form of MOZ_APP_BASENAME.
8559 # - MOZ_APP_PROFILE: When set, used for application.ini's
8560 # "Profile" field, which controls profile location.
8561 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8562 # crash reporter server url.
8563 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8564 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8566 if test -z "$MOZ_APP_NAME"; then
8567 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8570 # For extensions and langpacks, we require a max version that is compatible
8571 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8572 # 24.0a1 and 24.0a2 aren't affected
8574 # 24.1.1 becomes 24.*
8575 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8576 if test -z "$IS_ALPHA"; then
8578 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
8581 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8584 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8585 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8586 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8588 AC_SUBST(MOZ_APP_NAME)
8589 AC_SUBST(MOZ_APP_DISPLAYNAME)
8590 AC_SUBST(MOZ_APP_BASENAME)
8591 AC_SUBST(MOZ_APP_VENDOR)
8592 AC_SUBST(MOZ_APP_PROFILE)
8593 AC_SUBST(MOZ_APP_ID)
8594 AC_SUBST(MAR_CHANNEL_ID)
8595 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8596 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8597 AC_SUBST(MOZ_EXTENSION_MANAGER)
8598 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8599 AC_SUBST(MOZ_APP_UA_NAME)
8600 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8601 AC_SUBST(MOZ_APP_VERSION)
8602 AC_SUBST(MOZ_APP_MAXVERSION)
8603 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8604 AC_SUBST(FIREFOX_VERSION)
8605 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8606 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8607 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8610 AC_SUBST(MOZ_APP_STATIC_INI)
8612 AC_SUBST(MOZ_PKG_SPECIAL)
8614 AC_SUBST(MOZILLA_OFFICIAL)
8616 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8617 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8619 if test "$MOZ_TELEMETRY_REPORTING"; then
8620 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8622 # Enable Telemetry by default for nightly and aurora channels
8623 if test -z "$RELEASE_BUILD"; then
8624 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8628 dnl If we have any service that uploads data (and requires data submission
8629 dnl policy alert), set MOZ_DATA_REPORTING.
8630 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8631 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8632 MOZ_DATA_REPORTING=1
8633 AC_DEFINE(MOZ_DATA_REPORTING)
8634 AC_SUBST(MOZ_DATA_REPORTING)
8638 AC_SUBST(MOZ_BROWSE_INFO)
8639 AC_SUBST(MOZ_TOOLS_DIR)
8640 AC_SUBST(WIN32_REDIST_DIR)
8643 dnl Echo the CFLAGS to remove extra whitespace.
8649 $_WARNINGS_CXXFLAGS \
8652 COMPILE_CFLAGS=`echo \
8657 COMPILE_CXXFLAGS=`echo \
8658 $_DEFINES_CXXFLAGS \
8666 HOST_CXXFLAGS=`echo \
8670 AC_SUBST(MOZ_NATIVE_JPEG)
8671 AC_SUBST(MOZ_NATIVE_PNG)
8672 AC_SUBST(MOZ_NATIVE_BZ2)
8674 AC_SUBST(MOZ_JPEG_CFLAGS)
8675 AC_SUBST(MOZ_JPEG_LIBS)
8676 AC_SUBST(MOZ_BZ2_CFLAGS)
8677 AC_SUBST(MOZ_BZ2_LIBS)
8678 AC_SUBST(MOZ_PNG_CFLAGS)
8679 AC_SUBST(MOZ_PNG_LIBS)
8681 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
8682 export MOZ_NUWA_PROCESS
8683 AC_DEFINE(MOZ_NUWA_PROCESS)
8685 AC_SUBST(MOZ_NUWA_PROCESS)
8687 AC_SUBST(NSPR_CFLAGS)
8689 AC_SUBST(MOZ_NATIVE_NSPR)
8691 AC_SUBST(NSS_CFLAGS)
8693 AC_SUBST(MOZ_NATIVE_NSS)
8694 AC_SUBST(NSS_DISABLE_DBM)
8697 OS_CXXFLAGS="$CXXFLAGS"
8698 OS_CPPFLAGS="$CPPFLAGS"
8699 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8700 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8701 OS_LDFLAGS="$LDFLAGS"
8704 AC_SUBST(OS_CXXFLAGS)
8705 AC_SUBST(OS_CPPFLAGS)
8706 AC_SUBST(OS_COMPILE_CFLAGS)
8707 AC_SUBST(OS_COMPILE_CXXFLAGS)
8708 AC_SUBST(OS_LDFLAGS)
8710 AC_SUBST(CROSS_COMPILE)
8711 AC_SUBST(WCHAR_CFLAGS)
8715 AC_SUBST(HOST_CFLAGS)
8716 AC_SUBST(HOST_CXXFLAGS)
8717 AC_SUBST(HOST_LDFLAGS)
8718 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8720 AC_SUBST(HOST_AR_FLAGS)
8722 AC_SUBST(HOST_RANLIB)
8723 AC_SUBST(HOST_NSPR_MDCPUCFG)
8724 AC_SUBST(HOST_BIN_SUFFIX)
8725 AC_SUBST(HOST_OS_ARCH)
8727 AC_SUBST(TARGET_CPU)
8728 AC_SUBST(TARGET_VENDOR)
8730 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8731 AC_SUBST(TARGET_MD_ARCH)
8732 AC_SUBST(TARGET_XPCOM_ABI)
8735 AC_SUBST(OS_RELEASE)
8738 AC_SUBST(INTEL_ARCHITECTURE)
8739 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
8740 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
8741 AC_SUBST(GCC_USE_GNU_LD)
8743 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8745 AC_SUBST(WRAP_LDFLAGS)
8748 AC_SUBST(MKSHLIB_FORCE_ALL)
8749 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8750 AC_SUBST(DSO_CFLAGS)
8751 AC_SUBST(DSO_PIC_CFLAGS)
8752 AC_SUBST(DSO_LDOPTS)
8753 AC_SUBST(LIB_PREFIX)
8754 AC_SUBST(DLL_PREFIX)
8755 AC_SUBST(DLL_SUFFIX)
8756 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8757 AC_SUBST(LIB_SUFFIX)
8758 AC_SUBST(OBJ_SUFFIX)
8759 AC_SUBST(BIN_SUFFIX)
8760 AC_SUBST(ASM_SUFFIX)
8761 AC_SUBST(IMPORT_LIB_SUFFIX)
8763 AC_SUBST(CC_VERSION)
8764 AC_SUBST(CXX_VERSION)
8765 AC_SUBST(MSMANIFEST_TOOL)
8766 AC_SUBST(NS_ENABLE_TSF)
8767 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8770 AC_SUBST(MOZ_VORBIS)
8771 AC_SUBST(MOZ_TREMOR)
8775 AC_SUBST(MOZ_FFMPEG)
8778 AC_SUBST(MOZ_DIRECTSHOW)
8779 AC_SUBST(MOZ_ANDROID_OMX)
8780 AC_SUBST(MOZ_APPLEMEDIA)
8781 AC_SUBST(MOZ_OMX_PLUGIN)
8782 AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
8785 AC_SUBST(VPX_ASFLAGS)
8786 AC_SUBST(VPX_DASH_C_FLAG)
8787 AC_SUBST(VPX_AS_CONVERSION)
8788 AC_SUBST(VPX_ASM_SUFFIX)
8789 AC_SUBST(VPX_X86_ASM)
8790 AC_SUBST(VPX_ARM_ASM)
8791 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8792 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8793 AC_SUBST(LIBJPEG_TURBO_AS)
8794 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8795 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8796 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8797 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8799 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8800 AC_SUBST(MOZ_FOLD_LIBS)
8802 AC_SUBST(MOZ_ENABLE_SZIP)
8803 AC_SUBST(MOZ_SZIP_FLAGS)
8805 if test "$MOZ_DEBUG"; then
8808 AC_SUBST(MOZ_EM_DEBUG)
8810 if test -n "$COMPILE_ENVIRONMENT"; then
8811 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
8813 dnl Check for missing components
8814 if test "$MOZ_X11"; then
8815 if test "$WITHOUT_X11"; then
8816 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8818 dnl ====================================================
8819 dnl = Check if X headers exist
8820 dnl ====================================================
8821 _SAVE_CFLAGS=$CFLAGS
8822 CFLAGS="$CFLAGS $XCFLAGS"
8826 #include <X11/Xlib.h>
8827 #include <X11/Intrinsic.h>
8828 #include <X11/extensions/XShm.h>
8832 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8833 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8837 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
8838 CFLAGS="$_SAVE_CFLAGS"
8840 if test -n "$MISSING_X"; then
8841 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8846 fi # COMPILE_ENVIRONMENT
8848 dnl Set various defines and substitutions
8849 dnl ========================================================
8851 if test "$OS_ARCH" != "WINNT"; then
8855 if test "$MOZ_DEBUG"; then
8856 AC_DEFINE(MOZ_REFLOW_PERF)
8857 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8860 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
8861 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8862 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8863 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8864 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8865 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8866 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8867 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8868 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8871 if test "$MOZ_DEBUG"; then
8874 case "$MOZ_UPDATE_CHANNEL" in
8875 aurora|beta|release|esr)
8882 if test -n "$A11Y_LOG"; then
8886 AC_SUBST(MOZILLA_VERSION)
8888 AC_SUBST(ac_configure_args)
8890 dnl Spit out some output
8891 dnl ========================================================
8893 dnl The following defines are used by xpcom
8894 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8896 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8897 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8898 HAVE_CPP_PARTIAL_SPECIALIZATION
8899 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8900 NEED_CPP_UNUSED_IMPLEMENTATIONS
8903 HAVE_ICONV_WITH_CONST_INPUT
8916 AC_SUBST(STLPORT_LIBS)
8918 dnl ========================================================
8920 dnl ========================================================
8922 # Internationalization isn't built or exposed by default in non-desktop
8923 # builds. Bugs to enable:
8925 # Android: bug 864843
8928 if test "$MOZ_WIDGET_TOOLKIT" = "android" ||
8929 test "$MOZ_BUILD_APP" = "b2g"; then
8937 if test -n "$MOZ_NATIVE_ICU"; then
8938 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_ICU_LIBS"
8941 if test -n "$JS_SHARED_LIBRARY"; then
8942 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
8944 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
8945 AC_DEFINE(MOZ_STATIC_JS)
8947 AC_SUBST(JS_SHARED_LIBRARY)
8949 AC_SUBST(UPLOAD_EXTRA_FILES)
8951 MOZ_CREATE_CONFIG_STATUS()
8953 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8954 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8955 MOZ_SUBCONFIGURE_ICU()
8956 MOZ_SUBCONFIGURE_FFI()
8959 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8960 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8961 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8962 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8963 # (apparently) only need this hack when egrep's "pattern" is particularly long
8964 # (as in the following code) and the first egrep on our $PATH is Apple's. See
8968 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8975 # Run jemalloc configure script
8977 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
8978 ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
8979 if test -n "$MOZ_REPLACE_MALLOC"; then
8980 # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
8981 ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
8982 ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
8984 if test -n "$MOZ_JEMALLOC3"; then
8985 case "${OS_ARCH}" in
8987 # We want jemalloc functions to be kept hidden on both Mac and Windows
8988 # See memory/build/mozmemory_wrap.h for details.
8989 ac_configure_args="$ac_configure_args --without-export"
8992 elif test "${OS_ARCH}" = Darwin; then
8993 # When building as a replace-malloc lib, disabling the zone allocator
8994 # forces to use pthread_atfork.
8995 ac_configure_args="$ac_configure_args --disable-zone-allocator"
8997 _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
8999 if test -z "$MOZ_REPLACE_MALLOC"; then
9001 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9005 elif test -z "$MOZ_JEMALLOC3"; then
9007 JEMALLOC_WRAPPER=replace_
9009 if test -n "$MANGLE"; then
9011 if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
9012 JEMALLOC_WRAPPER=__wrap_
9014 for mangle in ${MANGLE}; do
9015 if test -n "$MANGLED"; then
9016 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9018 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9021 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9024 if test -z "$MOZ_TLS"; then
9025 ac_configure_args="$ac_configure_args --disable-tls"
9027 EXTRA_CFLAGS="$CFLAGS"
9028 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9029 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9031 if test "$CROSS_COMPILE"; then
9032 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9035 if ! test -e memory/jemalloc; then
9036 mkdir -p memory/jemalloc
9039 dnl jemalloc's configure uses $srcdir in AC_CONFIG_HEADERS, which syntax uses
9040 dnl colons, conflicting with the windows-style path in $srcdir.
9041 dnl Turn it into a msys path just for jemalloc's configure
9042 _save_srcdir="$srcdir"
9043 srcdir=`cd $srcdir; pwd`
9044 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9045 srcdir="$_save_srcdir"
9046 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9049 # Run freetype configure script
9051 if test "$MOZ_TREE_FREETYPE"; then
9052 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9053 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9054 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9055 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9056 # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
9057 # to force freetype to use our settings rather than autodetecting
9058 export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
9059 export LIBPNG_LIBS="$MOZ_PNG_LIBS "
9060 export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
9061 export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
9062 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9063 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
9065 if ! test -e modules; then
9069 AC_OUTPUT_SUBDIRS(modules/freetype2,$cache_file)
9072 if test -z "$direct_nspr_config"; then
9073 dnl ========================================================
9074 dnl = Setup a nice relatively clean build environment for
9075 dnl = sub-configures.
9076 dnl ========================================================
9079 CFLAGS="$_SUBDIR_CFLAGS"
9080 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9081 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9082 LDFLAGS="$_SUBDIR_LDFLAGS"
9083 HOST_CC="$_SUBDIR_HOST_CC"
9084 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9085 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9086 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9093 # Run all configure scripts specified by a subconfigure
9094 if test -n "$_subconfigure_subdir"; then
9095 _save_ac_configure_args="$ac_configure_args"
9096 ac_configure_args="$_subconfigure_config_args"
9097 AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
9098 ac_configure_args="$_save_ac_configure_args"
9101 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9102 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9106 if test -n "$_WRAP_MALLOC"; then
9107 # Avoid doubling wrap malloc arguments
9108 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9111 MOZ_SUBCONFIGURE_NSPR()
9113 dnl ========================================================
9114 dnl = Setup a nice relatively clean build environment for
9115 dnl = sub-configures.
9116 dnl ========================================================
9119 CFLAGS="$_SUBDIR_CFLAGS"
9120 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9121 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9122 LDFLAGS="$_SUBDIR_LDFLAGS"
9123 HOST_CC="$_SUBDIR_HOST_CC"
9124 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9125 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9126 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9129 if test -n "$ENABLE_CLANG_PLUGIN"; then
9130 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9131 AC_OUTPUT_SUBDIRS(build/clang-plugin)
9134 # Run the SpiderMonkey 'configure' script.
9135 dist=$MOZ_BUILD_ROOT/dist
9136 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9138 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
9140 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
9142 ac_configure_args="$ac_configure_args --enable-threadsafe"
9144 if test "$_INTL_API" = no; then
9145 ac_configure_args="$ac_configure_args --without-intl-api"
9148 if test "$BUILD_CTYPES"; then
9149 # Build js-ctypes on the platforms we can.
9150 ac_configure_args="$ac_configure_args --enable-ctypes"
9152 if test -z "$JS_SHARED_LIBRARY" ; then
9153 ac_configure_args="$ac_configure_args --disable-shared-js"
9154 if test -n "$MOZ_DISABLE_EXPORT_JS"; then
9155 ac_configure_args="$ac_configure_args --disable-export-js"
9158 if test -z "$JSGC_USE_EXACT_ROOTING" ; then
9159 ac_configure_args="$ac_configure_args --disable-exact-rooting"
9161 if test -z "$JSGC_GENERATIONAL" ; then
9162 ac_configure_args="$ac_configure_args --disable-gcgenerational"
9164 if test -n "$JS_GC_SMALL_CHUNK_SIZE" ; then
9165 ac_configure_args="$ac_configure_args --enable-small-chunk-size"
9167 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
9168 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9169 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9171 ac_configure_args="$ac_configure_args --prefix=$dist"
9172 if test "$MOZ_MEMORY"; then
9173 ac_configure_args="$ac_configure_args --enable-jemalloc"
9175 if test -n "$MOZ_GLUE_LDFLAGS"; then
9176 export MOZ_GLUE_LDFLAGS
9178 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9179 export MOZ_GLUE_PROGRAM_LDFLAGS
9181 if test -n "$ZLIB_IN_MOZGLUE"; then
9184 export MOZ_NATIVE_ZLIB
9185 export MOZ_ZLIB_CFLAGS
9186 export MOZ_ZLIB_LIBS
9188 export DONT_POPULATE_VIRTUALENV=1
9190 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9191 export STLPORT_CPPFLAGS
9192 export STLPORT_LDFLAGS
9194 export JS_STANDALONE=no
9196 export ZLIB_IN_MOZGLUE
9198 if ! test -e js; then
9202 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
9203 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9205 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9207 export WRITE_MOZINFO=1
9208 dnl we need to run config.status after js/src subconfigure because we're
9209 dnl traversing its moz.build and we need its config.status for that.
9210 dnl However, writing our own config.status needs to happen before
9211 dnl subconfigures because the setup surrounding subconfigures alters
9212 dnl many AC_SUBSTed variables.
9213 MOZ_RUN_CONFIG_STATUS()