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.1, [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
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 os.path; print(os.path.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 specifying a Bing API key file that contains the client ID and the
3959 # secret key to be used for the Bing Translation API requests.
3960 MOZ_ARG_WITH_STRING(bing-api-keyfile,
3961 [ --with-bing-api-keyfile=file Use the client id and secret key contained in the given keyfile for Bing API requests],
3962 [MOZ_BING_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
3963 MOZ_BING_API_KEY=`cat $withval | cut -f 2 -d " "`])
3964 if test -z "$MOZ_BING_API_CLIENTID"; then
3965 MOZ_BING_API_CLIENTID=no-bing-api-clientid
3966 MOZ_BING_API_KEY=no-bing-api-key
3968 AC_SUBST(MOZ_BING_API_CLIENTID)
3969 AC_SUBST(MOZ_BING_API_KEY)
3971 # Allow the application to influence configure with a confvars.sh script.
3972 AC_MSG_CHECKING([if app-specific confvars.sh exists])
3973 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
3974 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
3975 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
3980 # Allow influencing configure with a defines.sh script.
3981 . "${srcdir}/build/defines.sh"
3983 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
3985 if test "$BUILDING_RELEASE"; then
3986 # Override value in defines.sh, if any
3987 EARLY_BETA_OR_EARLIER=
3988 elif test "$EARLY_BETA_OR_EARLIER"; then
3989 AC_DEFINE(EARLY_BETA_OR_EARLIER)
3991 AC_SUBST(EARLY_BETA_OR_EARLIER)
3993 # Allow the application to provide a subconfigure script
3994 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
3995 do_output_subdirs() {
3996 if test -n "$_subconfigure_subdirs"; then
3997 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
3999 _subconfigure_subdir="$1"
4000 _subconfigure_config_args="$ac_configure_args"
4002 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4003 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4004 "${srcdir}/build/autoconf/altoptions.m4" \
4005 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4010 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4011 MOZ_ARG_WITH_STRING(app-name,
4012 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4013 WITH_APP_NAME=$withval,
4016 if test -n "$WITH_APP_NAME" ; then
4017 MOZ_APP_NAME="$WITH_APP_NAME"
4020 MOZ_ARG_WITH_STRING(app-basename,
4021 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4022 WITH_APP_BASENAME=$withval,
4025 if test -n "$WITH_APP_BASENAME" ; then
4026 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4029 # Now is a good time to test for logic errors, define mismatches, etc.
4030 case "$MOZ_BUILD_APP" in
4032 if test "$LIBXUL_SDK"; then
4033 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4038 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4039 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4041 case "$MOZ_BUILD_APP" in
4043 AC_DEFINE(MOZ_PHOENIX)
4047 AC_DEFINE(MOZ_XULRUNNER)
4054 AC_DEFINE(MOZ_MULET)
4058 AC_SUBST(MOZ_BUILD_APP)
4059 AC_SUBST(MOZ_PHOENIX)
4060 AC_SUBST(MOZ_XULRUNNER)
4063 AC_SUBST(MOZ_B2G_VERSION)
4065 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4067 dnl ========================================================
4068 dnl Check Android SDK version depending on mobile target.
4069 dnl ========================================================
4071 if test -z "$gonkdir" ; then
4072 # Minimum Android SDK API Level we require.
4073 case "$MOZ_BUILD_APP" in
4075 android_min_api_level=17
4077 *-android*|*-linuxandroid*)
4081 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])
4087 MOZ_ANDROID_SDK($android_min_api_level)
4090 dnl ========================================================
4092 dnl = Toolkit Options
4094 dnl ========================================================
4095 MOZ_ARG_HEADER(Toolkit Options)
4097 dnl ========================================================
4098 dnl = Select the default toolkit
4099 dnl ========================================================
4100 MOZ_ARG_ENABLE_STRING(default-toolkit,
4101 [ --enable-default-toolkit=TK
4102 Select default toolkit
4103 Platform specific defaults:
4104 Mac OS X - cairo-cocoa
4105 Win32 - cairo-windows
4109 [ _DEFAULT_TOOLKIT=$enableval ],
4110 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4112 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4113 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4114 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4115 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4116 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4117 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4118 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4119 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4120 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4122 dnl nglayout only supports building with one toolkit,
4123 dnl so ignore everything after the first comma (",").
4124 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4126 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4129 MOZ_ARG_WITHOUT_BOOL(x,
4130 [ --without-x Build without X11],
4133 dnl ========================================================
4134 dnl = Enable the toolkit as needed =
4135 dnl ========================================================
4139 case "$MOZ_WIDGET_TOOLKIT" in
4142 MOZ_WIDGET_TOOLKIT=windows
4144 MOZ_INSTRUMENT_EVENT_LOOP=1
4145 if test -n "$GNU_CC"; then
4151 MOZ_WIDGET_TOOLKIT=gtk3
4154 MOZ_ENABLE_XREMOTE=1
4155 MOZ_GL_DEFAULT_PROVIDER=GLX
4161 TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4162 TK_LIBS='$(MOZ_GTK3_LIBS)'
4164 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4166 MOZ_INSTRUMENT_EVENT_LOOP=1
4169 cairo-gtk2|cairo-gtk2-x11)
4170 MOZ_WIDGET_TOOLKIT=gtk2
4173 MOZ_ENABLE_XREMOTE=1
4174 MOZ_GL_DEFAULT_PROVIDER=GLX
4180 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4181 TK_LIBS='$(MOZ_GTK2_LIBS)'
4182 AC_DEFINE(MOZ_WIDGET_GTK2)
4184 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4186 MOZ_INSTRUMENT_EVENT_LOOP=1
4190 MOZ_WIDGET_TOOLKIT=qt
4192 if test -z "$WITHOUT_X11"; then
4193 MOZ_ENABLE_XREMOTE=1
4194 MOZ_GL_DEFAULT_PROVIDER=GLX
4201 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4202 TK_LIBS='$(MOZ_QT_LIBS)'
4203 AC_DEFINE(MOZ_WIDGET_QT)
4205 AC_DEFINE(QT_NO_KEYWORDS)
4209 MOZ_WIDGET_TOOLKIT=cocoa
4210 AC_DEFINE(MOZ_WIDGET_COCOA)
4211 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4212 # Use -Wl as a trick to avoid -framework and framework names from
4213 # being separated by AC_SUBST_LIST.
4214 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'
4215 TK_CFLAGS="-DNO_X11"
4216 CFLAGS="$CFLAGS $TK_CFLAGS"
4217 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4218 MOZ_USER_DIR="Mozilla"
4219 MOZ_FS_LAYOUT=bundle
4220 MOZ_INSTRUMENT_EVENT_LOOP=1
4224 MOZ_WIDGET_TOOLKIT=uikit
4225 AC_DEFINE(MOZ_WIDGET_UIKIT)
4226 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4227 TK_CFLAGS="-DNO_X11"
4228 TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText'
4229 CFLAGS="$CFLAGS $TK_CFLAGS"
4230 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4231 MOZ_USER_DIR="Mozilla"
4232 MOZ_FS_LAYOUT=bundle
4236 AC_DEFINE(MOZ_WIDGET_ANDROID)
4237 MOZ_WIDGET_TOOLKIT=android
4238 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4239 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4241 MOZ_INSTRUMENT_EVENT_LOOP=1
4245 AC_DEFINE(MOZ_WIDGET_GONK)
4246 AC_DEFINE(MOZ_TOUCH)
4247 MOZ_WIDGET_TOOLKIT=gonk
4248 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4249 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4252 MOZ_INSTRUMENT_EVENT_LOOP=1
4257 AC_SUBST(MOZ_PDF_PRINTING)
4258 if test "$MOZ_PDF_PRINTING"; then
4259 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4260 AC_DEFINE(MOZ_PDF_PRINTING)
4263 if test "$MOZ_ENABLE_XREMOTE"; then
4264 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4267 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4268 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4271 if test "$COMPILE_ENVIRONMENT"; then
4272 if test "$MOZ_ENABLE_GTK3"; then
4273 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4274 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
4276 if test "$MOZ_ENABLE_GTK"; then
4277 if test "$MOZ_X11"; then
4278 GDK_PACKAGES=gdk-x11-2.0
4281 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4282 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
4285 fi # COMPILE_ENVIRONMENT
4287 AC_SUBST(MOZ_FS_LAYOUT)
4289 dnl ========================================================
4290 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4291 dnl their usage and use them in spidermonkey.
4292 dnl ========================================================
4293 MOZ_ARG_WITH_BOOL(arm-kuser,
4294 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4296 if test -n "$USE_ARM_KUSER"; then
4297 AC_DEFINE(USE_ARM_KUSER)
4300 dnl ========================================================
4301 dnl = startup-notification support module
4302 dnl ========================================================
4304 if test "$MOZ_ENABLE_GTK"
4306 MOZ_ENABLE_STARTUP_NOTIFICATION=
4308 MOZ_ARG_ENABLE_BOOL(startup-notification,
4309 [ --enable-startup-notification
4310 Enable startup-notification support (default: disabled) ],
4311 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4312 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4313 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4315 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4316 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4317 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4318 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4320 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4322 MOZ_ENABLE_STARTUP_NOTIFICATION=
4326 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4327 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4330 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4332 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4334 dnl ========================================================
4335 dnl Disable printing
4336 dnl ========================================================
4337 MOZ_ARG_DISABLE_BOOL(printing,
4338 [ --disable-printing Disable printing support],
4342 if test "$NS_PRINTING"; then
4343 AC_DEFINE(NS_PRINTING)
4344 AC_DEFINE(NS_PRINT_PREVIEW)
4347 dnl ========================================================
4349 dnl ========================================================
4350 if test "$MOZ_ENABLE_QT"
4352 MOZ_ARG_WITH_STRING(qtdir,
4353 [ --with-qtdir=\$dir Specify Qt directory ],
4356 if test -z "$QTDIR"; then
4357 AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4359 HOST_QMAKE="$QTDIR/bin/qmake"
4361 QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4363 if test -z "$QTDIR"; then
4366 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4367 PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5Quick, ,
4369 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4371 QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4372 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4373 if test "$NS_PRINTING"; then
4374 PKG_CHECK_MODULES(MOZ_QT_WIDGETS, Qt5PrintSupport, ,
4376 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase widgets development package])
4378 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT_WIDGETS_LIBS"
4379 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT_WIDGETS_CFLAGS"
4383 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4387 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4388 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4390 MOZ_QT_CFLAGS="-DQT_SHARED"
4391 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4392 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4393 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4394 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4395 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4396 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4399 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4400 MOZ_QT_LIBS="$MOZ_QT_LIBS -L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml"
4401 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4402 if test "$NS_PRINTING"; then
4403 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4404 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4408 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4412 HOST_MOC="$QTDIR/bin/moc"
4413 HOST_RCC="$QTDIR/bin/rcc"
4415 if test -z "$HOST_MOC"; then
4416 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4418 if test -z "$HOST_RCC"; then
4419 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4425 MOZ_ENABLE_QMSYSTEM2=
4426 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4427 MOZ_ENABLE_QMSYSTEM2=1,
4428 MOZ_ENABLE_QMSYSTEM2=)
4430 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4431 MOZ_ENABLE_QMSYSTEM2=1
4432 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4433 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4434 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4437 MOZ_ENABLE_QTNETWORK=
4438 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4439 MOZ_ENABLE_QTNETWORK=1,
4440 MOZ_ENABLE_QTNETWORK=)
4442 if test "$MOZ_ENABLE_QTNETWORK"; then
4443 MOZ_ENABLE_QTNETWORK=1
4444 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4447 MOZ_ENABLE_QTMOBILITY=
4448 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4449 MOZ_ENABLE_QTMOBILITY=1,
4450 MOZ_ENABLE_QTMOBILITY=)
4451 if test "$MOZ_ENABLE_QTMOBILITY"; then
4452 MOZ_ENABLE_QTMOBILITY=1
4453 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4454 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4455 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4456 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4458 AC_CHECK_LIB(QtSensors, main, [
4459 MOZ_ENABLE_QTMOBILITY=1
4460 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4461 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4462 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4463 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4464 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4468 MOZ_ENABLE_QT5FEEDBACK=
4469 PKG_CHECK_MODULES(_QT5FEEDBACK, Qt0Feedback,
4470 MOZ_ENABLE_QT5FEEDBACK=1,
4471 MOZ_ENABLE_QT5FEEDBACK=)
4472 if test "$MOZ_ENABLE_QT5FEEDBACK"; then
4473 MOZ_ENABLE_QT5FEEDBACK=1
4474 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5FEEDBACK_CFLAGS"
4475 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5FEEDBACK_LIBS"
4476 AC_DEFINE(MOZ_ENABLE_QT5FEEDBACK)
4477 AC_SUBST(MOZ_ENABLE_QT5FEEDBACK)
4480 MOZ_ENABLE_QT5GEOPOSITION=
4481 PKG_CHECK_MODULES(_QT5GEOPOSITION, Qt5Positioning,
4482 MOZ_ENABLE_QT5GEOPOSITION=1,
4483 MOZ_ENABLE_QT5GEOPOSITION=)
4484 if test "$MOZ_ENABLE_QT5GEOPOSITION"; then
4485 MOZ_ENABLE_QT5GEOPOSITION=1
4486 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5GEOPOSITION_CFLAGS"
4487 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5GEOPOSITION_LIBS"
4488 AC_DEFINE(MOZ_ENABLE_QT5GEOPOSITION)
4489 AC_SUBST(MOZ_ENABLE_QT5GEOPOSITION)
4492 if test "$MOZ_ENABLE_CONTENTACTION"; then
4493 MOZ_ENABLE_CONTENTACTION=1
4494 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4497 MOZ_ENABLE_CONTENTACTION=
4498 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
4499 if test "$MOZ_ENABLE_CONTENTACTION"; then
4500 MOZ_ENABLE_CONTENTACTION=1
4501 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
4502 MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
4503 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4504 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
4508 AC_SUBST(GTK_CONFIG)
4509 AC_SUBST_LIST(TK_CFLAGS)
4510 AC_SUBST_LIST(TK_LIBS)
4512 AC_SUBST(MOZ_ENABLE_GTK2)
4513 AC_SUBST(MOZ_ENABLE_GTK3)
4514 AC_SUBST(MOZ_ENABLE_GTK)
4515 AC_SUBST(MOZ_ENABLE_QT)
4516 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4517 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4518 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4519 AC_SUBST(MOZ_ENABLE_XREMOTE)
4520 AC_SUBST(MOZ_WIDGET_GTK)
4521 AC_SUBST_LIST(MOZ_QT_CFLAGS)
4522 AC_SUBST_LIST(MOZ_QT_LIBS)
4529 dnl ========================================================
4531 dnl = Components & Features
4533 dnl ========================================================
4534 MOZ_ARG_HEADER(Components and Features)
4536 dnl ========================================================
4538 dnl ========================================================
4539 MOZ_ARG_ENABLE_STRING(ui-locale,
4540 [ --enable-ui-locale=ab-CD
4541 Select the user interface locale (default: en-US)],
4542 MOZ_UI_LOCALE=$enableval )
4543 AC_SUBST(MOZ_UI_LOCALE)
4545 dnl ========================================================
4546 dnl = Trademarked Branding
4547 dnl ========================================================
4548 MOZ_ARG_ENABLE_BOOL(official-branding,
4549 [ --enable-official-branding
4550 Enable Official mozilla.org Branding
4551 Do not distribute builds with
4552 --enable-official-branding unless you have
4553 permission to use trademarks per
4554 http://www.mozilla.org/foundation/trademarks/ .],
4556 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4557 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4559 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4560 MOZ_OFFICIAL_BRANDING=1
4562 ], MOZ_OFFICIAL_BRANDING=)
4564 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4565 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4566 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4569 MOZ_ARG_WITH_STRING(branding,
4570 [ --with-branding=dir Use branding from the specified directory.],
4571 MOZ_BRANDING_DIRECTORY=$withval)
4573 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4574 if test -z "$REAL_BRANDING_DIRECTORY"; then
4575 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4578 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4579 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4580 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4581 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
4584 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4586 dnl ========================================================
4587 dnl = Distribution ID
4588 dnl ========================================================
4589 MOZ_ARG_WITH_STRING(distribution-id,
4590 [ --with-distribution-id=ID
4591 Set distribution-specific id (default=org.mozilla)],
4592 [ val=`echo $withval`
4593 MOZ_DISTRIBUTION_ID="$val"])
4595 if test -z "$MOZ_DISTRIBUTION_ID"; then
4596 MOZ_DISTRIBUTION_ID="org.mozilla"
4599 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4600 AC_SUBST(MOZ_DISTRIBUTION_ID)
4603 dnl ========================================================
4605 dnl ========================================================
4606 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4608 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4610 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4613 dnl ========================================================
4614 dnl = GnomeVFS, GIO and GConf support module
4615 dnl ========================================================
4619 dnl build the GIO extension by default only when the
4620 dnl GTK2 toolkit is in use.
4621 if test "$MOZ_ENABLE_GTK"
4627 dnl ========================================================
4628 dnl = GnomeVFS support module
4629 dnl ========================================================
4630 MOZ_ARG_ENABLE_BOOL(gnomevfs,
4631 [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
4632 MOZ_ENABLE_GNOMEVFS=force,
4633 MOZ_ENABLE_GNOMEVFS=)
4635 if test "$MOZ_ENABLE_GNOMEVFS"
4637 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4638 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4639 MOZ_ENABLE_GNOMEVFS=1
4640 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4642 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4644 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4646 MOZ_ENABLE_GNOMEVFS=
4650 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4652 dnl ========================================================
4653 dnl = GIO support module
4654 dnl ========================================================
4655 MOZ_ARG_DISABLE_BOOL(gio,
4656 [ --disable-gio Disable GIO support],
4658 MOZ_ENABLE_GIO=force)
4660 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
4662 if test "$MOZ_ENABLE_GTK2"
4664 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4665 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4667 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4668 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4670 AC_DEFINE(MOZ_ENABLE_GIO)
4672 if test "$MOZ_ENABLE_GIO" = "force"
4674 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4680 AC_SUBST(MOZ_ENABLE_GIO)
4682 dnl ========================================================
4683 dnl = GConf support module
4684 dnl ========================================================
4685 MOZ_ARG_DISABLE_BOOL(gconf,
4686 [ --disable-gconf Disable Gconf support ],
4688 MOZ_ENABLE_GCONF=force)
4690 if test "$MOZ_ENABLE_GCONF"
4692 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4693 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4696 if test "$MOZ_ENABLE_GCONF" = "force"
4698 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4704 if test "$MOZ_ENABLE_GCONF"; then
4705 AC_DEFINE(MOZ_ENABLE_GCONF)
4708 AC_SUBST(MOZ_ENABLE_GCONF)
4711 dnl ========================================================
4712 dnl = libproxy support
4713 dnl ========================================================
4715 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4717 MOZ_ENABLE_LIBPROXY=
4719 MOZ_ARG_ENABLE_BOOL(libproxy,
4720 [ --enable-libproxy Enable libproxy support ],
4721 MOZ_ENABLE_LIBPROXY=1,
4722 MOZ_ENABLE_LIBPROXY=)
4724 if test "$MOZ_ENABLE_LIBPROXY"
4726 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4727 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4730 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4732 dnl ========================================================
4733 dnl = GNOME component (mozgnome)
4734 dnl ========================================================
4736 if test "$MOZ_ENABLE_GTK"
4738 MOZ_ENABLE_GNOME_COMPONENT=1
4740 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4742 dnl ========================================================
4743 dnl = libgnomeui support module
4744 dnl ========================================================
4746 if test "$MOZ_ENABLE_GTK"
4748 MOZ_ARG_ENABLE_BOOL(gnomeui,
4749 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
4750 MOZ_ENABLE_GNOMEUI=force,
4751 MOZ_ENABLE_GNOMEUI=)
4753 if test "$MOZ_ENABLE_GNOMEUI"
4755 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4757 MOZ_ENABLE_GNOMEUI=1
4759 if test "$MOZ_ENABLE_GNOMEUI" = "force"
4761 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4767 if test "$MOZ_ENABLE_GNOMEUI"; then
4768 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4772 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4774 dnl ========================================================
4776 dnl ========================================================
4778 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4782 MOZ_ARG_DISABLE_BOOL(dbus,
4783 [ --disable-dbus Disable dbus support ],
4787 if test "$MOZ_ENABLE_DBUS"
4789 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
4790 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
4791 AC_DEFINE(MOZ_ENABLE_DBUS)
4794 AC_SUBST(MOZ_ENABLE_DBUS)
4796 dnl ========================================================
4797 dnl = Enable Android History instead of Places
4798 dnl ========================================================
4799 if test -n "$MOZ_ANDROID_HISTORY"; then
4800 if test -z "$MOZ_PLACES"; then
4801 AC_DEFINE(MOZ_ANDROID_HISTORY)
4803 AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
4807 dnl ========================================================
4808 dnl = Enable the C++ async pan/zoom code instead of the Java version
4809 dnl ========================================================
4810 MOZ_ARG_ENABLE_BOOL(android-apz,
4811 [ --enable-android-apz Switch to C++ pan/zoom code],
4814 if test -n "$MOZ_ANDROID_APZ"; then
4815 dnl Do this if defined in confvars.sh
4816 AC_DEFINE(MOZ_ANDROID_APZ)
4819 dnl ========================================================
4820 dnl = Disable WebSMS backend
4821 dnl ========================================================
4822 MOZ_ARG_DISABLE_BOOL(websms-backend,
4823 [ --disable-websms-backend
4824 Disable WebSMS backend],
4825 MOZ_WEBSMS_BACKEND=,
4826 MOZ_WEBSMS_BACKEND=1)
4828 if test -n "$MOZ_WEBSMS_BACKEND"; then
4829 AC_DEFINE(MOZ_WEBSMS_BACKEND)
4832 dnl ========================================================
4833 dnl = Enable runtime locale switching on Android
4834 dnl ========================================================
4835 if test -n "$MOZ_LOCALE_SWITCHER"; then
4836 AC_DEFINE(MOZ_LOCALE_SWITCHER)
4839 dnl ========================================================
4840 dnl = Enable NFC permission on Android
4841 dnl ========================================================
4842 if test -n "$MOZ_ANDROID_BEAM"; then
4843 AC_DEFINE(MOZ_ANDROID_BEAM)
4846 dnl ========================================================
4847 dnl = Include Search Activity on Android
4848 dnl ========================================================
4849 if test -n "$MOZ_ANDROID_SEARCH_ACTIVITY"; then
4850 AC_DEFINE(MOZ_ANDROID_SEARCH_ACTIVITY)
4853 dnl ========================================================
4854 dnl = Include Mozilla Location Service Stumbler on Android
4855 dnl ========================================================
4856 if test -n "$MOZ_ANDROID_MLS_STUMBLER"; then
4857 AC_DEFINE(MOZ_ANDROID_MLS_STUMBLER)
4860 dnl ========================================================
4861 dnl = Include share overlay on Android
4862 dnl ========================================================
4863 if test -n "$MOZ_ANDROID_SHARE_OVERLAY"; then
4864 AC_DEFINE(MOZ_ANDROID_SHARE_OVERLAY)
4867 dnl ========================================================
4868 dnl = Enable IPDL's "expensive" unit tests
4869 dnl ========================================================
4872 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
4873 [ --enable-ipdl-tests Enable expensive IPDL tests],
4877 if test -n "$MOZ_IPDL_TESTS"; then
4878 AC_DEFINE(MOZ_IPDL_TESTS)
4881 AC_SUBST(MOZ_IPDL_TESTS)
4883 dnl ========================================================
4884 dnl = Disable building dbm
4885 dnl ========================================================
4886 MOZ_ARG_DISABLE_BOOL(dbm,
4887 [ --disable-dbm Disable building dbm],
4891 dnl ========================================================
4892 dnl accessibility support on by default on all platforms
4893 dnl ========================================================
4894 MOZ_ARG_DISABLE_BOOL(accessibility,
4895 [ --disable-accessibility Disable accessibility support],
4898 if test "$ACCESSIBILITY"; then
4901 if test -z "$MIDL"; then
4902 if test "$GCC" != "yes"; then
4903 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
4905 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.])
4909 AC_DEFINE(ACCESSIBILITY)
4912 dnl ========================================================
4913 dnl Accessibility is required for the linuxgl widget
4915 dnl ========================================================
4916 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
4917 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
4920 dnl Turn off webrtc for OS's we don't handle yet, but allow
4921 dnl --enable-webrtc to override. Can disable for everything in
4922 dnl the master list above.
4923 if test -n "$MOZ_WEBRTC"; then
4925 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
4929 dnl default to disabled for all others
4935 AC_TRY_COMPILE([#include <linux/ethtool.h>],
4936 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
4937 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
4939 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
4941 # target_arch is from {ia32|x64|arm|ppc}
4943 x86_64 | arm | x86 | ppc* | ia64)
4947 # unsupported arch for webrtc
4953 dnl ========================================================
4954 dnl = Disable WebRTC code
4955 dnl ========================================================
4956 MOZ_ARG_DISABLE_BOOL(webrtc,
4957 [ --disable-webrtc Disable support for WebRTC],
4961 if test -n "$MOZ_WEBRTC"; then
4962 AC_DEFINE(MOZ_WEBRTC)
4963 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
4964 dnl opt/production builds (via MOZ_CRASH())
4965 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
4968 MOZ_VPX_ERROR_CONCEALMENT=1
4970 dnl enable once Signaling lands
4971 MOZ_WEBRTC_SIGNALING=1
4972 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
4973 dnl enable once PeerConnection lands
4974 MOZ_PEERCONNECTION=1
4975 AC_DEFINE(MOZ_PEERCONNECTION)
4980 if test -n "$MOZ_X11"; then
4981 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
4987 dnl ========================================================
4988 dnl = Force hardware AEC, disable webrtc.org AEC
4989 dnl ========================================================
4990 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
4991 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
4992 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
4993 MOZ_WEBRTC_HARDWARE_AEC_NS=)
4995 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
4996 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
4999 AC_SUBST(MOZ_WEBRTC)
5000 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5001 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5002 AC_SUBST(MOZ_PEERCONNECTION)
5003 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5004 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
5007 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
5009 dnl Use integers over floats for audio on B2G and Android
5010 dnl (regarless of the CPU architecture, because audio
5011 dnl backends for those platforms don't support floats. We also
5012 dnl use integers on ARM with other OS, because it's more efficient.
5013 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
5014 MOZ_SAMPLE_TYPE_S16=1
5015 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5016 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5018 MOZ_SAMPLE_TYPE_FLOAT32=1
5019 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5020 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5023 dnl ========================================================
5024 dnl = Disable Speech API code
5025 dnl ========================================================
5026 MOZ_ARG_DISABLE_BOOL(webspeech,
5027 [ --disable-webspeech Disable support for HTML Speech API],
5031 if test -n "$MOZ_WEBSPEECH"; then
5032 AC_DEFINE(MOZ_WEBSPEECH)
5035 AC_SUBST(MOZ_WEBSPEECH)
5037 dnl ========================================================
5038 dnl = Enable Raw Codecs
5039 dnl ========================================================
5040 MOZ_ARG_ENABLE_BOOL(raw,
5041 [ --enable-raw Enable support for RAW media],
5045 if test -n "$MOZ_RAW"; then
5051 dnl Checks for __attribute__(aligned()) directive need by libogg
5052 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5053 [ac_cv_c_attribute_aligned],
5054 [ac_cv_c_attribute_aligned=0
5055 CFLAGS_save="${CFLAGS}"
5056 CFLAGS="${CFLAGS} -Werror"
5057 for ac_cv_c_attr_align_try in 64 32 16 8; do
5058 echo "trying $ac_cv_c_attr_align_try"
5060 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5061 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5062 if test "$ac_cv_c_attribute_aligned" != 0; then
5066 CFLAGS="${CFLAGS_save}"])
5067 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5068 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5069 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5072 dnl ========================================================
5073 dnl = Disable Opus audio codec support
5074 dnl ========================================================
5075 MOZ_ARG_DISABLE_BOOL(opus,
5076 [ --disable-opus Disable support for Opus audio],
5080 dnl ========================================================
5081 dnl = Disable VP8 decoder support
5082 dnl ========================================================
5083 MOZ_ARG_DISABLE_BOOL(webm,
5084 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5088 if test -n "$MOZ_WEBM"; then
5093 dnl ========================================================
5094 dnl = Apple platform decoder support
5095 dnl ========================================================
5096 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5100 if test -n "$MOZ_APPLEMEDIA"; then
5101 AC_DEFINE(MOZ_APPLEMEDIA)
5102 # hack in frameworks for fmp4 - see bug 1029974
5103 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
5104 LDFLAGS="$LDFLAGS -framework AudioToolbox"
5105 dnl Verify CoreMedia is available.
5106 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
5107 [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
5110 dnl ========================================================
5111 dnl = DirectShow support
5112 dnl ========================================================
5113 if test "$OS_ARCH" = "WINNT"; then
5114 dnl Enable DirectShow support by default.
5118 MOZ_ARG_DISABLE_BOOL(directshow,
5119 [ --disable-directshow Disable support for DirectShow],
5123 if test -n "$MOZ_DIRECTSHOW"; then
5124 AC_DEFINE(MOZ_DIRECTSHOW)
5127 dnl ========================================================
5128 dnl = Windows Media Foundation support
5129 dnl ========================================================
5130 if test "$OS_ARCH" = "WINNT"; then
5131 dnl Enable Windows Media Foundation support by default.
5132 dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5133 dnl guaranteed to have a recent-enough SDK to build WMF.
5137 MOZ_ARG_DISABLE_BOOL(wmf,
5138 [ --disable-wmf Disable support for Windows Media Foundation],
5142 if test -n "$MOZ_WMF"; then
5146 dnl ========================================================
5147 dnl FFmpeg H264/AAC Decoding Support
5148 dnl ========================================================
5149 case "$OS_TARGET" in
5150 WINNT|Darwin|Android)
5157 MOZ_ARG_DISABLE_BOOL(ffmpeg,
5158 [ --disable-ffmpeg Disable FFmpeg for fragmented H264/AAC decoding],
5163 if test -n "$MOZ_FFMPEG"; then
5164 AC_DEFINE(MOZ_FFMPEG)
5167 dnl ========================================================
5168 dnl = Built-in fragmented MP4 support.
5169 dnl ========================================================
5170 if test -n "$MOZ_WMF" -o -n "$MOZ_FFMPEG" -o -n "$MOZ_APPLEMEDIA"; then
5171 dnl Enable fragmented MP4 parser on platforms with decoder support.
5175 MOZ_ARG_DISABLE_BOOL(fmp4,
5176 [ --disable-fmp4 Disable support for in built Fragmented MP4 parsing],
5180 if test -n "$MOZ_FMP4"; then
5184 dnl ========================================================
5186 dnl ========================================================
5188 MOZ_ARG_DISABLE_BOOL(eme,
5189 [ --disable-eme Disable support for Encrypted Media Extensions],
5193 if test -n "$MOZ_EME"; then
5197 dnl ========================================================
5198 dnl = Enable media plugin support
5199 dnl ========================================================
5200 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5201 dnl Enable support on android by default
5205 MOZ_ARG_ENABLE_BOOL(android-omx,
5206 [ --enable-android-omx Enable support for Android OMX media backend],
5210 if test -n "$MOZ_ANDROID_OMX"; then
5211 AC_DEFINE(MOZ_ANDROID_OMX)
5214 dnl ========================================================
5215 dnl = Enable getUserMedia support
5216 dnl ========================================================
5217 MOZ_ARG_ENABLE_BOOL(media-navigator,
5218 [ --enable-media-navigator Enable support for getUserMedia],
5219 MOZ_MEDIA_NAVIGATOR=1,
5220 MOZ_MEDIA_NAVIGATOR=)
5222 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5223 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5226 dnl ========================================================
5227 dnl = Enable building OMX media plugin (B2G or Android)
5228 dnl ========================================================
5229 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5230 dnl Enable support on android by default
5234 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5235 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5239 if test -n "$MOZ_OMX_PLUGIN"; then
5240 if test "$OS_TARGET" = "Android"; then
5241 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5242 AC_DEFINE(MOZ_OMX_PLUGIN)
5244 dnl fail if we're not building on Gonk or Android
5245 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5249 dnl system libvpx Support
5250 dnl ========================================================
5251 MOZ_ARG_WITH_BOOL(system-libvpx,
5252 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5253 MOZ_NATIVE_LIBVPX=1)
5258 if test -n "$MOZ_VPX"; then
5260 if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
5261 AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
5264 _SAVE_CFLAGS=$CFLAGS
5266 if test -n "$MOZ_NATIVE_LIBVPX"; then
5267 dnl ============================
5268 dnl === libvpx Version check ===
5269 dnl ============================
5270 dnl Check to see if we have a system libvpx package.
5271 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.3.0)
5273 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
5274 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
5276 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5277 [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.])])
5279 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5280 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5282 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
5283 [AC_CHECK_FUNC(vpx_mem_set_functions)])
5284 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
5285 "$ac_cv_func_vpx_mem_set_functions" = no; then
5286 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
5289 CFLAGS=$_SAVE_CFLAGS
5293 AC_SUBST(MOZ_NATIVE_LIBVPX)
5294 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
5295 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
5297 if test "$MOZ_WEBM"; then
5298 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5305 if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then
5307 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5308 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5309 dnl We currently require gcc on all arm platforms.
5312 VPX_NEED_OBJ_INT_EXTRACT=
5314 dnl See if we have assembly on this platform.
5315 case "$OS_ARCH:$CPU_ARCH" in
5317 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5321 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5325 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5329 dnl Check for yasm 1.1 or greater.
5330 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5331 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.])
5332 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5333 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.])
5335 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5337 dnl The encoder needs obj_int_extract to get asm offsets.
5341 if test -n "$GNU_AS" ; then
5343 dnl These flags are a lie; they're just used to enable the requisite
5344 dnl opcodes; actual arch detection is done at runtime.
5345 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5346 VPX_DASH_C_FLAG="-c"
5347 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5348 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5353 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5354 VPX_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC"
5359 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5360 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5366 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5367 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.])
5370 if test -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5371 dnl We prefer to get asm offsets using inline assembler, which the above
5372 dnl compilers can do. When we're not using one of those, we have to fall
5373 dnl back to obj_int_extract, which reads them from a compiled object
5374 dnl file. Unfortunately, that only works if we're compiling on a system
5375 dnl with the header files for the appropriate object file format.
5376 VPX_NEED_OBJ_INT_EXTRACT=1
5379 if test -n "$VPX_X86_ASM"; then
5380 AC_DEFINE(VPX_X86_ASM)
5381 elif test -n "$VPX_ARM_ASM"; then
5382 AC_DEFINE(VPX_ARM_ASM)
5384 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5388 dnl ========================================================
5389 dnl = Disable Wave decoder support
5390 dnl ========================================================
5391 MOZ_ARG_DISABLE_BOOL(wave,
5392 [ --disable-wave Disable Wave decoder support],
5396 if test -n "$MOZ_WAVE"; then
5400 dnl ========================================================
5401 dnl = Handle dependent MEDIA defines
5402 dnl ========================================================
5404 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5405 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/])
5408 if test -n "$MOZ_WEBRTC" -a -z "$MOZ_OPUS"; then
5409 AC_MSG_ERROR([MOZ_WEBRTC requires MOZ_OPUS which is disabled.])
5412 if test -n "$MOZ_VORBIS"; then
5413 AC_DEFINE(MOZ_VORBIS)
5416 if test -n "$MOZ_TREMOR"; then
5417 AC_DEFINE(MOZ_TREMOR)
5418 # Tremor doesn't have an encoder.
5422 if test -n "$MOZ_OPUS"; then
5426 if test -n "$MOZ_WEBM_ENCODER"; then
5427 AC_DEFINE(MOZ_WEBM_ENCODER)
5429 AC_SUBST(MOZ_WEBM_ENCODER)
5431 dnl ==================================
5432 dnl = Check alsa availability on Linux
5433 dnl ==================================
5435 dnl If using Linux, ensure that the alsa library is available
5436 if test "$OS_TARGET" = "Linux"; then
5440 MOZ_ARG_ENABLE_BOOL(alsa,
5441 [ --enable-alsa Enable Alsa support (default on Linux)],
5445 if test -n "$MOZ_ALSA"; then
5446 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5447 [echo "$MOZ_ALSA_PKG_ERRORS"
5448 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.)])])
5453 dnl ========================================================
5454 dnl = Disable PulseAudio
5455 dnl ========================================================
5457 dnl If using Linux, ensure that the PA library is available
5458 case "$OS_TARGET" in
5459 WINNT|Darwin|Android|OpenBSD)
5462 if test -z "$MOZ_B2G"; then
5468 MOZ_ARG_DISABLE_BOOL(pulseaudio,
5469 [ --disable-pulseaudio Disable PulseAudio support],
5473 if test -n "$MOZ_PULSEAUDIO"; then
5474 if test -z "$gonkdir"; then
5475 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5476 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5477 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
5479 MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
5483 AC_SUBST(MOZ_PULSEAUDIO)
5485 dnl ========================================================
5486 dnl = Enable GStreamer
5487 dnl ========================================================
5488 case "$OS_TARGET" in
5489 WINNT|Darwin|Android)
5493 GST_API_VERSION=0.10
5497 MOZ_ARG_ENABLE_STRING(gstreamer,
5498 [ --enable-gstreamer[=0.10] Enable GStreamer support],
5500 # API version, eg 0.10, 1.0 etc
5501 if test -z "$enableval" -o "$enableval" = "yes"; then
5502 GST_API_VERSION=0.10
5503 elif test "$enableval" = "no"; then
5506 GST_API_VERSION=$enableval
5510 if test -n "$MOZ_GSTREAMER"; then
5511 # core/base release number
5512 if test "$GST_API_VERSION" = "1.0"; then
5518 PKG_CHECK_MODULES(GSTREAMER,
5519 gstreamer-$GST_API_VERSION >= $GST_VERSION
5520 gstreamer-app-$GST_API_VERSION
5521 gstreamer-plugins-base-$GST_API_VERSION,
5522 [_HAVE_GSTREAMER=1],
5524 if test -z "$_HAVE_GSTREAMER"; then
5525 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])
5528 _SAVE_LDFLAGS=$LDFLAGS
5529 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5530 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5531 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5532 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5534 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.])
5536 LDFLAGS=$_SAVE_LDFLAGS
5539 AC_SUBST(MOZ_GSTREAMER)
5540 AC_SUBST(GST_API_VERSION)
5542 if test -n "$MOZ_GSTREAMER"; then
5543 AC_DEFINE(MOZ_GSTREAMER)
5544 AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION")
5548 dnl ========================================================
5549 dnl Permissions System
5550 dnl ========================================================
5551 MOZ_ARG_DISABLE_BOOL(permissions,
5552 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5557 dnl ========================================================
5558 dnl Child permissions, currently only used for b2g
5559 dnl ========================================================
5560 if test -n "$MOZ_B2G"; then
5561 if test -n "$MOZ_PERMISSIONS"; then
5562 MOZ_CHILD_PERMISSIONS=1
5564 AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
5567 AC_SUBST(MOZ_CHILD_PERMISSIONS)
5569 dnl ========================================================
5571 dnl ========================================================
5572 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5573 [ --disable-negotiateauth Disable GSS-API negotiation ],
5574 MOZ_AUTH_EXTENSION=,
5575 MOZ_AUTH_EXTENSION=1 )
5577 dnl ========================================================
5578 dnl Pref extensions (autoconfig)
5579 dnl ========================================================
5580 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5581 [ --disable-pref-extensions
5582 Disable pref extensions such as autoconfig],
5583 MOZ_PREF_EXTENSIONS=,
5584 MOZ_PREF_EXTENSIONS=1 )
5586 dnl ========================================================
5587 dnl Searching of system directories for extensions.
5588 dnl Note: this switch is meant to be used for test builds
5589 dnl whose behavior should not depend on what happens to be
5590 dnl installed on the local machine.
5591 dnl ========================================================
5592 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5593 [ --disable-system-extension-dirs
5594 Disable searching system- and account-global
5595 directories for extensions of any kind; use
5596 only profile-specific extension directories],
5597 ENABLE_SYSTEM_EXTENSION_DIRS=,
5598 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5599 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5600 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5603 dnl ========================================================
5604 dnl = Universalchardet
5605 dnl ========================================================
5606 MOZ_ARG_DISABLE_BOOL(universalchardet,
5607 [ --disable-universalchardet
5608 Disable universal encoding detection],
5609 MOZ_UNIVERSALCHARDET=,
5610 MOZ_UNIVERSALCHARDET=1 )
5612 if test -n "${JAVA_BIN_PATH}"; then
5613 dnl Look for javac and jar in the specified path.
5614 JAVA_PATH="$JAVA_BIN_PATH"
5616 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5617 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5620 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5621 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5622 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5623 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5624 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5625 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5627 if test -n "${JAVA_BIN_PATH}" -o \
5628 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5629 if test -z "$JAVA" -o "$JAVA" = ":"; then
5630 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}])
5632 if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5633 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}])
5635 if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5636 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}])
5638 if test -z "$JAR" -o "$JAR" = ":"; then
5639 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}])
5641 if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5642 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}])
5644 if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5645 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}])
5648 AC_MSG_CHECKING([for minimum required javac version = 1.7])
5650 dnl Javac spits out something like `javac 1.7.0`. This line cuts off the 'javac'
5651 _javac_version=$($JAVAC -version 2>&1 | cut -d ' ' -f 2)
5653 dnl Here, we extract the major (1) and minor (7) version numbers from the
5654 dnl acquired version string.
5655 _javac_major_version=$(echo $_javac_version | cut -d '.' -f 1)
5656 _javac_minor_version=$(echo $_javac_version | cut -d '.' -f 2)
5658 AC_MSG_RESULT([$_javac_version])
5660 dnl Fail if we have a version other than 1.7.X
5661 if test "$_javac_major_version" -ne "1" -o \
5662 \( "$_javac_minor_version" -ne "7" \); then
5663 AC_MSG_ERROR([javac 1.7 is required.])
5667 dnl ========================================================
5668 dnl = ANGLE OpenGL->D3D translator for WebGL
5669 dnl = * only applies to win32
5670 dnl ========================================================
5674 MOZ_HAS_WINSDK_WITH_D3D=
5675 MOZ_D3DCOMPILER_VISTA_DLL=
5676 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5677 MOZ_DIRECTX_SDK_PATH=
5678 MOZ_D3DCOMPILER_XP_DLL=
5679 MOZ_D3DCOMPILER_XP_CAB=
5681 case "$target_os" in
5683 MOZ_ANGLE_RENDERER=1
5687 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5688 case "${target_cpu}" in
5690 MOZ_D3D_CPU_SUFFIX=x86
5693 MOZ_D3D_CPU_SUFFIX=x64
5697 MOZ_ARG_ENABLE_BOOL(require-all-d3dc-versions,
5698 [ --enable-require-all-d3dc-versions Require all versions of the D3D compiler needed for supported Windows systems.],
5699 MOZ_REQUIRE_ALL_D3DCS=1,
5700 MOZ_REQUIRE_ALL_D3DCS=)
5702 # This is potentially set in external mozconfig files; if it's set,
5703 # then the build exposes the "webgl" context name, which is reserved
5704 # for conformant implementations.
5705 if test -n "$MOZ_WEBGL_CONFORMANT"; then
5706 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
5709 dnl ========================================================
5710 dnl D3D compiler DLL
5711 dnl ========================================================
5712 MOZ_FOUND_D3D_COMPILERS=
5714 if test -n "$MOZ_ANGLE_RENDERER"; then
5715 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
5716 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
5719 ######################################
5720 # Find _46+ for use by Vista+.
5722 # Find a D3D compiler DLL in a Windows SDK.
5723 MOZ_D3DCOMPILER_VISTA_DLL=
5724 case "$MOZ_WINSDK_MAXVER" in
5726 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
5727 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
5730 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_46.dll
5731 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.0.])
5735 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5736 # We have a name, now track down the path.
5737 if test -n "$WINDOWSSDKDIR"; then
5738 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
5739 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5740 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5741 MOZ_HAS_WINSDK_WITH_D3D=1
5743 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5744 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
5745 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5748 AC_MSG_RESULT([Windows SDK not found.])
5752 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5753 MOZ_D3DCOMPILER_VISTA_DLL=
5756 # On mingw, check if headers are provided by toolchain.
5757 if test -n "$GNU_CC"; then
5758 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
5761 ######################################
5762 # Find _43 for use by XP.
5764 # Get the SDK path from the registry.
5765 # First try to get the June 2010 SDK
5766 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5767 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5768 # Otherwise just take whatever comes first
5769 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5771 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'`
5773 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5774 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/dxguid.lib ; then
5775 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5777 AC_MSG_RESULT([DirectX SDK not found.])
5778 MOZ_DIRECTX_SDK_PATH=
5781 # Check that our DirectX SDK is acceptable.
5782 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5783 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5784 AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
5785 MOZ_DIRECTX_SDK_PATH=
5789 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5790 # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
5791 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5792 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'`
5794 if test -n "$MOZ_D3DX9_VERSION" ; then
5795 MOZ_D3DCOMPILER_XP_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_D3D_CPU_SUFFIX}.cab | head -n1`
5797 if test -n "$MOZ_D3DCOMPILER_XP_CAB"; then
5798 MOZ_D3DCOMPILER_XP_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5800 AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
5801 AC_MSG_ERROR([DirectX SDK at "$MOZ_DIRECTX_SDK_PATH" appears broken.])
5802 MOZ_DIRECTX_SDK_PATH=
5805 AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
5806 MOZ_DIRECTX_SDK_PATH=
5809 AC_MSG_RESULT([Couldn't find an acceptable DirectX SDK for ANGLE, needed for d3dcompiler_43.])
5810 AC_MSG_RESULT([ Either ignore, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5813 ######################################
5814 # Check that we found what we needed.
5815 MOZ_FOUND_A_D3D_COMPILER=
5816 MOZ_FOUND_BOTH_D3D_COMPILERS=1
5818 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5819 MOZ_FOUND_A_D3D_COMPILER=1
5820 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
5822 MOZ_FOUND_BOTH_D3D_COMPILERS=
5825 if test -n "$MOZ_D3DCOMPILER_XP_DLL"; then
5826 MOZ_FOUND_A_D3D_COMPILER=1
5827 AC_MSG_RESULT([Found d3dcompiler DLL for XP: $MOZ_D3DCOMPILER_XP_DLL])
5829 MOZ_FOUND_BOTH_D3D_COMPILERS=
5832 if test -z "$CROSS_COMPILE"; then
5833 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
5834 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
5835 AC_MSG_ERROR([ Either install Windows SDK 8.0+, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5838 if test -n "$MOZ_REQUIRE_ALL_D3DCS" -a -z "$MOZ_FOUND_BOTH_D3D_COMPILERS"; then
5839 AC_MSG_ERROR([Both D3D compilers _43 and _46+ are required by --enable-require-d3d-compilers.])
5840 AC_MSG_ERROR([ Install Windows SDK 8.0+, as well as DirectX SDK (June 2010 version or newer), or reconfigure without this flag.])
5846 dnl ========================================================
5848 dnl ========================================================
5850 MOZ_GAMEPAD_BACKEND=stub
5852 # Gamepad DOM is built on supported platforms by default.
5853 case "$OS_TARGET" in
5858 if test "$MOZ_WIDGET_TOOLKIT" != "gonk"; then
5866 MOZ_ARG_DISABLE_BOOL(gamepad,
5867 [ --disable-gamepad Disable gamepad support],
5871 if test "$MOZ_GAMEPAD"; then
5872 case "$OS_TARGET" in
5874 MOZ_GAMEPAD_BACKEND=cocoa
5877 case "$MOZ_WINSDK_MAXVER" in
5878 # We support building with the Windows 7 SDK otherwise, but
5879 # Gamepad support requires the Windows 8 SDK for some HID headers.
5881 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.])
5886 MOZ_GAMEPAD_BACKEND=windows
5889 MOZ_CHECK_HEADER([linux/joystick.h])
5890 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5891 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.])
5893 MOZ_GAMEPAD_BACKEND=linux
5896 MOZ_GAMEPAD_BACKEND=android
5902 AC_DEFINE(MOZ_GAMEPAD)
5904 AC_SUBST(MOZ_GAMEPAD)
5905 AC_SUBST(MOZ_GAMEPAD_BACKEND)
5907 dnl ========================================================
5908 dnl = Breakpad crash reporting (on by default on supported platforms)
5909 dnl ========================================================
5912 i?86-*-mingw*|x86_64-*-mingw*)
5915 i?86-apple-darwin*|x86_64-apple-darwin*)
5918 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5919 if test "$MOZ_ENABLE_GTK"; then
5923 *-android*|*-linuxandroid*)
5931 MOZ_ARG_DISABLE_BOOL(crashreporter,
5932 [ --disable-crashreporter Disable breakpad crash reporting],
5933 [MOZ_CRASHREPORTER=],
5934 [MOZ_CRASHREPORTER=F # Force enable breakpad])
5936 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
5937 if test "$MOZ_CRASHREPORTER" = F; then
5938 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
5943 if test -n "$MOZ_CRASHREPORTER"; then
5944 AC_DEFINE(MOZ_CRASHREPORTER)
5946 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5947 test -z "$SKIP_LIBRARY_CHECKS"; then
5948 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5951 if test "$OS_ARCH" = "WINNT"; then
5952 if test -z "$HAVE_64BIT_BUILD"; then
5953 MOZ_CRASHREPORTER_INJECTOR=1
5954 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5959 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5960 [ --with-crashreporter-enable-percent=NN
5961 Enable sending crash reports by default on NN% of users. (default=100)],
5962 [ val=`echo $withval | sed 's/[^0-9]//g'`
5963 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5965 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5966 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5968 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5970 dnl ========================================================
5971 dnl = libjpeg-turbo configuration
5972 dnl ========================================================
5974 if test -z "$MOZ_NATIVE_JPEG"; then
5978 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5979 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
5981 MOZ_LIBJPEG_TURBO=1)
5983 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
5984 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
5987 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
5990 if test -n "$MOZ_LIBJPEG_TURBO"; then
5992 dnl Do we support libjpeg-turbo on this platform?
5993 case "$OS_ARCH:$OS_TEST" in
5995 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
5996 LIBJPEG_TURBO_X86_ASM=1
5999 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6000 LIBJPEG_TURBO_X64_ASM=1
6002 WINNT:x86|WINNT:i?86)
6003 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6004 LIBJPEG_TURBO_X86_ASM=1
6007 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6008 LIBJPEG_TURBO_X64_ASM=1
6011 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6012 LIBJPEG_TURBO_ARM_ASM=1
6015 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6016 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6017 LIBJPEG_TURBO_X86_ASM=1
6021 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6022 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6023 LIBJPEG_TURBO_X64_ASM=1
6030 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6031 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6032 dnl it doesn't exist or we have too old of a version.
6033 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6034 LIBJPEG_TURBO_AS=$YASM
6036 if test -z "$LIBJPEG_TURBO_AS" ; then
6037 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.])
6040 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6041 dnl on Linux and 1.1 or newer everywhere else.
6042 if test "$OS_ARCH" = "Linux" ; then
6043 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
6044 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.])
6047 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6048 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.])
6053 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6054 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6055 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6056 echo "Using $AS as the assembler for ARM code."
6057 LIBJPEG_TURBO_AS=$AS
6060 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6061 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6062 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6063 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6064 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6065 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6066 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6067 dnl Warn if we're not building the optimized routines, even though the user
6068 dnl didn't specify --disable-libjpeg-turbo.
6069 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6072 dnl ========================================================
6073 dnl = Enable compilation of specific extension modules
6074 dnl ========================================================
6076 MOZ_ARG_ENABLE_STRING(extensions,
6077 [ --enable-extensions Enable extensions],
6078 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6079 if test "$option" = "yes" -o "$option" = "all"; then
6080 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6081 elif test "$option" = "no" -o "$option" = "none"; then
6083 elif test "$option" = "default"; then
6084 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6085 elif test `echo "$option" | grep -c \^-` != 0; then
6086 option=`echo $option | sed 's/^-//'`
6087 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6089 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6092 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6094 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6095 # Suppress warning on non-X11 platforms
6096 if test -n "$MOZ_X11"; then
6097 AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6099 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6102 dnl Do not build gnomevfs with libxul based apps
6103 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6104 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6107 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6108 # Suppress warning on non-X11 platforms
6109 if test -n "$MOZ_X11"; then
6110 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6112 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6115 dnl Do not build gio with libxul based apps
6116 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6117 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6120 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6122 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6124 AC_SUBST(MOZ_GIO_COMPONENT)
6127 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6129 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6130 dnl when trying to build a nonexistent extension.
6131 for extension in $MOZ_EXTENSIONS; do
6132 if test ! -d "${srcdir}/extensions/${extension}"; then
6133 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6137 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6138 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6141 dnl ========================================================
6142 dnl Build Freetype in the tree
6143 dnl ========================================================
6144 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6145 [ --enable-tree-freetype Enable Tree FreeType],
6146 MOZ_TREE_FREETYPE=1,
6147 MOZ_TREE_FREETYPE= )
6148 if test -n "$MOZ_TREE_FREETYPE"; then
6149 if test -n "$_WIN32_MSVC"; then
6150 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6152 AC_DEFINE(MOZ_TREE_FREETYPE)
6153 AC_SUBST(MOZ_TREE_FREETYPE)
6154 MOZ_ENABLE_CAIRO_FT=1
6155 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6156 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6157 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6159 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6160 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6161 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6162 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
6165 dnl ========================================================
6167 dnl ========================================================
6168 dnl Abort Windows build if the required major version and
6169 dnl minimum minor version of Unicode NSIS isn't in the path
6170 dnl (unless in case of cross compiling, for which Unicode
6171 dnl is not yet sufficient).
6172 if test "$OS_ARCH" = "WINNT"; then
6173 MIN_NSIS_MAJOR_VER=2
6174 MIN_NSIS_MINOR_VER=46
6175 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-3.0a2.exe makensisu-2.46.exe makensis)
6176 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6177 AC_MSG_RESULT([yes])
6178 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null`
6180 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6182 if test "$MAKENSISU_PARSED_VER" = ""; then
6184 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
6187 MAKENSISU_MAJOR_VER=0
6188 MAKENSISU_MINOR_VER=0
6189 if test ! "$MAKENSISU_PARSED_VER" = ""; then
6190 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'`
6191 MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'`
6193 AC_MSG_CHECKING([for Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater])
6194 if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \
6195 "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER ||
6196 test "$MAKENSISU_MAJOR_VER" -gt $MIN_NSIS_MAJOR_VER; then
6197 AC_MSG_RESULT([yes])
6200 if test -z "$CROSS_COMPILE"; then
6201 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.])
6206 elif test -z "$CROSS_COMPILE"; then
6207 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.])
6213 dnl ========================================================
6215 dnl ========================================================
6216 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6217 [ --disable-webapp-runtime Disable Web App Runtime],
6218 MOZ_WEBAPP_RUNTIME=,
6219 MOZ_WEBAPP_RUNTIME=1)
6220 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a -z "$MOZ_WIDGET_GTK" ; then
6223 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6226 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6227 if test "$MOZ_WEBAPP_RUNTIME"; then
6228 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6231 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6232 if test -z "$TAR"; then
6233 AC_MSG_ERROR([no tar archiver found in \$PATH])
6237 AC_CHECK_PROGS(WGET, wget, "")
6240 dnl ========================================================
6242 dnl ========================================================
6244 if test -n "$MOZ_SIGN_CMD"; then
6245 AC_DEFINE(MOZ_SIGNING)
6248 dnl ========================================================
6249 dnl Maintenance Service
6250 dnl ========================================================
6252 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6253 [ --enable-maintenance-service Enable building of maintenanceservice],
6254 MOZ_MAINTENANCE_SERVICE=1,
6255 MOZ_MAINTENANCE_SERVICE= )
6257 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6258 if test "$OS_ARCH" = "WINNT"; then
6259 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6261 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6265 dnl ========================================================
6266 dnl Bundled fonts on desktop platforms
6267 dnl ========================================================
6269 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
6270 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
6271 MOZ_BUNDLED_FONTS=1,
6274 if test -n "$MOZ_BUNDLED_FONTS"; then
6275 AC_DEFINE(MOZ_BUNDLED_FONTS)
6278 dnl ========================================================
6279 dnl Verify MAR signatures
6280 dnl ========================================================
6282 MOZ_ARG_ENABLE_BOOL(verify-mar,
6283 [ --enable-verify-mar Enable verifying MAR signatures],
6284 MOZ_VERIFY_MAR_SIGNATURE=1,
6285 MOZ_VERIFY_MAR_SIGNATURE= )
6287 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6288 if test "$OS_ARCH" = "WINNT"; then
6289 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6291 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6295 dnl ========================================================
6296 dnl Enable building the signmar program.
6297 dnl This option is much different than the --enable-verify-mar option.
6298 dnl --enable-verify-mar is for enabling the verification check on MAR
6299 dnl files in the updater. The --enable-signmar option is for building
6300 dnl the signmar program.
6301 dnl ========================================================
6303 MOZ_ARG_ENABLE_BOOL(signmar,
6304 [ --enable-signmar Enable building the signmar program],
6305 MOZ_ENABLE_SIGNMAR=1,
6306 MOZ_ENABLE_SIGNMAR= )
6308 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6309 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6312 dnl ========================================================
6314 dnl ========================================================
6316 MOZ_ARG_DISABLE_BOOL(updater,
6317 [ --disable-updater Disable building of updater],
6321 if test -n "$MOZ_UPDATER"; then
6322 AC_DEFINE(MOZ_UPDATER)
6325 # tools/update-packaging is not checked out by default.
6326 MOZ_ARG_ENABLE_BOOL(update-packaging,
6327 [ --enable-update-packaging
6328 Enable tools/update-packaging],
6329 MOZ_UPDATE_PACKAGING=1,
6330 MOZ_UPDATE_PACKAGING= )
6331 AC_SUBST(MOZ_UPDATE_PACKAGING)
6333 dnl ========================================================
6334 dnl build the tests by default
6335 dnl ========================================================
6336 MOZ_ARG_DISABLE_BOOL(tests,
6337 [ --disable-tests Do not build test libraries & programs],
6341 if test -n "$ENABLE_TESTS"; then
6343 AC_DEFINE(ENABLE_TESTS)
6344 AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6345 AC_SUBST(GTEST_HAS_RTTI)
6346 if test -n "$_WIN32_MSVC"; then
6347 AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6349 if test "${OS_TARGET}" = "Android"; then
6350 AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6351 AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6352 AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6353 AC_SUBST(GTEST_OS_LINUX_ANDROID)
6354 AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6355 AC_SUBST(GTEST_HAS_CLONE)
6359 dnl ========================================================
6360 dnl parental controls (for Windows Vista)
6361 dnl ========================================================
6362 MOZ_ARG_DISABLE_BOOL(parental-controls,
6363 [ --disable-parental-controls
6364 Do not build parental controls],
6365 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6366 MOZ_DISABLE_PARENTAL_CONTROLS=)
6367 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6368 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6371 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6373 dnl ========================================================
6374 dnl = Disable smartcard support
6375 dnl ========================================================
6376 if test -n "$MOZ_NO_SMART_CARDS"; then
6377 AC_DEFINE(MOZ_NO_SMART_CARDS)
6379 AC_SUBST(MOZ_NO_SMART_CARDS)
6381 dnl ========================================================
6382 dnl = Disable EV certificate verification
6383 dnl ========================================================
6384 if test -n "$MOZ_NO_EV_CERTS"; then
6385 AC_DEFINE(MOZ_NO_EV_CERTS)
6387 AC_SUBST(MOZ_NO_EV_CERTS)
6389 dnl ========================================================
6390 dnl = Disable libpkix
6391 dnl ========================================================
6392 if test -n "$NSS_NO_LIBPKIX"; then
6393 AC_DEFINE(NSS_NO_LIBPKIX)
6395 AC_SUBST(NSS_NO_LIBPKIX)
6397 dnl ========================================================
6398 dnl = Sandboxing support
6399 dnl ========================================================
6400 MOZ_ARG_DISABLE_BOOL(sandbox,
6401 [ --disable-sandbox Disable sandboxing support],
6405 dnl ========================================================
6406 dnl = Content process sandboxing
6407 dnl ========================================================
6408 if test -n "$gonkdir"; then
6409 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6412 MOZ_ARG_ENABLE_BOOL(content-sandbox,
6413 [ --enable-content-sandbox Enable sandboxing support for content-processes],
6414 MOZ_CONTENT_SANDBOX=1,
6415 MOZ_CONTENT_SANDBOX=)
6417 if test -n "$MOZ_CONTENT_SANDBOX"; then
6418 AC_DEFINE(MOZ_CONTENT_SANDBOX)
6421 AC_SUBST(MOZ_CONTENT_SANDBOX)
6423 dnl ========================================================
6424 dnl = Gecko Media Plugin sandboxing
6425 dnl ========================================================
6428 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6433 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6438 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6442 if test -n "$MOZ_GMP_SANDBOX"; then
6443 AC_DEFINE(MOZ_GMP_SANDBOX)
6446 AC_SUBST(MOZ_GMP_SANDBOX)
6448 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
6452 if test -n "$MOZ_SANDBOX"; then
6453 AC_DEFINE(MOZ_SANDBOX)
6456 AC_SUBST(MOZ_SANDBOX)
6459 dnl ========================================================
6461 dnl = Module specific options
6463 dnl ========================================================
6464 MOZ_ARG_HEADER(Individual module options)
6466 dnl ========================================================
6467 dnl = Disable feed handling components
6468 dnl ========================================================
6469 MOZ_ARG_DISABLE_BOOL(feeds,
6470 [ --disable-feeds Disable feed handling and processing components],
6473 if test -n "$MOZ_FEEDS"; then
6474 AC_DEFINE(MOZ_FEEDS)
6476 if test "$MOZ_BUILD_APP" = "browser"; then
6477 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6481 dnl ========================================================
6482 dnl Check for sqlite
6483 dnl ========================================================
6486 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6487 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6488 MOZ_NATIVE_SQLITE=1,
6489 MOZ_NATIVE_SQLITE= )
6491 if test -n "$MOZ_NATIVE_SQLITE"
6493 dnl ============================
6494 dnl === SQLite Version check ===
6495 dnl ============================
6496 dnl Check to see if the system SQLite package is new enough.
6497 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6499 dnl ==================================
6500 dnl === SQLITE_SECURE_DELETE check ===
6501 dnl ==================================
6502 dnl Check to see if the system SQLite package is compiled with
6503 dnl SQLITE_SECURE_DELETE enabled.
6504 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6505 _SAVE_CFLAGS="$CFLAGS"
6506 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6508 LIBS="$LIBS $SQLITE_LIBS"
6509 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6511 #include "sqlite3.h"
6513 int main(int argc, char **argv){
6514 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6516 ac_cv_sqlite_secure_delete=yes,
6517 ac_cv_sqlite_secure_delete=no,
6518 ac_cv_sqlite_secure_delete=no
6521 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6522 CFLAGS="$_SAVE_CFLAGS"
6524 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6525 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6528 dnl ===============================
6529 dnl === SQLITE_THREADSAFE check ===
6530 dnl ===============================
6531 dnl Check to see if the system SQLite package is compiled with
6532 dnl SQLITE_THREADSAFE enabled.
6533 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6534 _SAVE_CFLAGS="$CFLAGS"
6535 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6537 LIBS="$LIBS $SQLITE_LIBS"
6538 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6540 #include "sqlite3.h"
6542 int main(int argc, char **argv){
6543 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6545 ac_cv_sqlite_threadsafe=yes,
6546 ac_cv_sqlite_threadsafe=no,
6547 ac_cv_sqlite_threadsafe=no
6550 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6551 CFLAGS="$_SAVE_CFLAGS"
6553 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6554 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6557 dnl ================================
6558 dnl === SQLITE_ENABLE_FTS3 check ===
6559 dnl ================================
6560 dnl check to see if the system SQLite package is compiled with
6561 dnl SQLITE_ENABLE_FTS3 enabled.
6562 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6563 _SAVE_CFLAGS="$CFLAGS"
6564 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6566 LIBS="$LIBS $SQLITE_LIBS"
6567 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6569 #include "sqlite3.h"
6571 int main(int argc, char **argv){
6572 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6574 ac_cv_sqlite_enable_fts3=yes,
6575 ac_cv_sqlite_enable_fts3=no,
6576 ac_cv_sqlite_enable_fts3=no
6579 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6580 CFLAGS="$_SAVE_CFLAGS"
6582 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6583 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6586 dnl =========================================
6587 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6588 dnl =========================================
6589 dnl check to see if the system SQLite package is compiled with
6590 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6591 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6592 _SAVE_CFLAGS="$CFLAGS"
6593 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6595 LIBS="$LIBS $SQLITE_LIBS"
6596 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6598 #include "sqlite3.h"
6600 int main(int argc, char **argv){
6601 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6603 ac_cv_sqlite_enable_unlock_notify=yes,
6604 ac_cv_sqlite_enable_unlock_notify=no,
6605 ac_cv_sqlite_enable_unlock_notify=no
6608 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6609 CFLAGS="$_SAVE_CFLAGS"
6611 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6612 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6616 if test -n "$MOZ_NATIVE_SQLITE"; then
6617 AC_DEFINE(MOZ_NATIVE_SQLITE)
6619 AC_SUBST(MOZ_NATIVE_SQLITE)
6621 dnl ========================================================
6622 dnl = Enable help viewer (off by default)
6623 dnl ========================================================
6624 if test -n "$MOZ_HELP_VIEWER"; then
6625 dnl Do this if defined in confvars.sh
6626 AC_DEFINE(MOZ_HELP_VIEWER)
6629 dnl ========================================================
6630 dnl = Enable safe browsing (anti-phishing)
6631 dnl ========================================================
6632 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6633 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6634 MOZ_SAFE_BROWSING=1,
6635 MOZ_SAFE_BROWSING= )
6636 if test -n "$MOZ_SAFE_BROWSING"; then
6637 AC_DEFINE(MOZ_SAFE_BROWSING)
6639 AC_SUBST(MOZ_SAFE_BROWSING)
6641 dnl ========================================================
6642 dnl = Enable url-classifier
6643 dnl ========================================================
6644 dnl Implicitly enabled by default if building with safe-browsing
6645 if test -n "$MOZ_SAFE_BROWSING"; then
6646 MOZ_URL_CLASSIFIER=1
6648 MOZ_ARG_ENABLE_BOOL(url-classifier,
6649 [ --enable-url-classifier Enable url classifier module],
6650 MOZ_URL_CLASSIFIER=1,
6651 MOZ_URL_CLASSIFIER= )
6652 if test -n "$MOZ_URL_CLASSIFIER"; then
6653 AC_DEFINE(MOZ_URL_CLASSIFIER)
6655 AC_SUBST(MOZ_URL_CLASSIFIER)
6657 dnl ========================================================
6658 dnl = Disable zipwriter
6659 dnl ========================================================
6660 MOZ_ARG_DISABLE_BOOL(zipwriter,
6661 [ --disable-zipwriter Disable zipwriter component],
6664 AC_SUBST(MOZ_ZIPWRITER)
6666 dnl ========================================================
6668 dnl ========================================================
6670 MOZ_ARG_WITH_STRING(gl-provider,
6671 [ --with-gl-provider=ID
6672 Set GL provider backend type],
6673 [ val=`echo $withval`
6674 MOZ_GL_PROVIDER="$val"])
6676 if test -n "$MOZ_GL_PROVIDER"; then
6677 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6678 AC_SUBST(MOZ_GL_PROVIDER)
6679 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6681 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6682 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6684 dnl ========================================================
6685 dnl = faststripe theme
6686 dnl ========================================================
6687 MOZ_ARG_ENABLE_BOOL(faststripe,
6688 [ --enable-faststripe Use faststripe theme],
6689 MOZ_THEME_FASTSTRIPE=1,
6690 MOZ_THEME_FASTSTRIPE= )
6691 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6693 dnl ========================================================
6695 dnl = Feature options that require extra sources to be pulled
6697 dnl ========================================================
6698 dnl MOZ_ARG_HEADER(Features that require extra sources)
6700 dnl ========================================================
6702 dnl = Runtime debugging and Optimization Options
6704 dnl ========================================================
6705 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
6707 dnl ========================================================
6708 dnl enable mobile optimizations
6709 dnl ========================================================
6710 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6711 [ --enable-mobile-optimize
6712 Enable mobile optimizations],
6713 MOZ_GFX_OPTIMIZE_MOBILE=1)
6715 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6717 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6718 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6721 dnl ========================================================
6722 dnl = Enable code optimization. ON by default.
6723 dnl ========================================================
6724 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6725 MOZ_OPTIMIZE_FLAGS="-O"
6728 MOZ_ARG_ENABLE_STRING(optimize,
6729 [ --disable-optimize Disable compiler optimization
6730 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6731 [ if test "$enableval" != "no"; then
6733 if test -n "$enableval" -a "$enableval" != "yes"; then
6734 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6739 fi ], MOZ_OPTIMIZE=1)
6741 MOZ_SET_FRAMEPTR_FLAGS
6743 if test "$COMPILE_ENVIRONMENT"; then
6744 if test -n "$MOZ_OPTIMIZE"; then
6745 AC_MSG_CHECKING([for valid optimization flags])
6746 _SAVE_CFLAGS=$CFLAGS
6747 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6748 AC_TRY_COMPILE([#include <stdio.h>],
6749 [printf("Hello World\n");],
6752 AC_MSG_RESULT([$_results])
6753 if test "$_results" = "no"; then
6754 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6756 CFLAGS=$_SAVE_CFLAGS
6758 fi # COMPILE_ENVIRONMENT
6760 AC_SUBST(MOZ_OPTIMIZE)
6761 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6762 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6763 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6764 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6765 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6767 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6769 dnl ========================================================
6770 dnl = Enable any treating of compile warnings as errors
6771 dnl ========================================================
6772 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6773 [ --enable-warnings-as-errors
6774 Enable treating of warnings as errors],
6775 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6776 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6777 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6778 WARNINGS_AS_ERRORS=''
6779 elif test "$GNU_CC"; then
6780 # Prevent the following GCC warnings from being treated as errors:
6781 # -Wuninitialized - too many false positives
6782 # -Wmaybe-uninitialized - too many false positives
6783 # -Wdeprecated-declarations - we don't want our builds held hostage when a
6784 # platform-specific API becomes deprecated.
6785 MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
6786 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
6787 MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
6788 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
6789 MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
6790 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
6792 if test -n "$MOZ_PGO"; then
6793 MOZ_C_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_c_has_noerror_coverage_mismatch)
6794 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_cxx_has_noerror_coverage_mismatch)
6798 dnl ========================================================
6799 dnl = Disable runtime logging checks
6800 dnl ========================================================
6801 MOZ_ARG_DISABLE_BOOL(logging,
6802 [ --disable-logging Disable logging facilities],
6803 NS_DISABLE_LOGGING=1,
6804 NS_DISABLE_LOGGING= )
6805 if test "$NS_DISABLE_LOGGING"; then
6806 AC_DEFINE(NS_DISABLE_LOGGING)
6808 AC_DEFINE(MOZ_LOGGING)
6811 dnl ========================================================
6812 dnl = This will enable logging of addref, release, ctor, dtor.
6813 dnl ========================================================
6814 _ENABLE_LOGREFCNT=42
6815 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6816 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6817 _ENABLE_LOGREFCNT=1,
6818 _ENABLE_LOGREFCNT= )
6819 if test "$_ENABLE_LOGREFCNT" = "1"; then
6820 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6821 elif test -z "$_ENABLE_LOGREFCNT"; then
6822 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6825 dnl ========================================================
6826 dnl moz_dump_painting
6827 dnl ========================================================
6828 MOZ_ARG_ENABLE_BOOL(dump-painting,
6829 [ --enable-dump-painting Enable paint debugging.],
6830 MOZ_DUMP_PAINTING=1,
6831 MOZ_DUMP_PAINTING= )
6832 if test -n "$MOZ_DUMP_PAINTING"; then
6833 AC_DEFINE(MOZ_DUMP_PAINTING)
6834 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6836 if test -n "$MOZ_DEBUG"; then
6837 AC_DEFINE(MOZ_DUMP_PAINTING)
6840 dnl ========================================================
6841 dnl = Enable trace malloc
6842 dnl ========================================================
6843 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6844 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6845 [ --enable-trace-malloc Enable malloc tracing; also disables DMD and jemalloc],
6848 if test "$NS_TRACE_MALLOC"; then
6849 # Please, Mr. Linker Man, don't take away our symbol names
6850 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6851 AC_DEFINE(NS_TRACE_MALLOC)
6853 AC_SUBST(NS_TRACE_MALLOC)
6855 dnl ========================================================
6857 dnl ========================================================
6859 MOZ_ARG_ENABLE_BOOL(dmd,
6860 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
6864 dnl The two options are conflicting. Fails the configure to alert the user.
6865 if test "$NS_TRACE_MALLOC" -a "$MOZ_DMD"; then
6866 AC_MSG_ERROR([--enable-trace-malloc and --enable-dmd are conflicting options])
6869 if test "$MOZ_DMD"; then
6872 if test "${CPU_ARCH}" = "arm"; then
6873 CFLAGS="$CFLAGS -funwind-tables"
6874 CXXFLAGS="$CXXFLAGS -funwind-tables"
6877 MOZ_MEMORY=1 # DMD enables jemalloc
6878 MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
6882 dnl ========================================================
6883 dnl = Enable jemalloc
6884 dnl ========================================================
6885 MOZ_ARG_ENABLE_BOOL(jemalloc,
6886 [ --enable-jemalloc Replace memory allocator with jemalloc],
6890 if test "$NS_TRACE_MALLOC"; then
6894 if test "${OS_TARGET}" = "Android"; then
6895 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6897 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin"; then
6898 dnl On Windows and OSX, we want to link all our binaries against mozglue
6899 if test -z "$GNU_CC"; then
6900 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6902 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6905 dnl On other Unix systems, we only want to link executables against mozglue
6906 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6907 dnl On other Unix systems, where mozglue is a static library, jemalloc is
6908 dnl separated for the SDK, so we need to add it here.
6909 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6910 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6912 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6913 if test -n "$GNU_CC"; then
6914 dnl And we need mozglue symbols to be exported.
6915 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6917 if test "$MOZ_LINKER" = 1; then
6918 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
6922 dnl ========================================================
6923 dnl = Enable dynamic replacement of malloc implementation
6924 dnl ========================================================
6925 if test -n "$NIGHTLY_BUILD" -a -n "$MOZ_MEMORY"; then
6926 # Enable on central for the debugging opportunities it adds.
6927 MOZ_REPLACE_MALLOC=1
6929 MOZ_ARG_ENABLE_BOOL(replace-malloc,
6930 [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
6931 MOZ_REPLACE_MALLOC=1,
6932 MOZ_REPLACE_MALLOC= )
6934 dnl The two options are conflicting. Fails the configure to alert the user.
6935 if test "$NS_TRACE_MALLOC" -a "$MOZ_REPLACE_MALLOC"; then
6936 AC_MSG_ERROR([--enable-trace-malloc and --enable-replace-malloc are conflicting options])
6939 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
6940 dnl We don't want to enable jemalloc unconditionally because it may be a
6941 dnl deliberate choice not to enable it (bug 702250, for instance)
6942 AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
6943 elif test -n "$MOZ_REPLACE_MALLOC"; then
6944 MOZ_NATIVE_JEMALLOC=
6946 dnl Replace-malloc Mac linkage quirks
6947 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
6948 AC_CACHE_CHECK([how to do weak dynamic linking],
6949 ac_cv_weak_dynamic_linking,
6950 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
6951 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
6952 test -s conftest${DLL_SUFFIX}; then
6953 dnl There are several ways the linker can put link edit rules in a binary:
6954 dnl - classic info only (for OSX < 10.6)
6955 dnl - dyld info only
6957 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
6962 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
6967 dnl With classic info, we need to build with -flat_namespace.
6968 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
6969 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
6970 dnl forgets to set the weak flag in the dyld info.
6971 dnl See http://glandium.org/blog/?p=2764 for more details.
6973 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
6974 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
6975 dnl - "flat namespace" when -flat_namespace alone is needed
6976 dnl - "dummy library" when a dummy library and -flat_namespace are needed
6977 dnl - "compiler support" when nothing is needed
6978 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
6979 if test -n "$_CLASSIC_INFO"; then
6980 ac_cv_weak_dynamic_linking="flat namespace"
6982 ac_cv_weak_dynamic_linking="compiler support"
6985 if test -n "$_DYLD_INFO"; then
6986 ac_cv_weak_dynamic_linking="dummy library"
6988 ac_cv_weak_dynamic_linking="flat namespace"
6992 AC_ERROR([couldn't compile a simple C file])
6995 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
6998 AC_SUBST(MOZ_REPLACE_MALLOC)
6999 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
7001 dnl ========================================================
7002 dnl = Jemalloc build setup
7003 dnl ========================================================
7004 if test -z "$MOZ_MEMORY"; then
7005 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
7006 MOZ_NATIVE_JEMALLOC=1
7007 AC_CHECK_FUNCS(mallctl nallocm,,
7008 [MOZ_NATIVE_JEMALLOC=
7010 if test -n "$MOZ_NATIVE_JEMALLOC"; then
7012 AC_DEFINE(MOZ_MEMORY)
7013 AC_DEFINE(MOZ_JEMALLOC3)
7014 AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7019 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7020 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.])
7025 AC_DEFINE(MOZ_MEMORY)
7026 if test -n "$MOZ_JEMALLOC3"; then
7027 AC_DEFINE(MOZ_JEMALLOC3)
7029 if test "x$MOZ_DEBUG" = "x1"; then
7030 AC_DEFINE(MOZ_MEMORY_DEBUG)
7032 dnl The generic feature tests that determine how to compute ncpus are long and
7033 dnl complicated. Therefore, simply define special cpp variables for the
7034 dnl platforms we have special knowledge of.
7037 AC_DEFINE(MOZ_MEMORY_DARWIN)
7040 AC_DEFINE(MOZ_MEMORY_BSD)
7042 *-android*|*-linuxandroid*)
7043 AC_DEFINE(MOZ_MEMORY_LINUX)
7044 AC_DEFINE(MOZ_MEMORY_ANDROID)
7045 if test -z "$gonkdir"; then
7048 AC_DEFINE(MOZ_MEMORY_GONK)
7053 AC_DEFINE(MOZ_MEMORY_LINUX)
7056 AC_DEFINE(MOZ_MEMORY_BSD)
7059 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7062 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7063 export MOZ_NO_DEBUG_RTL=1
7064 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7065 dnl Look for a broken crtdll.obj
7066 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7067 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7068 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7069 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcprt -DEFAULTLIB:mozcrt'
7070 dnl Also pass this to NSPR/NSS
7071 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7073 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7080 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7084 AC_SUBST(MOZ_MEMORY)
7085 AC_SUBST(MOZ_JEMALLOC3)
7086 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7087 AC_SUBST(MOZ_GLUE_LDFLAGS)
7088 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7089 AC_SUBST_LIST(WIN32_CRT_LIBS)
7090 dnl Need to set this for make because NSS doesn't have configure
7093 dnl We need to wrap dlopen and related functions on Android because we use
7095 if test "$OS_TARGET" = Android; then
7096 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7097 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7098 if test "$MOZ_WIDGET_TOOLKIT" = android; then
7099 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7101 if test -z "$gonkdir"; then
7102 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7103 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"
7105 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
7106 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"
7110 dnl ========================================================
7111 dnl = Use malloc wrapper lib
7112 dnl ========================================================
7113 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7114 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7118 if test -n "$_WRAP_MALLOC"; then
7119 if test -n "$GNU_CC"; then
7120 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7121 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7122 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7123 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=vasprintf,--wrap=asprintf"
7124 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7125 dnl Wrap operator new and operator delete on Android.
7126 if test "$OS_TARGET" = "Android"; then
7127 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7128 dnl Wrap the nothrow variants too.
7129 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7132 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7136 dnl ========================================================
7137 dnl = Location of malloc wrapper lib
7138 dnl ========================================================
7139 MOZ_ARG_WITH_STRING(wrap-malloc,
7140 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7141 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7143 dnl ========================================================
7144 dnl = Use JS Call tracing
7145 dnl ========================================================
7146 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7147 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7148 MOZ_TRACE_JSCALLS=1,
7149 MOZ_TRACE_JSCALLS= )
7150 if test -n "$MOZ_TRACE_JSCALLS"; then
7151 AC_DEFINE(MOZ_TRACE_JSCALLS)
7154 dnl ========================================================
7155 dnl JS opt-mode assertions and minidump instrumentation
7156 dnl ========================================================
7157 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7158 [ --enable-js-diagnostics
7159 Enable JS diagnostic assertions and breakpad data],
7160 JS_CRASH_DIAGNOSTICS=1,
7161 JS_CRASH_DIAGNOSTICS= )
7162 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7163 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7166 dnl ========================================================
7167 dnl = Use incremental GC
7168 dnl ========================================================
7170 MOZ_ARG_DISABLE_BOOL(gcincremental,
7171 [ --disable-gcincremental Disable incremental GC],
7173 if test -n "$JSGC_INCREMENTAL"; then
7174 AC_DEFINE(JSGC_INCREMENTAL)
7177 dnl ========================================================
7178 dnl = Use exact stack rooting for GC
7179 dnl ========================================================
7180 MOZ_ARG_DISABLE_BOOL(exact-rooting,
7181 [ --disable-exact-rooting Enable use of conservative stack scanning for GC],
7182 JSGC_USE_EXACT_ROOTING= ,
7183 JSGC_USE_EXACT_ROOTING=1 )
7184 if test -n "$JSGC_USE_EXACT_ROOTING"; then
7185 AC_DEFINE(JSGC_USE_EXACT_ROOTING)
7188 dnl ========================================================
7189 dnl = Use generational GC
7190 dnl ========================================================
7191 MOZ_ARG_DISABLE_BOOL(gcgenerational,
7192 [ --disable-gcgenerational Disable generational GC],
7193 JSGC_GENERATIONAL= ,
7194 JSGC_GENERATIONAL=1 )
7195 if test -n "$JSGC_GENERATIONAL"; then
7196 AC_DEFINE(JSGC_GENERATIONAL)
7199 dnl ========================================================
7200 dnl = Use compacting GC
7201 dnl ========================================================
7202 MOZ_ARG_ENABLE_BOOL(gccompacting,
7203 [ --enable-gccompacting Compact the JS heap by moving GC things],
7206 if test -n "$JS_GCCOMPACTING"; then
7207 AC_DEFINE(JS_GCCOMPACTING)
7210 dnl ========================================================
7211 dnl = Use a smaller chunk size for GC chunks
7212 dnl ========================================================
7213 MOZ_ARG_ENABLE_BOOL(small-chunk-size,
7214 [ --enable-small-chunk-size Allocate memory for JS GC things in smaller chunks],
7215 JS_GC_SMALL_CHUNK_SIZE=1,
7216 JS_GC_SMALL_CHUNK_SIZE= )
7217 if test -n "$JS_GC_SMALL_CHUNK_SIZE"; then
7218 AC_DEFINE(JS_GC_SMALL_CHUNK_SIZE)
7221 dnl ========================================================
7222 dnl Zealous JavaScript GC
7223 dnl ========================================================
7224 MOZ_ARG_ENABLE_BOOL(gczeal,
7225 [ --enable-gczeal Enable zealous JavaScript GCing],
7228 if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then
7229 AC_DEFINE(JS_GC_ZEAL)
7232 dnl ========================================================
7233 dnl = Perform moving GC stack rooting analysis
7234 dnl ========================================================
7235 MOZ_ARG_ENABLE_BOOL(root-analysis,
7236 [ --enable-root-analysis Enable moving GC stack root analysis],
7237 JSGC_ROOT_ANALYSIS=1,
7238 JSGC_ROOT_ANALYSIS= )
7239 if test -n "$JSGC_ROOT_ANALYSIS"; then
7240 AC_DEFINE(JSGC_ROOT_ANALYSIS)
7245 dnl ========================================================
7246 dnl = Enable static checking using gcc-dehydra
7247 dnl ========================================================
7249 MOZ_ARG_WITH_STRING(static-checking,
7250 [ --with-static-checking=path/to/gcc_dehydra.so
7251 Enable static checking of code using GCC-dehydra],
7252 DEHYDRA_PATH=$withval,
7255 if test -n "$DEHYDRA_PATH"; then
7256 if test ! -f "$DEHYDRA_PATH"; then
7257 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7259 AC_DEFINE(NS_STATIC_CHECKING)
7261 AC_SUBST(DEHYDRA_PATH)
7263 dnl ========================================================
7264 dnl = Enable using the clang plugin to build
7265 dnl ========================================================
7267 MOZ_ARG_ENABLE_BOOL(clang-plugin,
7268 [ --enable-clang-plugin Enable building with the mozilla clang plugin ],
7269 ENABLE_CLANG_PLUGIN=1,
7270 ENABLE_CLANG_PLUGIN= )
7271 if test -n "$ENABLE_CLANG_PLUGIN"; then
7272 if test -z "$CLANG_CC"; then
7273 AC_MSG_ERROR([Can't use clang plugin without clang.])
7275 AC_DEFINE(MOZ_CLANG_PLUGIN)
7278 AC_SUBST(ENABLE_CLANG_PLUGIN)
7280 dnl ========================================================
7281 dnl = Enable stripping of libs & executables
7282 dnl ========================================================
7283 MOZ_ARG_ENABLE_BOOL(strip,
7284 [ --enable-strip Enable stripping of libs & executables ],
7288 dnl ========================================================
7289 dnl = Enable stripping of libs & executables when packaging
7290 dnl ========================================================
7291 MOZ_ARG_ENABLE_BOOL(install-strip,
7292 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7296 dnl ========================================================
7297 dnl = --disable-elf-hack
7298 dnl ========================================================
7301 MOZ_ARG_DISABLE_BOOL(elf-hack,
7302 [ --disable-elf-hack Disable elf hacks],
7304 [USE_ELF_HACK=F # Force enable elf-hack])
7306 # Disable elf hack for profiling because the built in profiler
7307 # doesn't read the segments properly with elf hack. This is
7308 # temporary and should be fixed soon in the profiler.
7309 if test "$MOZ_PROFILING" = 1; then
7310 if test "$USE_ELF_HACK" = F; then
7311 AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
7316 # Only enable elfhack where supported
7317 if test "$USE_ELF_HACK" = 1; then
7318 case "${HOST_OS_ARCH},${OS_ARCH}" in
7320 case "${CPU_ARCH}" in
7335 if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
7336 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7337 dnl memory addresses it maps to. The result is that by the time elfhack
7338 dnl kicks in, it is not possible to apply relocations because of that,
7339 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7340 dnl segment. It makes elfhack mostly useless, so considering the problems
7341 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7342 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7343 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
7344 dnl elfhack enabled, disable PT_GNU_RELRO instead.
7345 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7346 LINK_WITH_PT_GNU_RELRO,
7347 [echo "int main() {return 0;}" > conftest.${ac_ext}
7348 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7349 test -s conftest${ac_exeext}; then
7350 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7351 LINK_WITH_PT_GNU_RELRO=yes
7353 LINK_WITH_PT_GNU_RELRO=no
7356 dnl We really don't expect to get here, but just in case
7357 AC_ERROR([couldn't compile a simple C file])
7360 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7361 if test "$USE_ELF_HACK" = F; then
7362 AC_MSG_CHECKING([for -z norelro option to ld])
7363 _SAVE_LDFLAGS=$LDFLAGS
7364 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
7365 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
7366 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
7367 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.]))
7370 AC_MSG_WARN([Disabling elfhack])
7376 dnl ========================================================
7377 dnl = libstdc++ compatibility hacks
7378 dnl ========================================================
7381 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7382 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7385 if test -n "$STDCXX_COMPAT"; then
7386 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
7387 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7388 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7391 dnl ========================================================
7393 dnl = Profiling and Instrumenting
7395 dnl ========================================================
7396 MOZ_ARG_HEADER(Profiling and Instrumenting)
7398 dnl ========================================================
7399 dnl = Enable runtime visual profiling logger
7400 dnl ========================================================
7401 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7402 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7403 MOZ_VISUAL_EVENT_TRACER=1,
7404 MOZ_VISUAL_EVENT_TRACER=)
7405 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7406 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7409 dnl ========================================================
7410 dnl = Enable TaskTracer
7411 dnl ========================================================
7412 MOZ_ARG_ENABLE_BOOL(tasktracer,
7413 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
7416 if test "$MOZ_WIDGET_TOOLKIT" = "gonk" -a -n "$MOZ_TASK_TRACER"; then
7417 AC_DEFINE(MOZ_TASK_TRACER)
7418 AC_SUBST(MOZ_TASK_TRACER)
7421 dnl ========================================================
7422 dnl Turn on reflow counting
7423 dnl ========================================================
7424 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7425 [ --enable-reflow-perf Enable reflow performance tracing],
7428 if test -n "$MOZ_REFLOW_PERF"; then
7429 AC_DEFINE(MOZ_REFLOW_PERF)
7432 dnl ========================================================
7433 dnl = Offer a way to disable the startup cache
7434 dnl ========================================================
7435 MOZ_DISABLE_STARTUPCACHE=
7437 MOZ_ARG_DISABLE_BOOL(startupcache,
7438 [ --disable-startupcache Disable startup cache ],
7439 MOZ_DISABLE_STARTUPCACHE=1,
7440 MOZ_DISABLE_STARTUPCACHE=)
7442 dnl bug 988880: disable startup cache on b2g
7443 if test -n "$MOZ_B2G"; then
7444 MOZ_DISABLE_STARTUPCACHE=1
7447 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
7449 dnl ========================================================
7450 dnl = Enable Radio Interface for B2G (Gonk usually)
7451 dnl ========================================================
7452 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7453 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7456 MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL )
7457 if test -n "$MOZ_B2G_RIL"; then
7458 if test -n "$_PLATFORM_HAVE_RIL"; then
7459 AC_DEFINE(MOZ_B2G_RIL)
7461 AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.])
7464 AC_SUBST(MOZ_B2G_RIL)
7466 dnl ========================================================
7467 dnl = Enable Radio FM for B2G (Gonk usually)
7468 dnl ========================================================
7469 if test -n "$MOZ_B2G_FM"; then
7470 AC_DEFINE(MOZ_B2G_FM)
7472 AC_SUBST(MOZ_B2G_FM)
7474 dnl ========================================================
7475 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7476 dnl ========================================================
7477 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7478 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7481 if test -n "$MOZ_B2G_BT"; then
7482 AC_DEFINE(MOZ_B2G_BT)
7484 AC_SUBST(MOZ_B2G_BT)
7485 AC_SUBST(MOZ_B2G_BT_BLUEZ)
7486 AC_SUBST(MOZ_B2G_BT_BLUEDROID)
7488 dnl ========================================================
7489 dnl = Enable NFC Interface for B2G (Gonk usually)
7490 dnl ========================================================
7491 MOZ_ARG_ENABLE_BOOL(nfc,
7492 [ --enable-nfc Set compile flags necessary for compiling NFC API ],
7495 if test -n "$MOZ_NFC"; then
7500 dnl ========================================================
7501 dnl = Enable Pico Speech Synthesis (Gonk usually)
7502 dnl ========================================================
7503 MOZ_ARG_ENABLE_BOOL(synth-pico,
7504 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
7507 if test -n "$MOZ_SYNTH_PICO"; then
7508 AC_DEFINE(MOZ_SYNTH_PICO)
7510 AC_SUBST(MOZ_SYNTH_PICO)
7512 dnl ========================================================
7513 dnl = Enable Support for Time Manager API
7514 dnl ========================================================
7515 if test -n "$MOZ_TIME_MANAGER"; then
7516 AC_DEFINE(MOZ_TIME_MANAGER)
7518 AC_SUBST(MOZ_TIME_MANAGER)
7520 dnl ========================================================
7521 dnl = Enable Camera Interface for B2G (Gonk usually)
7522 dnl ========================================================
7523 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7524 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7527 if test -n "$MOZ_B2G_CAMERA"; then
7528 AC_DEFINE(MOZ_B2G_CAMERA)
7530 AC_SUBST(MOZ_B2G_CAMERA)
7532 dnl ========================================================
7533 dnl = Enable Support for Payment API
7534 dnl ========================================================
7535 if test -n "$MOZ_PAY"; then
7540 dnl ========================================================
7541 dnl = Enable Browser Support for Activities
7542 dnl ========================================================
7543 if test -n "$MOZ_ACTIVITIES"; then
7544 AC_DEFINE(MOZ_ACTIVITIES)
7546 AC_SUBST(MOZ_ACTIVITIES)
7548 dnl ========================================================
7549 dnl = Enable Support for AudioChannelManager API
7550 dnl ========================================================
7551 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7552 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7554 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7556 dnl ========================================================
7557 dnl = Support for demangling undefined symbols
7558 dnl ========================================================
7559 if test -z "$SKIP_LIBRARY_CHECKS"; then
7562 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7566 # Demangle only for debug or trace-malloc or DMD builds
7567 MOZ_DEMANGLE_SYMBOLS=
7568 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7569 MOZ_DEMANGLE_SYMBOLS=1
7570 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7572 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7574 dnl ========================================================
7575 dnl = Support for gcc stack unwinding (from gcc 3.3)
7576 dnl ========================================================
7577 if test -z "$SKIP_LIBRARY_CHECKS"; then
7580 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7584 dnl ========================================================
7586 dnl ========================================================
7588 MOZ_ARG_WITH_STRING(jitreport-granularity,
7589 [ --jitreport-granularity=N
7590 Default granularity at which to report JIT code
7593 1 - code ranges for whole functions only
7594 2 - per-line information
7595 3 - per-op information],
7596 JITREPORT_GRANULARITY=$withval,
7597 JITREPORT_GRANULARITY=3)
7599 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7601 dnl ========================================================
7605 dnl ========================================================
7606 MOZ_ARG_HEADER(Misc. Options)
7608 dnl ========================================================
7609 dnl update xterm title
7610 dnl ========================================================
7611 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7612 [ --enable-xterm-updates Update XTERM titles with current command.],
7616 dnl =========================================================
7618 dnl =========================================================
7619 MOZ_ARG_ENABLE_STRING([chrome-format],
7620 [ --enable-chrome-format=jar|flat|omni
7621 Select FORMAT of chrome files during packaging],
7622 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7624 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7625 MOZ_CHROME_FILE_FORMAT=jar
7628 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7629 AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7632 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7633 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7634 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7635 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7638 dnl =========================================================
7639 dnl Omnijar packaging (bug 552121)
7640 dnl =========================================================
7641 dnl Omnijar packaging is compatible with flat packaging.
7642 dnl In unpackaged builds, omnijar looks for files as if
7643 dnl things were flat packaged. After packaging, all files
7644 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7645 dnl is set to flat since putting files into jars is only
7646 dnl done during packaging with omnijar.
7647 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7649 AC_DEFINE(MOZ_OMNIJAR)
7651 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7652 if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7653 MOZ_CHROME_FILE_FORMAT=flat
7655 MOZ_CHROME_FILE_FORMAT=symlink
7658 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7659 dnl Fennec's static resources live in the assets/ folder of the
7660 dnl APK. Adding a path to the name here works because we only
7661 dnl have one omnijar file in the final package (which is not the
7662 dnl case on desktop), and necessitates some contortions during
7663 dnl packaging so that the resources in the omnijar are considered
7664 dnl as rooted at / and not as rooted at assets/ (which again is
7665 dnl not the case on desktop: there are omnijars rooted at webrtc/,
7666 dnl etc). packager.mk handles changing the rooting of the single
7668 OMNIJAR_NAME=assets/omni.ja
7670 OMNIJAR_NAME=omni.ja
7673 AC_SUBST(OMNIJAR_NAME)
7674 AC_SUBST(MOZ_OMNIJAR)
7675 AC_SUBST(MOZ_PACKAGER_FORMAT)
7677 dnl ========================================================
7678 dnl = Define default location for MOZILLA_FIVE_HOME
7679 dnl ========================================================
7680 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7681 [ --with-default-mozilla-five-home
7682 Set the default value for MOZILLA_FIVE_HOME],
7683 [ val=`echo $withval`
7684 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7686 dnl ========================================================
7687 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7688 dnl ========================================================
7689 MOZ_ARG_WITH_STRING(user-appdir,
7690 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7691 [ val=`echo $withval`
7692 if echo "$val" | grep "\/" >/dev/null; then
7693 AC_MSG_ERROR("Homedir must be single relative path.")
7698 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7700 dnl ========================================================
7701 dnl = Doxygen configuration
7702 dnl ========================================================
7703 dnl Use commas to specify multiple dirs to this arg
7704 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7705 MOZ_ARG_WITH_STRING(doc-input-dirs,
7706 [ --with-doc-input-dirs=DIRS
7707 Header/idl dirs to create docs from],
7708 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7709 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7711 dnl Use commas to specify multiple dirs to this arg
7712 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7713 MOZ_ARG_WITH_STRING(doc-include-dirs,
7714 [ --with-doc-include-dirs=DIRS
7715 Include dirs to preprocess doc headers],
7716 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7717 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7719 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7720 MOZ_ARG_WITH_STRING(doc-output-dir,
7721 [ --with-doc-output-dir=DIR
7722 Dir to generate docs into],
7723 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7724 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7726 if test -z "$SKIP_COMPILER_CHECKS"; then
7727 dnl ========================================================
7729 dnl = Compiler Options
7731 dnl ========================================================
7732 MOZ_ARG_HEADER(Compiler Options)
7734 dnl ========================================================
7735 dnl Check for gcc -pipe support
7736 dnl ========================================================
7737 AC_MSG_CHECKING([for -pipe support])
7738 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7739 dnl Any gcc that supports firefox supports -pipe.
7740 CFLAGS="$CFLAGS -pipe"
7741 CXXFLAGS="$CXXFLAGS -pipe"
7742 AC_MSG_RESULT([yes])
7747 dnl ========================================================
7748 dnl Profile guided optimization (gcc checks)
7749 dnl ========================================================
7750 dnl Test for profiling options
7751 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7753 _SAVE_CFLAGS="$CFLAGS"
7754 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7756 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7757 AC_TRY_COMPILE([], [return 0;],
7758 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7759 result="yes" ], result="no")
7760 AC_MSG_RESULT([$result])
7762 if test $result = "yes"; then
7763 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7764 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7765 PROFILE_USE_LDFLAGS="-fprofile-use"
7768 CFLAGS="$_SAVE_CFLAGS"
7770 if test -n "$INTEL_CC"; then
7771 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7772 PROFILE_GEN_LDFLAGS=
7773 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7774 PROFILE_USE_LDFLAGS=
7777 dnl Sun Studio on Solaris
7778 if test "$SOLARIS_SUNPRO_CC"; then
7779 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7780 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7781 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7782 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7785 AC_SUBST(PROFILE_GEN_CFLAGS)
7786 AC_SUBST(PROFILE_GEN_LDFLAGS)
7787 AC_SUBST(PROFILE_USE_CFLAGS)
7788 AC_SUBST(PROFILE_USE_LDFLAGS)
7790 dnl =============================================
7791 dnl Support for -fno-integrated-as (recent clang)
7792 dnl =============================================
7793 dnl Under clang 3.4+, use -fno-integrated-as to
7794 dnl build libvpx's vp8_asm_enc_offsets.c
7796 _SAVE_CFLAGS="$CFLAGS"
7797 CFLAGS="$CFLAGS -fno-integrated-as -S"
7799 AC_MSG_CHECKING([whether C compiler supports -fno-integrated-as])
7800 AC_TRY_COMPILE([], [return 0;],
7801 [ NO_INTEGRATED_AS_CFLAGS="-fno-integrated-as"
7802 result="yes" ], result="no")
7803 AC_MSG_RESULT([$result])
7805 CFLAGS="$_SAVE_CFLAGS"
7807 AC_SUBST(NO_INTEGRATED_AS_CFLAGS)
7809 fi # ! SKIP_COMPILER_CHECKS
7811 AC_DEFINE(CPP_THROW_NEW, [throw()])
7814 if test "$COMPILE_ENVIRONMENT"; then
7816 fi # COMPILE_ENVIRONMENT
7818 dnl ========================================================
7820 dnl = Build depencency options
7822 dnl ========================================================
7823 MOZ_ARG_HEADER(Build dependencies)
7825 if test "$GNU_CC" -a "$GNU_CXX"; then
7826 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7827 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7828 elif test "$SOLARIS_SUNPRO_CC"; then
7831 dnl Don't override this for MSVC
7832 if test -z "$_WIN32_MSVC"; then
7833 _USE_CPP_INCLUDE_FLAG=
7834 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7835 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7837 echo '#include <stdio.h>' > dummy-hello.c
7839 dnl This output is localized, split at the first double space or colon and space.
7840 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
7841 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
7842 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
7844 if ! test -e "$_CL_STDIO_PATH"; then
7845 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
7847 if test -z "$CL_INCLUDES_PREFIX"; then
7848 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7850 AC_SUBST(CL_INCLUDES_PREFIX)
7853 dnl Make sure that the build system can handle non-ASCII characters
7854 dnl in environment variables to prevent it from breaking silently on
7855 dnl non-English systems.
7856 NONASCII=$'\241\241'
7861 dnl ========================================================
7863 dnl = Static Build Options
7865 dnl ========================================================
7866 MOZ_ARG_HEADER(Static build options)
7868 if test "$OS_ARCH" = "WINNT"; then
7869 GKMEDIAS_SHARED_LIBRARY=1
7870 AC_DEFINE(GKMEDIAS_SHARED_LIBRARY)
7872 AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
7874 if test -z "$MOZ_NATIVE_ZLIB"; then
7875 if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
7877 AC_DEFINE(ZLIB_IN_MOZGLUE)
7881 AC_SUBST(ZLIB_IN_MOZGLUE)
7883 dnl ========================================================
7885 dnl = Standalone module options
7887 dnl ========================================================
7888 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7891 dnl ========================================================
7893 if test -z "$SKIP_PATH_CHECKS"; then
7894 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7895 if test "$MOZ_ENABLE_GTK" ; then
7896 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7901 if test -z "${GLIB_GMODULE_LIBS}" \
7902 -a -n "${GLIB_CONFIG}"\
7903 -a "${GLIB_CONFIG}" != no\
7905 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7908 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
7910 dnl ========================================================
7911 dnl Graphics checks.
7912 dnl ========================================================
7914 if test "${OS_TARGET}" = "WINNT"; then
7915 if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then
7916 MOZ_ENABLE_DIRECT2D1_1=1
7917 AC_SUBST(MOZ_ENABLE_DIRECT2D1_1)
7921 if test "${OS_TARGET}" = "WINNT" -o \
7922 "${OS_ARCH}" = "Darwin" -o \
7923 "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
7924 "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
7925 "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
7926 "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
7927 case "${target_cpu}" in
7939 MOZ_ARG_ENABLE_BOOL(skia,
7940 [ --enable-skia Enable use of Skia],
7944 if test "$USE_FC_FREETYPE"; then
7945 if test "$COMPILE_ENVIRONMENT"; then
7946 dnl ========================================================
7947 dnl = Check for freetype2 and its functionality
7948 dnl ========================================================
7949 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7951 if test "$_HAVE_FREETYPE2"; then
7953 _SAVE_CFLAGS="$CFLAGS"
7954 LIBS="$LIBS $FT2_LIBS"
7955 CFLAGS="$CFLAGS $FT2_CFLAGS"
7957 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7958 ac_cv_member_FT_Bitmap_Size_y_ppem,
7959 [AC_TRY_COMPILE([#include <ft2build.h>
7960 #include FT_FREETYPE_H],
7962 if (sizeof s.y_ppem) return 0;
7964 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7965 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7966 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7967 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7969 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7971 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7972 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7973 [FT_Bitmap_Size structure includes y_ppem field])
7975 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
7978 CFLAGS="$_SAVE_CFLAGS"
7981 _SAVE_CPPFLAGS="$CPPFLAGS"
7982 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7983 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7984 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7985 CPPFLAGS="$_SAVE_CPPFLAGS"
7987 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7990 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
7992 if test "$MOZ_PANGO"; then
7993 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
7994 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
7996 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
7997 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
8002 dnl ========================================================
8003 dnl Check for pixman and cairo
8004 dnl ========================================================
8006 if test "$MOZ_WIDGET_TOOLKIT" = "gtk3" ; then
8007 # cairo-gtk3 can be build with system-cairo only
8013 MOZ_ARG_ENABLE_BOOL(system-cairo,
8014 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8019 MOZ_ARG_ENABLE_BOOL(system-pixman,
8020 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8022 MOZ_TREE_PIXMAN=force,
8025 # System cairo depends on system pixman
8026 if test "$MOZ_TREE_PIXMAN" = "force"; then
8027 if test -z "$MOZ_TREE_CAIRO"; then
8028 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
8032 elif test -z "$MOZ_TREE_CAIRO"; then
8036 if test "$MOZ_TREE_PIXMAN"; then
8037 AC_DEFINE(MOZ_TREE_PIXMAN)
8039 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8040 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8041 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8043 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8044 AC_SUBST_LIST(MOZ_PIXMAN_LIBS)
8046 # Check for headers defining standard int types.
8047 if test -n "$COMPILE_ENVIRONMENT"; then
8048 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8050 if test "${ac_cv_header_inttypes_h}" = "yes"; then
8055 AC_SUBST(HAVE_INTTYPES_H)
8057 if test "$MOZ_TREE_CAIRO"; then
8058 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8059 AC_DEFINE(MOZ_TREE_CAIRO)
8061 if test "$OS_ARCH" = "WINNT"; then
8062 # For now we assume that we will have a uint64_t available through
8063 # one of the above headers or mozstdint.h.
8064 AC_DEFINE(HAVE_UINT64_T)
8067 # Define macros for cairo-features.h
8068 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8069 if test "$MOZ_X11"; then
8070 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8071 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8072 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8074 if test "$_HAVE_FREETYPE2"; then
8075 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8076 MOZ_ENABLE_CAIRO_FT=1
8077 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8080 case "$MOZ_WIDGET_TOOLKIT" in
8082 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8085 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8086 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8087 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8090 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8091 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8092 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8093 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8094 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8095 MOZ_ENABLE_D2D_SURFACE=1
8096 MOZ_ENABLE_DWRITE_FONT=1
8098 WIN32_DWRITE_FONT_FEATURE=
8099 WIN32_D2D_SURFACE_FEATURE=
8102 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8104 dnl D3D10 Layers depend on D2D Surfaces.
8105 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8106 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8110 AC_MSG_ERROR([cairo-gtk3 toolkit is incompatible with in-tree cairo. Please add --enable-system-cairo to your build config.])
8113 if test "$USE_FC_FREETYPE"; then
8114 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8116 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8117 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8118 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8119 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8120 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8122 AC_SUBST(PS_SURFACE_FEATURE)
8123 AC_SUBST(PDF_SURFACE_FEATURE)
8124 AC_SUBST(SVG_SURFACE_FEATURE)
8125 AC_SUBST(XLIB_SURFACE_FEATURE)
8126 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8127 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8128 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8129 AC_SUBST(WIN32_SURFACE_FEATURE)
8130 AC_SUBST(OS2_SURFACE_FEATURE)
8131 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8132 AC_SUBST(FT_FONT_FEATURE)
8133 AC_SUBST(FC_FONT_FEATURE)
8134 AC_SUBST(WIN32_FONT_FEATURE)
8135 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8136 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8137 AC_SUBST(QUARTZ_FONT_FEATURE)
8138 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8139 AC_SUBST(QT_SURFACE_FEATURE)
8140 AC_SUBST(TEE_SURFACE_FEATURE)
8142 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8144 if test "$MOZ_X11"; then
8145 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8148 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8150 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8151 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8152 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8153 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8154 if test "$MOZ_X11"; then
8155 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8156 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8157 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8158 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8162 AC_SUBST(MOZ_TREE_CAIRO)
8163 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
8164 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
8165 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
8166 AC_SUBST(MOZ_TREE_PIXMAN)
8168 dnl ========================================================
8170 dnl ========================================================
8171 if test "$MOZ_ENABLE_SKIA"; then
8172 AC_DEFINE(MOZ_ENABLE_SKIA)
8174 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8175 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8178 if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" ; then
8179 MOZ_ENABLE_SKIA_GPU=1
8180 AC_DEFINE(USE_SKIA_GPU)
8181 AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8184 AC_SUBST(MOZ_ENABLE_SKIA)
8186 dnl ========================================================
8188 dnl ========================================================
8189 MOZ_ARG_DISABLE_BOOL(xul,
8190 [ --disable-xul Disable XUL],
8192 if test "$MOZ_XUL"; then
8195 dnl remove extensions that require XUL
8196 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
8201 dnl ========================================================
8202 dnl disable profile locking
8203 dnl do no use this in applications that can have more than
8204 dnl one process accessing the profile directory.
8205 dnl ========================================================
8206 MOZ_ARG_DISABLE_BOOL(profilelocking,
8207 [ --disable-profilelocking
8208 Disable profile locking],
8209 MOZ_PROFILELOCKING=,
8210 MOZ_PROFILELOCKING=1 )
8211 if test "$MOZ_PROFILELOCKING"; then
8212 AC_DEFINE(MOZ_PROFILELOCKING)
8215 dnl ========================================================
8216 dnl necko configuration options
8217 dnl ========================================================
8220 dnl option to disable various necko protocols
8222 MOZ_ARG_ENABLE_STRING(necko-protocols,
8223 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8224 Enable/disable specific protocol handlers],
8225 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8226 if test "$option" = "yes" -o "$option" = "all"; then
8227 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8228 elif test "$option" = "no" -o "$option" = "none"; then
8230 elif test "$option" = "default"; then
8231 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8232 elif test `echo "$option" | grep -c \^-` != 0; then
8233 option=`echo $option | sed 's/^-//'`
8234 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8236 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8239 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8241 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8242 AC_SUBST_SET(NECKO_PROTOCOLS)
8243 for p in $NECKO_PROTOCOLS; do
8244 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8245 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8249 dnl option to disable necko's wifi scanner
8252 case "$OS_TARGET" in
8254 if test -n "$gonkdir"; then
8258 Darwin|FreeBSD|SunOS|WINNT)
8267 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8268 [ --disable-necko-wifi Disable necko wifi scanner],
8272 if test "$NECKO_WIFI"; then
8273 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
8274 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
8276 AC_DEFINE(NECKO_WIFI)
8277 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8279 AC_SUBST(NECKO_WIFI)
8280 AC_SUBST(NECKO_WIFI_DBUS)
8283 dnl option to disable cookies
8285 MOZ_ARG_DISABLE_BOOL(cookies,
8286 [ --disable-cookies Disable cookie support],
8289 AC_SUBST(NECKO_COOKIES)
8290 if test "$NECKO_COOKIES"; then
8291 AC_DEFINE(NECKO_COOKIES)
8292 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8296 dnl Always build Marionette if not Android or B2G
8298 if test "$OS_TARGET" != Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
8299 AC_DEFINE(ENABLE_MARIONETTE)
8301 AC_SUBST(ENABLE_MARIONETTE)
8302 if test "$ENABLE_MARIONETTE"; then
8303 AC_DEFINE(ENABLE_MARIONETTE)
8307 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8309 MOZ_ARG_DISABLE_BOOL(ctypes,
8310 [ --disable-ctypes Disable js-ctypes],
8313 AC_SUBST(BUILD_CTYPES)
8314 if test "$BUILD_CTYPES"; then
8315 AC_DEFINE(BUILD_CTYPES)
8318 dnl Build Places if required
8319 if test "$MOZ_PLACES"; then
8320 AC_DEFINE(MOZ_PLACES)
8323 dnl Build SocialAPI if required
8324 if test "$MOZ_SOCIAL"; then
8325 AC_DEFINE(MOZ_SOCIAL)
8328 dnl Build Common JS modules provided by services.
8329 AC_SUBST(MOZ_SERVICES_COMMON)
8330 if test -n "$MOZ_SERVICES_COMMON"; then
8331 AC_DEFINE(MOZ_SERVICES_COMMON)
8334 dnl Build Services crypto component (used by Sync)
8335 AC_SUBST(MOZ_SERVICES_CRYPTO)
8336 if test -n "$MOZ_SERVICES_CRYPTO"; then
8337 AC_DEFINE(MOZ_SERVICES_CRYPTO)
8340 dnl Build Firefox Health Reporter Service
8341 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8342 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8343 AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8346 dnl Build Services metrics component
8347 AC_SUBST(MOZ_SERVICES_METRICS)
8348 if test -n "$MOZ_SERVICES_METRICS"; then
8349 AC_DEFINE(MOZ_SERVICES_METRICS)
8352 dnl Build Notifications if required
8353 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8354 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8355 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8358 dnl Build Sync Services if required
8359 AC_SUBST(MOZ_SERVICES_SYNC)
8360 if test -n "$MOZ_SERVICES_SYNC"; then
8361 AC_DEFINE(MOZ_SERVICES_SYNC)
8364 dnl Build Captive Portal Detector if required
8365 AC_SUBST(MOZ_CAPTIVEDETECT)
8366 if test -n "$MOZ_CAPTIVEDETECT"; then
8367 AC_DEFINE(MOZ_CAPTIVEDETECT)
8370 dnl Build second screen and casting features for external devices if required
8371 AC_SUBST(MOZ_DEVICES)
8372 if test -n "$MOZ_DEVICES"; then
8373 AC_DEFINE(MOZ_DEVICES)
8376 dnl ========================================================
8377 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8378 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8381 dnl ========================================================
8383 dnl = Maintainer debug option (no --enable equivalent)
8385 dnl ========================================================
8390 AC_SUBST(AR_EXTRACT)
8394 AC_SUBST(AS_DASH_C_FLAG)
8403 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8404 AC_SUBST(MOZ_UPDATE_XTERM)
8405 AC_SUBST(MOZ_AUTH_EXTENSION)
8406 AC_SUBST(MOZ_PERMISSIONS)
8407 AC_SUBST(MOZ_PREF_EXTENSIONS)
8409 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8410 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8411 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8412 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8413 AC_SUBST(WARNINGS_AS_ERRORS)
8414 AC_SUBST(MOZ_EXTENSIONS)
8415 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8418 AC_SUBST(MOZ_INSTRUMENTS)
8419 AC_SUBST(MOZ_CALLGRIND)
8421 AC_SUBST(MOZ_PROFILING)
8423 AC_SUBST(MOZ_PLACES)
8424 AC_SUBST(MOZ_SOCIAL)
8425 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8427 AC_SUBST(NS_PRINTING)
8428 AC_SUBST(MOZ_HELP_VIEWER)
8429 AC_SUBST(TOOLCHAIN_PREFIX)
8438 AC_SUBST(MOZ_PROFILELOCKING)
8440 AC_SUBST(ENABLE_TESTS)
8441 AC_SUBST(MOZ_UNIVERSALCHARDET)
8442 AC_SUBST(ACCESSIBILITY)
8443 AC_SUBST(MOZ_SPELLCHECK)
8444 AC_SUBST(MOZ_ANDROID_APZ)
8445 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8446 AC_SUBST(MOZ_CRASHREPORTER)
8447 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8448 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8449 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8450 AC_SUBST(MOZ_STUB_INSTALLER)
8451 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8452 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8453 AC_SUBST(MOZ_UPDATER)
8455 AC_SUBST(MOZ_ANGLE_RENDERER)
8456 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
8457 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
8458 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
8459 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
8460 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8461 AC_SUBST(MOZ_D3DCOMPILER_XP_DLL)
8462 AC_SUBST(MOZ_D3DCOMPILER_XP_CAB)
8466 AC_SUBST(MOZ_ANDROID_HISTORY)
8467 AC_SUBST(MOZ_WEBSMS_BACKEND)
8468 AC_SUBST(MOZ_ANDROID_BEAM)
8469 AC_SUBST(MOZ_LOCALE_SWITCHER)
8470 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
8471 AC_SUBST(MOZ_ANDROID_SEARCH_ACTIVITY)
8472 AC_SUBST(MOZ_ANDROID_SHARE_OVERLAY)
8473 AC_SUBST(MOZ_ANDROID_MLS_STUMBLER)
8474 AC_SUBST(ENABLE_STRIP)
8475 AC_SUBST(PKG_SKIP_STRIP)
8476 AC_SUBST(STRIP_FLAGS)
8477 AC_SUBST(USE_ELF_HACK)
8478 AC_SUBST(INCREMENTAL_LINKER)
8479 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8480 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8482 AC_SUBST(MOZ_FIX_LINK_PATHS)
8484 AC_SUBST(USE_DEPENDENT_LIBS)
8486 AC_SUBST(MOZ_BUILD_ROOT)
8488 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8489 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8490 AC_SUBST(MOZ_LINKER_EXTRACT)
8492 AC_SUBST(MOZ_JSDOWNLOADS)
8493 if test -n "$MOZ_JSDOWNLOADS"; then
8494 AC_DEFINE(MOZ_JSDOWNLOADS)
8497 dnl ========================================================
8498 dnl = Mac bundle name prefix
8499 dnl ========================================================
8500 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8501 [ --with-macbundlename-prefix=prefix
8502 Prefix for MOZ_MACBUNDLE_NAME],
8503 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8505 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8506 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8507 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8510 if test "$MOZ_DEBUG"; then
8511 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8513 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8515 AC_SUBST(MOZ_MACBUNDLE_NAME)
8517 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8518 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8519 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8520 if test "$MOZ_DEBUG"; then
8521 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8524 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8525 AC_SUBST(MOZ_MACBUNDLE_ID)
8527 dnl ========================================================
8528 dnl = Child Process Name for IPC
8529 dnl ========================================================
8530 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8531 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8533 # We want to let Android unpack the file at install time, but it only does
8534 # so if the file is named libsomething.so. The lib/ path is also required
8535 # because the unpacked file will be under the lib/ subdirectory and will
8536 # need to be executed from that path.
8537 MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8539 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8541 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8542 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8544 # The following variables are available to branding and application
8545 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8546 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8547 # impacts profile location and user-visible fields.
8548 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8549 # versions of a given application (e.g. Aurora and Firefox both use
8550 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8551 # for application.ini's "Name" field, which controls profile location in
8552 # the absence of a "Profile" field (see below), and various system
8553 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8554 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8555 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8556 # builds (e.g. Aurora for Firefox).
8557 # - MOZ_APP_VERSION: Defines the application version number.
8558 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8559 # defaults to a lowercase form of MOZ_APP_BASENAME.
8560 # - MOZ_APP_PROFILE: When set, used for application.ini's
8561 # "Profile" field, which controls profile location.
8562 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8563 # crash reporter server url.
8564 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8566 if test -z "$MOZ_APP_NAME"; then
8567 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8570 # For extensions and langpacks, we require a max version that is compatible
8571 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8572 # 24.0a1 and 24.0a2 aren't affected
8574 # 24.1.1 becomes 24.*
8575 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8576 if test -z "$IS_ALPHA"; then
8578 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
8581 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8584 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8585 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8586 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8588 AC_SUBST(MOZ_APP_NAME)
8589 AC_SUBST(MOZ_APP_DISPLAYNAME)
8590 AC_SUBST(MOZ_APP_BASENAME)
8591 AC_SUBST(MOZ_APP_VENDOR)
8592 AC_SUBST(MOZ_APP_PROFILE)
8593 AC_SUBST(MOZ_APP_ID)
8594 AC_SUBST(MAR_CHANNEL_ID)
8595 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8596 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8597 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8598 AC_SUBST(MOZ_APP_UA_NAME)
8599 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8600 AC_SUBST(MOZ_APP_VERSION)
8601 AC_SUBST(MOZ_APP_MAXVERSION)
8602 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8603 AC_SUBST(FIREFOX_VERSION)
8604 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8605 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8606 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8609 AC_SUBST(MOZ_APP_STATIC_INI)
8611 AC_SUBST(MOZ_PKG_SPECIAL)
8613 AC_SUBST(MOZILLA_OFFICIAL)
8615 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8616 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8618 if test "$MOZ_TELEMETRY_REPORTING"; then
8619 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8621 # Enable Telemetry by default for nightly and aurora channels
8622 if test -z "$RELEASE_BUILD"; then
8623 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8627 dnl If we have any service that uploads data (and requires data submission
8628 dnl policy alert), set MOZ_DATA_REPORTING.
8629 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8630 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8631 MOZ_DATA_REPORTING=1
8632 AC_DEFINE(MOZ_DATA_REPORTING)
8633 AC_SUBST(MOZ_DATA_REPORTING)
8637 AC_SUBST(MOZ_BROWSE_INFO)
8638 AC_SUBST(MOZ_TOOLS_DIR)
8639 AC_SUBST(WIN32_REDIST_DIR)
8642 dnl Echo the CFLAGS to remove extra whitespace.
8648 $_WARNINGS_CXXFLAGS \
8651 COMPILE_CFLAGS=`echo \
8656 COMPILE_CXXFLAGS=`echo \
8657 $_DEFINES_CXXFLAGS \
8665 HOST_CXXFLAGS=`echo \
8669 AC_SUBST(MOZ_NATIVE_JPEG)
8670 AC_SUBST(MOZ_NATIVE_PNG)
8671 AC_SUBST(MOZ_NATIVE_BZ2)
8673 AC_SUBST(MOZ_JPEG_CFLAGS)
8674 AC_SUBST_LIST(MOZ_JPEG_LIBS)
8675 AC_SUBST(MOZ_BZ2_CFLAGS)
8676 AC_SUBST_LIST(MOZ_BZ2_LIBS)
8677 AC_SUBST(MOZ_PNG_CFLAGS)
8678 AC_SUBST_LIST(MOZ_PNG_LIBS)
8680 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
8681 export MOZ_NUWA_PROCESS
8682 AC_DEFINE(MOZ_NUWA_PROCESS)
8684 AC_SUBST(MOZ_NUWA_PROCESS)
8685 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_B2G_LOADER"; then
8686 if test -z "$MOZ_NUWA_PROCESS"; then
8687 AC_MSG_ERROR([B2G loader works with Nuwa]);
8689 export MOZ_B2G_LOADER
8690 AC_DEFINE(MOZ_B2G_LOADER)
8692 AC_SUBST(MOZ_B2G_LOADER)
8694 AC_SUBST(NSPR_CFLAGS)
8695 AC_SUBST(MOZ_NATIVE_NSPR)
8697 AC_SUBST(NSS_CFLAGS)
8698 AC_SUBST(MOZ_NATIVE_NSS)
8699 AC_SUBST(NSS_DISABLE_DBM)
8702 OS_CXXFLAGS="$CXXFLAGS"
8703 OS_CPPFLAGS="$CPPFLAGS"
8704 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8705 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8706 OS_LDFLAGS="$LDFLAGS"
8709 AC_SUBST(OS_CXXFLAGS)
8710 AC_SUBST(OS_CPPFLAGS)
8711 AC_SUBST(OS_COMPILE_CFLAGS)
8712 AC_SUBST(OS_COMPILE_CXXFLAGS)
8713 AC_SUBST(OS_LDFLAGS)
8715 AC_SUBST(CROSS_COMPILE)
8716 AC_SUBST(WCHAR_CFLAGS)
8720 AC_SUBST(HOST_CFLAGS)
8721 AC_SUBST(HOST_CXXFLAGS)
8722 AC_SUBST(HOST_LDFLAGS)
8723 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8725 AC_SUBST(HOST_AR_FLAGS)
8727 AC_SUBST(HOST_RANLIB)
8728 AC_SUBST(HOST_NSPR_MDCPUCFG)
8729 AC_SUBST(HOST_BIN_SUFFIX)
8730 AC_SUBST(HOST_OS_ARCH)
8732 AC_SUBST(TARGET_CPU)
8733 AC_SUBST(TARGET_VENDOR)
8735 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8736 AC_SUBST(TARGET_MD_ARCH)
8737 AC_SUBST(TARGET_XPCOM_ABI)
8740 AC_SUBST(OS_RELEASE)
8743 AC_SUBST(INTEL_ARCHITECTURE)
8744 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
8745 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
8746 AC_SUBST(HAVE_X86_AVX2)
8747 AC_SUBST(GCC_USE_GNU_LD)
8749 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8751 AC_SUBST(WRAP_LDFLAGS)
8754 AC_SUBST(MKSHLIB_FORCE_ALL)
8755 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8756 AC_SUBST(DSO_CFLAGS)
8757 AC_SUBST(DSO_PIC_CFLAGS)
8758 AC_SUBST(DSO_LDOPTS)
8759 AC_SUBST(LIB_PREFIX)
8760 AC_SUBST(DLL_PREFIX)
8761 AC_SUBST(DLL_SUFFIX)
8762 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8763 AC_SUBST(LIB_SUFFIX)
8764 AC_SUBST(OBJ_SUFFIX)
8765 AC_SUBST(BIN_SUFFIX)
8766 AC_SUBST(ASM_SUFFIX)
8767 AC_SUBST(IMPORT_LIB_SUFFIX)
8769 AC_SUBST(CC_VERSION)
8770 AC_SUBST(CXX_VERSION)
8771 AC_SUBST(MSMANIFEST_TOOL)
8772 AC_SUBST(NS_ENABLE_TSF)
8773 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
8774 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
8777 AC_SUBST(MOZ_VORBIS)
8778 AC_SUBST(MOZ_TREMOR)
8782 AC_SUBST(MOZ_FFMPEG)
8785 AC_SUBST(MOZ_DIRECTSHOW)
8786 AC_SUBST(MOZ_ANDROID_OMX)
8787 AC_SUBST(MOZ_APPLEMEDIA)
8788 AC_SUBST(MOZ_OMX_PLUGIN)
8789 AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
8792 AC_SUBST(VPX_ASFLAGS)
8793 AC_SUBST(VPX_DASH_C_FLAG)
8794 AC_SUBST(VPX_AS_CONVERSION)
8795 AC_SUBST(VPX_ASM_SUFFIX)
8796 AC_SUBST(VPX_X86_ASM)
8797 AC_SUBST(VPX_ARM_ASM)
8798 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8799 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8800 AC_SUBST(MOZ_CODE_COVERAGE)
8801 AC_SUBST(LIBJPEG_TURBO_AS)
8802 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8803 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8804 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8805 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8807 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8808 AC_SUBST(MOZ_FOLD_LIBS)
8810 AC_SUBST(MOZ_ENABLE_SZIP)
8811 AC_SUBST(MOZ_SZIP_FLAGS)
8813 if test "$MOZ_DEBUG"; then
8816 AC_SUBST(MOZ_EM_DEBUG)
8818 if test -n "$COMPILE_ENVIRONMENT"; then
8819 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
8821 dnl Check for missing components
8822 if test "$MOZ_X11"; then
8823 if test "$WITHOUT_X11"; then
8824 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8826 dnl ====================================================
8827 dnl = Check if X headers exist
8828 dnl ====================================================
8829 _SAVE_CFLAGS=$CFLAGS
8830 CFLAGS="$CFLAGS $XCFLAGS"
8834 #include <X11/Xlib.h>
8835 #include <X11/Intrinsic.h>
8836 #include <X11/extensions/XShm.h>
8840 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8841 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8845 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
8846 CFLAGS="$_SAVE_CFLAGS"
8848 if test -n "$MISSING_X"; then
8849 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8854 fi # COMPILE_ENVIRONMENT
8856 dnl Set various defines and substitutions
8857 dnl ========================================================
8859 if test "$OS_ARCH" != "WINNT"; then
8863 if test "$MOZ_DEBUG"; then
8864 AC_DEFINE(MOZ_REFLOW_PERF)
8865 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8868 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
8869 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8870 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8871 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8872 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8873 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8874 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8875 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8876 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8879 if test "$MOZ_DEBUG"; then
8882 case "$MOZ_UPDATE_CHANNEL" in
8883 aurora|beta|release|esr)
8890 if test -n "$A11Y_LOG"; then
8894 AC_SUBST(MOZILLA_VERSION)
8896 AC_SUBST(ac_configure_args)
8898 dnl Spit out some output
8899 dnl ========================================================
8901 dnl The following defines are used by xpcom
8902 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8904 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8905 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8906 HAVE_CPP_PARTIAL_SPECIALIZATION
8907 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8908 NEED_CPP_UNUSED_IMPLEMENTATIONS
8911 HAVE_ICONV_WITH_CONST_INPUT
8924 AC_SUBST(STLPORT_LIBS)
8926 dnl ========================================================
8928 dnl ========================================================
8930 # Internationalization isn't built or exposed by default in non-desktop
8931 # builds. Bugs to enable:
8933 # Android: bug 864843
8936 if test "$MOZ_WIDGET_TOOLKIT" = "android" ||
8937 test "$MOZ_BUILD_APP" = "b2g"; then
8945 if test -z "$JS_SHARED_LIBRARY"; then
8946 AC_DEFINE(MOZ_STATIC_JS)
8948 AC_SUBST(JS_SHARED_LIBRARY)
8950 MOZ_CREATE_CONFIG_STATUS()
8952 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8953 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8954 MOZ_SUBCONFIGURE_ICU()
8955 MOZ_SUBCONFIGURE_FFI()
8958 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8959 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8960 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8961 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8962 # (apparently) only need this hack when egrep's "pattern" is particularly long
8963 # (as in the following code) and the first egrep on our $PATH is Apple's. See
8967 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8974 # Run jemalloc configure script
8976 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
8977 ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
8978 if test -n "$MOZ_REPLACE_MALLOC"; then
8979 # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
8980 ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
8981 ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
8983 if test -n "$MOZ_JEMALLOC3"; then
8984 case "${OS_ARCH}" in
8986 # We want jemalloc functions to be kept hidden on both Mac and Windows
8987 # See memory/build/mozmemory_wrap.h for details.
8988 ac_configure_args="$ac_configure_args --without-export"
8991 elif test "${OS_ARCH}" = Darwin; then
8992 # When building as a replace-malloc lib, disabling the zone allocator
8993 # forces to use pthread_atfork.
8994 ac_configure_args="$ac_configure_args --disable-zone-allocator"
8996 _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
8998 if test -z "$MOZ_REPLACE_MALLOC"; then
9000 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9004 elif test -z "$MOZ_JEMALLOC3"; then
9006 JEMALLOC_WRAPPER=replace_
9008 if test -n "$MANGLE"; then
9010 if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
9011 JEMALLOC_WRAPPER=__wrap_
9013 for mangle in ${MANGLE}; do
9014 if test -n "$MANGLED"; then
9015 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9017 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9020 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9023 if test -z "$MOZ_TLS"; then
9024 ac_configure_args="$ac_configure_args --disable-tls"
9026 EXTRA_CFLAGS="$CFLAGS"
9027 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9028 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9030 if test "$CROSS_COMPILE"; then
9031 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9034 if ! test -e memory/jemalloc; then
9035 mkdir -p memory/jemalloc
9038 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9039 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9042 # Run freetype configure script
9044 if test "$MOZ_TREE_FREETYPE"; then
9045 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9046 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9047 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9048 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9049 # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
9050 # to force freetype to use our settings rather than autodetecting
9051 if test -n "$MOZ_NATIVE_PNG"; then
9052 export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
9054 export LIBPNG_CFLAGS="-I$_objdir/dist/include"
9056 export LIBPNG_LIBS="$MOZ_PNG_LIBS "
9057 export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
9058 export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
9059 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9060 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
9062 if ! test -e modules; then
9066 AC_OUTPUT_SUBDIRS(modules/freetype2,$cache_file)
9069 if test -z "$direct_nspr_config"; then
9070 dnl ========================================================
9071 dnl = Setup a nice relatively clean build environment for
9072 dnl = sub-configures.
9073 dnl ========================================================
9076 CFLAGS="$_SUBDIR_CFLAGS"
9077 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9078 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9079 LDFLAGS="$_SUBDIR_LDFLAGS"
9080 HOST_CC="$_SUBDIR_HOST_CC"
9081 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9082 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9083 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9090 # Run all configure scripts specified by a subconfigure
9091 if test -n "$_subconfigure_subdir"; then
9092 _save_srcdir="$srcdir"
9094 _save_ac_configure_args="$ac_configure_args"
9095 ac_configure_args="$_subconfigure_config_args"
9096 AC_OUTPUT_SUBDIRS("$_subconfigure_subdir",$cache_file)
9097 ac_configure_args="$_save_ac_configure_args"
9098 srcdir="$_save_srcdir"
9101 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9102 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9106 if test -n "$_WRAP_MALLOC"; then
9107 # Avoid doubling wrap malloc arguments
9108 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9111 MOZ_SUBCONFIGURE_NSPR()
9113 dnl ========================================================
9114 dnl = Setup a nice relatively clean build environment for
9115 dnl = sub-configures.
9116 dnl ========================================================
9119 CFLAGS="$_SUBDIR_CFLAGS"
9120 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9121 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9122 LDFLAGS="$_SUBDIR_LDFLAGS"
9123 HOST_CC="$_SUBDIR_HOST_CC"
9124 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9125 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9126 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9129 if test -n "$ENABLE_CLANG_PLUGIN"; then
9130 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9131 AC_OUTPUT_SUBDIRS(build/clang-plugin)
9134 # Run the SpiderMonkey 'configure' script.
9135 dist=$MOZ_BUILD_ROOT/dist
9136 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9138 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
9140 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
9142 ac_configure_args="$ac_configure_args --enable-threadsafe"
9144 if test "$_INTL_API" = no; then
9145 ac_configure_args="$ac_configure_args --without-intl-api"
9148 if test "$BUILD_CTYPES"; then
9149 # Build js-ctypes on the platforms we can.
9150 ac_configure_args="$ac_configure_args --enable-ctypes"
9152 if test -z "$JS_SHARED_LIBRARY" ; then
9153 ac_configure_args="$ac_configure_args --disable-shared-js"
9154 if test -n "$MOZ_DISABLE_EXPORT_JS"; then
9155 ac_configure_args="$ac_configure_args --disable-export-js"
9158 if test -z "$JSGC_USE_EXACT_ROOTING" ; then
9159 ac_configure_args="$ac_configure_args --disable-exact-rooting"
9161 if test -z "$JSGC_GENERATIONAL" ; then
9162 ac_configure_args="$ac_configure_args --disable-gcgenerational"
9164 if test -n "$JS_GCCOMPACTING" ; then
9165 ac_configure_args="$ac_configure_args --enable-gccompacting"
9167 if test -n "$JS_GC_SMALL_CHUNK_SIZE" ; then
9168 ac_configure_args="$ac_configure_args --enable-small-chunk-size"
9170 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
9171 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9172 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9174 ac_configure_args="$ac_configure_args --prefix=$dist"
9175 if test "$MOZ_MEMORY"; then
9176 ac_configure_args="$ac_configure_args --enable-jemalloc"
9178 if test -n "$MOZ_GLUE_LDFLAGS"; then
9179 export MOZ_GLUE_LDFLAGS
9181 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9182 export MOZ_GLUE_PROGRAM_LDFLAGS
9184 if test -n "$ZLIB_IN_MOZGLUE"; then
9187 export MOZ_NATIVE_ZLIB
9188 export MOZ_ZLIB_CFLAGS
9189 export MOZ_ZLIB_LIBS
9191 export DONT_POPULATE_VIRTUALENV=1
9193 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9194 export STLPORT_CPPFLAGS
9196 export JS_STANDALONE=no
9198 export ZLIB_IN_MOZGLUE
9200 if ! test -e js; then
9204 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
9205 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9207 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9209 export WRITE_MOZINFO=1
9210 dnl we need to run config.status after js/src subconfigure because we're
9211 dnl traversing its moz.build and we need its config.status for that.
9212 dnl However, writing our own config.status needs to happen before
9213 dnl subconfigures because the setup surrounding subconfigures alters
9214 dnl many AC_SUBSTed variables.
9215 MOZ_RUN_CONFIG_STATUS()