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
1374 AC_DEFINE(HAVE_X86_AVX2)
1375 AC_SUBST(HAVE_X86_AVX2)
1379 DSO_LDOPTS='-shared'
1380 if test "$GCC_USE_GNU_LD"; then
1381 # Some tools like ASan use a runtime library that is only
1382 # linked against executables, so we must allow undefined
1383 # symbols for shared objects in some cases.
1384 if test -z "$MOZ_NO_WLZDEFS"; then
1385 # Don't allow undefined symbols in libraries
1386 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1388 # BSDs need `environ' exposed for posix_spawn (bug 753046)
1389 case "$OS_TARGET" in
1390 DragonFly|FreeBSD|NetBSD|OpenBSD)
1391 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
1392 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
1394 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
1401 # Turn on GNU-specific warnings:
1402 # -Wall - turn on a lot of warnings
1403 # -Wpointer-arith - good to have
1404 # -Wdeclaration-after-statement - MSVC doesn't like these
1405 # -Werror=return-type - catches missing returns, zero false positives
1406 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
1407 # -Wtype-limits - catches overflow bugs, few false positives
1408 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1409 # -Wsign-compare - catches comparison of signed and unsigned types
1411 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1412 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1413 MOZ_C_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_c_has_werror_int_to_pointer_cast)
1414 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1415 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1416 MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1418 # Turn off the following warnings that -Wall turns on:
1419 # -Wno-unused - lots of violations in third-party code
1421 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1423 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1424 # Don't use -Wcast-align with ICC or clang
1426 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1427 hppa | ia64 | sparc | arm)
1430 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1435 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1436 _USE_CPP_INCLUDE_FLAG=1
1437 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1439 elif test "$SOLARIS_SUNPRO_CC"; then
1441 if test "$CPU_ARCH" = "sparc"; then
1442 # for Sun Studio on Solaris/SPARC
1443 DSO_PIC_CFLAGS='-xcode=pic32'
1445 DSO_PIC_CFLAGS='-KPIC'
1447 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1449 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1450 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1452 DSO_LDOPTS='-shared'
1453 if test "$GNU_LD"; then
1454 # Don't allow undefined symbols in libraries
1455 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1459 DSO_PIC_CFLAGS='-KPIC'
1460 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1463 if test "$GNU_CXX"; then
1464 # FIXME: Let us build with strict aliasing. bug 414641.
1465 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1467 # Turn on GNU-specific warnings:
1468 # -Wall - turn on a lot of warnings
1469 # -Wpointer-arith - good to have
1470 # -Woverloaded-virtual - ???
1471 # -Werror=return-type - catches missing returns, zero false positives
1472 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
1473 # -Werror=type-limits - catches overflow bugs, few false positives
1474 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1475 # -Wsign-compare - catches comparison of signed and unsigned types
1477 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1478 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1479 MOZ_CXX_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_cxx_has_werror_int_to_pointer_cast)
1480 MOZ_CXX_SUPPORTS_WARNING(-W, error=type-limits, ac_cxx_has_werror_type_limits)
1481 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1482 MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1484 # Turn off the following warnings that -Wall turns on:
1485 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1486 # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc
1487 # for performance reasons, and because GCC and clang accept it (though
1488 # clang warns about it).
1490 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1491 MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete)
1493 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1494 # Don't use -Wcast-align with ICC or clang
1496 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1497 hppa | ia64 | sparc | arm)
1500 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1505 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1506 _USE_CPP_INCLUDE_FLAG=1
1508 # Recent clang and gcc support C++11 deleted functions without warnings if
1509 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1510 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1511 # unused. But clang's warning can be disabled, so when compiling with clang
1512 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1513 # deleted function syntax.
1514 if test "$CLANG_CXX"; then
1515 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1516 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1520 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1523 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1524 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1525 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1526 dnl normal behavior.
1527 dnl ========================================================
1529 MKSHLIB_UNFORCE_ALL=
1531 if test "$COMPILE_ENVIRONMENT"; then
1532 if test "$GNU_CC"; then
1533 AC_MSG_CHECKING(whether ld has archive extraction flags)
1534 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1535 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1536 ac_cv_mkshlib_force_and_unforce="no"
1537 exec 3<&0 <<LOOP_INPUT
1538 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1539 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1540 force="-Wl,-all"; unforce="-Wl,-none"
1547 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1550 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1552 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1556 eval $ac_cv_mkshlib_force_and_unforce
1557 MKSHLIB_FORCE_ALL=$force
1558 MKSHLIB_UNFORCE_ALL=$unforce
1561 fi # COMPILE_ENVIRONMENT
1563 dnl ========================================================
1564 dnl Checking for 64-bit OS
1565 dnl ========================================================
1566 if test "$COMPILE_ENVIRONMENT"; then
1569 AC_MSG_CHECKING(for 64-bit OS)
1570 AC_TRY_COMPILE([$configure_static_assert_macros],
1571 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1572 result="yes", result="no")
1573 AC_MSG_RESULT("$result")
1574 if test "$result" = "yes"; then
1575 AC_DEFINE(HAVE_64BIT_BUILD)
1578 AC_SUBST(HAVE_64BIT_BUILD)
1580 fi # COMPILE_ENVIRONMENT
1582 dnl ========================================================
1583 dnl = Use profiling compile flags
1584 dnl ========================================================
1585 MOZ_ARG_ENABLE_BOOL(profiling,
1586 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1590 dnl ========================================================
1591 dnl = Turn on systrace for android/b2g.
1592 dnl ========================================================
1593 MOZ_ARG_ENABLE_BOOL(systrace,
1594 [ --enable-systrace Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1597 if test -n "$MOZ_USE_SYSTRACE"; then
1598 AC_DEFINE(MOZ_USE_SYSTRACE)
1601 # For profiling builds keep the symbol information
1602 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1603 case "$OS_TARGET" in
1604 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1605 STRIP_FLAGS="--strip-debug"
1610 dnl ========================================================
1612 dnl ========================================================
1613 MOZ_ARG_ENABLE_BOOL(valgrind,
1614 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1617 if test -n "$MOZ_VALGRIND"; then
1618 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1620 [--enable-valgrind specified but Valgrind is not installed]))
1621 AC_DEFINE(MOZ_VALGRIND)
1623 AC_SUBST(MOZ_VALGRIND)
1625 dnl ========================================================
1627 dnl ========================================================
1628 MOZ_ARG_ENABLE_BOOL(jprof,
1629 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1632 if test -n "$MOZ_JPROF"; then
1634 AC_DEFINE(MOZ_JPROF)
1637 dnl ========================================================
1639 dnl ========================================================
1640 MOZ_ENABLE_PROFILER_SPS=1
1642 case "${OS_TARGET}" in
1644 case "${CPU_ARCH}" in
1647 MOZ_ENABLE_PROFILER_SPS=
1651 case "${CPU_ARCH}" in
1654 MOZ_ENABLE_PROFILER_SPS=
1659 MOZ_ENABLE_PROFILER_SPS=
1663 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1664 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1667 dnl ========================================================
1669 dnl ========================================================
1670 MOZ_ARG_ENABLE_BOOL(shark,
1671 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1674 if test -n "$MOZ_SHARK"; then
1676 AC_DEFINE(MOZ_SHARK)
1679 dnl ========================================================
1681 dnl ========================================================
1682 MOZ_ARG_ENABLE_BOOL(instruments,
1683 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
1686 if test -n "$MOZ_INSTRUMENTS"; then
1688 AC_DEFINE(MOZ_INSTRUMENTS)
1691 dnl ========================================================
1693 dnl ========================================================
1694 MOZ_ARG_ENABLE_BOOL(callgrind,
1695 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1698 if test -n "$MOZ_CALLGRIND"; then
1700 AC_DEFINE(MOZ_CALLGRIND)
1703 dnl ========================================================
1705 dnl ========================================================
1706 MOZ_ARG_ENABLE_BOOL(vtune,
1707 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1710 if test -n "$MOZ_VTUNE"; then
1712 AC_DEFINE(MOZ_VTUNE)
1715 dnl ========================================================
1717 dnl ========================================================
1718 if test -n "$MOZ_PROFILING"; then
1719 AC_DEFINE(MOZ_PROFILING)
1722 dnl ========================================================
1723 dnl System overrides of the defaults for host
1724 dnl ========================================================
1727 if test -n "$_WIN32_MSVC"; then
1729 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
1730 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
1731 HOST_RANLIB='echo ranlib'
1733 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1735 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1736 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1737 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1738 HOST_BIN_SUFFIX=.exe
1741 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1745 case "${host_cpu}" in
1747 if test -n "$_WIN32_MSVC"; then
1748 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1752 if test -n "$_WIN32_MSVC"; then
1753 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1755 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1761 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1762 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1763 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1766 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1767 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1768 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1769 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1773 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1774 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1778 dnl Check for using a custom <inttypes.h> implementation
1779 dnl ========================================================
1780 AC_MSG_CHECKING(for custom <inttypes.h> implementation)
1781 if test "$MOZ_CUSTOM_INTTYPES_H"; then
1782 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
1783 AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
1785 AC_MSG_RESULT(none specified)
1788 dnl Get mozilla version from central milestone file
1789 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1790 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1791 MOZILLA_SYMBOLVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -symbolversion`
1793 dnl Get version of various core apps from the version files.
1794 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1796 if test -z "$FIREFOX_VERSION"; then
1797 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1800 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1801 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1802 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1803 AC_SUBST(MOZILLA_SYMBOLVERSION)
1805 MOZ_DOING_LTO(lto_is_enabled)
1807 dnl ========================================================
1808 dnl System overrides of the defaults for target
1809 dnl ========================================================
1814 if test ! "$GNU_CC"; then
1815 if test ! "$HAVE_64BIT_BUILD"; then
1816 # Compiling with Visual Age C++ object model compat is the
1817 # default. To compile with object model ibm, add
1818 # AIX_OBJMODEL=ibm to .mozconfig.
1819 if test "$AIX_OBJMODEL" = "ibm"; then
1820 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1827 AC_SUBST(AIX_OBJMODEL)
1828 DSO_LDOPTS='-qmkshrobj=1'
1829 DSO_CFLAGS='-qflag=w:w'
1831 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1833 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1834 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1835 if test "$COMPILE_ENVIRONMENT"; then
1838 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1840 [#if (__IBMCPP__ < 900)
1841 #error "Bad compiler"
1843 _BAD_COMPILER=,_BAD_COMPILER=1)
1844 if test -n "$_BAD_COMPILER"; then
1846 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1848 AC_MSG_RESULT([yes])
1851 TARGET_COMPILER_ABI="ibmc"
1852 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1853 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1856 case "${target_os}" in
1861 if test "$COMPILE_ENVIRONMENT"; then
1862 MOZ_CHECK_HEADERS(sys/inttypes.h)
1864 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1868 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1869 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1870 MOZ_OPTIMIZE_FLAGS="-O3"
1871 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1872 if test "$HAVE_64BIT_BUILD"; then
1877 STRIP_FLAGS="$STRIP_FLAGS -x -S"
1878 # Check whether we're targeting OS X or iOS
1879 AC_CACHE_CHECK(for iOS target,
1881 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1882 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1886 ac_cv_ios_target="yes",
1887 ac_cv_ios_target="no")])
1888 if test "$ac_cv_ios_target" = "yes"; then
1890 AC_DEFINE(XP_DARWIN)
1891 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1893 AC_DEFINE(XP_MACOSX)
1894 AC_DEFINE(XP_DARWIN)
1895 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1896 # The ExceptionHandling framework is needed for Objective-C exception
1897 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1899 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1901 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1903 if test "x$lto_is_enabled" = "xyes"; then
1904 echo "Skipping -dead_strip because lto is enabled."
1905 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1906 dnl ===================================================================
1907 elif test "x$enable_dtrace" = "xyes"; then
1908 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1910 dnl check for the presence of the -dead_strip linker flag
1911 AC_MSG_CHECKING([for -dead_strip option to ld])
1912 _SAVE_LDFLAGS=$LDFLAGS
1913 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1914 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1915 if test -n "$_HAVE_DEAD_STRIP" ; then
1916 AC_MSG_RESULT([yes])
1917 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1922 LDFLAGS=$_SAVE_LDFLAGS
1925 dnl With newer linkers we need to pass -allow_heap_execute because of
1926 dnl Microsoft Silverlight (5.1.10411.0 at least).
1927 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1928 _SAVE_LDFLAGS=$LDFLAGS
1929 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1930 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1931 _HAVE_ALLOW_HEAP_EXECUTE=)
1932 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1933 AC_MSG_RESULT([yes])
1934 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1938 LDFLAGS=$_SAVE_LDFLAGS
1940 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1945 if test ! "$GNU_CC"; then
1949 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1950 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1951 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1954 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1955 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1958 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1959 AC_DEFINE(_LARGEFILE64_SOURCE)
1964 if test ! "$GNU_CC"; then
1965 DSO_LDOPTS='-b -Wl,+s'
1968 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1969 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1970 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1972 DSO_LDOPTS='-b -E +s'
1973 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1974 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1976 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1977 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1980 *-android*|*-linuxandroid*)
1981 AC_DEFINE(NO_PW_GECOS)
1983 if test -n "$gonkdir"; then
1984 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
1985 _PLATFORM_HAVE_RIL=1
1989 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
1992 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1994 MOZ_GFX_OPTIMIZE_MOBILE=1
1995 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
1999 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2000 # Similarly for GNU_CXX and INTEL_CXX.
2001 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2002 # -Os has been broken on Intel's C/C++ compilers for quite a
2003 # while; Intel recommends against using it.
2004 MOZ_OPTIMIZE_FLAGS="-O2"
2005 elif test "$GNU_CC" -o "$GNU_CXX"; then
2006 case $GCC_VERSION in
2008 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
2009 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2011 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2012 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2015 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2019 case "${target_cpu}" in
2021 CFLAGS="$CFLAGS -mieee"
2022 CXXFLAGS="$CXXFLAGS -mieee"
2026 if test -z "$MC"; then
2036 # certain versions of cygwin's makedepend barf on the
2037 # #include <string> vs -I./dist/include/string issue so don't use it
2038 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
2040 CXX="$CXX -mwindows"
2041 CPP="$CPP -mwindows"
2042 CFLAGS="$CFLAGS -mms-bitfields"
2043 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2044 DSO_LDOPTS='-shared'
2045 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2046 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2048 # Use static libgcc and libstdc++
2049 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
2050 NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
2051 # Use temp file for windres (bug 213281)
2052 RCFLAGS='-O coff --use-temp-file'
2053 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2054 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2057 IMPORT_LIB_SUFFIX=dll.a
2059 # We use mix of both POSIX and Win32 printf format across the tree, so format
2060 # warnings are useless on mingw.
2061 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2062 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2064 TARGET_COMPILER_ABI=msvc
2068 if test "$AS_BIN"; then
2069 AS="$(basename "$AS_BIN")"
2072 AR_FLAGS='-NOLOGO -OUT:$@'
2074 RANLIB='echo not_ranlib'
2075 STRIP='echo not_strip'
2086 IMPORT_LIB_SUFFIX=lib
2087 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2088 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2090 MKSHLIB_UNFORCE_ALL=
2091 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2092 _USE_CPP_INCLUDE_FLAG=1
2093 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2094 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2095 CFLAGS="$CFLAGS -W3 -Gy"
2096 CXXFLAGS="$CXXFLAGS -W3 -Gy"
2097 if test "$_CC_SUITE" -ge "11"; then
2098 dnl VS2012+ defaults to -arch:SSE2.
2099 CFLAGS="$CFLAGS -arch:IA32"
2100 CXXFLAGS="$CXXFLAGS -arch:IA32"
2102 if test "$_CC_SUITE" -ge "12"; then
2103 dnl VS2013+ requires -FS when parallel building by make -jN.
2104 dnl If nothing, compiler sometimes causes C1041 error.
2106 dnl Visual Studio 2013 supports -Gw flags
2107 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
2108 CFLAGS="$CFLAGS -FS -Gw"
2109 CXXFLAGS="$CXXFLAGS -FS -Gw"
2111 # khuey says we can safely ignore MSVC warning C4251
2112 # MSVC warning C4244 (implicit type conversion may lose data) warns
2113 # and requires workarounds for perfectly valid code. Also, GCC/clang
2114 # don't warn about it by default. So for consistency/sanity, we turn
2115 # it off on MSVC, too.
2116 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2117 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2118 # MSVC warning C4482 warns when an enum value is refered specifing the
2119 # name of the enum itself. This behavior is allowed in C++11, and the
2120 # warning has been removed in VS2012.
2121 # MSVC warning C4800 warns when a value is implicitly cast to bool,
2122 # because this also forces narrowing to a single byte, which can be a
2123 # perf hit. But this matters so little in practice (and often we want
2124 # that behavior) that it's better to turn it off.
2125 # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2126 # on non-Western system locales even if it is in a comment.
2127 CFLAGS="$CFLAGS -wd4244 -wd4819"
2128 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2129 # make 'foo == bar;' error out
2130 CFLAGS="$CFLAGS -we4553"
2131 CXXFLAGS="$CXXFLAGS -we4553"
2132 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2133 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2134 WARNINGS_AS_ERRORS='-WX'
2135 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
2137 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2138 # Disable these flags on clang-cl since it doesn't ignore unknown arguments by default, and
2139 # autoconf insists on passing $LDFLAGS to the compiler.
2140 if test -z "$CLANG_CL"; then
2141 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2142 if test -z "$DEVELOPER_OPTIONS"; then
2143 LDFLAGS="$LDFLAGS -RELEASE"
2146 dnl For profile-guided optimization
2147 PROFILE_GEN_CFLAGS="-GL"
2148 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2149 dnl XXX: PGO builds can fail with warnings treated as errors,
2150 dnl specifically "no profile data available" appears to be
2151 dnl treated as an error sometimes. This might be a consequence
2152 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2153 dnl with the linker doing most of the work in the whole-program
2154 dnl optimization/PGO case. I think it's probably a compiler bug,
2155 dnl but we work around it here.
2156 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2157 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2158 dnl Probably also a compiler bug, but what can you do?
2159 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2160 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2161 dnl Minimum reqiurement of Gecko is VS2010 or later which supports
2162 dnl both SSSE3 and SSE4.1.
2163 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2164 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
2167 AC_DEFINE(HAVE_SNPRINTF)
2172 AC_DEFINE(HW_THREADS)
2173 AC_DEFINE(STDC_HEADERS)
2174 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2175 TARGET_MD_ARCH=win32
2176 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2178 MOZ_USER_DIR="Mozilla"
2180 dnl Hardcode to win95 for now - cls
2181 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2183 dnl set NO_X11 defines here as the general check is skipped on win32
2189 if test -n "$L10NBASEDIR"; then
2190 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2197 if test -z "$MOZ_TOOLS"; then
2198 AC_MSG_ERROR([MOZ_TOOLS is not set])
2200 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2201 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2202 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2204 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2205 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2206 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2213 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.])
2219 if test "$HAVE_64BIT_BUILD"; then
2220 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2223 if test -n "$GNU_CC"; then
2224 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2225 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2226 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2228 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2229 # Disable this flag on clang-cl since it doesn't ignore unknown arguments by default, and
2230 # autoconf insists on passing $LDFLAGS to the compiler.
2231 if test -z "$CLANG_CL"; then
2232 LDFLAGS="$LDFLAGS -SAFESEH"
2239 if test -n "$_WIN32_MSVC"; then
2240 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2245 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2252 CFLAGS="$CFLAGS -Dunix"
2253 CXXFLAGS="$CXXFLAGS -Dunix"
2254 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2256 DSO_PIC_CFLAGS='-fPIC -DPIC'
2257 DSO_LDOPTS='-shared'
2258 BIN_FLAGS='-Wl,--export-dynamic'
2260 DSO_PIC_CFLAGS='-fPIC -DPIC'
2261 DLL_SUFFIX=".so.1.0"
2262 DSO_LDOPTS='-shared'
2264 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2265 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2266 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2267 if test "$LIBRUNPATH"; then
2268 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2270 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2271 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2275 if test "$SO_VERSION"; then
2276 DLL_SUFFIX=".so.$SO_VERSION"
2278 DLL_SUFFIX=".so.1.0"
2280 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2282 DSO_PIC_CFLAGS='-fPIC'
2283 DSO_LDOPTS='-shared -fPIC'
2284 if test "$LIBRUNPATH"; then
2285 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2291 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2293 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2294 # libraries one level up (e.g. libnspr4.so)
2295 if test "$SOLARIS_SUNPRO_CC"; then
2296 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2297 LIBS="-lCrun -lCstd -lc $LIBS"
2298 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2299 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2300 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2301 LDFLAGS="-xildoff $LDFLAGS"
2302 MMX_FLAGS="-xarch=mmx -xO4"
2303 SSE_FLAGS="-xarch=sse"
2304 SSE2_FLAGS="-xarch=ssei2 -xO4"
2305 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2306 _SAVE_LDFLAGS=$LDFLAGS
2307 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2308 AC_TRY_LINK([#include <stdio.h>],
2309 [printf("Hello World\n");],
2311 [LDFLAGS=$_SAVE_LDFLAGS])
2313 MOZ_OPTIMIZE_FLAGS="-xO4"
2314 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2315 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2316 MKSHLIB_FORCE_ALL='-z allextract'
2317 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2324 AS='/usr/ccs/bin/as'
2325 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2327 TARGET_COMPILER_ABI="sunc"
2328 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2329 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2330 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2334 [#if (__SUNPRO_CC < 0x590)
2337 _BAD_COMPILER=,_BAD_COMPILER=1)
2338 if test -n "$_BAD_COMPILER"; then
2340 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2345 [#if (__SUNPRO_CC >= 0x5100)
2346 #error "Sun C++ 5.10 or above"
2348 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2349 if test "$_ABOVE_SS12U1"; then
2351 CXXFLAGS="$CXXFLAGS -xannotate=no"
2353 AC_MSG_RESULT([$_res])
2356 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2358 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2359 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2360 ASFLAGS="$ASFLAGS -fPIC"
2361 DSO_LDOPTS='-shared'
2362 WARNINGS_AS_ERRORS='-Werror'
2364 _WARNINGS_CXXFLAGS=''
2365 if test "$OS_RELEASE" = "5.3"; then
2366 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2369 if test "$OS_RELEASE" = "5.5.1"; then
2370 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2375 DSO_LDOPTS='-Bdynamic'
2376 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2377 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2379 AC_DEFINE(SPRINTF_RETURNS_STRING)
2380 case "$(target_os)" in
2382 DLL_SUFFIX='.so.1.0'
2389 AC_SUBST_LIST(MMX_FLAGS)
2390 AC_SUBST_LIST(SSE_FLAGS)
2391 AC_SUBST_LIST(SSE2_FLAGS)
2395 # Includes linux-android
2400 AC_SUBST(MOZ_LINKER)
2401 if test -n "$MOZ_LINKER"; then
2402 AC_DEFINE(MOZ_LINKER)
2405 dnl Only one oddball right now (QNX), but this gives us flexibility
2406 dnl if any other platforms need to override this in the future.
2407 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2409 dnl ========================================================
2410 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2411 dnl by now will not have any way to link most binaries (tests
2412 dnl as well as viewer, apprunner, etc.), because some symbols
2413 dnl will be left out of the "composite" .so's by ld as unneeded.
2414 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2415 dnl they can link in the static libs that provide the missing
2417 dnl ========================================================
2418 NO_LD_ARCHIVE_FLAGS=
2419 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2420 NO_LD_ARCHIVE_FLAGS=1
2424 NO_LD_ARCHIVE_FLAGS=
2427 if test -z "$GNU_CC"; then
2428 NO_LD_ARCHIVE_FLAGS=
2432 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2434 dnl ========================================================
2435 dnl = Flags to strip unused symbols from .so components and
2436 dnl = to export jemalloc symbols when linking a program
2437 dnl ========================================================
2439 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2440 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2443 if test -z "$GNU_CC"; then
2444 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2446 if test -z "$GCC_USE_GNU_LD"; then
2447 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2449 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2454 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2457 if test -n "$GNU_CC"; then
2458 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2463 if test -z "$COMPILE_ENVIRONMENT"; then
2464 SKIP_COMPILER_CHECKS=1
2465 SKIP_LIBRARY_CHECKS=1
2470 if test -z "$SKIP_COMPILER_CHECKS"; then
2471 dnl Checks for typedefs, structures, and compiler characteristics.
2472 dnl ========================================================
2481 AC_MSG_CHECKING(for ssize_t)
2482 AC_CACHE_VAL(ac_cv_type_ssize_t,
2483 [AC_TRY_COMPILE([#include <stdio.h>
2484 #include <sys/types.h>],
2486 [ac_cv_type_ssize_t=true],
2487 [ac_cv_type_ssize_t=false])])
2488 if test "$ac_cv_type_ssize_t" = true ; then
2489 AC_DEFINE(HAVE_SSIZE_T)
2494 AC_STRUCT_ST_BLKSIZE
2495 AC_MSG_CHECKING(for siginfo_t)
2496 AC_CACHE_VAL(ac_cv_siginfo_t,
2497 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2498 #include <signal.h>],
2500 [ac_cv_siginfo_t=true],
2501 [ac_cv_siginfo_t=false])])
2502 if test "$ac_cv_siginfo_t" = true ; then
2503 AC_DEFINE(HAVE_SIGINFO_T)
2515 dnl Check for .hidden assembler directive and visibility attribute.
2516 dnl Borrowed from glibc configure.in
2517 dnl ===============================================================
2518 if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
2519 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2520 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2521 case "$OS_TARGET" in
2523 VISIBILITY_FLAGS='-fvisibility=hidden'
2526 case $GCC_VERSION in
2528 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden_dso_handle.h'
2531 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden.h'
2534 WRAP_SYSTEM_INCLUDES=1
2539 # visibility hidden flag for Sun Studio on Solaris
2540 if test "$SOLARIS_SUNPRO_CC"; then
2541 VISIBILITY_FLAGS='-xldscope=hidden'
2542 fi # Sun Studio on Solaris
2544 case "${OS_TARGET}" in
2545 WINNT|Darwin|Android)
2548 STL_FLAGS='-I$(DIST)/stl_wrappers'
2553 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2554 AC_SUBST(VISIBILITY_FLAGS)
2558 if test "$OS_TARGET" != WINNT; then
2559 # Only run this test with clang on non-Windows platforms, because clang
2560 # cannot do enough code gen for now to make this test work correctly.
2564 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2565 dnl ========================================================
2566 if test "$GNU_CC"; then
2567 CFLAGS_save="${CFLAGS}"
2568 CFLAGS="${CFLAGS} -Werror"
2569 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2570 ac_cv_force_align_arg_pointer,
2571 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2573 ac_cv_force_align_arg_pointer="yes",
2574 ac_cv_force_align_arg_pointer="no")])
2575 CFLAGS="${CFLAGS_save}"
2576 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2577 HAVE_GCC_ALIGN_ARG_POINTER=1
2579 HAVE_GCC_ALIGN_ARG_POINTER=
2582 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2584 dnl Checks for header files.
2585 dnl ========================================================
2587 case "$target_os" in
2589 # for stuff like -lXshm
2590 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2593 MOZ_CHECK_COMMON_HEADERS
2595 dnl These are all the places some variant of statfs can be hiding.
2596 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2599 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2600 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2602 dnl SCTP support - needs various network include headers
2603 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2605 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2607 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2608 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2609 ac_cv_sockaddr_in_sin_len,
2610 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2611 #include <sys/types.h>
2613 #include <netinet/in.h>
2614 struct sockaddr_in x;
2615 void *foo = (void*) &x.sin_len;],
2617 [ac_cv_sockaddr_in_sin_len=true],
2618 [ac_cv_sockaddr_in_sin_len=false])])
2619 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2620 AC_DEFINE(HAVE_SIN_LEN)
2621 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2622 AC_DEFINE(HAVE_SCONN_LEN)
2625 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2626 ac_cv_sockaddr_in6_sin6_len,
2627 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2628 #include <sys/types.h>
2630 #include <netinet/in.h>
2631 struct sockaddr_in6 x;
2632 void *foo = (void*) &x.sin6_len;],
2634 [ac_cv_sockaddr_in6_sin6_len=true],
2635 [ac_cv_sockaddr_in6_sin6_len=false])])
2636 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2637 AC_DEFINE(HAVE_SIN6_LEN)
2640 AC_CACHE_CHECK(for sockaddr.sa_len,
2641 ac_cv_sockaddr_sa_len,
2642 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2643 #include <sys/types.h>
2645 #include <sys/socket.h>
2647 void *foo = (void*) &x.sa_len;],
2649 [ac_cv_sockaddr_sa_len=true],
2650 [ac_cv_sockaddr_sa_len=false])])
2651 if test "$ac_cv_sockaddr_sa_len" = true ; then
2652 AC_DEFINE(HAVE_SA_LEN)
2655 MOZ_ARG_ENABLE_BOOL(dtrace,
2656 [ --enable-dtrace build with dtrace support if available (default=no)],
2657 [enable_dtrace="yes"],)
2658 if test "x$enable_dtrace" = "xyes"; then
2659 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2660 if test -n "$HAVE_DTRACE"; then
2661 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2663 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2666 AC_SUBST(HAVE_DTRACE)
2672 MOZ_CHECK_HEADERS(sys/cdefs.h)
2676 MOZ_LINUX_PERF_EVENT
2678 dnl Checks for libraries.
2679 dnl ========================================================
2684 AC_CHECK_LIB(c_r, gethostbyname_r)
2688 dnl We don't want to link with libdl even if it's present on OS X, since
2689 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2691 dnl We don't want to link against libm or libpthread on Darwin since
2692 dnl they both are just symlinks to libSystem and explicitly linking
2693 dnl against libSystem causes issues when debugging (see bug 299601).
2698 AC_SEARCH_LIBS(dlopen, dl,
2699 MOZ_CHECK_HEADER(dlfcn.h,
2700 AC_DEFINE(HAVE_DLOPEN)))
2704 _SAVE_CFLAGS="$CFLAGS"
2705 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2706 AC_CHECK_FUNCS(dladdr memmem)
2707 CFLAGS="$_SAVE_CFLAGS"
2709 if test ! "$GNU_CXX"; then
2713 AC_CHECK_LIB(C_r, demangle)
2716 AC_CHECK_LIB(C, demangle)
2721 AC_CHECK_LIB(socket, socket)
2724 XLIBS="$X_EXTRA_LIBS"
2726 dnl ========================================================
2727 dnl Checks for X libraries.
2728 dnl Ordering is important.
2729 dnl Xt is dependent upon SM as of X11R6
2730 dnl ========================================================
2731 if test "$no_x" = "yes"; then
2734 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2735 XLIBS="-lX11 $XLIBS"
2736 _SAVE_LDFLAGS="$LDFLAGS"
2737 LDFLAGS="$XLDFLAGS $LDFLAGS"
2738 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2739 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2740 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2741 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2743 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2744 unset ac_cv_lib_Xt_XtFree
2745 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2746 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
2747 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2748 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2751 # AIX needs the motif library linked before libXt to prevent
2752 # crashes in plugins linked against Motif - Bug #98892
2753 case "${target_os}" in
2755 XT_LIBS="-lXm $XT_LIBS"
2759 dnl ========================================================
2760 dnl = Check for XShm
2761 dnl ========================================================
2762 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
2765 dnl ========================================================
2767 dnl ========================================================
2768 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
2769 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
2770 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
2771 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
2773 LDFLAGS="$_SAVE_LDFLAGS"
2776 AC_SUBST_LIST(XCFLAGS)
2777 AC_SUBST_LIST(XLDFLAGS)
2778 AC_SUBST_LIST(XLIBS)
2779 AC_SUBST_LIST(XEXT_LIBS)
2780 AC_SUBST_LIST(XT_LIBS)
2781 AC_SUBST_LIST(XSS_LIBS)
2783 dnl ========================================================
2784 dnl = pthread support
2785 dnl = Start by checking whether the system support pthreads
2786 dnl ========================================================
2787 case "$target_os" in
2792 AC_CHECK_LIB(pthreads, pthread_create,
2793 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2794 AC_CHECK_LIB(pthread, pthread_create,
2795 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2796 AC_CHECK_LIB(c_r, pthread_create,
2797 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2798 AC_CHECK_LIB(c, pthread_create,
2807 dnl ========================================================
2808 dnl Check the command line for --with-pthreads
2809 dnl ========================================================
2810 MOZ_ARG_WITH_BOOL(pthreads,
2811 [ --with-pthreads Force use of system pthread library with NSPR ],
2812 [ if test "$MOZ_USE_PTHREADS"x = x; then
2813 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2819 dnl ========================================================
2820 dnl Do the platform specific pthread hackery
2821 dnl ========================================================
2822 if test "$MOZ_USE_PTHREADS"x != x
2825 dnl See if -pthread is supported.
2828 ac_cv_have_dash_pthread=no
2829 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2830 echo 'int main() { return 0; }' | cat > conftest.c
2831 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2832 if test $? -eq 0; then
2833 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2834 ac_cv_have_dash_pthread=yes
2835 case "$target_os" in
2837 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2840 CFLAGS="$CFLAGS -pthread"
2841 CXXFLAGS="$CXXFLAGS -pthread"
2847 AC_MSG_RESULT($ac_cv_have_dash_pthread)
2850 dnl See if -pthreads is supported.
2852 ac_cv_have_dash_pthreads=no
2853 if test "$ac_cv_have_dash_pthread" = "no"; then
2854 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2855 echo 'int main() { return 0; }' | cat > conftest.c
2856 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2857 if test $? -eq 0; then
2858 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2859 ac_cv_have_dash_pthreads=yes
2860 CFLAGS="$CFLAGS -pthreads"
2861 CXXFLAGS="$CXXFLAGS -pthreads"
2865 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2870 AC_DEFINE(_REENTRANT)
2871 AC_DEFINE(_THREAD_SAFE)
2872 dnl -pthread links in -lpthread, so don't specify it explicitly.
2873 if test "$ac_cv_have_dash_pthread" = "yes"; then
2874 _PTHREAD_LDFLAGS="-pthread"
2878 *-*-openbsd*|*-*-bsdi*)
2879 AC_DEFINE(_REENTRANT)
2880 AC_DEFINE(_THREAD_SAFE)
2881 dnl -pthread links in -lc_r, so don't specify it explicitly.
2882 if test "$ac_cv_have_dash_pthread" = "yes"; then
2883 _PTHREAD_LDFLAGS="-pthread"
2887 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
2888 AC_DEFINE(_REENTRANT)
2892 AC_DEFINE(_REENTRANT)
2896 AC_DEFINE(_REENTRANT)
2900 AC_DEFINE(_REENTRANT)
2901 if test "$SOLARIS_SUNPRO_CC"; then
2902 CFLAGS="$CFLAGS -mt"
2903 CXXFLAGS="$CXXFLAGS -mt"
2907 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
2908 AC_SUBST(MOZ_USE_PTHREADS)
2912 dnl Checks for library functions.
2913 dnl ========================================================
2914 AC_PROG_GCC_TRADITIONAL
2916 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r arc4random arc4random_buf)
2918 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
2919 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
2920 ac_cv_clock_monotonic,
2921 [for libs in "" -lrt; do
2924 AC_TRY_LINK([#include <time.h>],
2925 [ struct timespec ts;
2926 clock_gettime(CLOCK_MONOTONIC, &ts); ],
2927 ac_cv_clock_monotonic=$libs
2930 ac_cv_clock_monotonic=no)
2933 if test "$ac_cv_clock_monotonic" != "no"; then
2934 HAVE_CLOCK_MONOTONIC=1
2935 REALTIME_LIBS=$ac_cv_clock_monotonic
2936 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
2937 AC_SUBST(HAVE_CLOCK_MONOTONIC)
2938 AC_SUBST_LIST(REALTIME_LIBS)
2941 dnl check for wcrtomb/mbrtowc
2942 dnl =======================================================================
2943 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
2946 AC_CACHE_CHECK(for wcrtomb,
2948 [AC_TRY_LINK([#include <wchar.h>],
2949 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
2950 ac_cv_have_wcrtomb="yes",
2951 ac_cv_have_wcrtomb="no")])
2952 if test "$ac_cv_have_wcrtomb" = "yes"; then
2953 AC_DEFINE(HAVE_WCRTOMB)
2955 AC_CACHE_CHECK(for mbrtowc,
2957 [AC_TRY_LINK([#include <wchar.h>],
2958 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
2959 ac_cv_have_mbrtowc="yes",
2960 ac_cv_have_mbrtowc="no")])
2961 if test "$ac_cv_have_mbrtowc" = "yes"; then
2962 AC_DEFINE(HAVE_MBRTOWC)
2969 ac_cv_func_res_ninit,
2970 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
2971 dnl no need for res_ninit() on NetBSD and OpenBSD
2972 ac_cv_func_res_ninit=no
2976 #define _BSD_SOURCE 1
2978 #include <sys/types.h>
2979 #include <netinet/in.h>
2980 #include <arpa/nameser.h>
2983 [int foo = res_ninit(&_res);],
2984 [ac_cv_func_res_ninit=yes],
2985 [ac_cv_func_res_ninit=no])
2989 if test "$ac_cv_func_res_ninit" = "yes"; then
2990 AC_DEFINE(HAVE_RES_NINIT)
2991 dnl must add the link line we do something as foolish as this... dougt
2993 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
2994 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3006 AC_CHECK_LIB(c, iconv, [ICONV_LIBS=],
3007 AC_CHECK_LIB(iconv, iconv, [ICONV_LIBS="-liconv"],
3008 AC_CHECK_LIB(iconv, libiconv, [ICONV_LIBS="-liconv"])))
3010 LIBS="$LIBS $ICONV_LIBS"
3019 iconv_t h = iconv_open("", "");
3020 iconv(h, NULL, NULL, NULL, NULL);
3023 [ac_cv_func_iconv=yes],
3024 [ac_cv_func_iconv=no]
3027 if test "$ac_cv_func_iconv" = "yes"; then
3028 AC_DEFINE(HAVE_ICONV)
3029 LIBICONV="$ICONV_LIBS"
3031 [for iconv() with const input],
3032 ac_cv_func_const_iconv,
3038 const char *input = "testing";
3039 iconv_t h = iconv_open("", "");
3040 iconv(h, &input, NULL, NULL, NULL);
3043 [ac_cv_func_const_iconv=yes],
3044 [ac_cv_func_const_iconv=no]
3047 if test "$ac_cv_func_const_iconv" = "yes"; then
3048 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3056 AC_SUBST_LIST(ICONV_LIBS)
3062 dnl **********************
3063 dnl *** va_copy checks ***
3064 AC_CACHE_CHECK([for an implementation of va_copy()],
3066 [AC_TRY_COMPILE([#include <stdarg.h>
3068 void f (int i, ...) {
3069 va_list args1, args2;
3070 va_start (args1, i);
3071 va_copy (args2, args1);
3072 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3074 va_end (args1); va_end (args2);
3076 [f(0, 42); return 0],
3077 [ac_cv_va_copy=yes],
3081 AC_CACHE_CHECK([whether va_list can be copied by value],
3083 [AC_TRY_COMPILE([#include <stdarg.h>
3085 void f (int i, ...) {
3086 va_list args1, args2;
3087 va_start (args1, i);
3089 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3091 va_end (args1); va_end (args2);
3093 [f(0, 42); return 0],
3094 [ac_cv_va_val_copy=yes],
3095 [ac_cv_va_val_copy=no],
3098 if test "x$ac_cv_va_copy" = "xyes"; then
3099 AC_DEFINE(VA_COPY, va_copy)
3100 AC_DEFINE(HAVE_VA_COPY)
3103 if test "x$ac_cv_va_val_copy" = "xno"; then
3104 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3107 dnl ===================================================================
3108 dnl ========================================================
3109 dnl Put your C++ language/feature checks below
3110 dnl ========================================================
3114 if test "$GNU_CC"; then
3115 if test "$CPU_ARCH" = "arm" ; then
3116 AC_CACHE_CHECK(for ARM EABI,
3120 #if defined(__ARM_EABI__)
3123 #error Not ARM EABI.
3126 ac_cv_gcc_arm_eabi="yes",
3127 ac_cv_gcc_arm_eabi="no")])
3128 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3130 ARM_ABI_PREFIX=eabi-
3132 ARM_ABI_PREFIX=oabi-
3136 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3139 dnl Check to see if we can resolve ambiguity with |using|.
3140 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3141 ac_cv_cpp_ambiguity_resolving_using,
3142 [AC_TRY_COMPILE(class X {
3143 public: int go(const X&) {return 3;}
3144 int jo(const X&) {return 3;}
3146 class Y : public X {
3147 public: int go(int) {return 2;}
3148 int jo(int) {return 2;}
3150 private: using X::go;
3153 ac_cv_cpp_ambiguity_resolving_using=yes,
3154 ac_cv_cpp_ambiguity_resolving_using=no)])
3155 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3156 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3159 dnl See if a dynamic_cast to void* gives the most derived object.
3160 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3161 ac_cv_cpp_dynamic_cast_void_ptr,
3162 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3163 class Y { int j; public: virtual ~Y() { } };
3164 class Z : public X, public Y { int k; };
3170 return !((((void*)&mdo != (void*)subx) &&
3171 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3172 (((void*)&mdo != (void*)suby) &&
3173 ((void*)&mdo == dynamic_cast<void*>(suby))));
3175 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3176 ac_cv_cpp_dynamic_cast_void_ptr=no,
3177 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3178 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3179 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3182 dnl note that this one is reversed - if the test fails, then
3183 dnl we require implementations of unused virtual methods. Which
3184 dnl really blows because it means we'll have useless vtable
3186 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3187 ac_cv_cpp_unused_required,
3188 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3190 ac_cv_cpp_unused_required=no,
3191 ac_cv_cpp_unused_required=yes)])
3192 if test "$ac_cv_cpp_unused_required" = yes ; then
3193 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3197 dnl Some compilers have trouble comparing a constant reference to a templatized
3198 dnl class to zero, and require an explicit operator==() to be defined that takes
3199 dnl an int. This test separates the strong from the weak.
3201 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3202 ac_cv_trouble_comparing_to_zero,
3203 [AC_TRY_COMPILE([#include <algorithm>
3204 template <class T> class Foo {};
3206 template <class T> int operator==(const T2*, const T&) { return 0; }
3207 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3208 [Foo<int> f; return (0 != f);],
3209 ac_cv_trouble_comparing_to_zero=no,
3210 ac_cv_trouble_comparing_to_zero=yes)])
3211 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3212 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3215 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3216 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3217 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3219 _SAVE_LDFLAGS=$LDFLAGS
3220 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3221 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3222 ac_cv_thread_keyword,
3223 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3224 [return tlsIsMainThread;],
3225 ac_cv_thread_keyword=yes,
3226 ac_cv_thread_keyword=no)])
3227 LDFLAGS=$_SAVE_LDFLAGS
3228 # The custom dynamic linker doesn't support TLS variables
3230 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3231 # mips builds fail with TLS variables because of a binutils bug.
3233 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3238 *-android*|*-linuxandroid*)
3245 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3251 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3252 if test -n "$MOZ_LINKER"; then
3253 if test "$CPU_ARCH" = arm; then
3254 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3255 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3256 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3257 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3262 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3263 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3264 dnl We however want to avoid these text relocations, and this can be done
3265 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3266 dnl doesn't contain anything at all, beside placeholders for some sections,
3267 dnl and crtbegin only contains a finalizer function that calls
3268 dnl __cxa_finalize. The custom linker actually takes care of calling
3269 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3270 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3271 dnl link crtbegin and crtend at all.
3272 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3273 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3274 ac_cv_crt_has_text_relocations,
3275 [echo 'int foo() { return 0; }' > conftest.cpp
3276 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3277 test -s conftest${DLL_SUFFIX}; then
3278 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3279 ac_cv_crt_has_text_relocations=yes
3281 ac_cv_crt_has_text_relocations=no
3284 AC_ERROR([couldn't compile a simple C file])
3287 if test "$ac_cv_crt_has_text_relocations" = yes; then
3288 dnl While we want libraries to skip the CRT files, we don't want
3289 dnl executables to be treated the same way. We thus set the flag
3290 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3291 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3292 dnl Using LDFLAGS in nspr is safe, since we only really build
3293 dnl libraries there.
3294 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3295 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3299 dnl Check for the existence of various allocation headers/functions
3301 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3304 for file in $MALLOC_HEADERS; do
3305 MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3306 if test "$MALLOC_H" != ""; then
3307 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3312 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3314 AC_CHECK_FUNCS(malloc_usable_size)
3316 dnl See if compiler supports some gcc-style attributes
3318 AC_CACHE_CHECK(for __attribute__((always_inline)),
3319 ac_cv_attribute_always_inline,
3320 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3322 ac_cv_attribute_always_inline=yes,
3323 ac_cv_attribute_always_inline=no)])
3325 AC_CACHE_CHECK(for __attribute__((malloc)),
3326 ac_cv_attribute_malloc,
3327 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3329 ac_cv_attribute_malloc=yes,
3330 ac_cv_attribute_malloc=no)])
3332 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3333 ac_cv_attribute_warn_unused,
3334 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3336 ac_cv_attribute_warn_unused=yes,
3337 ac_cv_attribute_warn_unused=no)])
3339 dnl End of C++ language/feature checks
3342 dnl ========================================================
3343 dnl = Internationalization checks
3344 dnl ========================================================
3346 dnl Internationalization and Locale support is different
3347 dnl on various UNIX platforms. Checks for specific i18n
3348 dnl features go here.
3350 dnl check for LC_MESSAGES
3351 AC_CACHE_CHECK(for LC_MESSAGES,
3352 ac_cv_i18n_lc_messages,
3353 [AC_TRY_COMPILE([#include <locale.h>],
3354 [int category = LC_MESSAGES;],
3355 ac_cv_i18n_lc_messages=yes,
3356 ac_cv_i18n_lc_messages=no)])
3357 if test "$ac_cv_i18n_lc_messages" = yes; then
3358 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3361 AC_HAVE_FUNCS(localeconv)
3362 fi # ! SKIP_COMPILER_CHECKS
3365 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3366 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3367 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
3370 dnl Mozilla specific options
3371 dnl ========================================================
3372 dnl The macros used for command line options
3373 dnl are defined in build/autoconf/altoptions.m4.
3375 dnl If the compiler supports these attributes, define them as
3376 dnl convenience macros.
3377 if test "$ac_cv_attribute_malloc" = yes ; then
3378 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3380 AC_DEFINE(NS_ATTR_MALLOC,)
3383 if test "$ac_cv_attribute_warn_unused" = yes ; then
3384 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3386 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3389 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3390 dnl features that Windows actually does support.
3392 if test -n "$SKIP_COMPILER_CHECKS"; then
3393 dnl Windows has malloc.h
3394 AC_DEFINE(MALLOC_H, [<malloc.h>])
3395 AC_DEFINE(HAVE_FORCEINLINE)
3396 AC_DEFINE(HAVE_LOCALECONV)
3397 fi # SKIP_COMPILER_CHECKS
3399 dnl ========================================================
3401 dnl = Check for external package dependencies
3403 dnl ========================================================
3404 MOZ_ARG_HEADER(External Packages)
3406 MOZ_ARG_WITH_STRING(libxul-sdk,
3407 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3408 AC_MSG_ERROR([--with-libxul-sdk is not supported anymore.]))
3410 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3411 AC_SUBST(LIBXUL_DIST)
3415 dnl set GRE_MILESTONE
3416 dnl ========================================================
3417 if test -n "$LIBXUL_SDK"; then
3418 GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3420 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3422 AC_SUBST(GRE_MILESTONE)
3424 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3425 # The logic works like this:
3426 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3427 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3428 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3429 case "$GRE_MILESTONE" in
3432 AC_DEFINE(NIGHTLY_BUILD)
3438 AC_DEFINE(RELEASE_BUILD)
3441 AC_SUBST(NIGHTLY_BUILD)
3442 AC_SUBST(RELEASE_BUILD)
3444 dnl ========================================================
3445 dnl Disable compiling sources in unified mode.
3446 dnl ========================================================
3448 if test -z "$NIGHTLY_BUILD"; then
3449 MOZ_DISABLE_UNIFIED_COMPILATION=1
3452 MOZ_ARG_DISABLE_BOOL(unified-compilation,
3453 [ --disable-unified-compilation
3454 Disable unified compilation of some C/C++ sources],
3455 MOZ_DISABLE_UNIFIED_COMPILATION=1,
3456 MOZ_DISABLE_UNIFIED_COMPILATION=)
3457 AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
3459 dnl ========================================================
3460 dnl Multiprocess Firefox Nightly Testing UI
3461 dnl To be removed in Bug 1003313
3462 dnl ========================================================
3463 if test -z "$NIGHTLY_BUILD"; then
3467 AC_SUBST(E10S_TESTING_ONLY)
3469 dnl ========================================================
3470 dnl system libevent Support
3471 dnl ========================================================
3472 MOZ_ARG_WITH_STRING(system-libevent,
3473 [ --with-system-libevent[=PFX]
3474 Use system libevent [installed at prefix PFX]],
3475 LIBEVENT_DIR=$withval)
3477 _SAVE_CFLAGS=$CFLAGS
3478 _SAVE_LDFLAGS=$LDFLAGS
3480 if test "$LIBEVENT_DIR" = yes; then
3481 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3482 MOZ_NATIVE_LIBEVENT=1,
3485 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3486 MOZ_NATIVE_LIBEVENT=
3487 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3488 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3489 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3490 MOZ_CHECK_HEADER(event.h,
3491 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3492 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3494 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3495 AC_CHECK_LIB(event, event_init,
3496 [MOZ_NATIVE_LIBEVENT=1
3497 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3498 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3499 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3501 CFLAGS=$_SAVE_CFLAGS
3502 LDFLAGS=$_SAVE_LDFLAGS
3505 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3507 dnl ========================================================
3508 dnl = If NSS was not detected in the system,
3509 dnl = use the one in the source tree (mozilla/security/nss)
3510 dnl ========================================================
3512 MOZ_ARG_WITH_BOOL(system-nss,
3513 [ --with-system-nss Use system installed NSS],
3516 if test -n "$_USE_SYSTEM_NSS"; then
3517 AM_PATH_NSS(3.16.1, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3520 if test -n "$MOZ_NATIVE_NSS"; then
3521 NSS_LIBS="$NSS_LIBS -lcrmf"
3523 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3525 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
3527 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3528 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3529 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3530 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3531 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3533 NSS_LIBS='-L$(LIBXUL_DIST)/lib'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3537 dnl ======================
3539 dnl ======================
3541 AC_MSG_CHECKING([for YASM assembler])
3542 AC_CHECK_PROGS(YASM, yasm, "")
3544 if test -n "$YASM"; then
3545 dnl Pull out yasm's version string
3546 YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3547 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3548 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3549 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3550 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3553 if test -z "$SKIP_LIBRARY_CHECKS"; then
3554 dnl system JPEG support
3555 dnl ========================================================
3556 MOZ_ARG_WITH_STRING(system-jpeg,
3557 [ --with-system-jpeg[=PFX]
3558 Use system libjpeg [installed at prefix PFX]],
3561 _SAVE_CFLAGS=$CFLAGS
3562 _SAVE_LDFLAGS=$LDFLAGS
3564 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3565 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3566 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3568 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3571 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3574 if test "$MOZ_NATIVE_JPEG" = 1; then
3575 AC_TRY_COMPILE([ #include <stdio.h>
3576 #include <sys/types.h>
3577 #include <jpeglib.h> ],
3578 [ #if JPEG_LIB_VERSION < $MOZJPEG
3579 #error "Insufficient JPEG library version ($MOZJPEG required)."
3581 #ifndef JCS_EXTENSIONS
3582 #error "libjpeg-turbo JCS_EXTENSIONS required"
3586 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3588 CFLAGS=$_SAVE_CFLAGS
3589 LDFLAGS=$_SAVE_LDFLAGS
3592 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3593 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3594 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3596 fi # SKIP_LIBRARY_CHECKS
3598 dnl system ZLIB support
3599 dnl ========================================================
3600 MOZ_ZLIB_CHECK([1.2.3])
3602 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
3603 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
3608 if test -z "$SKIP_LIBRARY_CHECKS"; then
3609 dnl system BZIP2 Support
3610 dnl ========================================================
3611 MOZ_ARG_WITH_STRING(system-bz2,
3612 [ --with-system-bz2[=PFX]
3613 Use system libbz2 [installed at prefix PFX]],
3616 _SAVE_CFLAGS=$CFLAGS
3617 _SAVE_LDFLAGS=$LDFLAGS
3619 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
3620 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
3621 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
3623 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
3626 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
3627 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
3629 CFLAGS=$_SAVE_CFLAGS
3630 LDFLAGS=$_SAVE_LDFLAGS
3633 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
3634 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
3635 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
3638 dnl ========================================================
3639 dnl system PNG Support
3640 dnl ========================================================
3641 MOZ_ARG_WITH_STRING(system-png,
3642 [ --with-system-png[=PFX]
3643 Use system libpng [installed at prefix PFX]],
3646 _SAVE_CFLAGS=$CFLAGS
3647 _SAVE_LDFLAGS=$LDFLAGS
3649 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
3650 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
3651 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
3653 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
3656 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
3657 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3658 AC_CHECK_LIB(png, png_get_acTL, ,
3659 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
3661 if test "$MOZ_NATIVE_PNG" = 1; then
3662 AC_TRY_COMPILE([ #include <stdio.h>
3663 #include <sys/types.h>
3665 [ #if PNG_LIBPNG_VER < $MOZPNG
3666 #error "Insufficient libpng version ($MOZPNG required)."
3668 #ifndef PNG_UINT_31_MAX
3669 #error "Insufficient libpng version."
3672 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3674 CFLAGS=$_SAVE_CFLAGS
3675 LDFLAGS=$_SAVE_LDFLAGS
3678 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
3679 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
3680 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
3683 MOZ_PNG_ARM_NEON_CHECK=
3684 if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
3685 MOZ_ARG_ENABLE_STRING(png-arm-neon-support,
3686 [ --enable-png-arm-neon-support=TYPE
3690 nocheck (faster but unsafe)],
3691 [MOZ_PNG_ARM_NEON_SUPPORT=$enableval ] )
3692 case "$MOZ_PNG_ARM_NEON_SUPPORT" in
3694 # enable-png-arm-neon-support = no
3697 # enable-png-arm-neon-support = nocheck
3702 MOZ_PNG_ARM_NEON_CHECK=1
3707 AC_SUBST(MOZ_PNG_ARM_NEON_CHECK)
3709 fi # SKIP_LIBRARY_CHECKS
3711 AC_SUBST(MOZ_PNG_ARM_NEON)
3713 dnl ========================================================
3714 dnl system HunSpell Support
3715 dnl ========================================================
3716 MOZ_ARG_ENABLE_BOOL(system-hunspell,
3717 [ --enable-system-hunspell
3718 Use system hunspell (located with pkgconfig)],
3719 MOZ_NATIVE_HUNSPELL=1 )
3721 if test -n "$MOZ_NATIVE_HUNSPELL"; then
3722 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
3725 AC_SUBST(MOZ_NATIVE_HUNSPELL)
3727 dnl ========================================================
3728 dnl system libffi Support
3729 dnl ========================================================
3732 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
3733 if test "$OS_ARCH" = "WINNT"; then
3737 MOZ_ARG_ENABLE_BOOL(shared-js,
3738 [ --enable-shared-js
3739 Create a shared JavaScript library.],
3740 JS_SHARED_LIBRARY=1,
3743 dnl ========================================================
3744 dnl Java SDK support
3745 dnl ========================================================
3748 MOZ_ARG_WITH_STRING(java-bin-path,
3749 [ --with-java-bin-path=dir
3750 Location of Java binaries (java, javac, jar)],
3751 JAVA_BIN_PATH=$withval)
3753 dnl ========================================================
3757 dnl ========================================================
3759 MOZ_ARG_HEADER(Application)
3762 ENABLE_SYSTEM_EXTENSION_DIRS=1
3763 MOZ_BRANDING_DIRECTORY=
3764 MOZ_OFFICIAL_BRANDING=
3767 MOZ_AUTH_EXTENSION=1
3772 MOZ_SAMPLE_TYPE_FLOAT32=
3773 MOZ_SAMPLE_TYPE_S16=
3779 if test -n "$MOZ_FMP4"; then
3789 MOZ_WEBRTC_SIGNALING=
3790 MOZ_WEBRTC_ASSERT_ALWAYS=1
3793 MOZ_MEDIA_NAVIGATOR=
3796 MOZ_VPX_ERROR_CONCEALMENT=
3806 LIBJPEG_TURBO_ASFLAGS=
3807 LIBJPEG_TURBO_X86_ASM=
3808 LIBJPEG_TURBO_X64_ASM=
3809 LIBJPEG_TURBO_ARM_ASM=
3813 MOZ_PREF_EXTENSIONS=1
3814 MOZ_PROFILELOCKING=1
3821 MOZ_TOOLKIT_SEARCH=1
3823 MOZ_UNIVERSALCHARDET=1
3829 MOZ_DISABLE_CRYPTOLEGACY=
3832 NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device"
3833 if test -n "$MOZ_RTSP"; then
3834 NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp"
3838 MOZ_USE_NATIVE_POPUP_WINDOWS=
3839 MOZ_ANDROID_HISTORY=
3842 MOZ_LOCALE_SWITCHER=
3843 MOZ_ANDROID_SEARCH_ACTIVITY=
3844 MOZ_ANDROID_MLS_STUMBLER=
3848 MOZ_AUDIO_CHANNEL_MANAGER=
3850 MOZ_CONTENT_SANDBOX=
3852 JSGC_USE_EXACT_ROOTING=1
3855 case "$target_os" in
3858 AC_DEFINE(NS_ENABLE_TSF)
3863 *-android*|*-linuxandroid*)
3864 if test "$CPU_ARCH" = "arm" ; then
3869 MOZ_THEME_FASTSTRIPE=1
3877 MOZ_ARG_WITH_STRING(external-source-dir,
3878 [ --with-external-source-dir=dir
3879 External directory containing additional build files.],
3880 [ EXTERNAL_SOURCE_DIR=$withval])
3881 AC_SUBST(EXTERNAL_SOURCE_DIR)
3883 MOZ_ARG_ENABLE_STRING(application,
3884 [ --enable-application=APP
3888 tools/update-packaging (AUS-related packaging tools)],
3889 [ MOZ_BUILD_APP=$enableval ] )
3891 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
3892 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
3893 XULRUNNER_STUB_NAME=$withval)
3895 if test -z "$XULRUNNER_STUB_NAME"; then
3896 case "$target_os" in
3898 XULRUNNER_STUB_NAME=xulrunner
3901 XULRUNNER_STUB_NAME=xulrunner-stub
3904 AC_SUBST(XULRUNNER_STUB_NAME)
3906 AC_MSG_CHECKING([for application to build])
3907 if test -z "$MOZ_BUILD_APP"; then
3908 AC_MSG_RESULT([browser])
3909 MOZ_BUILD_APP=browser
3911 # "mobile" no longer exists.
3912 if test "$MOZ_BUILD_APP" = "mobile" ; then
3913 AC_MSG_RESULT([none])
3914 AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
3916 # We have a valid application only if it has a build.mk file in its top
3918 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
3919 AC_MSG_RESULT([none])
3920 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
3922 AC_MSG_RESULT([$MOZ_BUILD_APP])
3926 # The app update channel is 'default' when not supplied. The value is used in
3927 # the application's confvars.sh so it must be set before confvars.sh is called.
3928 MOZ_ARG_ENABLE_STRING([update-channel],
3929 [ --enable-update-channel=CHANNEL
3930 Select application update channel (default=default)],
3931 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
3933 if test -z "$MOZ_UPDATE_CHANNEL"; then
3934 MOZ_UPDATE_CHANNEL=default
3936 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
3937 AC_SUBST(MOZ_UPDATE_CHANNEL)
3939 # Allow to specify a Mozilla API key file that contains the secret key to be
3940 # used for various Mozilla API requests.
3941 MOZ_ARG_WITH_STRING(mozilla-api-keyfile,
3942 [ --with-mozilla-api-keyfile=file Use the secret key contained in the given keyfile for Mozilla API requests],
3943 MOZ_MOZILLA_API_KEY=`cat $withval`)
3944 if test -z "$MOZ_MOZILLA_API_KEY"; then
3945 MOZ_MOZILLA_API_KEY=no-mozilla-api-key
3947 AC_SUBST(MOZ_MOZILLA_API_KEY)
3949 # Allow to specify a Google API key file that contains the secret key to be
3950 # used for various Google API requests.
3951 MOZ_ARG_WITH_STRING(google-api-keyfile,
3952 [ --with-google-api-keyfile=file Use the secret key contained in the given keyfile for Google API requests],
3953 MOZ_GOOGLE_API_KEY=`cat $withval`)
3954 if test -z "$MOZ_GOOGLE_API_KEY"; then
3955 MOZ_GOOGLE_API_KEY=no-google-api-key
3957 AC_SUBST(MOZ_GOOGLE_API_KEY)
3959 # Allow specifying a Bing API key file that contains the client ID and the
3960 # secret key to be used for the Bing Translation API requests.
3961 MOZ_ARG_WITH_STRING(bing-api-keyfile,
3962 [ --with-bing-api-keyfile=file Use the client id and secret key contained in the given keyfile for Bing API requests],
3963 [MOZ_BING_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
3964 MOZ_BING_API_KEY=`cat $withval | cut -f 2 -d " "`])
3965 if test -z "$MOZ_BING_API_CLIENTID"; then
3966 MOZ_BING_API_CLIENTID=no-bing-api-clientid
3967 MOZ_BING_API_KEY=no-bing-api-key
3969 AC_SUBST(MOZ_BING_API_CLIENTID)
3970 AC_SUBST(MOZ_BING_API_KEY)
3972 # Allow the application to influence configure with a confvars.sh script.
3973 AC_MSG_CHECKING([if app-specific confvars.sh exists])
3974 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
3975 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
3976 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
3981 # Allow influencing configure with a defines.sh script.
3982 . "${srcdir}/build/defines.sh"
3984 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
3986 if test "$BUILDING_RELEASE"; then
3987 # Override value in defines.sh, if any
3988 EARLY_BETA_OR_EARLIER=
3989 elif test "$EARLY_BETA_OR_EARLIER"; then
3990 AC_DEFINE(EARLY_BETA_OR_EARLIER)
3992 AC_SUBST(EARLY_BETA_OR_EARLIER)
3994 # Allow the application to provide a subconfigure script
3995 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
3996 do_output_subdirs() {
3997 if test -n "$_subconfigure_subdirs"; then
3998 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4000 _subconfigure_subdir="$1"
4001 _subconfigure_config_args="$ac_configure_args"
4003 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4004 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4005 "${srcdir}/build/autoconf/altoptions.m4" \
4006 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4011 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4012 MOZ_ARG_WITH_STRING(app-name,
4013 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4014 WITH_APP_NAME=$withval,
4017 if test -n "$WITH_APP_NAME" ; then
4018 MOZ_APP_NAME="$WITH_APP_NAME"
4021 MOZ_ARG_WITH_STRING(app-basename,
4022 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4023 WITH_APP_BASENAME=$withval,
4026 if test -n "$WITH_APP_BASENAME" ; then
4027 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4030 # Now is a good time to test for logic errors, define mismatches, etc.
4031 case "$MOZ_BUILD_APP" in
4033 if test "$LIBXUL_SDK"; then
4034 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4039 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4040 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4042 case "$MOZ_BUILD_APP" in
4044 AC_DEFINE(MOZ_PHOENIX)
4048 AC_DEFINE(MOZ_XULRUNNER)
4055 AC_DEFINE(MOZ_MULET)
4059 AC_SUBST(MOZ_BUILD_APP)
4060 AC_SUBST(MOZ_PHOENIX)
4061 AC_SUBST(MOZ_XULRUNNER)
4064 AC_SUBST(MOZ_B2G_VERSION)
4066 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4068 dnl ========================================================
4069 dnl Check Android SDK version depending on mobile target.
4070 dnl ========================================================
4072 if test -z "$gonkdir" ; then
4073 # Minimum Android SDK API Level we require.
4074 case "$MOZ_BUILD_APP" in
4076 android_min_api_level=17
4078 *-android*|*-linuxandroid*)
4082 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])
4088 MOZ_ANDROID_SDK($android_min_api_level)
4091 dnl ========================================================
4093 dnl = Toolkit Options
4095 dnl ========================================================
4096 MOZ_ARG_HEADER(Toolkit Options)
4098 dnl ========================================================
4099 dnl = Select the default toolkit
4100 dnl ========================================================
4101 MOZ_ARG_ENABLE_STRING(default-toolkit,
4102 [ --enable-default-toolkit=TK
4103 Select default toolkit
4104 Platform specific defaults:
4105 Mac OS X - cairo-cocoa
4106 Win32 - cairo-windows
4110 [ _DEFAULT_TOOLKIT=$enableval ],
4111 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4113 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4114 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4115 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4116 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4117 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4118 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4119 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4120 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4121 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4123 dnl nglayout only supports building with one toolkit,
4124 dnl so ignore everything after the first comma (",").
4125 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4127 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4130 MOZ_ARG_WITHOUT_BOOL(x,
4131 [ --without-x Build without X11],
4134 dnl ========================================================
4135 dnl = Enable the toolkit as needed =
4136 dnl ========================================================
4140 case "$MOZ_WIDGET_TOOLKIT" in
4143 MOZ_WIDGET_TOOLKIT=windows
4146 MOZ_INSTRUMENT_EVENT_LOOP=1
4147 if test -n "$GNU_CC"; then
4153 MOZ_WIDGET_TOOLKIT=gtk3
4156 MOZ_ENABLE_XREMOTE=1
4158 MOZ_GL_DEFAULT_PROVIDER=GLX
4164 TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4165 TK_LIBS='$(MOZ_GTK3_LIBS)'
4167 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4169 MOZ_INSTRUMENT_EVENT_LOOP=1
4172 cairo-gtk2|cairo-gtk2-x11)
4173 MOZ_WIDGET_TOOLKIT=gtk2
4176 MOZ_ENABLE_XREMOTE=1
4178 MOZ_GL_DEFAULT_PROVIDER=GLX
4184 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4185 TK_LIBS='$(MOZ_GTK2_LIBS)'
4186 AC_DEFINE(MOZ_WIDGET_GTK2)
4188 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4190 MOZ_INSTRUMENT_EVENT_LOOP=1
4194 MOZ_WIDGET_TOOLKIT=qt
4196 if test -z "$WITHOUT_X11"; then
4197 MOZ_ENABLE_XREMOTE=1
4198 MOZ_GL_DEFAULT_PROVIDER=GLX
4206 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4207 TK_LIBS='$(MOZ_QT_LIBS)'
4208 AC_DEFINE(MOZ_WIDGET_QT)
4210 AC_DEFINE(QT_NO_KEYWORDS)
4214 MOZ_WIDGET_TOOLKIT=cocoa
4215 AC_DEFINE(MOZ_WIDGET_COCOA)
4216 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4217 # Use -Wl as a trick to avoid -framework and framework names from
4218 # being separated by AC_SUBST_LIST.
4219 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'
4220 TK_CFLAGS="-DNO_X11"
4221 CFLAGS="$CFLAGS $TK_CFLAGS"
4222 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4223 MOZ_USER_DIR="Mozilla"
4224 MOZ_FS_LAYOUT=bundle
4226 MOZ_INSTRUMENT_EVENT_LOOP=1
4230 MOZ_WIDGET_TOOLKIT=uikit
4231 AC_DEFINE(MOZ_WIDGET_UIKIT)
4232 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4233 TK_CFLAGS="-DNO_X11"
4234 TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText'
4235 CFLAGS="$CFLAGS $TK_CFLAGS"
4236 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4237 MOZ_USER_DIR="Mozilla"
4238 MOZ_FS_LAYOUT=bundle
4242 AC_DEFINE(MOZ_WIDGET_ANDROID)
4243 MOZ_WIDGET_TOOLKIT=android
4244 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4245 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4248 MOZ_INSTRUMENT_EVENT_LOOP=1
4252 AC_DEFINE(MOZ_WIDGET_GONK)
4253 AC_DEFINE(MOZ_TOUCH)
4254 MOZ_WIDGET_TOOLKIT=gonk
4255 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4256 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4260 MOZ_INSTRUMENT_EVENT_LOOP=1
4265 AC_SUBST(MOZ_PDF_PRINTING)
4266 if test "$MOZ_PDF_PRINTING"; then
4267 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4268 AC_DEFINE(MOZ_PDF_PRINTING)
4271 if test "$MOZ_ENABLE_XREMOTE"; then
4272 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4275 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4276 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4279 if test "$COMPILE_ENVIRONMENT"; then
4280 if test "$MOZ_ENABLE_GTK3"; then
4281 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4282 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
4284 if test "$MOZ_ENABLE_GTK"; then
4285 if test "$MOZ_X11"; then
4286 GDK_PACKAGES=gdk-x11-2.0
4289 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4290 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
4293 fi # COMPILE_ENVIRONMENT
4295 AC_SUBST(MOZ_FS_LAYOUT)
4297 dnl ========================================================
4298 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4299 dnl their usage and use them in spidermonkey.
4300 dnl ========================================================
4301 MOZ_ARG_WITH_BOOL(arm-kuser,
4302 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4304 if test -n "$USE_ARM_KUSER"; then
4305 AC_DEFINE(USE_ARM_KUSER)
4308 dnl ========================================================
4309 dnl = startup-notification support module
4310 dnl ========================================================
4312 if test "$MOZ_ENABLE_GTK"
4314 MOZ_ENABLE_STARTUP_NOTIFICATION=
4316 MOZ_ARG_ENABLE_BOOL(startup-notification,
4317 [ --enable-startup-notification
4318 Enable startup-notification support (default: disabled) ],
4319 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4320 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4321 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4323 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4324 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4325 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4326 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4328 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4330 MOZ_ENABLE_STARTUP_NOTIFICATION=
4334 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4335 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4338 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4340 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4342 dnl ========================================================
4343 dnl Disable printing
4344 dnl ========================================================
4345 MOZ_ARG_DISABLE_BOOL(printing,
4346 [ --disable-printing Disable printing support],
4350 if test "$NS_PRINTING"; then
4351 AC_DEFINE(NS_PRINTING)
4352 AC_DEFINE(NS_PRINT_PREVIEW)
4355 dnl ========================================================
4357 dnl ========================================================
4358 if test "$MOZ_ENABLE_QT"
4360 MOZ_ARG_WITH_STRING(qtdir,
4361 [ --with-qtdir=\$dir Specify Qt directory ],
4364 if test -z "$QTDIR"; then
4365 AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4367 HOST_QMAKE="$QTDIR/bin/qmake"
4369 QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4371 if test -z "$QTDIR"; then
4374 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4375 PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5Quick, ,
4377 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4379 QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4380 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4381 if test "$NS_PRINTING"; then
4382 PKG_CHECK_MODULES(MOZ_QT_WIDGETS, Qt5PrintSupport, ,
4384 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase widgets development package])
4386 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT_WIDGETS_LIBS"
4387 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT_WIDGETS_CFLAGS"
4391 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4395 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4396 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4398 MOZ_QT_CFLAGS="-DQT_SHARED"
4399 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4400 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4401 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4402 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4403 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4404 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4407 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4408 MOZ_QT_LIBS="$MOZ_QT_LIBS -L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml"
4409 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4410 if test "$NS_PRINTING"; then
4411 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4412 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4416 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4420 HOST_MOC="$QTDIR/bin/moc"
4421 HOST_RCC="$QTDIR/bin/rcc"
4423 if test -z "$HOST_MOC"; then
4424 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4426 if test -z "$HOST_RCC"; then
4427 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4433 MOZ_ENABLE_QMSYSTEM2=
4434 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4435 MOZ_ENABLE_QMSYSTEM2=1,
4436 MOZ_ENABLE_QMSYSTEM2=)
4438 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4439 MOZ_ENABLE_QMSYSTEM2=1
4440 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4441 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4442 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4445 MOZ_ENABLE_QTNETWORK=
4446 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4447 MOZ_ENABLE_QTNETWORK=1,
4448 MOZ_ENABLE_QTNETWORK=)
4450 if test "$MOZ_ENABLE_QTNETWORK"; then
4451 MOZ_ENABLE_QTNETWORK=1
4452 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4455 MOZ_ENABLE_QTMOBILITY=
4456 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4457 MOZ_ENABLE_QTMOBILITY=1,
4458 MOZ_ENABLE_QTMOBILITY=)
4459 if test "$MOZ_ENABLE_QTMOBILITY"; then
4460 MOZ_ENABLE_QTMOBILITY=1
4461 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4462 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4463 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4464 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4466 AC_CHECK_LIB(QtSensors, main, [
4467 MOZ_ENABLE_QTMOBILITY=1
4468 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4469 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4470 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4471 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4472 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4476 MOZ_ENABLE_QT5FEEDBACK=
4477 PKG_CHECK_MODULES(_QT5FEEDBACK, Qt0Feedback,
4478 MOZ_ENABLE_QT5FEEDBACK=1,
4479 MOZ_ENABLE_QT5FEEDBACK=)
4480 if test "$MOZ_ENABLE_QT5FEEDBACK"; then
4481 MOZ_ENABLE_QT5FEEDBACK=1
4482 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5FEEDBACK_CFLAGS"
4483 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5FEEDBACK_LIBS"
4484 AC_DEFINE(MOZ_ENABLE_QT5FEEDBACK)
4485 AC_SUBST(MOZ_ENABLE_QT5FEEDBACK)
4488 MOZ_ENABLE_QT5GEOPOSITION=
4489 PKG_CHECK_MODULES(_QT5GEOPOSITION, Qt5Positioning,
4490 MOZ_ENABLE_QT5GEOPOSITION=1,
4491 MOZ_ENABLE_QT5GEOPOSITION=)
4492 if test "$MOZ_ENABLE_QT5GEOPOSITION"; then
4493 MOZ_ENABLE_QT5GEOPOSITION=1
4494 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5GEOPOSITION_CFLAGS"
4495 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5GEOPOSITION_LIBS"
4496 AC_DEFINE(MOZ_ENABLE_QT5GEOPOSITION)
4497 AC_SUBST(MOZ_ENABLE_QT5GEOPOSITION)
4500 if test "$MOZ_ENABLE_CONTENTACTION"; then
4501 MOZ_ENABLE_CONTENTACTION=1
4502 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4505 MOZ_ENABLE_CONTENTACTION=
4506 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
4507 if test "$MOZ_ENABLE_CONTENTACTION"; then
4508 MOZ_ENABLE_CONTENTACTION=1
4509 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
4510 MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
4511 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4512 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
4516 AC_SUBST(GTK_CONFIG)
4517 AC_SUBST_LIST(TK_CFLAGS)
4518 AC_SUBST_LIST(TK_LIBS)
4520 AC_SUBST(MOZ_ENABLE_GTK2)
4521 AC_SUBST(MOZ_ENABLE_GTK3)
4522 AC_SUBST(MOZ_ENABLE_GTK)
4523 AC_SUBST(MOZ_ENABLE_QT)
4524 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4525 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4526 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4527 AC_SUBST(MOZ_ENABLE_XREMOTE)
4528 AC_SUBST(MOZ_WIDGET_GTK)
4529 AC_SUBST_LIST(MOZ_QT_CFLAGS)
4530 AC_SUBST_LIST(MOZ_QT_LIBS)
4537 dnl ========================================================
4539 dnl = Components & Features
4541 dnl ========================================================
4542 MOZ_ARG_HEADER(Components and Features)
4544 dnl ========================================================
4546 dnl ========================================================
4547 MOZ_ARG_ENABLE_STRING(ui-locale,
4548 [ --enable-ui-locale=ab-CD
4549 Select the user interface locale (default: en-US)],
4550 MOZ_UI_LOCALE=$enableval )
4551 AC_SUBST(MOZ_UI_LOCALE)
4553 dnl ========================================================
4554 dnl = Trademarked Branding
4555 dnl ========================================================
4556 MOZ_ARG_ENABLE_BOOL(official-branding,
4557 [ --enable-official-branding
4558 Enable Official mozilla.org Branding
4559 Do not distribute builds with
4560 --enable-official-branding unless you have
4561 permission to use trademarks per
4562 http://www.mozilla.org/foundation/trademarks/ .],
4564 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4565 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4567 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4568 MOZ_OFFICIAL_BRANDING=1
4570 ], MOZ_OFFICIAL_BRANDING=)
4572 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4573 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4574 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4577 MOZ_ARG_WITH_STRING(branding,
4578 [ --with-branding=dir Use branding from the specified directory.],
4579 MOZ_BRANDING_DIRECTORY=$withval)
4581 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4582 if test -z "$REAL_BRANDING_DIRECTORY"; then
4583 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4586 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4587 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4588 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4589 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
4592 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4594 dnl ========================================================
4595 dnl = Distribution ID
4596 dnl ========================================================
4597 MOZ_ARG_WITH_STRING(distribution-id,
4598 [ --with-distribution-id=ID
4599 Set distribution-specific id (default=org.mozilla)],
4600 [ val=`echo $withval`
4601 MOZ_DISTRIBUTION_ID="$val"])
4603 if test -z "$MOZ_DISTRIBUTION_ID"; then
4604 MOZ_DISTRIBUTION_ID="org.mozilla"
4607 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4608 AC_SUBST(MOZ_DISTRIBUTION_ID)
4611 dnl ========================================================
4613 dnl ========================================================
4614 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4616 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4618 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4621 dnl ========================================================
4622 dnl = GnomeVFS, GIO and GConf support module
4623 dnl ========================================================
4627 dnl build the GIO extension by default only when the
4628 dnl GTK2 toolkit is in use.
4629 if test "$MOZ_ENABLE_GTK"
4635 dnl ========================================================
4636 dnl = GnomeVFS support module
4637 dnl ========================================================
4638 MOZ_ARG_ENABLE_BOOL(gnomevfs,
4639 [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
4640 MOZ_ENABLE_GNOMEVFS=force,
4641 MOZ_ENABLE_GNOMEVFS=)
4643 if test "$MOZ_ENABLE_GNOMEVFS"
4645 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4646 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4647 MOZ_ENABLE_GNOMEVFS=1
4648 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4650 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4652 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4654 MOZ_ENABLE_GNOMEVFS=
4658 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4660 dnl ========================================================
4661 dnl = GIO support module
4662 dnl ========================================================
4663 MOZ_ARG_DISABLE_BOOL(gio,
4664 [ --disable-gio Disable GIO support],
4666 MOZ_ENABLE_GIO=force)
4668 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
4670 if test "$MOZ_ENABLE_GTK2"
4672 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4673 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4675 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4676 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4678 AC_DEFINE(MOZ_ENABLE_GIO)
4680 if test "$MOZ_ENABLE_GIO" = "force"
4682 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4688 AC_SUBST(MOZ_ENABLE_GIO)
4690 dnl ========================================================
4691 dnl = GConf support module
4692 dnl ========================================================
4693 MOZ_ARG_DISABLE_BOOL(gconf,
4694 [ --disable-gconf Disable Gconf support ],
4696 MOZ_ENABLE_GCONF=force)
4698 if test "$MOZ_ENABLE_GCONF"
4700 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4701 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4704 if test "$MOZ_ENABLE_GCONF" = "force"
4706 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4712 if test "$MOZ_ENABLE_GCONF"; then
4713 AC_DEFINE(MOZ_ENABLE_GCONF)
4716 AC_SUBST(MOZ_ENABLE_GCONF)
4719 dnl ========================================================
4720 dnl = libproxy support
4721 dnl ========================================================
4723 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4725 MOZ_ENABLE_LIBPROXY=
4727 MOZ_ARG_ENABLE_BOOL(libproxy,
4728 [ --enable-libproxy Enable libproxy support ],
4729 MOZ_ENABLE_LIBPROXY=1,
4730 MOZ_ENABLE_LIBPROXY=)
4732 if test "$MOZ_ENABLE_LIBPROXY"
4734 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4735 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4738 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4740 dnl ========================================================
4741 dnl = GNOME component (mozgnome)
4742 dnl ========================================================
4744 if test "$MOZ_ENABLE_GTK"
4746 MOZ_ENABLE_GNOME_COMPONENT=1
4748 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4750 dnl ========================================================
4751 dnl = libgnomeui support module
4752 dnl ========================================================
4754 if test "$MOZ_ENABLE_GTK"
4756 MOZ_ARG_ENABLE_BOOL(gnomeui,
4757 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
4758 MOZ_ENABLE_GNOMEUI=force,
4759 MOZ_ENABLE_GNOMEUI=)
4761 if test "$MOZ_ENABLE_GNOMEUI"
4763 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4765 MOZ_ENABLE_GNOMEUI=1
4767 if test "$MOZ_ENABLE_GNOMEUI" = "force"
4769 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4775 if test "$MOZ_ENABLE_GNOMEUI"; then
4776 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4780 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4782 dnl ========================================================
4784 dnl ========================================================
4786 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4790 MOZ_ARG_DISABLE_BOOL(dbus,
4791 [ --disable-dbus Disable dbus support ],
4795 if test "$MOZ_ENABLE_DBUS"
4797 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
4798 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
4799 AC_DEFINE(MOZ_ENABLE_DBUS)
4802 AC_SUBST(MOZ_ENABLE_DBUS)
4804 dnl ========================================================
4805 dnl = Enable Android History instead of Places
4806 dnl ========================================================
4807 if test -n "$MOZ_ANDROID_HISTORY"; then
4808 if test -z "$MOZ_PLACES"; then
4809 AC_DEFINE(MOZ_ANDROID_HISTORY)
4811 AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
4815 dnl ========================================================
4816 dnl = Build with the Android compositor
4817 dnl ========================================================
4818 if test -n "$MOZ_ANDROID_OMTC"; then
4819 dnl Do this if defined in confvars.sh
4820 AC_DEFINE(MOZ_ANDROID_OMTC)
4823 dnl ========================================================
4824 dnl = Enable the C++ async pan/zoom code instead of the Java version
4825 dnl ========================================================
4826 MOZ_ARG_ENABLE_BOOL(android-apz,
4827 [ --enable-android-apz Switch to C++ pan/zoom code],
4830 if test -n "$MOZ_ANDROID_APZ"; then
4831 dnl Do this if defined in confvars.sh
4832 AC_DEFINE(MOZ_ANDROID_APZ)
4835 dnl ========================================================
4836 dnl = Disable WebSMS backend
4837 dnl ========================================================
4838 MOZ_ARG_DISABLE_BOOL(websms-backend,
4839 [ --disable-websms-backend
4840 Disable WebSMS backend],
4841 MOZ_WEBSMS_BACKEND=,
4842 MOZ_WEBSMS_BACKEND=1)
4844 if test -n "$MOZ_WEBSMS_BACKEND"; then
4845 AC_DEFINE(MOZ_WEBSMS_BACKEND)
4848 dnl ========================================================
4849 dnl = Enable runtime locale switching on Android
4850 dnl ========================================================
4851 if test -n "$MOZ_LOCALE_SWITCHER"; then
4852 AC_DEFINE(MOZ_LOCALE_SWITCHER)
4855 dnl ========================================================
4856 dnl = Enable NFC permission on Android
4857 dnl ========================================================
4858 if test -n "$MOZ_ANDROID_BEAM"; then
4859 AC_DEFINE(MOZ_ANDROID_BEAM)
4862 dnl ========================================================
4863 dnl = Include Search Activity on Android
4864 dnl ========================================================
4865 if test -n "$MOZ_ANDROID_SEARCH_ACTIVITY"; then
4866 AC_DEFINE(MOZ_ANDROID_SEARCH_ACTIVITY)
4869 dnl ========================================================
4870 dnl = Include Mozilla Location Service Stumbler on Android
4871 dnl ========================================================
4872 if test -n "$MOZ_ANDROID_MLS_STUMBLER"; then
4873 AC_DEFINE(MOZ_ANDROID_MLS_STUMBLER)
4876 dnl ========================================================
4877 dnl = Enable IPDL's "expensive" unit tests
4878 dnl ========================================================
4881 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
4882 [ --enable-ipdl-tests Enable expensive IPDL tests],
4886 if test -n "$MOZ_IPDL_TESTS"; then
4887 AC_DEFINE(MOZ_IPDL_TESTS)
4890 AC_SUBST(MOZ_IPDL_TESTS)
4892 dnl ========================================================
4893 dnl = Disable building dbm
4894 dnl ========================================================
4895 MOZ_ARG_DISABLE_BOOL(dbm,
4896 [ --disable-dbm Disable building dbm],
4900 dnl ========================================================
4901 dnl accessibility support on by default on all platforms
4902 dnl ========================================================
4903 MOZ_ARG_DISABLE_BOOL(accessibility,
4904 [ --disable-accessibility Disable accessibility support],
4907 if test "$ACCESSIBILITY"; then
4910 if test -z "$MIDL"; then
4911 if test "$GCC" != "yes"; then
4912 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
4914 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.])
4918 AC_DEFINE(ACCESSIBILITY)
4921 dnl ========================================================
4922 dnl Accessibility is required for the linuxgl widget
4924 dnl ========================================================
4925 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
4926 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
4929 dnl Turn off webrtc for OS's we don't handle yet, but allow
4930 dnl --enable-webrtc to override. Can disable for everything in
4931 dnl the master list above.
4932 if test -n "$MOZ_WEBRTC"; then
4934 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
4938 dnl default to disabled for all others
4944 AC_TRY_COMPILE([#include <linux/ethtool.h>],
4945 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
4946 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
4948 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
4950 # target_arch is from {ia32|x64|arm|ppc}
4952 x86_64 | arm | x86 | ppc* | ia64)
4956 # unsupported arch for webrtc
4962 dnl ========================================================
4963 dnl = Disable WebRTC code
4964 dnl ========================================================
4965 MOZ_ARG_DISABLE_BOOL(webrtc,
4966 [ --disable-webrtc Disable support for WebRTC],
4970 if test -n "$MOZ_WEBRTC"; then
4971 AC_DEFINE(MOZ_WEBRTC)
4972 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
4973 dnl opt/production builds (via MOZ_CRASH())
4974 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
4977 MOZ_VPX_ERROR_CONCEALMENT=1
4979 dnl enable once Signaling lands
4980 MOZ_WEBRTC_SIGNALING=1
4981 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
4982 dnl enable once PeerConnection lands
4983 MOZ_PEERCONNECTION=1
4984 AC_DEFINE(MOZ_PEERCONNECTION)
4989 if test -n "$MOZ_X11"; then
4990 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
4996 AC_SUBST(MOZ_WEBRTC)
4997 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
4998 AC_SUBST(MOZ_WEBRTC_SIGNALING)
4999 AC_SUBST(MOZ_PEERCONNECTION)
5000 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5003 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
5005 dnl Use integers over floats for audio on B2G and Android
5006 dnl (regarless of the CPU architecture, because audio
5007 dnl backends for those platforms don't support floats. We also
5008 dnl use integers on ARM with other OS, because it's more efficient.
5009 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
5010 MOZ_SAMPLE_TYPE_S16=1
5011 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5012 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5014 MOZ_SAMPLE_TYPE_FLOAT32=1
5015 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5016 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5019 dnl ========================================================
5020 dnl = Disable Speech API code
5021 dnl ========================================================
5022 MOZ_ARG_DISABLE_BOOL(webspeech,
5023 [ --disable-webspeech Disable support for HTML Speech API],
5027 if test -n "$MOZ_WEBSPEECH"; then
5028 AC_DEFINE(MOZ_WEBSPEECH)
5031 AC_SUBST(MOZ_WEBSPEECH)
5033 dnl ========================================================
5034 dnl = Enable Raw Codecs
5035 dnl ========================================================
5036 MOZ_ARG_ENABLE_BOOL(raw,
5037 [ --enable-raw Enable support for RAW media],
5041 if test -n "$MOZ_RAW"; then
5047 dnl Checks for __attribute__(aligned()) directive need by libogg
5048 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5049 [ac_cv_c_attribute_aligned],
5050 [ac_cv_c_attribute_aligned=0
5051 CFLAGS_save="${CFLAGS}"
5052 CFLAGS="${CFLAGS} -Werror"
5053 for ac_cv_c_attr_align_try in 64 32 16 8; do
5054 echo "trying $ac_cv_c_attr_align_try"
5056 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5057 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5058 if test "$ac_cv_c_attribute_aligned" != 0; then
5062 CFLAGS="${CFLAGS_save}"])
5063 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5064 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5065 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5068 dnl ========================================================
5069 dnl = Disable Opus audio codec support
5070 dnl ========================================================
5071 MOZ_ARG_DISABLE_BOOL(opus,
5072 [ --disable-opus Disable support for Opus audio],
5076 dnl ========================================================
5077 dnl = Disable VP8 decoder support
5078 dnl ========================================================
5079 MOZ_ARG_DISABLE_BOOL(webm,
5080 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5084 if test -n "$MOZ_WEBM"; then
5089 dnl ========================================================
5090 dnl = Apple platform decoder support
5091 dnl ========================================================
5092 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5096 if test -n "$MOZ_APPLEMEDIA"; then
5097 AC_DEFINE(MOZ_APPLEMEDIA)
5098 # hack in frameworks for fmp4 - see bug 1029974
5099 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
5100 LDFLAGS="$LDFLAGS -framework AudioToolbox"
5101 dnl Verify CoreMedia is available.
5102 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
5103 [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
5106 dnl ========================================================
5107 dnl = DirectShow support
5108 dnl ========================================================
5109 if test "$OS_ARCH" = "WINNT"; then
5110 dnl Enable DirectShow support by default.
5114 MOZ_ARG_DISABLE_BOOL(directshow,
5115 [ --disable-directshow Disable support for DirectShow],
5119 if test -n "$MOZ_DIRECTSHOW"; then
5120 AC_DEFINE(MOZ_DIRECTSHOW)
5123 dnl ========================================================
5124 dnl = Windows Media Foundation support
5125 dnl ========================================================
5126 if test "$OS_ARCH" = "WINNT"; then
5127 dnl Enable Windows Media Foundation support by default.
5128 dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5129 dnl guaranteed to have a recent-enough SDK to build WMF.
5133 MOZ_ARG_DISABLE_BOOL(wmf,
5134 [ --disable-wmf Disable support for Windows Media Foundation],
5138 if test -n "$MOZ_WMF"; then
5142 dnl ========================================================
5143 dnl FFmpeg H264/AAC Decoding Support
5144 dnl ========================================================
5145 case "$OS_TARGET" in
5146 WINNT|Darwin|Android)
5153 MOZ_ARG_DISABLE_BOOL(ffmpeg,
5154 [ --disable-ffmpeg Disable FFmpeg for fragmented H264/AAC decoding],
5159 if test -n "$MOZ_FFMPEG"; then
5160 AC_DEFINE(MOZ_FFMPEG)
5163 dnl ========================================================
5164 dnl = Built-in fragmented MP4 support.
5165 dnl ========================================================
5166 if test -n "$MOZ_WMF" -o -n "$MOZ_FFMPEG" -o -n "$MOZ_APPLEMEDIA"; then
5167 dnl Enable fragmented MP4 parser on platforms with decoder support.
5171 MOZ_ARG_DISABLE_BOOL(fmp4,
5172 [ --disable-fmp4 Disable support for in built Fragmented MP4 parsing],
5176 if test -n "$MOZ_FMP4"; then
5180 dnl ========================================================
5182 dnl ========================================================
5184 MOZ_ARG_DISABLE_BOOL(eme,
5185 [ --disable-eme Disable support for Encrypted Media Extensions],
5189 if test -n "$MOZ_EME"; then
5193 dnl ========================================================
5194 dnl = Enable media plugin support
5195 dnl ========================================================
5196 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5197 dnl Enable support on android by default
5201 MOZ_ARG_ENABLE_BOOL(android-omx,
5202 [ --enable-android-omx Enable support for Android OMX media backend],
5206 if test -n "$MOZ_ANDROID_OMX"; then
5207 AC_DEFINE(MOZ_ANDROID_OMX)
5210 dnl ========================================================
5211 dnl = Enable getUserMedia support
5212 dnl ========================================================
5213 MOZ_ARG_ENABLE_BOOL(media-navigator,
5214 [ --enable-media-navigator Enable support for getUserMedia],
5215 MOZ_MEDIA_NAVIGATOR=1,
5216 MOZ_MEDIA_NAVIGATOR=)
5218 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5219 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5222 dnl ========================================================
5223 dnl = Enable building OMX media plugin (B2G or Android)
5224 dnl ========================================================
5225 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5226 dnl Enable support on android by default
5230 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5231 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5235 if test -n "$MOZ_OMX_PLUGIN"; then
5236 if test "$OS_TARGET" = "Android"; then
5237 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5238 AC_DEFINE(MOZ_OMX_PLUGIN)
5240 dnl fail if we're not building on Gonk or Android
5241 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5245 dnl system libvpx Support
5246 dnl ========================================================
5247 MOZ_ARG_WITH_BOOL(system-libvpx,
5248 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5249 MOZ_NATIVE_LIBVPX=1)
5254 if test -n "$MOZ_VPX"; then
5256 if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
5257 AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
5260 _SAVE_CFLAGS=$CFLAGS
5262 if test -n "$MOZ_NATIVE_LIBVPX"; then
5263 dnl ============================
5264 dnl === libvpx Version check ===
5265 dnl ============================
5266 dnl Check to see if we have a system libvpx package.
5267 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.3.0)
5269 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
5270 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
5272 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5273 [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.])])
5275 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5276 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5278 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
5279 [AC_CHECK_FUNC(vpx_mem_set_functions)])
5280 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
5281 "$ac_cv_func_vpx_mem_set_functions" = no; then
5282 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
5285 CFLAGS=$_SAVE_CFLAGS
5289 AC_SUBST(MOZ_NATIVE_LIBVPX)
5290 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
5291 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
5293 if test "$MOZ_WEBM"; then
5294 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5301 if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then
5303 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5304 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5305 dnl We currently require gcc on all arm platforms.
5308 VPX_NEED_OBJ_INT_EXTRACT=
5310 dnl See if we have assembly on this platform.
5311 case "$OS_ARCH:$CPU_ARCH" in
5313 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5317 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5321 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5325 dnl Check for yasm 1.1 or greater.
5326 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5327 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.])
5328 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5329 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.])
5331 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5333 dnl The encoder needs obj_int_extract to get asm offsets.
5337 if test -n "$GNU_AS" ; then
5339 dnl These flags are a lie; they're just used to enable the requisite
5340 dnl opcodes; actual arch detection is done at runtime.
5341 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5342 VPX_DASH_C_FLAG="-c"
5343 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5344 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5349 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5350 VPX_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC"
5355 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5356 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5362 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5363 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.])
5366 if test -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5367 dnl We prefer to get asm offsets using inline assembler, which the above
5368 dnl compilers can do. When we're not using one of those, we have to fall
5369 dnl back to obj_int_extract, which reads them from a compiled object
5370 dnl file. Unfortunately, that only works if we're compiling on a system
5371 dnl with the header files for the appropriate object file format.
5372 VPX_NEED_OBJ_INT_EXTRACT=1
5375 if test -n "$VPX_X86_ASM"; then
5376 AC_DEFINE(VPX_X86_ASM)
5377 elif test -n "$VPX_ARM_ASM"; then
5378 AC_DEFINE(VPX_ARM_ASM)
5380 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5384 dnl ========================================================
5385 dnl = Disable Wave decoder support
5386 dnl ========================================================
5387 MOZ_ARG_DISABLE_BOOL(wave,
5388 [ --disable-wave Disable Wave decoder support],
5392 if test -n "$MOZ_WAVE"; then
5396 dnl ========================================================
5397 dnl = Handle dependent MEDIA defines
5398 dnl ========================================================
5400 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5401 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/])
5404 if test -n "$MOZ_WEBRTC" -a -z "$MOZ_OPUS"; then
5405 AC_MSG_ERROR([MOZ_WEBRTC requires MOZ_OPUS which is disabled.])
5408 if test -n "$MOZ_VORBIS"; then
5409 AC_DEFINE(MOZ_VORBIS)
5412 if test -n "$MOZ_TREMOR"; then
5413 AC_DEFINE(MOZ_TREMOR)
5414 # Tremor doesn't have an encoder.
5418 if test -n "$MOZ_OPUS"; then
5422 if test -n "$MOZ_WEBM_ENCODER"; then
5423 AC_DEFINE(MOZ_WEBM_ENCODER)
5425 AC_SUBST(MOZ_WEBM_ENCODER)
5427 dnl ==================================
5428 dnl = Check alsa availability on Linux
5429 dnl ==================================
5431 dnl If using Linux, ensure that the alsa library is available
5432 if test "$OS_TARGET" = "Linux"; then
5436 MOZ_ARG_ENABLE_BOOL(alsa,
5437 [ --enable-alsa Enable Alsa support (default on Linux)],
5441 if test -n "$MOZ_ALSA"; then
5442 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5443 [echo "$MOZ_ALSA_PKG_ERRORS"
5444 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.)])])
5449 dnl ========================================================
5450 dnl = Disable PulseAudio
5451 dnl ========================================================
5453 dnl If using Linux, ensure that the PA library is available
5454 case "$OS_TARGET" in
5455 WINNT|Darwin|Android|OpenBSD)
5458 if test -z "$MOZ_B2G"; then
5464 MOZ_ARG_DISABLE_BOOL(pulseaudio,
5465 [ --disable-pulseaudio Disable PulseAudio support],
5469 if test -n "$MOZ_PULSEAUDIO"; then
5470 if test -z "$gonkdir"; then
5471 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5472 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5473 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
5475 MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
5479 AC_SUBST(MOZ_PULSEAUDIO)
5481 dnl ========================================================
5482 dnl = Enable GStreamer
5483 dnl ========================================================
5484 case "$OS_TARGET" in
5485 WINNT|Darwin|Android)
5489 GST_API_VERSION=0.10
5493 MOZ_ARG_ENABLE_STRING(gstreamer,
5494 [ --enable-gstreamer[=0.10] Enable GStreamer support],
5496 # API version, eg 0.10, 1.0 etc
5497 if test -z "$enableval" -o "$enableval" = "yes"; then
5498 GST_API_VERSION=0.10
5499 elif test "$enableval" = "no"; then
5502 GST_API_VERSION=$enableval
5506 if test -n "$MOZ_GSTREAMER"; then
5507 # core/base release number
5508 if test "$GST_API_VERSION" = "1.0"; then
5514 PKG_CHECK_MODULES(GSTREAMER,
5515 gstreamer-$GST_API_VERSION >= $GST_VERSION
5516 gstreamer-app-$GST_API_VERSION
5517 gstreamer-plugins-base-$GST_API_VERSION,
5518 [_HAVE_GSTREAMER=1],
5520 if test -z "$_HAVE_GSTREAMER"; then
5521 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])
5524 _SAVE_LDFLAGS=$LDFLAGS
5525 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5526 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5527 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5528 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5530 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.])
5532 LDFLAGS=$_SAVE_LDFLAGS
5535 AC_SUBST(MOZ_GSTREAMER)
5536 AC_SUBST(GST_API_VERSION)
5538 if test -n "$MOZ_GSTREAMER"; then
5539 AC_DEFINE(MOZ_GSTREAMER)
5540 AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION")
5544 dnl ========================================================
5545 dnl Permissions System
5546 dnl ========================================================
5547 MOZ_ARG_DISABLE_BOOL(permissions,
5548 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5553 dnl ========================================================
5554 dnl Child permissions, currently only used for b2g
5555 dnl ========================================================
5556 if test -n "$MOZ_B2G"; then
5557 if test -n "$MOZ_PERMISSIONS"; then
5558 MOZ_CHILD_PERMISSIONS=1
5560 AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
5563 AC_SUBST(MOZ_CHILD_PERMISSIONS)
5565 dnl ========================================================
5567 dnl ========================================================
5568 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5569 [ --disable-negotiateauth Disable GSS-API negotiation ],
5570 MOZ_AUTH_EXTENSION=,
5571 MOZ_AUTH_EXTENSION=1 )
5573 dnl ========================================================
5574 dnl Pref extensions (autoconfig)
5575 dnl ========================================================
5576 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5577 [ --disable-pref-extensions
5578 Disable pref extensions such as autoconfig],
5579 MOZ_PREF_EXTENSIONS=,
5580 MOZ_PREF_EXTENSIONS=1 )
5582 dnl ========================================================
5583 dnl Searching of system directories for extensions.
5584 dnl Note: this switch is meant to be used for test builds
5585 dnl whose behavior should not depend on what happens to be
5586 dnl installed on the local machine.
5587 dnl ========================================================
5588 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5589 [ --disable-system-extension-dirs
5590 Disable searching system- and account-global
5591 directories for extensions of any kind; use
5592 only profile-specific extension directories],
5593 ENABLE_SYSTEM_EXTENSION_DIRS=,
5594 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5595 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5596 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5599 dnl ========================================================
5600 dnl = Universalchardet
5601 dnl ========================================================
5602 MOZ_ARG_DISABLE_BOOL(universalchardet,
5603 [ --disable-universalchardet
5604 Disable universal encoding detection],
5605 MOZ_UNIVERSALCHARDET=,
5606 MOZ_UNIVERSALCHARDET=1 )
5608 if test -n "${JAVA_BIN_PATH}"; then
5609 dnl Look for javac and jar in the specified path.
5610 JAVA_PATH="$JAVA_BIN_PATH"
5612 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5613 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5616 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5617 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5618 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5619 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5620 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5621 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5623 if test -n "${JAVA_BIN_PATH}" -o \
5624 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5625 if test -z "$JAVA" -o "$JAVA" = ":"; then
5626 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}])
5628 if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5629 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}])
5631 if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5632 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}])
5634 if test -z "$JAR" -o "$JAR" = ":"; then
5635 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}])
5637 if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5638 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}])
5640 if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5641 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}])
5645 dnl ========================================================
5646 dnl = ANGLE OpenGL->D3D translator for WebGL
5647 dnl = * only applies to win32
5648 dnl ========================================================
5652 MOZ_HAS_WINSDK_WITH_D3D=
5653 MOZ_D3DCOMPILER_VISTA_DLL=
5654 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5655 MOZ_DIRECTX_SDK_PATH=
5656 MOZ_D3DCOMPILER_XP_DLL=
5657 MOZ_D3DCOMPILER_XP_CAB=
5659 case "$target_os" in
5661 MOZ_ANGLE_RENDERER=1
5665 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5666 case "${target_cpu}" in
5668 MOZ_D3D_CPU_SUFFIX=x86
5671 MOZ_D3D_CPU_SUFFIX=x64
5675 MOZ_ARG_DISABLE_BOOL(webgl,
5676 [ --disable-webgl Disable building of the WebGL implementation],
5677 MOZ_WEBGL_DISABLED=1,
5678 MOZ_WEBGL_DISABLED=)
5680 MOZ_ARG_ENABLE_BOOL(require-all-d3dc-versions,
5681 [ --enable-require-all-d3dc-versions Require all versions of the D3D compiler needed for supported Windows systems.],
5682 MOZ_REQUIRE_ALL_D3DCS=1,
5683 MOZ_REQUIRE_ALL_D3DCS=)
5685 if test -n "$MOZ_WEBGL_DISABLED"; then
5690 if test -n "$MOZ_WEBGL"; then
5691 AC_DEFINE(MOZ_WEBGL)
5694 if test -n "$MOZ_WEBGL_CONFORMANT"; then
5695 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
5698 dnl ========================================================
5699 dnl D3D compiler DLL
5700 dnl ========================================================
5701 MOZ_FOUND_D3D_COMPILERS=
5703 if test -n "$MOZ_ANGLE_RENDERER"; then
5704 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
5705 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
5708 ######################################
5709 # Find _46+ for use by Vista+.
5711 # Find a D3D compiler DLL in a Windows SDK.
5712 MOZ_D3DCOMPILER_VISTA_DLL=
5713 case "$MOZ_WINSDK_MAXVER" in
5715 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
5716 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
5719 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_46.dll
5720 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.0.])
5724 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5725 # We have a name, now track down the path.
5726 if test -n "$WINDOWSSDKDIR"; then
5727 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
5728 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5729 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5730 MOZ_HAS_WINSDK_WITH_D3D=1
5732 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5733 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
5734 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5737 AC_MSG_RESULT([Windows SDK not found.])
5741 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5742 MOZ_D3DCOMPILER_VISTA_DLL=
5745 # On mingw, check if headers are provided by toolchain.
5746 if test -n "$GNU_CC"; then
5747 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
5750 ######################################
5751 # Find _43 for use by XP.
5753 # Get the SDK path from the registry.
5754 # First try to get the June 2010 SDK
5755 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5756 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5757 # Otherwise just take whatever comes first
5758 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5760 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'`
5762 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5763 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/dxguid.lib ; then
5764 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5766 AC_MSG_RESULT([DirectX SDK not found.])
5767 MOZ_DIRECTX_SDK_PATH=
5770 # Check that our DirectX SDK is acceptable.
5771 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5772 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5773 AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
5774 MOZ_DIRECTX_SDK_PATH=
5778 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5779 # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
5780 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5781 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'`
5783 if test -n "$MOZ_D3DX9_VERSION" ; then
5784 MOZ_D3DCOMPILER_XP_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_D3D_CPU_SUFFIX}.cab | head -n1`
5786 if test -n "$MOZ_D3DCOMPILER_XP_CAB"; then
5787 MOZ_D3DCOMPILER_XP_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5789 AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
5790 AC_MSG_ERROR([DirectX SDK at "$MOZ_DIRECTX_SDK_PATH" appears broken.])
5791 MOZ_DIRECTX_SDK_PATH=
5794 AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
5795 MOZ_DIRECTX_SDK_PATH=
5798 AC_MSG_RESULT([Couldn't find an acceptable DirectX SDK for ANGLE, needed for d3dcompiler_43.])
5799 AC_MSG_RESULT([ Either ignore, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5802 ######################################
5803 # Check that we found what we needed.
5804 MOZ_FOUND_A_D3D_COMPILER=
5805 MOZ_FOUND_BOTH_D3D_COMPILERS=1
5807 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5808 MOZ_FOUND_A_D3D_COMPILER=1
5809 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
5811 MOZ_FOUND_BOTH_D3D_COMPILERS=
5814 if test -n "$MOZ_D3DCOMPILER_XP_DLL"; then
5815 MOZ_FOUND_A_D3D_COMPILER=1
5816 AC_MSG_RESULT([Found d3dcompiler DLL for XP: $MOZ_D3DCOMPILER_XP_DLL])
5818 MOZ_FOUND_BOTH_D3D_COMPILERS=
5821 if test -z "$CROSS_COMPILE"; then
5822 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
5823 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
5824 AC_MSG_ERROR([ Either install Windows SDK 8.0+, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5827 if test -n "$MOZ_REQUIRE_ALL_D3DCS" -a -z "$MOZ_FOUND_BOTH_D3D_COMPILERS"; then
5828 AC_MSG_ERROR([Both D3D compilers _43 and _46+ are required by --enable-require-d3d-compilers.])
5829 AC_MSG_ERROR([ Install Windows SDK 8.0+, as well as DirectX SDK (June 2010 version or newer), or reconfigure without this flag.])
5835 dnl ========================================================
5837 dnl ========================================================
5839 MOZ_GAMEPAD_BACKEND=stub
5841 # Gamepad DOM is built on supported platforms by default.
5842 case "$OS_TARGET" in
5847 if test "$MOZ_WIDGET_TOOLKIT" != "gonk"; then
5855 MOZ_ARG_DISABLE_BOOL(gamepad,
5856 [ --disable-gamepad Disable gamepad support],
5860 if test "$MOZ_GAMEPAD"; then
5861 case "$OS_TARGET" in
5863 MOZ_GAMEPAD_BACKEND=cocoa
5866 case "$MOZ_WINSDK_MAXVER" in
5867 # We support building with the Windows 7 SDK otherwise, but
5868 # Gamepad support requires the Windows 8 SDK for some HID headers.
5870 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.])
5875 MOZ_GAMEPAD_BACKEND=windows
5878 MOZ_CHECK_HEADER([linux/joystick.h])
5879 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5880 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.])
5882 MOZ_GAMEPAD_BACKEND=linux
5885 MOZ_GAMEPAD_BACKEND=android
5891 AC_DEFINE(MOZ_GAMEPAD)
5893 AC_SUBST(MOZ_GAMEPAD)
5894 AC_SUBST(MOZ_GAMEPAD_BACKEND)
5896 dnl ========================================================
5897 dnl = Breakpad crash reporting (on by default on supported platforms)
5898 dnl ========================================================
5901 i?86-*-mingw*|x86_64-*-mingw*)
5904 i?86-apple-darwin*|x86_64-apple-darwin*)
5907 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5908 if test "$MOZ_ENABLE_GTK"; then
5912 *-android*|*-linuxandroid*)
5920 MOZ_ARG_DISABLE_BOOL(crashreporter,
5921 [ --disable-crashreporter Disable breakpad crash reporting],
5922 [MOZ_CRASHREPORTER=],
5923 [MOZ_CRASHREPORTER=F # Force enable breakpad])
5925 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
5926 if test "$MOZ_CRASHREPORTER" = F; then
5927 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
5932 if test -n "$MOZ_CRASHREPORTER"; then
5933 AC_DEFINE(MOZ_CRASHREPORTER)
5935 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5936 test -z "$SKIP_LIBRARY_CHECKS"; then
5937 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5940 if test "$OS_ARCH" = "WINNT"; then
5941 if test -z "$HAVE_64BIT_BUILD"; then
5942 MOZ_CRASHREPORTER_INJECTOR=1
5943 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5948 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5949 [ --with-crashreporter-enable-percent=NN
5950 Enable sending crash reports by default on NN% of users. (default=100)],
5951 [ val=`echo $withval | sed 's/[^0-9]//g'`
5952 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5954 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5955 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5957 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5959 dnl ========================================================
5960 dnl = libjpeg-turbo configuration
5961 dnl ========================================================
5963 if test -z "$MOZ_NATIVE_JPEG"; then
5967 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5968 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
5970 MOZ_LIBJPEG_TURBO=1)
5972 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
5973 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
5976 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
5979 if test -n "$MOZ_LIBJPEG_TURBO"; then
5981 dnl Do we support libjpeg-turbo on this platform?
5982 case "$OS_ARCH:$OS_TEST" in
5984 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
5985 LIBJPEG_TURBO_X86_ASM=1
5988 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
5989 LIBJPEG_TURBO_X64_ASM=1
5991 WINNT:x86|WINNT:i?86)
5992 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
5993 LIBJPEG_TURBO_X86_ASM=1
5996 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
5997 LIBJPEG_TURBO_X64_ASM=1
6000 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6001 LIBJPEG_TURBO_ARM_ASM=1
6004 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6005 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6006 LIBJPEG_TURBO_X86_ASM=1
6010 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6011 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6012 LIBJPEG_TURBO_X64_ASM=1
6019 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6020 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6021 dnl it doesn't exist or we have too old of a version.
6022 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6023 LIBJPEG_TURBO_AS=$YASM
6025 if test -z "$LIBJPEG_TURBO_AS" ; then
6026 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.])
6029 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6030 dnl on Linux and 1.1 or newer everywhere else.
6031 if test "$OS_ARCH" = "Linux" ; then
6032 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
6033 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.])
6036 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6037 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.])
6042 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6043 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6044 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6045 echo "Using $AS as the assembler for ARM code."
6046 LIBJPEG_TURBO_AS=$AS
6049 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6050 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6051 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6052 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6053 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6054 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6055 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6056 dnl Warn if we're not building the optimized routines, even though the user
6057 dnl didn't specify --disable-libjpeg-turbo.
6058 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6061 dnl ========================================================
6062 dnl = Enable compilation of specific extension modules
6063 dnl ========================================================
6065 MOZ_ARG_ENABLE_STRING(extensions,
6066 [ --enable-extensions Enable extensions],
6067 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6068 if test "$option" = "yes" -o "$option" = "all"; then
6069 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6070 elif test "$option" = "no" -o "$option" = "none"; then
6072 elif test "$option" = "default"; then
6073 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6074 elif test `echo "$option" | grep -c \^-` != 0; then
6075 option=`echo $option | sed 's/^-//'`
6076 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6078 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6081 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6083 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6084 # Suppress warning on non-X11 platforms
6085 if test -n "$MOZ_X11"; then
6086 AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6088 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6091 dnl Do not build gnomevfs with libxul based apps
6092 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6093 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6096 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6097 # Suppress warning on non-X11 platforms
6098 if test -n "$MOZ_X11"; then
6099 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6101 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6104 dnl Do not build gio with libxul based apps
6105 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6106 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6109 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6111 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6113 AC_SUBST(MOZ_GIO_COMPONENT)
6116 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6118 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6119 dnl when trying to build a nonexistent extension.
6120 for extension in $MOZ_EXTENSIONS; do
6121 if test ! -d "${srcdir}/extensions/${extension}"; then
6122 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6126 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6127 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6130 dnl ========================================================
6131 dnl Build Freetype in the tree
6132 dnl ========================================================
6133 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6134 [ --enable-tree-freetype Enable Tree FreeType],
6135 MOZ_TREE_FREETYPE=1,
6136 MOZ_TREE_FREETYPE= )
6137 if test -n "$MOZ_TREE_FREETYPE"; then
6138 if test -n "$_WIN32_MSVC"; then
6139 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6141 AC_DEFINE(MOZ_TREE_FREETYPE)
6142 AC_SUBST(MOZ_TREE_FREETYPE)
6143 MOZ_ENABLE_CAIRO_FT=1
6144 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6145 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6146 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6148 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6149 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6150 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6151 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
6154 dnl ========================================================
6156 dnl ========================================================
6157 dnl Abort Windows build if the required major version and
6158 dnl minimum minor version of Unicode NSIS isn't in the path
6159 dnl (unless in case of cross compiling, for which Unicode
6160 dnl is not yet sufficient).
6161 if test "$OS_ARCH" = "WINNT"; then
6162 MIN_NSIS_MAJOR_VER=2
6163 MIN_NSIS_MINOR_VER=46
6164 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-3.0a2.exe makensisu-2.46.exe makensis)
6165 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6166 AC_MSG_RESULT([yes])
6167 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null`
6169 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6171 if test "$MAKENSISU_PARSED_VER" = ""; then
6173 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
6176 MAKENSISU_MAJOR_VER=0
6177 MAKENSISU_MINOR_VER=0
6178 if test ! "$MAKENSISU_PARSED_VER" = ""; then
6179 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'`
6180 MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'`
6182 AC_MSG_CHECKING([for Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater])
6183 if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \
6184 "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER ||
6185 test "$MAKENSISU_MAJOR_VER" -gt $MIN_NSIS_MAJOR_VER; then
6186 AC_MSG_RESULT([yes])
6189 if test -z "$CROSS_COMPILE"; then
6190 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.])
6195 elif test -z "$CROSS_COMPILE"; then
6196 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.])
6202 dnl ========================================================
6204 dnl ========================================================
6205 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6206 [ --disable-webapp-runtime Disable Web App Runtime],
6207 MOZ_WEBAPP_RUNTIME=,
6208 MOZ_WEBAPP_RUNTIME=1)
6209 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a -z "$MOZ_WIDGET_GTK" ; then
6212 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6215 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6216 if test "$MOZ_WEBAPP_RUNTIME"; then
6217 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6220 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6221 if test -z "$TAR"; then
6222 AC_MSG_ERROR([no tar archiver found in \$PATH])
6226 AC_CHECK_PROGS(WGET, wget, "")
6229 dnl ========================================================
6231 dnl ========================================================
6233 if test -n "$MOZ_SIGN_CMD"; then
6234 AC_DEFINE(MOZ_SIGNING)
6237 dnl ========================================================
6238 dnl Maintenance Service
6239 dnl ========================================================
6241 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6242 [ --enable-maintenance-service Enable building of maintenanceservice],
6243 MOZ_MAINTENANCE_SERVICE=1,
6244 MOZ_MAINTENANCE_SERVICE= )
6246 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6247 if test "$OS_ARCH" = "WINNT"; then
6248 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6250 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6254 dnl ========================================================
6255 dnl Bundled fonts on desktop platforms
6256 dnl ========================================================
6258 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
6259 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
6260 MOZ_BUNDLED_FONTS=1,
6263 if test -n "$MOZ_BUNDLED_FONTS"; then
6264 AC_DEFINE(MOZ_BUNDLED_FONTS)
6267 dnl ========================================================
6268 dnl Verify MAR signatures
6269 dnl ========================================================
6271 MOZ_ARG_ENABLE_BOOL(verify-mar,
6272 [ --enable-verify-mar Enable verifying MAR signatures],
6273 MOZ_VERIFY_MAR_SIGNATURE=1,
6274 MOZ_VERIFY_MAR_SIGNATURE= )
6276 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6277 if test "$OS_ARCH" = "WINNT"; then
6278 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6280 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6284 dnl ========================================================
6285 dnl Enable building the signmar program.
6286 dnl This option is much different than the --enable-verify-mar option.
6287 dnl --enable-verify-mar is for enabling the verification check on MAR
6288 dnl files in the updater. The --enable-signmar option is for building
6289 dnl the signmar program.
6290 dnl ========================================================
6292 MOZ_ARG_ENABLE_BOOL(signmar,
6293 [ --enable-signmar Enable building the signmar program],
6294 MOZ_ENABLE_SIGNMAR=1,
6295 MOZ_ENABLE_SIGNMAR= )
6297 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6298 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6301 dnl ========================================================
6303 dnl ========================================================
6305 MOZ_ARG_DISABLE_BOOL(updater,
6306 [ --disable-updater Disable building of updater],
6310 if test -n "$MOZ_UPDATER"; then
6311 AC_DEFINE(MOZ_UPDATER)
6314 # tools/update-packaging is not checked out by default.
6315 MOZ_ARG_ENABLE_BOOL(update-packaging,
6316 [ --enable-update-packaging
6317 Enable tools/update-packaging],
6318 MOZ_UPDATE_PACKAGING=1,
6319 MOZ_UPDATE_PACKAGING= )
6320 AC_SUBST(MOZ_UPDATE_PACKAGING)
6322 dnl ========================================================
6323 dnl build the tests by default
6324 dnl ========================================================
6325 MOZ_ARG_DISABLE_BOOL(tests,
6326 [ --disable-tests Do not build test libraries & programs],
6330 if test -n "$ENABLE_TESTS"; then
6332 AC_DEFINE(ENABLE_TESTS)
6333 AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6334 AC_SUBST(GTEST_HAS_RTTI)
6335 if test -n "$_WIN32_MSVC"; then
6336 AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6338 if test "${OS_TARGET}" = "Android"; then
6339 AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6340 AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6341 AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6342 AC_SUBST(GTEST_OS_LINUX_ANDROID)
6343 AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6344 AC_SUBST(GTEST_HAS_CLONE)
6348 dnl ========================================================
6349 dnl parental controls (for Windows Vista)
6350 dnl ========================================================
6351 MOZ_ARG_DISABLE_BOOL(parental-controls,
6352 [ --disable-parental-controls
6353 Do not build parental controls],
6354 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6355 MOZ_DISABLE_PARENTAL_CONTROLS=)
6356 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6357 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6360 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6362 dnl ========================================================
6363 dnl = Disable DOMCrypto
6364 dnl ========================================================
6365 if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
6366 AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
6368 AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
6370 dnl ========================================================
6371 dnl = Disable EV certificate verification
6372 dnl ========================================================
6373 if test -n "$MOZ_NO_EV_CERTS"; then
6374 AC_DEFINE(MOZ_NO_EV_CERTS)
6376 AC_SUBST(MOZ_NO_EV_CERTS)
6378 dnl ========================================================
6379 dnl = Disable libpkix
6380 dnl ========================================================
6381 if test -n "$NSS_NO_LIBPKIX"; then
6382 AC_DEFINE(NSS_NO_LIBPKIX)
6384 AC_SUBST(NSS_NO_LIBPKIX)
6386 dnl ========================================================
6387 dnl = Content process sandboxing
6388 dnl ========================================================
6389 if test -n "$gonkdir"; then
6390 MOZ_CONTENT_SANDBOX=1
6393 MOZ_ARG_ENABLE_BOOL(content-sandbox,
6394 [ --enable-content-sandbox Enable sandboxing support for content-processes],
6395 MOZ_CONTENT_SANDBOX=1,
6396 MOZ_CONTENT_SANDBOX=)
6398 if test -n "$MOZ_CONTENT_SANDBOX"; then
6399 AC_DEFINE(MOZ_CONTENT_SANDBOX)
6402 AC_SUBST(MOZ_CONTENT_SANDBOX)
6404 dnl ========================================================
6405 dnl = Gecko Media Plugin sandboxing
6406 dnl ========================================================
6423 if test -n "$MOZ_GMP_SANDBOX"; then
6424 AC_DEFINE(MOZ_GMP_SANDBOX)
6427 AC_SUBST(MOZ_GMP_SANDBOX)
6429 dnl ========================================================
6431 dnl = Module specific options
6433 dnl ========================================================
6434 MOZ_ARG_HEADER(Individual module options)
6436 dnl ========================================================
6437 dnl = Disable feed handling components
6438 dnl ========================================================
6439 MOZ_ARG_DISABLE_BOOL(feeds,
6440 [ --disable-feeds Disable feed handling and processing components],
6443 if test -n "$MOZ_FEEDS"; then
6444 AC_DEFINE(MOZ_FEEDS)
6446 if test "$MOZ_BUILD_APP" = "browser"; then
6447 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6451 dnl ========================================================
6452 dnl Check for sqlite
6453 dnl ========================================================
6456 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6457 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6458 MOZ_NATIVE_SQLITE=1,
6459 MOZ_NATIVE_SQLITE= )
6461 if test -n "$MOZ_NATIVE_SQLITE"
6463 dnl ============================
6464 dnl === SQLite Version check ===
6465 dnl ============================
6466 dnl Check to see if the system SQLite package is new enough.
6467 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6469 dnl ==================================
6470 dnl === SQLITE_SECURE_DELETE check ===
6471 dnl ==================================
6472 dnl Check to see if the system SQLite package is compiled with
6473 dnl SQLITE_SECURE_DELETE enabled.
6474 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6475 _SAVE_CFLAGS="$CFLAGS"
6476 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6478 LIBS="$LIBS $SQLITE_LIBS"
6479 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6481 #include "sqlite3.h"
6483 int main(int argc, char **argv){
6484 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6486 ac_cv_sqlite_secure_delete=yes,
6487 ac_cv_sqlite_secure_delete=no,
6488 ac_cv_sqlite_secure_delete=no
6491 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6492 CFLAGS="$_SAVE_CFLAGS"
6494 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6495 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6498 dnl ===============================
6499 dnl === SQLITE_THREADSAFE check ===
6500 dnl ===============================
6501 dnl Check to see if the system SQLite package is compiled with
6502 dnl SQLITE_THREADSAFE enabled.
6503 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6504 _SAVE_CFLAGS="$CFLAGS"
6505 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6507 LIBS="$LIBS $SQLITE_LIBS"
6508 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6510 #include "sqlite3.h"
6512 int main(int argc, char **argv){
6513 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6515 ac_cv_sqlite_threadsafe=yes,
6516 ac_cv_sqlite_threadsafe=no,
6517 ac_cv_sqlite_threadsafe=no
6520 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6521 CFLAGS="$_SAVE_CFLAGS"
6523 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6524 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6527 dnl ================================
6528 dnl === SQLITE_ENABLE_FTS3 check ===
6529 dnl ================================
6530 dnl check to see if the system SQLite package is compiled with
6531 dnl SQLITE_ENABLE_FTS3 enabled.
6532 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6533 _SAVE_CFLAGS="$CFLAGS"
6534 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6536 LIBS="$LIBS $SQLITE_LIBS"
6537 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6539 #include "sqlite3.h"
6541 int main(int argc, char **argv){
6542 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6544 ac_cv_sqlite_enable_fts3=yes,
6545 ac_cv_sqlite_enable_fts3=no,
6546 ac_cv_sqlite_enable_fts3=no
6549 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6550 CFLAGS="$_SAVE_CFLAGS"
6552 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6553 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6556 dnl =========================================
6557 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6558 dnl =========================================
6559 dnl check to see if the system SQLite package is compiled with
6560 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6561 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6562 _SAVE_CFLAGS="$CFLAGS"
6563 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6565 LIBS="$LIBS $SQLITE_LIBS"
6566 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6568 #include "sqlite3.h"
6570 int main(int argc, char **argv){
6571 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6573 ac_cv_sqlite_enable_unlock_notify=yes,
6574 ac_cv_sqlite_enable_unlock_notify=no,
6575 ac_cv_sqlite_enable_unlock_notify=no
6578 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6579 CFLAGS="$_SAVE_CFLAGS"
6581 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6582 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6586 if test -n "$MOZ_NATIVE_SQLITE"; then
6587 AC_DEFINE(MOZ_NATIVE_SQLITE)
6589 AC_SUBST(MOZ_NATIVE_SQLITE)
6591 dnl ========================================================
6592 dnl = Enable help viewer (off by default)
6593 dnl ========================================================
6594 if test -n "$MOZ_HELP_VIEWER"; then
6595 dnl Do this if defined in confvars.sh
6596 AC_DEFINE(MOZ_HELP_VIEWER)
6599 dnl ========================================================
6600 dnl = Enable safe browsing (anti-phishing)
6601 dnl ========================================================
6602 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6603 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6604 MOZ_SAFE_BROWSING=1,
6605 MOZ_SAFE_BROWSING= )
6606 if test -n "$MOZ_SAFE_BROWSING"; then
6607 AC_DEFINE(MOZ_SAFE_BROWSING)
6609 AC_SUBST(MOZ_SAFE_BROWSING)
6611 dnl ========================================================
6612 dnl = Enable url-classifier
6613 dnl ========================================================
6614 dnl Implicitly enabled by default if building with safe-browsing
6615 if test -n "$MOZ_SAFE_BROWSING"; then
6616 MOZ_URL_CLASSIFIER=1
6618 MOZ_ARG_ENABLE_BOOL(url-classifier,
6619 [ --enable-url-classifier Enable url classifier module],
6620 MOZ_URL_CLASSIFIER=1,
6621 MOZ_URL_CLASSIFIER= )
6622 if test -n "$MOZ_URL_CLASSIFIER"; then
6623 AC_DEFINE(MOZ_URL_CLASSIFIER)
6625 AC_SUBST(MOZ_URL_CLASSIFIER)
6627 dnl ========================================================
6628 dnl = Disable zipwriter
6629 dnl ========================================================
6630 MOZ_ARG_DISABLE_BOOL(zipwriter,
6631 [ --disable-zipwriter Disable zipwriter component],
6634 AC_SUBST(MOZ_ZIPWRITER)
6636 dnl ========================================================
6638 dnl ========================================================
6640 MOZ_ARG_WITH_STRING(gl-provider,
6641 [ --with-gl-provider=ID
6642 Set GL provider backend type],
6643 [ val=`echo $withval`
6644 MOZ_GL_PROVIDER="$val"])
6646 if test -n "$MOZ_GL_PROVIDER"; then
6647 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6648 AC_SUBST(MOZ_GL_PROVIDER)
6649 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6651 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6652 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6654 dnl ========================================================
6655 dnl = faststripe theme
6656 dnl ========================================================
6657 MOZ_ARG_ENABLE_BOOL(faststripe,
6658 [ --enable-faststripe Use faststripe theme],
6659 MOZ_THEME_FASTSTRIPE=1,
6660 MOZ_THEME_FASTSTRIPE= )
6661 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6663 dnl ========================================================
6665 dnl = Feature options that require extra sources to be pulled
6667 dnl ========================================================
6668 dnl MOZ_ARG_HEADER(Features that require extra sources)
6670 dnl ========================================================
6672 dnl = Runtime debugging and Optimization Options
6674 dnl ========================================================
6675 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
6677 dnl ========================================================
6678 dnl enable mobile optimizations
6679 dnl ========================================================
6680 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6681 [ --enable-mobile-optimize
6682 Enable mobile optimizations],
6683 MOZ_GFX_OPTIMIZE_MOBILE=1)
6685 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6687 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6688 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6691 dnl ========================================================
6692 dnl = Enable code optimization. ON by default.
6693 dnl ========================================================
6694 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6695 MOZ_OPTIMIZE_FLAGS="-O"
6698 MOZ_ARG_ENABLE_STRING(optimize,
6699 [ --disable-optimize Disable compiler optimization
6700 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6701 [ if test "$enableval" != "no"; then
6703 if test -n "$enableval" -a "$enableval" != "yes"; then
6704 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6709 fi ], MOZ_OPTIMIZE=1)
6711 MOZ_SET_FRAMEPTR_FLAGS
6713 if test "$COMPILE_ENVIRONMENT"; then
6714 if test -n "$MOZ_OPTIMIZE"; then
6715 AC_MSG_CHECKING([for valid optimization flags])
6716 _SAVE_CFLAGS=$CFLAGS
6717 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6718 AC_TRY_COMPILE([#include <stdio.h>],
6719 [printf("Hello World\n");],
6722 AC_MSG_RESULT([$_results])
6723 if test "$_results" = "no"; then
6724 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6726 CFLAGS=$_SAVE_CFLAGS
6728 fi # COMPILE_ENVIRONMENT
6730 AC_SUBST(MOZ_OPTIMIZE)
6731 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6732 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6733 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6734 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6735 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6737 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6739 dnl ========================================================
6740 dnl = Enable any treating of compile warnings as errors
6741 dnl ========================================================
6742 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6743 [ --enable-warnings-as-errors
6744 Enable treating of warnings as errors],
6745 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6746 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6747 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6748 WARNINGS_AS_ERRORS=''
6749 elif test "$GNU_CC"; then
6750 # Prevent the following GCC warnings from being treated as errors:
6751 # -Wuninitialized - too many false positives
6752 # -Wmaybe-uninitialized - too many false positives
6753 # -Wdeprecated-declarations - we don't want our builds held hostage when a
6754 # platform-specific API becomes deprecated.
6755 MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
6756 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
6757 MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
6758 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
6759 MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
6760 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
6762 if test -n "$MOZ_PGO"; then
6763 MOZ_C_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_c_has_noerror_coverage_mismatch)
6764 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_cxx_has_noerror_coverage_mismatch)
6768 dnl ========================================================
6769 dnl = Disable runtime logging checks
6770 dnl ========================================================
6771 MOZ_ARG_DISABLE_BOOL(logging,
6772 [ --disable-logging Disable logging facilities],
6773 NS_DISABLE_LOGGING=1,
6774 NS_DISABLE_LOGGING= )
6775 if test "$NS_DISABLE_LOGGING"; then
6776 AC_DEFINE(NS_DISABLE_LOGGING)
6778 AC_DEFINE(MOZ_LOGGING)
6781 dnl ========================================================
6782 dnl = This will enable logging of addref, release, ctor, dtor.
6783 dnl ========================================================
6784 _ENABLE_LOGREFCNT=42
6785 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6786 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6787 _ENABLE_LOGREFCNT=1,
6788 _ENABLE_LOGREFCNT= )
6789 if test "$_ENABLE_LOGREFCNT" = "1"; then
6790 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6791 elif test -z "$_ENABLE_LOGREFCNT"; then
6792 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6795 dnl ========================================================
6796 dnl moz_dump_painting
6797 dnl ========================================================
6798 MOZ_ARG_ENABLE_BOOL(dump-painting,
6799 [ --enable-dump-painting Enable paint debugging.],
6800 MOZ_DUMP_PAINTING=1,
6801 MOZ_DUMP_PAINTING= )
6802 if test -n "$MOZ_DUMP_PAINTING"; then
6803 AC_DEFINE(MOZ_DUMP_PAINTING)
6804 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6806 if test -n "$MOZ_DEBUG"; then
6807 AC_DEFINE(MOZ_DUMP_PAINTING)
6810 dnl ========================================================
6811 dnl = Enable trace malloc
6812 dnl ========================================================
6813 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6814 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6815 [ --enable-trace-malloc Enable malloc tracing; also disables DMD and jemalloc],
6818 if test "$NS_TRACE_MALLOC"; then
6819 # Please, Mr. Linker Man, don't take away our symbol names
6820 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6821 AC_DEFINE(NS_TRACE_MALLOC)
6823 AC_SUBST(NS_TRACE_MALLOC)
6825 dnl ========================================================
6827 dnl ========================================================
6829 MOZ_ARG_ENABLE_BOOL(dmd,
6830 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
6834 dnl The two options are conflicting. Fails the configure to alert the user.
6835 if test "$NS_TRACE_MALLOC" -a "$MOZ_DMD"; then
6836 AC_MSG_ERROR([--enable-trace-malloc and --enable-dmd are conflicting options])
6839 if test "$MOZ_DMD"; then
6842 if test "${CPU_ARCH}" = "arm"; then
6843 CFLAGS="$CFLAGS -funwind-tables"
6844 CXXFLAGS="$CXXFLAGS -funwind-tables"
6847 MOZ_MEMORY=1 # DMD enables jemalloc
6848 MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
6852 dnl ========================================================
6853 dnl = Enable jemalloc
6854 dnl ========================================================
6855 MOZ_ARG_ENABLE_BOOL(jemalloc,
6856 [ --enable-jemalloc Replace memory allocator with jemalloc],
6860 if test "$NS_TRACE_MALLOC"; then
6864 if test "${OS_TARGET}" = "Android"; then
6865 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6867 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin"; then
6868 dnl On Windows and OSX, we want to link all our binaries against mozglue
6869 if test -z "$GNU_CC"; then
6870 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6872 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6875 dnl On other Unix systems, we only want to link executables against mozglue
6876 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6877 dnl On other Unix systems, where mozglue is a static library, jemalloc is
6878 dnl separated for the SDK, so we need to add it here.
6879 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6880 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6882 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6883 if test -n "$GNU_CC"; then
6884 dnl And we need mozglue symbols to be exported.
6885 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6887 if test "$MOZ_LINKER" = 1; then
6888 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
6892 dnl ========================================================
6893 dnl = Enable dynamic replacement of malloc implementation
6894 dnl ========================================================
6895 if test -n "$NIGHTLY_BUILD" -a -n "$MOZ_MEMORY"; then
6896 # Enable on central for the debugging opportunities it adds.
6897 MOZ_REPLACE_MALLOC=1
6899 MOZ_ARG_ENABLE_BOOL(replace-malloc,
6900 [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
6901 MOZ_REPLACE_MALLOC=1,
6902 MOZ_REPLACE_MALLOC= )
6904 dnl The two options are conflicting. Fails the configure to alert the user.
6905 if test "$NS_TRACE_MALLOC" -a "$MOZ_REPLACE_MALLOC"; then
6906 AC_MSG_ERROR([--enable-trace-malloc and --enable-replace-malloc are conflicting options])
6909 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
6910 dnl We don't want to enable jemalloc unconditionally because it may be a
6911 dnl deliberate choice not to enable it (bug 702250, for instance)
6912 AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
6913 elif test -n "$MOZ_REPLACE_MALLOC"; then
6914 MOZ_NATIVE_JEMALLOC=
6916 dnl Replace-malloc Mac linkage quirks
6917 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
6918 AC_CACHE_CHECK([how to do weak dynamic linking],
6919 ac_cv_weak_dynamic_linking,
6920 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
6921 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
6922 test -s conftest${DLL_SUFFIX}; then
6923 dnl There are several ways the linker can put link edit rules in a binary:
6924 dnl - classic info only (for OSX < 10.6)
6925 dnl - dyld info only
6927 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
6932 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
6937 dnl With classic info, we need to build with -flat_namespace.
6938 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
6939 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
6940 dnl forgets to set the weak flag in the dyld info.
6941 dnl See http://glandium.org/blog/?p=2764 for more details.
6943 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
6944 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
6945 dnl - "flat namespace" when -flat_namespace alone is needed
6946 dnl - "dummy library" when a dummy library and -flat_namespace are needed
6947 dnl - "compiler support" when nothing is needed
6948 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
6949 if test -n "$_CLASSIC_INFO"; then
6950 ac_cv_weak_dynamic_linking="flat namespace"
6952 ac_cv_weak_dynamic_linking="compiler support"
6955 if test -n "$_DYLD_INFO"; then
6956 ac_cv_weak_dynamic_linking="dummy library"
6958 ac_cv_weak_dynamic_linking="flat namespace"
6962 AC_ERROR([couldn't compile a simple C file])
6965 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
6968 AC_SUBST(MOZ_REPLACE_MALLOC)
6969 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
6971 dnl ========================================================
6972 dnl = Jemalloc build setup
6973 dnl ========================================================
6974 if test -z "$MOZ_MEMORY"; then
6975 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
6976 MOZ_NATIVE_JEMALLOC=1
6977 AC_CHECK_FUNCS(mallctl nallocm,,
6978 [MOZ_NATIVE_JEMALLOC=
6980 if test -n "$MOZ_NATIVE_JEMALLOC"; then
6982 AC_DEFINE(MOZ_MEMORY)
6983 AC_DEFINE(MOZ_JEMALLOC3)
6984 AC_DEFINE(MOZ_NATIVE_JEMALLOC)
6989 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
6990 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.])
6995 AC_DEFINE(MOZ_MEMORY)
6996 if test -n "$MOZ_JEMALLOC3"; then
6997 AC_DEFINE(MOZ_JEMALLOC3)
6999 if test "x$MOZ_DEBUG" = "x1"; then
7000 AC_DEFINE(MOZ_MEMORY_DEBUG)
7002 dnl The generic feature tests that determine how to compute ncpus are long and
7003 dnl complicated. Therefore, simply define special cpp variables for the
7004 dnl platforms we have special knowledge of.
7007 AC_DEFINE(MOZ_MEMORY_DARWIN)
7010 AC_DEFINE(MOZ_MEMORY_BSD)
7012 *-android*|*-linuxandroid*)
7013 AC_DEFINE(MOZ_MEMORY_LINUX)
7014 AC_DEFINE(MOZ_MEMORY_ANDROID)
7015 if test -z "$gonkdir"; then
7018 AC_DEFINE(MOZ_MEMORY_GONK)
7023 AC_DEFINE(MOZ_MEMORY_LINUX)
7026 AC_DEFINE(MOZ_MEMORY_BSD)
7029 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7032 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7033 export MOZ_NO_DEBUG_RTL=1
7034 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7035 dnl Look for a broken crtdll.obj
7036 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7037 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7038 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7039 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcprt -DEFAULTLIB:mozcrt'
7040 dnl Also pass this to NSPR/NSS
7041 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7043 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7050 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7054 AC_SUBST(MOZ_MEMORY)
7055 AC_SUBST(MOZ_JEMALLOC3)
7056 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7057 AC_SUBST(MOZ_GLUE_LDFLAGS)
7058 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7059 AC_SUBST_LIST(WIN32_CRT_LIBS)
7060 dnl Need to set this for make because NSS doesn't have configure
7063 dnl We need to wrap dlopen and related functions on Android because we use
7065 if test "$OS_TARGET" = Android; then
7066 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7067 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7068 if test "$MOZ_WIDGET_TOOLKIT" = android; then
7069 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7071 if test -z "$gonkdir"; then
7072 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7073 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"
7075 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
7076 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"
7080 dnl ========================================================
7081 dnl = Use malloc wrapper lib
7082 dnl ========================================================
7083 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7084 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7088 if test -n "$_WRAP_MALLOC"; then
7089 if test -n "$GNU_CC"; then
7090 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7091 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7092 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7093 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=vasprintf,--wrap=asprintf"
7094 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7095 dnl Wrap operator new and operator delete on Android.
7096 if test "$OS_TARGET" = "Android"; then
7097 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7098 dnl Wrap the nothrow variants too.
7099 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7102 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7106 dnl ========================================================
7107 dnl = Location of malloc wrapper lib
7108 dnl ========================================================
7109 MOZ_ARG_WITH_STRING(wrap-malloc,
7110 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7111 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7113 dnl ========================================================
7114 dnl = Use JS Call tracing
7115 dnl ========================================================
7116 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7117 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7118 MOZ_TRACE_JSCALLS=1,
7119 MOZ_TRACE_JSCALLS= )
7120 if test -n "$MOZ_TRACE_JSCALLS"; then
7121 AC_DEFINE(MOZ_TRACE_JSCALLS)
7124 dnl ========================================================
7125 dnl JS opt-mode assertions and minidump instrumentation
7126 dnl ========================================================
7127 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7128 [ --enable-js-diagnostics
7129 Enable JS diagnostic assertions and breakpad data],
7130 JS_CRASH_DIAGNOSTICS=1,
7131 JS_CRASH_DIAGNOSTICS= )
7132 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7133 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7136 dnl ========================================================
7137 dnl = Use incremental GC
7138 dnl ========================================================
7140 MOZ_ARG_DISABLE_BOOL(gcincremental,
7141 [ --disable-gcincremental Disable incremental GC],
7143 if test -n "$JSGC_INCREMENTAL"; then
7144 AC_DEFINE(JSGC_INCREMENTAL)
7147 dnl ========================================================
7148 dnl = Use exact stack rooting for GC
7149 dnl ========================================================
7150 MOZ_ARG_DISABLE_BOOL(exact-rooting,
7151 [ --disable-exact-rooting Enable use of conservative stack scanning for GC],
7152 JSGC_USE_EXACT_ROOTING= ,
7153 JSGC_USE_EXACT_ROOTING=1 )
7154 if test -n "$JSGC_USE_EXACT_ROOTING"; then
7155 AC_DEFINE(JSGC_USE_EXACT_ROOTING)
7158 dnl ========================================================
7159 dnl = Use generational GC
7160 dnl ========================================================
7161 MOZ_ARG_DISABLE_BOOL(gcgenerational,
7162 [ --disable-gcgenerational Disable generational GC],
7163 JSGC_GENERATIONAL= ,
7164 JSGC_GENERATIONAL=1 )
7165 if test -n "$JSGC_GENERATIONAL"; then
7166 AC_DEFINE(JSGC_GENERATIONAL)
7169 dnl ========================================================
7170 dnl = Use a smaller chunk size for GC chunks
7171 dnl ========================================================
7172 MOZ_ARG_ENABLE_BOOL(small-chunk-size,
7173 [ --enable-small-chunk-size Allocate memory for JS GC things in smaller chunks],
7174 JS_GC_SMALL_CHUNK_SIZE=1,
7175 JS_GC_SMALL_CHUNK_SIZE= )
7176 if test -n "$JS_GC_SMALL_CHUNK_SIZE"; then
7177 AC_DEFINE(JS_GC_SMALL_CHUNK_SIZE)
7180 dnl ========================================================
7181 dnl Zealous JavaScript GC
7182 dnl ========================================================
7183 MOZ_ARG_ENABLE_BOOL(gczeal,
7184 [ --enable-gczeal Enable zealous JavaScript GCing],
7187 if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then
7188 AC_DEFINE(JS_GC_ZEAL)
7191 dnl ========================================================
7192 dnl = Perform moving GC stack rooting analysis
7193 dnl ========================================================
7194 MOZ_ARG_ENABLE_BOOL(root-analysis,
7195 [ --enable-root-analysis Enable moving GC stack root analysis],
7196 JSGC_ROOT_ANALYSIS=1,
7197 JSGC_ROOT_ANALYSIS= )
7198 if test -n "$JSGC_ROOT_ANALYSIS"; then
7199 AC_DEFINE(JSGC_ROOT_ANALYSIS)
7204 dnl ========================================================
7205 dnl = Enable static checking using gcc-dehydra
7206 dnl ========================================================
7208 MOZ_ARG_WITH_STRING(static-checking,
7209 [ --with-static-checking=path/to/gcc_dehydra.so
7210 Enable static checking of code using GCC-dehydra],
7211 DEHYDRA_PATH=$withval,
7214 if test -n "$DEHYDRA_PATH"; then
7215 if test ! -f "$DEHYDRA_PATH"; then
7216 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7218 AC_DEFINE(NS_STATIC_CHECKING)
7220 AC_SUBST(DEHYDRA_PATH)
7222 dnl ========================================================
7223 dnl = Enable using the clang plugin to build
7224 dnl ========================================================
7226 MOZ_ARG_ENABLE_BOOL(clang-plugin,
7227 [ --enable-clang-plugin Enable building with the mozilla clang plugin ],
7228 ENABLE_CLANG_PLUGIN=1,
7229 ENABLE_CLANG_PLUGIN= )
7230 if test -n "$ENABLE_CLANG_PLUGIN"; then
7231 if test -z "$CLANG_CC"; then
7232 AC_MSG_ERROR([Can't use clang plugin without clang.])
7234 AC_DEFINE(MOZ_CLANG_PLUGIN)
7237 AC_SUBST(ENABLE_CLANG_PLUGIN)
7239 dnl ========================================================
7240 dnl = Enable stripping of libs & executables
7241 dnl ========================================================
7242 MOZ_ARG_ENABLE_BOOL(strip,
7243 [ --enable-strip Enable stripping of libs & executables ],
7247 dnl ========================================================
7248 dnl = Enable stripping of libs & executables when packaging
7249 dnl ========================================================
7250 MOZ_ARG_ENABLE_BOOL(install-strip,
7251 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7255 dnl ========================================================
7256 dnl = --disable-elf-hack
7257 dnl ========================================================
7260 MOZ_ARG_DISABLE_BOOL(elf-hack,
7261 [ --disable-elf-hack Disable elf hacks],
7263 [USE_ELF_HACK=F # Force enable elf-hack])
7265 # Disable elf hack for profiling because the built in profiler
7266 # doesn't read the segments properly with elf hack. This is
7267 # temporary and should be fixed soon in the profiler.
7268 if test "$MOZ_PROFILING" = 1; then
7269 if test "$USE_ELF_HACK" = F; then
7270 AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
7275 # Only enable elfhack where supported
7276 if test "$USE_ELF_HACK" = 1; then
7277 case "${HOST_OS_ARCH},${OS_ARCH}" in
7279 case "${CPU_ARCH}" in
7294 if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
7295 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7296 dnl memory addresses it maps to. The result is that by the time elfhack
7297 dnl kicks in, it is not possible to apply relocations because of that,
7298 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7299 dnl segment. It makes elfhack mostly useless, so considering the problems
7300 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7301 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7302 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
7303 dnl elfhack enabled, disable PT_GNU_RELRO instead.
7304 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7305 LINK_WITH_PT_GNU_RELRO,
7306 [echo "int main() {return 0;}" > conftest.${ac_ext}
7307 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7308 test -s conftest${ac_exeext}; then
7309 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7310 LINK_WITH_PT_GNU_RELRO=yes
7312 LINK_WITH_PT_GNU_RELRO=no
7315 dnl We really don't expect to get here, but just in case
7316 AC_ERROR([couldn't compile a simple C file])
7319 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7320 if test "$USE_ELF_HACK" = F; then
7321 AC_MSG_CHECKING([for -z norelro option to ld])
7322 _SAVE_LDFLAGS=$LDFLAGS
7323 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
7324 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
7325 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
7326 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.]))
7329 AC_MSG_WARN([Disabling elfhack])
7335 dnl ========================================================
7336 dnl = libstdc++ compatibility hacks
7337 dnl ========================================================
7340 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7341 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7344 if test -n "$STDCXX_COMPAT"; then
7345 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
7346 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7347 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7350 dnl ========================================================
7352 dnl = Profiling and Instrumenting
7354 dnl ========================================================
7355 MOZ_ARG_HEADER(Profiling and Instrumenting)
7357 dnl ========================================================
7358 dnl = Enable runtime visual profiling logger
7359 dnl ========================================================
7360 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7361 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7362 MOZ_VISUAL_EVENT_TRACER=1,
7363 MOZ_VISUAL_EVENT_TRACER=)
7364 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7365 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7368 dnl ========================================================
7369 dnl = Enable TaskTracer
7370 dnl ========================================================
7371 MOZ_ARG_ENABLE_BOOL(tasktracer,
7372 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
7375 if test "$MOZ_WIDGET_TOOLKIT" = "gonk" -a -n "$MOZ_TASK_TRACER"; then
7376 AC_DEFINE(MOZ_TASK_TRACER)
7377 AC_SUBST(MOZ_TASK_TRACER)
7380 dnl ========================================================
7381 dnl Turn on reflow counting
7382 dnl ========================================================
7383 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7384 [ --enable-reflow-perf Enable reflow performance tracing],
7387 if test -n "$MOZ_REFLOW_PERF"; then
7388 AC_DEFINE(MOZ_REFLOW_PERF)
7391 dnl ========================================================
7392 dnl = Offer a way to disable the startup cache
7393 dnl ========================================================
7394 MOZ_DISABLE_STARTUPCACHE=
7396 MOZ_ARG_DISABLE_BOOL(startupcache,
7397 [ --disable-startupcache Disable startup cache ],
7398 MOZ_DISABLE_STARTUPCACHE=1,
7399 MOZ_DISABLE_STARTUPCACHE=)
7401 dnl bug 988880: disable startup cache on b2g
7402 if test -n "$MOZ_B2G"; then
7403 MOZ_DISABLE_STARTUPCACHE=1
7406 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
7408 dnl ========================================================
7409 dnl = Enable Radio Interface for B2G (Gonk usually)
7410 dnl ========================================================
7411 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7412 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7415 MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL )
7416 if test -n "$MOZ_B2G_RIL"; then
7417 if test -n "$_PLATFORM_HAVE_RIL"; then
7418 AC_DEFINE(MOZ_B2G_RIL)
7420 AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.])
7423 AC_SUBST(MOZ_B2G_RIL)
7425 dnl ========================================================
7426 dnl = Enable Radio FM for B2G (Gonk usually)
7427 dnl ========================================================
7428 if test -n "$MOZ_B2G_FM"; then
7429 AC_DEFINE(MOZ_B2G_FM)
7431 AC_SUBST(MOZ_B2G_FM)
7433 dnl ========================================================
7434 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7435 dnl ========================================================
7436 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7437 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7440 if test -n "$MOZ_B2G_BT"; then
7441 AC_DEFINE(MOZ_B2G_BT)
7443 AC_SUBST(MOZ_B2G_BT)
7444 AC_SUBST(MOZ_B2G_BT_BLUEZ)
7445 AC_SUBST(MOZ_B2G_BT_BLUEDROID)
7447 dnl ========================================================
7448 dnl = Enable NFC Interface for B2G (Gonk usually)
7449 dnl ========================================================
7450 MOZ_ARG_ENABLE_BOOL(nfc,
7451 [ --enable-nfc Set compile flags necessary for compiling NFC API ],
7454 if test -n "$MOZ_NFC"; then
7459 dnl ========================================================
7460 dnl = Enable Pico Speech Synthesis (Gonk usually)
7461 dnl ========================================================
7462 MOZ_ARG_ENABLE_BOOL(synth-pico,
7463 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
7466 if test -n "$MOZ_SYNTH_PICO"; then
7467 AC_DEFINE(MOZ_SYNTH_PICO)
7469 AC_SUBST(MOZ_SYNTH_PICO)
7471 dnl ========================================================
7472 dnl = Enable Support for Time Manager API
7473 dnl ========================================================
7474 if test -n "$MOZ_TIME_MANAGER"; then
7475 AC_DEFINE(MOZ_TIME_MANAGER)
7477 AC_SUBST(MOZ_TIME_MANAGER)
7479 dnl ========================================================
7480 dnl = Enable Camera Interface for B2G (Gonk usually)
7481 dnl ========================================================
7482 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7483 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7486 if test -n "$MOZ_B2G_CAMERA"; then
7487 AC_DEFINE(MOZ_B2G_CAMERA)
7489 AC_SUBST(MOZ_B2G_CAMERA)
7491 dnl ========================================================
7492 dnl = Enable Support for Payment API
7493 dnl ========================================================
7494 if test -n "$MOZ_PAY"; then
7499 dnl ========================================================
7500 dnl = Enable Browser Support for Activities
7501 dnl ========================================================
7502 if test -n "$MOZ_ACTIVITIES"; then
7503 AC_DEFINE(MOZ_ACTIVITIES)
7505 AC_SUBST(MOZ_ACTIVITIES)
7507 dnl ========================================================
7508 dnl = Enable Support for AudioChannelManager API
7509 dnl ========================================================
7510 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7511 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7513 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7515 dnl ========================================================
7516 dnl = Support for demangling undefined symbols
7517 dnl ========================================================
7518 if test -z "$SKIP_LIBRARY_CHECKS"; then
7521 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7525 # Demangle only for debug or trace-malloc or DMD builds
7526 MOZ_DEMANGLE_SYMBOLS=
7527 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7528 MOZ_DEMANGLE_SYMBOLS=1
7529 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7531 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7533 dnl ========================================================
7534 dnl = Support for gcc stack unwinding (from gcc 3.3)
7535 dnl ========================================================
7536 if test -z "$SKIP_LIBRARY_CHECKS"; then
7539 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7543 dnl ========================================================
7545 dnl ========================================================
7547 MOZ_ARG_WITH_STRING(jitreport-granularity,
7548 [ --jitreport-granularity=N
7549 Default granularity at which to report JIT code
7552 1 - code ranges for whole functions only
7553 2 - per-line information
7554 3 - per-op information],
7555 JITREPORT_GRANULARITY=$withval,
7556 JITREPORT_GRANULARITY=3)
7558 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7560 dnl ========================================================
7564 dnl ========================================================
7565 MOZ_ARG_HEADER(Misc. Options)
7567 dnl ========================================================
7568 dnl update xterm title
7569 dnl ========================================================
7570 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7571 [ --enable-xterm-updates Update XTERM titles with current command.],
7575 dnl =========================================================
7577 dnl =========================================================
7578 MOZ_ARG_ENABLE_STRING([chrome-format],
7579 [ --enable-chrome-format=jar|flat|omni
7580 Select FORMAT of chrome files during packaging],
7581 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7583 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7584 MOZ_CHROME_FILE_FORMAT=jar
7587 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7588 AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7591 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7592 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7593 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7594 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7597 dnl =========================================================
7598 dnl Omnijar packaging (bug 552121)
7599 dnl =========================================================
7600 dnl Omnijar packaging is compatible with flat packaging.
7601 dnl In unpackaged builds, omnijar looks for files as if
7602 dnl things were flat packaged. After packaging, all files
7603 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7604 dnl is set to flat since putting files into jars is only
7605 dnl done during packaging with omnijar.
7606 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7608 AC_DEFINE(MOZ_OMNIJAR)
7610 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7611 if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7612 MOZ_CHROME_FILE_FORMAT=flat
7614 MOZ_CHROME_FILE_FORMAT=symlink
7617 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7618 dnl Fennec's static resources live in the assets/ folder of the
7619 dnl APK. Adding a path to the name here works because we only
7620 dnl have one omnijar file in the final package (which is not the
7621 dnl case on desktop), and necessitates some contortions during
7622 dnl packaging so that the resources in the omnijar are considered
7623 dnl as rooted at / and not as rooted at assets/ (which again is
7624 dnl not the case on desktop: there are omnijars rooted at webrtc/,
7625 dnl etc). packager.mk handles changing the rooting of the single
7627 OMNIJAR_NAME=assets/omni.ja
7629 OMNIJAR_NAME=omni.ja
7632 AC_SUBST(OMNIJAR_NAME)
7633 AC_SUBST(MOZ_OMNIJAR)
7634 AC_SUBST(MOZ_PACKAGER_FORMAT)
7636 dnl ========================================================
7637 dnl = Define default location for MOZILLA_FIVE_HOME
7638 dnl ========================================================
7639 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7640 [ --with-default-mozilla-five-home
7641 Set the default value for MOZILLA_FIVE_HOME],
7642 [ val=`echo $withval`
7643 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7645 dnl ========================================================
7646 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7647 dnl ========================================================
7648 MOZ_ARG_WITH_STRING(user-appdir,
7649 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7650 [ val=`echo $withval`
7651 if echo "$val" | grep "\/" >/dev/null; then
7652 AC_MSG_ERROR("Homedir must be single relative path.")
7657 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7659 dnl ========================================================
7660 dnl = Doxygen configuration
7661 dnl ========================================================
7662 dnl Use commas to specify multiple dirs to this arg
7663 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7664 MOZ_ARG_WITH_STRING(doc-input-dirs,
7665 [ --with-doc-input-dirs=DIRS
7666 Header/idl dirs to create docs from],
7667 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7668 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7670 dnl Use commas to specify multiple dirs to this arg
7671 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7672 MOZ_ARG_WITH_STRING(doc-include-dirs,
7673 [ --with-doc-include-dirs=DIRS
7674 Include dirs to preprocess doc headers],
7675 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7676 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7678 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7679 MOZ_ARG_WITH_STRING(doc-output-dir,
7680 [ --with-doc-output-dir=DIR
7681 Dir to generate docs into],
7682 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7683 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7685 if test -z "$SKIP_COMPILER_CHECKS"; then
7686 dnl ========================================================
7688 dnl = Compiler Options
7690 dnl ========================================================
7691 MOZ_ARG_HEADER(Compiler Options)
7693 dnl ========================================================
7694 dnl Check for gcc -pipe support
7695 dnl ========================================================
7696 AC_MSG_CHECKING([for -pipe support])
7697 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7698 dnl Any gcc that supports firefox supports -pipe.
7699 CFLAGS="$CFLAGS -pipe"
7700 CXXFLAGS="$CXXFLAGS -pipe"
7701 AC_MSG_RESULT([yes])
7706 dnl ========================================================
7707 dnl Profile guided optimization (gcc checks)
7708 dnl ========================================================
7709 dnl Test for profiling options
7710 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7712 _SAVE_CFLAGS="$CFLAGS"
7713 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7715 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7716 AC_TRY_COMPILE([], [return 0;],
7717 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7718 result="yes" ], result="no")
7719 AC_MSG_RESULT([$result])
7721 if test $result = "yes"; then
7722 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7723 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7724 PROFILE_USE_LDFLAGS="-fprofile-use"
7727 CFLAGS="$_SAVE_CFLAGS"
7729 if test -n "$INTEL_CC"; then
7730 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7731 PROFILE_GEN_LDFLAGS=
7732 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7733 PROFILE_USE_LDFLAGS=
7736 dnl Sun Studio on Solaris
7737 if test "$SOLARIS_SUNPRO_CC"; then
7738 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7739 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7740 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7741 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7744 AC_SUBST(PROFILE_GEN_CFLAGS)
7745 AC_SUBST(PROFILE_GEN_LDFLAGS)
7746 AC_SUBST(PROFILE_USE_CFLAGS)
7747 AC_SUBST(PROFILE_USE_LDFLAGS)
7749 dnl =============================================
7750 dnl Support for -fno-integrated-as (recent clang)
7751 dnl =============================================
7752 dnl Under clang 3.4+, use -fno-integrated-as to
7753 dnl build libvpx's vp8_asm_enc_offsets.c
7755 _SAVE_CFLAGS="$CFLAGS"
7756 CFLAGS="$CFLAGS -fno-integrated-as -S"
7758 AC_MSG_CHECKING([whether C compiler supports -fno-integrated-as])
7759 AC_TRY_COMPILE([], [return 0;],
7760 [ NO_INTEGRATED_AS_CFLAGS="-fno-integrated-as"
7761 result="yes" ], result="no")
7762 AC_MSG_RESULT([$result])
7764 CFLAGS="$_SAVE_CFLAGS"
7766 AC_SUBST(NO_INTEGRATED_AS_CFLAGS)
7768 fi # ! SKIP_COMPILER_CHECKS
7770 AC_DEFINE(CPP_THROW_NEW, [throw()])
7773 if test "$COMPILE_ENVIRONMENT"; then
7775 fi # COMPILE_ENVIRONMENT
7777 dnl ========================================================
7779 dnl = Build depencency options
7781 dnl ========================================================
7782 MOZ_ARG_HEADER(Build dependencies)
7784 if test "$GNU_CC" -a "$GNU_CXX"; then
7785 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7786 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7787 elif test "$SOLARIS_SUNPRO_CC"; then
7790 dnl Don't override this for MSVC
7791 if test -z "$_WIN32_MSVC"; then
7792 _USE_CPP_INCLUDE_FLAG=
7793 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7794 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7796 echo '#include <stdio.h>' > dummy-hello.c
7798 dnl This output is localized, split at the first double space or colon and space.
7799 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
7800 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
7801 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
7803 if ! test -e "$_CL_STDIO_PATH"; then
7804 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
7806 if test -z "$CL_INCLUDES_PREFIX"; then
7807 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7809 AC_SUBST(CL_INCLUDES_PREFIX)
7812 dnl Make sure that the build system can handle non-ASCII characters
7813 dnl in environment variables to prevent it from breaking silently on
7814 dnl non-English systems.
7815 NONASCII=$'\241\241'
7820 dnl ========================================================
7822 dnl = Static Build Options
7824 dnl ========================================================
7825 MOZ_ARG_HEADER(Static build options)
7827 if test "$OS_ARCH" = "WINNT"; then
7828 GKMEDIAS_SHARED_LIBRARY=1
7829 AC_DEFINE(GKMEDIAS_SHARED_LIBRARY)
7831 AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
7833 if test -z "$MOZ_NATIVE_ZLIB"; then
7834 if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
7836 AC_DEFINE(ZLIB_IN_MOZGLUE)
7840 AC_SUBST(ZLIB_IN_MOZGLUE)
7842 dnl ========================================================
7844 dnl = Standalone module options
7846 dnl ========================================================
7847 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7850 dnl ========================================================
7852 if test -z "$SKIP_PATH_CHECKS"; then
7853 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7854 if test "$MOZ_ENABLE_GTK" ; then
7855 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7860 if test -z "${GLIB_GMODULE_LIBS}" \
7861 -a -n "${GLIB_CONFIG}"\
7862 -a "${GLIB_CONFIG}" != no\
7864 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7867 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
7869 dnl ========================================================
7870 dnl Graphics checks.
7871 dnl ========================================================
7873 if test "${OS_TARGET}" = "WINNT"; then
7874 if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then
7875 MOZ_ENABLE_DIRECT2D1_1=1
7876 AC_SUBST(MOZ_ENABLE_DIRECT2D1_1)
7880 if test "${OS_TARGET}" = "WINNT" -o \
7881 "${OS_ARCH}" = "Darwin" -o \
7882 "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
7883 "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
7884 "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
7885 "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
7886 case "${target_cpu}" in
7898 MOZ_ARG_ENABLE_BOOL(skia,
7899 [ --enable-skia Enable use of Skia],
7903 if test "$USE_FC_FREETYPE"; then
7904 if test "$COMPILE_ENVIRONMENT"; then
7905 dnl ========================================================
7906 dnl = Check for freetype2 and its functionality
7907 dnl ========================================================
7908 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7910 if test "$_HAVE_FREETYPE2"; then
7912 _SAVE_CFLAGS="$CFLAGS"
7913 LIBS="$LIBS $FT2_LIBS"
7914 CFLAGS="$CFLAGS $FT2_CFLAGS"
7916 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7917 ac_cv_member_FT_Bitmap_Size_y_ppem,
7918 [AC_TRY_COMPILE([#include <ft2build.h>
7919 #include FT_FREETYPE_H],
7921 if (sizeof s.y_ppem) return 0;
7923 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7924 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7925 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7926 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7928 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7930 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7931 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7932 [FT_Bitmap_Size structure includes y_ppem field])
7934 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
7937 CFLAGS="$_SAVE_CFLAGS"
7940 _SAVE_CPPFLAGS="$CPPFLAGS"
7941 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7942 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7943 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7944 CPPFLAGS="$_SAVE_CPPFLAGS"
7946 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7949 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
7951 if test "$MOZ_PANGO"; then
7952 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
7953 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
7955 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
7956 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
7961 dnl ========================================================
7962 dnl Check for pixman and cairo
7963 dnl ========================================================
7965 if test "$MOZ_WIDGET_TOOLKIT" = "gtk3" ; then
7966 # cairo-gtk3 can be build with system-cairo only
7972 MOZ_ARG_ENABLE_BOOL(system-cairo,
7973 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7978 MOZ_ARG_ENABLE_BOOL(system-pixman,
7979 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7981 MOZ_TREE_PIXMAN=force,
7984 # System cairo depends on system pixman
7985 if test "$MOZ_TREE_PIXMAN" = "force"; then
7986 if test -z "$MOZ_TREE_CAIRO"; then
7987 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7991 elif test -z "$MOZ_TREE_CAIRO"; then
7995 if test "$MOZ_TREE_PIXMAN"; then
7996 AC_DEFINE(MOZ_TREE_PIXMAN)
7998 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
7999 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8000 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8002 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8003 AC_SUBST_LIST(MOZ_PIXMAN_LIBS)
8005 # Check for headers defining standard int types.
8006 if test -n "$COMPILE_ENVIRONMENT"; then
8007 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8009 if test "${ac_cv_header_inttypes_h}" = "yes"; then
8014 AC_SUBST(HAVE_INTTYPES_H)
8016 if test "$MOZ_TREE_CAIRO"; then
8017 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8018 AC_DEFINE(MOZ_TREE_CAIRO)
8020 if test "$OS_ARCH" = "WINNT"; then
8021 # For now we assume that we will have a uint64_t available through
8022 # one of the above headers or mozstdint.h.
8023 AC_DEFINE(HAVE_UINT64_T)
8026 # Define macros for cairo-features.h
8027 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8028 if test "$MOZ_X11"; then
8029 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8030 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8031 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8033 if test "$_HAVE_FREETYPE2"; then
8034 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8035 MOZ_ENABLE_CAIRO_FT=1
8036 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8039 case "$MOZ_WIDGET_TOOLKIT" in
8041 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8044 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8045 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8046 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8049 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8050 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8051 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8052 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8053 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8054 MOZ_ENABLE_D2D_SURFACE=1
8055 MOZ_ENABLE_DWRITE_FONT=1
8057 WIN32_DWRITE_FONT_FEATURE=
8058 WIN32_D2D_SURFACE_FEATURE=
8061 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8063 dnl D3D10 Layers depend on D2D Surfaces.
8064 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8065 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8069 AC_MSG_ERROR([cairo-gtk3 toolkit is incompatible with in-tree cairo. Please add --enable-system-cairo to your build config.])
8072 if test "$USE_FC_FREETYPE"; then
8073 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8075 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8076 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8077 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8078 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8079 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8081 AC_SUBST(PS_SURFACE_FEATURE)
8082 AC_SUBST(PDF_SURFACE_FEATURE)
8083 AC_SUBST(SVG_SURFACE_FEATURE)
8084 AC_SUBST(XLIB_SURFACE_FEATURE)
8085 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8086 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8087 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8088 AC_SUBST(WIN32_SURFACE_FEATURE)
8089 AC_SUBST(OS2_SURFACE_FEATURE)
8090 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8091 AC_SUBST(FT_FONT_FEATURE)
8092 AC_SUBST(FC_FONT_FEATURE)
8093 AC_SUBST(WIN32_FONT_FEATURE)
8094 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8095 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8096 AC_SUBST(QUARTZ_FONT_FEATURE)
8097 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8098 AC_SUBST(QT_SURFACE_FEATURE)
8099 AC_SUBST(TEE_SURFACE_FEATURE)
8101 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8103 if test "$MOZ_X11"; then
8104 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8107 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8109 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8110 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8111 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8112 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8113 if test "$MOZ_X11"; then
8114 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8115 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8116 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8117 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8121 AC_SUBST(MOZ_TREE_CAIRO)
8122 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
8123 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
8124 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
8125 AC_SUBST(MOZ_TREE_PIXMAN)
8127 dnl ========================================================
8129 dnl ========================================================
8130 if test "$MOZ_ENABLE_SKIA"; then
8131 AC_DEFINE(MOZ_ENABLE_SKIA)
8133 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8134 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8137 if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" ; then
8138 MOZ_ENABLE_SKIA_GPU=1
8139 AC_DEFINE(USE_SKIA_GPU)
8140 AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8143 AC_SUBST(MOZ_ENABLE_SKIA)
8145 dnl ========================================================
8147 dnl ========================================================
8148 MOZ_ARG_DISABLE_BOOL(xul,
8149 [ --disable-xul Disable XUL],
8151 if test "$MOZ_XUL"; then
8154 dnl remove extensions that require XUL
8155 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
8160 dnl ========================================================
8161 dnl disable profile locking
8162 dnl do no use this in applications that can have more than
8163 dnl one process accessing the profile directory.
8164 dnl ========================================================
8165 MOZ_ARG_DISABLE_BOOL(profilelocking,
8166 [ --disable-profilelocking
8167 Disable profile locking],
8168 MOZ_PROFILELOCKING=,
8169 MOZ_PROFILELOCKING=1 )
8170 if test "$MOZ_PROFILELOCKING"; then
8171 AC_DEFINE(MOZ_PROFILELOCKING)
8174 dnl ========================================================
8175 dnl necko configuration options
8176 dnl ========================================================
8179 dnl option to disable various necko protocols
8181 MOZ_ARG_ENABLE_STRING(necko-protocols,
8182 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8183 Enable/disable specific protocol handlers],
8184 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8185 if test "$option" = "yes" -o "$option" = "all"; then
8186 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8187 elif test "$option" = "no" -o "$option" = "none"; then
8189 elif test "$option" = "default"; then
8190 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8191 elif test `echo "$option" | grep -c \^-` != 0; then
8192 option=`echo $option | sed 's/^-//'`
8193 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8195 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8198 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8200 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8201 AC_SUBST_SET(NECKO_PROTOCOLS)
8202 for p in $NECKO_PROTOCOLS; do
8203 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8204 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8208 dnl option to disable necko's wifi scanner
8211 case "$OS_TARGET" in
8213 if test -n "$gonkdir"; then
8217 Darwin|FreeBSD|SunOS|WINNT)
8226 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8227 [ --disable-necko-wifi Disable necko wifi scanner],
8231 if test "$NECKO_WIFI"; then
8232 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
8233 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
8235 AC_DEFINE(NECKO_WIFI)
8236 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8238 AC_SUBST(NECKO_WIFI)
8239 AC_SUBST(NECKO_WIFI_DBUS)
8242 dnl option to disable cookies
8244 MOZ_ARG_DISABLE_BOOL(cookies,
8245 [ --disable-cookies Disable cookie support],
8248 AC_SUBST(NECKO_COOKIES)
8249 if test "$NECKO_COOKIES"; then
8250 AC_DEFINE(NECKO_COOKIES)
8251 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8255 dnl Always build Marionette if not Android or B2G
8257 if test "$OS_TARGET" != Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
8258 AC_DEFINE(ENABLE_MARIONETTE)
8260 AC_SUBST(ENABLE_MARIONETTE)
8261 if test "$ENABLE_MARIONETTE"; then
8262 AC_DEFINE(ENABLE_MARIONETTE)
8266 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8268 MOZ_ARG_DISABLE_BOOL(ctypes,
8269 [ --disable-ctypes Disable js-ctypes],
8272 AC_SUBST(BUILD_CTYPES)
8273 if test "$BUILD_CTYPES"; then
8274 AC_DEFINE(BUILD_CTYPES)
8277 dnl Build Places if required
8278 if test "$MOZ_PLACES"; then
8279 AC_DEFINE(MOZ_PLACES)
8282 dnl Build SocialAPI if required
8283 if test "$MOZ_SOCIAL"; then
8284 AC_DEFINE(MOZ_SOCIAL)
8287 dnl Build Common JS modules provided by services.
8288 AC_SUBST(MOZ_SERVICES_COMMON)
8289 if test -n "$MOZ_SERVICES_COMMON"; then
8290 AC_DEFINE(MOZ_SERVICES_COMMON)
8293 dnl Build Services crypto component (used by Sync)
8294 AC_SUBST(MOZ_SERVICES_CRYPTO)
8295 if test -n "$MOZ_SERVICES_CRYPTO"; then
8296 AC_DEFINE(MOZ_SERVICES_CRYPTO)
8299 dnl Build Firefox Health Reporter Service
8300 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8301 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8302 AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8305 dnl Build Services metrics component
8306 AC_SUBST(MOZ_SERVICES_METRICS)
8307 if test -n "$MOZ_SERVICES_METRICS"; then
8308 AC_DEFINE(MOZ_SERVICES_METRICS)
8311 dnl Build Notifications if required
8312 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8313 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8314 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8317 dnl Build Sync Services if required
8318 AC_SUBST(MOZ_SERVICES_SYNC)
8319 if test -n "$MOZ_SERVICES_SYNC"; then
8320 AC_DEFINE(MOZ_SERVICES_SYNC)
8323 dnl Build Captive Portal Detector if required
8324 AC_SUBST(MOZ_CAPTIVEDETECT)
8325 if test -n "$MOZ_CAPTIVEDETECT"; then
8326 AC_DEFINE(MOZ_CAPTIVEDETECT)
8329 dnl Build second screen and casting features for external devices if required
8330 AC_SUBST(MOZ_DEVICES)
8331 if test -n "$MOZ_DEVICES"; then
8332 AC_DEFINE(MOZ_DEVICES)
8335 dnl ========================================================
8336 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8337 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8340 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8341 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8344 if test "$MOZ_APP_COMPONENT_MODULES"; then
8345 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8348 dnl ========================================================
8350 dnl = Maintainer debug option (no --enable equivalent)
8352 dnl ========================================================
8357 AC_SUBST(AR_EXTRACT)
8361 AC_SUBST(AS_DASH_C_FLAG)
8370 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8371 AC_SUBST(MOZ_UPDATE_XTERM)
8372 AC_SUBST(MOZ_AUTH_EXTENSION)
8373 AC_SUBST(MOZ_PERMISSIONS)
8374 AC_SUBST(MOZ_PREF_EXTENSIONS)
8376 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8377 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8378 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8379 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8380 AC_SUBST(WARNINGS_AS_ERRORS)
8381 AC_SUBST(MOZ_EXTENSIONS)
8382 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8385 AC_SUBST(MOZ_INSTRUMENTS)
8386 AC_SUBST(MOZ_CALLGRIND)
8388 AC_SUBST(MOZ_PROFILING)
8390 AC_SUBST(MOZ_PLACES)
8391 AC_SUBST(MOZ_SOCIAL)
8392 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8394 AC_SUBST(NS_PRINTING)
8396 AC_SUBST(MOZ_HELP_VIEWER)
8397 AC_SUBST(TOOLCHAIN_PREFIX)
8406 AC_SUBST(MOZ_PROFILELOCKING)
8408 AC_SUBST(ENABLE_TESTS)
8409 AC_SUBST(MOZ_UNIVERSALCHARDET)
8410 AC_SUBST(ACCESSIBILITY)
8411 AC_SUBST(MOZ_SPELLCHECK)
8412 AC_SUBST(MOZ_ANDROID_OMTC)
8413 AC_SUBST(MOZ_ANDROID_APZ)
8414 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8415 AC_SUBST(MOZ_CRASHREPORTER)
8416 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8417 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8418 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8419 AC_SUBST(MOZ_STUB_INSTALLER)
8420 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8421 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8422 AC_SUBST(MOZ_UPDATER)
8424 AC_SUBST(MOZ_ANGLE_RENDERER)
8425 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
8426 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
8427 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
8428 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
8429 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8430 AC_SUBST(MOZ_D3DCOMPILER_XP_DLL)
8431 AC_SUBST(MOZ_D3DCOMPILER_XP_CAB)
8435 AC_SUBST(MOZ_ANDROID_HISTORY)
8436 AC_SUBST(MOZ_WEBSMS_BACKEND)
8437 AC_SUBST(MOZ_ANDROID_BEAM)
8438 AC_SUBST(MOZ_LOCALE_SWITCHER)
8439 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
8440 AC_SUBST(MOZ_ANDROID_SEARCH_ACTIVITY)
8441 AC_SUBST(MOZ_ANDROID_MLS_STUMBLER)
8442 AC_SUBST(ENABLE_STRIP)
8443 AC_SUBST(PKG_SKIP_STRIP)
8444 AC_SUBST(STRIP_FLAGS)
8445 AC_SUBST(USE_ELF_HACK)
8446 AC_SUBST(INCREMENTAL_LINKER)
8447 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8448 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8450 AC_SUBST(MOZ_FIX_LINK_PATHS)
8452 AC_SUBST(USE_DEPENDENT_LIBS)
8454 AC_SUBST(MOZ_BUILD_ROOT)
8456 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8457 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8458 AC_SUBST(MOZ_LINKER_EXTRACT)
8460 AC_SUBST(MOZ_JSDOWNLOADS)
8461 if test -n "$MOZ_JSDOWNLOADS"; then
8462 AC_DEFINE(MOZ_JSDOWNLOADS)
8465 dnl ========================================================
8466 dnl = Mac bundle name prefix
8467 dnl ========================================================
8468 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8469 [ --with-macbundlename-prefix=prefix
8470 Prefix for MOZ_MACBUNDLE_NAME],
8471 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8473 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8474 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8475 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8478 if test "$MOZ_DEBUG"; then
8479 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8481 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8483 AC_SUBST(MOZ_MACBUNDLE_NAME)
8485 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8486 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8487 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8488 if test "$MOZ_DEBUG"; then
8489 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8492 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8493 AC_SUBST(MOZ_MACBUNDLE_ID)
8495 dnl ========================================================
8496 dnl = Child Process Name for IPC
8497 dnl ========================================================
8498 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8499 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8501 # We want to let Android unpack the file at install time, but it only does
8502 # so if the file is named libsomething.so. The lib/ path is also required
8503 # because the unpacked file will be under the lib/ subdirectory and will
8504 # need to be executed from that path.
8505 MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8507 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8509 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8510 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8512 # The following variables are available to branding and application
8513 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8514 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8515 # impacts profile location and user-visible fields.
8516 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8517 # versions of a given application (e.g. Aurora and Firefox both use
8518 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8519 # for application.ini's "Name" field, which controls profile location in
8520 # the absence of a "Profile" field (see below), and various system
8521 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8522 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8523 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8524 # builds (e.g. Aurora for Firefox).
8525 # - MOZ_APP_VERSION: Defines the application version number.
8526 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8527 # defaults to a lowercase form of MOZ_APP_BASENAME.
8528 # - MOZ_APP_PROFILE: When set, used for application.ini's
8529 # "Profile" field, which controls profile location.
8530 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8531 # crash reporter server url.
8532 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8533 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8535 if test -z "$MOZ_APP_NAME"; then
8536 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8539 # For extensions and langpacks, we require a max version that is compatible
8540 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8541 # 24.0a1 and 24.0a2 aren't affected
8543 # 24.1.1 becomes 24.*
8544 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8545 if test -z "$IS_ALPHA"; then
8547 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
8550 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8553 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8554 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8555 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8557 AC_SUBST(MOZ_APP_NAME)
8558 AC_SUBST(MOZ_APP_DISPLAYNAME)
8559 AC_SUBST(MOZ_APP_BASENAME)
8560 AC_SUBST(MOZ_APP_VENDOR)
8561 AC_SUBST(MOZ_APP_PROFILE)
8562 AC_SUBST(MOZ_APP_ID)
8563 AC_SUBST(MAR_CHANNEL_ID)
8564 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8565 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8566 AC_SUBST(MOZ_EXTENSION_MANAGER)
8567 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8568 AC_SUBST(MOZ_APP_UA_NAME)
8569 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8570 AC_SUBST(MOZ_APP_VERSION)
8571 AC_SUBST(MOZ_APP_MAXVERSION)
8572 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8573 AC_SUBST(FIREFOX_VERSION)
8574 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8575 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8576 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8579 AC_SUBST(MOZ_APP_STATIC_INI)
8581 AC_SUBST(MOZ_PKG_SPECIAL)
8583 AC_SUBST(MOZILLA_OFFICIAL)
8585 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8586 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8588 if test "$MOZ_TELEMETRY_REPORTING"; then
8589 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8591 # Enable Telemetry by default for nightly and aurora channels
8592 if test -z "$RELEASE_BUILD"; then
8593 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8597 dnl If we have any service that uploads data (and requires data submission
8598 dnl policy alert), set MOZ_DATA_REPORTING.
8599 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8600 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8601 MOZ_DATA_REPORTING=1
8602 AC_DEFINE(MOZ_DATA_REPORTING)
8603 AC_SUBST(MOZ_DATA_REPORTING)
8607 AC_SUBST(MOZ_BROWSE_INFO)
8608 AC_SUBST(MOZ_TOOLS_DIR)
8609 AC_SUBST(WIN32_REDIST_DIR)
8612 dnl Echo the CFLAGS to remove extra whitespace.
8618 $_WARNINGS_CXXFLAGS \
8621 COMPILE_CFLAGS=`echo \
8626 COMPILE_CXXFLAGS=`echo \
8627 $_DEFINES_CXXFLAGS \
8635 HOST_CXXFLAGS=`echo \
8639 AC_SUBST(MOZ_NATIVE_JPEG)
8640 AC_SUBST(MOZ_NATIVE_PNG)
8641 AC_SUBST(MOZ_NATIVE_BZ2)
8643 AC_SUBST(MOZ_JPEG_CFLAGS)
8644 AC_SUBST_LIST(MOZ_JPEG_LIBS)
8645 AC_SUBST(MOZ_BZ2_CFLAGS)
8646 AC_SUBST_LIST(MOZ_BZ2_LIBS)
8647 AC_SUBST(MOZ_PNG_CFLAGS)
8648 AC_SUBST_LIST(MOZ_PNG_LIBS)
8650 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
8651 export MOZ_NUWA_PROCESS
8652 AC_DEFINE(MOZ_NUWA_PROCESS)
8654 AC_SUBST(MOZ_NUWA_PROCESS)
8655 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_B2G_LOADER"; then
8656 if test -z "$MOZ_NUWA_PROCESS"; then
8657 AC_MSG_ERROR([B2G loader works with Nuwa]);
8659 export MOZ_B2G_LOADER
8660 AC_DEFINE(MOZ_B2G_LOADER)
8662 AC_SUBST(MOZ_B2G_LOADER)
8664 AC_SUBST(NSPR_CFLAGS)
8665 AC_SUBST(MOZ_NATIVE_NSPR)
8667 AC_SUBST(NSS_CFLAGS)
8668 AC_SUBST(MOZ_NATIVE_NSS)
8669 AC_SUBST(NSS_DISABLE_DBM)
8672 OS_CXXFLAGS="$CXXFLAGS"
8673 OS_CPPFLAGS="$CPPFLAGS"
8674 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8675 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8676 OS_LDFLAGS="$LDFLAGS"
8679 AC_SUBST(OS_CXXFLAGS)
8680 AC_SUBST(OS_CPPFLAGS)
8681 AC_SUBST(OS_COMPILE_CFLAGS)
8682 AC_SUBST(OS_COMPILE_CXXFLAGS)
8683 AC_SUBST(OS_LDFLAGS)
8685 AC_SUBST(CROSS_COMPILE)
8686 AC_SUBST(WCHAR_CFLAGS)
8690 AC_SUBST(HOST_CFLAGS)
8691 AC_SUBST(HOST_CXXFLAGS)
8692 AC_SUBST(HOST_LDFLAGS)
8693 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8695 AC_SUBST(HOST_AR_FLAGS)
8697 AC_SUBST(HOST_RANLIB)
8698 AC_SUBST(HOST_NSPR_MDCPUCFG)
8699 AC_SUBST(HOST_BIN_SUFFIX)
8700 AC_SUBST(HOST_OS_ARCH)
8702 AC_SUBST(TARGET_CPU)
8703 AC_SUBST(TARGET_VENDOR)
8705 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8706 AC_SUBST(TARGET_MD_ARCH)
8707 AC_SUBST(TARGET_XPCOM_ABI)
8710 AC_SUBST(OS_RELEASE)
8713 AC_SUBST(INTEL_ARCHITECTURE)
8714 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
8715 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
8716 AC_SUBST(GCC_USE_GNU_LD)
8718 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8720 AC_SUBST(WRAP_LDFLAGS)
8723 AC_SUBST(MKSHLIB_FORCE_ALL)
8724 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8725 AC_SUBST(DSO_CFLAGS)
8726 AC_SUBST(DSO_PIC_CFLAGS)
8727 AC_SUBST(DSO_LDOPTS)
8728 AC_SUBST(LIB_PREFIX)
8729 AC_SUBST(DLL_PREFIX)
8730 AC_SUBST(DLL_SUFFIX)
8731 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8732 AC_SUBST(LIB_SUFFIX)
8733 AC_SUBST(OBJ_SUFFIX)
8734 AC_SUBST(BIN_SUFFIX)
8735 AC_SUBST(ASM_SUFFIX)
8736 AC_SUBST(IMPORT_LIB_SUFFIX)
8738 AC_SUBST(CC_VERSION)
8739 AC_SUBST(CXX_VERSION)
8740 AC_SUBST(MSMANIFEST_TOOL)
8741 AC_SUBST(NS_ENABLE_TSF)
8742 AC_SUBST_LIST(MOZ_APP_EXTRA_LIBS)
8745 AC_SUBST(MOZ_VORBIS)
8746 AC_SUBST(MOZ_TREMOR)
8750 AC_SUBST(MOZ_FFMPEG)
8753 AC_SUBST(MOZ_DIRECTSHOW)
8754 AC_SUBST(MOZ_ANDROID_OMX)
8755 AC_SUBST(MOZ_APPLEMEDIA)
8756 AC_SUBST(MOZ_OMX_PLUGIN)
8757 AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
8760 AC_SUBST(VPX_ASFLAGS)
8761 AC_SUBST(VPX_DASH_C_FLAG)
8762 AC_SUBST(VPX_AS_CONVERSION)
8763 AC_SUBST(VPX_ASM_SUFFIX)
8764 AC_SUBST(VPX_X86_ASM)
8765 AC_SUBST(VPX_ARM_ASM)
8766 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8767 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8768 AC_SUBST(LIBJPEG_TURBO_AS)
8769 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8770 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8771 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8772 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8774 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8775 AC_SUBST(MOZ_FOLD_LIBS)
8777 AC_SUBST(MOZ_ENABLE_SZIP)
8778 AC_SUBST(MOZ_SZIP_FLAGS)
8780 if test "$MOZ_DEBUG"; then
8783 AC_SUBST(MOZ_EM_DEBUG)
8785 if test -n "$COMPILE_ENVIRONMENT"; then
8786 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
8788 dnl Check for missing components
8789 if test "$MOZ_X11"; then
8790 if test "$WITHOUT_X11"; then
8791 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8793 dnl ====================================================
8794 dnl = Check if X headers exist
8795 dnl ====================================================
8796 _SAVE_CFLAGS=$CFLAGS
8797 CFLAGS="$CFLAGS $XCFLAGS"
8801 #include <X11/Xlib.h>
8802 #include <X11/Intrinsic.h>
8803 #include <X11/extensions/XShm.h>
8807 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8808 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8812 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
8813 CFLAGS="$_SAVE_CFLAGS"
8815 if test -n "$MISSING_X"; then
8816 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8821 fi # COMPILE_ENVIRONMENT
8823 dnl Set various defines and substitutions
8824 dnl ========================================================
8826 if test "$OS_ARCH" != "WINNT"; then
8830 if test "$MOZ_DEBUG"; then
8831 AC_DEFINE(MOZ_REFLOW_PERF)
8832 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8835 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
8836 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8837 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8838 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8839 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8840 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8841 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8842 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8843 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8846 if test "$MOZ_DEBUG"; then
8849 case "$MOZ_UPDATE_CHANNEL" in
8850 aurora|beta|release|esr)
8857 if test -n "$A11Y_LOG"; then
8861 AC_SUBST(MOZILLA_VERSION)
8863 AC_SUBST(ac_configure_args)
8865 dnl Spit out some output
8866 dnl ========================================================
8868 dnl The following defines are used by xpcom
8869 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8871 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8872 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8873 HAVE_CPP_PARTIAL_SPECIALIZATION
8874 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8875 NEED_CPP_UNUSED_IMPLEMENTATIONS
8878 HAVE_ICONV_WITH_CONST_INPUT
8891 AC_SUBST(STLPORT_LIBS)
8893 dnl ========================================================
8895 dnl ========================================================
8897 # Internationalization isn't built or exposed by default in non-desktop
8898 # builds. Bugs to enable:
8900 # Android: bug 864843
8903 if test "$MOZ_WIDGET_TOOLKIT" = "android" ||
8904 test "$MOZ_BUILD_APP" = "b2g"; then
8912 if test -z "$JS_SHARED_LIBRARY"; then
8913 AC_DEFINE(MOZ_STATIC_JS)
8915 AC_SUBST(JS_SHARED_LIBRARY)
8917 AC_SUBST(UPLOAD_EXTRA_FILES)
8919 MOZ_CREATE_CONFIG_STATUS()
8921 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8922 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8923 MOZ_SUBCONFIGURE_ICU()
8924 MOZ_SUBCONFIGURE_FFI()
8927 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8928 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8929 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8930 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8931 # (apparently) only need this hack when egrep's "pattern" is particularly long
8932 # (as in the following code) and the first egrep on our $PATH is Apple's. See
8936 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8943 # Run jemalloc configure script
8945 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
8946 ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
8947 if test -n "$MOZ_REPLACE_MALLOC"; then
8948 # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
8949 ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
8950 ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
8952 if test -n "$MOZ_JEMALLOC3"; then
8953 case "${OS_ARCH}" in
8955 # We want jemalloc functions to be kept hidden on both Mac and Windows
8956 # See memory/build/mozmemory_wrap.h for details.
8957 ac_configure_args="$ac_configure_args --without-export"
8960 elif test "${OS_ARCH}" = Darwin; then
8961 # When building as a replace-malloc lib, disabling the zone allocator
8962 # forces to use pthread_atfork.
8963 ac_configure_args="$ac_configure_args --disable-zone-allocator"
8965 _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
8967 if test -z "$MOZ_REPLACE_MALLOC"; then
8969 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
8973 elif test -z "$MOZ_JEMALLOC3"; then
8975 JEMALLOC_WRAPPER=replace_
8977 if test -n "$MANGLE"; then
8979 if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
8980 JEMALLOC_WRAPPER=__wrap_
8982 for mangle in ${MANGLE}; do
8983 if test -n "$MANGLED"; then
8984 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
8986 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
8989 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
8992 if test -z "$MOZ_TLS"; then
8993 ac_configure_args="$ac_configure_args --disable-tls"
8995 EXTRA_CFLAGS="$CFLAGS"
8996 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
8997 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
8999 if test "$CROSS_COMPILE"; then
9000 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9003 if ! test -e memory/jemalloc; then
9004 mkdir -p memory/jemalloc
9007 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9008 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9011 # Run freetype configure script
9013 if test "$MOZ_TREE_FREETYPE"; then
9014 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9015 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9016 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9017 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9018 # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
9019 # to force freetype to use our settings rather than autodetecting
9020 if test -n "$MOZ_NATIVE_PNG"; then
9021 export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
9023 export LIBPNG_CFLAGS="-I$_objdir/dist/include"
9025 export LIBPNG_LIBS="$MOZ_PNG_LIBS "
9026 export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
9027 export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
9028 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9029 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
9031 if ! test -e modules; then
9035 AC_OUTPUT_SUBDIRS(modules/freetype2,$cache_file)
9038 if test -z "$direct_nspr_config"; then
9039 dnl ========================================================
9040 dnl = Setup a nice relatively clean build environment for
9041 dnl = sub-configures.
9042 dnl ========================================================
9045 CFLAGS="$_SUBDIR_CFLAGS"
9046 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9047 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9048 LDFLAGS="$_SUBDIR_LDFLAGS"
9049 HOST_CC="$_SUBDIR_HOST_CC"
9050 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9051 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9052 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9059 # Run all configure scripts specified by a subconfigure
9060 if test -n "$_subconfigure_subdir"; then
9061 _save_srcdir="$srcdir"
9063 _save_ac_configure_args="$ac_configure_args"
9064 ac_configure_args="$_subconfigure_config_args"
9065 AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
9066 ac_configure_args="$_save_ac_configure_args"
9067 srcdir="$_save_srcdir"
9070 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9071 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9075 if test -n "$_WRAP_MALLOC"; then
9076 # Avoid doubling wrap malloc arguments
9077 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9080 MOZ_SUBCONFIGURE_NSPR()
9082 dnl ========================================================
9083 dnl = Setup a nice relatively clean build environment for
9084 dnl = sub-configures.
9085 dnl ========================================================
9088 CFLAGS="$_SUBDIR_CFLAGS"
9089 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9090 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9091 LDFLAGS="$_SUBDIR_LDFLAGS"
9092 HOST_CC="$_SUBDIR_HOST_CC"
9093 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9094 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9095 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9098 if test -n "$ENABLE_CLANG_PLUGIN"; then
9099 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9100 AC_OUTPUT_SUBDIRS(build/clang-plugin)
9103 # Run the SpiderMonkey 'configure' script.
9104 dist=$MOZ_BUILD_ROOT/dist
9105 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9107 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
9109 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
9111 ac_configure_args="$ac_configure_args --enable-threadsafe"
9113 if test "$_INTL_API" = no; then
9114 ac_configure_args="$ac_configure_args --without-intl-api"
9117 if test "$BUILD_CTYPES"; then
9118 # Build js-ctypes on the platforms we can.
9119 ac_configure_args="$ac_configure_args --enable-ctypes"
9121 if test -z "$JS_SHARED_LIBRARY" ; then
9122 ac_configure_args="$ac_configure_args --disable-shared-js"
9123 if test -n "$MOZ_DISABLE_EXPORT_JS"; then
9124 ac_configure_args="$ac_configure_args --disable-export-js"
9127 if test -z "$JSGC_USE_EXACT_ROOTING" ; then
9128 ac_configure_args="$ac_configure_args --disable-exact-rooting"
9130 if test -z "$JSGC_GENERATIONAL" ; then
9131 ac_configure_args="$ac_configure_args --disable-gcgenerational"
9133 if test -n "$JS_GC_SMALL_CHUNK_SIZE" ; then
9134 ac_configure_args="$ac_configure_args --enable-small-chunk-size"
9136 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
9137 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9138 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9140 ac_configure_args="$ac_configure_args --prefix=$dist"
9141 if test "$MOZ_MEMORY"; then
9142 ac_configure_args="$ac_configure_args --enable-jemalloc"
9144 if test -n "$MOZ_GLUE_LDFLAGS"; then
9145 export MOZ_GLUE_LDFLAGS
9147 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9148 export MOZ_GLUE_PROGRAM_LDFLAGS
9150 if test -n "$ZLIB_IN_MOZGLUE"; then
9153 export MOZ_NATIVE_ZLIB
9154 export MOZ_ZLIB_CFLAGS
9155 export MOZ_ZLIB_LIBS
9157 export DONT_POPULATE_VIRTUALENV=1
9159 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9160 export STLPORT_CPPFLAGS
9162 export JS_STANDALONE=no
9164 export ZLIB_IN_MOZGLUE
9166 if ! test -e js; then
9170 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
9171 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9173 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9175 export WRITE_MOZINFO=1
9176 dnl we need to run config.status after js/src subconfigure because we're
9177 dnl traversing its moz.build and we need its config.status for that.
9178 dnl However, writing our own config.status needs to happen before
9179 dnl subconfigures because the setup surrounding subconfigures alters
9180 dnl many AC_SUBSTed variables.
9181 MOZ_RUN_CONFIG_STATUS()