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)
267 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"
270 MOZ_B2G_BT_BLUEDROID=1
275 AC_DEFINE(MOZ_OMX_ENCODER)
277 AC_SUBST(MOZ_AUDIO_OFFLOAD)
278 AC_DEFINE(MOZ_AUDIO_OFFLOAD)
282 AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
285 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"
286 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
287 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
288 dnl Add -llog by default, since we use it all over the place.
291 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"
293 dnl prevent cross compile section from using these flags as host flags
294 if test -z "$HOST_CPPFLAGS" ; then
297 if test -z "$HOST_CFLAGS" ; then
300 if test -z "$HOST_CXXFLAGS" ; then
303 if test -z "$HOST_LDFLAGS" ; then
308 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
309 AC_SUBST(ANDROID_VERSION)
310 AC_DEFINE(HAVE_SYS_UIO_H)
311 AC_DEFINE(HAVE_PTHREADS)
312 MOZ_CHROME_FILE_FORMAT=omni
318 *-android*|*-linuxandroid*)
319 if test -z "$ANDROID_PACKAGE_NAME" ; then
320 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
322 MOZ_CHROME_FILE_FORMAT=omni
326 AC_PATH_PROG(OBJCOPY,objcopy)
331 AC_SUBST(ANDROID_SOURCE)
332 AC_SUBST(ANDROID_PACKAGE_NAME)
335 dnl ========================================================
336 dnl Checks for compilers.
337 dnl ========================================================
339 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
342 if test "$COMPILE_ENVIRONMENT"; then
344 if test "$target" != "$host"; then
350 # Work around the conftest.exe access problem on Windows
355 MOZ_PATH_PROGS(AS, $AS as, $CC)
356 AC_CHECK_PROGS(AR, ar, :)
357 AC_CHECK_PROGS(LD, ld, :)
358 AC_CHECK_PROGS(STRIP, strip, :)
359 AC_CHECK_PROGS(WINDRES, windres, :)
360 if test -z "$HOST_CC"; then
363 if test -z "$HOST_CFLAGS"; then
364 HOST_CFLAGS="$CFLAGS"
366 if test -z "$HOST_CXX"; then
369 if test -z "$HOST_CXXFLAGS"; then
370 HOST_CXXFLAGS="$CXXFLAGS"
372 if test -z "$HOST_LDFLAGS"; then
373 HOST_LDFLAGS="$LDFLAGS"
375 if test -z "$HOST_RANLIB"; then
376 HOST_RANLIB="$RANLIB"
378 if test -z "$HOST_AR"; then
381 if test -z "$HOST_AR_FLAGS"; then
382 HOST_AR_FLAGS="$AR_FLAGS"
386 if test -n "$MOZ_WINCONSOLE"; then
387 AC_DEFINE(MOZ_WINCONSOLE)
392 MOZ_CHECK_COMPILER_WRAPPER
394 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
395 if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
396 test "$GCC_MAJOR_VERSION" -lt 4; then
397 AC_MSG_ERROR([Only GCC 4.4 or newer supported])
401 dnl ========================================================
402 dnl Special win32 checks
403 dnl ========================================================
405 MOZ_ARG_ENABLE_BOOL(metro,
406 [ --enable-metro Enable Windows Metro build targets],
409 if test -n "$MOZ_METRO"; then
411 # Target the Windows 8 Kit
414 # toolkit/library/makefile.in needs these, see nsDllMain.
416 CRTEXPDLLVERSION=1-1-0
418 # Target the Windows 7 SDK by default
423 AC_SUBST(CRTDLLVERSION)
424 AC_SUBST(CRTEXPDLLVERSION)
426 MOZ_ARG_WITH_STRING(windows-version,
427 [ --with-windows-version=WINSDK_TARGETVER
428 Windows SDK version to target. Lowest version
429 currently allowed is 601 (Win7), highest is 602 (Win8)],
430 WINSDK_TARGETVER=$withval)
432 # Currently only two sdk versions allowed, 601 and 602
433 case "$WINSDK_TARGETVER" in
435 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
439 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
445 if test "$GCC" != "yes"; then
446 # Check to see if we are really running in a msvc environemnt
448 AC_CHECK_PROGS(MIDL, midl)
450 # Make sure compilers are valid
451 CFLAGS="$CFLAGS -TC -nologo"
452 CXXFLAGS="$CXXFLAGS -TP -nologo"
455 AC_TRY_COMPILE([#include <stdio.h>],
456 [ printf("Hello World\n"); ],,
457 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
460 AC_TRY_COMPILE([#include <new.h>],
461 [ unsigned *test = new unsigned(42); ],,
462 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
466 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
469 # Determine compiler version
470 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | cut -c 1-2`
471 _CC_MINOR_VERSION=`echo ${CC_VERSION} | cut -c 3-4`
472 _MSC_VER=${CC_VERSION}
474 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | cut -c 1-2`
476 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
477 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
480 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
481 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
483 if test "$_CC_MAJOR_VERSION" = "16"; then
486 MSVC_C_RUNTIME_DLL=msvcr100.dll
487 MSVC_CXX_RUNTIME_DLL=msvcp100.dll
488 elif test "$_CC_MAJOR_VERSION" = "17"; then
491 MSVC_C_RUNTIME_DLL=msvcr110.dll
492 MSVC_CXX_RUNTIME_DLL=msvcp110.dll
493 elif test "$_CC_MAJOR_VERSION" = "18"; then
496 MSVC_C_RUNTIME_DLL=msvcr120.dll
497 MSVC_CXX_RUNTIME_DLL=msvcp120.dll
499 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
501 AC_SUBST(MSVS_VERSION)
502 AC_SUBST(MSVC_C_RUNTIME_DLL)
503 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
505 # Disable SEH on clang-cl because it doesn't implement them yet.
506 if test -z "$CLANG_CL"; then
507 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
509 AC_DEFINE_UNQUOTED(GTEST_HAS_SEH, 0)
512 if test -n "$WIN32_REDIST_DIR"; then
513 if test ! -d "$WIN32_REDIST_DIR"; then
514 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
516 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
519 dnl Confirm we have the pri tools on win8 builds
520 if test -n "$MOZ_METRO"; then
521 AC_MSG_CHECKING([for makepri])
522 AC_CHECK_PROGS(MAKEPRI, makepri, "")
523 if test -z "MAKEPRI" ; then
524 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
529 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
530 dnl not something else like "magnetic tape manipulation utility".
531 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
532 if test -z "$MSMT_TOOL"; then
533 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
537 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
539 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
540 if test -z "$MSMANIFEST_TOOL_VERSION"; then
541 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
547 # Check linker version
548 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
549 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
550 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
551 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
556 # Set midl environment
559 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
562 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
566 unset _MSVC_VER_FILTER
568 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
572 _SAVE_CXXFLAGS="$CXXFLAGS"
573 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
574 AC_TRY_COMPILE([#include <exception>],
575 [std::_Throw(std::exception()); return 0;],
576 ac_cv_have_std__Throw="yes",
577 ac_cv_have_std__Throw="no")
578 CXXFLAGS="$_SAVE_CXXFLAGS"
582 if test "$ac_cv_have_std__Throw" = "yes"; then
583 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
584 ac_cv_have_dllimport_exception_bug,
588 _SAVE_CXXFLAGS="$CXXFLAGS"
589 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
590 AC_TRY_LINK([#include <vector>],
591 [std::vector<int> v; return v.at(1);],
592 ac_cv_have_dllimport_exception_bug="no",
593 ac_cv_have_dllimport_exception_bug="yes")
594 CXXFLAGS="$_SAVE_CXXFLAGS"
597 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
599 MOZ_MSVC_STL_WRAP__Throw=1
600 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
603 AC_CACHE_CHECK(for overridable _RAISE,
608 _SAVE_CXXFLAGS="$CXXFLAGS"
609 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
610 AC_TRY_COMPILE([#include <xstddef>
612 #define _RAISE(x) externallyDefinedFunction((x).what())
615 [std::vector<int> v; return v.at(1);],
616 ac_cv_have__RAISE="no",
617 ac_cv_have__RAISE="yes")
618 CXXFLAGS="$_SAVE_CXXFLAGS"
621 if test "$ac_cv_have__RAISE" = "yes"; then
623 MOZ_MSVC_STL_WRAP__RAISE=1
624 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
626 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
630 if test "$WRAP_STL_INCLUDES" = "1"; then
631 STL_FLAGS='-I$(DIST)/stl_wrappers'
633 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
634 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
636 MOZ_FIND_WINSDK_VERSION
638 # Check w32api version
639 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
640 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
641 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
642 AC_TRY_COMPILE([#include <w32api.h>],
643 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
644 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
645 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
646 #error "test failed."
648 , [ res=yes ], [ res=no ])
649 AC_MSG_RESULT([$res])
650 if test "$res" != "yes"; then
651 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
653 # Check windres version
654 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
655 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
656 AC_MSG_RESULT([$_WINDRES_VERSION])
657 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
658 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
659 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
660 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
661 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
662 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
663 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
664 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
665 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
666 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
667 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
668 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
670 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
673 AC_CHECK_PROGS(MIDL, $target-widl widl)
674 if test -n "$MIDL"; then
677 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
680 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
685 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
686 # causing problems with local implementations with the same name.
687 AC_DEFINE(STRSAFE_NO_DEPRECATE)
689 MOZ_WINSDK_MAXVER=0x06020000
692 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
693 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
694 # Require OS features provided by IE 6.0 SP2 (XP SP2)
695 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
697 # If the maximum version supported by this SDK is lower than the target
699 AC_MSG_CHECKING([for Windows SDK being recent enough])
700 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
704 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.])
707 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
708 # Definitions matching sdkddkver.h
709 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
710 AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
711 AC_SUBST(MOZ_WINSDK_MAXVER)
718 if test -n "$_WIN32_MSVC"; then
720 SKIP_COMPILER_CHECKS=1
721 SKIP_LIBRARY_CHECKS=1
723 # Since we're skipping compiler and library checks, hard-code
726 AC_DEFINE(HAVE_SETBUF)
727 AC_DEFINE(HAVE_ISATTY)
730 fi # COMPILE_ENVIRONMENT
743 AC_SUBST(WRAP_STL_INCLUDES)
744 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
745 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
747 dnl ========================================================
748 dnl Checks for programs.
749 dnl ========================================================
753 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
754 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
755 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
757 AC_MSG_RESULT([$_perl_version])
759 if test "$_perl_res" != 0; then
760 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
764 AC_MSG_CHECKING([for full perl installation])
765 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
767 if test "$_perl_res" != 0; then
769 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
774 if test -z "$COMPILE_ENVIRONMENT"; then
775 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
777 AC_SUBST(NSINSTALL_BIN)
779 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
780 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
781 MOZ_PATH_PROGS(UNZIP, unzip)
782 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
783 AC_MSG_ERROR([unzip not found in \$PATH])
785 MOZ_PATH_PROGS(ZIP, zip)
786 if test -z "$ZIP" -o "$ZIP" = ":"; then
787 AC_MSG_ERROR([zip not found in \$PATH])
789 MOZ_PATH_PROG(XARGS, xargs)
790 if test -z "$XARGS" -o "$XARGS" = ":"; then
791 AC_MSG_ERROR([xargs not found in \$PATH .])
794 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
797 if test "$COMPILE_ENVIRONMENT"; then
799 dnl ========================================================
800 dnl = Mac OS X toolchain support
801 dnl ========================================================
803 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
804 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
805 dnl when we can run target binaries.
806 AC_SUBST(UNIVERSAL_BINARY)
807 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
809 MOZ_ARG_WITH_STRING(unify-dist,
810 [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
812 if test -n "$UNIVERSAL_BINARY"; then
813 if test -z "$UNIFY_DIST"; then
814 AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
816 case "$UNIFY_DIST" in
820 UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
826 dnl ========================================================
827 dnl Check for MacOS deployment target version
828 dnl ========================================================
830 MOZ_ARG_ENABLE_STRING(macos-target,
831 [ --enable-macos-target=VER (default=10.6)
832 Set the minimum MacOS version needed at runtime],
833 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
837 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
838 dnl Use the specified value
839 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
841 dnl No value specified on the command line or in the environment,
842 dnl use architecture minimum.
843 export MACOSX_DEPLOYMENT_TARGET=10.6
848 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
850 dnl ========================================================
851 dnl = Mac OS X SDK support
852 dnl ========================================================
854 MOZ_ARG_WITH_STRING(macos-sdk,
855 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
856 MACOS_SDK_DIR=$withval)
858 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
859 MOZ_ARG_WITH_STRING(macos-private-frameworks,
860 [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)],
861 MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
862 MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
863 MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
865 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
866 if test -z "$CROSS_COMPILE"; then
867 AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
869 if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
870 AC_MSG_ERROR([PrivateFrameworks directory not found.])
874 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
875 AC_SUBST(MACOS_SDK_DIR)
876 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
878 if test "$MACOS_SDK_DIR"; then
879 dnl Sync this section with the ones in NSPR and NSS.
880 dnl Changes to the cross environment here need to be accounted for in
881 dnl the libIDL checks (below) and xpidl build.
883 if test ! -d "$MACOS_SDK_DIR"; then
884 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
885 specify a valid SDK. SDKs are installed when the optional cross-development
886 tools are selected during the Xcode/Developer Tools installation.])
889 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
890 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
892 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
893 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
894 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
897 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
899 AC_TRY_COMPILE([#include <new>],[],
903 AC_MSG_RESULT($result)
905 if test "$result" = "no" ; then
906 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
910 fi # COMPILE_ENVIRONMENT
912 if test -n "$MAKE"; then
913 if test `echo $MAKE | grep -c make.py` != 1; then
920 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
923 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
926 if test "$GMAKE" = ":"; then
927 AC_MSG_ERROR([GNU make not found])
931 if test -z "$MAKE"; then
935 if test "$COMPILE_ENVIRONMENT"; then
941 fi # COMPILE_ENVIRONMENT
943 dnl ========================================================
944 dnl set the defaults first
945 dnl ========================================================
961 MOZ_USER_DIR=".mozilla"
963 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
969 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
971 if test -n "$CROSS_COMPILE"; then
972 OS_TARGET="${target_os}"
973 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
975 case "${target_os}" in
976 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
977 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU/kFreeBSD ;;
979 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
980 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
981 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
982 dragonfly*) OS_ARCH=DragonFly OS_TARGET=DragonFly ;;
983 freebsd*) OS_ARCH=FreeBSD OS_TARGET=FreeBSD ;;
984 netbsd*) OS_ARCH=NetBSD OS_TARGET=NetBSD ;;
985 openbsd*) OS_ARCH=OpenBSD OS_TARGET=OpenBSD ;;
988 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
992 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
993 OS_RELEASE=`uname -r`
996 # Before this used `uname -m` when not cross compiling
997 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
998 OS_TEST="${target_cpu}"
1000 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1002 #######################################################################
1003 # Master "Core Components" macros for getting the OS target #
1004 #######################################################################
1007 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1008 # cross-compilation.
1012 # Define and override various archtecture-specific variables, including
1021 case "$HOST_OS_ARCH" in
1032 HOST_OS_ARCH=GNU_kFreeBSD
1038 HOST_OS_ARCH=DragonFly
1041 HOST_OS_ARCH=FreeBSD
1047 HOST_OS_ARCH=OpenBSD
1053 if test -z "$GNU_CC"; then
1054 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1059 if test -z "$GNU_CXX"; then
1060 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1061 SOLARIS_SUNPRO_CXX=1
1064 AC_SUBST(SOLARIS_SUNPRO_CC)
1065 AC_SUBST(SOLARIS_SUNPRO_CXX)
1071 if test -z "$CROSS_COMPILE" ; then
1077 # If uname -s returns "Windows_NT", we assume that we are using
1078 # the uname.exe in MKS toolkit.
1080 # The -r option of MKS uname only returns the major version number.
1081 # So we need to use its -v option to get the minor version number.
1082 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1086 OS_MINOR_RELEASE=`uname -v`
1087 if test "$OS_MINOR_RELEASE" = "00"; then
1090 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1094 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1095 # the uname.exe in the MSYS tools.
1097 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1102 OS_RELEASE=`uname -v`.`uname -r`
1103 OS_TEST=${target_cpu}
1106 case "${target_cpu}" in
1117 if test -z "$CROSS_COMPILE" ; then
1125 # Only set CPU_ARCH if we recognize the value of OS_TEST
1132 powerpc64 | ppc64 | powerpc64le | ppc64le)
1136 powerpc | ppc | rs6000)
1140 Alpha | alpha | ALPHA)
1177 if test -z "$OS_TARGET"; then
1180 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1182 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1183 dnl ===============================================================
1187 INTEL_ARCHITECTURE=1
1190 dnl Configure platform-specific CPU architecture compiler options.
1191 dnl ==============================================================
1194 dnl =================================================================
1195 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1196 dnl which is bad when cross compiling.
1197 dnl =================================================================
1198 if test "$COMPILE_ENVIRONMENT"; then
1199 configure_static_assert_macros='
1200 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1201 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1202 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1205 dnl test that the macros actually work:
1206 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1207 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1210 ac_cv_static_assertion_macros_work="yes"
1211 AC_TRY_COMPILE([$configure_static_assert_macros],
1212 [CONFIGURE_STATIC_ASSERT(1)],
1214 ac_cv_static_assertion_macros_work="no")
1215 AC_TRY_COMPILE([$configure_static_assert_macros],
1216 [CONFIGURE_STATIC_ASSERT(0)],
1217 ac_cv_static_assertion_macros_work="no",
1220 AC_TRY_COMPILE([$configure_static_assert_macros],
1221 [CONFIGURE_STATIC_ASSERT(1)],
1223 ac_cv_static_assertion_macros_work="no")
1224 AC_TRY_COMPILE([$configure_static_assert_macros],
1225 [CONFIGURE_STATIC_ASSERT(0)],
1226 ac_cv_static_assertion_macros_work="no",
1230 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1231 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1232 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1234 fi # COMPILE_ENVIRONMENT
1236 dnl ========================================================
1237 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1239 dnl ========================================================
1243 dnl ========================================================
1244 dnl Suppress Clang Argument Warnings
1245 dnl ========================================================
1246 if test -n "$CLANG_CC"; then
1247 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1248 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1250 if test -n "$CLANG_CXX"; then
1251 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1254 dnl ========================================================
1255 dnl = Use Address Sanitizer
1256 dnl ========================================================
1257 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1258 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1261 if test -n "$MOZ_ASAN"; then
1264 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1267 AC_SUBST(LLVM_SYMBOLIZER)
1269 dnl ========================================================
1270 dnl = Enable hacks required for LLVM instrumentations
1271 dnl ========================================================
1272 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1273 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1276 if test -n "$MOZ_LLVM_HACKS"; then
1280 AC_SUBST(MOZ_NO_WLZDEFS)
1281 AC_SUBST(MOZ_CFLAGS_NSS)
1283 dnl ========================================================
1284 dnl GNU specific defaults
1285 dnl ========================================================
1286 if test "$GNU_CC"; then
1290 # Per bug 719659 comment 2, some of the headers on ancient build machines
1291 # may require gnu89 inline semantics. But otherwise, we use C99.
1292 # But on OS X we just use C99 plus GNU extensions, in order to fix
1294 CFLAGS="$CFLAGS -std=gnu99"
1295 if test "${OS_ARCH}" != Darwin; then
1296 CFLAGS="$CFLAGS -fgnu89-inline"
1298 # FIXME: Let us build with strict aliasing. bug 414641.
1299 CFLAGS="$CFLAGS -fno-strict-aliasing"
1300 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1301 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1302 WARNINGS_AS_ERRORS='-Werror'
1304 DSO_PIC_CFLAGS='-fPIC'
1305 ASFLAGS="$ASFLAGS -fPIC"
1306 AC_MSG_CHECKING([for --noexecstack option to as])
1307 _SAVE_CFLAGS=$CFLAGS
1308 CFLAGS="$CFLAGS -Wa,--noexecstack"
1309 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1310 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1311 AC_MSG_RESULT([no]))
1312 CFLAGS=$_SAVE_CFLAGS
1313 AC_MSG_CHECKING([for -z noexecstack option to ld])
1314 _SAVE_LDFLAGS=$LDFLAGS
1315 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1316 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1318 LDFLAGS=$_SAVE_LDFLAGS)
1320 AC_MSG_CHECKING([for -z text option to ld])
1321 _SAVE_LDFLAGS=$LDFLAGS
1322 LDFLAGS="$LDFLAGS -Wl,-z,text"
1323 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1324 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1326 LDFLAGS=$_SAVE_LDFLAGS)
1328 AC_MSG_CHECKING([for --build-id option to ld])
1329 _SAVE_LDFLAGS=$LDFLAGS
1330 LDFLAGS="$LDFLAGS -Wl,--build-id"
1331 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1332 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1334 LDFLAGS=$_SAVE_LDFLAGS)
1336 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
1337 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
1338 _SAVE_LDFLAGS=$LDFLAGS
1339 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
1340 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1341 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
1342 AC_MSG_RESULT([no]))
1343 LDFLAGS=$_SAVE_LDFLAGS
1345 # Check for -mssse3 on $CC
1346 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1347 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1348 _SAVE_CFLAGS=$CFLAGS
1349 CFLAGS="$CFLAGS -mssse3"
1350 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1351 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1352 AC_MSG_RESULT([no]))
1353 CFLAGS=$_SAVE_CFLAGS
1355 # Check for -msse4.1 on $CC
1356 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1357 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1358 _SAVE_CFLAGS=$CFLAGS
1359 CFLAGS="$CFLAGS -msse4.1"
1360 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1361 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1362 AC_MSG_RESULT([no]))
1363 CFLAGS=$_SAVE_CFLAGS
1365 case "${CPU_ARCH}" in
1367 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
1369 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
1370 result="yes", result="no")
1371 AC_MSG_RESULT("$result")
1372 if test "$result" = "yes"; then
1377 DSO_LDOPTS='-shared'
1378 if test "$GCC_USE_GNU_LD"; then
1379 # Some tools like ASan use a runtime library that is only
1380 # linked against executables, so we must allow undefined
1381 # symbols for shared objects in some cases.
1382 if test -z "$MOZ_NO_WLZDEFS"; then
1383 # Don't allow undefined symbols in libraries
1384 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1386 # BSDs need `environ' exposed for posix_spawn (bug 753046)
1387 case "$OS_TARGET" in
1388 DragonFly|FreeBSD|NetBSD|OpenBSD)
1389 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
1390 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
1392 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
1399 # Turn on GNU-specific warnings:
1400 # -Wall - turn on a lot of warnings
1401 # -Wpointer-arith - good to have
1402 # -Wdeclaration-after-statement - MSVC doesn't like these
1403 # -Werror=return-type - catches missing returns, zero false positives
1404 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
1405 # -Wtype-limits - catches overflow bugs, few false positives
1406 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1407 # -Wsign-compare - catches comparison of signed and unsigned types
1409 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1410 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1411 MOZ_C_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_c_has_werror_int_to_pointer_cast)
1412 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1413 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1414 MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1416 # Turn off the following warnings that -Wall turns on:
1417 # -Wno-unused - lots of violations in third-party code
1419 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1421 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1422 # Don't use -Wcast-align with ICC or clang
1424 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1425 hppa | ia64 | sparc | arm)
1428 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1433 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1434 _USE_CPP_INCLUDE_FLAG=1
1435 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1437 elif test "$SOLARIS_SUNPRO_CC"; then
1439 if test "$CPU_ARCH" = "sparc"; then
1440 # for Sun Studio on Solaris/SPARC
1441 DSO_PIC_CFLAGS='-xcode=pic32'
1443 DSO_PIC_CFLAGS='-KPIC'
1445 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1447 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1448 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1450 DSO_LDOPTS='-shared'
1451 if test "$GNU_LD"; then
1452 # Don't allow undefined symbols in libraries
1453 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1457 DSO_PIC_CFLAGS='-KPIC'
1458 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1461 if test "$GNU_CXX"; then
1462 # FIXME: Let us build with strict aliasing. bug 414641.
1463 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1465 # Turn on GNU-specific warnings:
1466 # -Wall - turn on a lot of warnings
1467 # -Wpointer-arith - good to have
1468 # -Woverloaded-virtual - ???
1469 # -Werror=return-type - catches missing returns, zero false positives
1470 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
1471 # -Werror=type-limits - catches overflow bugs, few false positives
1472 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1473 # -Wsign-compare - catches comparison of signed and unsigned types
1475 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1476 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1477 MOZ_CXX_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_cxx_has_werror_int_to_pointer_cast)
1478 MOZ_CXX_SUPPORTS_WARNING(-W, error=type-limits, ac_cxx_has_werror_type_limits)
1479 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1480 MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1482 # Turn off the following warnings that -Wall turns on:
1483 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1484 # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc
1485 # for performance reasons, and because GCC and clang accept it (though
1486 # clang warns about it).
1488 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1489 MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete)
1491 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1492 # Don't use -Wcast-align with ICC or clang
1494 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1495 hppa | ia64 | sparc | arm)
1498 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1503 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1504 _USE_CPP_INCLUDE_FLAG=1
1506 # Recent clang and gcc support C++11 deleted functions without warnings if
1507 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1508 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1509 # unused. But clang's warning can be disabled, so when compiling with clang
1510 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1511 # deleted function syntax.
1512 if test "$CLANG_CXX"; then
1513 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1514 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1518 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1521 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1522 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1523 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1524 dnl normal behavior.
1525 dnl ========================================================
1527 MKSHLIB_UNFORCE_ALL=
1529 if test "$COMPILE_ENVIRONMENT"; then
1530 if test "$GNU_CC"; then
1531 AC_MSG_CHECKING(whether ld has archive extraction flags)
1532 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1533 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1534 ac_cv_mkshlib_force_and_unforce="no"
1535 exec 3<&0 <<LOOP_INPUT
1536 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1537 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1538 force="-Wl,-all"; unforce="-Wl,-none"
1545 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1548 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1550 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1554 eval $ac_cv_mkshlib_force_and_unforce
1555 MKSHLIB_FORCE_ALL=$force
1556 MKSHLIB_UNFORCE_ALL=$unforce
1559 fi # COMPILE_ENVIRONMENT
1561 dnl ========================================================
1562 dnl Checking for 64-bit OS
1563 dnl ========================================================
1564 if test "$COMPILE_ENVIRONMENT"; then
1567 AC_MSG_CHECKING(for 64-bit OS)
1568 AC_TRY_COMPILE([$configure_static_assert_macros],
1569 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1570 result="yes", result="no")
1571 AC_MSG_RESULT("$result")
1572 if test "$result" = "yes"; then
1573 AC_DEFINE(HAVE_64BIT_BUILD)
1576 AC_SUBST(HAVE_64BIT_BUILD)
1578 fi # COMPILE_ENVIRONMENT
1580 dnl ========================================================
1581 dnl = Use profiling compile flags
1582 dnl ========================================================
1583 MOZ_ARG_ENABLE_BOOL(profiling,
1584 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1588 dnl ========================================================
1589 dnl = Turn on systrace for android/b2g.
1590 dnl ========================================================
1591 MOZ_ARG_ENABLE_BOOL(systrace,
1592 [ --enable-systrace Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1595 if test -n "$MOZ_USE_SYSTRACE"; then
1596 AC_DEFINE(MOZ_USE_SYSTRACE)
1599 # For profiling builds keep the symbol information
1600 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1601 case "$OS_TARGET" in
1602 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1603 STRIP_FLAGS="--strip-debug"
1608 dnl ========================================================
1610 dnl ========================================================
1611 MOZ_ARG_ENABLE_BOOL(valgrind,
1612 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1615 if test -n "$MOZ_VALGRIND"; then
1616 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1618 [--enable-valgrind specified but Valgrind is not installed]))
1619 AC_DEFINE(MOZ_VALGRIND)
1621 AC_SUBST(MOZ_VALGRIND)
1623 dnl ========================================================
1625 dnl ========================================================
1626 MOZ_ARG_ENABLE_BOOL(jprof,
1627 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1630 if test -n "$MOZ_JPROF"; then
1632 AC_DEFINE(MOZ_JPROF)
1635 dnl ========================================================
1637 dnl ========================================================
1638 MOZ_ENABLE_PROFILER_SPS=1
1640 case "${OS_TARGET}" in
1642 case "${CPU_ARCH}" in
1645 MOZ_ENABLE_PROFILER_SPS=
1649 case "${CPU_ARCH}" in
1652 MOZ_ENABLE_PROFILER_SPS=
1657 MOZ_ENABLE_PROFILER_SPS=
1661 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1662 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1665 dnl ========================================================
1667 dnl ========================================================
1668 MOZ_ARG_ENABLE_BOOL(shark,
1669 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1672 if test -n "$MOZ_SHARK"; then
1674 AC_DEFINE(MOZ_SHARK)
1677 dnl ========================================================
1679 dnl ========================================================
1680 MOZ_ARG_ENABLE_BOOL(instruments,
1681 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
1684 if test -n "$MOZ_INSTRUMENTS"; then
1686 AC_DEFINE(MOZ_INSTRUMENTS)
1689 dnl ========================================================
1691 dnl ========================================================
1692 MOZ_ARG_ENABLE_BOOL(callgrind,
1693 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1696 if test -n "$MOZ_CALLGRIND"; then
1698 AC_DEFINE(MOZ_CALLGRIND)
1701 dnl ========================================================
1703 dnl ========================================================
1704 MOZ_ARG_ENABLE_BOOL(vtune,
1705 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1708 if test -n "$MOZ_VTUNE"; then
1710 AC_DEFINE(MOZ_VTUNE)
1713 dnl ========================================================
1715 dnl ========================================================
1716 if test -n "$MOZ_PROFILING"; then
1717 AC_DEFINE(MOZ_PROFILING)
1720 dnl ========================================================
1721 dnl System overrides of the defaults for host
1722 dnl ========================================================
1725 if test -n "$_WIN32_MSVC"; then
1727 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
1728 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
1729 HOST_RANLIB='echo ranlib'
1731 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1733 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1734 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1735 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1736 HOST_BIN_SUFFIX=.exe
1739 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1743 case "${host_cpu}" in
1745 if test -n "$_WIN32_MSVC"; then
1746 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1750 if test -n "$_WIN32_MSVC"; then
1751 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1753 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1759 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1760 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1761 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1764 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1765 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1766 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1767 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1771 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1772 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1776 dnl Check for using a custom <inttypes.h> implementation
1777 dnl ========================================================
1778 AC_MSG_CHECKING(for custom <inttypes.h> implementation)
1779 if test "$MOZ_CUSTOM_INTTYPES_H"; then
1780 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
1781 AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
1783 AC_MSG_RESULT(none specified)
1786 dnl Get mozilla version from central milestone file
1787 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1788 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1789 MOZILLA_SYMBOLVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -symbolversion`
1791 dnl Get version of various core apps from the version files.
1792 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1794 if test -z "$FIREFOX_VERSION"; then
1795 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1798 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1799 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1800 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1801 AC_SUBST(MOZILLA_SYMBOLVERSION)
1803 MOZ_DOING_LTO(lto_is_enabled)
1805 dnl ========================================================
1806 dnl System overrides of the defaults for target
1807 dnl ========================================================
1812 if test ! "$GNU_CC"; then
1813 if test ! "$HAVE_64BIT_BUILD"; then
1814 # Compiling with Visual Age C++ object model compat is the
1815 # default. To compile with object model ibm, add
1816 # AIX_OBJMODEL=ibm to .mozconfig.
1817 if test "$AIX_OBJMODEL" = "ibm"; then
1818 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1825 AC_SUBST(AIX_OBJMODEL)
1826 DSO_LDOPTS='-qmkshrobj=1'
1827 DSO_CFLAGS='-qflag=w:w'
1829 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1831 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1832 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1833 if test "$COMPILE_ENVIRONMENT"; then
1836 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1838 [#if (__IBMCPP__ < 900)
1839 #error "Bad compiler"
1841 _BAD_COMPILER=,_BAD_COMPILER=1)
1842 if test -n "$_BAD_COMPILER"; then
1844 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1846 AC_MSG_RESULT([yes])
1849 TARGET_COMPILER_ABI="ibmc"
1850 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1851 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1854 case "${target_os}" in
1859 if test "$COMPILE_ENVIRONMENT"; then
1860 MOZ_CHECK_HEADERS(sys/inttypes.h)
1862 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1866 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1867 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1868 MOZ_OPTIMIZE_FLAGS="-O3"
1869 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1870 if test "$HAVE_64BIT_BUILD"; then
1875 STRIP_FLAGS="$STRIP_FLAGS -x -S"
1876 # Check whether we're targeting OS X or iOS
1877 AC_CACHE_CHECK(for iOS target,
1879 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1880 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1884 ac_cv_ios_target="yes",
1885 ac_cv_ios_target="no")])
1886 if test "$ac_cv_ios_target" = "yes"; then
1888 AC_DEFINE(XP_DARWIN)
1889 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1891 AC_DEFINE(XP_MACOSX)
1892 AC_DEFINE(XP_DARWIN)
1893 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1894 # The ExceptionHandling framework is needed for Objective-C exception
1895 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1897 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1899 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1901 if test "x$lto_is_enabled" = "xyes"; then
1902 echo "Skipping -dead_strip because lto is enabled."
1903 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1904 dnl ===================================================================
1905 elif test "x$enable_dtrace" = "xyes"; then
1906 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1908 dnl check for the presence of the -dead_strip linker flag
1909 AC_MSG_CHECKING([for -dead_strip option to ld])
1910 _SAVE_LDFLAGS=$LDFLAGS
1911 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1912 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1913 if test -n "$_HAVE_DEAD_STRIP" ; then
1914 AC_MSG_RESULT([yes])
1915 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1920 LDFLAGS=$_SAVE_LDFLAGS
1923 dnl With newer linkers we need to pass -allow_heap_execute because of
1924 dnl Microsoft Silverlight (5.1.10411.0 at least).
1925 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1926 _SAVE_LDFLAGS=$LDFLAGS
1927 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1928 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1929 _HAVE_ALLOW_HEAP_EXECUTE=)
1930 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1931 AC_MSG_RESULT([yes])
1932 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1936 LDFLAGS=$_SAVE_LDFLAGS
1938 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1943 if test ! "$GNU_CC"; then
1947 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1948 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1949 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1952 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1953 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1956 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1957 AC_DEFINE(_LARGEFILE64_SOURCE)
1962 if test ! "$GNU_CC"; then
1963 DSO_LDOPTS='-b -Wl,+s'
1966 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1967 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1968 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1970 DSO_LDOPTS='-b -E +s'
1971 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1972 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1974 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1975 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1978 *-android*|*-linuxandroid*)
1979 AC_DEFINE(NO_PW_GECOS)
1981 if test -n "$gonkdir"; then
1982 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
1983 _PLATFORM_HAVE_RIL=1
1987 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
1990 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1992 MOZ_GFX_OPTIMIZE_MOBILE=1
1993 MOZ_OPTIMIZE_FLAGS="-Os -fno-reorder-functions"
1994 if test -z "$CLANG_CC"; then
1995 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
2000 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2001 # Similarly for GNU_CXX and INTEL_CXX.
2002 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2003 # -Os has been broken on Intel's C/C++ compilers for quite a
2004 # while; Intel recommends against using it.
2005 MOZ_OPTIMIZE_FLAGS="-O2"
2006 elif test "$GNU_CC" -o "$GNU_CXX"; then
2007 case $GCC_VERSION in
2009 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
2010 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2012 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2013 MOZ_OPTIMIZE_FLAGS="-Os $MOZ_OPTIMIZE_SIZE_TWEAK"
2014 if test -z "$CLANG_CC"; then
2015 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
2019 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2023 case "${target_cpu}" in
2025 CFLAGS="$CFLAGS -mieee"
2026 CXXFLAGS="$CXXFLAGS -mieee"
2030 if test -z "$MC"; then
2040 # certain versions of cygwin's makedepend barf on the
2041 # #include <string> vs -I./dist/include/string issue so don't use it
2042 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
2044 CXX="$CXX -mwindows"
2045 CPP="$CPP -mwindows"
2046 CFLAGS="$CFLAGS -mms-bitfields"
2047 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2048 DSO_LDOPTS='-shared'
2049 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2050 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2052 # Use static libgcc and libstdc++
2053 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
2054 NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
2055 # Use temp file for windres (bug 213281)
2056 RCFLAGS='-O coff --use-temp-file'
2057 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2058 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2061 IMPORT_LIB_SUFFIX=dll.a
2063 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
2064 WIN32_GUI_EXE_LDFLAGS=-mwindows
2066 # We use mix of both POSIX and Win32 printf format across the tree, so format
2067 # warnings are useless on mingw.
2068 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2069 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2071 TARGET_COMPILER_ABI=msvc
2075 if test "$AS_BIN"; then
2076 AS="$(basename "$AS_BIN")"
2079 AR_FLAGS='-NOLOGO -OUT:$@'
2081 RANLIB='echo not_ranlib'
2082 STRIP='echo not_strip'
2093 IMPORT_LIB_SUFFIX=lib
2094 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2095 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2097 MKSHLIB_UNFORCE_ALL=
2098 dnl Set subsystem version 5 for Windows XP.
2099 if test "$CPU_ARCH" = "x86"; then
2100 WIN32_SUBSYSTEM_VERSION=5.01
2102 WIN32_SUBSYSTEM_VERSION=5.02
2104 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
2105 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
2106 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
2107 _USE_CPP_INCLUDE_FLAG=1
2108 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2109 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2110 CFLAGS="$CFLAGS -W3 -Gy"
2111 CXXFLAGS="$CXXFLAGS -W3 -Gy"
2112 if test "$_CC_SUITE" -ge "11" -a "$CPU_ARCH" = "x86"; then
2113 dnl VS2012+ defaults to -arch:SSE2.
2114 CFLAGS="$CFLAGS -arch:IA32"
2115 CXXFLAGS="$CXXFLAGS -arch:IA32"
2117 if test "$_CC_SUITE" -ge "12"; then
2118 dnl VS2013+ requires -FS when parallel building by make -jN.
2119 dnl If nothing, compiler sometimes causes C1041 error.
2121 dnl Visual Studio 2013 supports -Gw flags
2122 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
2123 CFLAGS="$CFLAGS -FS -Gw"
2124 CXXFLAGS="$CXXFLAGS -FS -Gw"
2126 # khuey says we can safely ignore MSVC warning C4251
2127 # MSVC warning C4244 (implicit type conversion may lose data) warns
2128 # and requires workarounds for perfectly valid code. Also, GCC/clang
2129 # don't warn about it by default. So for consistency/sanity, we turn
2130 # it off on MSVC, too.
2131 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2132 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2133 # MSVC warning C4482 warns when an enum value is refered specifing the
2134 # name of the enum itself. This behavior is allowed in C++11, and the
2135 # warning has been removed in VS2012.
2136 # MSVC warning C4800 warns when a value is implicitly cast to bool,
2137 # because this also forces narrowing to a single byte, which can be a
2138 # perf hit. But this matters so little in practice (and often we want
2139 # that behavior) that it's better to turn it off.
2140 # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2141 # on non-Western system locales even if it is in a comment.
2142 CFLAGS="$CFLAGS -wd4244 -wd4819"
2143 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2144 # make 'foo == bar;' error out
2145 CFLAGS="$CFLAGS -we4553"
2146 CXXFLAGS="$CXXFLAGS -we4553"
2147 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2148 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2149 WARNINGS_AS_ERRORS='-WX'
2150 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
2152 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2153 # Disable these flags on clang-cl since it doesn't ignore unknown arguments by default, and
2154 # autoconf insists on passing $LDFLAGS to the compiler.
2155 if test -z "$CLANG_CL"; then
2156 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2157 if test -z "$DEVELOPER_OPTIONS"; then
2158 LDFLAGS="$LDFLAGS -RELEASE"
2161 dnl For profile-guided optimization
2162 PROFILE_GEN_CFLAGS="-GL"
2163 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2164 dnl XXX: PGO builds can fail with warnings treated as errors,
2165 dnl specifically "no profile data available" appears to be
2166 dnl treated as an error sometimes. This might be a consequence
2167 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2168 dnl with the linker doing most of the work in the whole-program
2169 dnl optimization/PGO case. I think it's probably a compiler bug,
2170 dnl but we work around it here.
2171 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2172 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2173 dnl Probably also a compiler bug, but what can you do?
2174 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2175 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2176 dnl Minimum reqiurement of Gecko is VS2010 or later which supports
2177 dnl both SSSE3 and SSE4.1.
2178 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2179 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
2180 if test "$_CC_SUITE" -ge "11"; then
2181 dnl allow AVX2 code from VS2012
2186 AC_DEFINE(HAVE_SNPRINTF)
2191 AC_DEFINE(HW_THREADS)
2192 AC_DEFINE(STDC_HEADERS)
2193 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2194 TARGET_MD_ARCH=win32
2195 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2197 MOZ_USER_DIR="Mozilla"
2199 dnl Hardcode to win95 for now - cls
2200 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2202 dnl set NO_X11 defines here as the general check is skipped on win32
2208 if test -n "$L10NBASEDIR"; then
2209 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2216 if test -z "$MOZ_TOOLS"; then
2217 AC_MSG_ERROR([MOZ_TOOLS is not set])
2219 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2220 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2221 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2223 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2224 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2225 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2232 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.])
2238 if test "$HAVE_64BIT_BUILD"; then
2239 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2242 if test -n "$GNU_CC"; then
2243 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2244 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2245 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2247 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2248 # Disable this flag on clang-cl since it doesn't ignore unknown arguments by default, and
2249 # autoconf insists on passing $LDFLAGS to the compiler.
2250 if test -z "$CLANG_CL"; then
2251 LDFLAGS="$LDFLAGS -SAFESEH"
2258 if test -n "$_WIN32_MSVC"; then
2259 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2264 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2271 CFLAGS="$CFLAGS -Dunix"
2272 CXXFLAGS="$CXXFLAGS -Dunix"
2273 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2275 DSO_PIC_CFLAGS='-fPIC -DPIC'
2276 DSO_LDOPTS='-shared'
2277 BIN_FLAGS='-Wl,--export-dynamic'
2279 DSO_PIC_CFLAGS='-fPIC -DPIC'
2280 DLL_SUFFIX=".so.1.0"
2281 DSO_LDOPTS='-shared'
2283 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2284 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2285 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2286 if test "$LIBRUNPATH"; then
2287 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2289 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2290 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2294 if test "$SO_VERSION"; then
2295 DLL_SUFFIX=".so.$SO_VERSION"
2297 DLL_SUFFIX=".so.1.0"
2299 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2301 DSO_PIC_CFLAGS='-fPIC'
2302 DSO_LDOPTS='-shared -fPIC'
2303 if test "$LIBRUNPATH"; then
2304 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2310 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2312 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2313 # libraries one level up (e.g. libnspr4.so)
2314 if test "$SOLARIS_SUNPRO_CC"; then
2315 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2316 LIBS="-lCrun -lCstd -lc $LIBS"
2317 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2318 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2319 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2320 LDFLAGS="-xildoff $LDFLAGS"
2321 MMX_FLAGS="-xarch=mmx -xO4"
2322 SSE_FLAGS="-xarch=sse"
2323 SSE2_FLAGS="-xarch=ssei2 -xO4"
2324 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2325 _SAVE_LDFLAGS=$LDFLAGS
2326 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2327 AC_TRY_LINK([#include <stdio.h>],
2328 [printf("Hello World\n");],
2330 [LDFLAGS=$_SAVE_LDFLAGS])
2332 MOZ_OPTIMIZE_FLAGS="-xO4"
2333 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2334 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2335 MKSHLIB_FORCE_ALL='-z allextract'
2336 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2343 AS='/usr/ccs/bin/as'
2344 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2346 TARGET_COMPILER_ABI="sunc"
2347 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2348 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2349 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2353 [#if (__SUNPRO_CC < 0x590)
2356 _BAD_COMPILER=,_BAD_COMPILER=1)
2357 if test -n "$_BAD_COMPILER"; then
2359 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2364 [#if (__SUNPRO_CC >= 0x5100)
2365 #error "Sun C++ 5.10 or above"
2367 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2368 if test "$_ABOVE_SS12U1"; then
2370 CXXFLAGS="$CXXFLAGS -xannotate=no"
2372 AC_MSG_RESULT([$_res])
2375 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2377 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2378 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2379 ASFLAGS="$ASFLAGS -fPIC"
2380 DSO_LDOPTS='-shared'
2381 WARNINGS_AS_ERRORS='-Werror'
2383 _WARNINGS_CXXFLAGS=''
2384 if test "$OS_RELEASE" = "5.3"; then
2385 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2388 if test "$OS_RELEASE" = "5.5.1"; then
2389 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2394 DSO_LDOPTS='-Bdynamic'
2395 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2396 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2398 AC_DEFINE(SPRINTF_RETURNS_STRING)
2399 case "$(target_os)" in
2401 DLL_SUFFIX='.so.1.0'
2408 AC_SUBST_LIST(MMX_FLAGS)
2409 AC_SUBST_LIST(SSE_FLAGS)
2410 AC_SUBST_LIST(SSE2_FLAGS)
2414 # Includes linux-android
2419 AC_SUBST(MOZ_LINKER)
2420 if test -n "$MOZ_LINKER"; then
2421 AC_DEFINE(MOZ_LINKER)
2424 dnl Only one oddball right now (QNX), but this gives us flexibility
2425 dnl if any other platforms need to override this in the future.
2426 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2428 dnl ========================================================
2429 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2430 dnl by now will not have any way to link most binaries (tests
2431 dnl as well as viewer, apprunner, etc.), because some symbols
2432 dnl will be left out of the "composite" .so's by ld as unneeded.
2433 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2434 dnl they can link in the static libs that provide the missing
2436 dnl ========================================================
2437 NO_LD_ARCHIVE_FLAGS=
2438 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2439 NO_LD_ARCHIVE_FLAGS=1
2443 NO_LD_ARCHIVE_FLAGS=
2446 if test -z "$GNU_CC"; then
2447 NO_LD_ARCHIVE_FLAGS=
2451 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2453 dnl ========================================================
2454 dnl = Flags to strip unused symbols from .so components and
2455 dnl = to export jemalloc symbols when linking a program
2456 dnl ========================================================
2458 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2459 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2462 if test -z "$GNU_CC"; then
2463 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2465 if test -z "$GCC_USE_GNU_LD"; then
2466 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2468 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2473 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2476 if test -n "$GNU_CC"; then
2477 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2482 if test -z "$COMPILE_ENVIRONMENT"; then
2483 SKIP_COMPILER_CHECKS=1
2484 SKIP_LIBRARY_CHECKS=1
2489 if test -z "$SKIP_COMPILER_CHECKS"; then
2490 dnl Checks for typedefs, structures, and compiler characteristics.
2491 dnl ========================================================
2507 dnl Check for .hidden assembler directive and visibility attribute.
2508 dnl Borrowed from glibc configure.in
2509 dnl ===============================================================
2510 if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
2511 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2512 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2513 case "$OS_TARGET" in
2515 VISIBILITY_FLAGS='-fvisibility=hidden'
2518 case $GCC_VERSION in
2520 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden_dso_handle.h'
2523 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden.h'
2526 WRAP_SYSTEM_INCLUDES=1
2531 # visibility hidden flag for Sun Studio on Solaris
2532 if test "$SOLARIS_SUNPRO_CC"; then
2533 VISIBILITY_FLAGS='-xldscope=hidden'
2534 fi # Sun Studio on Solaris
2536 case "${OS_TARGET}" in
2537 WINNT|Darwin|Android)
2540 STL_FLAGS='-I$(DIST)/stl_wrappers'
2545 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2546 AC_SUBST(VISIBILITY_FLAGS)
2550 if test "$OS_TARGET" != WINNT; then
2551 # Only run this test with clang on non-Windows platforms, because clang
2552 # cannot do enough code gen for now to make this test work correctly.
2556 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2557 dnl ========================================================
2558 if test "$GNU_CC"; then
2559 CFLAGS_save="${CFLAGS}"
2560 CFLAGS="${CFLAGS} -Werror"
2561 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2562 ac_cv_force_align_arg_pointer,
2563 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2565 ac_cv_force_align_arg_pointer="yes",
2566 ac_cv_force_align_arg_pointer="no")])
2567 CFLAGS="${CFLAGS_save}"
2568 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2569 HAVE_GCC_ALIGN_ARG_POINTER=1
2571 HAVE_GCC_ALIGN_ARG_POINTER=
2574 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2576 dnl Checks for header files.
2577 dnl ========================================================
2579 case "$target_os" in
2581 # for stuff like -lXshm
2582 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2585 MOZ_CHECK_COMMON_HEADERS
2587 dnl These are all the places some variant of statfs can be hiding.
2588 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2591 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2592 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2594 dnl SCTP support - needs various network include headers
2595 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2597 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2599 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2600 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2601 ac_cv_sockaddr_in_sin_len,
2602 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2603 #include <sys/types.h>
2605 #include <netinet/in.h>
2606 struct sockaddr_in x;
2607 void *foo = (void*) &x.sin_len;],
2609 [ac_cv_sockaddr_in_sin_len=true],
2610 [ac_cv_sockaddr_in_sin_len=false])])
2611 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2612 AC_DEFINE(HAVE_SIN_LEN)
2613 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2614 AC_DEFINE(HAVE_SCONN_LEN)
2617 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2618 ac_cv_sockaddr_in6_sin6_len,
2619 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2620 #include <sys/types.h>
2622 #include <netinet/in.h>
2623 struct sockaddr_in6 x;
2624 void *foo = (void*) &x.sin6_len;],
2626 [ac_cv_sockaddr_in6_sin6_len=true],
2627 [ac_cv_sockaddr_in6_sin6_len=false])])
2628 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2629 AC_DEFINE(HAVE_SIN6_LEN)
2632 AC_CACHE_CHECK(for sockaddr.sa_len,
2633 ac_cv_sockaddr_sa_len,
2634 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2635 #include <sys/types.h>
2637 #include <sys/socket.h>
2639 void *foo = (void*) &x.sa_len;],
2641 [ac_cv_sockaddr_sa_len=true],
2642 [ac_cv_sockaddr_sa_len=false])])
2643 if test "$ac_cv_sockaddr_sa_len" = true ; then
2644 AC_DEFINE(HAVE_SA_LEN)
2647 MOZ_ARG_ENABLE_BOOL(dtrace,
2648 [ --enable-dtrace build with dtrace support if available (default=no)],
2649 [enable_dtrace="yes"],)
2650 if test "x$enable_dtrace" = "xyes"; then
2651 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2652 if test -n "$HAVE_DTRACE"; then
2653 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2655 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2658 AC_SUBST(HAVE_DTRACE)
2664 MOZ_CHECK_HEADERS(sys/cdefs.h)
2668 MOZ_LINUX_PERF_EVENT
2670 dnl Checks for libraries.
2671 dnl ========================================================
2676 AC_CHECK_LIB(c_r, gethostbyname_r)
2680 dnl We don't want to link with libdl even if it's present on OS X, since
2681 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2683 dnl We don't want to link against libm or libpthread on Darwin since
2684 dnl they both are just symlinks to libSystem and explicitly linking
2685 dnl against libSystem causes issues when debugging (see bug 299601).
2690 AC_SEARCH_LIBS(dlopen, dl,
2691 MOZ_CHECK_HEADER(dlfcn.h,
2692 AC_DEFINE(HAVE_DLOPEN)))
2696 _SAVE_CFLAGS="$CFLAGS"
2697 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2698 AC_CHECK_FUNCS(dladdr memmem)
2699 CFLAGS="$_SAVE_CFLAGS"
2701 if test ! "$GNU_CXX"; then
2705 AC_CHECK_LIB(C_r, demangle)
2708 AC_CHECK_LIB(C, demangle)
2713 AC_CHECK_LIB(socket, socket)
2716 XLIBS="$X_EXTRA_LIBS"
2718 dnl ========================================================
2719 dnl Checks for X libraries.
2720 dnl Ordering is important.
2721 dnl Xt is dependent upon SM as of X11R6
2722 dnl ========================================================
2723 if test "$no_x" = "yes"; then
2726 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2727 XLIBS="-lX11 $XLIBS"
2728 _SAVE_LDFLAGS="$LDFLAGS"
2729 LDFLAGS="$XLDFLAGS $LDFLAGS"
2730 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2731 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2732 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2733 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2735 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2736 unset ac_cv_lib_Xt_XtFree
2737 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2738 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
2739 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2740 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2743 # AIX needs the motif library linked before libXt to prevent
2744 # crashes in plugins linked against Motif - Bug #98892
2745 case "${target_os}" in
2747 XT_LIBS="-lXm $XT_LIBS"
2751 dnl ========================================================
2752 dnl = Check for XShm
2753 dnl ========================================================
2754 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
2757 dnl ========================================================
2759 dnl ========================================================
2760 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
2761 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
2762 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
2763 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
2765 LDFLAGS="$_SAVE_LDFLAGS"
2768 AC_SUBST_LIST(XCFLAGS)
2769 AC_SUBST_LIST(XLDFLAGS)
2770 AC_SUBST_LIST(XLIBS)
2771 AC_SUBST_LIST(XEXT_LIBS)
2772 AC_SUBST_LIST(XT_LIBS)
2773 AC_SUBST_LIST(XSS_LIBS)
2775 dnl ========================================================
2776 dnl = pthread support
2777 dnl = Start by checking whether the system support pthreads
2778 dnl ========================================================
2779 case "$target_os" in
2784 AC_CHECK_LIB(pthreads, pthread_create,
2785 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2786 AC_CHECK_LIB(pthread, pthread_create,
2787 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2788 AC_CHECK_LIB(c_r, pthread_create,
2789 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2790 AC_CHECK_LIB(c, pthread_create,
2799 dnl ========================================================
2800 dnl Check the command line for --with-pthreads
2801 dnl ========================================================
2802 MOZ_ARG_WITH_BOOL(pthreads,
2803 [ --with-pthreads Force use of system pthread library with NSPR ],
2804 [ if test "$MOZ_USE_PTHREADS"x = x; then
2805 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2811 dnl ========================================================
2812 dnl Do the platform specific pthread hackery
2813 dnl ========================================================
2814 if test "$MOZ_USE_PTHREADS"x != x
2817 dnl See if -pthread is supported.
2820 ac_cv_have_dash_pthread=no
2821 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2822 echo 'int main() { return 0; }' | cat > conftest.c
2823 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2824 if test $? -eq 0; then
2825 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2826 ac_cv_have_dash_pthread=yes
2827 case "$target_os" in
2829 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2832 CFLAGS="$CFLAGS -pthread"
2833 CXXFLAGS="$CXXFLAGS -pthread"
2839 AC_MSG_RESULT($ac_cv_have_dash_pthread)
2842 dnl See if -pthreads is supported.
2844 ac_cv_have_dash_pthreads=no
2845 if test "$ac_cv_have_dash_pthread" = "no"; then
2846 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2847 echo 'int main() { return 0; }' | cat > conftest.c
2848 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2849 if test $? -eq 0; then
2850 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2851 ac_cv_have_dash_pthreads=yes
2852 CFLAGS="$CFLAGS -pthreads"
2853 CXXFLAGS="$CXXFLAGS -pthreads"
2857 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2862 AC_DEFINE(_REENTRANT)
2863 AC_DEFINE(_THREAD_SAFE)
2864 dnl -pthread links in -lpthread, so don't specify it explicitly.
2865 if test "$ac_cv_have_dash_pthread" = "yes"; then
2866 _PTHREAD_LDFLAGS="-pthread"
2870 *-*-openbsd*|*-*-bsdi*)
2871 AC_DEFINE(_REENTRANT)
2872 AC_DEFINE(_THREAD_SAFE)
2873 dnl -pthread links in -lc_r, so don't specify it explicitly.
2874 if test "$ac_cv_have_dash_pthread" = "yes"; then
2875 _PTHREAD_LDFLAGS="-pthread"
2879 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
2880 AC_DEFINE(_REENTRANT)
2884 AC_DEFINE(_REENTRANT)
2888 AC_DEFINE(_REENTRANT)
2892 AC_DEFINE(_REENTRANT)
2893 if test "$SOLARIS_SUNPRO_CC"; then
2894 CFLAGS="$CFLAGS -mt"
2895 CXXFLAGS="$CXXFLAGS -mt"
2899 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
2900 AC_SUBST(MOZ_USE_PTHREADS)
2904 dnl Checks for library functions.
2905 dnl ========================================================
2906 AC_PROG_GCC_TRADITIONAL
2908 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r arc4random arc4random_buf)
2910 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
2911 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
2912 ac_cv_clock_monotonic,
2913 [for libs in "" -lrt; do
2916 AC_TRY_LINK([#include <time.h>],
2917 [ struct timespec ts;
2918 clock_gettime(CLOCK_MONOTONIC, &ts); ],
2919 ac_cv_clock_monotonic=$libs
2922 ac_cv_clock_monotonic=no)
2925 if test "$ac_cv_clock_monotonic" != "no"; then
2926 HAVE_CLOCK_MONOTONIC=1
2927 REALTIME_LIBS=$ac_cv_clock_monotonic
2928 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
2929 AC_SUBST(HAVE_CLOCK_MONOTONIC)
2930 AC_SUBST_LIST(REALTIME_LIBS)
2933 dnl check for wcrtomb/mbrtowc
2934 dnl =======================================================================
2935 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
2938 AC_CACHE_CHECK(for wcrtomb,
2940 [AC_TRY_LINK([#include <wchar.h>],
2941 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
2942 ac_cv_have_wcrtomb="yes",
2943 ac_cv_have_wcrtomb="no")])
2944 if test "$ac_cv_have_wcrtomb" = "yes"; then
2945 AC_DEFINE(HAVE_WCRTOMB)
2947 AC_CACHE_CHECK(for mbrtowc,
2949 [AC_TRY_LINK([#include <wchar.h>],
2950 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
2951 ac_cv_have_mbrtowc="yes",
2952 ac_cv_have_mbrtowc="no")])
2953 if test "$ac_cv_have_mbrtowc" = "yes"; then
2954 AC_DEFINE(HAVE_MBRTOWC)
2961 ac_cv_func_res_ninit,
2962 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
2963 dnl no need for res_ninit() on NetBSD and OpenBSD
2964 ac_cv_func_res_ninit=no
2968 #define _BSD_SOURCE 1
2970 #include <sys/types.h>
2971 #include <netinet/in.h>
2972 #include <arpa/nameser.h>
2975 [int foo = res_ninit(&_res);],
2976 [ac_cv_func_res_ninit=yes],
2977 [ac_cv_func_res_ninit=no])
2981 if test "$ac_cv_func_res_ninit" = "yes"; then
2982 AC_DEFINE(HAVE_RES_NINIT)
2983 dnl must add the link line we do something as foolish as this... dougt
2985 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
2986 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
2998 AC_CHECK_LIB(c, iconv, [ICONV_LIBS=],
2999 AC_CHECK_LIB(iconv, iconv, [ICONV_LIBS="-liconv"],
3000 AC_CHECK_LIB(iconv, libiconv, [ICONV_LIBS="-liconv"])))
3002 LIBS="$LIBS $ICONV_LIBS"
3011 iconv_t h = iconv_open("", "");
3012 iconv(h, NULL, NULL, NULL, NULL);
3015 [ac_cv_func_iconv=yes],
3016 [ac_cv_func_iconv=no]
3019 if test "$ac_cv_func_iconv" = "yes"; then
3020 AC_DEFINE(HAVE_ICONV)
3021 LIBICONV="$ICONV_LIBS"
3023 [for iconv() with const input],
3024 ac_cv_func_const_iconv,
3030 const char *input = "testing";
3031 iconv_t h = iconv_open("", "");
3032 iconv(h, &input, NULL, NULL, NULL);
3035 [ac_cv_func_const_iconv=yes],
3036 [ac_cv_func_const_iconv=no]
3039 if test "$ac_cv_func_const_iconv" = "yes"; then
3040 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3048 AC_SUBST_LIST(ICONV_LIBS)
3054 dnl **********************
3055 dnl *** va_copy checks ***
3056 AC_CACHE_CHECK([for an implementation of va_copy()],
3058 [AC_TRY_COMPILE([#include <stdarg.h>
3060 void f (int i, ...) {
3061 va_list args1, args2;
3062 va_start (args1, i);
3063 va_copy (args2, args1);
3064 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3066 va_end (args1); va_end (args2);
3068 [f(0, 42); return 0],
3069 [ac_cv_va_copy=yes],
3073 AC_CACHE_CHECK([whether va_list can be copied by value],
3075 [AC_TRY_COMPILE([#include <stdarg.h>
3077 void f (int i, ...) {
3078 va_list args1, args2;
3079 va_start (args1, i);
3081 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3083 va_end (args1); va_end (args2);
3085 [f(0, 42); return 0],
3086 [ac_cv_va_val_copy=yes],
3087 [ac_cv_va_val_copy=no],
3090 if test "x$ac_cv_va_copy" = "xyes"; then
3091 AC_DEFINE(VA_COPY, va_copy)
3092 AC_DEFINE(HAVE_VA_COPY)
3095 if test "x$ac_cv_va_val_copy" = "xno"; then
3096 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3099 dnl ===================================================================
3100 dnl ========================================================
3101 dnl Put your C++ language/feature checks below
3102 dnl ========================================================
3106 if test "$GNU_CC"; then
3107 if test "$CPU_ARCH" = "arm" ; then
3108 AC_CACHE_CHECK(for ARM EABI,
3112 #if defined(__ARM_EABI__)
3115 #error Not ARM EABI.
3118 ac_cv_gcc_arm_eabi="yes",
3119 ac_cv_gcc_arm_eabi="no")])
3120 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3122 ARM_ABI_PREFIX=eabi-
3124 ARM_ABI_PREFIX=oabi-
3128 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3131 dnl Check to see if we can resolve ambiguity with |using|.
3132 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3133 ac_cv_cpp_ambiguity_resolving_using,
3134 [AC_TRY_COMPILE(class X {
3135 public: int go(const X&) {return 3;}
3136 int jo(const X&) {return 3;}
3138 class Y : public X {
3139 public: int go(int) {return 2;}
3140 int jo(int) {return 2;}
3142 private: using X::go;
3145 ac_cv_cpp_ambiguity_resolving_using=yes,
3146 ac_cv_cpp_ambiguity_resolving_using=no)])
3147 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3148 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3151 dnl See if a dynamic_cast to void* gives the most derived object.
3152 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3153 ac_cv_cpp_dynamic_cast_void_ptr,
3154 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3155 class Y { int j; public: virtual ~Y() { } };
3156 class Z : public X, public Y { int k; };
3162 return !((((void*)&mdo != (void*)subx) &&
3163 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3164 (((void*)&mdo != (void*)suby) &&
3165 ((void*)&mdo == dynamic_cast<void*>(suby))));
3167 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3168 ac_cv_cpp_dynamic_cast_void_ptr=no,
3169 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3170 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3171 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3174 dnl note that this one is reversed - if the test fails, then
3175 dnl we require implementations of unused virtual methods. Which
3176 dnl really blows because it means we'll have useless vtable
3178 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3179 ac_cv_cpp_unused_required,
3180 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3182 ac_cv_cpp_unused_required=no,
3183 ac_cv_cpp_unused_required=yes)])
3184 if test "$ac_cv_cpp_unused_required" = yes ; then
3185 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3189 dnl Some compilers have trouble comparing a constant reference to a templatized
3190 dnl class to zero, and require an explicit operator==() to be defined that takes
3191 dnl an int. This test separates the strong from the weak.
3193 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3194 ac_cv_trouble_comparing_to_zero,
3195 [AC_TRY_COMPILE([#include <algorithm>
3196 template <class T> class Foo {};
3198 template <class T> int operator==(const T2*, const T&) { return 0; }
3199 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3200 [Foo<int> f; return (0 != f);],
3201 ac_cv_trouble_comparing_to_zero=no,
3202 ac_cv_trouble_comparing_to_zero=yes)])
3203 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3204 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3207 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3208 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3209 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3211 _SAVE_LDFLAGS=$LDFLAGS
3212 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3213 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3214 ac_cv_thread_keyword,
3215 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3216 [return tlsIsMainThread;],
3217 ac_cv_thread_keyword=yes,
3218 ac_cv_thread_keyword=no)])
3219 LDFLAGS=$_SAVE_LDFLAGS
3220 # The custom dynamic linker doesn't support TLS variables
3222 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3223 # mips builds fail with TLS variables because of a binutils bug.
3225 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3230 *-android*|*-linuxandroid*)
3237 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3243 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3244 if test -n "$MOZ_LINKER"; then
3245 if test "$CPU_ARCH" = arm; then
3246 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3247 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3248 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3249 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3254 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3255 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3256 dnl We however want to avoid these text relocations, and this can be done
3257 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3258 dnl doesn't contain anything at all, beside placeholders for some sections,
3259 dnl and crtbegin only contains a finalizer function that calls
3260 dnl __cxa_finalize. The custom linker actually takes care of calling
3261 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3262 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3263 dnl link crtbegin and crtend at all.
3264 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3265 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3266 ac_cv_crt_has_text_relocations,
3267 [echo 'int foo() { return 0; }' > conftest.cpp
3268 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3269 test -s conftest${DLL_SUFFIX}; then
3270 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3271 ac_cv_crt_has_text_relocations=yes
3273 ac_cv_crt_has_text_relocations=no
3276 AC_ERROR([couldn't compile a simple C file])
3279 if test "$ac_cv_crt_has_text_relocations" = yes; then
3280 dnl While we want libraries to skip the CRT files, we don't want
3281 dnl executables to be treated the same way. We thus set the flag
3282 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3283 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3284 dnl Using LDFLAGS in nspr is safe, since we only really build
3285 dnl libraries there.
3286 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3287 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3291 dnl Check for the existence of various allocation headers/functions
3293 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3296 for file in $MALLOC_HEADERS; do
3297 MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3298 if test "$MALLOC_H" != ""; then
3299 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3304 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3306 AC_CHECK_FUNCS(malloc_usable_size)
3308 dnl See if compiler supports some gcc-style attributes
3310 AC_CACHE_CHECK(for __attribute__((always_inline)),
3311 ac_cv_attribute_always_inline,
3312 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3314 ac_cv_attribute_always_inline=yes,
3315 ac_cv_attribute_always_inline=no)])
3317 AC_CACHE_CHECK(for __attribute__((malloc)),
3318 ac_cv_attribute_malloc,
3319 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3321 ac_cv_attribute_malloc=yes,
3322 ac_cv_attribute_malloc=no)])
3324 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3325 ac_cv_attribute_warn_unused,
3326 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3328 ac_cv_attribute_warn_unused=yes,
3329 ac_cv_attribute_warn_unused=no)])
3331 dnl End of C++ language/feature checks
3334 dnl ========================================================
3335 dnl = Internationalization checks
3336 dnl ========================================================
3338 dnl Internationalization and Locale support is different
3339 dnl on various UNIX platforms. Checks for specific i18n
3340 dnl features go here.
3342 dnl check for LC_MESSAGES
3343 AC_CACHE_CHECK(for LC_MESSAGES,
3344 ac_cv_i18n_lc_messages,
3345 [AC_TRY_COMPILE([#include <locale.h>],
3346 [int category = LC_MESSAGES;],
3347 ac_cv_i18n_lc_messages=yes,
3348 ac_cv_i18n_lc_messages=no)])
3349 if test "$ac_cv_i18n_lc_messages" = yes; then
3350 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3353 AC_HAVE_FUNCS(localeconv)
3354 fi # ! SKIP_COMPILER_CHECKS
3357 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3358 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3359 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
3362 dnl Mozilla specific options
3363 dnl ========================================================
3364 dnl The macros used for command line options
3365 dnl are defined in build/autoconf/altoptions.m4.
3367 dnl If the compiler supports these attributes, define them as
3368 dnl convenience macros.
3369 if test "$ac_cv_attribute_malloc" = yes ; then
3370 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3372 AC_DEFINE(NS_ATTR_MALLOC,)
3375 if test "$ac_cv_attribute_warn_unused" = yes ; then
3376 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3378 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3381 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3382 dnl features that Windows actually does support.
3384 if test -n "$SKIP_COMPILER_CHECKS"; then
3385 dnl Windows has malloc.h
3386 AC_DEFINE(MALLOC_H, [<malloc.h>])
3387 AC_DEFINE(HAVE_FORCEINLINE)
3388 AC_DEFINE(HAVE_LOCALECONV)
3389 fi # SKIP_COMPILER_CHECKS
3391 dnl ========================================================
3393 dnl = Check for external package dependencies
3395 dnl ========================================================
3396 MOZ_ARG_HEADER(External Packages)
3398 MOZ_ARG_WITH_STRING(libxul-sdk,
3399 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3400 AC_MSG_ERROR([--with-libxul-sdk is not supported anymore.]))
3402 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3403 AC_SUBST(LIBXUL_DIST)
3407 dnl set GRE_MILESTONE
3408 dnl ========================================================
3409 if test -n "$LIBXUL_SDK"; then
3410 GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3412 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3414 AC_SUBST(GRE_MILESTONE)
3416 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3417 # The logic works like this:
3418 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3419 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3420 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3421 case "$GRE_MILESTONE" in
3424 AC_DEFINE(NIGHTLY_BUILD)
3430 AC_DEFINE(RELEASE_BUILD)
3433 AC_SUBST(NIGHTLY_BUILD)
3434 AC_SUBST(RELEASE_BUILD)
3436 dnl ========================================================
3437 dnl Disable compiling sources in unified mode.
3438 dnl ========================================================
3440 if test -z "$NIGHTLY_BUILD"; then
3441 MOZ_DISABLE_UNIFIED_COMPILATION=1
3444 MOZ_ARG_DISABLE_BOOL(unified-compilation,
3445 [ --disable-unified-compilation
3446 Disable unified compilation of some C/C++ sources],
3447 MOZ_DISABLE_UNIFIED_COMPILATION=1,
3448 MOZ_DISABLE_UNIFIED_COMPILATION=)
3449 AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
3451 dnl ========================================================
3452 dnl Multiprocess Firefox Nightly Testing UI
3453 dnl To be removed in Bug 1003313
3454 dnl ========================================================
3455 if test -z "$NIGHTLY_BUILD"; then
3459 AC_SUBST(E10S_TESTING_ONLY)
3461 dnl ========================================================
3462 dnl system libevent Support
3463 dnl ========================================================
3464 MOZ_ARG_WITH_STRING(system-libevent,
3465 [ --with-system-libevent[=PFX]
3466 Use system libevent [installed at prefix PFX]],
3467 LIBEVENT_DIR=$withval)
3469 _SAVE_CFLAGS=$CFLAGS
3470 _SAVE_LDFLAGS=$LDFLAGS
3472 if test "$LIBEVENT_DIR" = yes; then
3473 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3474 MOZ_NATIVE_LIBEVENT=1,
3477 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3478 MOZ_NATIVE_LIBEVENT=
3479 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3480 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3481 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3482 MOZ_CHECK_HEADER(event.h,
3483 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3484 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3486 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3487 AC_CHECK_LIB(event, event_init,
3488 [MOZ_NATIVE_LIBEVENT=1
3489 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3490 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3491 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3493 CFLAGS=$_SAVE_CFLAGS
3494 LDFLAGS=$_SAVE_LDFLAGS
3497 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3499 dnl ========================================================
3500 dnl = If NSS was not detected in the system,
3501 dnl = use the one in the source tree (mozilla/security/nss)
3502 dnl ========================================================
3504 MOZ_ARG_WITH_BOOL(system-nss,
3505 [ --with-system-nss Use system installed NSS],
3508 if test -n "$_USE_SYSTEM_NSS"; then
3509 AM_PATH_NSS(3.17.2, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3512 if test -n "$MOZ_NATIVE_NSS"; then
3513 NSS_LIBS="$NSS_LIBS -lcrmf"
3515 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3517 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
3519 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3520 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3521 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3522 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3523 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3525 NSS_LIBS='-L$(LIBXUL_DIST)/lib'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3529 dnl ======================
3531 dnl ======================
3533 AC_MSG_CHECKING([for YASM assembler])
3534 AC_CHECK_PROGS(YASM, yasm, "")
3536 if test -n "$YASM"; then
3537 dnl Pull out yasm's version string
3538 YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3539 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3540 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3541 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3542 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3545 if test -z "$SKIP_LIBRARY_CHECKS"; then
3546 dnl system JPEG support
3547 dnl ========================================================
3548 MOZ_ARG_WITH_STRING(system-jpeg,
3549 [ --with-system-jpeg[=PFX]
3550 Use system libjpeg [installed at prefix PFX]],
3553 _SAVE_CFLAGS=$CFLAGS
3554 _SAVE_LDFLAGS=$LDFLAGS
3556 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3557 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3558 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3560 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3563 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3566 if test "$MOZ_NATIVE_JPEG" = 1; then
3567 AC_TRY_COMPILE([ #include <stdio.h>
3568 #include <sys/types.h>
3569 #include <jpeglib.h> ],
3570 [ #if JPEG_LIB_VERSION < $MOZJPEG
3571 #error "Insufficient JPEG library version ($MOZJPEG required)."
3573 #ifndef JCS_EXTENSIONS
3574 #error "libjpeg-turbo JCS_EXTENSIONS required"
3578 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3580 CFLAGS=$_SAVE_CFLAGS
3581 LDFLAGS=$_SAVE_LDFLAGS
3584 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3585 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3586 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3588 fi # SKIP_LIBRARY_CHECKS
3590 dnl system ZLIB support
3591 dnl ========================================================
3592 MOZ_ZLIB_CHECK([1.2.3])
3594 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
3595 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
3600 if test -z "$SKIP_LIBRARY_CHECKS"; then
3601 dnl system BZIP2 Support
3602 dnl ========================================================
3603 MOZ_ARG_WITH_STRING(system-bz2,
3604 [ --with-system-bz2[=PFX]
3605 Use system libbz2 [installed at prefix PFX]],
3608 _SAVE_CFLAGS=$CFLAGS
3609 _SAVE_LDFLAGS=$LDFLAGS
3611 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
3612 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
3613 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
3615 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
3618 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
3619 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
3621 CFLAGS=$_SAVE_CFLAGS
3622 LDFLAGS=$_SAVE_LDFLAGS
3625 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
3626 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
3627 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
3630 dnl ========================================================
3631 dnl system PNG Support
3632 dnl ========================================================
3633 MOZ_ARG_WITH_STRING(system-png,
3634 [ --with-system-png[=PFX]
3635 Use system libpng [installed at prefix PFX]],
3638 _SAVE_CFLAGS=$CFLAGS
3639 _SAVE_LDFLAGS=$LDFLAGS
3641 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
3642 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
3643 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
3645 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
3648 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
3649 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3650 AC_CHECK_LIB(png, png_get_acTL, ,
3651 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
3653 if test "$MOZ_NATIVE_PNG" = 1; then
3654 AC_TRY_COMPILE([ #include <stdio.h>
3655 #include <sys/types.h>
3657 [ #if PNG_LIBPNG_VER < $MOZPNG
3658 #error "Insufficient libpng version ($MOZPNG required)."
3660 #ifndef PNG_UINT_31_MAX
3661 #error "Insufficient libpng version."
3664 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3666 CFLAGS=$_SAVE_CFLAGS
3667 LDFLAGS=$_SAVE_LDFLAGS
3670 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
3671 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
3672 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
3675 MOZ_PNG_ARM_NEON_CHECK=
3676 if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
3677 MOZ_ARG_ENABLE_STRING(png-arm-neon-support,
3678 [ --enable-png-arm-neon-support=TYPE
3682 nocheck (faster but unsafe)],
3683 [MOZ_PNG_ARM_NEON_SUPPORT=$enableval ] )
3684 case "$MOZ_PNG_ARM_NEON_SUPPORT" in
3686 # enable-png-arm-neon-support = no
3689 # enable-png-arm-neon-support = nocheck
3694 MOZ_PNG_ARM_NEON_CHECK=1
3699 AC_SUBST(MOZ_PNG_ARM_NEON_CHECK)
3701 fi # SKIP_LIBRARY_CHECKS
3703 AC_SUBST(MOZ_PNG_ARM_NEON)
3705 dnl ========================================================
3706 dnl system HunSpell Support
3707 dnl ========================================================
3708 MOZ_ARG_ENABLE_BOOL(system-hunspell,
3709 [ --enable-system-hunspell
3710 Use system hunspell (located with pkgconfig)],
3711 MOZ_NATIVE_HUNSPELL=1 )
3713 if test -n "$MOZ_NATIVE_HUNSPELL"; then
3714 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
3717 AC_SUBST(MOZ_NATIVE_HUNSPELL)
3719 dnl ========================================================
3720 dnl system libffi Support
3721 dnl ========================================================
3724 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
3725 if test "$OS_ARCH" = "WINNT"; then
3729 MOZ_ARG_ENABLE_BOOL(shared-js,
3730 [ --enable-shared-js
3731 Create a shared JavaScript library.],
3732 JS_SHARED_LIBRARY=1,
3735 dnl ========================================================
3736 dnl Java SDK support
3737 dnl ========================================================
3740 MOZ_ARG_WITH_STRING(java-bin-path,
3741 [ --with-java-bin-path=dir
3742 Location of Java binaries (java, javac, jar)],
3743 JAVA_BIN_PATH=$withval)
3745 dnl ========================================================
3749 dnl ========================================================
3751 MOZ_ARG_HEADER(Application)
3754 ENABLE_SYSTEM_EXTENSION_DIRS=1
3755 MOZ_BRANDING_DIRECTORY=
3756 MOZ_OFFICIAL_BRANDING=
3759 MOZ_AUTH_EXTENSION=1
3764 MOZ_SAMPLE_TYPE_FLOAT32=
3765 MOZ_SAMPLE_TYPE_S16=
3771 if test -n "$MOZ_FMP4"; then
3781 MOZ_WEBRTC_SIGNALING=
3782 MOZ_WEBRTC_ASSERT_ALWAYS=1
3783 MOZ_WEBRTC_HARDWARE_AEC_NS=
3786 MOZ_MEDIA_NAVIGATOR=
3789 MOZ_VPX_ERROR_CONCEALMENT=
3799 LIBJPEG_TURBO_ASFLAGS=
3800 LIBJPEG_TURBO_X86_ASM=
3801 LIBJPEG_TURBO_X64_ASM=
3802 LIBJPEG_TURBO_ARM_ASM=
3806 MOZ_PREF_EXTENSIONS=1
3807 MOZ_PROFILELOCKING=1
3813 MOZ_TOOLKIT_SEARCH=1
3815 MOZ_UNIVERSALCHARDET=1
3821 MOZ_DISABLE_CRYPTOLEGACY=
3824 NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device"
3825 if test -n "$MOZ_RTSP"; then
3826 NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp"
3830 MOZ_USE_NATIVE_POPUP_WINDOWS=
3831 MOZ_ANDROID_HISTORY=
3834 MOZ_LOCALE_SWITCHER=
3835 MOZ_ANDROID_SEARCH_ACTIVITY=
3836 MOZ_ANDROID_MLS_STUMBLER=
3837 MOZ_ANDROID_SHARE_OVERLAY=
3841 MOZ_AUDIO_CHANNEL_MANAGER=
3843 MOZ_CONTENT_SANDBOX=
3846 JSGC_USE_EXACT_ROOTING=1
3849 case "$target_os" in
3852 AC_DEFINE(NS_ENABLE_TSF)
3857 *-android*|*-linuxandroid*)
3858 if test "$CPU_ARCH" = "arm" ; then
3863 MOZ_THEME_FASTSTRIPE=1
3871 MOZ_ARG_WITH_STRING(external-source-dir,
3872 [ --with-external-source-dir=dir
3873 External directory containing additional build files.],
3874 [ EXTERNAL_SOURCE_DIR=$withval])
3875 AC_SUBST(EXTERNAL_SOURCE_DIR)
3877 MOZ_ARG_ENABLE_STRING(application,
3878 [ --enable-application=APP
3882 tools/update-packaging (AUS-related packaging tools)],
3883 [ MOZ_BUILD_APP=$enableval ] )
3885 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
3886 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
3887 XULRUNNER_STUB_NAME=$withval)
3889 if test -z "$XULRUNNER_STUB_NAME"; then
3890 case "$target_os" in
3892 XULRUNNER_STUB_NAME=xulrunner
3895 XULRUNNER_STUB_NAME=xulrunner-stub
3898 AC_SUBST(XULRUNNER_STUB_NAME)
3900 AC_MSG_CHECKING([for application to build])
3901 if test -z "$MOZ_BUILD_APP"; then
3902 AC_MSG_RESULT([browser])
3903 MOZ_BUILD_APP=browser
3905 # "mobile" no longer exists.
3906 if test "$MOZ_BUILD_APP" = "mobile" ; then
3907 AC_MSG_RESULT([none])
3908 AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
3910 # Support comm-central.
3911 if test -n "$EXTERNAL_SOURCE_DIR" ; then
3912 MOZ_BUILD_APP="$EXTERNAL_SOURCE_DIR/$MOZ_BUILD_APP"
3913 MOZ_BUILD_APP=`${PYTHON} -c "import mozpack.path as mozpath; print(mozpath.relpath(\"${MOZ_BUILD_APP}\", \"${srcdir}\"))"`
3915 # We have a valid application only if it has a build.mk file in its top
3917 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
3918 AC_MSG_RESULT([none])
3919 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
3921 AC_MSG_RESULT([$MOZ_BUILD_APP])
3925 # The app update channel is 'default' when not supplied. The value is used in
3926 # the application's confvars.sh so it must be set before confvars.sh is called.
3927 MOZ_ARG_ENABLE_STRING([update-channel],
3928 [ --enable-update-channel=CHANNEL
3929 Select application update channel (default=default)],
3930 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
3932 if test -z "$MOZ_UPDATE_CHANNEL"; then
3933 MOZ_UPDATE_CHANNEL=default
3935 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
3936 AC_SUBST(MOZ_UPDATE_CHANNEL)
3938 # Allow to specify a Mozilla API key file that contains the secret key to be
3939 # used for various Mozilla API requests.
3940 MOZ_ARG_WITH_STRING(mozilla-api-keyfile,
3941 [ --with-mozilla-api-keyfile=file Use the secret key contained in the given keyfile for Mozilla API requests],
3942 MOZ_MOZILLA_API_KEY=`cat $withval`)
3943 if test -z "$MOZ_MOZILLA_API_KEY"; then
3944 MOZ_MOZILLA_API_KEY=no-mozilla-api-key
3946 AC_SUBST(MOZ_MOZILLA_API_KEY)
3948 # Allow to specify a Google API key file that contains the secret key to be
3949 # used for various Google API requests.
3950 MOZ_ARG_WITH_STRING(google-api-keyfile,
3951 [ --with-google-api-keyfile=file Use the secret key contained in the given keyfile for Google API requests],
3952 MOZ_GOOGLE_API_KEY=`cat $withval`)
3953 if test -z "$MOZ_GOOGLE_API_KEY"; then
3954 MOZ_GOOGLE_API_KEY=no-google-api-key
3956 AC_SUBST(MOZ_GOOGLE_API_KEY)
3958 # Allow to specify a Google OAuth API key file that contains the client ID and
3959 # the secret key to be used for various Google OAuth API requests.
3960 MOZ_ARG_WITH_STRING(google-oauth-api-keyfile,
3961 [ --with-google-oauth-api-keyfile=file Use the client id and secret key contained in the given keyfile for Google OAuth API requests],
3962 [MOZ_GOOGLE_OAUTH_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
3963 MOZ_GOOGLE_OAUTH_API_KEY=`cat $withval | cut -f 2 -d " "`])
3964 if test -z "$MOZ_GOOGLE_OAUTH_API_CLIENTID"; then
3965 MOZ_GOOGLE_OAUTH_API_CLIENTID=no-google-oauth-api-clientid
3966 MOZ_GOOGLE_OAUTH_API_KEY=no-google-oauth-api-key
3968 AC_SUBST(MOZ_GOOGLE_OAUTH_API_CLIENTID)
3969 AC_SUBST(MOZ_GOOGLE_OAUTH_API_KEY)
3971 # Allow specifying a Bing API key file that contains the client ID and the
3972 # secret key to be used for the Bing Translation API requests.
3973 MOZ_ARG_WITH_STRING(bing-api-keyfile,
3974 [ --with-bing-api-keyfile=file Use the client id and secret key contained in the given keyfile for Bing API requests],
3975 [MOZ_BING_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
3976 MOZ_BING_API_KEY=`cat $withval | cut -f 2 -d " "`])
3977 if test -z "$MOZ_BING_API_CLIENTID"; then
3978 MOZ_BING_API_CLIENTID=no-bing-api-clientid
3979 MOZ_BING_API_KEY=no-bing-api-key
3981 AC_SUBST(MOZ_BING_API_CLIENTID)
3982 AC_SUBST(MOZ_BING_API_KEY)
3984 # Allow the application to influence configure with a confvars.sh script.
3985 AC_MSG_CHECKING([if app-specific confvars.sh exists])
3986 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
3987 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
3988 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
3993 # Allow influencing configure with a defines.sh script.
3994 . "${srcdir}/build/defines.sh"
3996 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
3998 if test "$BUILDING_RELEASE"; then
3999 # Override value in defines.sh, if any
4000 EARLY_BETA_OR_EARLIER=
4001 elif test "$EARLY_BETA_OR_EARLIER"; then
4002 AC_DEFINE(EARLY_BETA_OR_EARLIER)
4004 AC_SUBST(EARLY_BETA_OR_EARLIER)
4006 # Allow the application to provide a subconfigure script
4007 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4008 do_output_subdirs() {
4009 if test -n "$_subconfigure_subdirs"; then
4010 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4012 _subconfigure_subdir="$1"
4013 _subconfigure_config_args="$ac_configure_args"
4015 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4016 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4017 "${srcdir}/build/autoconf/altoptions.m4" \
4018 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4023 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4024 MOZ_ARG_WITH_STRING(app-name,
4025 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4026 WITH_APP_NAME=$withval,
4029 if test -n "$WITH_APP_NAME" ; then
4030 MOZ_APP_NAME="$WITH_APP_NAME"
4033 MOZ_ARG_WITH_STRING(app-basename,
4034 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4035 WITH_APP_BASENAME=$withval,
4038 if test -n "$WITH_APP_BASENAME" ; then
4039 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4042 # Now is a good time to test for logic errors, define mismatches, etc.
4043 case "$MOZ_BUILD_APP" in
4045 if test "$LIBXUL_SDK"; then
4046 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4051 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4052 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4054 case "$MOZ_BUILD_APP" in
4056 AC_DEFINE(MOZ_PHOENIX)
4060 AC_DEFINE(MOZ_XULRUNNER)
4067 AC_DEFINE(MOZ_MULET)
4071 AC_SUBST(MOZ_BUILD_APP)
4072 AC_SUBST(MOZ_PHOENIX)
4073 AC_SUBST(MOZ_XULRUNNER)
4076 AC_SUBST(MOZ_B2G_VERSION)
4078 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4080 dnl ========================================================
4081 dnl Check Android SDK version depending on mobile target.
4082 dnl ========================================================
4084 if test -z "$gonkdir" ; then
4085 # Minimum Android SDK API Level we require.
4086 case "$MOZ_BUILD_APP" in
4088 android_min_api_level=17
4090 *-android*|*-linuxandroid*)
4094 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])
4100 MOZ_ANDROID_SDK($android_min_api_level)
4103 dnl ========================================================
4105 dnl = Toolkit Options
4107 dnl ========================================================
4108 MOZ_ARG_HEADER(Toolkit Options)
4110 dnl ========================================================
4111 dnl = Select the default toolkit
4112 dnl ========================================================
4113 MOZ_ARG_ENABLE_STRING(default-toolkit,
4114 [ --enable-default-toolkit=TK
4115 Select default toolkit
4116 Platform specific defaults:
4117 Mac OS X - cairo-cocoa
4118 Win32 - cairo-windows
4122 [ _DEFAULT_TOOLKIT=$enableval ],
4123 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4125 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4126 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4127 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4128 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4129 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4130 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4131 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4132 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4133 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4135 dnl nglayout only supports building with one toolkit,
4136 dnl so ignore everything after the first comma (",").
4137 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4139 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4142 MOZ_ARG_WITHOUT_BOOL(x,
4143 [ --without-x Build without X11],
4146 dnl ========================================================
4147 dnl = Enable the toolkit as needed =
4148 dnl ========================================================
4152 case "$MOZ_WIDGET_TOOLKIT" in
4155 MOZ_WIDGET_TOOLKIT=windows
4157 MOZ_INSTRUMENT_EVENT_LOOP=1
4158 if test -n "$GNU_CC"; then
4164 MOZ_WIDGET_TOOLKIT=gtk3
4167 MOZ_ENABLE_XREMOTE=1
4168 MOZ_GL_DEFAULT_PROVIDER=GLX
4174 TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4175 TK_LIBS='$(MOZ_GTK3_LIBS)'
4177 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4179 MOZ_INSTRUMENT_EVENT_LOOP=1
4182 cairo-gtk2|cairo-gtk2-x11)
4183 MOZ_WIDGET_TOOLKIT=gtk2
4186 MOZ_ENABLE_XREMOTE=1
4187 MOZ_GL_DEFAULT_PROVIDER=GLX
4193 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4194 TK_LIBS='$(MOZ_GTK2_LIBS)'
4195 AC_DEFINE(MOZ_WIDGET_GTK2)
4197 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4199 MOZ_INSTRUMENT_EVENT_LOOP=1
4203 MOZ_WIDGET_TOOLKIT=qt
4205 if test -z "$WITHOUT_X11"; then
4206 MOZ_ENABLE_XREMOTE=1
4207 MOZ_GL_DEFAULT_PROVIDER=GLX
4214 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4215 TK_LIBS='$(MOZ_QT_LIBS)'
4216 AC_DEFINE(MOZ_WIDGET_QT)
4218 AC_DEFINE(QT_NO_KEYWORDS)
4222 MOZ_WIDGET_TOOLKIT=cocoa
4223 AC_DEFINE(MOZ_WIDGET_COCOA)
4224 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4225 # Use -Wl as a trick to avoid -framework and framework names from
4226 # being separated by AC_SUBST_LIST.
4227 TK_LIBS='-Wl,-framework,CoreLocation -Wl,-framework,QuartzCore -Wl,-framework,Carbon -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,AddressBook -Wl,-framework,OpenGL'
4228 TK_CFLAGS="-DNO_X11"
4229 CFLAGS="$CFLAGS $TK_CFLAGS"
4230 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4231 MOZ_USER_DIR="Mozilla"
4232 MOZ_FS_LAYOUT=bundle
4233 MOZ_INSTRUMENT_EVENT_LOOP=1
4237 MOZ_WIDGET_TOOLKIT=uikit
4238 AC_DEFINE(MOZ_WIDGET_UIKIT)
4239 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4240 TK_CFLAGS="-DNO_X11"
4241 TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText'
4242 CFLAGS="$CFLAGS $TK_CFLAGS"
4243 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4244 MOZ_USER_DIR="Mozilla"
4245 MOZ_FS_LAYOUT=bundle
4249 AC_DEFINE(MOZ_WIDGET_ANDROID)
4250 MOZ_WIDGET_TOOLKIT=android
4251 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4252 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4254 MOZ_INSTRUMENT_EVENT_LOOP=1
4258 AC_DEFINE(MOZ_WIDGET_GONK)
4259 AC_DEFINE(MOZ_TOUCH)
4260 MOZ_WIDGET_TOOLKIT=gonk
4261 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4262 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4265 MOZ_INSTRUMENT_EVENT_LOOP=1
4270 AC_SUBST(MOZ_PDF_PRINTING)
4271 if test "$MOZ_PDF_PRINTING"; then
4272 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4273 AC_DEFINE(MOZ_PDF_PRINTING)
4276 if test "$MOZ_ENABLE_XREMOTE"; then
4277 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4280 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4281 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4284 if test "$COMPILE_ENVIRONMENT"; then
4285 if test "$MOZ_ENABLE_GTK3"; then
4286 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4287 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
4289 if test "$MOZ_ENABLE_GTK"; then
4290 if test "$MOZ_X11"; then
4291 GDK_PACKAGES=gdk-x11-2.0
4294 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4295 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
4298 fi # COMPILE_ENVIRONMENT
4300 AC_SUBST(MOZ_FS_LAYOUT)
4302 dnl ========================================================
4303 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4304 dnl their usage and use them in spidermonkey.
4305 dnl ========================================================
4306 MOZ_ARG_WITH_BOOL(arm-kuser,
4307 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4309 if test -n "$USE_ARM_KUSER"; then
4310 AC_DEFINE(USE_ARM_KUSER)
4313 dnl ========================================================
4314 dnl = startup-notification support module
4315 dnl ========================================================
4317 if test "$MOZ_ENABLE_GTK"
4319 MOZ_ENABLE_STARTUP_NOTIFICATION=
4321 MOZ_ARG_ENABLE_BOOL(startup-notification,
4322 [ --enable-startup-notification
4323 Enable startup-notification support (default: disabled) ],
4324 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4325 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4326 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4328 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4329 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4330 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4331 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4333 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4335 MOZ_ENABLE_STARTUP_NOTIFICATION=
4339 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4340 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4343 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4345 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4347 dnl ========================================================
4348 dnl Disable printing
4349 dnl ========================================================
4350 MOZ_ARG_DISABLE_BOOL(printing,
4351 [ --disable-printing Disable printing support],
4355 if test "$NS_PRINTING"; then
4356 AC_DEFINE(NS_PRINTING)
4357 AC_DEFINE(NS_PRINT_PREVIEW)
4360 dnl ========================================================
4362 dnl ========================================================
4363 if test "$MOZ_ENABLE_QT"
4365 MOZ_ARG_WITH_STRING(qtdir,
4366 [ --with-qtdir=\$dir Specify Qt directory ],
4369 if test -z "$QTDIR"; then
4370 AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4372 HOST_QMAKE="$QTDIR/bin/qmake"
4374 QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4376 if test -z "$QTDIR"; then
4379 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4380 PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5Quick, ,
4382 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4384 QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4385 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4386 if test "$NS_PRINTING"; then
4387 PKG_CHECK_MODULES(MOZ_QT_WIDGETS, Qt5PrintSupport, ,
4389 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase widgets development package])
4391 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT_WIDGETS_LIBS"
4392 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT_WIDGETS_CFLAGS"
4396 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4400 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4401 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4403 MOZ_QT_CFLAGS="-DQT_SHARED"
4404 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4405 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4406 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4407 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4408 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4409 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4412 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4413 MOZ_QT_LIBS="$MOZ_QT_LIBS -L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml"
4414 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4415 if test "$NS_PRINTING"; then
4416 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4417 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4421 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4425 HOST_MOC="$QTDIR/bin/moc"
4426 HOST_RCC="$QTDIR/bin/rcc"
4428 if test -z "$HOST_MOC"; then
4429 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4431 if test -z "$HOST_RCC"; then
4432 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4438 MOZ_ENABLE_QMSYSTEM2=
4439 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4440 MOZ_ENABLE_QMSYSTEM2=1,
4441 MOZ_ENABLE_QMSYSTEM2=)
4443 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4444 MOZ_ENABLE_QMSYSTEM2=1
4445 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4446 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4447 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4450 MOZ_ENABLE_QTNETWORK=
4451 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4452 MOZ_ENABLE_QTNETWORK=1,
4453 MOZ_ENABLE_QTNETWORK=)
4455 if test "$MOZ_ENABLE_QTNETWORK"; then
4456 MOZ_ENABLE_QTNETWORK=1
4457 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4460 MOZ_ENABLE_QTMOBILITY=
4461 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4462 MOZ_ENABLE_QTMOBILITY=1,
4463 MOZ_ENABLE_QTMOBILITY=)
4464 if test "$MOZ_ENABLE_QTMOBILITY"; then
4465 MOZ_ENABLE_QTMOBILITY=1
4466 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4467 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4468 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4469 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4471 AC_CHECK_LIB(QtSensors, main, [
4472 MOZ_ENABLE_QTMOBILITY=1
4473 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4474 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4475 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4476 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4477 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4481 MOZ_ENABLE_QT5FEEDBACK=
4482 PKG_CHECK_MODULES(_QT5FEEDBACK, Qt0Feedback,
4483 MOZ_ENABLE_QT5FEEDBACK=1,
4484 MOZ_ENABLE_QT5FEEDBACK=)
4485 if test "$MOZ_ENABLE_QT5FEEDBACK"; then
4486 MOZ_ENABLE_QT5FEEDBACK=1
4487 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5FEEDBACK_CFLAGS"
4488 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5FEEDBACK_LIBS"
4489 AC_DEFINE(MOZ_ENABLE_QT5FEEDBACK)
4490 AC_SUBST(MOZ_ENABLE_QT5FEEDBACK)
4493 MOZ_ENABLE_QT5GEOPOSITION=
4494 PKG_CHECK_MODULES(_QT5GEOPOSITION, Qt5Positioning,
4495 MOZ_ENABLE_QT5GEOPOSITION=1,
4496 MOZ_ENABLE_QT5GEOPOSITION=)
4497 if test "$MOZ_ENABLE_QT5GEOPOSITION"; then
4498 MOZ_ENABLE_QT5GEOPOSITION=1
4499 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5GEOPOSITION_CFLAGS"
4500 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5GEOPOSITION_LIBS"
4501 AC_DEFINE(MOZ_ENABLE_QT5GEOPOSITION)
4502 AC_SUBST(MOZ_ENABLE_QT5GEOPOSITION)
4505 if test "$MOZ_ENABLE_CONTENTACTION"; then
4506 MOZ_ENABLE_CONTENTACTION=1
4507 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4510 MOZ_ENABLE_CONTENTACTION=
4511 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
4512 if test "$MOZ_ENABLE_CONTENTACTION"; then
4513 MOZ_ENABLE_CONTENTACTION=1
4514 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
4515 MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
4516 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4517 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
4521 AC_SUBST(GTK_CONFIG)
4522 AC_SUBST_LIST(TK_CFLAGS)
4523 AC_SUBST_LIST(TK_LIBS)
4525 AC_SUBST(MOZ_ENABLE_GTK2)
4526 AC_SUBST(MOZ_ENABLE_GTK3)
4527 AC_SUBST(MOZ_ENABLE_GTK)
4528 AC_SUBST(MOZ_ENABLE_QT)
4529 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4530 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4531 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4532 AC_SUBST(MOZ_ENABLE_XREMOTE)
4533 AC_SUBST(MOZ_WIDGET_GTK)
4534 AC_SUBST_LIST(MOZ_QT_CFLAGS)
4535 AC_SUBST_LIST(MOZ_QT_LIBS)
4542 dnl ========================================================
4544 dnl = Components & Features
4546 dnl ========================================================
4547 MOZ_ARG_HEADER(Components and Features)
4549 dnl ========================================================
4551 dnl ========================================================
4552 MOZ_ARG_ENABLE_STRING(ui-locale,
4553 [ --enable-ui-locale=ab-CD
4554 Select the user interface locale (default: en-US)],
4555 MOZ_UI_LOCALE=$enableval )
4556 AC_SUBST(MOZ_UI_LOCALE)
4558 dnl ========================================================
4559 dnl = Trademarked Branding
4560 dnl ========================================================
4561 MOZ_ARG_ENABLE_BOOL(official-branding,
4562 [ --enable-official-branding
4563 Enable Official mozilla.org Branding
4564 Do not distribute builds with
4565 --enable-official-branding unless you have
4566 permission to use trademarks per
4567 http://www.mozilla.org/foundation/trademarks/ .],
4569 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4570 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4572 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4573 MOZ_OFFICIAL_BRANDING=1
4575 ], MOZ_OFFICIAL_BRANDING=)
4577 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4578 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4579 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4582 MOZ_ARG_WITH_STRING(branding,
4583 [ --with-branding=dir Use branding from the specified directory.],
4584 MOZ_BRANDING_DIRECTORY=$withval)
4586 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4587 if test -z "$REAL_BRANDING_DIRECTORY"; then
4588 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4591 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4592 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4593 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4594 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
4597 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4599 dnl ========================================================
4600 dnl = Distribution ID
4601 dnl ========================================================
4602 MOZ_ARG_WITH_STRING(distribution-id,
4603 [ --with-distribution-id=ID
4604 Set distribution-specific id (default=org.mozilla)],
4605 [ val=`echo $withval`
4606 MOZ_DISTRIBUTION_ID="$val"])
4608 if test -z "$MOZ_DISTRIBUTION_ID"; then
4609 MOZ_DISTRIBUTION_ID="org.mozilla"
4612 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4613 AC_SUBST(MOZ_DISTRIBUTION_ID)
4616 dnl ========================================================
4618 dnl ========================================================
4619 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4621 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4623 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4626 dnl ========================================================
4627 dnl = GnomeVFS, GIO and GConf support module
4628 dnl ========================================================
4632 dnl build the GIO extension by default only when the
4633 dnl GTK2 toolkit is in use.
4634 if test "$MOZ_ENABLE_GTK"
4640 dnl ========================================================
4641 dnl = GnomeVFS support module
4642 dnl ========================================================
4643 MOZ_ARG_ENABLE_BOOL(gnomevfs,
4644 [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
4645 MOZ_ENABLE_GNOMEVFS=force,
4646 MOZ_ENABLE_GNOMEVFS=)
4648 if test "$MOZ_ENABLE_GNOMEVFS"
4650 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4651 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4652 MOZ_ENABLE_GNOMEVFS=1
4653 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4655 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4657 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4659 MOZ_ENABLE_GNOMEVFS=
4663 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4665 dnl ========================================================
4666 dnl = GIO support module
4667 dnl ========================================================
4668 MOZ_ARG_DISABLE_BOOL(gio,
4669 [ --disable-gio Disable GIO support],
4671 MOZ_ENABLE_GIO=force)
4673 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
4675 if test "$MOZ_ENABLE_GTK2"
4677 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4678 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4680 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4681 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4683 AC_DEFINE(MOZ_ENABLE_GIO)
4685 if test "$MOZ_ENABLE_GIO" = "force"
4687 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4693 AC_SUBST(MOZ_ENABLE_GIO)
4695 dnl ========================================================
4696 dnl = GConf support module
4697 dnl ========================================================
4698 MOZ_ARG_DISABLE_BOOL(gconf,
4699 [ --disable-gconf Disable Gconf support ],
4701 MOZ_ENABLE_GCONF=force)
4703 if test "$MOZ_ENABLE_GCONF"
4705 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4706 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4709 if test "$MOZ_ENABLE_GCONF" = "force"
4711 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4717 if test "$MOZ_ENABLE_GCONF"; then
4718 AC_DEFINE(MOZ_ENABLE_GCONF)
4721 AC_SUBST(MOZ_ENABLE_GCONF)
4724 dnl ========================================================
4725 dnl = libproxy support
4726 dnl ========================================================
4728 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4730 MOZ_ENABLE_LIBPROXY=
4732 MOZ_ARG_ENABLE_BOOL(libproxy,
4733 [ --enable-libproxy Enable libproxy support ],
4734 MOZ_ENABLE_LIBPROXY=1,
4735 MOZ_ENABLE_LIBPROXY=)
4737 if test "$MOZ_ENABLE_LIBPROXY"
4739 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4740 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4743 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4745 dnl ========================================================
4746 dnl = GNOME component (mozgnome)
4747 dnl ========================================================
4749 if test "$MOZ_ENABLE_GTK"
4751 MOZ_ENABLE_GNOME_COMPONENT=1
4753 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4755 dnl ========================================================
4756 dnl = libgnomeui support module
4757 dnl ========================================================
4759 if test "$MOZ_ENABLE_GTK"
4761 MOZ_ARG_ENABLE_BOOL(gnomeui,
4762 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
4763 MOZ_ENABLE_GNOMEUI=force,
4764 MOZ_ENABLE_GNOMEUI=)
4766 if test "$MOZ_ENABLE_GNOMEUI"
4768 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4770 MOZ_ENABLE_GNOMEUI=1
4772 if test "$MOZ_ENABLE_GNOMEUI" = "force"
4774 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4780 if test "$MOZ_ENABLE_GNOMEUI"; then
4781 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4785 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4787 dnl ========================================================
4789 dnl ========================================================
4791 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4795 MOZ_ARG_DISABLE_BOOL(dbus,
4796 [ --disable-dbus Disable dbus support ],
4800 if test "$MOZ_ENABLE_DBUS"
4802 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
4803 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
4804 AC_DEFINE(MOZ_ENABLE_DBUS)
4807 AC_SUBST(MOZ_ENABLE_DBUS)
4809 dnl ========================================================
4810 dnl = Enable Android History instead of Places
4811 dnl ========================================================
4812 if test -n "$MOZ_ANDROID_HISTORY"; then
4813 if test -z "$MOZ_PLACES"; then
4814 AC_DEFINE(MOZ_ANDROID_HISTORY)
4816 AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
4820 dnl ========================================================
4821 dnl = Enable the C++ async pan/zoom code instead of the Java version
4822 dnl ========================================================
4823 MOZ_ARG_ENABLE_BOOL(android-apz,
4824 [ --enable-android-apz Switch to C++ pan/zoom code],
4827 if test -n "$MOZ_ANDROID_APZ"; then
4828 dnl Do this if defined in confvars.sh
4829 AC_DEFINE(MOZ_ANDROID_APZ)
4832 dnl ========================================================
4833 dnl = Disable WebSMS backend
4834 dnl ========================================================
4835 MOZ_ARG_DISABLE_BOOL(websms-backend,
4836 [ --disable-websms-backend
4837 Disable WebSMS backend],
4838 MOZ_WEBSMS_BACKEND=,
4839 MOZ_WEBSMS_BACKEND=1)
4841 if test -n "$MOZ_WEBSMS_BACKEND"; then
4842 AC_DEFINE(MOZ_WEBSMS_BACKEND)
4845 dnl ========================================================
4846 dnl = Enable runtime locale switching on Android
4847 dnl ========================================================
4848 if test -n "$MOZ_LOCALE_SWITCHER"; then
4849 AC_DEFINE(MOZ_LOCALE_SWITCHER)
4852 dnl ========================================================
4853 dnl = Enable NFC permission on Android
4854 dnl ========================================================
4855 if test -n "$MOZ_ANDROID_BEAM"; then
4856 AC_DEFINE(MOZ_ANDROID_BEAM)
4859 dnl ========================================================
4860 dnl = Include Search Activity on Android
4861 dnl ========================================================
4862 if test -n "$MOZ_ANDROID_SEARCH_ACTIVITY"; then
4863 AC_DEFINE(MOZ_ANDROID_SEARCH_ACTIVITY)
4866 dnl ========================================================
4867 dnl = Include Mozilla Location Service Stumbler on Android
4868 dnl ========================================================
4869 if test -n "$MOZ_ANDROID_MLS_STUMBLER"; then
4870 AC_DEFINE(MOZ_ANDROID_MLS_STUMBLER)
4873 dnl ========================================================
4874 dnl = Include share overlay on Android
4875 dnl ========================================================
4876 if test -n "$MOZ_ANDROID_SHARE_OVERLAY"; then
4877 AC_DEFINE(MOZ_ANDROID_SHARE_OVERLAY)
4880 dnl ========================================================
4881 dnl = Enable IPDL's "expensive" unit tests
4882 dnl ========================================================
4885 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
4886 [ --enable-ipdl-tests Enable expensive IPDL tests],
4890 if test -n "$MOZ_IPDL_TESTS"; then
4891 AC_DEFINE(MOZ_IPDL_TESTS)
4894 AC_SUBST(MOZ_IPDL_TESTS)
4896 dnl ========================================================
4897 dnl = Disable building dbm
4898 dnl ========================================================
4899 MOZ_ARG_DISABLE_BOOL(dbm,
4900 [ --disable-dbm Disable building dbm],
4904 dnl ========================================================
4905 dnl accessibility support on by default on all platforms
4906 dnl ========================================================
4907 MOZ_ARG_DISABLE_BOOL(accessibility,
4908 [ --disable-accessibility Disable accessibility support],
4911 if test "$ACCESSIBILITY"; then
4914 if test -z "$MIDL"; then
4915 if test "$GCC" != "yes"; then
4916 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
4918 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.])
4922 AC_DEFINE(ACCESSIBILITY)
4925 dnl ========================================================
4926 dnl Accessibility is required for the linuxgl widget
4928 dnl ========================================================
4929 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
4930 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
4933 dnl Turn off webrtc for OS's we don't handle yet, but allow
4934 dnl --enable-webrtc to override. Can disable for everything in
4935 dnl the master list above.
4936 if test -n "$MOZ_WEBRTC"; then
4938 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
4942 dnl default to disabled for all others
4948 AC_TRY_COMPILE([#include <linux/ethtool.h>],
4949 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
4950 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
4952 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
4954 # target_arch is from {ia32|x64|arm|ppc}
4956 x86_64 | arm | x86 | ppc* | ia64)
4960 # unsupported arch for webrtc
4966 dnl ========================================================
4967 dnl = Disable WebRTC code
4968 dnl ========================================================
4969 MOZ_ARG_DISABLE_BOOL(webrtc,
4970 [ --disable-webrtc Disable support for WebRTC],
4974 if test -n "$MOZ_WEBRTC"; then
4975 AC_DEFINE(MOZ_WEBRTC)
4976 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
4977 dnl opt/production builds (via MOZ_CRASH())
4978 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
4981 MOZ_VPX_ERROR_CONCEALMENT=1
4983 dnl enable once Signaling lands
4984 MOZ_WEBRTC_SIGNALING=1
4985 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
4986 dnl enable once PeerConnection lands
4987 MOZ_PEERCONNECTION=1
4988 AC_DEFINE(MOZ_PEERCONNECTION)
4993 if test -n "$MOZ_X11"; then
4994 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
5000 dnl ========================================================
5001 dnl = Force hardware AEC, disable webrtc.org AEC
5002 dnl ========================================================
5003 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
5004 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
5005 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
5006 MOZ_WEBRTC_HARDWARE_AEC_NS=)
5008 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
5009 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
5012 AC_SUBST(MOZ_WEBRTC)
5013 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5014 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5015 AC_SUBST(MOZ_PEERCONNECTION)
5016 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5017 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
5020 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
5022 dnl Use integers over floats for audio on B2G and Android
5023 dnl (regarless of the CPU architecture, because audio
5024 dnl backends for those platforms don't support floats. We also
5025 dnl use integers on ARM with other OS, because it's more efficient.
5026 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
5027 MOZ_SAMPLE_TYPE_S16=1
5028 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5029 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5031 MOZ_SAMPLE_TYPE_FLOAT32=1
5032 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5033 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5036 dnl ========================================================
5037 dnl = Disable Speech API code
5038 dnl ========================================================
5039 MOZ_ARG_DISABLE_BOOL(webspeech,
5040 [ --disable-webspeech Disable support for HTML Speech API],
5044 if test -n "$MOZ_WEBSPEECH"; then
5045 AC_DEFINE(MOZ_WEBSPEECH)
5048 AC_SUBST(MOZ_WEBSPEECH)
5050 dnl ========================================================
5051 dnl = Enable Raw Codecs
5052 dnl ========================================================
5053 MOZ_ARG_ENABLE_BOOL(raw,
5054 [ --enable-raw Enable support for RAW media],
5058 if test -n "$MOZ_RAW"; then
5064 dnl Checks for __attribute__(aligned()) directive need by libogg
5065 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5066 [ac_cv_c_attribute_aligned],
5067 [ac_cv_c_attribute_aligned=0
5068 CFLAGS_save="${CFLAGS}"
5069 CFLAGS="${CFLAGS} -Werror"
5070 for ac_cv_c_attr_align_try in 64 32 16 8; do
5071 echo "trying $ac_cv_c_attr_align_try"
5073 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5074 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5075 if test "$ac_cv_c_attribute_aligned" != 0; then
5079 CFLAGS="${CFLAGS_save}"])
5080 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5081 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5082 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5085 dnl ========================================================
5086 dnl = Disable Opus audio codec support
5087 dnl ========================================================
5088 MOZ_ARG_DISABLE_BOOL(opus,
5089 [ --disable-opus Disable support for Opus audio],
5093 dnl ========================================================
5094 dnl = Disable VP8 decoder support
5095 dnl ========================================================
5096 MOZ_ARG_DISABLE_BOOL(webm,
5097 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5101 if test -n "$MOZ_WEBM"; then
5106 dnl ========================================================
5107 dnl = Apple platform decoder support
5108 dnl ========================================================
5109 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5113 if test -n "$MOZ_APPLEMEDIA"; then
5114 AC_DEFINE(MOZ_APPLEMEDIA)
5115 # hack in frameworks for fmp4 - see bug 1029974
5116 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
5117 LDFLAGS="$LDFLAGS -framework AudioToolbox"
5118 dnl Verify CoreMedia is available.
5119 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
5120 [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
5123 dnl ========================================================
5124 dnl = DirectShow support
5125 dnl ========================================================
5126 if test "$OS_ARCH" = "WINNT"; then
5127 dnl Enable DirectShow support by default.
5131 MOZ_ARG_DISABLE_BOOL(directshow,
5132 [ --disable-directshow Disable support for DirectShow],
5136 if test -n "$MOZ_DIRECTSHOW"; then
5137 AC_DEFINE(MOZ_DIRECTSHOW)
5140 dnl ========================================================
5141 dnl = Windows Media Foundation support
5142 dnl ========================================================
5143 if test "$OS_ARCH" = "WINNT"; then
5144 dnl Enable Windows Media Foundation support by default.
5145 dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5146 dnl guaranteed to have a recent-enough SDK to build WMF.
5150 MOZ_ARG_DISABLE_BOOL(wmf,
5151 [ --disable-wmf Disable support for Windows Media Foundation],
5155 if test -n "$MOZ_WMF"; then
5159 dnl ========================================================
5160 dnl FFmpeg H264/AAC Decoding Support
5161 dnl ========================================================
5162 case "$OS_TARGET" in
5163 WINNT|Darwin|Android)
5170 MOZ_ARG_DISABLE_BOOL(ffmpeg,
5171 [ --disable-ffmpeg Disable FFmpeg for fragmented H264/AAC decoding],
5176 if test -n "$MOZ_FFMPEG"; then
5177 AC_DEFINE(MOZ_FFMPEG)
5180 dnl ========================================================
5181 dnl = Built-in fragmented MP4 support.
5182 dnl ========================================================
5184 if test "$OS_TARGET" = Android; then
5188 if test -n "$MOZ_WMF" -o -n "$MOZ_FFMPEG" -o -n "$MOZ_APPLEMEDIA"; then
5189 dnl Enable fragmented MP4 parser on Windows by default.
5190 dnl We will also need to enable it on other platforms as we implement
5191 dnl platform decoder support there too.
5195 MOZ_ARG_DISABLE_BOOL(fmp4,
5196 [ --disable-fmp4 Disable support for in built Fragmented MP4 parsing],
5200 if test -n "$MOZ_FMP4"; then
5204 dnl ========================================================
5206 dnl ========================================================
5208 MOZ_ARG_DISABLE_BOOL(eme,
5209 [ --disable-eme Disable support for Encrypted Media Extensions],
5213 if test -n "$MOZ_EME"; then
5217 dnl ========================================================
5218 dnl = Enable media plugin support
5219 dnl ========================================================
5220 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5221 dnl Enable support on android by default
5225 MOZ_ARG_ENABLE_BOOL(android-omx,
5226 [ --enable-android-omx Enable support for Android OMX media backend],
5230 if test -n "$MOZ_ANDROID_OMX"; then
5231 AC_DEFINE(MOZ_ANDROID_OMX)
5234 dnl ========================================================
5235 dnl = Enable getUserMedia support
5236 dnl ========================================================
5237 MOZ_ARG_ENABLE_BOOL(media-navigator,
5238 [ --enable-media-navigator Enable support for getUserMedia],
5239 MOZ_MEDIA_NAVIGATOR=1,
5240 MOZ_MEDIA_NAVIGATOR=)
5242 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5243 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5246 dnl ========================================================
5247 dnl = Enable building OMX media plugin (B2G or Android)
5248 dnl ========================================================
5249 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5250 dnl Enable support on android by default
5254 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5255 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5259 if test -n "$MOZ_OMX_PLUGIN"; then
5260 if test "$OS_TARGET" = "Android"; then
5261 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5262 AC_DEFINE(MOZ_OMX_PLUGIN)
5264 dnl fail if we're not building on Gonk or Android
5265 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5269 dnl system libvpx Support
5270 dnl ========================================================
5271 MOZ_ARG_WITH_BOOL(system-libvpx,
5272 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5273 MOZ_NATIVE_LIBVPX=1)
5278 if test -n "$MOZ_VPX"; then
5280 if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
5281 AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
5284 _SAVE_CFLAGS=$CFLAGS
5286 if test -n "$MOZ_NATIVE_LIBVPX"; then
5287 dnl ============================
5288 dnl === libvpx Version check ===
5289 dnl ============================
5290 dnl Check to see if we have a system libvpx package.
5291 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.3.0)
5293 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
5294 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
5296 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5297 [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.])])
5299 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5300 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5302 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
5303 [AC_CHECK_FUNC(vpx_mem_set_functions)])
5304 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
5305 "$ac_cv_func_vpx_mem_set_functions" = no; then
5306 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
5309 CFLAGS=$_SAVE_CFLAGS
5313 AC_SUBST(MOZ_NATIVE_LIBVPX)
5314 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
5315 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
5317 if test "$MOZ_WEBM"; then
5318 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5325 if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then
5327 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5328 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5329 dnl We currently require gcc on all arm platforms.
5332 VPX_NEED_OBJ_INT_EXTRACT=
5334 dnl See if we have assembly on this platform.
5335 case "$OS_ARCH:$CPU_ARCH" in
5337 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5341 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5345 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5349 dnl Check for yasm 1.1 or greater.
5350 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5351 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.])
5352 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5353 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.])
5355 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5357 dnl The encoder needs obj_int_extract to get asm offsets.
5361 if test -n "$GNU_AS" ; then
5363 dnl These flags are a lie; they're just used to enable the requisite
5364 dnl opcodes; actual arch detection is done at runtime.
5365 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5366 VPX_DASH_C_FLAG="-c"
5367 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5368 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5373 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5374 VPX_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC"
5379 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5380 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5386 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5387 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.])
5390 if test -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5391 dnl We prefer to get asm offsets using inline assembler, which the above
5392 dnl compilers can do. When we're not using one of those, we have to fall
5393 dnl back to obj_int_extract, which reads them from a compiled object
5394 dnl file. Unfortunately, that only works if we're compiling on a system
5395 dnl with the header files for the appropriate object file format.
5396 VPX_NEED_OBJ_INT_EXTRACT=1
5399 if test -n "$VPX_X86_ASM"; then
5400 AC_DEFINE(VPX_X86_ASM)
5401 elif test -n "$VPX_ARM_ASM"; then
5402 AC_DEFINE(VPX_ARM_ASM)
5404 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5408 dnl ========================================================
5409 dnl = Disable Wave decoder support
5410 dnl ========================================================
5411 MOZ_ARG_DISABLE_BOOL(wave,
5412 [ --disable-wave Disable Wave decoder support],
5416 if test -n "$MOZ_WAVE"; then
5420 dnl ========================================================
5421 dnl = Handle dependent MEDIA defines
5422 dnl ========================================================
5424 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5425 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/])
5428 if test -n "$MOZ_WEBRTC" -a -z "$MOZ_OPUS"; then
5429 AC_MSG_ERROR([MOZ_WEBRTC requires MOZ_OPUS which is disabled.])
5432 if test -n "$MOZ_VORBIS"; then
5433 AC_DEFINE(MOZ_VORBIS)
5436 if test -n "$MOZ_TREMOR"; then
5437 AC_DEFINE(MOZ_TREMOR)
5438 # Tremor doesn't have an encoder.
5442 if test -n "$MOZ_OPUS"; then
5446 if test -n "$MOZ_WEBM_ENCODER"; then
5447 AC_DEFINE(MOZ_WEBM_ENCODER)
5449 AC_SUBST(MOZ_WEBM_ENCODER)
5451 dnl ==================================
5452 dnl = Check alsa availability on Linux
5453 dnl ==================================
5455 dnl If using Linux, ensure that the alsa library is available
5456 if test "$OS_TARGET" = "Linux"; then
5460 MOZ_ARG_ENABLE_BOOL(alsa,
5461 [ --enable-alsa Enable Alsa support (default on Linux)],
5465 if test -n "$MOZ_ALSA"; then
5466 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5467 [echo "$MOZ_ALSA_PKG_ERRORS"
5468 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.)])])
5473 dnl ========================================================
5474 dnl = Disable PulseAudio
5475 dnl ========================================================
5477 dnl If using Linux, ensure that the PA library is available
5478 case "$OS_TARGET" in
5479 WINNT|Darwin|Android|OpenBSD)
5482 if test -z "$MOZ_B2G"; then
5488 MOZ_ARG_DISABLE_BOOL(pulseaudio,
5489 [ --disable-pulseaudio Disable PulseAudio support],
5493 if test -n "$MOZ_PULSEAUDIO"; then
5494 if test -z "$gonkdir"; then
5495 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5496 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5497 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
5499 MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
5503 AC_SUBST(MOZ_PULSEAUDIO)
5505 dnl ========================================================
5506 dnl = Enable GStreamer
5507 dnl ========================================================
5508 case "$OS_TARGET" in
5509 WINNT|Darwin|Android)
5513 GST_API_VERSION=0.10
5517 MOZ_ARG_ENABLE_STRING(gstreamer,
5518 [ --enable-gstreamer[=0.10] Enable GStreamer support],
5520 # API version, eg 0.10, 1.0 etc
5521 if test -z "$enableval" -o "$enableval" = "yes"; then
5522 GST_API_VERSION=0.10
5523 elif test "$enableval" = "no"; then
5526 GST_API_VERSION=$enableval
5530 if test -n "$MOZ_GSTREAMER"; then
5531 # core/base release number
5532 if test "$GST_API_VERSION" = "1.0"; then
5538 PKG_CHECK_MODULES(GSTREAMER,
5539 gstreamer-$GST_API_VERSION >= $GST_VERSION
5540 gstreamer-app-$GST_API_VERSION
5541 gstreamer-plugins-base-$GST_API_VERSION,
5542 [_HAVE_GSTREAMER=1],
5544 if test -z "$_HAVE_GSTREAMER"; then
5545 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])
5548 _SAVE_LDFLAGS=$LDFLAGS
5549 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5550 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5551 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5552 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5554 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.])
5556 LDFLAGS=$_SAVE_LDFLAGS
5559 AC_SUBST(MOZ_GSTREAMER)
5560 AC_SUBST(GST_API_VERSION)
5562 if test -n "$MOZ_GSTREAMER"; then
5563 AC_DEFINE(MOZ_GSTREAMER)
5564 AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION")
5568 dnl ========================================================
5569 dnl Permissions System
5570 dnl ========================================================
5571 MOZ_ARG_DISABLE_BOOL(permissions,
5572 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5577 dnl ========================================================
5578 dnl Child permissions, currently only used for b2g
5579 dnl ========================================================
5580 if test -n "$MOZ_B2G"; then
5581 if test -n "$MOZ_PERMISSIONS"; then
5582 MOZ_CHILD_PERMISSIONS=1
5584 AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
5587 AC_SUBST(MOZ_CHILD_PERMISSIONS)
5589 dnl ========================================================
5591 dnl ========================================================
5592 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5593 [ --disable-negotiateauth Disable GSS-API negotiation ],
5594 MOZ_AUTH_EXTENSION=,
5595 MOZ_AUTH_EXTENSION=1 )
5597 dnl ========================================================
5598 dnl Pref extensions (autoconfig)
5599 dnl ========================================================
5600 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5601 [ --disable-pref-extensions
5602 Disable pref extensions such as autoconfig],
5603 MOZ_PREF_EXTENSIONS=,
5604 MOZ_PREF_EXTENSIONS=1 )
5606 dnl ========================================================
5607 dnl Searching of system directories for extensions.
5608 dnl Note: this switch is meant to be used for test builds
5609 dnl whose behavior should not depend on what happens to be
5610 dnl installed on the local machine.
5611 dnl ========================================================
5612 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5613 [ --disable-system-extension-dirs
5614 Disable searching system- and account-global
5615 directories for extensions of any kind; use
5616 only profile-specific extension directories],
5617 ENABLE_SYSTEM_EXTENSION_DIRS=,
5618 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5619 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5620 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5623 dnl ========================================================
5624 dnl = Universalchardet
5625 dnl ========================================================
5626 MOZ_ARG_DISABLE_BOOL(universalchardet,
5627 [ --disable-universalchardet
5628 Disable universal encoding detection],
5629 MOZ_UNIVERSALCHARDET=,
5630 MOZ_UNIVERSALCHARDET=1 )
5632 if test -n "${JAVA_BIN_PATH}"; then
5633 dnl Look for javac and jar in the specified path.
5634 JAVA_PATH="$JAVA_BIN_PATH"
5636 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5637 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5640 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5641 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5642 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5643 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5644 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5645 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5647 if test -n "${JAVA_BIN_PATH}" -o \
5648 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5649 if test -z "$JAVA" -o "$JAVA" = ":"; then
5650 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}])
5652 if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5653 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}])
5655 if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5656 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}])
5658 if test -z "$JAR" -o "$JAR" = ":"; then
5659 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}])
5661 if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5662 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}])
5664 if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5665 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}])
5668 AC_MSG_CHECKING([for minimum required javac version = 1.7])
5670 dnl Javac spits out something like `javac 1.7.0`. This line cuts off the 'javac'
5671 _javac_version=$($JAVAC -version 2>&1 | cut -d ' ' -f 2)
5673 dnl Here, we extract the major (1) and minor (7) version numbers from the
5674 dnl acquired version string.
5675 _javac_major_version=$(echo $_javac_version | cut -d '.' -f 1)
5676 _javac_minor_version=$(echo $_javac_version | cut -d '.' -f 2)
5678 AC_MSG_RESULT([$_javac_version])
5680 dnl Fail if we have a version other than 1.7.X
5681 if test "$_javac_major_version" -ne "1" -o \
5682 \( "$_javac_minor_version" -ne "7" \); then
5683 AC_MSG_ERROR([javac 1.7 is required.])
5687 dnl ========================================================
5688 dnl = ANGLE OpenGL->D3D translator for WebGL
5689 dnl = * only applies to win32
5690 dnl ========================================================
5694 MOZ_HAS_WINSDK_WITH_D3D=
5695 MOZ_D3DCOMPILER_VISTA_DLL=
5696 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5697 MOZ_DIRECTX_SDK_PATH=
5698 MOZ_D3DCOMPILER_XP_DLL=
5699 MOZ_D3DCOMPILER_XP_CAB=
5701 case "$target_os" in
5703 MOZ_ANGLE_RENDERER=1
5707 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5708 case "${target_cpu}" in
5710 MOZ_D3D_CPU_SUFFIX=x86
5713 MOZ_D3D_CPU_SUFFIX=x64
5717 MOZ_ARG_ENABLE_BOOL(require-all-d3dc-versions,
5718 [ --enable-require-all-d3dc-versions Require all versions of the D3D compiler needed for supported Windows systems.],
5719 MOZ_REQUIRE_ALL_D3DCS=1,
5720 MOZ_REQUIRE_ALL_D3DCS=)
5722 # This is potentially set in external mozconfig files; if it's set,
5723 # then the build exposes the "webgl" context name, which is reserved
5724 # for conformant implementations.
5725 if test -n "$MOZ_WEBGL_CONFORMANT"; then
5726 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
5729 dnl ========================================================
5730 dnl D3D compiler DLL
5731 dnl ========================================================
5732 MOZ_FOUND_D3D_COMPILERS=
5734 if test -n "$MOZ_ANGLE_RENDERER"; then
5735 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
5736 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
5739 ######################################
5740 # Find _46+ for use by Vista+.
5742 # Find a D3D compiler DLL in a Windows SDK.
5743 MOZ_D3DCOMPILER_VISTA_DLL=
5744 case "$MOZ_WINSDK_MAXVER" in
5746 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
5747 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
5750 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_46.dll
5751 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.0.])
5755 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5756 # We have a name, now track down the path.
5757 if test -n "$WINDOWSSDKDIR"; then
5758 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
5759 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5760 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5761 MOZ_HAS_WINSDK_WITH_D3D=1
5763 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5764 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
5765 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5768 AC_MSG_RESULT([Windows SDK not found.])
5772 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5773 MOZ_D3DCOMPILER_VISTA_DLL=
5776 # On mingw, check if headers are provided by toolchain.
5777 if test -n "$GNU_CC"; then
5778 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
5781 ######################################
5782 # Find _43 for use by XP.
5784 # Get the SDK path from the registry.
5785 # First try to get the June 2010 SDK
5786 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5787 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5788 # Otherwise just take whatever comes first
5789 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5791 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'`
5793 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5794 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/dxguid.lib ; then
5795 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5797 AC_MSG_RESULT([DirectX SDK not found.])
5798 MOZ_DIRECTX_SDK_PATH=
5801 # Check that our DirectX SDK is acceptable.
5802 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5803 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5804 AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
5805 MOZ_DIRECTX_SDK_PATH=
5809 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5810 # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
5811 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5812 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'`
5814 if test -n "$MOZ_D3DX9_VERSION" ; then
5815 MOZ_D3DCOMPILER_XP_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_D3D_CPU_SUFFIX}.cab | head -n1`
5817 if test -n "$MOZ_D3DCOMPILER_XP_CAB"; then
5818 MOZ_D3DCOMPILER_XP_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5820 AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
5821 AC_MSG_ERROR([DirectX SDK at "$MOZ_DIRECTX_SDK_PATH" appears broken.])
5822 MOZ_DIRECTX_SDK_PATH=
5825 AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
5826 MOZ_DIRECTX_SDK_PATH=
5829 AC_MSG_RESULT([Couldn't find an acceptable DirectX SDK for ANGLE, needed for d3dcompiler_43.])
5830 AC_MSG_RESULT([ Either ignore, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5833 ######################################
5834 # Check that we found what we needed.
5835 MOZ_FOUND_A_D3D_COMPILER=
5836 MOZ_FOUND_BOTH_D3D_COMPILERS=1
5838 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5839 MOZ_FOUND_A_D3D_COMPILER=1
5840 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
5842 MOZ_FOUND_BOTH_D3D_COMPILERS=
5845 if test -n "$MOZ_D3DCOMPILER_XP_DLL"; then
5846 MOZ_FOUND_A_D3D_COMPILER=1
5847 AC_MSG_RESULT([Found d3dcompiler DLL for XP: $MOZ_D3DCOMPILER_XP_DLL])
5849 MOZ_FOUND_BOTH_D3D_COMPILERS=
5852 if test -z "$CROSS_COMPILE"; then
5853 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
5854 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
5855 AC_MSG_ERROR([ Either install Windows SDK 8.0+, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5858 if test -n "$MOZ_REQUIRE_ALL_D3DCS" -a -z "$MOZ_FOUND_BOTH_D3D_COMPILERS"; then
5859 AC_MSG_ERROR([Both D3D compilers _43 and _46+ are required by --enable-require-d3d-compilers.])
5860 AC_MSG_ERROR([ Install Windows SDK 8.0+, as well as DirectX SDK (June 2010 version or newer), or reconfigure without this flag.])
5866 dnl ========================================================
5868 dnl ========================================================
5870 MOZ_GAMEPAD_BACKEND=stub
5872 # Gamepad DOM is built on supported platforms by default.
5873 case "$OS_TARGET" in
5878 if test "$MOZ_WIDGET_TOOLKIT" != "gonk"; then
5886 MOZ_ARG_DISABLE_BOOL(gamepad,
5887 [ --disable-gamepad Disable gamepad support],
5891 if test "$MOZ_GAMEPAD"; then
5892 case "$OS_TARGET" in
5894 MOZ_GAMEPAD_BACKEND=cocoa
5897 case "$MOZ_WINSDK_MAXVER" in
5898 # We support building with the Windows 7 SDK otherwise, but
5899 # Gamepad support requires the Windows 8 SDK for some HID headers.
5901 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.])
5906 MOZ_GAMEPAD_BACKEND=windows
5909 MOZ_CHECK_HEADER([linux/joystick.h])
5910 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5911 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.])
5913 MOZ_GAMEPAD_BACKEND=linux
5916 MOZ_GAMEPAD_BACKEND=android
5922 AC_DEFINE(MOZ_GAMEPAD)
5924 AC_SUBST(MOZ_GAMEPAD)
5925 AC_SUBST(MOZ_GAMEPAD_BACKEND)
5927 dnl ========================================================
5928 dnl = Breakpad crash reporting (on by default on supported platforms)
5929 dnl ========================================================
5932 i?86-*-mingw*|x86_64-*-mingw*)
5935 i?86-apple-darwin*|x86_64-apple-darwin*)
5938 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5939 if test "$MOZ_ENABLE_GTK"; then
5943 *-android*|*-linuxandroid*)
5951 MOZ_ARG_DISABLE_BOOL(crashreporter,
5952 [ --disable-crashreporter Disable breakpad crash reporting],
5953 [MOZ_CRASHREPORTER=],
5954 [MOZ_CRASHREPORTER=F # Force enable breakpad])
5956 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
5957 if test "$MOZ_CRASHREPORTER" = F; then
5958 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
5963 if test -n "$MOZ_CRASHREPORTER"; then
5964 AC_DEFINE(MOZ_CRASHREPORTER)
5966 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5967 test -z "$SKIP_LIBRARY_CHECKS"; then
5968 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5971 if test "$OS_ARCH" = "WINNT"; then
5972 if test -z "$HAVE_64BIT_BUILD"; then
5973 MOZ_CRASHREPORTER_INJECTOR=1
5974 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5979 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5980 [ --with-crashreporter-enable-percent=NN
5981 Enable sending crash reports by default on NN% of users. (default=100)],
5982 [ val=`echo $withval | sed 's/[^0-9]//g'`
5983 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5985 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5986 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5988 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5990 dnl ========================================================
5991 dnl = libjpeg-turbo configuration
5992 dnl ========================================================
5994 if test -z "$MOZ_NATIVE_JPEG"; then
5998 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5999 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
6001 MOZ_LIBJPEG_TURBO=1)
6003 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6004 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6007 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6010 if test -n "$MOZ_LIBJPEG_TURBO"; then
6012 dnl Do we support libjpeg-turbo on this platform?
6013 case "$OS_ARCH:$OS_TEST" in
6015 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6016 LIBJPEG_TURBO_X86_ASM=1
6019 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6020 LIBJPEG_TURBO_X64_ASM=1
6022 WINNT:x86|WINNT:i?86)
6023 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6024 LIBJPEG_TURBO_X86_ASM=1
6027 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6028 LIBJPEG_TURBO_X64_ASM=1
6031 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6032 LIBJPEG_TURBO_ARM_ASM=1
6035 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6036 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6037 LIBJPEG_TURBO_X86_ASM=1
6041 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6042 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6043 LIBJPEG_TURBO_X64_ASM=1
6050 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6051 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6052 dnl it doesn't exist or we have too old of a version.
6053 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6054 LIBJPEG_TURBO_AS=$YASM
6056 if test -z "$LIBJPEG_TURBO_AS" ; then
6057 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.])
6060 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6061 dnl on Linux and 1.1 or newer everywhere else.
6062 if test "$OS_ARCH" = "Linux" ; then
6063 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
6064 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.])
6067 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6068 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.])
6073 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6074 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6075 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6076 echo "Using $AS as the assembler for ARM code."
6077 LIBJPEG_TURBO_AS=$AS
6080 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6081 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6082 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6083 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6084 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6085 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6086 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6087 dnl Warn if we're not building the optimized routines, even though the user
6088 dnl didn't specify --disable-libjpeg-turbo.
6089 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6092 dnl ========================================================
6093 dnl = Enable compilation of specific extension modules
6094 dnl ========================================================
6096 MOZ_ARG_ENABLE_STRING(extensions,
6097 [ --enable-extensions Enable extensions],
6098 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6099 if test "$option" = "yes" -o "$option" = "all"; then
6100 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6101 elif test "$option" = "no" -o "$option" = "none"; then
6103 elif test "$option" = "default"; then
6104 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6105 elif test `echo "$option" | grep -c \^-` != 0; then
6106 option=`echo $option | sed 's/^-//'`
6107 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6109 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6112 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6114 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6115 # Suppress warning on non-X11 platforms
6116 if test -n "$MOZ_X11"; then
6117 AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6119 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6122 dnl Do not build gnomevfs with libxul based apps
6123 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6124 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6127 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6128 # Suppress warning on non-X11 platforms
6129 if test -n "$MOZ_X11"; then
6130 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6132 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6135 dnl Do not build gio with libxul based apps
6136 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6137 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6140 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6142 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6144 AC_SUBST(MOZ_GIO_COMPONENT)
6147 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6149 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6150 dnl when trying to build a nonexistent extension.
6151 for extension in $MOZ_EXTENSIONS; do
6152 if test ! -d "${srcdir}/extensions/${extension}"; then
6153 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6157 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6158 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6161 dnl ========================================================
6162 dnl Build Freetype in the tree
6163 dnl ========================================================
6164 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6165 [ --enable-tree-freetype Enable Tree FreeType],
6166 MOZ_TREE_FREETYPE=1,
6167 MOZ_TREE_FREETYPE= )
6168 if test -n "$MOZ_TREE_FREETYPE"; then
6169 if test -n "$_WIN32_MSVC"; then
6170 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6172 AC_DEFINE(MOZ_TREE_FREETYPE)
6173 AC_SUBST(MOZ_TREE_FREETYPE)
6174 MOZ_ENABLE_CAIRO_FT=1
6175 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6176 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6177 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6179 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6180 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6181 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6182 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
6185 dnl ========================================================
6187 dnl ========================================================
6188 dnl Abort Windows build if the required major version and
6189 dnl minimum minor version of Unicode NSIS isn't in the path
6190 dnl (unless in case of cross compiling, for which Unicode
6191 dnl is not yet sufficient).
6192 if test "$OS_ARCH" = "WINNT"; then
6193 MIN_NSIS_MAJOR_VER=2
6194 MIN_NSIS_MINOR_VER=46
6195 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-3.0a2.exe makensisu-2.46.exe makensis)
6196 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6197 AC_MSG_RESULT([yes])
6198 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null`
6200 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6202 if test "$MAKENSISU_PARSED_VER" = ""; then
6204 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
6207 MAKENSISU_MAJOR_VER=0
6208 MAKENSISU_MINOR_VER=0
6209 if test ! "$MAKENSISU_PARSED_VER" = ""; then
6210 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'`
6211 MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'`
6213 AC_MSG_CHECKING([for Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater])
6214 if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \
6215 "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER ||
6216 test "$MAKENSISU_MAJOR_VER" -gt $MIN_NSIS_MAJOR_VER; then
6217 AC_MSG_RESULT([yes])
6220 if test -z "$CROSS_COMPILE"; then
6221 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.])
6226 elif test -z "$CROSS_COMPILE"; then
6227 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.])
6233 dnl ========================================================
6235 dnl ========================================================
6236 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6237 [ --disable-webapp-runtime Disable Web App Runtime],
6238 MOZ_WEBAPP_RUNTIME=,
6239 MOZ_WEBAPP_RUNTIME=1)
6240 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a -z "$MOZ_WIDGET_GTK" ; then
6243 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6246 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6247 if test "$MOZ_WEBAPP_RUNTIME"; then
6248 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6251 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6252 if test -z "$TAR"; then
6253 AC_MSG_ERROR([no tar archiver found in \$PATH])
6257 AC_CHECK_PROGS(WGET, wget, "")
6260 dnl ========================================================
6262 dnl ========================================================
6264 if test -n "$MOZ_SIGN_CMD"; then
6265 AC_DEFINE(MOZ_SIGNING)
6268 dnl ========================================================
6269 dnl Maintenance Service
6270 dnl ========================================================
6272 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6273 [ --enable-maintenance-service Enable building of maintenanceservice],
6274 MOZ_MAINTENANCE_SERVICE=1,
6275 MOZ_MAINTENANCE_SERVICE= )
6277 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6278 if test "$OS_ARCH" = "WINNT"; then
6279 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6281 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6285 dnl ========================================================
6286 dnl Bundled fonts on desktop platforms
6287 dnl ========================================================
6289 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
6290 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
6291 MOZ_BUNDLED_FONTS=1,
6294 if test -n "$MOZ_BUNDLED_FONTS"; then
6295 AC_DEFINE(MOZ_BUNDLED_FONTS)
6298 dnl ========================================================
6299 dnl Verify MAR signatures
6300 dnl ========================================================
6302 MOZ_ARG_ENABLE_BOOL(verify-mar,
6303 [ --enable-verify-mar Enable verifying MAR signatures],
6304 MOZ_VERIFY_MAR_SIGNATURE=1,
6305 MOZ_VERIFY_MAR_SIGNATURE= )
6307 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6308 if test "$OS_ARCH" = "WINNT"; then
6309 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6311 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6315 dnl ========================================================
6316 dnl Enable building the signmar program.
6317 dnl This option is much different than the --enable-verify-mar option.
6318 dnl --enable-verify-mar is for enabling the verification check on MAR
6319 dnl files in the updater. The --enable-signmar option is for building
6320 dnl the signmar program.
6321 dnl ========================================================
6323 MOZ_ARG_ENABLE_BOOL(signmar,
6324 [ --enable-signmar Enable building the signmar program],
6325 MOZ_ENABLE_SIGNMAR=1,
6326 MOZ_ENABLE_SIGNMAR= )
6328 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6329 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6332 dnl ========================================================
6334 dnl ========================================================
6336 MOZ_ARG_DISABLE_BOOL(updater,
6337 [ --disable-updater Disable building of updater],
6341 if test -n "$MOZ_UPDATER"; then
6342 AC_DEFINE(MOZ_UPDATER)
6345 # tools/update-packaging is not checked out by default.
6346 MOZ_ARG_ENABLE_BOOL(update-packaging,
6347 [ --enable-update-packaging
6348 Enable tools/update-packaging],
6349 MOZ_UPDATE_PACKAGING=1,
6350 MOZ_UPDATE_PACKAGING= )
6351 AC_SUBST(MOZ_UPDATE_PACKAGING)
6353 dnl ========================================================
6354 dnl build the tests by default
6355 dnl ========================================================
6356 MOZ_ARG_DISABLE_BOOL(tests,
6357 [ --disable-tests Do not build test libraries & programs],
6361 if test -n "$ENABLE_TESTS"; then
6363 AC_DEFINE(ENABLE_TESTS)
6364 AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6365 AC_SUBST(GTEST_HAS_RTTI)
6366 if test -n "$_WIN32_MSVC"; then
6367 AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6369 if test "${OS_TARGET}" = "Android"; then
6370 AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6371 AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6372 AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6373 AC_SUBST(GTEST_OS_LINUX_ANDROID)
6374 AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6375 AC_SUBST(GTEST_HAS_CLONE)
6379 dnl ========================================================
6380 dnl parental controls (for Windows Vista)
6381 dnl ========================================================
6382 MOZ_ARG_DISABLE_BOOL(parental-controls,
6383 [ --disable-parental-controls
6384 Do not build parental controls],
6385 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6386 MOZ_DISABLE_PARENTAL_CONTROLS=)
6387 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6388 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6391 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6393 dnl ========================================================
6394 dnl = Disable DOMCrypto
6395 dnl ========================================================
6396 if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
6397 AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
6399 AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
6401 dnl ========================================================
6402 dnl = Disable EV certificate verification
6403 dnl ========================================================
6404 if test -n "$MOZ_NO_EV_CERTS"; then
6405 AC_DEFINE(MOZ_NO_EV_CERTS)
6407 AC_SUBST(MOZ_NO_EV_CERTS)
6409 dnl ========================================================
6410 dnl = Disable libpkix
6411 dnl ========================================================
6412 if test -n "$NSS_NO_LIBPKIX"; then
6413 AC_DEFINE(NSS_NO_LIBPKIX)
6415 AC_SUBST(NSS_NO_LIBPKIX)
6417 dnl ========================================================
6418 dnl = Sandboxing support
6419 dnl ========================================================
6420 MOZ_ARG_DISABLE_BOOL(sandbox,
6421 [ --disable-sandbox Disable sandboxing support],
6425 dnl ========================================================
6426 dnl = Content process sandboxing
6427 dnl ========================================================
6428 if test -n "$gonkdir"; then
6429 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6432 MOZ_ARG_ENABLE_BOOL(content-sandbox,
6433 [ --enable-content-sandbox Enable sandboxing support for content-processes],
6434 MOZ_CONTENT_SANDBOX=1,
6435 MOZ_CONTENT_SANDBOX=)
6437 if test -n "$MOZ_CONTENT_SANDBOX"; then
6438 AC_DEFINE(MOZ_CONTENT_SANDBOX)
6441 AC_SUBST(MOZ_CONTENT_SANDBOX)
6443 dnl ========================================================
6444 dnl = Gecko Media Plugin sandboxing
6445 dnl ========================================================
6448 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6453 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6458 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6462 if test -n "$MOZ_GMP_SANDBOX"; then
6463 AC_DEFINE(MOZ_GMP_SANDBOX)
6466 AC_SUBST(MOZ_GMP_SANDBOX)
6468 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
6472 if test -n "$MOZ_SANDBOX"; then
6473 AC_DEFINE(MOZ_SANDBOX)
6476 AC_SUBST(MOZ_SANDBOX)
6479 dnl ========================================================
6481 dnl = Module specific options
6483 dnl ========================================================
6484 MOZ_ARG_HEADER(Individual module options)
6486 dnl ========================================================
6487 dnl = Disable feed handling components
6488 dnl ========================================================
6489 MOZ_ARG_DISABLE_BOOL(feeds,
6490 [ --disable-feeds Disable feed handling and processing components],
6493 if test -n "$MOZ_FEEDS"; then
6494 AC_DEFINE(MOZ_FEEDS)
6496 if test "$MOZ_BUILD_APP" = "browser"; then
6497 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6501 dnl ========================================================
6502 dnl Check for sqlite
6503 dnl ========================================================
6506 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6507 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6508 MOZ_NATIVE_SQLITE=1,
6509 MOZ_NATIVE_SQLITE= )
6511 if test -n "$MOZ_NATIVE_SQLITE"
6513 dnl ============================
6514 dnl === SQLite Version check ===
6515 dnl ============================
6516 dnl Check to see if the system SQLite package is new enough.
6517 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6519 dnl ==================================
6520 dnl === SQLITE_SECURE_DELETE check ===
6521 dnl ==================================
6522 dnl Check to see if the system SQLite package is compiled with
6523 dnl SQLITE_SECURE_DELETE enabled.
6524 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6525 _SAVE_CFLAGS="$CFLAGS"
6526 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6528 LIBS="$LIBS $SQLITE_LIBS"
6529 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6531 #include "sqlite3.h"
6533 int main(int argc, char **argv){
6534 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6536 ac_cv_sqlite_secure_delete=yes,
6537 ac_cv_sqlite_secure_delete=no,
6538 ac_cv_sqlite_secure_delete=no
6541 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6542 CFLAGS="$_SAVE_CFLAGS"
6544 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6545 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6548 dnl ===============================
6549 dnl === SQLITE_THREADSAFE check ===
6550 dnl ===============================
6551 dnl Check to see if the system SQLite package is compiled with
6552 dnl SQLITE_THREADSAFE enabled.
6553 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6554 _SAVE_CFLAGS="$CFLAGS"
6555 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6557 LIBS="$LIBS $SQLITE_LIBS"
6558 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6560 #include "sqlite3.h"
6562 int main(int argc, char **argv){
6563 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6565 ac_cv_sqlite_threadsafe=yes,
6566 ac_cv_sqlite_threadsafe=no,
6567 ac_cv_sqlite_threadsafe=no
6570 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6571 CFLAGS="$_SAVE_CFLAGS"
6573 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6574 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6577 dnl ================================
6578 dnl === SQLITE_ENABLE_FTS3 check ===
6579 dnl ================================
6580 dnl check to see if the system SQLite package is compiled with
6581 dnl SQLITE_ENABLE_FTS3 enabled.
6582 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6583 _SAVE_CFLAGS="$CFLAGS"
6584 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6586 LIBS="$LIBS $SQLITE_LIBS"
6587 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6589 #include "sqlite3.h"
6591 int main(int argc, char **argv){
6592 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6594 ac_cv_sqlite_enable_fts3=yes,
6595 ac_cv_sqlite_enable_fts3=no,
6596 ac_cv_sqlite_enable_fts3=no
6599 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6600 CFLAGS="$_SAVE_CFLAGS"
6602 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6603 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6606 dnl =========================================
6607 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6608 dnl =========================================
6609 dnl check to see if the system SQLite package is compiled with
6610 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6611 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6612 _SAVE_CFLAGS="$CFLAGS"
6613 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6615 LIBS="$LIBS $SQLITE_LIBS"
6616 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6618 #include "sqlite3.h"
6620 int main(int argc, char **argv){
6621 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6623 ac_cv_sqlite_enable_unlock_notify=yes,
6624 ac_cv_sqlite_enable_unlock_notify=no,
6625 ac_cv_sqlite_enable_unlock_notify=no
6628 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6629 CFLAGS="$_SAVE_CFLAGS"
6631 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6632 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6636 if test -n "$MOZ_NATIVE_SQLITE"; then
6637 AC_DEFINE(MOZ_NATIVE_SQLITE)
6639 AC_SUBST(MOZ_NATIVE_SQLITE)
6641 dnl ========================================================
6642 dnl = Enable help viewer (off by default)
6643 dnl ========================================================
6644 if test -n "$MOZ_HELP_VIEWER"; then
6645 dnl Do this if defined in confvars.sh
6646 AC_DEFINE(MOZ_HELP_VIEWER)
6649 dnl ========================================================
6650 dnl = Enable safe browsing (anti-phishing)
6651 dnl ========================================================
6652 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6653 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6654 MOZ_SAFE_BROWSING=1,
6655 MOZ_SAFE_BROWSING= )
6656 if test -n "$MOZ_SAFE_BROWSING"; then
6657 AC_DEFINE(MOZ_SAFE_BROWSING)
6659 AC_SUBST(MOZ_SAFE_BROWSING)
6661 dnl ========================================================
6662 dnl = Enable url-classifier
6663 dnl ========================================================
6664 dnl Implicitly enabled by default if building with safe-browsing
6665 if test -n "$MOZ_SAFE_BROWSING"; then
6666 MOZ_URL_CLASSIFIER=1
6668 MOZ_ARG_ENABLE_BOOL(url-classifier,
6669 [ --enable-url-classifier Enable url classifier module],
6670 MOZ_URL_CLASSIFIER=1,
6671 MOZ_URL_CLASSIFIER= )
6672 if test -n "$MOZ_URL_CLASSIFIER"; then
6673 AC_DEFINE(MOZ_URL_CLASSIFIER)
6675 AC_SUBST(MOZ_URL_CLASSIFIER)
6677 dnl ========================================================
6678 dnl = Disable zipwriter
6679 dnl ========================================================
6680 MOZ_ARG_DISABLE_BOOL(zipwriter,
6681 [ --disable-zipwriter Disable zipwriter component],
6684 AC_SUBST(MOZ_ZIPWRITER)
6686 dnl ========================================================
6688 dnl ========================================================
6690 MOZ_ARG_WITH_STRING(gl-provider,
6691 [ --with-gl-provider=ID
6692 Set GL provider backend type],
6693 [ val=`echo $withval`
6694 MOZ_GL_PROVIDER="$val"])
6696 if test -n "$MOZ_GL_PROVIDER"; then
6697 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6698 AC_SUBST(MOZ_GL_PROVIDER)
6699 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6701 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6702 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6704 dnl ========================================================
6705 dnl = faststripe theme
6706 dnl ========================================================
6707 MOZ_ARG_ENABLE_BOOL(faststripe,
6708 [ --enable-faststripe Use faststripe theme],
6709 MOZ_THEME_FASTSTRIPE=1,
6710 MOZ_THEME_FASTSTRIPE= )
6711 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6713 dnl ========================================================
6715 dnl = Feature options that require extra sources to be pulled
6717 dnl ========================================================
6718 dnl MOZ_ARG_HEADER(Features that require extra sources)
6720 dnl ========================================================
6722 dnl = Runtime debugging and Optimization Options
6724 dnl ========================================================
6725 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
6727 dnl ========================================================
6728 dnl enable mobile optimizations
6729 dnl ========================================================
6730 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6731 [ --enable-mobile-optimize
6732 Enable mobile optimizations],
6733 MOZ_GFX_OPTIMIZE_MOBILE=1)
6735 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6737 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6738 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6741 dnl ========================================================
6742 dnl = Enable code optimization. ON by default.
6743 dnl ========================================================
6744 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6745 MOZ_OPTIMIZE_FLAGS="-O"
6748 MOZ_ARG_ENABLE_STRING(optimize,
6749 [ --disable-optimize Disable compiler optimization
6750 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6751 [ if test "$enableval" != "no"; then
6753 if test -n "$enableval" -a "$enableval" != "yes"; then
6754 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6759 fi ], MOZ_OPTIMIZE=1)
6761 MOZ_SET_FRAMEPTR_FLAGS
6763 if test "$COMPILE_ENVIRONMENT"; then
6764 if test -n "$MOZ_OPTIMIZE"; then
6765 AC_MSG_CHECKING([for valid optimization flags])
6766 _SAVE_CFLAGS=$CFLAGS
6767 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6768 AC_TRY_COMPILE([#include <stdio.h>],
6769 [printf("Hello World\n");],
6772 AC_MSG_RESULT([$_results])
6773 if test "$_results" = "no"; then
6774 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6776 CFLAGS=$_SAVE_CFLAGS
6778 fi # COMPILE_ENVIRONMENT
6780 AC_SUBST(MOZ_OPTIMIZE)
6781 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6782 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6783 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6784 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6785 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6787 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6789 dnl ========================================================
6790 dnl = Enable any treating of compile warnings as errors
6791 dnl ========================================================
6792 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6793 [ --enable-warnings-as-errors
6794 Enable treating of warnings as errors],
6795 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6796 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6797 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6798 WARNINGS_AS_ERRORS=''
6799 elif test "$GNU_CC"; then
6800 # Prevent the following GCC warnings from being treated as errors:
6801 # -Wuninitialized - too many false positives
6802 # -Wmaybe-uninitialized - too many false positives
6803 # -Wdeprecated-declarations - we don't want our builds held hostage when a
6804 # platform-specific API becomes deprecated.
6805 MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
6806 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
6807 MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
6808 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
6809 MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
6810 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
6812 if test -n "$MOZ_PGO"; then
6813 MOZ_C_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_c_has_noerror_coverage_mismatch)
6814 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_cxx_has_noerror_coverage_mismatch)
6818 dnl ========================================================
6819 dnl = Disable runtime logging checks
6820 dnl ========================================================
6821 MOZ_ARG_DISABLE_BOOL(logging,
6822 [ --disable-logging Disable logging facilities],
6823 NS_DISABLE_LOGGING=1,
6824 NS_DISABLE_LOGGING= )
6825 if test "$NS_DISABLE_LOGGING"; then
6826 AC_DEFINE(NS_DISABLE_LOGGING)
6828 AC_DEFINE(MOZ_LOGGING)
6831 dnl ========================================================
6832 dnl = This will enable logging of addref, release, ctor, dtor.
6833 dnl ========================================================
6834 _ENABLE_LOGREFCNT=42
6835 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6836 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6837 _ENABLE_LOGREFCNT=1,
6838 _ENABLE_LOGREFCNT= )
6839 if test "$_ENABLE_LOGREFCNT" = "1"; then
6840 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6841 elif test -z "$_ENABLE_LOGREFCNT"; then
6842 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6845 dnl ========================================================
6846 dnl moz_dump_painting
6847 dnl ========================================================
6848 MOZ_ARG_ENABLE_BOOL(dump-painting,
6849 [ --enable-dump-painting Enable paint debugging.],
6850 MOZ_DUMP_PAINTING=1,
6851 MOZ_DUMP_PAINTING= )
6852 if test -n "$MOZ_DUMP_PAINTING"; then
6853 AC_DEFINE(MOZ_DUMP_PAINTING)
6854 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6856 if test -n "$MOZ_DEBUG"; then
6857 AC_DEFINE(MOZ_DUMP_PAINTING)
6860 dnl ========================================================
6861 dnl = Enable trace malloc
6862 dnl ========================================================
6863 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6864 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6865 [ --enable-trace-malloc Enable malloc tracing; also disables DMD and jemalloc],
6868 if test "$NS_TRACE_MALLOC"; then
6869 # Please, Mr. Linker Man, don't take away our symbol names
6870 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6871 AC_DEFINE(NS_TRACE_MALLOC)
6873 AC_SUBST(NS_TRACE_MALLOC)
6875 dnl ========================================================
6877 dnl ========================================================
6879 MOZ_ARG_ENABLE_BOOL(dmd,
6880 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
6884 dnl The two options are conflicting. Fails the configure to alert the user.
6885 if test "$NS_TRACE_MALLOC" -a "$MOZ_DMD"; then
6886 AC_MSG_ERROR([--enable-trace-malloc and --enable-dmd are conflicting options])
6889 if test "$MOZ_DMD"; then
6892 if test "${CPU_ARCH}" = "arm"; then
6893 CFLAGS="$CFLAGS -funwind-tables"
6894 CXXFLAGS="$CXXFLAGS -funwind-tables"
6897 MOZ_MEMORY=1 # DMD enables jemalloc
6898 MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
6902 dnl ========================================================
6903 dnl = Enable jemalloc
6904 dnl ========================================================
6905 MOZ_ARG_ENABLE_BOOL(jemalloc,
6906 [ --enable-jemalloc Replace memory allocator with jemalloc],
6910 if test "$NS_TRACE_MALLOC"; then
6914 if test "${OS_TARGET}" = "Android"; then
6915 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6917 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin"; then
6918 dnl On Windows and OSX, we want to link all our binaries against mozglue
6919 if test -z "$GNU_CC"; then
6920 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6922 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6925 dnl On other Unix systems, we only want to link executables against mozglue
6926 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6927 dnl On other Unix systems, where mozglue is a static library, jemalloc is
6928 dnl separated for the SDK, so we need to add it here.
6929 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6930 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6932 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6933 if test -n "$GNU_CC"; then
6934 dnl And we need mozglue symbols to be exported.
6935 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6937 if test "$MOZ_LINKER" = 1; then
6938 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
6942 dnl ========================================================
6943 dnl = Enable dynamic replacement of malloc implementation
6944 dnl ========================================================
6945 if test -n "$NIGHTLY_BUILD" -a -n "$MOZ_MEMORY"; then
6946 # Enable on central for the debugging opportunities it adds.
6947 MOZ_REPLACE_MALLOC=1
6949 MOZ_ARG_ENABLE_BOOL(replace-malloc,
6950 [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
6951 MOZ_REPLACE_MALLOC=1,
6952 MOZ_REPLACE_MALLOC= )
6954 dnl The two options are conflicting. Fails the configure to alert the user.
6955 if test "$NS_TRACE_MALLOC" -a "$MOZ_REPLACE_MALLOC"; then
6956 AC_MSG_ERROR([--enable-trace-malloc and --enable-replace-malloc are conflicting options])
6959 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
6960 dnl We don't want to enable jemalloc unconditionally because it may be a
6961 dnl deliberate choice not to enable it (bug 702250, for instance)
6962 AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
6963 elif test -n "$MOZ_REPLACE_MALLOC"; then
6964 MOZ_NATIVE_JEMALLOC=
6966 dnl Replace-malloc Mac linkage quirks
6967 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
6968 AC_CACHE_CHECK([how to do weak dynamic linking],
6969 ac_cv_weak_dynamic_linking,
6970 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
6971 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
6972 test -s conftest${DLL_SUFFIX}; then
6973 dnl There are several ways the linker can put link edit rules in a binary:
6974 dnl - classic info only (for OSX < 10.6)
6975 dnl - dyld info only
6977 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
6982 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
6987 dnl With classic info, we need to build with -flat_namespace.
6988 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
6989 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
6990 dnl forgets to set the weak flag in the dyld info.
6991 dnl See http://glandium.org/blog/?p=2764 for more details.
6993 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
6994 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
6995 dnl - "flat namespace" when -flat_namespace alone is needed
6996 dnl - "dummy library" when a dummy library and -flat_namespace are needed
6997 dnl - "compiler support" when nothing is needed
6998 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
6999 if test -n "$_CLASSIC_INFO"; then
7000 ac_cv_weak_dynamic_linking="flat namespace"
7002 ac_cv_weak_dynamic_linking="compiler support"
7005 if test -n "$_DYLD_INFO"; then
7006 ac_cv_weak_dynamic_linking="dummy library"
7008 ac_cv_weak_dynamic_linking="flat namespace"
7012 AC_ERROR([couldn't compile a simple C file])
7015 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
7018 AC_SUBST(MOZ_REPLACE_MALLOC)
7019 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
7021 dnl ========================================================
7022 dnl = Jemalloc build setup
7023 dnl ========================================================
7024 if test -z "$MOZ_MEMORY"; then
7025 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
7026 MOZ_NATIVE_JEMALLOC=1
7027 AC_CHECK_FUNCS(mallctl nallocm,,
7028 [MOZ_NATIVE_JEMALLOC=
7030 if test -n "$MOZ_NATIVE_JEMALLOC"; then
7032 AC_DEFINE(MOZ_MEMORY)
7033 AC_DEFINE(MOZ_JEMALLOC3)
7034 AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7039 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7040 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.])
7045 AC_DEFINE(MOZ_MEMORY)
7046 if test -n "$MOZ_JEMALLOC3"; then
7047 AC_DEFINE(MOZ_JEMALLOC3)
7049 if test "x$MOZ_DEBUG" = "x1"; then
7050 AC_DEFINE(MOZ_MEMORY_DEBUG)
7052 dnl The generic feature tests that determine how to compute ncpus are long and
7053 dnl complicated. Therefore, simply define special cpp variables for the
7054 dnl platforms we have special knowledge of.
7057 AC_DEFINE(MOZ_MEMORY_DARWIN)
7060 AC_DEFINE(MOZ_MEMORY_BSD)
7062 *-android*|*-linuxandroid*)
7063 AC_DEFINE(MOZ_MEMORY_LINUX)
7064 AC_DEFINE(MOZ_MEMORY_ANDROID)
7065 if test -z "$gonkdir"; then
7068 AC_DEFINE(MOZ_MEMORY_GONK)
7073 AC_DEFINE(MOZ_MEMORY_LINUX)
7076 AC_DEFINE(MOZ_MEMORY_BSD)
7079 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7082 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7083 export MOZ_NO_DEBUG_RTL=1
7084 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7085 dnl Look for a broken crtdll.obj
7086 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7087 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7088 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7089 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcprt -DEFAULTLIB:mozcrt'
7090 dnl Also pass this to NSPR/NSS
7091 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7093 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7100 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7104 AC_SUBST(MOZ_MEMORY)
7105 AC_SUBST(MOZ_JEMALLOC3)
7106 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7107 AC_SUBST(MOZ_GLUE_LDFLAGS)
7108 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7109 AC_SUBST_LIST(WIN32_CRT_LIBS)
7110 dnl Need to set this for make because NSS doesn't have configure
7113 dnl We need to wrap dlopen and related functions on Android because we use
7115 if test "$OS_TARGET" = Android; then
7116 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7117 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7118 if test "$MOZ_WIDGET_TOOLKIT" = android; then
7119 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7121 if test -z "$gonkdir"; then
7122 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7123 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"
7125 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
7126 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"
7130 dnl ========================================================
7131 dnl = Use malloc wrapper lib
7132 dnl ========================================================
7133 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7134 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7138 if test -n "$_WRAP_MALLOC"; then
7139 if test -n "$GNU_CC"; then
7140 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7141 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7142 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7143 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=vasprintf,--wrap=asprintf"
7144 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7145 dnl Wrap operator new and operator delete on Android.
7146 if test "$OS_TARGET" = "Android"; then
7147 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7148 dnl Wrap the nothrow variants too.
7149 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7152 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7156 dnl ========================================================
7157 dnl = Location of malloc wrapper lib
7158 dnl ========================================================
7159 MOZ_ARG_WITH_STRING(wrap-malloc,
7160 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7161 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7163 dnl ========================================================
7164 dnl = Use JS Call tracing
7165 dnl ========================================================
7166 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7167 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7168 MOZ_TRACE_JSCALLS=1,
7169 MOZ_TRACE_JSCALLS= )
7170 if test -n "$MOZ_TRACE_JSCALLS"; then
7171 AC_DEFINE(MOZ_TRACE_JSCALLS)
7174 dnl ========================================================
7175 dnl JS opt-mode assertions and minidump instrumentation
7176 dnl ========================================================
7177 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7178 [ --enable-js-diagnostics
7179 Enable JS diagnostic assertions and breakpad data],
7180 JS_CRASH_DIAGNOSTICS=1,
7181 JS_CRASH_DIAGNOSTICS= )
7182 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7183 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7186 dnl ========================================================
7187 dnl = Use incremental GC
7188 dnl ========================================================
7190 MOZ_ARG_DISABLE_BOOL(gcincremental,
7191 [ --disable-gcincremental Disable incremental GC],
7193 if test -n "$JSGC_INCREMENTAL"; then
7194 AC_DEFINE(JSGC_INCREMENTAL)
7197 dnl ========================================================
7198 dnl = Use exact stack rooting for GC
7199 dnl ========================================================
7200 MOZ_ARG_DISABLE_BOOL(exact-rooting,
7201 [ --disable-exact-rooting Enable use of conservative stack scanning for GC],
7202 JSGC_USE_EXACT_ROOTING= ,
7203 JSGC_USE_EXACT_ROOTING=1 )
7204 if test -n "$JSGC_USE_EXACT_ROOTING"; then
7205 AC_DEFINE(JSGC_USE_EXACT_ROOTING)
7208 dnl ========================================================
7209 dnl = Use generational GC
7210 dnl ========================================================
7211 MOZ_ARG_DISABLE_BOOL(gcgenerational,
7212 [ --disable-gcgenerational Disable generational GC],
7213 JSGC_GENERATIONAL= ,
7214 JSGC_GENERATIONAL=1 )
7215 if test -n "$JSGC_GENERATIONAL"; then
7216 AC_DEFINE(JSGC_GENERATIONAL)
7219 dnl ========================================================
7220 dnl = Use compacting GC
7221 dnl ========================================================
7222 MOZ_ARG_ENABLE_BOOL(gccompacting,
7223 [ --enable-gccompacting Compact the JS heap by moving GC things],
7226 if test -n "$JS_GCCOMPACTING"; then
7227 AC_DEFINE(JS_GCCOMPACTING)
7230 dnl ========================================================
7231 dnl = Use a smaller chunk size for GC chunks
7232 dnl ========================================================
7233 MOZ_ARG_ENABLE_BOOL(small-chunk-size,
7234 [ --enable-small-chunk-size Allocate memory for JS GC things in smaller chunks],
7235 JS_GC_SMALL_CHUNK_SIZE=1,
7236 JS_GC_SMALL_CHUNK_SIZE= )
7237 if test -n "$JS_GC_SMALL_CHUNK_SIZE"; then
7238 AC_DEFINE(JS_GC_SMALL_CHUNK_SIZE)
7241 dnl ========================================================
7242 dnl Zealous JavaScript GC
7243 dnl ========================================================
7244 MOZ_ARG_ENABLE_BOOL(gczeal,
7245 [ --enable-gczeal Enable zealous JavaScript GCing],
7248 if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then
7249 AC_DEFINE(JS_GC_ZEAL)
7252 dnl ========================================================
7253 dnl = Perform moving GC stack rooting analysis
7254 dnl ========================================================
7255 MOZ_ARG_ENABLE_BOOL(root-analysis,
7256 [ --enable-root-analysis Enable moving GC stack root analysis],
7257 JSGC_ROOT_ANALYSIS=1,
7258 JSGC_ROOT_ANALYSIS= )
7259 if test -n "$JSGC_ROOT_ANALYSIS"; then
7260 AC_DEFINE(JSGC_ROOT_ANALYSIS)
7265 dnl ========================================================
7266 dnl = Enable static checking using gcc-dehydra
7267 dnl ========================================================
7269 MOZ_ARG_WITH_STRING(static-checking,
7270 [ --with-static-checking=path/to/gcc_dehydra.so
7271 Enable static checking of code using GCC-dehydra],
7272 DEHYDRA_PATH=$withval,
7275 if test -n "$DEHYDRA_PATH"; then
7276 if test ! -f "$DEHYDRA_PATH"; then
7277 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7279 AC_DEFINE(NS_STATIC_CHECKING)
7281 AC_SUBST(DEHYDRA_PATH)
7283 dnl ========================================================
7284 dnl = Enable using the clang plugin to build
7285 dnl ========================================================
7287 MOZ_ARG_ENABLE_BOOL(clang-plugin,
7288 [ --enable-clang-plugin Enable building with the mozilla clang plugin ],
7289 ENABLE_CLANG_PLUGIN=1,
7290 ENABLE_CLANG_PLUGIN= )
7291 if test -n "$ENABLE_CLANG_PLUGIN"; then
7292 if test -z "$CLANG_CC"; then
7293 AC_MSG_ERROR([Can't use clang plugin without clang.])
7295 AC_DEFINE(MOZ_CLANG_PLUGIN)
7298 AC_SUBST(ENABLE_CLANG_PLUGIN)
7300 dnl ========================================================
7301 dnl = Enable stripping of libs & executables
7302 dnl ========================================================
7303 MOZ_ARG_ENABLE_BOOL(strip,
7304 [ --enable-strip Enable stripping of libs & executables ],
7308 dnl ========================================================
7309 dnl = Enable stripping of libs & executables when packaging
7310 dnl ========================================================
7311 MOZ_ARG_ENABLE_BOOL(install-strip,
7312 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7316 dnl ========================================================
7317 dnl = --disable-elf-hack
7318 dnl ========================================================
7321 MOZ_ARG_DISABLE_BOOL(elf-hack,
7322 [ --disable-elf-hack Disable elf hacks],
7324 [USE_ELF_HACK=F # Force enable elf-hack])
7326 # Disable elf hack for profiling because the built in profiler
7327 # doesn't read the segments properly with elf hack. This is
7328 # temporary and should be fixed soon in the profiler.
7329 if test "$MOZ_PROFILING" = 1; then
7330 if test "$USE_ELF_HACK" = F; then
7331 AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
7336 # Only enable elfhack where supported
7337 if test "$USE_ELF_HACK" = 1; then
7338 case "${HOST_OS_ARCH},${OS_ARCH}" in
7340 case "${CPU_ARCH}" in
7355 if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
7356 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7357 dnl memory addresses it maps to. The result is that by the time elfhack
7358 dnl kicks in, it is not possible to apply relocations because of that,
7359 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7360 dnl segment. It makes elfhack mostly useless, so considering the problems
7361 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7362 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7363 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
7364 dnl elfhack enabled, disable PT_GNU_RELRO instead.
7365 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7366 LINK_WITH_PT_GNU_RELRO,
7367 [echo "int main() {return 0;}" > conftest.${ac_ext}
7368 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7369 test -s conftest${ac_exeext}; then
7370 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7371 LINK_WITH_PT_GNU_RELRO=yes
7373 LINK_WITH_PT_GNU_RELRO=no
7376 dnl We really don't expect to get here, but just in case
7377 AC_ERROR([couldn't compile a simple C file])
7380 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7381 if test "$USE_ELF_HACK" = F; then
7382 AC_MSG_CHECKING([for -z norelro option to ld])
7383 _SAVE_LDFLAGS=$LDFLAGS
7384 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
7385 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
7386 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
7387 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.]))
7390 AC_MSG_WARN([Disabling elfhack])
7396 dnl ========================================================
7397 dnl = libstdc++ compatibility hacks
7398 dnl ========================================================
7401 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7402 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7405 if test -n "$STDCXX_COMPAT"; then
7406 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
7407 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7408 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7411 dnl ========================================================
7413 dnl = Profiling and Instrumenting
7415 dnl ========================================================
7416 MOZ_ARG_HEADER(Profiling and Instrumenting)
7418 dnl ========================================================
7419 dnl = Enable runtime visual profiling logger
7420 dnl ========================================================
7421 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7422 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7423 MOZ_VISUAL_EVENT_TRACER=1,
7424 MOZ_VISUAL_EVENT_TRACER=)
7425 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7426 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7429 dnl ========================================================
7430 dnl = Enable TaskTracer
7431 dnl ========================================================
7432 MOZ_ARG_ENABLE_BOOL(tasktracer,
7433 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
7436 if test "$MOZ_WIDGET_TOOLKIT" = "gonk" -a -n "$MOZ_TASK_TRACER"; then
7437 AC_DEFINE(MOZ_TASK_TRACER)
7438 AC_SUBST(MOZ_TASK_TRACER)
7441 dnl ========================================================
7442 dnl Turn on reflow counting
7443 dnl ========================================================
7444 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7445 [ --enable-reflow-perf Enable reflow performance tracing],
7448 if test -n "$MOZ_REFLOW_PERF"; then
7449 AC_DEFINE(MOZ_REFLOW_PERF)
7452 dnl ========================================================
7453 dnl = Offer a way to disable the startup cache
7454 dnl ========================================================
7455 MOZ_DISABLE_STARTUPCACHE=
7457 MOZ_ARG_DISABLE_BOOL(startupcache,
7458 [ --disable-startupcache Disable startup cache ],
7459 MOZ_DISABLE_STARTUPCACHE=1,
7460 MOZ_DISABLE_STARTUPCACHE=)
7462 dnl bug 988880: disable startup cache on b2g
7463 if test -n "$MOZ_B2G"; then
7464 MOZ_DISABLE_STARTUPCACHE=1
7467 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
7469 dnl ========================================================
7470 dnl = Enable Radio Interface for B2G (Gonk usually)
7471 dnl ========================================================
7472 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7473 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7476 MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL )
7477 if test -n "$MOZ_B2G_RIL"; then
7478 if test -n "$_PLATFORM_HAVE_RIL"; then
7479 AC_DEFINE(MOZ_B2G_RIL)
7481 AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.])
7484 AC_SUBST(MOZ_B2G_RIL)
7486 dnl ========================================================
7487 dnl = Enable Radio FM for B2G (Gonk usually)
7488 dnl ========================================================
7489 if test -n "$MOZ_B2G_FM"; then
7490 AC_DEFINE(MOZ_B2G_FM)
7492 AC_SUBST(MOZ_B2G_FM)
7494 dnl ========================================================
7495 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7496 dnl ========================================================
7497 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7498 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7501 if test -n "$MOZ_B2G_BT"; then
7502 AC_DEFINE(MOZ_B2G_BT)
7504 AC_SUBST(MOZ_B2G_BT)
7505 AC_SUBST(MOZ_B2G_BT_BLUEZ)
7506 AC_SUBST(MOZ_B2G_BT_BLUEDROID)
7508 dnl ========================================================
7509 dnl = Enable NFC Interface for B2G (Gonk usually)
7510 dnl ========================================================
7511 MOZ_ARG_ENABLE_BOOL(nfc,
7512 [ --enable-nfc Set compile flags necessary for compiling NFC API ],
7515 if test -n "$MOZ_NFC"; then
7520 dnl ========================================================
7521 dnl = Enable Pico Speech Synthesis (Gonk usually)
7522 dnl ========================================================
7523 MOZ_ARG_ENABLE_BOOL(synth-pico,
7524 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
7527 if test -n "$MOZ_SYNTH_PICO"; then
7528 AC_DEFINE(MOZ_SYNTH_PICO)
7530 AC_SUBST(MOZ_SYNTH_PICO)
7532 dnl ========================================================
7533 dnl = Enable Support for Time Manager API
7534 dnl ========================================================
7535 if test -n "$MOZ_TIME_MANAGER"; then
7536 AC_DEFINE(MOZ_TIME_MANAGER)
7538 AC_SUBST(MOZ_TIME_MANAGER)
7540 dnl ========================================================
7541 dnl = Enable Camera Interface for B2G (Gonk usually)
7542 dnl ========================================================
7543 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7544 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7547 if test -n "$MOZ_B2G_CAMERA"; then
7548 AC_DEFINE(MOZ_B2G_CAMERA)
7550 AC_SUBST(MOZ_B2G_CAMERA)
7552 dnl ========================================================
7553 dnl = Enable Support for Payment API
7554 dnl ========================================================
7555 if test -n "$MOZ_PAY"; then
7560 dnl ========================================================
7561 dnl = Enable Browser Support for Activities
7562 dnl ========================================================
7563 if test -n "$MOZ_ACTIVITIES"; then
7564 AC_DEFINE(MOZ_ACTIVITIES)
7566 AC_SUBST(MOZ_ACTIVITIES)
7568 dnl ========================================================
7569 dnl = Enable Support for AudioChannelManager API
7570 dnl ========================================================
7571 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7572 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7574 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7576 dnl ========================================================
7577 dnl = Support for demangling undefined symbols
7578 dnl ========================================================
7579 if test -z "$SKIP_LIBRARY_CHECKS"; then
7582 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7586 # Demangle only for debug or trace-malloc or DMD builds
7587 MOZ_DEMANGLE_SYMBOLS=
7588 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7589 MOZ_DEMANGLE_SYMBOLS=1
7590 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7592 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7594 dnl ========================================================
7595 dnl = Support for gcc stack unwinding (from gcc 3.3)
7596 dnl ========================================================
7597 if test -z "$SKIP_LIBRARY_CHECKS"; then
7600 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7604 dnl ========================================================
7606 dnl ========================================================
7608 MOZ_ARG_WITH_STRING(jitreport-granularity,
7609 [ --jitreport-granularity=N
7610 Default granularity at which to report JIT code
7613 1 - code ranges for whole functions only
7614 2 - per-line information
7615 3 - per-op information],
7616 JITREPORT_GRANULARITY=$withval,
7617 JITREPORT_GRANULARITY=3)
7619 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7621 dnl ========================================================
7625 dnl ========================================================
7626 MOZ_ARG_HEADER(Misc. Options)
7628 dnl ========================================================
7629 dnl update xterm title
7630 dnl ========================================================
7631 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7632 [ --enable-xterm-updates Update XTERM titles with current command.],
7636 dnl =========================================================
7638 dnl =========================================================
7639 MOZ_ARG_ENABLE_STRING([chrome-format],
7640 [ --enable-chrome-format=jar|flat|omni
7641 Select FORMAT of chrome files during packaging],
7642 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7644 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7645 MOZ_CHROME_FILE_FORMAT=jar
7648 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7649 AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7652 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7653 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7654 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7655 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7658 dnl =========================================================
7659 dnl Omnijar packaging (bug 552121)
7660 dnl =========================================================
7661 dnl Omnijar packaging is compatible with flat packaging.
7662 dnl In unpackaged builds, omnijar looks for files as if
7663 dnl things were flat packaged. After packaging, all files
7664 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7665 dnl is set to flat since putting files into jars is only
7666 dnl done during packaging with omnijar.
7667 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7669 AC_DEFINE(MOZ_OMNIJAR)
7671 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7672 if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7673 MOZ_CHROME_FILE_FORMAT=flat
7675 MOZ_CHROME_FILE_FORMAT=symlink
7678 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7679 dnl Fennec's static resources live in the assets/ folder of the
7680 dnl APK. Adding a path to the name here works because we only
7681 dnl have one omnijar file in the final package (which is not the
7682 dnl case on desktop), and necessitates some contortions during
7683 dnl packaging so that the resources in the omnijar are considered
7684 dnl as rooted at / and not as rooted at assets/ (which again is
7685 dnl not the case on desktop: there are omnijars rooted at webrtc/,
7686 dnl etc). packager.mk handles changing the rooting of the single
7688 OMNIJAR_NAME=assets/omni.ja
7690 OMNIJAR_NAME=omni.ja
7693 AC_SUBST(OMNIJAR_NAME)
7694 AC_SUBST(MOZ_OMNIJAR)
7695 AC_SUBST(MOZ_PACKAGER_FORMAT)
7697 dnl ========================================================
7698 dnl = Define default location for MOZILLA_FIVE_HOME
7699 dnl ========================================================
7700 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7701 [ --with-default-mozilla-five-home
7702 Set the default value for MOZILLA_FIVE_HOME],
7703 [ val=`echo $withval`
7704 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7706 dnl ========================================================
7707 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7708 dnl ========================================================
7709 MOZ_ARG_WITH_STRING(user-appdir,
7710 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7711 [ val=`echo $withval`
7712 if echo "$val" | grep "\/" >/dev/null; then
7713 AC_MSG_ERROR("Homedir must be single relative path.")
7718 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7720 dnl ========================================================
7721 dnl = Doxygen configuration
7722 dnl ========================================================
7723 dnl Use commas to specify multiple dirs to this arg
7724 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7725 MOZ_ARG_WITH_STRING(doc-input-dirs,
7726 [ --with-doc-input-dirs=DIRS
7727 Header/idl dirs to create docs from],
7728 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7729 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7731 dnl Use commas to specify multiple dirs to this arg
7732 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7733 MOZ_ARG_WITH_STRING(doc-include-dirs,
7734 [ --with-doc-include-dirs=DIRS
7735 Include dirs to preprocess doc headers],
7736 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7737 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7739 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7740 MOZ_ARG_WITH_STRING(doc-output-dir,
7741 [ --with-doc-output-dir=DIR
7742 Dir to generate docs into],
7743 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7744 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7746 if test -z "$SKIP_COMPILER_CHECKS"; then
7747 dnl ========================================================
7749 dnl = Compiler Options
7751 dnl ========================================================
7752 MOZ_ARG_HEADER(Compiler Options)
7754 dnl ========================================================
7755 dnl Check for gcc -pipe support
7756 dnl ========================================================
7757 AC_MSG_CHECKING([for -pipe support])
7758 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7759 dnl Any gcc that supports firefox supports -pipe.
7760 CFLAGS="$CFLAGS -pipe"
7761 CXXFLAGS="$CXXFLAGS -pipe"
7762 AC_MSG_RESULT([yes])
7767 dnl ========================================================
7768 dnl Profile guided optimization (gcc checks)
7769 dnl ========================================================
7770 dnl Test for profiling options
7771 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7773 _SAVE_CFLAGS="$CFLAGS"
7774 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7776 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7777 AC_TRY_COMPILE([], [return 0;],
7778 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7779 result="yes" ], result="no")
7780 AC_MSG_RESULT([$result])
7782 if test $result = "yes"; then
7783 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7784 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7785 PROFILE_USE_LDFLAGS="-fprofile-use"
7788 CFLAGS="$_SAVE_CFLAGS"
7790 if test -n "$INTEL_CC"; then
7791 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7792 PROFILE_GEN_LDFLAGS=
7793 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7794 PROFILE_USE_LDFLAGS=
7797 dnl Sun Studio on Solaris
7798 if test "$SOLARIS_SUNPRO_CC"; then
7799 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7800 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7801 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7802 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7805 AC_SUBST(PROFILE_GEN_CFLAGS)
7806 AC_SUBST(PROFILE_GEN_LDFLAGS)
7807 AC_SUBST(PROFILE_USE_CFLAGS)
7808 AC_SUBST(PROFILE_USE_LDFLAGS)
7810 dnl =============================================
7811 dnl Support for -fno-integrated-as (recent clang)
7812 dnl =============================================
7813 dnl Under clang 3.4+, use -fno-integrated-as to
7814 dnl build libvpx's vp8_asm_enc_offsets.c
7816 _SAVE_CFLAGS="$CFLAGS"
7817 CFLAGS="$CFLAGS -fno-integrated-as -S"
7819 AC_MSG_CHECKING([whether C compiler supports -fno-integrated-as])
7820 AC_TRY_COMPILE([], [return 0;],
7821 [ NO_INTEGRATED_AS_CFLAGS="-fno-integrated-as"
7822 result="yes" ], result="no")
7823 AC_MSG_RESULT([$result])
7825 CFLAGS="$_SAVE_CFLAGS"
7827 AC_SUBST(NO_INTEGRATED_AS_CFLAGS)
7829 fi # ! SKIP_COMPILER_CHECKS
7831 AC_DEFINE(CPP_THROW_NEW, [throw()])
7834 if test "$COMPILE_ENVIRONMENT"; then
7836 fi # COMPILE_ENVIRONMENT
7838 dnl ========================================================
7840 dnl = Build depencency options
7842 dnl ========================================================
7843 MOZ_ARG_HEADER(Build dependencies)
7845 if test "$GNU_CC" -a "$GNU_CXX"; then
7846 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7847 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7848 elif test "$SOLARIS_SUNPRO_CC"; then
7851 dnl Don't override this for MSVC
7852 if test -z "$_WIN32_MSVC"; then
7853 _USE_CPP_INCLUDE_FLAG=
7854 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7855 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7857 echo '#include <stdio.h>' > dummy-hello.c
7859 dnl This output is localized, split at the first double space or colon and space.
7860 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
7861 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
7862 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
7864 if ! test -e "$_CL_STDIO_PATH"; then
7865 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
7867 if test -z "$CL_INCLUDES_PREFIX"; then
7868 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7870 AC_SUBST(CL_INCLUDES_PREFIX)
7873 dnl Make sure that the build system can handle non-ASCII characters
7874 dnl in environment variables to prevent it from breaking silently on
7875 dnl non-English systems.
7876 NONASCII=$'\241\241'
7881 dnl ========================================================
7883 dnl = Static Build Options
7885 dnl ========================================================
7886 MOZ_ARG_HEADER(Static build options)
7888 if test "$OS_ARCH" = "WINNT"; then
7889 GKMEDIAS_SHARED_LIBRARY=1
7890 AC_DEFINE(GKMEDIAS_SHARED_LIBRARY)
7892 AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
7894 if test -z "$MOZ_NATIVE_ZLIB"; then
7895 if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
7897 AC_DEFINE(ZLIB_IN_MOZGLUE)
7901 AC_SUBST(ZLIB_IN_MOZGLUE)
7903 dnl ========================================================
7905 dnl = Standalone module options
7907 dnl ========================================================
7908 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7911 dnl ========================================================
7913 if test -z "$SKIP_PATH_CHECKS"; then
7914 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7915 if test "$MOZ_ENABLE_GTK" ; then
7916 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7921 if test -z "${GLIB_GMODULE_LIBS}" \
7922 -a -n "${GLIB_CONFIG}"\
7923 -a "${GLIB_CONFIG}" != no\
7925 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7928 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
7930 dnl ========================================================
7931 dnl Graphics checks.
7932 dnl ========================================================
7934 if test "${OS_TARGET}" = "WINNT"; then
7935 if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then
7936 MOZ_ENABLE_DIRECT2D1_1=1
7937 AC_SUBST(MOZ_ENABLE_DIRECT2D1_1)
7941 if test "${OS_TARGET}" = "WINNT" -o \
7942 "${OS_ARCH}" = "Darwin" -o \
7943 "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
7944 "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
7945 "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
7946 "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
7947 case "${target_cpu}" in
7959 MOZ_ARG_ENABLE_BOOL(skia,
7960 [ --enable-skia Enable use of Skia],
7964 if test "$USE_FC_FREETYPE"; then
7965 if test "$COMPILE_ENVIRONMENT"; then
7966 dnl ========================================================
7967 dnl = Check for freetype2 and its functionality
7968 dnl ========================================================
7969 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7971 if test "$_HAVE_FREETYPE2"; then
7973 _SAVE_CFLAGS="$CFLAGS"
7974 LIBS="$LIBS $FT2_LIBS"
7975 CFLAGS="$CFLAGS $FT2_CFLAGS"
7977 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7978 ac_cv_member_FT_Bitmap_Size_y_ppem,
7979 [AC_TRY_COMPILE([#include <ft2build.h>
7980 #include FT_FREETYPE_H],
7982 if (sizeof s.y_ppem) return 0;
7984 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7985 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7986 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7987 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7989 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7991 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7992 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7993 [FT_Bitmap_Size structure includes y_ppem field])
7995 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
7998 CFLAGS="$_SAVE_CFLAGS"
8001 _SAVE_CPPFLAGS="$CPPFLAGS"
8002 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8003 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8004 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8005 CPPFLAGS="$_SAVE_CPPFLAGS"
8007 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8010 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
8012 if test "$MOZ_PANGO"; then
8013 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
8014 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
8016 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
8017 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
8022 dnl ========================================================
8023 dnl Check for pixman and cairo
8024 dnl ========================================================
8026 if test "$MOZ_WIDGET_TOOLKIT" = "gtk3" ; then
8027 # cairo-gtk3 can be build with system-cairo only
8033 MOZ_ARG_ENABLE_BOOL(system-cairo,
8034 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8039 MOZ_ARG_ENABLE_BOOL(system-pixman,
8040 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8042 MOZ_TREE_PIXMAN=force,
8045 # System cairo depends on system pixman
8046 if test "$MOZ_TREE_PIXMAN" = "force"; then
8047 if test -z "$MOZ_TREE_CAIRO"; then
8048 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
8052 elif test -z "$MOZ_TREE_CAIRO"; then
8056 if test "$MOZ_TREE_PIXMAN"; then
8057 AC_DEFINE(MOZ_TREE_PIXMAN)
8059 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8060 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8061 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8063 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8064 AC_SUBST_LIST(MOZ_PIXMAN_LIBS)
8066 # Check for headers defining standard int types.
8067 if test -n "$COMPILE_ENVIRONMENT"; then
8068 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8070 if test "${ac_cv_header_inttypes_h}" = "yes"; then
8075 AC_SUBST(HAVE_INTTYPES_H)
8077 if test "$MOZ_TREE_CAIRO"; then
8078 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8079 AC_DEFINE(MOZ_TREE_CAIRO)
8081 if test "$OS_ARCH" = "WINNT"; then
8082 # For now we assume that we will have a uint64_t available through
8083 # one of the above headers or mozstdint.h.
8084 AC_DEFINE(HAVE_UINT64_T)
8087 # Define macros for cairo-features.h
8088 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8089 if test "$MOZ_X11"; then
8090 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8091 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8092 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8094 if test "$_HAVE_FREETYPE2"; then
8095 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8096 MOZ_ENABLE_CAIRO_FT=1
8097 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8100 case "$MOZ_WIDGET_TOOLKIT" in
8102 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8105 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8106 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8107 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8110 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8111 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8112 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8113 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8114 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8115 MOZ_ENABLE_D2D_SURFACE=1
8116 MOZ_ENABLE_DWRITE_FONT=1
8118 WIN32_DWRITE_FONT_FEATURE=
8119 WIN32_D2D_SURFACE_FEATURE=
8122 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8124 dnl D3D10 Layers depend on D2D Surfaces.
8125 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8126 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8130 AC_MSG_ERROR([cairo-gtk3 toolkit is incompatible with in-tree cairo. Please add --enable-system-cairo to your build config.])
8133 if test "$USE_FC_FREETYPE"; then
8134 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8136 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8137 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8138 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8139 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8140 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8142 AC_SUBST(PS_SURFACE_FEATURE)
8143 AC_SUBST(PDF_SURFACE_FEATURE)
8144 AC_SUBST(SVG_SURFACE_FEATURE)
8145 AC_SUBST(XLIB_SURFACE_FEATURE)
8146 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8147 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8148 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8149 AC_SUBST(WIN32_SURFACE_FEATURE)
8150 AC_SUBST(OS2_SURFACE_FEATURE)
8151 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8152 AC_SUBST(FT_FONT_FEATURE)
8153 AC_SUBST(FC_FONT_FEATURE)
8154 AC_SUBST(WIN32_FONT_FEATURE)
8155 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8156 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8157 AC_SUBST(QUARTZ_FONT_FEATURE)
8158 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8159 AC_SUBST(QT_SURFACE_FEATURE)
8160 AC_SUBST(TEE_SURFACE_FEATURE)
8162 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8164 if test "$MOZ_X11"; then
8165 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8168 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8170 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8171 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8172 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8173 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8174 if test "$MOZ_X11"; then
8175 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8176 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8177 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8178 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8182 AC_SUBST(MOZ_TREE_CAIRO)
8183 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
8184 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
8185 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
8186 AC_SUBST(MOZ_TREE_PIXMAN)
8188 dnl ========================================================
8190 dnl ========================================================
8191 if test "$MOZ_ENABLE_SKIA"; then
8192 AC_DEFINE(MOZ_ENABLE_SKIA)
8194 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8195 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8198 if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" ; then
8199 MOZ_ENABLE_SKIA_GPU=1
8200 AC_DEFINE(USE_SKIA_GPU)
8201 AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8204 AC_SUBST(MOZ_ENABLE_SKIA)
8206 dnl ========================================================
8208 dnl ========================================================
8209 MOZ_ARG_DISABLE_BOOL(xul,
8210 [ --disable-xul Disable XUL],
8212 if test "$MOZ_XUL"; then
8215 dnl remove extensions that require XUL
8216 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
8221 dnl ========================================================
8222 dnl disable profile locking
8223 dnl do no use this in applications that can have more than
8224 dnl one process accessing the profile directory.
8225 dnl ========================================================
8226 MOZ_ARG_DISABLE_BOOL(profilelocking,
8227 [ --disable-profilelocking
8228 Disable profile locking],
8229 MOZ_PROFILELOCKING=,
8230 MOZ_PROFILELOCKING=1 )
8231 if test "$MOZ_PROFILELOCKING"; then
8232 AC_DEFINE(MOZ_PROFILELOCKING)
8235 dnl ========================================================
8236 dnl necko configuration options
8237 dnl ========================================================
8240 dnl option to disable various necko protocols
8242 MOZ_ARG_ENABLE_STRING(necko-protocols,
8243 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8244 Enable/disable specific protocol handlers],
8245 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8246 if test "$option" = "yes" -o "$option" = "all"; then
8247 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8248 elif test "$option" = "no" -o "$option" = "none"; then
8250 elif test "$option" = "default"; then
8251 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8252 elif test `echo "$option" | grep -c \^-` != 0; then
8253 option=`echo $option | sed 's/^-//'`
8254 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8256 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8259 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8261 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8262 AC_SUBST_SET(NECKO_PROTOCOLS)
8263 for p in $NECKO_PROTOCOLS; do
8264 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8265 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8269 dnl option to disable necko's wifi scanner
8272 case "$OS_TARGET" in
8274 if test -n "$gonkdir"; then
8278 Darwin|FreeBSD|SunOS|WINNT)
8287 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8288 [ --disable-necko-wifi Disable necko wifi scanner],
8292 if test "$NECKO_WIFI"; then
8293 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
8294 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
8296 AC_DEFINE(NECKO_WIFI)
8297 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8299 AC_SUBST(NECKO_WIFI)
8300 AC_SUBST(NECKO_WIFI_DBUS)
8303 dnl option to disable cookies
8305 MOZ_ARG_DISABLE_BOOL(cookies,
8306 [ --disable-cookies Disable cookie support],
8309 AC_SUBST(NECKO_COOKIES)
8310 if test "$NECKO_COOKIES"; then
8311 AC_DEFINE(NECKO_COOKIES)
8312 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8316 dnl Always build Marionette if not Android or B2G
8318 if test "$OS_TARGET" != Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
8319 AC_DEFINE(ENABLE_MARIONETTE)
8321 AC_SUBST(ENABLE_MARIONETTE)
8322 if test "$ENABLE_MARIONETTE"; then
8323 AC_DEFINE(ENABLE_MARIONETTE)
8327 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8329 MOZ_ARG_DISABLE_BOOL(ctypes,
8330 [ --disable-ctypes Disable js-ctypes],
8333 AC_SUBST(BUILD_CTYPES)
8334 if test "$BUILD_CTYPES"; then
8335 AC_DEFINE(BUILD_CTYPES)
8338 dnl Build Places if required
8339 if test "$MOZ_PLACES"; then
8340 AC_DEFINE(MOZ_PLACES)
8343 dnl Build SocialAPI if required
8344 if test "$MOZ_SOCIAL"; then
8345 AC_DEFINE(MOZ_SOCIAL)
8348 dnl Build Common JS modules provided by services.
8349 AC_SUBST(MOZ_SERVICES_COMMON)
8350 if test -n "$MOZ_SERVICES_COMMON"; then
8351 AC_DEFINE(MOZ_SERVICES_COMMON)
8354 dnl Build Services crypto component (used by Sync)
8355 AC_SUBST(MOZ_SERVICES_CRYPTO)
8356 if test -n "$MOZ_SERVICES_CRYPTO"; then
8357 AC_DEFINE(MOZ_SERVICES_CRYPTO)
8360 dnl Build Firefox Health Reporter Service
8361 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8362 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8363 AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8366 dnl Build Services metrics component
8367 AC_SUBST(MOZ_SERVICES_METRICS)
8368 if test -n "$MOZ_SERVICES_METRICS"; then
8369 AC_DEFINE(MOZ_SERVICES_METRICS)
8372 dnl Build Notifications if required
8373 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8374 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8375 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8378 dnl Build Sync Services if required
8379 AC_SUBST(MOZ_SERVICES_SYNC)
8380 if test -n "$MOZ_SERVICES_SYNC"; then
8381 AC_DEFINE(MOZ_SERVICES_SYNC)
8384 dnl Build Services/CloudSync if required
8385 AC_SUBST(MOZ_SERVICES_CLOUDSYNC)
8386 if test -n "$MOZ_SERVICES_CLOUDSYNC"; then
8387 AC_DEFINE(MOZ_SERVICES_CLOUDSYNC)
8390 dnl Build Captive Portal Detector if required
8391 AC_SUBST(MOZ_CAPTIVEDETECT)
8392 if test -n "$MOZ_CAPTIVEDETECT"; then
8393 AC_DEFINE(MOZ_CAPTIVEDETECT)
8396 dnl Build second screen and casting features for external devices if required
8397 AC_SUBST(MOZ_DEVICES)
8398 if test -n "$MOZ_DEVICES"; then
8399 AC_DEFINE(MOZ_DEVICES)
8402 dnl ========================================================
8403 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8404 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8407 dnl ========================================================
8409 dnl = Maintainer debug option (no --enable equivalent)
8411 dnl ========================================================
8416 AC_SUBST(AR_EXTRACT)
8420 AC_SUBST(AS_DASH_C_FLAG)
8429 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8430 AC_SUBST(MOZ_UPDATE_XTERM)
8431 AC_SUBST(MOZ_AUTH_EXTENSION)
8432 AC_SUBST(MOZ_PERMISSIONS)
8433 AC_SUBST(MOZ_PREF_EXTENSIONS)
8435 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8436 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8437 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8438 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8439 AC_SUBST(WARNINGS_AS_ERRORS)
8440 AC_SUBST(MOZ_EXTENSIONS)
8441 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8444 AC_SUBST(MOZ_INSTRUMENTS)
8445 AC_SUBST(MOZ_CALLGRIND)
8447 AC_SUBST(MOZ_PROFILING)
8449 AC_SUBST(MOZ_PLACES)
8450 AC_SUBST(MOZ_SOCIAL)
8451 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8453 AC_SUBST(NS_PRINTING)
8454 AC_SUBST(MOZ_HELP_VIEWER)
8455 AC_SUBST(TOOLCHAIN_PREFIX)
8464 AC_SUBST(MOZ_PROFILELOCKING)
8466 AC_SUBST(ENABLE_TESTS)
8467 AC_SUBST(MOZ_UNIVERSALCHARDET)
8468 AC_SUBST(ACCESSIBILITY)
8469 AC_SUBST(MOZ_SPELLCHECK)
8470 AC_SUBST(MOZ_ANDROID_APZ)
8471 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8472 AC_SUBST(MOZ_CRASHREPORTER)
8473 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8474 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8475 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8476 AC_SUBST(MOZ_STUB_INSTALLER)
8477 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8478 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8479 AC_SUBST(MOZ_UPDATER)
8481 AC_SUBST(MOZ_ANGLE_RENDERER)
8482 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
8483 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
8484 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
8485 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
8486 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8487 AC_SUBST(MOZ_D3DCOMPILER_XP_DLL)
8488 AC_SUBST(MOZ_D3DCOMPILER_XP_CAB)
8492 AC_SUBST(MOZ_ANDROID_HISTORY)
8493 AC_SUBST(MOZ_WEBSMS_BACKEND)
8494 AC_SUBST(MOZ_ANDROID_BEAM)
8495 AC_SUBST(MOZ_LOCALE_SWITCHER)
8496 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
8497 AC_SUBST(MOZ_ANDROID_SEARCH_ACTIVITY)
8498 AC_SUBST(MOZ_ANDROID_SHARE_OVERLAY)
8499 AC_SUBST(MOZ_ANDROID_MLS_STUMBLER)
8500 AC_SUBST(ENABLE_STRIP)
8501 AC_SUBST(PKG_SKIP_STRIP)
8502 AC_SUBST(STRIP_FLAGS)
8503 AC_SUBST(USE_ELF_HACK)
8504 AC_SUBST(INCREMENTAL_LINKER)
8505 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8506 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8508 AC_SUBST(MOZ_FIX_LINK_PATHS)
8510 AC_SUBST(USE_DEPENDENT_LIBS)
8512 AC_SUBST(MOZ_BUILD_ROOT)
8514 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8515 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8516 AC_SUBST(MOZ_LINKER_EXTRACT)
8518 AC_SUBST(MOZ_JSDOWNLOADS)
8519 if test -n "$MOZ_JSDOWNLOADS"; then
8520 AC_DEFINE(MOZ_JSDOWNLOADS)
8523 dnl ========================================================
8524 dnl = Mac bundle name prefix
8525 dnl ========================================================
8526 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8527 [ --with-macbundlename-prefix=prefix
8528 Prefix for MOZ_MACBUNDLE_NAME],
8529 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8531 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8532 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8533 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8536 if test "$MOZ_DEBUG"; then
8537 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8539 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8541 AC_SUBST(MOZ_MACBUNDLE_NAME)
8543 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8544 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8545 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8546 if test "$MOZ_DEBUG"; then
8547 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8550 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8551 AC_SUBST(MOZ_MACBUNDLE_ID)
8553 dnl ========================================================
8554 dnl = Child Process Name for IPC
8555 dnl ========================================================
8556 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8557 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8559 # We want to let Android unpack the file at install time, but it only does
8560 # so if the file is named libsomething.so. The lib/ path is also required
8561 # because the unpacked file will be under the lib/ subdirectory and will
8562 # need to be executed from that path.
8563 MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8565 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8567 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8568 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8570 # The following variables are available to branding and application
8571 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8572 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8573 # impacts profile location and user-visible fields.
8574 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8575 # versions of a given application (e.g. Aurora and Firefox both use
8576 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8577 # for application.ini's "Name" field, which controls profile location in
8578 # the absence of a "Profile" field (see below), and various system
8579 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8580 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8581 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8582 # builds (e.g. Aurora for Firefox).
8583 # - MOZ_APP_VERSION: Defines the application version number.
8584 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8585 # defaults to a lowercase form of MOZ_APP_BASENAME.
8586 # - MOZ_APP_PROFILE: When set, used for application.ini's
8587 # "Profile" field, which controls profile location.
8588 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8589 # crash reporter server url.
8590 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8592 if test -z "$MOZ_APP_NAME"; then
8593 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8596 # For extensions and langpacks, we require a max version that is compatible
8597 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8598 # 24.0a1 and 24.0a2 aren't affected
8600 # 24.1.1 becomes 24.*
8601 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8602 if test -z "$IS_ALPHA"; then
8604 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
8607 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8610 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8611 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8612 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8614 AC_SUBST(MOZ_APP_NAME)
8615 AC_SUBST(MOZ_APP_DISPLAYNAME)
8616 AC_SUBST(MOZ_APP_BASENAME)
8617 AC_SUBST(MOZ_APP_VENDOR)
8618 AC_SUBST(MOZ_APP_PROFILE)
8619 AC_SUBST(MOZ_APP_ID)
8620 AC_SUBST(MAR_CHANNEL_ID)
8621 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8622 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8623 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8624 AC_SUBST(MOZ_APP_UA_NAME)
8625 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8626 AC_SUBST(MOZ_APP_VERSION)
8627 AC_SUBST(MOZ_APP_MAXVERSION)
8628 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8629 AC_SUBST(FIREFOX_VERSION)
8630 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8631 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8632 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8635 AC_SUBST(MOZ_APP_STATIC_INI)
8637 AC_SUBST(MOZ_PKG_SPECIAL)
8639 AC_SUBST(MOZILLA_OFFICIAL)
8641 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8642 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8644 if test "$MOZ_TELEMETRY_REPORTING"; then
8645 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8647 # Enable Telemetry by default for nightly and aurora channels
8648 if test -z "$RELEASE_BUILD"; then
8649 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8653 dnl If we have any service that uploads data (and requires data submission
8654 dnl policy alert), set MOZ_DATA_REPORTING.
8655 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8656 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8657 MOZ_DATA_REPORTING=1
8658 AC_DEFINE(MOZ_DATA_REPORTING)
8659 AC_SUBST(MOZ_DATA_REPORTING)
8663 AC_SUBST(MOZ_BROWSE_INFO)
8664 AC_SUBST(MOZ_TOOLS_DIR)
8665 AC_SUBST(WIN32_REDIST_DIR)
8668 dnl Echo the CFLAGS to remove extra whitespace.
8674 $_WARNINGS_CXXFLAGS \
8677 COMPILE_CFLAGS=`echo \
8682 COMPILE_CXXFLAGS=`echo \
8683 $_DEFINES_CXXFLAGS \
8691 HOST_CXXFLAGS=`echo \
8695 AC_SUBST(MOZ_NATIVE_JPEG)
8696 AC_SUBST(MOZ_NATIVE_PNG)
8697 AC_SUBST(MOZ_NATIVE_BZ2)
8699 AC_SUBST(MOZ_JPEG_CFLAGS)
8700 AC_SUBST_LIST(MOZ_JPEG_LIBS)
8701 AC_SUBST(MOZ_BZ2_CFLAGS)
8702 AC_SUBST_LIST(MOZ_BZ2_LIBS)
8703 AC_SUBST(MOZ_PNG_CFLAGS)
8704 AC_SUBST_LIST(MOZ_PNG_LIBS)
8706 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
8707 export MOZ_NUWA_PROCESS
8708 AC_DEFINE(MOZ_NUWA_PROCESS)
8710 AC_SUBST(MOZ_NUWA_PROCESS)
8711 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_B2G_LOADER"; then
8712 if test -z "$MOZ_NUWA_PROCESS"; then
8713 AC_MSG_ERROR([B2G loader works with Nuwa]);
8715 export MOZ_B2G_LOADER
8716 AC_DEFINE(MOZ_B2G_LOADER)
8718 AC_SUBST(MOZ_B2G_LOADER)
8720 AC_SUBST(NSPR_CFLAGS)
8721 AC_SUBST(MOZ_NATIVE_NSPR)
8723 AC_SUBST(NSS_CFLAGS)
8724 AC_SUBST(MOZ_NATIVE_NSS)
8725 AC_SUBST(NSS_DISABLE_DBM)
8728 OS_CXXFLAGS="$CXXFLAGS"
8729 OS_CPPFLAGS="$CPPFLAGS"
8730 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8731 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8732 OS_LDFLAGS="$LDFLAGS"
8735 AC_SUBST(OS_CXXFLAGS)
8736 AC_SUBST(OS_CPPFLAGS)
8737 AC_SUBST(OS_COMPILE_CFLAGS)
8738 AC_SUBST(OS_COMPILE_CXXFLAGS)
8739 AC_SUBST(OS_LDFLAGS)
8741 AC_SUBST(CROSS_COMPILE)
8742 AC_SUBST(WCHAR_CFLAGS)
8746 AC_SUBST(HOST_CFLAGS)
8747 AC_SUBST(HOST_CXXFLAGS)
8748 AC_SUBST(HOST_LDFLAGS)
8749 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8751 AC_SUBST(HOST_AR_FLAGS)
8753 AC_SUBST(HOST_RANLIB)
8754 AC_SUBST(HOST_NSPR_MDCPUCFG)
8755 AC_SUBST(HOST_BIN_SUFFIX)
8756 AC_SUBST(HOST_OS_ARCH)
8758 AC_SUBST(TARGET_CPU)
8759 AC_SUBST(TARGET_VENDOR)
8761 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8762 AC_SUBST(TARGET_MD_ARCH)
8763 AC_SUBST(TARGET_XPCOM_ABI)
8766 AC_SUBST(OS_RELEASE)
8769 AC_SUBST(INTEL_ARCHITECTURE)
8770 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
8771 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
8772 AC_SUBST(HAVE_X86_AVX2)
8773 AC_SUBST(GCC_USE_GNU_LD)
8775 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8777 AC_SUBST(WRAP_LDFLAGS)
8780 AC_SUBST(MKSHLIB_FORCE_ALL)
8781 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8782 AC_SUBST(DSO_CFLAGS)
8783 AC_SUBST(DSO_PIC_CFLAGS)
8784 AC_SUBST(DSO_LDOPTS)
8785 AC_SUBST(LIB_PREFIX)
8786 AC_SUBST(DLL_PREFIX)
8787 AC_SUBST(DLL_SUFFIX)
8788 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8789 AC_SUBST(LIB_SUFFIX)
8790 AC_SUBST(OBJ_SUFFIX)
8791 AC_SUBST(BIN_SUFFIX)
8792 AC_SUBST(ASM_SUFFIX)
8793 AC_SUBST(IMPORT_LIB_SUFFIX)
8795 AC_SUBST(CC_VERSION)
8796 AC_SUBST(CXX_VERSION)
8797 AC_SUBST(MSMANIFEST_TOOL)
8798 AC_SUBST(NS_ENABLE_TSF)
8799 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
8800 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
8803 AC_SUBST(MOZ_VORBIS)
8804 AC_SUBST(MOZ_TREMOR)
8808 AC_SUBST(MOZ_FFMPEG)
8811 AC_SUBST(MOZ_DIRECTSHOW)
8812 AC_SUBST(MOZ_ANDROID_OMX)
8813 AC_SUBST(MOZ_APPLEMEDIA)
8814 AC_SUBST(MOZ_OMX_PLUGIN)
8815 AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
8818 AC_SUBST(VPX_ASFLAGS)
8819 AC_SUBST(VPX_DASH_C_FLAG)
8820 AC_SUBST(VPX_AS_CONVERSION)
8821 AC_SUBST(VPX_ASM_SUFFIX)
8822 AC_SUBST(VPX_X86_ASM)
8823 AC_SUBST(VPX_ARM_ASM)
8824 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8825 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8826 AC_SUBST(MOZ_CODE_COVERAGE)
8827 AC_SUBST(LIBJPEG_TURBO_AS)
8828 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8829 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8830 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8831 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8833 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8834 AC_SUBST(MOZ_FOLD_LIBS)
8836 AC_SUBST(MOZ_ENABLE_SZIP)
8837 AC_SUBST(MOZ_SZIP_FLAGS)
8839 if test "$MOZ_DEBUG"; then
8842 AC_SUBST(MOZ_EM_DEBUG)
8844 if test -n "$COMPILE_ENVIRONMENT"; then
8845 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
8847 dnl Check for missing components
8848 if test "$MOZ_X11"; then
8849 if test "$WITHOUT_X11"; then
8850 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8852 dnl ====================================================
8853 dnl = Check if X headers exist
8854 dnl ====================================================
8855 _SAVE_CFLAGS=$CFLAGS
8856 CFLAGS="$CFLAGS $XCFLAGS"
8860 #include <X11/Xlib.h>
8861 #include <X11/Intrinsic.h>
8862 #include <X11/extensions/XShm.h>
8866 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8867 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8871 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
8872 CFLAGS="$_SAVE_CFLAGS"
8874 if test -n "$MISSING_X"; then
8875 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8880 fi # COMPILE_ENVIRONMENT
8882 dnl Set various defines and substitutions
8883 dnl ========================================================
8885 if test "$OS_ARCH" != "WINNT"; then
8889 if test "$MOZ_DEBUG"; then
8890 AC_DEFINE(MOZ_REFLOW_PERF)
8891 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8894 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
8895 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8896 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8897 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8898 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8899 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8900 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8901 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8902 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8905 if test "$MOZ_DEBUG"; then
8908 case "$MOZ_UPDATE_CHANNEL" in
8909 aurora|beta|release|esr)
8916 if test -n "$A11Y_LOG"; then
8920 AC_SUBST(MOZILLA_VERSION)
8922 AC_SUBST(ac_configure_args)
8924 dnl Spit out some output
8925 dnl ========================================================
8927 dnl The following defines are used by xpcom
8928 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8930 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8931 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8932 HAVE_CPP_PARTIAL_SPECIALIZATION
8933 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8934 NEED_CPP_UNUSED_IMPLEMENTATIONS
8937 HAVE_ICONV_WITH_CONST_INPUT
8950 AC_SUBST(STLPORT_LIBS)
8952 dnl ========================================================
8954 dnl ========================================================
8956 # Internationalization isn't built or exposed by default in non-desktop
8957 # builds. Bugs to enable:
8959 # Android: bug 864843
8962 if test "$MOZ_WIDGET_TOOLKIT" = "android" ||
8963 test "$MOZ_BUILD_APP" = "b2g"; then
8971 if test -z "$JS_SHARED_LIBRARY"; then
8972 AC_DEFINE(MOZ_STATIC_JS)
8974 AC_SUBST(JS_SHARED_LIBRARY)
8976 MOZ_CREATE_CONFIG_STATUS()
8978 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8979 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8980 MOZ_SUBCONFIGURE_ICU()
8981 MOZ_SUBCONFIGURE_FFI()
8984 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8985 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8986 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8987 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8988 # (apparently) only need this hack when egrep's "pattern" is particularly long
8989 # (as in the following code) and the first egrep on our $PATH is Apple's. See
8993 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
9000 # Run jemalloc configure script
9002 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
9003 ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
9004 if test -n "$MOZ_REPLACE_MALLOC"; then
9005 # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9006 ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9007 ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9009 if test -n "$MOZ_JEMALLOC3"; then
9010 case "${OS_ARCH}" in
9012 # We want jemalloc functions to be kept hidden on both Mac and Windows
9013 # See memory/build/mozmemory_wrap.h for details.
9014 ac_configure_args="$ac_configure_args --without-export"
9017 elif test "${OS_ARCH}" = Darwin; then
9018 # When building as a replace-malloc lib, disabling the zone allocator
9019 # forces to use pthread_atfork.
9020 ac_configure_args="$ac_configure_args --disable-zone-allocator"
9022 _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9024 if test -z "$MOZ_REPLACE_MALLOC"; then
9026 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9030 elif test -z "$MOZ_JEMALLOC3"; then
9032 JEMALLOC_WRAPPER=replace_
9034 if test -n "$MANGLE"; then
9036 if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
9037 JEMALLOC_WRAPPER=__wrap_
9039 for mangle in ${MANGLE}; do
9040 if test -n "$MANGLED"; then
9041 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9043 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9046 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9049 if test -z "$MOZ_TLS"; then
9050 ac_configure_args="$ac_configure_args --disable-tls"
9052 EXTRA_CFLAGS="$CFLAGS"
9053 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9054 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9056 if test "$CROSS_COMPILE"; then
9057 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9060 if ! test -e memory/jemalloc; then
9061 mkdir -p memory/jemalloc
9064 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9065 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9068 # Run freetype configure script
9070 if test "$MOZ_TREE_FREETYPE"; then
9071 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9072 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9073 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9074 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9075 # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
9076 # to force freetype to use our settings rather than autodetecting
9077 if test -n "$MOZ_NATIVE_PNG"; then
9078 export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
9080 export LIBPNG_CFLAGS="-I$_objdir/dist/include"
9082 export LIBPNG_LIBS="$MOZ_PNG_LIBS "
9083 export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
9084 export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
9085 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9086 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
9088 if ! test -e modules; then
9091 # Only export CC, CXX and RANLIB for the subconfigure, and avoid spilling
9092 # that further down the road.
9093 (export CC CXX RANLIB;
9094 AC_OUTPUT_SUBDIRS(modules/freetype2)
9098 if test -z "$direct_nspr_config"; then
9099 dnl ========================================================
9100 dnl = Setup a nice relatively clean build environment for
9101 dnl = sub-configures.
9102 dnl ========================================================
9105 CFLAGS="$_SUBDIR_CFLAGS"
9106 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9107 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9108 LDFLAGS="$_SUBDIR_LDFLAGS"
9109 HOST_CC="$_SUBDIR_HOST_CC"
9110 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9111 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9112 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9119 # Run all configure scripts specified by a subconfigure
9120 if test -n "$_subconfigure_subdir"; then
9121 _save_srcdir="$srcdir"
9123 _save_ac_configure_args="$ac_configure_args"
9124 ac_configure_args="$_subconfigure_config_args"
9125 AC_OUTPUT_SUBDIRS("$_subconfigure_subdir",$cache_file)
9126 ac_configure_args="$_save_ac_configure_args"
9127 srcdir="$_save_srcdir"
9130 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9131 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9135 if test -n "$_WRAP_MALLOC"; then
9136 # Avoid doubling wrap malloc arguments
9137 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9140 MOZ_SUBCONFIGURE_NSPR()
9142 dnl ========================================================
9143 dnl = Setup a nice relatively clean build environment for
9144 dnl = sub-configures.
9145 dnl ========================================================
9148 CFLAGS="$_SUBDIR_CFLAGS"
9149 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9150 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9151 LDFLAGS="$_SUBDIR_LDFLAGS"
9152 HOST_CC="$_SUBDIR_HOST_CC"
9153 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9154 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9155 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9158 if test -n "$ENABLE_CLANG_PLUGIN"; then
9159 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9160 AC_OUTPUT_SUBDIRS(build/clang-plugin)
9163 # Run the SpiderMonkey 'configure' script.
9164 dist=$MOZ_BUILD_ROOT/dist
9165 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9167 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
9169 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
9171 ac_configure_args="$ac_configure_args --enable-threadsafe"
9173 if test "$_INTL_API" = no; then
9174 ac_configure_args="$ac_configure_args --without-intl-api"
9177 if test "$BUILD_CTYPES"; then
9178 # Build js-ctypes on the platforms we can.
9179 ac_configure_args="$ac_configure_args --enable-ctypes"
9181 if test -z "$JS_SHARED_LIBRARY" ; then
9182 ac_configure_args="$ac_configure_args --disable-shared-js"
9183 if test -n "$MOZ_DISABLE_EXPORT_JS"; then
9184 ac_configure_args="$ac_configure_args --disable-export-js"
9187 if test -z "$JSGC_USE_EXACT_ROOTING" ; then
9188 ac_configure_args="$ac_configure_args --disable-exact-rooting"
9190 if test -z "$JSGC_GENERATIONAL" ; then
9191 ac_configure_args="$ac_configure_args --disable-gcgenerational"
9193 if test -n "$JS_GCCOMPACTING" ; then
9194 ac_configure_args="$ac_configure_args --enable-gccompacting"
9196 if test -n "$JS_GC_SMALL_CHUNK_SIZE" ; then
9197 ac_configure_args="$ac_configure_args --enable-small-chunk-size"
9199 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
9200 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9201 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9203 ac_configure_args="$ac_configure_args --prefix=$dist"
9204 if test "$MOZ_MEMORY"; then
9205 ac_configure_args="$ac_configure_args --enable-jemalloc"
9207 if test -n "$MOZ_GLUE_LDFLAGS"; then
9208 export MOZ_GLUE_LDFLAGS
9210 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9211 export MOZ_GLUE_PROGRAM_LDFLAGS
9213 if test -n "$ZLIB_IN_MOZGLUE"; then
9216 export MOZ_NATIVE_ZLIB
9217 export MOZ_ZLIB_CFLAGS
9218 export MOZ_ZLIB_LIBS
9220 export DONT_POPULATE_VIRTUALENV=1
9222 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9223 export STLPORT_CPPFLAGS
9225 export JS_STANDALONE=no
9227 export ZLIB_IN_MOZGLUE
9229 if ! test -e js; then
9233 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
9234 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9236 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9238 export WRITE_MOZINFO=1
9239 dnl we need to run config.status after js/src subconfigure because we're
9240 dnl traversing its moz.build and we need its config.status for that.
9241 dnl However, writing our own config.status needs to happen before
9242 dnl subconfigures because the setup surrounding subconfigures alters
9243 dnl many AC_SUBSTed variables.
9244 MOZ_RUN_CONFIG_STATUS()