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)
1268 dnl ========================================================
1269 dnl = Use Memory Sanitizer
1270 dnl ========================================================
1271 MOZ_ARG_ENABLE_BOOL(memory-sanitizer,
1272 [ --enable-memory-sanitizer Enable Memory Sanitizer (default=no)],
1275 if test -n "$MOZ_MSAN"; then
1278 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1282 # The LLVM symbolizer is used by all sanitizers
1283 AC_SUBST(LLVM_SYMBOLIZER)
1285 dnl ========================================================
1286 dnl = Enable hacks required for LLVM instrumentations
1287 dnl ========================================================
1288 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1289 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1292 if test -n "$MOZ_LLVM_HACKS"; then
1296 AC_SUBST(MOZ_NO_WLZDEFS)
1297 AC_SUBST(MOZ_CFLAGS_NSS)
1299 dnl ========================================================
1300 dnl GNU specific defaults
1301 dnl ========================================================
1302 if test "$GNU_CC"; then
1306 # Per bug 719659 comment 2, some of the headers on ancient build machines
1307 # may require gnu89 inline semantics. But otherwise, we use C99.
1308 # But on OS X we just use C99 plus GNU extensions, in order to fix
1310 CFLAGS="$CFLAGS -std=gnu99"
1311 if test "${OS_ARCH}" != Darwin; then
1312 CFLAGS="$CFLAGS -fgnu89-inline"
1314 # FIXME: Let us build with strict aliasing. bug 414641.
1315 CFLAGS="$CFLAGS -fno-strict-aliasing"
1316 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1317 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1318 WARNINGS_AS_ERRORS='-Werror'
1320 DSO_PIC_CFLAGS='-fPIC'
1321 ASFLAGS="$ASFLAGS -fPIC"
1322 AC_MSG_CHECKING([for --noexecstack option to as])
1323 _SAVE_CFLAGS=$CFLAGS
1324 CFLAGS="$CFLAGS -Wa,--noexecstack"
1325 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1326 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1327 AC_MSG_RESULT([no]))
1328 CFLAGS=$_SAVE_CFLAGS
1329 AC_MSG_CHECKING([for -z noexecstack option to ld])
1330 _SAVE_LDFLAGS=$LDFLAGS
1331 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1332 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1334 LDFLAGS=$_SAVE_LDFLAGS)
1336 AC_MSG_CHECKING([for -z text option to ld])
1337 _SAVE_LDFLAGS=$LDFLAGS
1338 LDFLAGS="$LDFLAGS -Wl,-z,text"
1339 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1340 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1342 LDFLAGS=$_SAVE_LDFLAGS)
1344 AC_MSG_CHECKING([for --build-id option to ld])
1345 _SAVE_LDFLAGS=$LDFLAGS
1346 LDFLAGS="$LDFLAGS -Wl,--build-id"
1347 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1348 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1350 LDFLAGS=$_SAVE_LDFLAGS)
1352 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
1353 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
1354 _SAVE_LDFLAGS=$LDFLAGS
1355 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
1356 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1357 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
1358 AC_MSG_RESULT([no]))
1359 LDFLAGS=$_SAVE_LDFLAGS
1361 # Check for -mssse3 on $CC
1362 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1363 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1364 _SAVE_CFLAGS=$CFLAGS
1365 CFLAGS="$CFLAGS -mssse3"
1366 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1367 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1368 AC_MSG_RESULT([no]))
1369 CFLAGS=$_SAVE_CFLAGS
1371 # Check for -msse4.1 on $CC
1372 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1373 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1374 _SAVE_CFLAGS=$CFLAGS
1375 CFLAGS="$CFLAGS -msse4.1"
1376 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1377 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1378 AC_MSG_RESULT([no]))
1379 CFLAGS=$_SAVE_CFLAGS
1381 case "${CPU_ARCH}" in
1383 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
1385 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
1386 result="yes", result="no")
1387 AC_MSG_RESULT("$result")
1388 if test "$result" = "yes"; then
1393 DSO_LDOPTS='-shared'
1394 if test "$GCC_USE_GNU_LD"; then
1395 # Some tools like ASan use a runtime library that is only
1396 # linked against executables, so we must allow undefined
1397 # symbols for shared objects in some cases.
1398 if test -z "$MOZ_NO_WLZDEFS"; then
1399 # Don't allow undefined symbols in libraries
1400 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1402 # BSDs need `environ' exposed for posix_spawn (bug 753046)
1403 case "$OS_TARGET" in
1404 DragonFly|FreeBSD|NetBSD|OpenBSD)
1405 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
1406 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
1408 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
1415 # Turn on GNU-specific warnings:
1416 # -Wall - turn on a lot of warnings
1417 # -Wpointer-arith - good to have
1418 # -Wdeclaration-after-statement - MSVC doesn't like these
1419 # -Werror=return-type - catches missing returns, zero false positives
1420 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
1421 # -Wtype-limits - catches overflow bugs, few false positives
1422 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1423 # -Wsign-compare - catches comparison of signed and unsigned types
1425 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1426 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1427 MOZ_C_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_c_has_werror_int_to_pointer_cast)
1428 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1429 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1430 MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1432 # Turn off the following warnings that -Wall turns on:
1433 # -Wno-unused - lots of violations in third-party code
1435 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1437 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1438 # Don't use -Wcast-align with ICC or clang
1440 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1441 hppa | ia64 | sparc | arm)
1444 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1449 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1450 _USE_CPP_INCLUDE_FLAG=1
1451 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1453 elif test "$SOLARIS_SUNPRO_CC"; then
1455 if test "$CPU_ARCH" = "sparc"; then
1456 # for Sun Studio on Solaris/SPARC
1457 DSO_PIC_CFLAGS='-xcode=pic32'
1459 DSO_PIC_CFLAGS='-KPIC'
1461 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1463 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1464 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1466 DSO_LDOPTS='-shared'
1467 if test "$GNU_LD"; then
1468 # Don't allow undefined symbols in libraries
1469 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1473 DSO_PIC_CFLAGS='-KPIC'
1474 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1477 if test "$GNU_CXX"; then
1478 # FIXME: Let us build with strict aliasing. bug 414641.
1479 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1481 # Turn on GNU-specific warnings:
1482 # -Wall - turn on a lot of warnings
1483 # -Wpointer-arith - good to have
1484 # -Woverloaded-virtual - ???
1485 # -Werror=return-type - catches missing returns, zero false positives
1486 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
1487 # -Werror=type-limits - catches overflow bugs, few false positives
1488 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1489 # -Wsign-compare - catches comparison of signed and unsigned types
1491 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1492 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1493 MOZ_CXX_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_cxx_has_werror_int_to_pointer_cast)
1494 MOZ_CXX_SUPPORTS_WARNING(-W, error=type-limits, ac_cxx_has_werror_type_limits)
1495 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1496 MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1498 # Turn off the following warnings that -Wall turns on:
1499 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1500 # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc
1501 # for performance reasons, and because GCC and clang accept it (though
1502 # clang warns about it).
1504 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1505 MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete)
1507 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1508 # Don't use -Wcast-align with ICC or clang
1510 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1511 hppa | ia64 | sparc | arm)
1514 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1519 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1520 _USE_CPP_INCLUDE_FLAG=1
1522 # Recent clang and gcc support C++11 deleted functions without warnings if
1523 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1524 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1525 # unused. But clang's warning can be disabled, so when compiling with clang
1526 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1527 # deleted function syntax.
1528 if test "$CLANG_CXX"; then
1529 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1530 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1534 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1537 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1538 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1539 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1540 dnl normal behavior.
1541 dnl ========================================================
1543 MKSHLIB_UNFORCE_ALL=
1545 if test "$COMPILE_ENVIRONMENT"; then
1546 if test "$GNU_CC"; then
1547 AC_MSG_CHECKING(whether ld has archive extraction flags)
1548 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1549 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1550 ac_cv_mkshlib_force_and_unforce="no"
1551 exec 3<&0 <<LOOP_INPUT
1552 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1553 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1554 force="-Wl,-all"; unforce="-Wl,-none"
1561 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1564 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1566 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1570 eval $ac_cv_mkshlib_force_and_unforce
1571 MKSHLIB_FORCE_ALL=$force
1572 MKSHLIB_UNFORCE_ALL=$unforce
1575 fi # COMPILE_ENVIRONMENT
1577 dnl ========================================================
1578 dnl Checking for 64-bit OS
1579 dnl ========================================================
1580 if test "$COMPILE_ENVIRONMENT"; then
1583 AC_MSG_CHECKING(for 64-bit OS)
1584 AC_TRY_COMPILE([$configure_static_assert_macros],
1585 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1586 result="yes", result="no")
1587 AC_MSG_RESULT("$result")
1588 if test "$result" = "yes"; then
1589 AC_DEFINE(HAVE_64BIT_BUILD)
1592 AC_SUBST(HAVE_64BIT_BUILD)
1594 fi # COMPILE_ENVIRONMENT
1596 dnl ========================================================
1597 dnl = Use profiling compile flags
1598 dnl ========================================================
1599 MOZ_ARG_ENABLE_BOOL(profiling,
1600 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1604 dnl ========================================================
1605 dnl = Turn on systrace for android/b2g.
1606 dnl ========================================================
1607 MOZ_ARG_ENABLE_BOOL(systrace,
1608 [ --enable-systrace Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1611 if test -n "$MOZ_USE_SYSTRACE"; then
1612 AC_DEFINE(MOZ_USE_SYSTRACE)
1615 # For profiling builds keep the symbol information
1616 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1617 case "$OS_TARGET" in
1618 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1619 STRIP_FLAGS="--strip-debug"
1624 dnl ========================================================
1626 dnl ========================================================
1627 MOZ_ARG_ENABLE_BOOL(valgrind,
1628 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1631 if test -n "$MOZ_VALGRIND"; then
1632 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1634 [--enable-valgrind specified but Valgrind is not installed]))
1635 AC_DEFINE(MOZ_VALGRIND)
1637 AC_SUBST(MOZ_VALGRIND)
1639 dnl ========================================================
1641 dnl ========================================================
1642 MOZ_ARG_ENABLE_BOOL(jprof,
1643 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1646 if test -n "$MOZ_JPROF"; then
1648 AC_DEFINE(MOZ_JPROF)
1651 dnl ========================================================
1653 dnl ========================================================
1654 MOZ_ENABLE_PROFILER_SPS=1
1656 case "${OS_TARGET}" in
1658 case "${CPU_ARCH}" in
1661 MOZ_ENABLE_PROFILER_SPS=
1665 case "${CPU_ARCH}" in
1668 MOZ_ENABLE_PROFILER_SPS=
1673 MOZ_ENABLE_PROFILER_SPS=
1677 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1678 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1681 dnl ========================================================
1683 dnl ========================================================
1684 MOZ_ARG_ENABLE_BOOL(shark,
1685 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1688 if test -n "$MOZ_SHARK"; then
1690 AC_DEFINE(MOZ_SHARK)
1693 dnl ========================================================
1695 dnl ========================================================
1696 MOZ_ARG_ENABLE_BOOL(instruments,
1697 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
1700 if test -n "$MOZ_INSTRUMENTS"; then
1702 AC_DEFINE(MOZ_INSTRUMENTS)
1705 dnl ========================================================
1707 dnl ========================================================
1708 MOZ_ARG_ENABLE_BOOL(callgrind,
1709 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1712 if test -n "$MOZ_CALLGRIND"; then
1714 AC_DEFINE(MOZ_CALLGRIND)
1717 dnl ========================================================
1719 dnl ========================================================
1720 MOZ_ARG_ENABLE_BOOL(vtune,
1721 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1724 if test -n "$MOZ_VTUNE"; then
1726 AC_DEFINE(MOZ_VTUNE)
1729 dnl ========================================================
1731 dnl ========================================================
1732 if test -n "$MOZ_PROFILING"; then
1733 AC_DEFINE(MOZ_PROFILING)
1736 dnl ========================================================
1737 dnl System overrides of the defaults for host
1738 dnl ========================================================
1741 if test -n "$_WIN32_MSVC"; then
1743 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
1744 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
1745 HOST_RANLIB='echo ranlib'
1747 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1749 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1750 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1751 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1752 HOST_BIN_SUFFIX=.exe
1755 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1759 case "${host_cpu}" in
1761 if test -n "$_WIN32_MSVC"; then
1762 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1766 if test -n "$_WIN32_MSVC"; then
1767 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1769 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1775 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1776 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1777 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1780 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1781 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1782 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1783 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1787 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1788 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1792 dnl Check for using a custom <inttypes.h> implementation
1793 dnl ========================================================
1794 AC_MSG_CHECKING(for custom <inttypes.h> implementation)
1795 if test "$MOZ_CUSTOM_INTTYPES_H"; then
1796 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
1797 AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
1799 AC_MSG_RESULT(none specified)
1802 dnl Get mozilla version from central milestone file
1803 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1804 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1805 MOZILLA_SYMBOLVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -symbolversion`
1807 dnl Get version of various core apps from the version files.
1808 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1810 if test -z "$FIREFOX_VERSION"; then
1811 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1814 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1815 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1816 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1817 AC_SUBST(MOZILLA_SYMBOLVERSION)
1819 MOZ_DOING_LTO(lto_is_enabled)
1821 dnl ========================================================
1822 dnl System overrides of the defaults for target
1823 dnl ========================================================
1828 if test ! "$GNU_CC"; then
1829 if test ! "$HAVE_64BIT_BUILD"; then
1830 # Compiling with Visual Age C++ object model compat is the
1831 # default. To compile with object model ibm, add
1832 # AIX_OBJMODEL=ibm to .mozconfig.
1833 if test "$AIX_OBJMODEL" = "ibm"; then
1834 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1841 AC_SUBST(AIX_OBJMODEL)
1842 DSO_LDOPTS='-qmkshrobj=1'
1843 DSO_CFLAGS='-qflag=w:w'
1845 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1847 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1848 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1849 if test "$COMPILE_ENVIRONMENT"; then
1852 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1854 [#if (__IBMCPP__ < 900)
1855 #error "Bad compiler"
1857 _BAD_COMPILER=,_BAD_COMPILER=1)
1858 if test -n "$_BAD_COMPILER"; then
1860 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1862 AC_MSG_RESULT([yes])
1865 TARGET_COMPILER_ABI="ibmc"
1866 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1867 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1870 case "${target_os}" in
1875 if test "$COMPILE_ENVIRONMENT"; then
1876 MOZ_CHECK_HEADERS(sys/inttypes.h)
1878 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1882 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1883 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1884 MOZ_OPTIMIZE_FLAGS="-O3"
1885 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1886 if test "$HAVE_64BIT_BUILD"; then
1891 STRIP_FLAGS="$STRIP_FLAGS -x -S"
1892 # Check whether we're targeting OS X or iOS
1893 AC_CACHE_CHECK(for iOS target,
1895 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1896 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1900 ac_cv_ios_target="yes",
1901 ac_cv_ios_target="no")])
1902 if test "$ac_cv_ios_target" = "yes"; then
1904 AC_DEFINE(XP_DARWIN)
1905 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1907 AC_DEFINE(XP_MACOSX)
1908 AC_DEFINE(XP_DARWIN)
1909 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1910 # The ExceptionHandling framework is needed for Objective-C exception
1911 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1913 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1915 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1917 if test "x$lto_is_enabled" = "xyes"; then
1918 echo "Skipping -dead_strip because lto is enabled."
1919 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1920 dnl ===================================================================
1921 elif test "x$enable_dtrace" = "xyes"; then
1922 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1924 dnl check for the presence of the -dead_strip linker flag
1925 AC_MSG_CHECKING([for -dead_strip option to ld])
1926 _SAVE_LDFLAGS=$LDFLAGS
1927 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1928 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1929 if test -n "$_HAVE_DEAD_STRIP" ; then
1930 AC_MSG_RESULT([yes])
1931 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1936 LDFLAGS=$_SAVE_LDFLAGS
1939 dnl With newer linkers we need to pass -allow_heap_execute because of
1940 dnl Microsoft Silverlight (5.1.10411.0 at least).
1941 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1942 _SAVE_LDFLAGS=$LDFLAGS
1943 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1944 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1945 _HAVE_ALLOW_HEAP_EXECUTE=)
1946 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1947 AC_MSG_RESULT([yes])
1948 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1952 LDFLAGS=$_SAVE_LDFLAGS
1954 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1959 if test ! "$GNU_CC"; then
1963 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1964 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1965 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1968 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1969 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1972 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1973 AC_DEFINE(_LARGEFILE64_SOURCE)
1978 if test ! "$GNU_CC"; then
1979 DSO_LDOPTS='-b -Wl,+s'
1982 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1983 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1984 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1986 DSO_LDOPTS='-b -E +s'
1987 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1988 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1990 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1991 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1994 *-android*|*-linuxandroid*)
1995 AC_DEFINE(NO_PW_GECOS)
1997 if test -n "$gonkdir"; then
1998 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
1999 _PLATFORM_HAVE_RIL=1
2003 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2006 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2008 MOZ_GFX_OPTIMIZE_MOBILE=1
2009 MOZ_OPTIMIZE_FLAGS="-Os -fno-reorder-functions"
2010 if test -z "$CLANG_CC"; then
2011 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
2016 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2017 # Similarly for GNU_CXX and INTEL_CXX.
2018 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2019 # -Os has been broken on Intel's C/C++ compilers for quite a
2020 # while; Intel recommends against using it.
2021 MOZ_OPTIMIZE_FLAGS="-O2"
2022 elif test "$GNU_CC" -o "$GNU_CXX"; then
2023 case $GCC_VERSION in
2025 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
2026 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2028 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2029 MOZ_OPTIMIZE_FLAGS="-Os $MOZ_OPTIMIZE_SIZE_TWEAK"
2030 if test -z "$CLANG_CC"; then
2031 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
2035 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2039 case "${target_cpu}" in
2041 CFLAGS="$CFLAGS -mieee"
2042 CXXFLAGS="$CXXFLAGS -mieee"
2046 if test -z "$MC"; then
2056 # certain versions of cygwin's makedepend barf on the
2057 # #include <string> vs -I./dist/include/string issue so don't use it
2058 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
2060 CXX="$CXX -mwindows"
2061 CPP="$CPP -mwindows"
2062 CFLAGS="$CFLAGS -mms-bitfields"
2063 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2064 DSO_LDOPTS='-shared'
2065 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2066 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2068 # Use static libgcc and libstdc++
2069 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
2070 NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
2071 # Use temp file for windres (bug 213281)
2072 RCFLAGS='-O coff --use-temp-file'
2073 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2074 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2079 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
2080 WIN32_GUI_EXE_LDFLAGS=-mwindows
2082 # We use mix of both POSIX and Win32 printf format across the tree, so format
2083 # warnings are useless on mingw.
2084 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2085 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2087 TARGET_COMPILER_ABI=msvc
2091 if test "$AS_BIN"; then
2092 AS="$(basename "$AS_BIN")"
2095 AR_FLAGS='-NOLOGO -OUT:$@'
2097 RANLIB='echo not_ranlib'
2098 STRIP='echo not_strip'
2109 IMPORT_LIB_SUFFIX=lib
2110 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2111 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2113 MKSHLIB_UNFORCE_ALL=
2114 dnl Set subsystem version 5 for Windows XP.
2115 if test "$CPU_ARCH" = "x86"; then
2116 WIN32_SUBSYSTEM_VERSION=5.01
2118 WIN32_SUBSYSTEM_VERSION=5.02
2120 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
2121 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
2122 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
2123 _USE_CPP_INCLUDE_FLAG=1
2124 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2125 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2126 CFLAGS="$CFLAGS -W3 -Gy"
2127 CXXFLAGS="$CXXFLAGS -W3 -Gy"
2128 if test "$_CC_SUITE" -ge "11" -a "$CPU_ARCH" = "x86"; then
2129 dnl VS2012+ defaults to -arch:SSE2.
2130 CFLAGS="$CFLAGS -arch:IA32"
2131 CXXFLAGS="$CXXFLAGS -arch:IA32"
2133 if test "$_CC_SUITE" -ge "12"; then
2134 dnl VS2013+ requires -FS when parallel building by make -jN.
2135 dnl If nothing, compiler sometimes causes C1041 error.
2136 CFLAGS="$CFLAGS -FS"
2137 CXXFLAGS="$CXXFLAGS -FS"
2139 # khuey says we can safely ignore MSVC warning C4251
2140 # MSVC warning C4244 (implicit type conversion may lose data) warns
2141 # and requires workarounds for perfectly valid code. Also, GCC/clang
2142 # don't warn about it by default. So for consistency/sanity, we turn
2143 # it off on MSVC, too.
2144 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2145 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2146 # MSVC warning C4482 warns when an enum value is refered specifing the
2147 # name of the enum itself. This behavior is allowed in C++11, and the
2148 # warning has been removed in VS2012.
2149 # MSVC warning C4800 warns when a value is implicitly cast to bool,
2150 # because this also forces narrowing to a single byte, which can be a
2151 # perf hit. But this matters so little in practice (and often we want
2152 # that behavior) that it's better to turn it off.
2153 # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2154 # on non-Western system locales even if it is in a comment.
2155 CFLAGS="$CFLAGS -wd4244 -wd4819"
2156 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2157 # make 'foo == bar;' error out
2158 CFLAGS="$CFLAGS -we4553"
2159 CXXFLAGS="$CXXFLAGS -we4553"
2160 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2161 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2162 WARNINGS_AS_ERRORS='-WX'
2163 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
2165 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2166 # Disable these flags on clang-cl since it doesn't ignore unknown arguments by default, and
2167 # autoconf insists on passing $LDFLAGS to the compiler.
2168 if test -z "$CLANG_CL"; then
2169 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2170 if test -z "$DEVELOPER_OPTIONS"; then
2171 LDFLAGS="$LDFLAGS -RELEASE"
2174 dnl For profile-guided optimization
2175 PROFILE_GEN_CFLAGS="-GL"
2176 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2177 dnl XXX: PGO builds can fail with warnings treated as errors,
2178 dnl specifically "no profile data available" appears to be
2179 dnl treated as an error sometimes. This might be a consequence
2180 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2181 dnl with the linker doing most of the work in the whole-program
2182 dnl optimization/PGO case. I think it's probably a compiler bug,
2183 dnl but we work around it here.
2184 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2185 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2186 dnl Probably also a compiler bug, but what can you do?
2187 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2188 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2189 dnl Minimum reqiurement of Gecko is VS2010 or later which supports
2190 dnl both SSSE3 and SSE4.1.
2191 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2192 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
2193 if test "$_CC_SUITE" -ge "11"; then
2194 dnl allow AVX2 code from VS2012
2199 AC_DEFINE(HAVE_SNPRINTF)
2204 AC_DEFINE(HW_THREADS)
2205 AC_DEFINE(STDC_HEADERS)
2206 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2207 TARGET_MD_ARCH=win32
2208 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2210 MOZ_USER_DIR="Mozilla"
2212 dnl Hardcode to win95 for now - cls
2213 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2215 dnl set NO_X11 defines here as the general check is skipped on win32
2221 if test -n "$L10NBASEDIR"; then
2222 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2229 if test -z "$MOZ_TOOLS"; then
2230 AC_MSG_ERROR([MOZ_TOOLS is not set])
2232 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2233 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2234 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2236 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2237 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2238 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2245 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.])
2251 if test "$HAVE_64BIT_BUILD"; then
2252 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2255 if test -n "$GNU_CC"; then
2256 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2257 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2258 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2260 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2261 # Disable this flag on clang-cl since it doesn't ignore unknown arguments by default, and
2262 # autoconf insists on passing $LDFLAGS to the compiler.
2263 if test -z "$CLANG_CL"; then
2264 LDFLAGS="$LDFLAGS -SAFESEH"
2271 if test -n "$_WIN32_MSVC"; then
2272 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2277 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2284 CFLAGS="$CFLAGS -Dunix"
2285 CXXFLAGS="$CXXFLAGS -Dunix"
2286 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2288 DSO_PIC_CFLAGS='-fPIC -DPIC'
2289 DSO_LDOPTS='-shared'
2290 BIN_FLAGS='-Wl,--export-dynamic'
2292 DSO_PIC_CFLAGS='-fPIC -DPIC'
2293 DLL_SUFFIX=".so.1.0"
2294 DSO_LDOPTS='-shared'
2296 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2297 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2298 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2299 if test "$LIBRUNPATH"; then
2300 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2302 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2303 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2307 if test "$SO_VERSION"; then
2308 DLL_SUFFIX=".so.$SO_VERSION"
2310 DLL_SUFFIX=".so.1.0"
2312 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2314 DSO_PIC_CFLAGS='-fPIC'
2315 DSO_LDOPTS='-shared -fPIC'
2316 if test "$LIBRUNPATH"; then
2317 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2323 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2325 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2326 # libraries one level up (e.g. libnspr4.so)
2327 if test "$SOLARIS_SUNPRO_CC"; then
2328 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2329 LIBS="-lCrun -lCstd -lc $LIBS"
2330 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2331 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2332 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2333 LDFLAGS="-xildoff $LDFLAGS"
2334 MMX_FLAGS="-xarch=mmx -xO4"
2335 SSE_FLAGS="-xarch=sse"
2336 SSE2_FLAGS="-xarch=ssei2 -xO4"
2337 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2338 _SAVE_LDFLAGS=$LDFLAGS
2339 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2340 AC_TRY_LINK([#include <stdio.h>],
2341 [printf("Hello World\n");],
2343 [LDFLAGS=$_SAVE_LDFLAGS])
2345 MOZ_OPTIMIZE_FLAGS="-xO4"
2346 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2347 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2348 MKSHLIB_FORCE_ALL='-z allextract'
2349 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2356 AS='/usr/ccs/bin/as'
2357 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2359 TARGET_COMPILER_ABI="sunc"
2360 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2361 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2362 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2366 [#if (__SUNPRO_CC < 0x590)
2369 _BAD_COMPILER=,_BAD_COMPILER=1)
2370 if test -n "$_BAD_COMPILER"; then
2372 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2377 [#if (__SUNPRO_CC >= 0x5100)
2378 #error "Sun C++ 5.10 or above"
2380 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2381 if test "$_ABOVE_SS12U1"; then
2383 CXXFLAGS="$CXXFLAGS -xannotate=no"
2385 AC_MSG_RESULT([$_res])
2388 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2390 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2391 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2392 ASFLAGS="$ASFLAGS -fPIC"
2393 DSO_LDOPTS='-shared'
2394 WARNINGS_AS_ERRORS='-Werror'
2396 _WARNINGS_CXXFLAGS=''
2397 if test "$OS_RELEASE" = "5.3"; then
2398 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2401 if test "$OS_RELEASE" = "5.5.1"; then
2402 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2407 DSO_LDOPTS='-Bdynamic'
2408 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2409 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2411 AC_DEFINE(SPRINTF_RETURNS_STRING)
2412 case "$(target_os)" in
2414 DLL_SUFFIX='.so.1.0'
2421 AC_SUBST_LIST(MMX_FLAGS)
2422 AC_SUBST_LIST(SSE_FLAGS)
2423 AC_SUBST_LIST(SSE2_FLAGS)
2427 # Includes linux-android
2432 AC_SUBST(MOZ_LINKER)
2433 if test -n "$MOZ_LINKER"; then
2434 AC_DEFINE(MOZ_LINKER)
2437 dnl Only one oddball right now (QNX), but this gives us flexibility
2438 dnl if any other platforms need to override this in the future.
2439 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2441 dnl ========================================================
2442 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2443 dnl by now will not have any way to link most binaries (tests
2444 dnl as well as viewer, apprunner, etc.), because some symbols
2445 dnl will be left out of the "composite" .so's by ld as unneeded.
2446 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2447 dnl they can link in the static libs that provide the missing
2449 dnl ========================================================
2450 NO_LD_ARCHIVE_FLAGS=
2451 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2452 NO_LD_ARCHIVE_FLAGS=1
2456 NO_LD_ARCHIVE_FLAGS=
2459 if test -z "$GNU_CC"; then
2460 NO_LD_ARCHIVE_FLAGS=
2464 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2466 dnl ========================================================
2467 dnl = Flags to strip unused symbols from .so components and
2468 dnl = to export jemalloc symbols when linking a program
2469 dnl ========================================================
2471 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2472 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2475 if test -z "$GNU_CC"; then
2476 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2478 if test -z "$GCC_USE_GNU_LD"; then
2479 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2481 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2486 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2489 if test -n "$GNU_CC"; then
2490 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2495 if test -z "$COMPILE_ENVIRONMENT"; then
2496 SKIP_COMPILER_CHECKS=1
2497 SKIP_LIBRARY_CHECKS=1
2502 if test -z "$SKIP_COMPILER_CHECKS"; then
2503 dnl Checks for typedefs, structures, and compiler characteristics.
2504 dnl ========================================================
2520 dnl Check for .hidden assembler directive and visibility attribute.
2521 dnl Borrowed from glibc configure.in
2522 dnl ===============================================================
2523 if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
2524 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2525 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2526 case "$OS_TARGET" in
2528 VISIBILITY_FLAGS='-fvisibility=hidden'
2531 case $GCC_VERSION in
2533 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden_dso_handle.h'
2536 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden.h'
2539 WRAP_SYSTEM_INCLUDES=1
2544 # visibility hidden flag for Sun Studio on Solaris
2545 if test "$SOLARIS_SUNPRO_CC"; then
2546 VISIBILITY_FLAGS='-xldscope=hidden'
2547 fi # Sun Studio on Solaris
2549 case "${OS_TARGET}" in
2550 WINNT|Darwin|Android)
2553 STL_FLAGS='-I$(DIST)/stl_wrappers'
2558 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2559 AC_SUBST(VISIBILITY_FLAGS)
2563 if test "$OS_TARGET" != WINNT; then
2564 # Only run this test with clang on non-Windows platforms, because clang
2565 # cannot do enough code gen for now to make this test work correctly.
2569 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2570 dnl ========================================================
2571 if test "$GNU_CC"; then
2572 CFLAGS_save="${CFLAGS}"
2573 CFLAGS="${CFLAGS} -Werror"
2574 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2575 ac_cv_force_align_arg_pointer,
2576 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2578 ac_cv_force_align_arg_pointer="yes",
2579 ac_cv_force_align_arg_pointer="no")])
2580 CFLAGS="${CFLAGS_save}"
2581 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2582 HAVE_GCC_ALIGN_ARG_POINTER=1
2584 HAVE_GCC_ALIGN_ARG_POINTER=
2587 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2589 dnl Checks for header files.
2590 dnl ========================================================
2592 case "$target_os" in
2594 # for stuff like -lXshm
2595 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2598 MOZ_CHECK_COMMON_HEADERS
2600 dnl These are all the places some variant of statfs can be hiding.
2601 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2604 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2605 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2607 dnl SCTP support - needs various network include headers
2608 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2610 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2612 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2613 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2614 ac_cv_sockaddr_in_sin_len,
2615 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2616 #include <sys/types.h>
2618 #include <netinet/in.h>
2619 struct sockaddr_in x;
2620 void *foo = (void*) &x.sin_len;],
2622 [ac_cv_sockaddr_in_sin_len=true],
2623 [ac_cv_sockaddr_in_sin_len=false])])
2624 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2625 AC_DEFINE(HAVE_SIN_LEN)
2626 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2627 AC_DEFINE(HAVE_SCONN_LEN)
2630 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2631 ac_cv_sockaddr_in6_sin6_len,
2632 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2633 #include <sys/types.h>
2635 #include <netinet/in.h>
2636 struct sockaddr_in6 x;
2637 void *foo = (void*) &x.sin6_len;],
2639 [ac_cv_sockaddr_in6_sin6_len=true],
2640 [ac_cv_sockaddr_in6_sin6_len=false])])
2641 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2642 AC_DEFINE(HAVE_SIN6_LEN)
2645 AC_CACHE_CHECK(for sockaddr.sa_len,
2646 ac_cv_sockaddr_sa_len,
2647 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2648 #include <sys/types.h>
2650 #include <sys/socket.h>
2652 void *foo = (void*) &x.sa_len;],
2654 [ac_cv_sockaddr_sa_len=true],
2655 [ac_cv_sockaddr_sa_len=false])])
2656 if test "$ac_cv_sockaddr_sa_len" = true ; then
2657 AC_DEFINE(HAVE_SA_LEN)
2660 MOZ_ARG_ENABLE_BOOL(dtrace,
2661 [ --enable-dtrace build with dtrace support if available (default=no)],
2662 [enable_dtrace="yes"],)
2663 if test "x$enable_dtrace" = "xyes"; then
2664 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2665 if test -n "$HAVE_DTRACE"; then
2666 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2668 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2671 AC_SUBST(HAVE_DTRACE)
2677 MOZ_CHECK_HEADERS(sys/cdefs.h)
2681 MOZ_LINUX_PERF_EVENT
2683 dnl Checks for libraries.
2684 dnl ========================================================
2689 AC_CHECK_LIB(c_r, gethostbyname_r)
2693 dnl We don't want to link with libdl even if it's present on OS X, since
2694 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2696 dnl We don't want to link against libm or libpthread on Darwin since
2697 dnl they both are just symlinks to libSystem and explicitly linking
2698 dnl against libSystem causes issues when debugging (see bug 299601).
2703 AC_SEARCH_LIBS(dlopen, dl,
2704 MOZ_CHECK_HEADER(dlfcn.h,
2705 AC_DEFINE(HAVE_DLOPEN)))
2709 _SAVE_CFLAGS="$CFLAGS"
2710 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2711 AC_CHECK_FUNCS(dladdr memmem)
2712 CFLAGS="$_SAVE_CFLAGS"
2714 if test ! "$GNU_CXX"; then
2718 AC_CHECK_LIB(C_r, demangle)
2721 AC_CHECK_LIB(C, demangle)
2726 AC_CHECK_LIB(socket, socket)
2729 XLIBS="$X_EXTRA_LIBS"
2731 dnl ========================================================
2732 dnl Checks for X libraries.
2733 dnl Ordering is important.
2734 dnl Xt is dependent upon SM as of X11R6
2735 dnl ========================================================
2736 if test "$no_x" = "yes"; then
2739 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2740 XLIBS="-lX11 $XLIBS"
2741 _SAVE_LDFLAGS="$LDFLAGS"
2742 LDFLAGS="$XLDFLAGS $LDFLAGS"
2743 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2744 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2745 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2746 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2748 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2749 unset ac_cv_lib_Xt_XtFree
2750 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2751 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
2752 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2753 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2756 # AIX needs the motif library linked before libXt to prevent
2757 # crashes in plugins linked against Motif - Bug #98892
2758 case "${target_os}" in
2760 XT_LIBS="-lXm $XT_LIBS"
2764 dnl ========================================================
2765 dnl = Check for XShm
2766 dnl ========================================================
2767 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
2770 dnl ========================================================
2772 dnl ========================================================
2773 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
2774 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
2775 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
2776 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
2778 LDFLAGS="$_SAVE_LDFLAGS"
2781 AC_SUBST_LIST(XCFLAGS)
2782 AC_SUBST_LIST(XLDFLAGS)
2783 AC_SUBST_LIST(XLIBS)
2784 AC_SUBST_LIST(XEXT_LIBS)
2785 AC_SUBST_LIST(XT_LIBS)
2786 AC_SUBST_LIST(XSS_LIBS)
2788 dnl ========================================================
2789 dnl = pthread support
2790 dnl = Start by checking whether the system support pthreads
2791 dnl ========================================================
2792 case "$target_os" in
2797 AC_CHECK_LIB(pthreads, pthread_create,
2798 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2799 AC_CHECK_LIB(pthread, pthread_create,
2800 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2801 AC_CHECK_LIB(c_r, pthread_create,
2802 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2803 AC_CHECK_LIB(c, pthread_create,
2812 dnl ========================================================
2813 dnl Check the command line for --with-pthreads
2814 dnl ========================================================
2815 MOZ_ARG_WITH_BOOL(pthreads,
2816 [ --with-pthreads Force use of system pthread library with NSPR ],
2817 [ if test "$MOZ_USE_PTHREADS"x = x; then
2818 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2824 dnl ========================================================
2825 dnl Do the platform specific pthread hackery
2826 dnl ========================================================
2827 if test "$MOZ_USE_PTHREADS"x != x
2830 dnl See if -pthread is supported.
2833 ac_cv_have_dash_pthread=no
2834 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2835 echo 'int main() { return 0; }' | cat > conftest.c
2836 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2837 if test $? -eq 0; then
2838 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2839 ac_cv_have_dash_pthread=yes
2840 case "$target_os" in
2842 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2845 CFLAGS="$CFLAGS -pthread"
2846 CXXFLAGS="$CXXFLAGS -pthread"
2852 AC_MSG_RESULT($ac_cv_have_dash_pthread)
2855 dnl See if -pthreads is supported.
2857 ac_cv_have_dash_pthreads=no
2858 if test "$ac_cv_have_dash_pthread" = "no"; then
2859 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2860 echo 'int main() { return 0; }' | cat > conftest.c
2861 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2862 if test $? -eq 0; then
2863 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2864 ac_cv_have_dash_pthreads=yes
2865 CFLAGS="$CFLAGS -pthreads"
2866 CXXFLAGS="$CXXFLAGS -pthreads"
2870 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2875 AC_DEFINE(_REENTRANT)
2876 AC_DEFINE(_THREAD_SAFE)
2877 dnl -pthread links in -lpthread, so don't specify it explicitly.
2878 if test "$ac_cv_have_dash_pthread" = "yes"; then
2879 _PTHREAD_LDFLAGS="-pthread"
2883 *-*-openbsd*|*-*-bsdi*)
2884 AC_DEFINE(_REENTRANT)
2885 AC_DEFINE(_THREAD_SAFE)
2886 dnl -pthread links in -lc_r, so don't specify it explicitly.
2887 if test "$ac_cv_have_dash_pthread" = "yes"; then
2888 _PTHREAD_LDFLAGS="-pthread"
2892 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
2893 AC_DEFINE(_REENTRANT)
2897 AC_DEFINE(_REENTRANT)
2901 AC_DEFINE(_REENTRANT)
2905 AC_DEFINE(_REENTRANT)
2906 if test "$SOLARIS_SUNPRO_CC"; then
2907 CFLAGS="$CFLAGS -mt"
2908 CXXFLAGS="$CXXFLAGS -mt"
2912 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
2913 AC_SUBST(MOZ_USE_PTHREADS)
2917 dnl Checks for library functions.
2918 dnl ========================================================
2919 AC_PROG_GCC_TRADITIONAL
2921 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r arc4random arc4random_buf)
2923 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
2924 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
2925 ac_cv_clock_monotonic,
2926 [for libs in "" -lrt; do
2929 AC_TRY_LINK([#include <time.h>],
2930 [ struct timespec ts;
2931 clock_gettime(CLOCK_MONOTONIC, &ts); ],
2932 ac_cv_clock_monotonic=$libs
2935 ac_cv_clock_monotonic=no)
2938 if test "$ac_cv_clock_monotonic" != "no"; then
2939 HAVE_CLOCK_MONOTONIC=1
2940 REALTIME_LIBS=$ac_cv_clock_monotonic
2941 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
2942 AC_SUBST(HAVE_CLOCK_MONOTONIC)
2943 AC_SUBST_LIST(REALTIME_LIBS)
2946 dnl check for wcrtomb/mbrtowc
2947 dnl =======================================================================
2948 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
2951 AC_CACHE_CHECK(for wcrtomb,
2953 [AC_TRY_LINK([#include <wchar.h>],
2954 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
2955 ac_cv_have_wcrtomb="yes",
2956 ac_cv_have_wcrtomb="no")])
2957 if test "$ac_cv_have_wcrtomb" = "yes"; then
2958 AC_DEFINE(HAVE_WCRTOMB)
2960 AC_CACHE_CHECK(for mbrtowc,
2962 [AC_TRY_LINK([#include <wchar.h>],
2963 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
2964 ac_cv_have_mbrtowc="yes",
2965 ac_cv_have_mbrtowc="no")])
2966 if test "$ac_cv_have_mbrtowc" = "yes"; then
2967 AC_DEFINE(HAVE_MBRTOWC)
2974 ac_cv_func_res_ninit,
2975 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
2976 dnl no need for res_ninit() on NetBSD and OpenBSD
2977 ac_cv_func_res_ninit=no
2981 #define _BSD_SOURCE 1
2983 #include <sys/types.h>
2984 #include <netinet/in.h>
2985 #include <arpa/nameser.h>
2988 [int foo = res_ninit(&_res);],
2989 [ac_cv_func_res_ninit=yes],
2990 [ac_cv_func_res_ninit=no])
2994 if test "$ac_cv_func_res_ninit" = "yes"; then
2995 AC_DEFINE(HAVE_RES_NINIT)
2996 dnl must add the link line we do something as foolish as this... dougt
2998 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
2999 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3011 AC_CHECK_LIB(c, iconv, [ICONV_LIBS=],
3012 AC_CHECK_LIB(iconv, iconv, [ICONV_LIBS="-liconv"],
3013 AC_CHECK_LIB(iconv, libiconv, [ICONV_LIBS="-liconv"])))
3015 LIBS="$LIBS $ICONV_LIBS"
3024 iconv_t h = iconv_open("", "");
3025 iconv(h, NULL, NULL, NULL, NULL);
3028 [ac_cv_func_iconv=yes],
3029 [ac_cv_func_iconv=no]
3032 if test "$ac_cv_func_iconv" = "yes"; then
3033 AC_DEFINE(HAVE_ICONV)
3034 LIBICONV="$ICONV_LIBS"
3036 [for iconv() with const input],
3037 ac_cv_func_const_iconv,
3043 const char *input = "testing";
3044 iconv_t h = iconv_open("", "");
3045 iconv(h, &input, NULL, NULL, NULL);
3048 [ac_cv_func_const_iconv=yes],
3049 [ac_cv_func_const_iconv=no]
3052 if test "$ac_cv_func_const_iconv" = "yes"; then
3053 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3061 AC_SUBST_LIST(ICONV_LIBS)
3067 dnl **********************
3068 dnl *** va_copy checks ***
3069 AC_CACHE_CHECK([for an implementation of va_copy()],
3071 [AC_TRY_COMPILE([#include <stdarg.h>
3073 void f (int i, ...) {
3074 va_list args1, args2;
3075 va_start (args1, i);
3076 va_copy (args2, args1);
3077 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3079 va_end (args1); va_end (args2);
3081 [f(0, 42); return 0],
3082 [ac_cv_va_copy=yes],
3086 AC_CACHE_CHECK([whether va_list can be copied by value],
3088 [AC_TRY_COMPILE([#include <stdarg.h>
3090 void f (int i, ...) {
3091 va_list args1, args2;
3092 va_start (args1, i);
3094 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3096 va_end (args1); va_end (args2);
3098 [f(0, 42); return 0],
3099 [ac_cv_va_val_copy=yes],
3100 [ac_cv_va_val_copy=no],
3103 if test "x$ac_cv_va_copy" = "xyes"; then
3104 AC_DEFINE(VA_COPY, va_copy)
3105 AC_DEFINE(HAVE_VA_COPY)
3108 if test "x$ac_cv_va_val_copy" = "xno"; then
3109 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3112 dnl ===================================================================
3113 dnl ========================================================
3114 dnl Put your C++ language/feature checks below
3115 dnl ========================================================
3119 if test "$GNU_CC"; then
3120 if test "$CPU_ARCH" = "arm" ; then
3121 AC_CACHE_CHECK(for ARM EABI,
3125 #if defined(__ARM_EABI__)
3128 #error Not ARM EABI.
3131 ac_cv_gcc_arm_eabi="yes",
3132 ac_cv_gcc_arm_eabi="no")])
3133 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3135 ARM_ABI_PREFIX=eabi-
3137 ARM_ABI_PREFIX=oabi-
3141 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3144 dnl Check to see if we can resolve ambiguity with |using|.
3145 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3146 ac_cv_cpp_ambiguity_resolving_using,
3147 [AC_TRY_COMPILE(class X {
3148 public: int go(const X&) {return 3;}
3149 int jo(const X&) {return 3;}
3151 class Y : public X {
3152 public: int go(int) {return 2;}
3153 int jo(int) {return 2;}
3155 private: using X::go;
3158 ac_cv_cpp_ambiguity_resolving_using=yes,
3159 ac_cv_cpp_ambiguity_resolving_using=no)])
3160 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3161 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3164 dnl See if a dynamic_cast to void* gives the most derived object.
3165 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3166 ac_cv_cpp_dynamic_cast_void_ptr,
3167 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3168 class Y { int j; public: virtual ~Y() { } };
3169 class Z : public X, public Y { int k; };
3175 return !((((void*)&mdo != (void*)subx) &&
3176 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3177 (((void*)&mdo != (void*)suby) &&
3178 ((void*)&mdo == dynamic_cast<void*>(suby))));
3180 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3181 ac_cv_cpp_dynamic_cast_void_ptr=no,
3182 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3183 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3184 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3187 dnl note that this one is reversed - if the test fails, then
3188 dnl we require implementations of unused virtual methods. Which
3189 dnl really blows because it means we'll have useless vtable
3191 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3192 ac_cv_cpp_unused_required,
3193 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3195 ac_cv_cpp_unused_required=no,
3196 ac_cv_cpp_unused_required=yes)])
3197 if test "$ac_cv_cpp_unused_required" = yes ; then
3198 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3202 dnl Some compilers have trouble comparing a constant reference to a templatized
3203 dnl class to zero, and require an explicit operator==() to be defined that takes
3204 dnl an int. This test separates the strong from the weak.
3206 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3207 ac_cv_trouble_comparing_to_zero,
3208 [AC_TRY_COMPILE([#include <algorithm>
3209 template <class T> class Foo {};
3211 template <class T> int operator==(const T2*, const T&) { return 0; }
3212 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3213 [Foo<int> f; return (0 != f);],
3214 ac_cv_trouble_comparing_to_zero=no,
3215 ac_cv_trouble_comparing_to_zero=yes)])
3216 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3217 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3220 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3221 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3222 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3224 _SAVE_LDFLAGS=$LDFLAGS
3225 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3226 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3227 ac_cv_thread_keyword,
3228 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3229 [return tlsIsMainThread;],
3230 ac_cv_thread_keyword=yes,
3231 ac_cv_thread_keyword=no)])
3232 LDFLAGS=$_SAVE_LDFLAGS
3233 # The custom dynamic linker doesn't support TLS variables
3235 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3236 # mips builds fail with TLS variables because of a binutils bug.
3238 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3243 *-android*|*-linuxandroid*)
3250 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3256 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3257 if test -n "$MOZ_LINKER"; then
3258 if test "$CPU_ARCH" = arm; then
3259 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3260 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3261 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3262 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3267 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3268 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3269 dnl We however want to avoid these text relocations, and this can be done
3270 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3271 dnl doesn't contain anything at all, beside placeholders for some sections,
3272 dnl and crtbegin only contains a finalizer function that calls
3273 dnl __cxa_finalize. The custom linker actually takes care of calling
3274 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3275 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3276 dnl link crtbegin and crtend at all.
3277 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3278 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3279 ac_cv_crt_has_text_relocations,
3280 [echo 'int foo() { return 0; }' > conftest.cpp
3281 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3282 test -s conftest${DLL_SUFFIX}; then
3283 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3284 ac_cv_crt_has_text_relocations=yes
3286 ac_cv_crt_has_text_relocations=no
3289 AC_ERROR([couldn't compile a simple C file])
3292 if test "$ac_cv_crt_has_text_relocations" = yes; then
3293 dnl While we want libraries to skip the CRT files, we don't want
3294 dnl executables to be treated the same way. We thus set the flag
3295 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3296 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3297 dnl Using LDFLAGS in nspr is safe, since we only really build
3298 dnl libraries there.
3299 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3300 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3304 dnl Check for the existence of various allocation headers/functions
3306 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3309 for file in $MALLOC_HEADERS; do
3310 MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3311 if test "$MALLOC_H" != ""; then
3312 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3317 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3319 AC_CHECK_FUNCS(malloc_usable_size)
3321 dnl See if compiler supports some gcc-style attributes
3323 AC_CACHE_CHECK(for __attribute__((always_inline)),
3324 ac_cv_attribute_always_inline,
3325 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3327 ac_cv_attribute_always_inline=yes,
3328 ac_cv_attribute_always_inline=no)])
3330 AC_CACHE_CHECK(for __attribute__((malloc)),
3331 ac_cv_attribute_malloc,
3332 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3334 ac_cv_attribute_malloc=yes,
3335 ac_cv_attribute_malloc=no)])
3337 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3338 ac_cv_attribute_warn_unused,
3339 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3341 ac_cv_attribute_warn_unused=yes,
3342 ac_cv_attribute_warn_unused=no)])
3344 dnl End of C++ language/feature checks
3347 dnl ========================================================
3348 dnl = Internationalization checks
3349 dnl ========================================================
3351 dnl Internationalization and Locale support is different
3352 dnl on various UNIX platforms. Checks for specific i18n
3353 dnl features go here.
3355 dnl check for LC_MESSAGES
3356 AC_CACHE_CHECK(for LC_MESSAGES,
3357 ac_cv_i18n_lc_messages,
3358 [AC_TRY_COMPILE([#include <locale.h>],
3359 [int category = LC_MESSAGES;],
3360 ac_cv_i18n_lc_messages=yes,
3361 ac_cv_i18n_lc_messages=no)])
3362 if test "$ac_cv_i18n_lc_messages" = yes; then
3363 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3366 AC_HAVE_FUNCS(localeconv)
3367 fi # ! SKIP_COMPILER_CHECKS
3370 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3371 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3372 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
3375 dnl Mozilla specific options
3376 dnl ========================================================
3377 dnl The macros used for command line options
3378 dnl are defined in build/autoconf/altoptions.m4.
3380 dnl If the compiler supports these attributes, define them as
3381 dnl convenience macros.
3382 if test "$ac_cv_attribute_malloc" = yes ; then
3383 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3385 AC_DEFINE(NS_ATTR_MALLOC,)
3388 if test "$ac_cv_attribute_warn_unused" = yes ; then
3389 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3391 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3394 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3395 dnl features that Windows actually does support.
3397 if test -n "$SKIP_COMPILER_CHECKS"; then
3398 dnl Windows has malloc.h
3399 AC_DEFINE(MALLOC_H, [<malloc.h>])
3400 AC_DEFINE(HAVE_FORCEINLINE)
3401 AC_DEFINE(HAVE_LOCALECONV)
3402 fi # SKIP_COMPILER_CHECKS
3404 dnl ========================================================
3406 dnl = Check for external package dependencies
3408 dnl ========================================================
3409 MOZ_ARG_HEADER(External Packages)
3411 MOZ_ARG_WITH_STRING(libxul-sdk,
3412 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3413 AC_MSG_ERROR([--with-libxul-sdk is not supported anymore.]))
3415 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3416 AC_SUBST(LIBXUL_DIST)
3420 dnl set GRE_MILESTONE
3421 dnl ========================================================
3422 if test -n "$LIBXUL_SDK"; then
3423 GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3425 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3427 AC_SUBST(GRE_MILESTONE)
3429 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3430 # The logic works like this:
3431 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3432 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3433 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3434 case "$GRE_MILESTONE" in
3437 AC_DEFINE(NIGHTLY_BUILD)
3443 AC_DEFINE(RELEASE_BUILD)
3446 AC_SUBST(NIGHTLY_BUILD)
3447 AC_SUBST(RELEASE_BUILD)
3449 dnl ========================================================
3450 dnl Disable compiling sources in unified mode.
3451 dnl ========================================================
3453 if test -z "$NIGHTLY_BUILD"; then
3454 MOZ_DISABLE_UNIFIED_COMPILATION=1
3457 MOZ_ARG_DISABLE_BOOL(unified-compilation,
3458 [ --disable-unified-compilation
3459 Disable unified compilation of some C/C++ sources],
3460 MOZ_DISABLE_UNIFIED_COMPILATION=1,
3461 MOZ_DISABLE_UNIFIED_COMPILATION=)
3462 AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
3464 dnl ========================================================
3465 dnl Multiprocess Firefox Nightly Testing UI
3466 dnl To be removed in Bug 1003313
3467 dnl ========================================================
3468 if test -z "$NIGHTLY_BUILD"; then
3472 AC_SUBST(E10S_TESTING_ONLY)
3474 dnl ========================================================
3475 dnl system libevent Support
3476 dnl ========================================================
3477 MOZ_ARG_WITH_STRING(system-libevent,
3478 [ --with-system-libevent[=PFX]
3479 Use system libevent [installed at prefix PFX]],
3480 LIBEVENT_DIR=$withval)
3482 _SAVE_CFLAGS=$CFLAGS
3483 _SAVE_LDFLAGS=$LDFLAGS
3485 if test "$LIBEVENT_DIR" = yes; then
3486 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3487 MOZ_NATIVE_LIBEVENT=1,
3490 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3491 MOZ_NATIVE_LIBEVENT=
3492 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3493 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3494 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3495 MOZ_CHECK_HEADER(event.h,
3496 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3497 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3499 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3500 AC_CHECK_LIB(event, event_init,
3501 [MOZ_NATIVE_LIBEVENT=1
3502 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3503 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3504 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3506 CFLAGS=$_SAVE_CFLAGS
3507 LDFLAGS=$_SAVE_LDFLAGS
3510 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3512 dnl ========================================================
3513 dnl = If NSS was not detected in the system,
3514 dnl = use the one in the source tree (mozilla/security/nss)
3515 dnl ========================================================
3517 MOZ_ARG_WITH_BOOL(system-nss,
3518 [ --with-system-nss Use system installed NSS],
3521 if test -n "$_USE_SYSTEM_NSS"; then
3522 AM_PATH_NSS(3.17.1, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3525 if test -n "$MOZ_NATIVE_NSS"; then
3526 NSS_LIBS="$NSS_LIBS -lcrmf"
3528 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3530 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
3532 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3533 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3534 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3535 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3536 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3538 NSS_LIBS='-L$(LIBXUL_DIST)/lib'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3542 dnl ======================
3544 dnl ======================
3546 AC_MSG_CHECKING([for YASM assembler])
3547 AC_CHECK_PROGS(YASM, yasm, "")
3549 if test -n "$YASM"; then
3550 dnl Pull out yasm's version string
3551 YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3552 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3553 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3554 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3555 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3558 if test -z "$SKIP_LIBRARY_CHECKS"; then
3559 dnl system JPEG support
3560 dnl ========================================================
3561 MOZ_ARG_WITH_STRING(system-jpeg,
3562 [ --with-system-jpeg[=PFX]
3563 Use system libjpeg [installed at prefix PFX]],
3566 _SAVE_CFLAGS=$CFLAGS
3567 _SAVE_LDFLAGS=$LDFLAGS
3569 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3570 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3571 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3573 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3576 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3579 if test "$MOZ_NATIVE_JPEG" = 1; then
3580 AC_TRY_COMPILE([ #include <stdio.h>
3581 #include <sys/types.h>
3582 #include <jpeglib.h> ],
3583 [ #if JPEG_LIB_VERSION < $MOZJPEG
3584 #error "Insufficient JPEG library version ($MOZJPEG required)."
3586 #ifndef JCS_EXTENSIONS
3587 #error "libjpeg-turbo JCS_EXTENSIONS required"
3591 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3593 CFLAGS=$_SAVE_CFLAGS
3594 LDFLAGS=$_SAVE_LDFLAGS
3597 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3598 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3599 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3601 fi # SKIP_LIBRARY_CHECKS
3603 dnl system ZLIB support
3604 dnl ========================================================
3605 MOZ_ZLIB_CHECK([1.2.3])
3607 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
3608 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
3613 if test -z "$SKIP_LIBRARY_CHECKS"; then
3614 dnl system BZIP2 Support
3615 dnl ========================================================
3616 MOZ_ARG_WITH_STRING(system-bz2,
3617 [ --with-system-bz2[=PFX]
3618 Use system libbz2 [installed at prefix PFX]],
3621 _SAVE_CFLAGS=$CFLAGS
3622 _SAVE_LDFLAGS=$LDFLAGS
3624 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
3625 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
3626 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
3628 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
3631 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
3632 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
3634 CFLAGS=$_SAVE_CFLAGS
3635 LDFLAGS=$_SAVE_LDFLAGS
3638 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
3639 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
3640 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
3643 dnl ========================================================
3644 dnl system PNG Support
3645 dnl ========================================================
3646 MOZ_ARG_WITH_STRING(system-png,
3647 [ --with-system-png[=PFX]
3648 Use system libpng [installed at prefix PFX]],
3651 _SAVE_CFLAGS=$CFLAGS
3652 _SAVE_LDFLAGS=$LDFLAGS
3654 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
3655 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
3656 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
3658 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
3661 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
3662 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3663 AC_CHECK_LIB(png, png_get_acTL, ,
3664 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
3666 if test "$MOZ_NATIVE_PNG" = 1; then
3667 AC_TRY_COMPILE([ #include <stdio.h>
3668 #include <sys/types.h>
3670 [ #if PNG_LIBPNG_VER < $MOZPNG
3671 #error "Insufficient libpng version ($MOZPNG required)."
3673 #ifndef PNG_UINT_31_MAX
3674 #error "Insufficient libpng version."
3677 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3679 CFLAGS=$_SAVE_CFLAGS
3680 LDFLAGS=$_SAVE_LDFLAGS
3683 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
3684 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
3685 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
3688 MOZ_PNG_ARM_NEON_CHECK=
3689 if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
3690 MOZ_ARG_ENABLE_STRING(png-arm-neon-support,
3691 [ --enable-png-arm-neon-support=TYPE
3695 nocheck (faster but unsafe)],
3696 [MOZ_PNG_ARM_NEON_SUPPORT=$enableval ] )
3697 case "$MOZ_PNG_ARM_NEON_SUPPORT" in
3699 # enable-png-arm-neon-support = no
3702 # enable-png-arm-neon-support = nocheck
3707 MOZ_PNG_ARM_NEON_CHECK=1
3712 AC_SUBST(MOZ_PNG_ARM_NEON_CHECK)
3714 fi # SKIP_LIBRARY_CHECKS
3716 AC_SUBST(MOZ_PNG_ARM_NEON)
3718 dnl ========================================================
3719 dnl system HunSpell Support
3720 dnl ========================================================
3721 MOZ_ARG_ENABLE_BOOL(system-hunspell,
3722 [ --enable-system-hunspell
3723 Use system hunspell (located with pkgconfig)],
3724 MOZ_NATIVE_HUNSPELL=1 )
3726 if test -n "$MOZ_NATIVE_HUNSPELL"; then
3727 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
3730 AC_SUBST(MOZ_NATIVE_HUNSPELL)
3732 dnl ========================================================
3733 dnl system libffi Support
3734 dnl ========================================================
3737 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
3738 if test "$OS_ARCH" = "WINNT"; then
3742 MOZ_ARG_ENABLE_BOOL(shared-js,
3743 [ --enable-shared-js
3744 Create a shared JavaScript library.],
3745 JS_SHARED_LIBRARY=1,
3748 dnl ========================================================
3749 dnl Java SDK support
3750 dnl ========================================================
3753 MOZ_ARG_WITH_STRING(java-bin-path,
3754 [ --with-java-bin-path=dir
3755 Location of Java binaries (java, javac, jar)],
3756 JAVA_BIN_PATH=$withval)
3758 dnl ========================================================
3762 dnl ========================================================
3764 MOZ_ARG_HEADER(Application)
3767 ENABLE_SYSTEM_EXTENSION_DIRS=1
3768 MOZ_BRANDING_DIRECTORY=
3769 MOZ_OFFICIAL_BRANDING=
3772 MOZ_AUTH_EXTENSION=1
3777 MOZ_SAMPLE_TYPE_FLOAT32=
3778 MOZ_SAMPLE_TYPE_S16=
3784 if test -n "$MOZ_FMP4"; then
3794 MOZ_WEBRTC_SIGNALING=
3795 MOZ_WEBRTC_ASSERT_ALWAYS=1
3796 MOZ_WEBRTC_HARDWARE_AEC_NS=
3799 MOZ_MEDIA_NAVIGATOR=
3802 MOZ_VPX_ERROR_CONCEALMENT=
3812 LIBJPEG_TURBO_ASFLAGS=
3813 LIBJPEG_TURBO_X86_ASM=
3814 LIBJPEG_TURBO_X64_ASM=
3815 LIBJPEG_TURBO_ARM_ASM=
3819 MOZ_PREF_EXTENSIONS=1
3820 MOZ_PROFILELOCKING=1
3826 MOZ_TOOLKIT_SEARCH=1
3828 MOZ_UNIVERSALCHARDET=1
3837 NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device"
3838 if test -n "$MOZ_RTSP"; then
3839 NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp"
3843 MOZ_USE_NATIVE_POPUP_WINDOWS=
3844 MOZ_ANDROID_HISTORY=
3847 MOZ_LOCALE_SWITCHER=
3848 MOZ_ANDROID_SEARCH_ACTIVITY=
3849 MOZ_ANDROID_DOWNLOADS_INTEGRATION=
3850 MOZ_ANDROID_MLS_STUMBLER=
3851 MOZ_ANDROID_SHARE_OVERLAY=
3855 MOZ_AUDIO_CHANNEL_MANAGER=
3857 MOZ_CONTENT_SANDBOX=
3862 case "$target_os" in
3865 AC_DEFINE(NS_ENABLE_TSF)
3870 *-android*|*-linuxandroid*)
3871 if test "$CPU_ARCH" = "arm" ; then
3876 MOZ_THEME_FASTSTRIPE=1
3884 MOZ_ARG_WITH_STRING(external-source-dir,
3885 [ --with-external-source-dir=dir
3886 External directory containing additional build files.],
3887 [ EXTERNAL_SOURCE_DIR=$withval])
3888 AC_SUBST(EXTERNAL_SOURCE_DIR)
3890 MOZ_ARG_ENABLE_STRING(application,
3891 [ --enable-application=APP
3895 tools/update-packaging (AUS-related packaging tools)],
3896 [ MOZ_BUILD_APP=$enableval ] )
3898 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
3899 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
3900 XULRUNNER_STUB_NAME=$withval)
3902 if test -z "$XULRUNNER_STUB_NAME"; then
3903 case "$target_os" in
3905 XULRUNNER_STUB_NAME=xulrunner
3908 XULRUNNER_STUB_NAME=xulrunner-stub
3911 AC_SUBST(XULRUNNER_STUB_NAME)
3913 AC_MSG_CHECKING([for application to build])
3914 if test -z "$MOZ_BUILD_APP"; then
3915 AC_MSG_RESULT([browser])
3916 MOZ_BUILD_APP=browser
3918 # "mobile" no longer exists.
3919 if test "$MOZ_BUILD_APP" = "mobile" ; then
3920 AC_MSG_RESULT([none])
3921 AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
3923 # Support comm-central.
3924 if test -n "$EXTERNAL_SOURCE_DIR" ; then
3925 MOZ_BUILD_APP="$EXTERNAL_SOURCE_DIR/$MOZ_BUILD_APP"
3926 MOZ_BUILD_APP=`${PYTHON} -c "import os.path; print(os.path.relpath(\"${MOZ_BUILD_APP}\", \"${srcdir}\"))"`
3928 # We have a valid application only if it has a build.mk file in its top
3930 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
3931 AC_MSG_RESULT([none])
3932 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
3934 AC_MSG_RESULT([$MOZ_BUILD_APP])
3938 # The app update channel is 'default' when not supplied. The value is used in
3939 # the application's confvars.sh so it must be set before confvars.sh is called.
3940 MOZ_ARG_ENABLE_STRING([update-channel],
3941 [ --enable-update-channel=CHANNEL
3942 Select application update channel (default=default)],
3943 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
3945 if test -z "$MOZ_UPDATE_CHANNEL"; then
3946 MOZ_UPDATE_CHANNEL=default
3948 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
3949 AC_SUBST(MOZ_UPDATE_CHANNEL)
3951 # Allow to specify a Mozilla API key file that contains the secret key to be
3952 # used for various Mozilla API requests.
3953 MOZ_ARG_WITH_STRING(mozilla-api-keyfile,
3954 [ --with-mozilla-api-keyfile=file Use the secret key contained in the given keyfile for Mozilla API requests],
3955 MOZ_MOZILLA_API_KEY=`cat $withval`)
3956 if test -z "$MOZ_MOZILLA_API_KEY"; then
3957 MOZ_MOZILLA_API_KEY=no-mozilla-api-key
3959 AC_SUBST(MOZ_MOZILLA_API_KEY)
3961 # Allow to specify a Google API key file that contains the secret key to be
3962 # used for various Google API requests.
3963 MOZ_ARG_WITH_STRING(google-api-keyfile,
3964 [ --with-google-api-keyfile=file Use the secret key contained in the given keyfile for Google API requests],
3965 MOZ_GOOGLE_API_KEY=`cat $withval`)
3966 if test -z "$MOZ_GOOGLE_API_KEY"; then
3967 MOZ_GOOGLE_API_KEY=no-google-api-key
3969 AC_SUBST(MOZ_GOOGLE_API_KEY)
3971 # Allow specifying a Bing API key file that contains the client ID and the
3972 # secret key to be used for the Bing Translation API requests.
3973 MOZ_ARG_WITH_STRING(bing-api-keyfile,
3974 [ --with-bing-api-keyfile=file Use the client id and secret key contained in the given keyfile for Bing API requests],
3975 [MOZ_BING_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
3976 MOZ_BING_API_KEY=`cat $withval | cut -f 2 -d " "`])
3977 if test -z "$MOZ_BING_API_CLIENTID"; then
3978 MOZ_BING_API_CLIENTID=no-bing-api-clientid
3979 MOZ_BING_API_KEY=no-bing-api-key
3981 AC_SUBST(MOZ_BING_API_CLIENTID)
3982 AC_SUBST(MOZ_BING_API_KEY)
3984 # Allow the application to influence configure with a confvars.sh script.
3985 AC_MSG_CHECKING([if app-specific confvars.sh exists])
3986 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
3987 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
3988 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
3993 # Allow influencing configure with a defines.sh script.
3994 . "${srcdir}/build/defines.sh"
3996 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
3998 if test "$BUILDING_RELEASE"; then
3999 # Override value in defines.sh, if any
4000 EARLY_BETA_OR_EARLIER=
4001 elif test "$EARLY_BETA_OR_EARLIER"; then
4002 AC_DEFINE(EARLY_BETA_OR_EARLIER)
4004 AC_SUBST(EARLY_BETA_OR_EARLIER)
4006 # Allow the application to provide a subconfigure script
4007 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4008 do_output_subdirs() {
4009 if test -n "$_subconfigure_subdirs"; then
4010 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4012 _subconfigure_subdir="$1"
4013 _subconfigure_config_args="$ac_configure_args"
4015 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4016 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4017 "${srcdir}/build/autoconf/altoptions.m4" \
4018 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4023 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4024 MOZ_ARG_WITH_STRING(app-name,
4025 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4026 WITH_APP_NAME=$withval,
4029 if test -n "$WITH_APP_NAME" ; then
4030 MOZ_APP_NAME="$WITH_APP_NAME"
4033 MOZ_ARG_WITH_STRING(app-basename,
4034 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4035 WITH_APP_BASENAME=$withval,
4038 if test -n "$WITH_APP_BASENAME" ; then
4039 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4042 # Now is a good time to test for logic errors, define mismatches, etc.
4043 case "$MOZ_BUILD_APP" in
4045 if test "$LIBXUL_SDK"; then
4046 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4051 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4052 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4054 case "$MOZ_BUILD_APP" in
4056 AC_DEFINE(MOZ_PHOENIX)
4060 AC_DEFINE(MOZ_XULRUNNER)
4067 AC_DEFINE(MOZ_MULET)
4071 AC_SUBST(MOZ_BUILD_APP)
4072 AC_SUBST(MOZ_PHOENIX)
4073 AC_SUBST(MOZ_XULRUNNER)
4076 AC_SUBST(MOZ_B2G_VERSION)
4078 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4080 dnl ========================================================
4081 dnl Check Android SDK version depending on mobile target.
4082 dnl ========================================================
4084 if test -z "$gonkdir" ; then
4085 # Minimum Android SDK API Level we require.
4086 case "$MOZ_BUILD_APP" in
4088 android_min_api_level=17
4090 *-android*|*-linuxandroid*)
4094 AC_MSG_ERROR([You must specify --target=arm-linux-androideabi (or some other valid android target) when building with --enable-application=mobile/android. See https://wiki.mozilla.org/Mobile/Fennec/Android#Setup_Fennec_mozconfig for more information about the necessary options])
4100 MOZ_ANDROID_SDK($android_min_api_level)
4103 dnl ========================================================
4105 dnl = Toolkit Options
4107 dnl ========================================================
4108 MOZ_ARG_HEADER(Toolkit Options)
4110 dnl ========================================================
4111 dnl = Select the default toolkit
4112 dnl ========================================================
4113 MOZ_ARG_ENABLE_STRING(default-toolkit,
4114 [ --enable-default-toolkit=TK
4115 Select default toolkit
4116 Platform specific defaults:
4117 Mac OS X - cairo-cocoa
4118 Win32 - cairo-windows
4122 [ _DEFAULT_TOOLKIT=$enableval ],
4123 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4125 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4126 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4127 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4128 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4129 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4130 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4131 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4132 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4133 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4135 dnl nglayout only supports building with one toolkit,
4136 dnl so ignore everything after the first comma (",").
4137 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4139 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4142 MOZ_ARG_WITHOUT_BOOL(x,
4143 [ --without-x Build without X11],
4146 dnl ========================================================
4147 dnl = Enable the toolkit as needed =
4148 dnl ========================================================
4152 case "$MOZ_WIDGET_TOOLKIT" in
4155 MOZ_WIDGET_TOOLKIT=windows
4157 MOZ_INSTRUMENT_EVENT_LOOP=1
4158 if test -n "$GNU_CC"; then
4164 MOZ_WIDGET_TOOLKIT=gtk3
4167 MOZ_ENABLE_XREMOTE=1
4168 MOZ_GL_DEFAULT_PROVIDER=GLX
4174 TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4176 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4178 MOZ_INSTRUMENT_EVENT_LOOP=1
4181 cairo-gtk2|cairo-gtk2-x11)
4182 MOZ_WIDGET_TOOLKIT=gtk2
4185 MOZ_ENABLE_XREMOTE=1
4186 MOZ_GL_DEFAULT_PROVIDER=GLX
4192 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4193 TK_LIBS='$(MOZ_GTK2_LIBS)'
4194 AC_DEFINE(MOZ_WIDGET_GTK2)
4196 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4198 MOZ_INSTRUMENT_EVENT_LOOP=1
4202 MOZ_WIDGET_TOOLKIT=qt
4204 if test -z "$WITHOUT_X11"; then
4205 MOZ_ENABLE_XREMOTE=1
4206 MOZ_GL_DEFAULT_PROVIDER=GLX
4213 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4214 TK_LIBS='$(MOZ_QT_LIBS)'
4215 AC_DEFINE(MOZ_WIDGET_QT)
4217 AC_DEFINE(QT_NO_KEYWORDS)
4221 MOZ_WIDGET_TOOLKIT=cocoa
4222 AC_DEFINE(MOZ_WIDGET_COCOA)
4223 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4224 # Use -Wl as a trick to avoid -framework and framework names from
4225 # being separated by AC_SUBST_LIST.
4226 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'
4227 TK_CFLAGS="-DNO_X11"
4228 CFLAGS="$CFLAGS $TK_CFLAGS"
4229 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4230 MOZ_USER_DIR="Mozilla"
4231 MOZ_FS_LAYOUT=bundle
4232 MOZ_INSTRUMENT_EVENT_LOOP=1
4236 MOZ_WIDGET_TOOLKIT=uikit
4237 AC_DEFINE(MOZ_WIDGET_UIKIT)
4238 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4239 TK_CFLAGS="-DNO_X11"
4240 TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText'
4241 CFLAGS="$CFLAGS $TK_CFLAGS"
4242 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4243 MOZ_USER_DIR="Mozilla"
4244 MOZ_FS_LAYOUT=bundle
4248 AC_DEFINE(MOZ_WIDGET_ANDROID)
4249 MOZ_WIDGET_TOOLKIT=android
4250 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4251 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4253 MOZ_INSTRUMENT_EVENT_LOOP=1
4257 AC_DEFINE(MOZ_WIDGET_GONK)
4258 AC_DEFINE(MOZ_TOUCH)
4259 MOZ_WIDGET_TOOLKIT=gonk
4260 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4261 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4264 MOZ_INSTRUMENT_EVENT_LOOP=1
4269 AC_SUBST(MOZ_PDF_PRINTING)
4270 if test "$MOZ_PDF_PRINTING"; then
4271 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4272 AC_DEFINE(MOZ_PDF_PRINTING)
4275 if test "$MOZ_ENABLE_XREMOTE"; then
4276 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4279 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4280 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4283 if test "$COMPILE_ENVIRONMENT"; then
4284 if test "$MOZ_ENABLE_GTK3"; then
4285 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4286 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
4287 dnl Contrary to MOZ_GTK2_LIBS, MOZ_GTK3_LIBS needs to be literally added to TK_LIBS instead
4288 dnl of a make reference because of how TK_LIBS is mangled in toolkit/library/moz.build
4289 dnl for GTK+3 builds.
4290 TK_LIBS=$MOZ_GTK3_LIBS
4292 if test "$MOZ_ENABLE_GTK"; then
4293 if test "$MOZ_X11"; then
4294 GDK_PACKAGES=gdk-x11-2.0
4297 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4298 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
4301 fi # COMPILE_ENVIRONMENT
4303 AC_SUBST(MOZ_FS_LAYOUT)
4305 dnl ========================================================
4306 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4307 dnl their usage and use them in spidermonkey.
4308 dnl ========================================================
4309 MOZ_ARG_WITH_BOOL(arm-kuser,
4310 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4312 if test -n "$USE_ARM_KUSER"; then
4313 AC_DEFINE(USE_ARM_KUSER)
4316 dnl ========================================================
4317 dnl = startup-notification support module
4318 dnl ========================================================
4320 if test "$MOZ_ENABLE_GTK"
4322 MOZ_ENABLE_STARTUP_NOTIFICATION=
4324 MOZ_ARG_ENABLE_BOOL(startup-notification,
4325 [ --enable-startup-notification
4326 Enable startup-notification support (default: disabled) ],
4327 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4328 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4329 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4331 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4332 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4333 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4334 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4336 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4338 MOZ_ENABLE_STARTUP_NOTIFICATION=
4342 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4343 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4346 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4348 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4350 dnl ========================================================
4351 dnl Disable printing
4352 dnl ========================================================
4353 MOZ_ARG_DISABLE_BOOL(printing,
4354 [ --disable-printing Disable printing support],
4358 if test "$NS_PRINTING"; then
4359 AC_DEFINE(NS_PRINTING)
4360 AC_DEFINE(NS_PRINT_PREVIEW)
4363 dnl ========================================================
4365 dnl ========================================================
4366 if test "$MOZ_ENABLE_QT"
4368 MOZ_ARG_WITH_STRING(qtdir,
4369 [ --with-qtdir=\$dir Specify Qt directory ],
4372 if test -z "$QTDIR"; then
4373 AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4375 HOST_QMAKE="$QTDIR/bin/qmake"
4377 QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4379 if test -z "$QTDIR"; then
4382 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4383 PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5Quick, ,
4385 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4387 QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4388 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4389 if test "$NS_PRINTING"; then
4390 PKG_CHECK_MODULES(MOZ_QT_WIDGETS, Qt5PrintSupport, ,
4392 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase widgets development package])
4394 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT_WIDGETS_LIBS"
4395 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT_WIDGETS_CFLAGS"
4399 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4403 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4404 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4406 MOZ_QT_CFLAGS="-DQT_SHARED"
4407 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4408 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4409 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4410 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4411 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4412 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4415 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4416 MOZ_QT_LIBS="$MOZ_QT_LIBS -L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml"
4417 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4418 if test "$NS_PRINTING"; then
4419 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4420 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4424 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4428 HOST_MOC="$QTDIR/bin/moc"
4429 HOST_RCC="$QTDIR/bin/rcc"
4431 if test -z "$HOST_MOC"; then
4432 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4434 if test -z "$HOST_RCC"; then
4435 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4441 MOZ_ENABLE_QMSYSTEM2=
4442 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4443 MOZ_ENABLE_QMSYSTEM2=1,
4444 MOZ_ENABLE_QMSYSTEM2=)
4446 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4447 MOZ_ENABLE_QMSYSTEM2=1
4448 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4449 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4450 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4453 MOZ_ENABLE_QTNETWORK=
4454 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4455 MOZ_ENABLE_QTNETWORK=1,
4456 MOZ_ENABLE_QTNETWORK=)
4458 if test "$MOZ_ENABLE_QTNETWORK"; then
4459 MOZ_ENABLE_QTNETWORK=1
4460 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4463 MOZ_ENABLE_QTMOBILITY=
4464 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4465 MOZ_ENABLE_QTMOBILITY=1,
4466 MOZ_ENABLE_QTMOBILITY=)
4467 if test "$MOZ_ENABLE_QTMOBILITY"; then
4468 MOZ_ENABLE_QTMOBILITY=1
4469 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4470 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4471 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4472 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4474 AC_CHECK_LIB(QtSensors, main, [
4475 MOZ_ENABLE_QTMOBILITY=1
4476 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4477 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4478 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4479 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4480 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4484 MOZ_ENABLE_QT5FEEDBACK=
4485 PKG_CHECK_MODULES(_QT5FEEDBACK, Qt0Feedback,
4486 MOZ_ENABLE_QT5FEEDBACK=1,
4487 MOZ_ENABLE_QT5FEEDBACK=)
4488 if test "$MOZ_ENABLE_QT5FEEDBACK"; then
4489 MOZ_ENABLE_QT5FEEDBACK=1
4490 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5FEEDBACK_CFLAGS"
4491 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5FEEDBACK_LIBS"
4492 AC_DEFINE(MOZ_ENABLE_QT5FEEDBACK)
4493 AC_SUBST(MOZ_ENABLE_QT5FEEDBACK)
4496 MOZ_ENABLE_QT5GEOPOSITION=
4497 PKG_CHECK_MODULES(_QT5GEOPOSITION, Qt5Positioning,
4498 MOZ_ENABLE_QT5GEOPOSITION=1,
4499 MOZ_ENABLE_QT5GEOPOSITION=)
4500 if test "$MOZ_ENABLE_QT5GEOPOSITION"; then
4501 MOZ_ENABLE_QT5GEOPOSITION=1
4502 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5GEOPOSITION_CFLAGS"
4503 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5GEOPOSITION_LIBS"
4504 AC_DEFINE(MOZ_ENABLE_QT5GEOPOSITION)
4505 AC_SUBST(MOZ_ENABLE_QT5GEOPOSITION)
4508 if test "$MOZ_ENABLE_CONTENTACTION"; then
4509 MOZ_ENABLE_CONTENTACTION=1
4510 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4513 MOZ_ENABLE_CONTENTACTION=
4514 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
4515 if test "$MOZ_ENABLE_CONTENTACTION"; then
4516 MOZ_ENABLE_CONTENTACTION=1
4517 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
4518 MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
4519 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4520 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
4524 AC_SUBST(GTK_CONFIG)
4525 AC_SUBST_LIST(TK_CFLAGS)
4526 AC_SUBST_LIST(TK_LIBS)
4528 AC_SUBST(MOZ_ENABLE_GTK2)
4529 AC_SUBST(MOZ_ENABLE_GTK3)
4530 AC_SUBST(MOZ_ENABLE_GTK)
4531 AC_SUBST(MOZ_ENABLE_QT)
4532 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4533 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4534 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4535 AC_SUBST(MOZ_ENABLE_XREMOTE)
4536 AC_SUBST(MOZ_WIDGET_GTK)
4537 AC_SUBST_LIST(MOZ_QT_CFLAGS)
4538 AC_SUBST_LIST(MOZ_QT_LIBS)
4545 dnl ========================================================
4547 dnl = Components & Features
4549 dnl ========================================================
4550 MOZ_ARG_HEADER(Components and Features)
4552 dnl ========================================================
4554 dnl ========================================================
4555 MOZ_ARG_ENABLE_STRING(ui-locale,
4556 [ --enable-ui-locale=ab-CD
4557 Select the user interface locale (default: en-US)],
4558 MOZ_UI_LOCALE=$enableval )
4559 AC_SUBST(MOZ_UI_LOCALE)
4561 dnl ========================================================
4562 dnl = Trademarked Branding
4563 dnl ========================================================
4564 MOZ_ARG_ENABLE_BOOL(official-branding,
4565 [ --enable-official-branding
4566 Enable Official mozilla.org Branding
4567 Do not distribute builds with
4568 --enable-official-branding unless you have
4569 permission to use trademarks per
4570 http://www.mozilla.org/foundation/trademarks/ .],
4572 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4573 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4575 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4576 MOZ_OFFICIAL_BRANDING=1
4578 ], MOZ_OFFICIAL_BRANDING=)
4580 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4581 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4582 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4585 MOZ_ARG_WITH_STRING(branding,
4586 [ --with-branding=dir Use branding from the specified directory.],
4587 MOZ_BRANDING_DIRECTORY=$withval)
4589 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4590 if test -z "$REAL_BRANDING_DIRECTORY"; then
4591 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4594 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4595 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4596 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4597 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
4600 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4602 dnl ========================================================
4603 dnl = Distribution ID
4604 dnl ========================================================
4605 MOZ_ARG_WITH_STRING(distribution-id,
4606 [ --with-distribution-id=ID
4607 Set distribution-specific id (default=org.mozilla)],
4608 [ val=`echo $withval`
4609 MOZ_DISTRIBUTION_ID="$val"])
4611 if test -z "$MOZ_DISTRIBUTION_ID"; then
4612 MOZ_DISTRIBUTION_ID="org.mozilla"
4615 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4616 AC_SUBST(MOZ_DISTRIBUTION_ID)
4619 dnl ========================================================
4620 dnl Google Play Services, placed here so it can depend on
4621 dnl values set by configure.sh above.
4622 dnl ========================================================
4624 MOZ_ANDROID_GOOGLE_PLAY_SERVICES
4627 dnl ========================================================
4629 dnl ========================================================
4630 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4632 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4634 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4637 dnl ========================================================
4638 dnl = GnomeVFS, GIO and GConf support module
4639 dnl ========================================================
4643 dnl build the GIO extension by default only when the
4644 dnl GTK2 toolkit is in use.
4645 if test "$MOZ_ENABLE_GTK"
4651 dnl ========================================================
4652 dnl = GnomeVFS support module
4653 dnl ========================================================
4654 MOZ_ARG_ENABLE_BOOL(gnomevfs,
4655 [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
4656 MOZ_ENABLE_GNOMEVFS=force,
4657 MOZ_ENABLE_GNOMEVFS=)
4659 if test "$MOZ_ENABLE_GNOMEVFS"
4661 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4662 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4663 MOZ_ENABLE_GNOMEVFS=1
4664 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4666 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4668 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4670 MOZ_ENABLE_GNOMEVFS=
4674 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4676 dnl ========================================================
4677 dnl = GIO support module
4678 dnl ========================================================
4679 MOZ_ARG_DISABLE_BOOL(gio,
4680 [ --disable-gio Disable GIO support],
4682 MOZ_ENABLE_GIO=force)
4684 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
4686 if test "$MOZ_ENABLE_GTK2"
4688 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4689 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4691 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4692 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4694 AC_DEFINE(MOZ_ENABLE_GIO)
4696 if test "$MOZ_ENABLE_GIO" = "force"
4698 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4704 AC_SUBST(MOZ_ENABLE_GIO)
4706 dnl ========================================================
4707 dnl = GConf support module
4708 dnl ========================================================
4709 MOZ_ARG_DISABLE_BOOL(gconf,
4710 [ --disable-gconf Disable Gconf support ],
4712 MOZ_ENABLE_GCONF=force)
4714 if test "$MOZ_ENABLE_GCONF"
4716 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4717 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4720 if test "$MOZ_ENABLE_GCONF" = "force"
4722 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4728 if test "$MOZ_ENABLE_GCONF"; then
4729 AC_DEFINE(MOZ_ENABLE_GCONF)
4732 AC_SUBST(MOZ_ENABLE_GCONF)
4735 dnl ========================================================
4736 dnl = libproxy support
4737 dnl ========================================================
4739 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4741 MOZ_ENABLE_LIBPROXY=
4743 MOZ_ARG_ENABLE_BOOL(libproxy,
4744 [ --enable-libproxy Enable libproxy support ],
4745 MOZ_ENABLE_LIBPROXY=1,
4746 MOZ_ENABLE_LIBPROXY=)
4748 if test "$MOZ_ENABLE_LIBPROXY"
4750 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4751 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4754 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4756 dnl ========================================================
4757 dnl = GNOME component (mozgnome)
4758 dnl ========================================================
4760 if test "$MOZ_ENABLE_GTK"
4762 MOZ_ENABLE_GNOME_COMPONENT=1
4764 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4766 dnl ========================================================
4767 dnl = libgnomeui support module
4768 dnl ========================================================
4770 if test "$MOZ_ENABLE_GTK"
4772 MOZ_ARG_ENABLE_BOOL(gnomeui,
4773 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
4774 MOZ_ENABLE_GNOMEUI=force,
4775 MOZ_ENABLE_GNOMEUI=)
4777 if test "$MOZ_ENABLE_GNOMEUI"
4779 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4781 MOZ_ENABLE_GNOMEUI=1
4783 if test "$MOZ_ENABLE_GNOMEUI" = "force"
4785 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4791 if test "$MOZ_ENABLE_GNOMEUI"; then
4792 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4796 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4798 dnl ========================================================
4800 dnl ========================================================
4802 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4806 MOZ_ARG_DISABLE_BOOL(dbus,
4807 [ --disable-dbus Disable dbus support ],
4811 if test "$MOZ_ENABLE_DBUS"
4813 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
4814 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
4815 AC_DEFINE(MOZ_ENABLE_DBUS)
4818 AC_SUBST(MOZ_ENABLE_DBUS)
4820 dnl ========================================================
4821 dnl = Enable Android History instead of Places
4822 dnl ========================================================
4823 if test -n "$MOZ_ANDROID_HISTORY"; then
4824 if test -z "$MOZ_PLACES"; then
4825 AC_DEFINE(MOZ_ANDROID_HISTORY)
4827 AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
4831 dnl ========================================================
4832 dnl = Enable the C++ async pan/zoom code instead of the Java version
4833 dnl ========================================================
4834 MOZ_ARG_ENABLE_BOOL(android-apz,
4835 [ --enable-android-apz Switch to C++ pan/zoom code],
4838 if test -n "$MOZ_ANDROID_APZ"; then
4839 dnl Do this if defined in confvars.sh
4840 AC_DEFINE(MOZ_ANDROID_APZ)
4843 dnl ========================================================
4844 dnl = Disable WebSMS backend
4845 dnl ========================================================
4846 MOZ_ARG_DISABLE_BOOL(websms-backend,
4847 [ --disable-websms-backend
4848 Disable WebSMS backend],
4849 MOZ_WEBSMS_BACKEND=,
4850 MOZ_WEBSMS_BACKEND=1)
4852 if test -n "$MOZ_WEBSMS_BACKEND"; then
4853 AC_DEFINE(MOZ_WEBSMS_BACKEND)
4856 dnl ========================================================
4857 dnl = Enable runtime locale switching on Android
4858 dnl ========================================================
4859 if test -n "$MOZ_LOCALE_SWITCHER"; then
4860 AC_DEFINE(MOZ_LOCALE_SWITCHER)
4863 dnl ========================================================
4864 dnl = Enable system download manager on Android
4865 dnl ========================================================
4866 if test -n "$MOZ_ANDROID_DOWNLOADS_INTEGRATION"; then
4867 AC_DEFINE(MOZ_ANDROID_DOWNLOADS_INTEGRATION)
4870 dnl ========================================================
4871 dnl = Enable NFC permission on Android
4872 dnl ========================================================
4873 if test -n "$MOZ_ANDROID_BEAM"; then
4874 AC_DEFINE(MOZ_ANDROID_BEAM)
4877 dnl ========================================================
4878 dnl = Include Search Activity on Android
4879 dnl ========================================================
4880 if test -n "$MOZ_ANDROID_SEARCH_ACTIVITY"; then
4881 AC_DEFINE(MOZ_ANDROID_SEARCH_ACTIVITY)
4884 dnl ========================================================
4885 dnl = Include Mozilla Location Service Stumbler on Android
4886 dnl ========================================================
4887 if test -n "$MOZ_ANDROID_MLS_STUMBLER"; then
4888 AC_DEFINE(MOZ_ANDROID_MLS_STUMBLER)
4891 dnl ========================================================
4892 dnl = Include share overlay on Android
4893 dnl ========================================================
4894 if test -n "$MOZ_ANDROID_SHARE_OVERLAY"; then
4895 AC_DEFINE(MOZ_ANDROID_SHARE_OVERLAY)
4898 dnl ========================================================
4899 dnl = Enable IPDL's "expensive" unit tests
4900 dnl ========================================================
4903 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
4904 [ --enable-ipdl-tests Enable expensive IPDL tests],
4908 if test -n "$MOZ_IPDL_TESTS"; then
4909 AC_DEFINE(MOZ_IPDL_TESTS)
4912 AC_SUBST(MOZ_IPDL_TESTS)
4914 dnl ========================================================
4915 dnl = Disable building dbm
4916 dnl ========================================================
4917 MOZ_ARG_DISABLE_BOOL(dbm,
4918 [ --disable-dbm Disable building dbm],
4922 dnl ========================================================
4923 dnl accessibility support on by default on all platforms
4924 dnl ========================================================
4925 MOZ_ARG_DISABLE_BOOL(accessibility,
4926 [ --disable-accessibility Disable accessibility support],
4929 if test "$ACCESSIBILITY"; then
4932 if test -z "$MIDL"; then
4933 if test "$GCC" != "yes"; then
4934 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
4936 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.])
4940 AC_DEFINE(ACCESSIBILITY)
4943 dnl ========================================================
4944 dnl Accessibility is required for the linuxgl widget
4946 dnl ========================================================
4947 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
4948 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
4951 dnl Turn off webrtc for OS's we don't handle yet, but allow
4952 dnl --enable-webrtc to override. Can disable for everything in
4953 dnl the master list above.
4954 if test -n "$MOZ_WEBRTC"; then
4956 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
4960 dnl default to disabled for all others
4966 AC_TRY_COMPILE([#include <linux/ethtool.h>],
4967 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
4968 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
4970 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
4972 # target_arch is from {ia32|x64|arm|ppc}
4974 x86_64 | arm | x86 | ppc* | ia64)
4978 # unsupported arch for webrtc
4984 dnl ========================================================
4985 dnl = Disable WebRTC code
4986 dnl ========================================================
4987 MOZ_ARG_DISABLE_BOOL(webrtc,
4988 [ --disable-webrtc Disable support for WebRTC],
4992 if test -n "$MOZ_WEBRTC"; then
4993 AC_DEFINE(MOZ_WEBRTC)
4994 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
4995 dnl opt/production builds (via MOZ_CRASH())
4996 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
4999 MOZ_VPX_ERROR_CONCEALMENT=1
5001 dnl enable once Signaling lands
5002 MOZ_WEBRTC_SIGNALING=1
5003 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5004 dnl enable once PeerConnection lands
5005 MOZ_PEERCONNECTION=1
5006 AC_DEFINE(MOZ_PEERCONNECTION)
5011 if test -n "$MOZ_X11"; then
5012 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
5018 dnl ========================================================
5019 dnl = Force hardware AEC, disable webrtc.org AEC
5020 dnl ========================================================
5021 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
5022 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
5023 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
5024 MOZ_WEBRTC_HARDWARE_AEC_NS=)
5026 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
5027 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
5030 AC_SUBST(MOZ_WEBRTC)
5031 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5032 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5033 AC_SUBST(MOZ_PEERCONNECTION)
5034 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5035 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
5038 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
5040 dnl Use integers over floats for audio on B2G and Android
5041 dnl (regarless of the CPU architecture, because audio
5042 dnl backends for those platforms don't support floats. We also
5043 dnl use integers on ARM with other OS, because it's more efficient.
5044 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
5045 MOZ_SAMPLE_TYPE_S16=1
5046 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5047 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5049 MOZ_SAMPLE_TYPE_FLOAT32=1
5050 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5051 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5054 dnl ========================================================
5055 dnl = Disable Speech API code
5056 dnl ========================================================
5057 MOZ_ARG_DISABLE_BOOL(webspeech,
5058 [ --disable-webspeech Disable support for HTML Speech API],
5062 if test -n "$MOZ_WEBSPEECH"; then
5063 AC_DEFINE(MOZ_WEBSPEECH)
5066 AC_SUBST(MOZ_WEBSPEECH)
5068 dnl ========================================================
5069 dnl = Enable Raw Codecs
5070 dnl ========================================================
5071 MOZ_ARG_ENABLE_BOOL(raw,
5072 [ --enable-raw Enable support for RAW media],
5076 if test -n "$MOZ_RAW"; then
5082 dnl Checks for __attribute__(aligned()) directive need by libogg
5083 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5084 [ac_cv_c_attribute_aligned],
5085 [ac_cv_c_attribute_aligned=0
5086 CFLAGS_save="${CFLAGS}"
5087 CFLAGS="${CFLAGS} -Werror"
5088 for ac_cv_c_attr_align_try in 64 32 16 8; do
5089 echo "trying $ac_cv_c_attr_align_try"
5091 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5092 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5093 if test "$ac_cv_c_attribute_aligned" != 0; then
5097 CFLAGS="${CFLAGS_save}"])
5098 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5099 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5100 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5103 dnl ========================================================
5104 dnl = Disable Opus audio codec support
5105 dnl ========================================================
5106 MOZ_ARG_DISABLE_BOOL(opus,
5107 [ --disable-opus Disable support for Opus audio],
5111 dnl ========================================================
5112 dnl = Disable VP8 decoder support
5113 dnl ========================================================
5114 MOZ_ARG_DISABLE_BOOL(webm,
5115 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5119 if test -n "$MOZ_WEBM"; then
5124 dnl ========================================================
5125 dnl = Apple platform decoder support
5126 dnl ========================================================
5127 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5131 if test -n "$MOZ_APPLEMEDIA"; then
5132 AC_DEFINE(MOZ_APPLEMEDIA)
5133 # hack in frameworks for fmp4 - see bug 1029974
5134 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
5135 LDFLAGS="$LDFLAGS -framework AudioToolbox"
5136 dnl Verify CoreMedia is available.
5137 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
5138 [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
5141 dnl ========================================================
5142 dnl = DirectShow support
5143 dnl ========================================================
5144 if test "$OS_ARCH" = "WINNT"; then
5145 dnl Enable DirectShow support by default.
5149 MOZ_ARG_DISABLE_BOOL(directshow,
5150 [ --disable-directshow Disable support for DirectShow],
5154 if test -n "$MOZ_DIRECTSHOW"; then
5155 AC_DEFINE(MOZ_DIRECTSHOW)
5158 dnl ========================================================
5159 dnl = Windows Media Foundation support
5160 dnl ========================================================
5161 if test "$OS_ARCH" = "WINNT"; then
5162 dnl Enable Windows Media Foundation support by default.
5163 dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5164 dnl guaranteed to have a recent-enough SDK to build WMF.
5168 MOZ_ARG_DISABLE_BOOL(wmf,
5169 [ --disable-wmf Disable support for Windows Media Foundation],
5173 if test -n "$MOZ_WMF"; then
5177 dnl ========================================================
5178 dnl FFmpeg H264/AAC Decoding Support
5179 dnl ========================================================
5180 case "$OS_TARGET" in
5181 WINNT|Darwin|Android)
5188 MOZ_ARG_DISABLE_BOOL(ffmpeg,
5189 [ --disable-ffmpeg Disable FFmpeg for fragmented H264/AAC decoding],
5194 if test -n "$MOZ_FFMPEG"; then
5195 AC_DEFINE(MOZ_FFMPEG)
5198 dnl ========================================================
5199 dnl = Built-in fragmented MP4 support.
5200 dnl ========================================================
5201 if test -n "$MOZ_WMF" -o -n "$MOZ_FFMPEG" -o -n "$MOZ_APPLEMEDIA"; then
5202 dnl Enable fragmented MP4 parser on platforms with decoder support.
5206 MOZ_ARG_DISABLE_BOOL(fmp4,
5207 [ --disable-fmp4 Disable support for in built Fragmented MP4 parsing],
5211 if test -n "$MOZ_FMP4"; then
5215 dnl ========================================================
5217 dnl ========================================================
5219 MOZ_ARG_DISABLE_BOOL(eme,
5220 [ --disable-eme Disable support for Encrypted Media Extensions],
5224 if test -n "$MOZ_EME"; then
5228 dnl ========================================================
5229 dnl = Enable media plugin support
5230 dnl ========================================================
5231 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5232 dnl Enable support on android by default
5236 MOZ_ARG_ENABLE_BOOL(android-omx,
5237 [ --enable-android-omx Enable support for Android OMX media backend],
5241 if test -n "$MOZ_ANDROID_OMX"; then
5242 AC_DEFINE(MOZ_ANDROID_OMX)
5245 dnl ========================================================
5246 dnl = Enable getUserMedia support
5247 dnl ========================================================
5248 MOZ_ARG_ENABLE_BOOL(media-navigator,
5249 [ --enable-media-navigator Enable support for getUserMedia],
5250 MOZ_MEDIA_NAVIGATOR=1,
5251 MOZ_MEDIA_NAVIGATOR=)
5253 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5254 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5257 dnl ========================================================
5258 dnl = Enable building OMX media plugin (B2G or Android)
5259 dnl ========================================================
5260 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5261 dnl Enable support on android by default
5265 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5266 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5270 if test -n "$MOZ_OMX_PLUGIN"; then
5271 if test "$OS_TARGET" = "Android"; then
5272 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5273 AC_DEFINE(MOZ_OMX_PLUGIN)
5275 dnl fail if we're not building on Gonk or Android
5276 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5280 dnl system libvpx Support
5281 dnl ========================================================
5282 MOZ_ARG_WITH_BOOL(system-libvpx,
5283 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5284 MOZ_NATIVE_LIBVPX=1)
5289 if test -n "$MOZ_VPX"; then
5291 if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
5292 AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
5295 _SAVE_CFLAGS=$CFLAGS
5297 if test -n "$MOZ_NATIVE_LIBVPX"; then
5298 dnl ============================
5299 dnl === libvpx Version check ===
5300 dnl ============================
5301 dnl Check to see if we have a system libvpx package.
5302 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.3.0)
5304 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
5305 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
5307 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5308 [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.])])
5310 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5311 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5313 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
5314 [AC_CHECK_FUNC(vpx_mem_set_functions)])
5315 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
5316 "$ac_cv_func_vpx_mem_set_functions" = no; then
5317 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
5320 CFLAGS=$_SAVE_CFLAGS
5324 AC_SUBST(MOZ_NATIVE_LIBVPX)
5325 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
5326 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
5328 if test "$MOZ_WEBM"; then
5329 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5336 if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then
5338 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5339 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5340 dnl We currently require gcc on all arm platforms.
5343 VPX_NEED_OBJ_INT_EXTRACT=
5345 dnl See if we have assembly on this platform.
5346 case "$OS_ARCH:$CPU_ARCH" in
5348 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5352 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5356 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5360 dnl Check for yasm 1.1 or greater.
5361 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5362 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.])
5363 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5364 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.])
5366 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5368 dnl The encoder needs obj_int_extract to get asm offsets.
5372 if test -n "$GNU_AS" ; then
5374 dnl These flags are a lie; they're just used to enable the requisite
5375 dnl opcodes; actual arch detection is done at runtime.
5376 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5377 VPX_DASH_C_FLAG="-c"
5378 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5379 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5384 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5385 VPX_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC"
5390 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5391 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5397 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5398 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.])
5401 if test -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5402 dnl We prefer to get asm offsets using inline assembler, which the above
5403 dnl compilers can do. When we're not using one of those, we have to fall
5404 dnl back to obj_int_extract, which reads them from a compiled object
5405 dnl file. Unfortunately, that only works if we're compiling on a system
5406 dnl with the header files for the appropriate object file format.
5407 VPX_NEED_OBJ_INT_EXTRACT=1
5410 if test -n "$VPX_X86_ASM"; then
5411 AC_DEFINE(VPX_X86_ASM)
5412 elif test -n "$VPX_ARM_ASM"; then
5413 AC_DEFINE(VPX_ARM_ASM)
5415 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5419 dnl ========================================================
5420 dnl = Disable Wave decoder support
5421 dnl ========================================================
5422 MOZ_ARG_DISABLE_BOOL(wave,
5423 [ --disable-wave Disable Wave decoder support],
5427 if test -n "$MOZ_WAVE"; then
5431 dnl ========================================================
5432 dnl = Handle dependent MEDIA defines
5433 dnl ========================================================
5435 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5436 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/])
5439 if test -n "$MOZ_WEBRTC" -a -z "$MOZ_OPUS"; then
5440 AC_MSG_ERROR([MOZ_WEBRTC requires MOZ_OPUS which is disabled.])
5443 if test -n "$MOZ_VORBIS"; then
5444 AC_DEFINE(MOZ_VORBIS)
5447 if test -n "$MOZ_TREMOR"; then
5448 AC_DEFINE(MOZ_TREMOR)
5449 # Tremor doesn't have an encoder.
5453 if test -n "$MOZ_OPUS"; then
5457 if test -n "$MOZ_WEBM_ENCODER"; then
5458 AC_DEFINE(MOZ_WEBM_ENCODER)
5460 AC_SUBST(MOZ_WEBM_ENCODER)
5462 dnl ==================================
5463 dnl = Check alsa availability on Linux
5464 dnl ==================================
5466 dnl If using Linux, ensure that the alsa library is available
5467 if test "$OS_TARGET" = "Linux"; then
5471 MOZ_ARG_ENABLE_BOOL(alsa,
5472 [ --enable-alsa Enable Alsa support (default on Linux)],
5476 if test -n "$MOZ_ALSA"; then
5477 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5478 [echo "$MOZ_ALSA_PKG_ERRORS"
5479 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.)])])
5484 dnl ========================================================
5485 dnl = Disable PulseAudio
5486 dnl ========================================================
5488 dnl If using Linux, ensure that the PA library is available
5489 case "$OS_TARGET" in
5490 WINNT|Darwin|Android|OpenBSD)
5493 if test -z "$MOZ_B2G"; then
5499 MOZ_ARG_DISABLE_BOOL(pulseaudio,
5500 [ --disable-pulseaudio Disable PulseAudio support],
5504 if test -n "$MOZ_PULSEAUDIO"; then
5505 if test -z "$gonkdir"; then
5506 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5507 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5508 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
5510 MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
5514 AC_SUBST(MOZ_PULSEAUDIO)
5516 dnl ========================================================
5517 dnl = Enable GStreamer
5518 dnl ========================================================
5519 case "$OS_TARGET" in
5520 WINNT|Darwin|Android)
5524 GST_API_VERSION=0.10
5528 MOZ_ARG_ENABLE_STRING(gstreamer,
5529 [ --enable-gstreamer[=0.10] Enable GStreamer support],
5531 # API version, eg 0.10, 1.0 etc
5532 if test -z "$enableval" -o "$enableval" = "yes"; then
5533 GST_API_VERSION=0.10
5534 elif test "$enableval" = "no"; then
5537 GST_API_VERSION=$enableval
5541 if test -n "$MOZ_GSTREAMER"; then
5542 # core/base release number
5543 if test "$GST_API_VERSION" = "1.0"; then
5549 PKG_CHECK_MODULES(GSTREAMER,
5550 gstreamer-$GST_API_VERSION >= $GST_VERSION
5551 gstreamer-app-$GST_API_VERSION
5552 gstreamer-plugins-base-$GST_API_VERSION,
5553 [_HAVE_GSTREAMER=1],
5555 if test -z "$_HAVE_GSTREAMER"; then
5556 AC_MSG_ERROR([gstreamer and gstreamer-plugins-base development packages are needed to build gstreamer backend. Install them or disable gstreamer support with --disable-gstreamer])
5559 _SAVE_LDFLAGS=$LDFLAGS
5560 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5561 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5562 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5563 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5565 AC_MSG_ERROR([gstreamer-plugins-base found, but no libgstvideo. Something has gone terribly wrong. Try reinstalling gstreamer-plugins-base; failing that, disable the gstreamer backend with --disable-gstreamer.])
5567 LDFLAGS=$_SAVE_LDFLAGS
5570 AC_SUBST(MOZ_GSTREAMER)
5571 AC_SUBST(GST_API_VERSION)
5573 if test -n "$MOZ_GSTREAMER"; then
5574 AC_DEFINE(MOZ_GSTREAMER)
5575 AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION")
5579 dnl ========================================================
5580 dnl Permissions System
5581 dnl ========================================================
5582 MOZ_ARG_DISABLE_BOOL(permissions,
5583 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5588 dnl ========================================================
5589 dnl Child permissions, currently only used for b2g
5590 dnl ========================================================
5591 if test -n "$MOZ_B2G"; then
5592 if test -n "$MOZ_PERMISSIONS"; then
5593 MOZ_CHILD_PERMISSIONS=1
5595 AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
5598 AC_SUBST(MOZ_CHILD_PERMISSIONS)
5600 dnl ========================================================
5602 dnl ========================================================
5603 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5604 [ --disable-negotiateauth Disable GSS-API negotiation ],
5605 MOZ_AUTH_EXTENSION=,
5606 MOZ_AUTH_EXTENSION=1 )
5608 dnl ========================================================
5609 dnl Pref extensions (autoconfig)
5610 dnl ========================================================
5611 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5612 [ --disable-pref-extensions
5613 Disable pref extensions such as autoconfig],
5614 MOZ_PREF_EXTENSIONS=,
5615 MOZ_PREF_EXTENSIONS=1 )
5617 dnl ========================================================
5618 dnl Searching of system directories for extensions.
5619 dnl Note: this switch is meant to be used for test builds
5620 dnl whose behavior should not depend on what happens to be
5621 dnl installed on the local machine.
5622 dnl ========================================================
5623 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5624 [ --disable-system-extension-dirs
5625 Disable searching system- and account-global
5626 directories for extensions of any kind; use
5627 only profile-specific extension directories],
5628 ENABLE_SYSTEM_EXTENSION_DIRS=,
5629 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5630 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5631 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5634 dnl ========================================================
5635 dnl = Universalchardet
5636 dnl ========================================================
5637 MOZ_ARG_DISABLE_BOOL(universalchardet,
5638 [ --disable-universalchardet
5639 Disable universal encoding detection],
5640 MOZ_UNIVERSALCHARDET=,
5641 MOZ_UNIVERSALCHARDET=1 )
5643 if test -n "${JAVA_BIN_PATH}"; then
5644 dnl Look for javac and jar in the specified path.
5645 JAVA_PATH="$JAVA_BIN_PATH"
5647 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5648 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5651 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5652 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5653 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5654 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5655 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5656 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5658 if test -n "${JAVA_BIN_PATH}" -o \
5659 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5660 if test -z "$JAVA" -o "$JAVA" = ":"; then
5661 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}])
5663 if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5664 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}])
5666 if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5667 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}])
5669 if test -z "$JAR" -o "$JAR" = ":"; then
5670 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}])
5672 if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5673 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}])
5675 if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5676 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}])
5679 AC_MSG_CHECKING([for minimum required javac version >= 1.7])
5681 dnl Javac spits out something like `javac 1.7.0`. This line cuts off the 'javac'
5682 _javac_version=$($JAVAC -version 2>&1 | cut -d ' ' -f 2)
5684 dnl Here, we extract the major (1) and minor (7) version numbers from the
5685 dnl acquired version string.
5686 _javac_major_version=$(echo $_javac_version | cut -d '.' -f 1)
5687 _javac_minor_version=$(echo $_javac_version | cut -d '.' -f 2)
5689 AC_MSG_RESULT([$_javac_version])
5691 dnl Fail if we have a version other than 1.7.X
5692 if test "$_javac_major_version" -ne "1" -o \
5693 \( "$_javac_minor_version" -lt "7" \); then
5694 AC_MSG_ERROR([javac 1.7 or higher is required.])
5698 dnl ========================================================
5699 dnl = ANGLE OpenGL->D3D translator for WebGL
5700 dnl = * only applies to win32
5701 dnl ========================================================
5705 MOZ_HAS_WINSDK_WITH_D3D=
5706 MOZ_D3DCOMPILER_VISTA_DLL=
5707 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5708 MOZ_DIRECTX_SDK_PATH=
5709 MOZ_D3DCOMPILER_XP_DLL=
5710 MOZ_D3DCOMPILER_XP_CAB=
5712 case "$target_os" in
5714 MOZ_ANGLE_RENDERER=1
5718 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5719 case "${target_cpu}" in
5721 MOZ_D3D_CPU_SUFFIX=x86
5724 MOZ_D3D_CPU_SUFFIX=x64
5728 MOZ_ARG_ENABLE_BOOL(require-all-d3dc-versions,
5729 [ --enable-require-all-d3dc-versions Require all versions of the D3D compiler needed for supported Windows systems.],
5730 MOZ_REQUIRE_ALL_D3DCS=1,
5731 MOZ_REQUIRE_ALL_D3DCS=)
5733 # This is potentially set in external mozconfig files; if it's set,
5734 # then the build exposes the "webgl" context name, which is reserved
5735 # for conformant implementations.
5736 if test -n "$MOZ_WEBGL_CONFORMANT"; then
5737 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
5740 dnl ========================================================
5741 dnl D3D compiler DLL
5742 dnl ========================================================
5743 MOZ_FOUND_D3D_COMPILERS=
5745 if test -n "$MOZ_ANGLE_RENDERER"; then
5746 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
5747 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
5750 ######################################
5751 # Find _46+ for use by Vista+.
5753 # Find a D3D compiler DLL in a Windows SDK.
5754 MOZ_D3DCOMPILER_VISTA_DLL=
5755 case "$MOZ_WINSDK_MAXVER" in
5757 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
5758 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
5761 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_46.dll
5762 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.0.])
5766 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5767 # We have a name, now track down the path.
5768 if test -n "$WINDOWSSDKDIR"; then
5769 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
5770 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5771 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5772 MOZ_HAS_WINSDK_WITH_D3D=1
5774 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5775 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
5776 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5779 AC_MSG_RESULT([Windows SDK not found.])
5783 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5784 MOZ_D3DCOMPILER_VISTA_DLL=
5787 # On mingw, check if headers are provided by toolchain.
5788 if test -n "$GNU_CC"; then
5789 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
5792 ######################################
5793 # Find _43 for use by XP.
5795 # Get the SDK path from the registry.
5796 # First try to get the June 2010 SDK
5797 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5798 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5799 # Otherwise just take whatever comes first
5800 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5802 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'`
5804 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5805 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/dxguid.lib ; then
5806 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5808 AC_MSG_RESULT([DirectX SDK not found.])
5809 MOZ_DIRECTX_SDK_PATH=
5812 # Check that our DirectX SDK is acceptable.
5813 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5814 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5815 AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
5816 MOZ_DIRECTX_SDK_PATH=
5820 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5821 # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
5822 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5823 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'`
5825 if test -n "$MOZ_D3DX9_VERSION" ; then
5826 MOZ_D3DCOMPILER_XP_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_D3D_CPU_SUFFIX}.cab | head -n1`
5828 if test -n "$MOZ_D3DCOMPILER_XP_CAB"; then
5829 MOZ_D3DCOMPILER_XP_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5831 AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
5832 AC_MSG_ERROR([DirectX SDK at "$MOZ_DIRECTX_SDK_PATH" appears broken.])
5833 MOZ_DIRECTX_SDK_PATH=
5836 AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
5837 MOZ_DIRECTX_SDK_PATH=
5840 AC_MSG_RESULT([Couldn't find an acceptable DirectX SDK for ANGLE, needed for d3dcompiler_43.])
5841 AC_MSG_RESULT([ Either ignore, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5844 ######################################
5845 # Check that we found what we needed.
5846 MOZ_FOUND_A_D3D_COMPILER=
5847 MOZ_FOUND_BOTH_D3D_COMPILERS=1
5849 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5850 MOZ_FOUND_A_D3D_COMPILER=1
5851 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
5853 MOZ_FOUND_BOTH_D3D_COMPILERS=
5856 if test -n "$MOZ_D3DCOMPILER_XP_DLL"; then
5857 MOZ_FOUND_A_D3D_COMPILER=1
5858 AC_MSG_RESULT([Found d3dcompiler DLL for XP: $MOZ_D3DCOMPILER_XP_DLL])
5860 MOZ_FOUND_BOTH_D3D_COMPILERS=
5863 if test -z "$CROSS_COMPILE"; then
5864 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
5865 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
5866 AC_MSG_ERROR([ Either install Windows SDK 8.0+, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5869 if test -n "$MOZ_REQUIRE_ALL_D3DCS" -a -z "$MOZ_FOUND_BOTH_D3D_COMPILERS"; then
5870 AC_MSG_ERROR([Both D3D compilers _43 and _46+ are required by --enable-require-d3d-compilers.])
5871 AC_MSG_ERROR([ Install Windows SDK 8.0+, as well as DirectX SDK (June 2010 version or newer), or reconfigure without this flag.])
5877 dnl ========================================================
5879 dnl ========================================================
5881 MOZ_GAMEPAD_BACKEND=stub
5883 # Gamepad DOM is built on supported platforms by default.
5884 case "$OS_TARGET" in
5889 if test "$MOZ_WIDGET_TOOLKIT" != "gonk"; then
5897 MOZ_ARG_DISABLE_BOOL(gamepad,
5898 [ --disable-gamepad Disable gamepad support],
5902 if test "$MOZ_GAMEPAD"; then
5903 case "$OS_TARGET" in
5905 MOZ_GAMEPAD_BACKEND=cocoa
5908 case "$MOZ_WINSDK_MAXVER" in
5909 # We support building with the Windows 7 SDK otherwise, but
5910 # Gamepad support requires the Windows 8 SDK for some HID headers.
5912 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.])
5917 MOZ_GAMEPAD_BACKEND=windows
5920 MOZ_CHECK_HEADER([linux/joystick.h])
5921 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5922 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.])
5924 MOZ_GAMEPAD_BACKEND=linux
5927 MOZ_GAMEPAD_BACKEND=android
5933 AC_DEFINE(MOZ_GAMEPAD)
5935 AC_SUBST(MOZ_GAMEPAD)
5936 AC_SUBST(MOZ_GAMEPAD_BACKEND)
5938 dnl ========================================================
5939 dnl = Breakpad crash reporting (on by default on supported platforms)
5940 dnl ========================================================
5943 i?86-*-mingw*|x86_64-*-mingw*)
5946 i?86-apple-darwin*|x86_64-apple-darwin*)
5949 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5950 if test "$MOZ_ENABLE_GTK"; then
5954 *-android*|*-linuxandroid*)
5962 MOZ_ARG_DISABLE_BOOL(crashreporter,
5963 [ --disable-crashreporter Disable breakpad crash reporting],
5964 [MOZ_CRASHREPORTER=],
5965 [MOZ_CRASHREPORTER=F # Force enable breakpad])
5967 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
5968 if test "$MOZ_CRASHREPORTER" = F; then
5969 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
5974 if test -n "$MOZ_CRASHREPORTER"; then
5975 AC_DEFINE(MOZ_CRASHREPORTER)
5977 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5978 test -z "$SKIP_LIBRARY_CHECKS"; then
5979 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5982 if test "$OS_ARCH" = "WINNT"; then
5983 if test -z "$HAVE_64BIT_BUILD"; then
5984 MOZ_CRASHREPORTER_INJECTOR=1
5985 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5990 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5991 [ --with-crashreporter-enable-percent=NN
5992 Enable sending crash reports by default on NN% of users. (default=100)],
5993 [ val=`echo $withval | sed 's/[^0-9]//g'`
5994 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5996 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5997 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5999 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6001 dnl ========================================================
6002 dnl = libjpeg-turbo configuration
6003 dnl ========================================================
6005 if test -z "$MOZ_NATIVE_JPEG"; then
6009 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6010 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
6012 MOZ_LIBJPEG_TURBO=1)
6014 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6015 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6018 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6021 if test -n "$MOZ_LIBJPEG_TURBO"; then
6023 dnl Do we support libjpeg-turbo on this platform?
6024 case "$OS_ARCH:$OS_TEST" in
6026 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6027 LIBJPEG_TURBO_X86_ASM=1
6030 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6031 LIBJPEG_TURBO_X64_ASM=1
6033 WINNT:x86|WINNT:i?86)
6034 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6035 LIBJPEG_TURBO_X86_ASM=1
6038 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6039 LIBJPEG_TURBO_X64_ASM=1
6042 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6043 LIBJPEG_TURBO_ARM_ASM=1
6046 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6047 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6048 LIBJPEG_TURBO_X86_ASM=1
6052 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6053 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6054 LIBJPEG_TURBO_X64_ASM=1
6061 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6062 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6063 dnl it doesn't exist or we have too old of a version.
6064 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6065 LIBJPEG_TURBO_AS=$YASM
6067 if test -z "$LIBJPEG_TURBO_AS" ; then
6068 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.])
6071 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6072 dnl on Linux and 1.1 or newer everywhere else.
6073 if test "$OS_ARCH" = "Linux" ; then
6074 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
6075 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.])
6078 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6079 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.])
6084 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6085 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6086 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6087 echo "Using $AS as the assembler for ARM code."
6088 LIBJPEG_TURBO_AS=$AS
6091 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6092 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6093 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6094 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6095 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6096 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6097 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6098 dnl Warn if we're not building the optimized routines, even though the user
6099 dnl didn't specify --disable-libjpeg-turbo.
6100 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6103 dnl ========================================================
6104 dnl = Enable compilation of specific extension modules
6105 dnl ========================================================
6107 MOZ_ARG_ENABLE_STRING(extensions,
6108 [ --enable-extensions Enable extensions],
6109 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6110 if test "$option" = "yes" -o "$option" = "all"; then
6111 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6112 elif test "$option" = "no" -o "$option" = "none"; then
6114 elif test "$option" = "default"; then
6115 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6116 elif test `echo "$option" | grep -c \^-` != 0; then
6117 option=`echo $option | sed 's/^-//'`
6118 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6120 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6123 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6125 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6126 # Suppress warning on non-X11 platforms
6127 if test -n "$MOZ_X11"; then
6128 AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6130 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6133 dnl Do not build gnomevfs with libxul based apps
6134 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6135 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6138 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6139 # Suppress warning on non-X11 platforms
6140 if test -n "$MOZ_X11"; then
6141 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6143 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6146 dnl Do not build gio with libxul based apps
6147 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6148 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6151 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6153 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6155 AC_SUBST(MOZ_GIO_COMPONENT)
6158 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6160 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6161 dnl when trying to build a nonexistent extension.
6162 for extension in $MOZ_EXTENSIONS; do
6163 if test ! -d "${srcdir}/extensions/${extension}"; then
6164 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6168 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6169 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6172 dnl ========================================================
6173 dnl Build Freetype in the tree
6174 dnl ========================================================
6175 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6176 [ --enable-tree-freetype Enable Tree FreeType],
6177 MOZ_TREE_FREETYPE=1,
6178 MOZ_TREE_FREETYPE= )
6179 if test -n "$MOZ_TREE_FREETYPE"; then
6180 if test -n "$_WIN32_MSVC"; then
6181 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6183 AC_DEFINE(MOZ_TREE_FREETYPE)
6184 AC_SUBST(MOZ_TREE_FREETYPE)
6185 MOZ_ENABLE_CAIRO_FT=1
6186 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6187 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6188 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6190 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6191 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6192 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6193 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
6196 dnl ========================================================
6198 dnl ========================================================
6199 dnl Abort Windows build if the required major version and
6200 dnl minimum minor version of Unicode NSIS isn't in the path
6201 dnl (unless in case of cross compiling, for which Unicode
6202 dnl is not yet sufficient).
6203 if test "$OS_ARCH" = "WINNT"; then
6204 MIN_NSIS_MAJOR_VER=2
6205 MIN_NSIS_MINOR_VER=46
6206 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-3.0a2.exe makensisu-2.46.exe makensis)
6207 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6208 AC_MSG_RESULT([yes])
6209 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null`
6211 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6213 if test "$MAKENSISU_PARSED_VER" = ""; then
6215 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
6218 MAKENSISU_MAJOR_VER=0
6219 MAKENSISU_MINOR_VER=0
6220 if test ! "$MAKENSISU_PARSED_VER" = ""; then
6221 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'`
6222 MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'`
6224 AC_MSG_CHECKING([for Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater])
6225 if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \
6226 "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER ||
6227 test "$MAKENSISU_MAJOR_VER" -gt $MIN_NSIS_MAJOR_VER; then
6228 AC_MSG_RESULT([yes])
6231 if test -z "$CROSS_COMPILE"; then
6232 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.])
6237 elif test -z "$CROSS_COMPILE"; then
6238 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.])
6244 dnl ========================================================
6246 dnl ========================================================
6247 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6248 [ --disable-webapp-runtime Disable Web App Runtime],
6249 MOZ_WEBAPP_RUNTIME=,
6250 MOZ_WEBAPP_RUNTIME=1)
6251 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a -z "$MOZ_WIDGET_GTK" ; then
6254 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6257 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6258 if test "$MOZ_WEBAPP_RUNTIME"; then
6259 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6262 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6263 if test -z "$TAR"; then
6264 AC_MSG_ERROR([no tar archiver found in \$PATH])
6268 AC_CHECK_PROGS(WGET, wget, "")
6271 dnl ========================================================
6273 dnl ========================================================
6275 if test -n "$MOZ_SIGN_CMD"; then
6276 AC_DEFINE(MOZ_SIGNING)
6279 dnl ========================================================
6280 dnl Maintenance Service
6281 dnl ========================================================
6283 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6284 [ --enable-maintenance-service Enable building of maintenanceservice],
6285 MOZ_MAINTENANCE_SERVICE=1,
6286 MOZ_MAINTENANCE_SERVICE= )
6288 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6289 if test "$OS_ARCH" = "WINNT"; then
6290 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6292 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6296 dnl ========================================================
6297 dnl Bundled fonts on desktop platforms
6298 dnl ========================================================
6300 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
6301 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
6302 MOZ_BUNDLED_FONTS=1,
6305 if test -n "$MOZ_BUNDLED_FONTS"; then
6306 AC_DEFINE(MOZ_BUNDLED_FONTS)
6309 dnl ========================================================
6310 dnl Verify MAR signatures
6311 dnl ========================================================
6313 MOZ_ARG_ENABLE_BOOL(verify-mar,
6314 [ --enable-verify-mar Enable verifying MAR signatures],
6315 MOZ_VERIFY_MAR_SIGNATURE=1,
6316 MOZ_VERIFY_MAR_SIGNATURE= )
6318 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6319 if test "$OS_ARCH" = "WINNT"; then
6320 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6322 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6326 dnl ========================================================
6327 dnl Enable building the signmar program.
6328 dnl This option is much different than the --enable-verify-mar option.
6329 dnl --enable-verify-mar is for enabling the verification check on MAR
6330 dnl files in the updater. The --enable-signmar option is for building
6331 dnl the signmar program.
6332 dnl ========================================================
6334 MOZ_ARG_ENABLE_BOOL(signmar,
6335 [ --enable-signmar Enable building the signmar program],
6336 MOZ_ENABLE_SIGNMAR=1,
6337 MOZ_ENABLE_SIGNMAR= )
6339 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6340 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6343 dnl ========================================================
6345 dnl ========================================================
6347 MOZ_ARG_DISABLE_BOOL(updater,
6348 [ --disable-updater Disable building of updater],
6352 if test -n "$MOZ_UPDATER"; then
6353 AC_DEFINE(MOZ_UPDATER)
6356 # tools/update-packaging is not checked out by default.
6357 MOZ_ARG_ENABLE_BOOL(update-packaging,
6358 [ --enable-update-packaging
6359 Enable tools/update-packaging],
6360 MOZ_UPDATE_PACKAGING=1,
6361 MOZ_UPDATE_PACKAGING= )
6362 AC_SUBST(MOZ_UPDATE_PACKAGING)
6364 dnl ========================================================
6365 dnl build the tests by default
6366 dnl ========================================================
6367 MOZ_ARG_DISABLE_BOOL(tests,
6368 [ --disable-tests Do not build test libraries & programs],
6372 if test -n "$ENABLE_TESTS"; then
6374 AC_DEFINE(ENABLE_TESTS)
6375 AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6376 AC_SUBST(GTEST_HAS_RTTI)
6377 if test -n "$_WIN32_MSVC"; then
6378 AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6380 if test "${OS_TARGET}" = "Android"; then
6381 AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6382 AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6383 AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6384 AC_SUBST(GTEST_OS_LINUX_ANDROID)
6385 AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6386 AC_SUBST(GTEST_HAS_CLONE)
6390 dnl ========================================================
6391 dnl parental controls (for Windows Vista)
6392 dnl ========================================================
6393 MOZ_ARG_DISABLE_BOOL(parental-controls,
6394 [ --disable-parental-controls
6395 Do not build parental controls],
6396 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6397 MOZ_DISABLE_PARENTAL_CONTROLS=)
6398 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6399 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6402 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6404 dnl ========================================================
6405 dnl = Disable smartcard support
6406 dnl ========================================================
6407 if test -n "$MOZ_NO_SMART_CARDS"; then
6408 AC_DEFINE(MOZ_NO_SMART_CARDS)
6410 AC_SUBST(MOZ_NO_SMART_CARDS)
6412 dnl ========================================================
6413 dnl = Disable EV certificate verification
6414 dnl ========================================================
6415 if test -n "$MOZ_NO_EV_CERTS"; then
6416 AC_DEFINE(MOZ_NO_EV_CERTS)
6418 AC_SUBST(MOZ_NO_EV_CERTS)
6420 dnl ========================================================
6421 dnl = Disable libpkix
6422 dnl ========================================================
6423 if test -n "$NSS_NO_LIBPKIX"; then
6424 AC_DEFINE(NSS_NO_LIBPKIX)
6426 AC_SUBST(NSS_NO_LIBPKIX)
6428 dnl ========================================================
6429 dnl = Sandboxing support
6430 dnl ========================================================
6431 MOZ_ARG_DISABLE_BOOL(sandbox,
6432 [ --disable-sandbox Disable sandboxing support],
6436 dnl ========================================================
6437 dnl = Content process sandboxing
6438 dnl ========================================================
6439 if test -n "$gonkdir"; then
6440 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6443 case "$OS_TARGET:$NIGHTLY_BUILD" in
6445 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6448 MOZ_ARG_ENABLE_BOOL(content-sandbox,
6449 [ --enable-content-sandbox Enable sandboxing support for content-processes],
6450 MOZ_CONTENT_SANDBOX=1,
6451 MOZ_CONTENT_SANDBOX=)
6455 if test -n "$MOZ_CONTENT_SANDBOX"; then
6456 AC_DEFINE(MOZ_CONTENT_SANDBOX)
6459 AC_SUBST(MOZ_CONTENT_SANDBOX)
6461 dnl ========================================================
6462 dnl = Gecko Media Plugin sandboxing
6463 dnl ========================================================
6466 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6471 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6476 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6480 if test -n "$MOZ_GMP_SANDBOX"; then
6481 AC_DEFINE(MOZ_GMP_SANDBOX)
6484 AC_SUBST(MOZ_GMP_SANDBOX)
6486 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
6490 if test -n "$MOZ_SANDBOX"; then
6491 AC_DEFINE(MOZ_SANDBOX)
6494 AC_SUBST(MOZ_SANDBOX)
6497 dnl ========================================================
6499 dnl = Module specific options
6501 dnl ========================================================
6502 MOZ_ARG_HEADER(Individual module options)
6504 dnl ========================================================
6505 dnl = Disable feed handling components
6506 dnl ========================================================
6507 MOZ_ARG_DISABLE_BOOL(feeds,
6508 [ --disable-feeds Disable feed handling and processing components],
6511 if test -n "$MOZ_FEEDS"; then
6512 AC_DEFINE(MOZ_FEEDS)
6514 if test "$MOZ_BUILD_APP" = "browser"; then
6515 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6519 dnl ========================================================
6520 dnl Check for sqlite
6521 dnl ========================================================
6524 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6525 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6526 MOZ_NATIVE_SQLITE=1,
6527 MOZ_NATIVE_SQLITE= )
6529 if test -n "$MOZ_NATIVE_SQLITE"
6531 dnl ============================
6532 dnl === SQLite Version check ===
6533 dnl ============================
6534 dnl Check to see if the system SQLite package is new enough.
6535 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6537 dnl ==================================
6538 dnl === SQLITE_SECURE_DELETE check ===
6539 dnl ==================================
6540 dnl Check to see if the system SQLite package is compiled with
6541 dnl SQLITE_SECURE_DELETE enabled.
6542 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6543 _SAVE_CFLAGS="$CFLAGS"
6544 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6546 LIBS="$LIBS $SQLITE_LIBS"
6547 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6549 #include "sqlite3.h"
6551 int main(int argc, char **argv){
6552 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6554 ac_cv_sqlite_secure_delete=yes,
6555 ac_cv_sqlite_secure_delete=no,
6556 ac_cv_sqlite_secure_delete=no
6559 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6560 CFLAGS="$_SAVE_CFLAGS"
6562 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6563 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6566 dnl ===============================
6567 dnl === SQLITE_THREADSAFE check ===
6568 dnl ===============================
6569 dnl Check to see if the system SQLite package is compiled with
6570 dnl SQLITE_THREADSAFE enabled.
6571 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6572 _SAVE_CFLAGS="$CFLAGS"
6573 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6575 LIBS="$LIBS $SQLITE_LIBS"
6576 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6578 #include "sqlite3.h"
6580 int main(int argc, char **argv){
6581 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6583 ac_cv_sqlite_threadsafe=yes,
6584 ac_cv_sqlite_threadsafe=no,
6585 ac_cv_sqlite_threadsafe=no
6588 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6589 CFLAGS="$_SAVE_CFLAGS"
6591 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6592 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6595 dnl ================================
6596 dnl === SQLITE_ENABLE_FTS3 check ===
6597 dnl ================================
6598 dnl check to see if the system SQLite package is compiled with
6599 dnl SQLITE_ENABLE_FTS3 enabled.
6600 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6601 _SAVE_CFLAGS="$CFLAGS"
6602 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6604 LIBS="$LIBS $SQLITE_LIBS"
6605 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6607 #include "sqlite3.h"
6609 int main(int argc, char **argv){
6610 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6612 ac_cv_sqlite_enable_fts3=yes,
6613 ac_cv_sqlite_enable_fts3=no,
6614 ac_cv_sqlite_enable_fts3=no
6617 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6618 CFLAGS="$_SAVE_CFLAGS"
6620 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6621 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6624 dnl =========================================
6625 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6626 dnl =========================================
6627 dnl check to see if the system SQLite package is compiled with
6628 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6629 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6630 _SAVE_CFLAGS="$CFLAGS"
6631 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6633 LIBS="$LIBS $SQLITE_LIBS"
6634 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6636 #include "sqlite3.h"
6638 int main(int argc, char **argv){
6639 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6641 ac_cv_sqlite_enable_unlock_notify=yes,
6642 ac_cv_sqlite_enable_unlock_notify=no,
6643 ac_cv_sqlite_enable_unlock_notify=no
6646 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6647 CFLAGS="$_SAVE_CFLAGS"
6649 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6650 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6654 if test -n "$MOZ_NATIVE_SQLITE"; then
6655 AC_DEFINE(MOZ_NATIVE_SQLITE)
6657 AC_SUBST(MOZ_NATIVE_SQLITE)
6659 dnl ========================================================
6660 dnl = Enable help viewer (off by default)
6661 dnl ========================================================
6662 if test -n "$MOZ_HELP_VIEWER"; then
6663 dnl Do this if defined in confvars.sh
6664 AC_DEFINE(MOZ_HELP_VIEWER)
6667 dnl ========================================================
6668 dnl = Enable safe browsing (anti-phishing)
6669 dnl ========================================================
6670 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6671 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6672 MOZ_SAFE_BROWSING=1,
6673 MOZ_SAFE_BROWSING= )
6674 if test -n "$MOZ_SAFE_BROWSING"; then
6675 AC_DEFINE(MOZ_SAFE_BROWSING)
6677 AC_SUBST(MOZ_SAFE_BROWSING)
6679 dnl ========================================================
6680 dnl = Enable url-classifier
6681 dnl ========================================================
6682 dnl Implicitly enabled by default if building with safe-browsing
6683 if test -n "$MOZ_SAFE_BROWSING"; then
6684 MOZ_URL_CLASSIFIER=1
6686 MOZ_ARG_ENABLE_BOOL(url-classifier,
6687 [ --enable-url-classifier Enable url classifier module],
6688 MOZ_URL_CLASSIFIER=1,
6689 MOZ_URL_CLASSIFIER= )
6690 if test -n "$MOZ_URL_CLASSIFIER"; then
6691 AC_DEFINE(MOZ_URL_CLASSIFIER)
6693 AC_SUBST(MOZ_URL_CLASSIFIER)
6695 dnl ========================================================
6696 dnl = Disable zipwriter
6697 dnl ========================================================
6698 MOZ_ARG_DISABLE_BOOL(zipwriter,
6699 [ --disable-zipwriter Disable zipwriter component],
6702 AC_SUBST(MOZ_ZIPWRITER)
6704 dnl ========================================================
6706 dnl ========================================================
6708 MOZ_ARG_WITH_STRING(gl-provider,
6709 [ --with-gl-provider=ID
6710 Set GL provider backend type],
6711 [ val=`echo $withval`
6712 MOZ_GL_PROVIDER="$val"])
6714 if test -n "$MOZ_GL_PROVIDER"; then
6715 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6716 AC_SUBST(MOZ_GL_PROVIDER)
6717 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6719 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6720 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6722 dnl ========================================================
6723 dnl = faststripe theme
6724 dnl ========================================================
6725 MOZ_ARG_ENABLE_BOOL(faststripe,
6726 [ --enable-faststripe Use faststripe theme],
6727 MOZ_THEME_FASTSTRIPE=1,
6728 MOZ_THEME_FASTSTRIPE= )
6729 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6731 dnl ========================================================
6733 dnl = Feature options that require extra sources to be pulled
6735 dnl ========================================================
6736 dnl MOZ_ARG_HEADER(Features that require extra sources)
6738 dnl ========================================================
6740 dnl = Runtime debugging and Optimization Options
6742 dnl ========================================================
6743 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
6745 dnl ========================================================
6746 dnl enable mobile optimizations
6747 dnl ========================================================
6748 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6749 [ --enable-mobile-optimize
6750 Enable mobile optimizations],
6751 MOZ_GFX_OPTIMIZE_MOBILE=1)
6753 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6755 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6756 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6759 dnl ========================================================
6760 dnl = Enable code optimization. ON by default.
6761 dnl ========================================================
6762 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6763 MOZ_OPTIMIZE_FLAGS="-O"
6766 MOZ_ARG_ENABLE_STRING(optimize,
6767 [ --disable-optimize Disable compiler optimization
6768 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6769 [ if test "$enableval" != "no"; then
6771 if test -n "$enableval" -a "$enableval" != "yes"; then
6772 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6777 fi ], MOZ_OPTIMIZE=1)
6779 MOZ_SET_FRAMEPTR_FLAGS
6781 if test "$COMPILE_ENVIRONMENT"; then
6782 if test -n "$MOZ_OPTIMIZE"; then
6783 AC_MSG_CHECKING([for valid optimization flags])
6784 _SAVE_CFLAGS=$CFLAGS
6785 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6786 AC_TRY_COMPILE([#include <stdio.h>],
6787 [printf("Hello World\n");],
6790 AC_MSG_RESULT([$_results])
6791 if test "$_results" = "no"; then
6792 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6794 CFLAGS=$_SAVE_CFLAGS
6796 fi # COMPILE_ENVIRONMENT
6798 AC_SUBST(MOZ_OPTIMIZE)
6799 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6800 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6801 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6802 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6803 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6805 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6807 dnl ========================================================
6808 dnl = Enable NS_StackWalk.
6809 dnl ========================================================
6811 # On Windows, NS_StackWalk will only work correctly if we have frame pointers
6812 # available. That will only be true for non-optimized builds, debug builds or
6813 # builds with --enable-profiling in the .mozconfig (which is turned on in
6814 # Nightly by default.)
6815 case "$OS_TARGET" in
6817 if test -z "$MOZ_OPTIMIZE" -o -n "$MOZ_PROFILING" -o -n "$MOZ_DEBUG"; then
6828 if test -n "$MOZ_STACKWALKING"; then
6829 AC_DEFINE(MOZ_STACKWALKING)
6832 AC_SUBST(MOZ_STACKWALKING)
6834 dnl ========================================================
6835 dnl = Enable any treating of compile warnings as errors
6836 dnl ========================================================
6837 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6838 [ --enable-warnings-as-errors
6839 Enable treating of warnings as errors],
6840 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6841 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6842 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6843 WARNINGS_AS_ERRORS=''
6844 elif test "$GNU_CC"; then
6845 # Prevent the following GCC warnings from being treated as errors:
6846 # -Wuninitialized - too many false positives
6847 # -Wmaybe-uninitialized - too many false positives
6848 # -Wdeprecated-declarations - we don't want our builds held hostage when a
6849 # platform-specific API becomes deprecated.
6850 MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
6851 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
6852 MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
6853 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
6854 MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
6855 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
6857 if test -n "$MOZ_PGO"; then
6858 MOZ_C_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_c_has_noerror_coverage_mismatch)
6859 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_cxx_has_noerror_coverage_mismatch)
6863 dnl ========================================================
6864 dnl = Disable runtime logging checks
6865 dnl ========================================================
6866 MOZ_ARG_DISABLE_BOOL(logging,
6867 [ --disable-logging Disable logging facilities],
6868 NS_DISABLE_LOGGING=1,
6869 NS_DISABLE_LOGGING= )
6870 if test "$NS_DISABLE_LOGGING"; then
6871 AC_DEFINE(NS_DISABLE_LOGGING)
6873 AC_DEFINE(MOZ_LOGGING)
6876 dnl ========================================================
6877 dnl = This will enable logging of addref, release, ctor, dtor.
6878 dnl ========================================================
6879 _ENABLE_LOGREFCNT=42
6880 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6881 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6882 _ENABLE_LOGREFCNT=1,
6883 _ENABLE_LOGREFCNT= )
6884 if test "$_ENABLE_LOGREFCNT" = "1"; then
6885 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6886 elif test -z "$_ENABLE_LOGREFCNT"; then
6887 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6890 dnl ========================================================
6891 dnl moz_dump_painting
6892 dnl ========================================================
6893 MOZ_ARG_ENABLE_BOOL(dump-painting,
6894 [ --enable-dump-painting Enable paint debugging.],
6895 MOZ_DUMP_PAINTING=1,
6896 MOZ_DUMP_PAINTING= )
6897 if test -n "$MOZ_DUMP_PAINTING"; then
6898 AC_DEFINE(MOZ_DUMP_PAINTING)
6899 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6901 if test -n "$MOZ_DEBUG"; then
6902 AC_DEFINE(MOZ_DUMP_PAINTING)
6905 dnl ========================================================
6906 dnl = Enable trace malloc
6907 dnl ========================================================
6908 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6909 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6910 [ --enable-trace-malloc Enable malloc tracing; also disables DMD and jemalloc],
6913 if test "$NS_TRACE_MALLOC"; then
6914 # Please, Mr. Linker Man, don't take away our symbol names
6915 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6916 AC_DEFINE(NS_TRACE_MALLOC)
6918 AC_SUBST(NS_TRACE_MALLOC)
6920 dnl ========================================================
6922 dnl ========================================================
6924 MOZ_ARG_ENABLE_BOOL(dmd,
6925 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
6929 dnl The two options are conflicting. Fails the configure to alert the user.
6930 if test "$NS_TRACE_MALLOC" -a "$MOZ_DMD"; then
6931 AC_MSG_ERROR([--enable-trace-malloc and --enable-dmd are conflicting options])
6934 if test "$MOZ_DMD"; then
6937 if test "${CPU_ARCH}" = "arm"; then
6938 CFLAGS="$CFLAGS -funwind-tables"
6939 CXXFLAGS="$CXXFLAGS -funwind-tables"
6942 MOZ_MEMORY=1 # DMD enables jemalloc
6943 MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
6947 dnl ========================================================
6948 dnl = Enable jemalloc
6949 dnl ========================================================
6950 MOZ_ARG_ENABLE_BOOL(jemalloc,
6951 [ --enable-jemalloc Replace memory allocator with jemalloc],
6955 if test "$NS_TRACE_MALLOC"; then
6959 if test "${OS_TARGET}" = "Android"; then
6960 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6962 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin"; then
6963 dnl On Windows and OSX, we want to link all our binaries against mozglue
6964 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6966 dnl On other Unix systems, we only want to link executables against mozglue
6967 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6968 dnl On other Unix systems, where mozglue is a static library, jemalloc is
6969 dnl separated for the SDK, so we need to add it here.
6970 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6971 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6973 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6974 if test -n "$GNU_CC"; then
6975 dnl And we need mozglue symbols to be exported.
6976 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6978 if test "$MOZ_LINKER" = 1; then
6979 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
6983 dnl ========================================================
6984 dnl = Enable dynamic replacement of malloc implementation
6985 dnl ========================================================
6986 if test -n "$NIGHTLY_BUILD" -a -n "$MOZ_MEMORY"; then
6987 # Enable on central for the debugging opportunities it adds.
6988 MOZ_REPLACE_MALLOC=1
6990 MOZ_ARG_ENABLE_BOOL(replace-malloc,
6991 [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
6992 MOZ_REPLACE_MALLOC=1,
6993 MOZ_REPLACE_MALLOC= )
6995 dnl The two options are conflicting. Fails the configure to alert the user.
6996 if test "$NS_TRACE_MALLOC" -a "$MOZ_REPLACE_MALLOC"; then
6997 AC_MSG_ERROR([--enable-trace-malloc and --enable-replace-malloc are conflicting options])
7000 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
7001 dnl We don't want to enable jemalloc unconditionally because it may be a
7002 dnl deliberate choice not to enable it (bug 702250, for instance)
7003 AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
7004 elif test -n "$MOZ_REPLACE_MALLOC"; then
7005 MOZ_NATIVE_JEMALLOC=
7007 dnl Replace-malloc Mac linkage quirks
7008 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
7009 AC_CACHE_CHECK([how to do weak dynamic linking],
7010 ac_cv_weak_dynamic_linking,
7011 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
7012 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
7013 test -s conftest${DLL_SUFFIX}; then
7014 dnl There are several ways the linker can put link edit rules in a binary:
7015 dnl - classic info only (for OSX < 10.6)
7016 dnl - dyld info only
7018 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
7023 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
7028 dnl With classic info, we need to build with -flat_namespace.
7029 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
7030 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
7031 dnl forgets to set the weak flag in the dyld info.
7032 dnl See http://glandium.org/blog/?p=2764 for more details.
7034 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
7035 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
7036 dnl - "flat namespace" when -flat_namespace alone is needed
7037 dnl - "dummy library" when a dummy library and -flat_namespace are needed
7038 dnl - "compiler support" when nothing is needed
7039 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
7040 if test -n "$_CLASSIC_INFO"; then
7041 ac_cv_weak_dynamic_linking="flat namespace"
7043 ac_cv_weak_dynamic_linking="compiler support"
7046 if test -n "$_DYLD_INFO"; then
7047 ac_cv_weak_dynamic_linking="dummy library"
7049 ac_cv_weak_dynamic_linking="flat namespace"
7053 AC_ERROR([couldn't compile a simple C file])
7056 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
7059 AC_SUBST(MOZ_REPLACE_MALLOC)
7060 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
7062 dnl ========================================================
7063 dnl = Jemalloc build setup
7064 dnl ========================================================
7065 if test -z "$MOZ_MEMORY"; then
7066 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
7067 MOZ_NATIVE_JEMALLOC=1
7068 AC_CHECK_FUNCS(mallctl nallocm,,
7069 [MOZ_NATIVE_JEMALLOC=
7071 if test -n "$MOZ_NATIVE_JEMALLOC"; then
7073 AC_DEFINE(MOZ_MEMORY)
7074 AC_DEFINE(MOZ_JEMALLOC3)
7075 AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7080 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7081 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.])
7086 AC_DEFINE(MOZ_MEMORY)
7087 if test -n "$MOZ_JEMALLOC3"; then
7088 AC_DEFINE(MOZ_JEMALLOC3)
7090 if test "x$MOZ_DEBUG" = "x1"; then
7091 AC_DEFINE(MOZ_MEMORY_DEBUG)
7093 dnl The generic feature tests that determine how to compute ncpus are long and
7094 dnl complicated. Therefore, simply define special cpp variables for the
7095 dnl platforms we have special knowledge of.
7098 AC_DEFINE(MOZ_MEMORY_DARWIN)
7101 AC_DEFINE(MOZ_MEMORY_BSD)
7103 *-android*|*-linuxandroid*)
7104 AC_DEFINE(MOZ_MEMORY_LINUX)
7105 AC_DEFINE(MOZ_MEMORY_ANDROID)
7106 if test -z "$gonkdir"; then
7109 AC_DEFINE(MOZ_MEMORY_GONK)
7114 AC_DEFINE(MOZ_MEMORY_LINUX)
7117 AC_DEFINE(MOZ_MEMORY_BSD)
7120 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7123 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7124 export MOZ_NO_DEBUG_RTL=1
7125 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7126 dnl Look for a broken crtdll.obj
7127 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7128 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7129 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7130 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcprt -DEFAULTLIB:mozcrt'
7131 dnl Also pass this to NSPR/NSS
7132 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7134 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7141 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7145 AC_SUBST(MOZ_MEMORY)
7146 AC_SUBST(MOZ_JEMALLOC3)
7147 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7148 AC_SUBST(MOZ_GLUE_LDFLAGS)
7149 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7150 AC_SUBST_LIST(WIN32_CRT_LIBS)
7151 dnl Need to set this for make because NSS doesn't have configure
7154 dnl We need to wrap dlopen and related functions on Android because we use
7156 if test "$OS_TARGET" = Android; then
7157 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7158 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7159 if test "$MOZ_WIDGET_TOOLKIT" = android; then
7160 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7162 if test -z "$gonkdir"; then
7163 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7164 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"
7166 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
7167 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"
7171 dnl ========================================================
7172 dnl = Use malloc wrapper lib
7173 dnl ========================================================
7174 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7175 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7179 if test -n "$_WRAP_MALLOC"; then
7180 if test -n "$GNU_CC"; then
7181 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7182 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7183 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7184 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=vasprintf,--wrap=asprintf"
7185 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7186 dnl Wrap operator new and operator delete on Android.
7187 if test "$OS_TARGET" = "Android"; then
7188 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7189 dnl Wrap the nothrow variants too.
7190 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7193 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7197 dnl ========================================================
7198 dnl = Location of malloc wrapper lib
7199 dnl ========================================================
7200 MOZ_ARG_WITH_STRING(wrap-malloc,
7201 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7202 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7204 dnl ========================================================
7205 dnl = Use JS Call tracing
7206 dnl ========================================================
7207 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7208 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7209 MOZ_TRACE_JSCALLS=1,
7210 MOZ_TRACE_JSCALLS= )
7211 if test -n "$MOZ_TRACE_JSCALLS"; then
7212 AC_DEFINE(MOZ_TRACE_JSCALLS)
7215 dnl ========================================================
7216 dnl JS opt-mode assertions and minidump instrumentation
7217 dnl ========================================================
7218 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7219 [ --enable-js-diagnostics
7220 Enable JS diagnostic assertions and breakpad data],
7221 JS_CRASH_DIAGNOSTICS=1,
7222 JS_CRASH_DIAGNOSTICS= )
7223 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7224 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7227 dnl ========================================================
7228 dnl = Use incremental GC
7229 dnl ========================================================
7231 MOZ_ARG_DISABLE_BOOL(gcincremental,
7232 [ --disable-gcincremental Disable incremental GC],
7234 if test -n "$JSGC_INCREMENTAL"; then
7235 AC_DEFINE(JSGC_INCREMENTAL)
7238 dnl ========================================================
7239 dnl = Use generational GC
7240 dnl ========================================================
7241 MOZ_ARG_DISABLE_BOOL(gcgenerational,
7242 [ --disable-gcgenerational Disable generational GC],
7243 JSGC_GENERATIONAL= ,
7244 JSGC_GENERATIONAL=1 )
7245 if test -n "$JSGC_GENERATIONAL"; then
7246 AC_DEFINE(JSGC_GENERATIONAL)
7249 dnl ========================================================
7250 dnl = Use compacting GC
7251 dnl ========================================================
7252 MOZ_ARG_ENABLE_BOOL(gccompacting,
7253 [ --enable-gccompacting Compact the JS heap by moving GC things],
7256 if test -n "$JS_GCCOMPACTING"; then
7257 AC_DEFINE(JS_GCCOMPACTING)
7260 dnl ========================================================
7261 dnl = Use a smaller chunk size for GC chunks
7262 dnl ========================================================
7263 MOZ_ARG_ENABLE_BOOL(small-chunk-size,
7264 [ --enable-small-chunk-size Allocate memory for JS GC things in smaller chunks],
7265 JS_GC_SMALL_CHUNK_SIZE=1,
7266 JS_GC_SMALL_CHUNK_SIZE= )
7267 if test -n "$JS_GC_SMALL_CHUNK_SIZE"; then
7268 AC_DEFINE(JS_GC_SMALL_CHUNK_SIZE)
7271 dnl ========================================================
7272 dnl Zealous JavaScript GC
7273 dnl ========================================================
7274 MOZ_ARG_ENABLE_BOOL(gczeal,
7275 [ --enable-gczeal Enable zealous JavaScript GCing],
7278 if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then
7279 AC_DEFINE(JS_GC_ZEAL)
7284 dnl ========================================================
7285 dnl = Enable static checking using gcc-dehydra
7286 dnl ========================================================
7288 MOZ_ARG_WITH_STRING(static-checking,
7289 [ --with-static-checking=path/to/gcc_dehydra.so
7290 Enable static checking of code using GCC-dehydra],
7291 DEHYDRA_PATH=$withval,
7294 if test -n "$DEHYDRA_PATH"; then
7295 if test ! -f "$DEHYDRA_PATH"; then
7296 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7298 AC_DEFINE(NS_STATIC_CHECKING)
7300 AC_SUBST(DEHYDRA_PATH)
7302 dnl ========================================================
7303 dnl = Enable using the clang plugin to build
7304 dnl ========================================================
7306 MOZ_CONFIG_CLANG_PLUGIN
7308 dnl ========================================================
7309 dnl = Enable stripping of libs & executables
7310 dnl ========================================================
7311 MOZ_ARG_ENABLE_BOOL(strip,
7312 [ --enable-strip Enable stripping of libs & executables ],
7316 dnl ========================================================
7317 dnl = Enable stripping of libs & executables when packaging
7318 dnl ========================================================
7319 MOZ_ARG_ENABLE_BOOL(install-strip,
7320 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7324 dnl ========================================================
7325 dnl = --disable-elf-hack
7326 dnl ========================================================
7329 MOZ_ARG_DISABLE_BOOL(elf-hack,
7330 [ --disable-elf-hack Disable elf hacks],
7332 [USE_ELF_HACK=F # Force enable elf-hack])
7334 # Disable elf hack for profiling because the built in profiler
7335 # doesn't read the segments properly with elf hack. This is
7336 # temporary and should be fixed soon in the profiler.
7337 if test "$MOZ_PROFILING" = 1; then
7338 if test "$USE_ELF_HACK" = F; then
7339 AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
7344 # Only enable elfhack where supported
7345 if test "$USE_ELF_HACK" = 1; then
7346 case "${HOST_OS_ARCH},${OS_ARCH}" in
7348 case "${CPU_ARCH}" in
7363 if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
7364 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7365 dnl memory addresses it maps to. The result is that by the time elfhack
7366 dnl kicks in, it is not possible to apply relocations because of that,
7367 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7368 dnl segment. It makes elfhack mostly useless, so considering the problems
7369 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7370 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7371 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
7372 dnl elfhack enabled, disable PT_GNU_RELRO instead.
7373 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7374 LINK_WITH_PT_GNU_RELRO,
7375 [echo "int main() {return 0;}" > conftest.${ac_ext}
7376 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7377 test -s conftest${ac_exeext}; then
7378 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7379 LINK_WITH_PT_GNU_RELRO=yes
7381 LINK_WITH_PT_GNU_RELRO=no
7384 dnl We really don't expect to get here, but just in case
7385 AC_ERROR([couldn't compile a simple C file])
7388 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7389 if test "$USE_ELF_HACK" = F; then
7390 AC_MSG_CHECKING([for -z norelro option to ld])
7391 _SAVE_LDFLAGS=$LDFLAGS
7392 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
7393 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
7394 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
7395 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.]))
7398 AC_MSG_WARN([Disabling elfhack])
7404 dnl ========================================================
7405 dnl = libstdc++ compatibility hacks
7406 dnl ========================================================
7409 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7410 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7413 if test -n "$STDCXX_COMPAT"; then
7414 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
7415 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7416 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7419 dnl ========================================================
7421 dnl = Profiling and Instrumenting
7423 dnl ========================================================
7424 MOZ_ARG_HEADER(Profiling and Instrumenting)
7426 dnl ========================================================
7427 dnl = Enable runtime visual profiling logger
7428 dnl ========================================================
7429 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7430 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7431 MOZ_VISUAL_EVENT_TRACER=1,
7432 MOZ_VISUAL_EVENT_TRACER=)
7433 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7434 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7437 dnl ========================================================
7438 dnl = Enable TaskTracer
7439 dnl ========================================================
7440 MOZ_ARG_ENABLE_BOOL(tasktracer,
7441 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
7444 if test "$MOZ_WIDGET_TOOLKIT" = "gonk" -a -n "$MOZ_TASK_TRACER"; then
7445 AC_DEFINE(MOZ_TASK_TRACER)
7446 AC_SUBST(MOZ_TASK_TRACER)
7449 dnl ========================================================
7450 dnl Turn on reflow counting
7451 dnl ========================================================
7452 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7453 [ --enable-reflow-perf Enable reflow performance tracing],
7456 if test -n "$MOZ_REFLOW_PERF"; then
7457 AC_DEFINE(MOZ_REFLOW_PERF)
7460 dnl ========================================================
7461 dnl = Offer a way to disable the startup cache
7462 dnl ========================================================
7463 MOZ_DISABLE_STARTUPCACHE=
7465 MOZ_ARG_DISABLE_BOOL(startupcache,
7466 [ --disable-startupcache Disable startup cache ],
7467 MOZ_DISABLE_STARTUPCACHE=1,
7468 MOZ_DISABLE_STARTUPCACHE=)
7470 dnl bug 988880: disable startup cache on b2g
7471 if test -n "$MOZ_B2G"; then
7472 MOZ_DISABLE_STARTUPCACHE=1
7475 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
7477 dnl ========================================================
7478 dnl = Enable Radio Interface for B2G (Gonk usually)
7479 dnl ========================================================
7480 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7481 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7484 MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL )
7485 if test -n "$MOZ_B2G_RIL"; then
7486 if test -n "$_PLATFORM_HAVE_RIL"; then
7487 AC_DEFINE(MOZ_B2G_RIL)
7489 AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.])
7492 AC_SUBST(MOZ_B2G_RIL)
7494 dnl ========================================================
7495 dnl = Enable Radio FM for B2G (Gonk usually)
7496 dnl ========================================================
7497 if test -n "$MOZ_B2G_FM"; then
7498 AC_DEFINE(MOZ_B2G_FM)
7500 AC_SUBST(MOZ_B2G_FM)
7502 dnl ========================================================
7503 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7504 dnl ========================================================
7505 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7506 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7509 if test -n "$MOZ_B2G_BT"; then
7510 AC_DEFINE(MOZ_B2G_BT)
7512 AC_SUBST(MOZ_B2G_BT)
7513 AC_SUBST(MOZ_B2G_BT_BLUEZ)
7514 AC_SUBST(MOZ_B2G_BT_BLUEDROID)
7516 dnl ========================================================
7517 dnl = Enable NFC Interface for B2G (Gonk usually)
7518 dnl ========================================================
7519 MOZ_ARG_ENABLE_BOOL(nfc,
7520 [ --enable-nfc Set compile flags necessary for compiling NFC API ],
7523 if test -n "$MOZ_NFC"; then
7528 dnl ========================================================
7529 dnl = Enable Pico Speech Synthesis (Gonk usually)
7530 dnl ========================================================
7531 MOZ_ARG_ENABLE_BOOL(synth-pico,
7532 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
7535 if test -n "$MOZ_SYNTH_PICO"; then
7536 AC_DEFINE(MOZ_SYNTH_PICO)
7538 AC_SUBST(MOZ_SYNTH_PICO)
7540 dnl ========================================================
7541 dnl = Enable Support for Time Manager API
7542 dnl ========================================================
7543 if test -n "$MOZ_TIME_MANAGER"; then
7544 AC_DEFINE(MOZ_TIME_MANAGER)
7546 AC_SUBST(MOZ_TIME_MANAGER)
7548 dnl ========================================================
7549 dnl = Enable Camera Interface for B2G (Gonk usually)
7550 dnl ========================================================
7551 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7552 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7555 if test -n "$MOZ_B2G_CAMERA"; then
7556 AC_DEFINE(MOZ_B2G_CAMERA)
7558 AC_SUBST(MOZ_B2G_CAMERA)
7560 dnl ========================================================
7561 dnl = Enable Support for Payment API
7562 dnl ========================================================
7563 if test -n "$MOZ_PAY"; then
7568 dnl ========================================================
7569 dnl = Enable Browser Support for Activities
7570 dnl ========================================================
7571 if test -n "$MOZ_ACTIVITIES"; then
7572 AC_DEFINE(MOZ_ACTIVITIES)
7574 AC_SUBST(MOZ_ACTIVITIES)
7576 dnl ========================================================
7577 dnl = Enable Support for AudioChannelManager API
7578 dnl ========================================================
7579 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7580 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7582 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7584 dnl ========================================================
7585 dnl = Support for demangling undefined symbols
7586 dnl ========================================================
7587 if test -z "$SKIP_LIBRARY_CHECKS"; then
7590 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7594 # Demangle only for debug or trace-malloc or DMD builds
7595 MOZ_DEMANGLE_SYMBOLS=
7596 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7597 MOZ_DEMANGLE_SYMBOLS=1
7598 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7600 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7602 dnl ========================================================
7603 dnl = Support for gcc stack unwinding (from gcc 3.3)
7604 dnl ========================================================
7605 if test -z "$SKIP_LIBRARY_CHECKS"; then
7608 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7612 dnl ========================================================
7614 dnl ========================================================
7616 MOZ_ARG_WITH_STRING(jitreport-granularity,
7617 [ --jitreport-granularity=N
7618 Default granularity at which to report JIT code
7621 1 - code ranges for whole functions only
7622 2 - per-line information
7623 3 - per-op information],
7624 JITREPORT_GRANULARITY=$withval,
7625 JITREPORT_GRANULARITY=3)
7627 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7629 dnl ========================================================
7633 dnl ========================================================
7634 MOZ_ARG_HEADER(Misc. Options)
7636 dnl ========================================================
7637 dnl update xterm title
7638 dnl ========================================================
7639 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7640 [ --enable-xterm-updates Update XTERM titles with current command.],
7644 dnl =========================================================
7646 dnl =========================================================
7647 MOZ_ARG_ENABLE_STRING([chrome-format],
7648 [ --enable-chrome-format=jar|flat|omni
7649 Select FORMAT of chrome files during packaging],
7650 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7652 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7653 MOZ_CHROME_FILE_FORMAT=jar
7656 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7657 AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7660 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7661 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7662 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7663 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7666 dnl =========================================================
7667 dnl Omnijar packaging (bug 552121)
7668 dnl =========================================================
7669 dnl Omnijar packaging is compatible with flat packaging.
7670 dnl In unpackaged builds, omnijar looks for files as if
7671 dnl things were flat packaged. After packaging, all files
7672 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7673 dnl is set to flat since putting files into jars is only
7674 dnl done during packaging with omnijar.
7675 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7677 AC_DEFINE(MOZ_OMNIJAR)
7679 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7680 if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7681 MOZ_CHROME_FILE_FORMAT=flat
7683 MOZ_CHROME_FILE_FORMAT=symlink
7686 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7687 dnl Fennec's static resources live in the assets/ folder of the
7688 dnl APK. Adding a path to the name here works because we only
7689 dnl have one omnijar file in the final package (which is not the
7690 dnl case on desktop), and necessitates some contortions during
7691 dnl packaging so that the resources in the omnijar are considered
7692 dnl as rooted at / and not as rooted at assets/ (which again is
7693 dnl not the case on desktop: there are omnijars rooted at webrtc/,
7694 dnl etc). packager.mk handles changing the rooting of the single
7696 OMNIJAR_NAME=assets/omni.ja
7698 OMNIJAR_NAME=omni.ja
7701 AC_SUBST(OMNIJAR_NAME)
7702 AC_SUBST(MOZ_OMNIJAR)
7703 AC_SUBST(MOZ_PACKAGER_FORMAT)
7705 dnl ========================================================
7706 dnl = Define default location for MOZILLA_FIVE_HOME
7707 dnl ========================================================
7708 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7709 [ --with-default-mozilla-five-home
7710 Set the default value for MOZILLA_FIVE_HOME],
7711 [ val=`echo $withval`
7712 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7714 dnl ========================================================
7715 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7716 dnl ========================================================
7717 MOZ_ARG_WITH_STRING(user-appdir,
7718 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7719 [ val=`echo $withval`
7720 if echo "$val" | grep "\/" >/dev/null; then
7721 AC_MSG_ERROR("Homedir must be single relative path.")
7726 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7728 dnl ========================================================
7729 dnl = Doxygen configuration
7730 dnl ========================================================
7731 dnl Use commas to specify multiple dirs to this arg
7732 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7733 MOZ_ARG_WITH_STRING(doc-input-dirs,
7734 [ --with-doc-input-dirs=DIRS
7735 Header/idl dirs to create docs from],
7736 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7737 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7739 dnl Use commas to specify multiple dirs to this arg
7740 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7741 MOZ_ARG_WITH_STRING(doc-include-dirs,
7742 [ --with-doc-include-dirs=DIRS
7743 Include dirs to preprocess doc headers],
7744 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7745 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7747 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7748 MOZ_ARG_WITH_STRING(doc-output-dir,
7749 [ --with-doc-output-dir=DIR
7750 Dir to generate docs into],
7751 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7752 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7754 if test -z "$SKIP_COMPILER_CHECKS"; then
7755 dnl ========================================================
7757 dnl = Compiler Options
7759 dnl ========================================================
7760 MOZ_ARG_HEADER(Compiler Options)
7762 dnl ========================================================
7763 dnl Check for gcc -pipe support
7764 dnl ========================================================
7765 AC_MSG_CHECKING([for -pipe support])
7766 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7767 dnl Any gcc that supports firefox supports -pipe.
7768 CFLAGS="$CFLAGS -pipe"
7769 CXXFLAGS="$CXXFLAGS -pipe"
7770 AC_MSG_RESULT([yes])
7775 dnl ========================================================
7776 dnl Profile guided optimization (gcc checks)
7777 dnl ========================================================
7778 dnl Test for profiling options
7779 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7781 _SAVE_CFLAGS="$CFLAGS"
7782 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7784 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7785 AC_TRY_COMPILE([], [return 0;],
7786 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7787 result="yes" ], result="no")
7788 AC_MSG_RESULT([$result])
7790 if test $result = "yes"; then
7791 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7792 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7793 PROFILE_USE_LDFLAGS="-fprofile-use"
7796 CFLAGS="$_SAVE_CFLAGS"
7798 if test -n "$INTEL_CC"; then
7799 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7800 PROFILE_GEN_LDFLAGS=
7801 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7802 PROFILE_USE_LDFLAGS=
7805 dnl Sun Studio on Solaris
7806 if test "$SOLARIS_SUNPRO_CC"; then
7807 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7808 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7809 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7810 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7813 AC_SUBST(PROFILE_GEN_CFLAGS)
7814 AC_SUBST(PROFILE_GEN_LDFLAGS)
7815 AC_SUBST(PROFILE_USE_CFLAGS)
7816 AC_SUBST(PROFILE_USE_LDFLAGS)
7818 dnl =============================================
7819 dnl Support for -fno-integrated-as (recent clang)
7820 dnl =============================================
7821 dnl Under clang 3.4+, use -fno-integrated-as to
7822 dnl build libvpx's vp8_asm_enc_offsets.c
7824 _SAVE_CFLAGS="$CFLAGS"
7825 CFLAGS="$CFLAGS -fno-integrated-as -S"
7827 AC_MSG_CHECKING([whether C compiler supports -fno-integrated-as])
7828 AC_TRY_COMPILE([], [return 0;],
7829 [ NO_INTEGRATED_AS_CFLAGS="-fno-integrated-as"
7830 result="yes" ], result="no")
7831 AC_MSG_RESULT([$result])
7833 CFLAGS="$_SAVE_CFLAGS"
7835 AC_SUBST(NO_INTEGRATED_AS_CFLAGS)
7837 fi # ! SKIP_COMPILER_CHECKS
7839 AC_DEFINE(CPP_THROW_NEW, [throw()])
7842 if test "$COMPILE_ENVIRONMENT"; then
7844 fi # COMPILE_ENVIRONMENT
7846 dnl ========================================================
7848 dnl = Build depencency options
7850 dnl ========================================================
7851 MOZ_ARG_HEADER(Build dependencies)
7853 if test "$GNU_CC" -a "$GNU_CXX"; then
7854 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7855 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7856 elif test "$SOLARIS_SUNPRO_CC"; then
7859 dnl Don't override this for MSVC
7860 if test -z "$_WIN32_MSVC"; then
7861 _USE_CPP_INCLUDE_FLAG=
7862 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7863 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7865 echo '#include <stdio.h>' > dummy-hello.c
7867 dnl This output is localized, split at the first double space or colon and space.
7868 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
7869 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
7870 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
7872 if ! test -e "$_CL_STDIO_PATH"; then
7873 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
7875 if test -z "$CL_INCLUDES_PREFIX"; then
7876 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7878 AC_SUBST(CL_INCLUDES_PREFIX)
7881 dnl Make sure that the build system can handle non-ASCII characters
7882 dnl in environment variables to prevent it from breaking silently on
7883 dnl non-English systems.
7884 NONASCII=$'\241\241'
7889 dnl ========================================================
7891 dnl = Static Build Options
7893 dnl ========================================================
7894 MOZ_ARG_HEADER(Static build options)
7896 if test "$OS_ARCH" = "WINNT"; then
7897 GKMEDIAS_SHARED_LIBRARY=1
7898 AC_DEFINE(GKMEDIAS_SHARED_LIBRARY)
7900 AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
7902 if test -z "$MOZ_NATIVE_ZLIB"; then
7903 if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
7905 AC_DEFINE(ZLIB_IN_MOZGLUE)
7909 AC_SUBST(ZLIB_IN_MOZGLUE)
7911 dnl ========================================================
7913 dnl = Standalone module options
7915 dnl ========================================================
7916 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7919 dnl ========================================================
7921 if test -z "$SKIP_PATH_CHECKS"; then
7922 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7923 if test "$MOZ_ENABLE_GTK" ; then
7924 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7929 if test -z "${GLIB_GMODULE_LIBS}" \
7930 -a -n "${GLIB_CONFIG}"\
7931 -a "${GLIB_CONFIG}" != no\
7933 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7936 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
7938 dnl ========================================================
7939 dnl Graphics checks.
7940 dnl ========================================================
7942 if test "${OS_TARGET}" = "WINNT"; then
7943 if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then
7944 MOZ_ENABLE_DIRECT2D1_1=1
7945 AC_SUBST(MOZ_ENABLE_DIRECT2D1_1)
7949 if test "${OS_TARGET}" = "WINNT" -o \
7950 "${OS_ARCH}" = "Darwin" -o \
7951 "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
7952 "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
7953 "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
7954 "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
7955 case "${target_cpu}" in
7967 MOZ_ARG_ENABLE_BOOL(skia,
7968 [ --enable-skia Enable use of Skia],
7972 if test "$USE_FC_FREETYPE"; then
7973 if test "$COMPILE_ENVIRONMENT"; then
7974 dnl ========================================================
7975 dnl = Check for freetype2 and its functionality
7976 dnl ========================================================
7977 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7979 if test "$_HAVE_FREETYPE2"; then
7981 _SAVE_CFLAGS="$CFLAGS"
7982 LIBS="$LIBS $FT2_LIBS"
7983 CFLAGS="$CFLAGS $FT2_CFLAGS"
7985 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7986 ac_cv_member_FT_Bitmap_Size_y_ppem,
7987 [AC_TRY_COMPILE([#include <ft2build.h>
7988 #include FT_FREETYPE_H],
7990 if (sizeof s.y_ppem) return 0;
7992 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7993 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7994 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7995 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7997 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7999 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
8000 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
8001 [FT_Bitmap_Size structure includes y_ppem field])
8003 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
8006 CFLAGS="$_SAVE_CFLAGS"
8009 _SAVE_CPPFLAGS="$CPPFLAGS"
8010 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8011 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8012 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8013 CPPFLAGS="$_SAVE_CPPFLAGS"
8015 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8018 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
8020 if test "$MOZ_PANGO"; then
8021 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
8022 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
8024 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
8025 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
8030 dnl ========================================================
8031 dnl Check for pixman and cairo
8032 dnl ========================================================
8034 if test "$MOZ_WIDGET_TOOLKIT" = "gtk3" ; then
8035 # cairo-gtk3 can be build with system-cairo only
8041 MOZ_ARG_ENABLE_BOOL(system-cairo,
8042 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8047 MOZ_ARG_ENABLE_BOOL(system-pixman,
8048 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8050 MOZ_TREE_PIXMAN=force,
8053 # System cairo depends on system pixman
8054 if test "$MOZ_TREE_PIXMAN" = "force"; then
8055 if test -z "$MOZ_TREE_CAIRO"; then
8056 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
8060 elif test -z "$MOZ_TREE_CAIRO"; then
8064 if test "$MOZ_TREE_PIXMAN"; then
8065 AC_DEFINE(MOZ_TREE_PIXMAN)
8067 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8068 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8069 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8071 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8072 AC_SUBST_LIST(MOZ_PIXMAN_LIBS)
8074 # Check for headers defining standard int types.
8075 if test -n "$COMPILE_ENVIRONMENT"; then
8076 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8078 if test "${ac_cv_header_inttypes_h}" = "yes"; then
8083 AC_SUBST(HAVE_INTTYPES_H)
8085 if test "$MOZ_TREE_CAIRO"; then
8086 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8087 AC_DEFINE(MOZ_TREE_CAIRO)
8089 if test "$OS_ARCH" = "WINNT"; then
8090 # For now we assume that we will have a uint64_t available through
8091 # one of the above headers or mozstdint.h.
8092 AC_DEFINE(HAVE_UINT64_T)
8095 # Define macros for cairo-features.h
8096 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8097 if test "$MOZ_X11"; then
8098 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8099 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8100 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8102 if test "$_HAVE_FREETYPE2"; then
8103 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8104 MOZ_ENABLE_CAIRO_FT=1
8105 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8108 case "$MOZ_WIDGET_TOOLKIT" in
8110 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8113 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8114 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8115 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8118 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8119 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8120 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8121 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8122 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8123 MOZ_ENABLE_D2D_SURFACE=1
8124 MOZ_ENABLE_DWRITE_FONT=1
8126 WIN32_DWRITE_FONT_FEATURE=
8127 WIN32_D2D_SURFACE_FEATURE=
8130 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8132 dnl D3D10 Layers depend on D2D Surfaces.
8133 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8134 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8138 AC_MSG_ERROR([cairo-gtk3 toolkit is incompatible with in-tree cairo. Please add --enable-system-cairo to your build config.])
8141 if test "$USE_FC_FREETYPE"; then
8142 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8144 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8145 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8146 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8147 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8148 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8150 AC_SUBST(PS_SURFACE_FEATURE)
8151 AC_SUBST(PDF_SURFACE_FEATURE)
8152 AC_SUBST(SVG_SURFACE_FEATURE)
8153 AC_SUBST(XLIB_SURFACE_FEATURE)
8154 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8155 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8156 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8157 AC_SUBST(WIN32_SURFACE_FEATURE)
8158 AC_SUBST(OS2_SURFACE_FEATURE)
8159 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8160 AC_SUBST(FT_FONT_FEATURE)
8161 AC_SUBST(FC_FONT_FEATURE)
8162 AC_SUBST(WIN32_FONT_FEATURE)
8163 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8164 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8165 AC_SUBST(QUARTZ_FONT_FEATURE)
8166 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8167 AC_SUBST(QT_SURFACE_FEATURE)
8168 AC_SUBST(TEE_SURFACE_FEATURE)
8170 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8172 if test "$MOZ_X11"; then
8173 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8176 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8178 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8179 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8180 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8181 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8182 if test "$MOZ_X11"; then
8183 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8184 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8185 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8186 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8190 AC_SUBST(MOZ_TREE_CAIRO)
8191 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
8192 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
8193 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
8194 AC_SUBST(MOZ_TREE_PIXMAN)
8196 dnl ========================================================
8198 dnl ========================================================
8199 if test "$MOZ_ENABLE_SKIA"; then
8200 AC_DEFINE(MOZ_ENABLE_SKIA)
8202 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8203 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8206 if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" ; then
8207 MOZ_ENABLE_SKIA_GPU=1
8208 AC_DEFINE(USE_SKIA_GPU)
8209 AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8212 AC_SUBST(MOZ_ENABLE_SKIA)
8214 dnl ========================================================
8216 dnl ========================================================
8217 MOZ_ARG_DISABLE_BOOL(xul,
8218 [ --disable-xul Disable XUL],
8220 if test "$MOZ_XUL"; then
8223 dnl remove extensions that require XUL
8224 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
8229 dnl ========================================================
8230 dnl disable profile locking
8231 dnl do no use this in applications that can have more than
8232 dnl one process accessing the profile directory.
8233 dnl ========================================================
8234 MOZ_ARG_DISABLE_BOOL(profilelocking,
8235 [ --disable-profilelocking
8236 Disable profile locking],
8237 MOZ_PROFILELOCKING=,
8238 MOZ_PROFILELOCKING=1 )
8239 if test "$MOZ_PROFILELOCKING"; then
8240 AC_DEFINE(MOZ_PROFILELOCKING)
8243 dnl ========================================================
8244 dnl necko configuration options
8245 dnl ========================================================
8248 dnl option to disable various necko protocols
8250 MOZ_ARG_ENABLE_STRING(necko-protocols,
8251 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8252 Enable/disable specific protocol handlers],
8253 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8254 if test "$option" = "yes" -o "$option" = "all"; then
8255 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8256 elif test "$option" = "no" -o "$option" = "none"; then
8258 elif test "$option" = "default"; then
8259 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8260 elif test `echo "$option" | grep -c \^-` != 0; then
8261 option=`echo $option | sed 's/^-//'`
8262 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8264 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8267 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8269 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8270 AC_SUBST_SET(NECKO_PROTOCOLS)
8271 for p in $NECKO_PROTOCOLS; do
8272 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8273 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8277 dnl option to disable necko's wifi scanner
8280 case "$OS_TARGET" in
8282 if test -n "$gonkdir"; then
8286 Darwin|FreeBSD|SunOS|WINNT)
8295 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8296 [ --disable-necko-wifi Disable necko wifi scanner],
8300 if test "$NECKO_WIFI"; then
8301 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
8302 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
8304 AC_DEFINE(NECKO_WIFI)
8305 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8307 AC_SUBST(NECKO_WIFI)
8308 AC_SUBST(NECKO_WIFI_DBUS)
8311 dnl option to disable cookies
8313 MOZ_ARG_DISABLE_BOOL(cookies,
8314 [ --disable-cookies Disable cookie support],
8317 AC_SUBST(NECKO_COOKIES)
8318 if test "$NECKO_COOKIES"; then
8319 AC_DEFINE(NECKO_COOKIES)
8320 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8324 dnl Always build Marionette if not Android or B2G
8326 if test "$OS_TARGET" != Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
8327 AC_DEFINE(ENABLE_MARIONETTE)
8329 AC_SUBST(ENABLE_MARIONETTE)
8330 if test "$ENABLE_MARIONETTE"; then
8331 AC_DEFINE(ENABLE_MARIONETTE)
8335 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8337 MOZ_ARG_DISABLE_BOOL(ctypes,
8338 [ --disable-ctypes Disable js-ctypes],
8341 AC_SUBST(BUILD_CTYPES)
8342 if test "$BUILD_CTYPES"; then
8343 AC_DEFINE(BUILD_CTYPES)
8346 dnl Build Places if required
8347 if test "$MOZ_PLACES"; then
8348 AC_DEFINE(MOZ_PLACES)
8351 dnl Build SocialAPI if required
8352 if test "$MOZ_SOCIAL"; then
8353 AC_DEFINE(MOZ_SOCIAL)
8356 dnl Build Common JS modules provided by services.
8357 AC_SUBST(MOZ_SERVICES_COMMON)
8358 if test -n "$MOZ_SERVICES_COMMON"; then
8359 AC_DEFINE(MOZ_SERVICES_COMMON)
8362 dnl Build Services crypto component (used by Sync)
8363 AC_SUBST(MOZ_SERVICES_CRYPTO)
8364 if test -n "$MOZ_SERVICES_CRYPTO"; then
8365 AC_DEFINE(MOZ_SERVICES_CRYPTO)
8368 dnl Build Firefox Health Reporter Service
8369 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8370 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8371 AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8374 dnl Build Services metrics component
8375 AC_SUBST(MOZ_SERVICES_METRICS)
8376 if test -n "$MOZ_SERVICES_METRICS"; then
8377 AC_DEFINE(MOZ_SERVICES_METRICS)
8380 dnl Build Notifications if required
8381 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8382 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8383 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8386 dnl Build Sync Services if required
8387 AC_SUBST(MOZ_SERVICES_SYNC)
8388 if test -n "$MOZ_SERVICES_SYNC"; then
8389 AC_DEFINE(MOZ_SERVICES_SYNC)
8392 dnl Build Services/CloudSync if required
8393 AC_SUBST(MOZ_SERVICES_CLOUDSYNC)
8394 if test -n "$MOZ_SERVICES_CLOUDSYNC"; then
8395 AC_DEFINE(MOZ_SERVICES_CLOUDSYNC)
8398 dnl Build Captive Portal Detector if required
8399 AC_SUBST(MOZ_CAPTIVEDETECT)
8400 if test -n "$MOZ_CAPTIVEDETECT"; then
8401 AC_DEFINE(MOZ_CAPTIVEDETECT)
8404 dnl Build second screen and casting features for external devices if required
8405 AC_SUBST(MOZ_DEVICES)
8406 if test -n "$MOZ_DEVICES"; then
8407 AC_DEFINE(MOZ_DEVICES)
8410 dnl ========================================================
8411 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8412 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8415 dnl ========================================================
8417 dnl = Maintainer debug option (no --enable equivalent)
8419 dnl ========================================================
8424 AC_SUBST(AR_EXTRACT)
8428 AC_SUBST(AS_DASH_C_FLAG)
8437 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8438 AC_SUBST(MOZ_UPDATE_XTERM)
8439 AC_SUBST(MOZ_AUTH_EXTENSION)
8440 AC_SUBST(MOZ_PERMISSIONS)
8441 AC_SUBST(MOZ_PREF_EXTENSIONS)
8443 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8444 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8445 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8446 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8447 AC_SUBST(WARNINGS_AS_ERRORS)
8448 AC_SUBST(MOZ_EXTENSIONS)
8449 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8452 AC_SUBST(MOZ_INSTRUMENTS)
8453 AC_SUBST(MOZ_CALLGRIND)
8455 AC_SUBST(MOZ_PROFILING)
8457 AC_SUBST(MOZ_PLACES)
8458 AC_SUBST(MOZ_SOCIAL)
8459 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8461 AC_SUBST(NS_PRINTING)
8462 AC_SUBST(MOZ_HELP_VIEWER)
8463 AC_SUBST(TOOLCHAIN_PREFIX)
8472 AC_SUBST(MOZ_PROFILELOCKING)
8474 AC_SUBST(ENABLE_TESTS)
8475 AC_SUBST(MOZ_UNIVERSALCHARDET)
8476 AC_SUBST(ACCESSIBILITY)
8477 AC_SUBST(MOZ_SPELLCHECK)
8478 AC_SUBST(MOZ_ANDROID_APZ)
8479 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8480 AC_SUBST(MOZ_CRASHREPORTER)
8481 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8482 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8483 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8484 AC_SUBST(MOZ_STUB_INSTALLER)
8485 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8486 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8487 AC_SUBST(MOZ_UPDATER)
8489 AC_SUBST(MOZ_ANGLE_RENDERER)
8490 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
8491 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
8492 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
8493 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
8494 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8495 AC_SUBST(MOZ_D3DCOMPILER_XP_DLL)
8496 AC_SUBST(MOZ_D3DCOMPILER_XP_CAB)
8500 AC_SUBST(MOZ_ANDROID_HISTORY)
8501 AC_SUBST(MOZ_WEBSMS_BACKEND)
8502 AC_SUBST(MOZ_ANDROID_BEAM)
8503 AC_SUBST(MOZ_LOCALE_SWITCHER)
8504 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
8505 AC_SUBST(MOZ_ANDROID_SEARCH_ACTIVITY)
8506 AC_SUBST(MOZ_ANDROID_SHARE_OVERLAY)
8507 AC_SUBST(MOZ_ANDROID_MLS_STUMBLER)
8508 AC_SUBST(MOZ_ANDROID_DOWNLOADS_INTEGRATION)
8509 AC_SUBST(ENABLE_STRIP)
8510 AC_SUBST(PKG_SKIP_STRIP)
8511 AC_SUBST(STRIP_FLAGS)
8512 AC_SUBST(USE_ELF_HACK)
8513 AC_SUBST(INCREMENTAL_LINKER)
8514 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8515 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8517 AC_SUBST(MOZ_FIX_LINK_PATHS)
8519 AC_SUBST(USE_DEPENDENT_LIBS)
8521 AC_SUBST(MOZ_BUILD_ROOT)
8523 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8524 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8525 AC_SUBST(MOZ_LINKER_EXTRACT)
8527 AC_SUBST(MOZ_JSDOWNLOADS)
8528 if test -n "$MOZ_JSDOWNLOADS"; then
8529 AC_DEFINE(MOZ_JSDOWNLOADS)
8532 dnl ========================================================
8533 dnl = Mac bundle name prefix
8534 dnl ========================================================
8535 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8536 [ --with-macbundlename-prefix=prefix
8537 Prefix for MOZ_MACBUNDLE_NAME],
8538 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8540 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8541 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8542 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8545 if test "$MOZ_DEBUG"; then
8546 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8548 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8550 AC_SUBST(MOZ_MACBUNDLE_NAME)
8552 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8553 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8554 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8555 if test "$MOZ_DEBUG"; then
8556 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8559 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8560 AC_SUBST(MOZ_MACBUNDLE_ID)
8562 dnl ========================================================
8563 dnl = Child Process Name for IPC
8564 dnl ========================================================
8565 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8566 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8568 # We want to let Android unpack the file at install time, but it only does
8569 # so if the file is named libsomething.so. The lib/ path is also required
8570 # because the unpacked file will be under the lib/ subdirectory and will
8571 # need to be executed from that path.
8572 MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8574 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8576 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8577 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8579 # The following variables are available to branding and application
8580 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8581 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8582 # impacts profile location and user-visible fields.
8583 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8584 # versions of a given application (e.g. Aurora and Firefox both use
8585 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8586 # for application.ini's "Name" field, which controls profile location in
8587 # the absence of a "Profile" field (see below), and various system
8588 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8589 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8590 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8591 # builds (e.g. Aurora for Firefox).
8592 # - MOZ_APP_VERSION: Defines the application version number.
8593 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8594 # defaults to a lowercase form of MOZ_APP_BASENAME.
8595 # - MOZ_APP_PROFILE: When set, used for application.ini's
8596 # "Profile" field, which controls profile location.
8597 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8598 # crash reporter server url.
8599 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8601 if test -z "$MOZ_APP_NAME"; then
8602 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8605 # For extensions and langpacks, we require a max version that is compatible
8606 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8607 # 24.0a1 and 24.0a2 aren't affected
8609 # 24.1.1 becomes 24.*
8610 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8611 if test -z "$IS_ALPHA"; then
8613 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
8616 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8619 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8620 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8621 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8623 AC_SUBST(MOZ_APP_NAME)
8624 AC_SUBST(MOZ_APP_DISPLAYNAME)
8625 AC_SUBST(MOZ_APP_BASENAME)
8626 AC_SUBST(MOZ_APP_VENDOR)
8627 AC_SUBST(MOZ_APP_PROFILE)
8628 AC_SUBST(MOZ_APP_ID)
8629 AC_SUBST(MAR_CHANNEL_ID)
8630 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8631 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8632 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8633 AC_SUBST(MOZ_APP_UA_NAME)
8634 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8635 AC_SUBST(MOZ_APP_VERSION)
8636 AC_SUBST(MOZ_APP_MAXVERSION)
8637 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8638 AC_SUBST(FIREFOX_VERSION)
8639 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8640 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8641 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8644 AC_SUBST(MOZ_APP_STATIC_INI)
8646 AC_SUBST(MOZ_PKG_SPECIAL)
8648 AC_SUBST(MOZILLA_OFFICIAL)
8650 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8651 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8653 if test "$MOZ_TELEMETRY_REPORTING"; then
8654 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8656 # Enable Telemetry by default for nightly and aurora channels
8657 if test -z "$RELEASE_BUILD"; then
8658 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8662 dnl If we have any service that uploads data (and requires data submission
8663 dnl policy alert), set MOZ_DATA_REPORTING.
8664 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8665 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8666 MOZ_DATA_REPORTING=1
8667 AC_DEFINE(MOZ_DATA_REPORTING)
8668 AC_SUBST(MOZ_DATA_REPORTING)
8672 AC_SUBST(MOZ_BROWSE_INFO)
8673 AC_SUBST(MOZ_TOOLS_DIR)
8674 AC_SUBST(WIN32_REDIST_DIR)
8677 dnl Echo the CFLAGS to remove extra whitespace.
8683 $_WARNINGS_CXXFLAGS \
8686 COMPILE_CFLAGS=`echo \
8691 COMPILE_CXXFLAGS=`echo \
8692 $_DEFINES_CXXFLAGS \
8700 HOST_CXXFLAGS=`echo \
8704 AC_SUBST(MOZ_NATIVE_JPEG)
8705 AC_SUBST(MOZ_NATIVE_PNG)
8706 AC_SUBST(MOZ_NATIVE_BZ2)
8708 AC_SUBST(MOZ_JPEG_CFLAGS)
8709 AC_SUBST_LIST(MOZ_JPEG_LIBS)
8710 AC_SUBST(MOZ_BZ2_CFLAGS)
8711 AC_SUBST_LIST(MOZ_BZ2_LIBS)
8712 AC_SUBST(MOZ_PNG_CFLAGS)
8713 AC_SUBST_LIST(MOZ_PNG_LIBS)
8715 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
8716 export MOZ_NUWA_PROCESS
8717 AC_DEFINE(MOZ_NUWA_PROCESS)
8719 AC_SUBST(MOZ_NUWA_PROCESS)
8720 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_B2G_LOADER"; then
8721 if test -z "$MOZ_NUWA_PROCESS"; then
8722 AC_MSG_ERROR([B2G loader works with Nuwa]);
8724 export MOZ_B2G_LOADER
8725 AC_DEFINE(MOZ_B2G_LOADER)
8727 AC_SUBST(MOZ_B2G_LOADER)
8729 AC_SUBST(NSPR_CFLAGS)
8730 AC_SUBST(MOZ_NATIVE_NSPR)
8732 AC_SUBST(NSS_CFLAGS)
8733 AC_SUBST(MOZ_NATIVE_NSS)
8734 AC_SUBST(NSS_DISABLE_DBM)
8737 OS_CXXFLAGS="$CXXFLAGS"
8738 OS_CPPFLAGS="$CPPFLAGS"
8739 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8740 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8741 OS_LDFLAGS="$LDFLAGS"
8744 AC_SUBST(OS_CXXFLAGS)
8745 AC_SUBST(OS_CPPFLAGS)
8746 AC_SUBST(OS_COMPILE_CFLAGS)
8747 AC_SUBST(OS_COMPILE_CXXFLAGS)
8748 AC_SUBST(OS_LDFLAGS)
8750 AC_SUBST(CROSS_COMPILE)
8751 AC_SUBST(WCHAR_CFLAGS)
8755 AC_SUBST(HOST_CFLAGS)
8756 AC_SUBST(HOST_CXXFLAGS)
8757 AC_SUBST(HOST_LDFLAGS)
8758 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8760 AC_SUBST(HOST_AR_FLAGS)
8762 AC_SUBST(HOST_RANLIB)
8763 AC_SUBST(HOST_NSPR_MDCPUCFG)
8764 AC_SUBST(HOST_BIN_SUFFIX)
8765 AC_SUBST(HOST_OS_ARCH)
8767 AC_SUBST(TARGET_CPU)
8768 AC_SUBST(TARGET_VENDOR)
8770 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8771 AC_SUBST(TARGET_MD_ARCH)
8772 AC_SUBST(TARGET_XPCOM_ABI)
8775 AC_SUBST(OS_RELEASE)
8778 AC_SUBST(INTEL_ARCHITECTURE)
8779 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
8780 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
8781 AC_SUBST(HAVE_X86_AVX2)
8782 AC_SUBST(GCC_USE_GNU_LD)
8784 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8786 AC_SUBST(WRAP_LDFLAGS)
8789 AC_SUBST(MKSHLIB_FORCE_ALL)
8790 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8791 AC_SUBST(DSO_CFLAGS)
8792 AC_SUBST(DSO_PIC_CFLAGS)
8793 AC_SUBST(DSO_LDOPTS)
8794 AC_SUBST(LIB_PREFIX)
8795 AC_SUBST(DLL_PREFIX)
8796 AC_SUBST(DLL_SUFFIX)
8797 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8798 AC_SUBST(LIB_SUFFIX)
8799 AC_SUBST(OBJ_SUFFIX)
8800 AC_SUBST(BIN_SUFFIX)
8801 AC_SUBST(ASM_SUFFIX)
8802 AC_SUBST(IMPORT_LIB_SUFFIX)
8804 AC_SUBST(CC_VERSION)
8805 AC_SUBST(CXX_VERSION)
8806 AC_SUBST(MSMANIFEST_TOOL)
8807 AC_SUBST(NS_ENABLE_TSF)
8808 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
8809 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
8812 AC_SUBST(MOZ_VORBIS)
8813 AC_SUBST(MOZ_TREMOR)
8817 AC_SUBST(MOZ_FFMPEG)
8820 AC_SUBST(MOZ_DIRECTSHOW)
8821 AC_SUBST(MOZ_ANDROID_OMX)
8822 AC_SUBST(MOZ_APPLEMEDIA)
8823 AC_SUBST(MOZ_OMX_PLUGIN)
8824 AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
8827 AC_SUBST(VPX_ASFLAGS)
8828 AC_SUBST(VPX_DASH_C_FLAG)
8829 AC_SUBST(VPX_AS_CONVERSION)
8830 AC_SUBST(VPX_ASM_SUFFIX)
8831 AC_SUBST(VPX_X86_ASM)
8832 AC_SUBST(VPX_ARM_ASM)
8833 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8834 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8835 AC_SUBST(MOZ_CODE_COVERAGE)
8836 AC_SUBST(LIBJPEG_TURBO_AS)
8837 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8838 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8839 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8840 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8842 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8843 AC_SUBST(MOZ_FOLD_LIBS)
8845 AC_SUBST(MOZ_ENABLE_SZIP)
8846 AC_SUBST(MOZ_SZIP_FLAGS)
8848 if test "$MOZ_DEBUG"; then
8851 AC_SUBST(MOZ_EM_DEBUG)
8853 if test -n "$COMPILE_ENVIRONMENT"; then
8854 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
8856 dnl Check for missing components
8857 if test "$MOZ_X11"; then
8858 if test "$WITHOUT_X11"; then
8859 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8861 dnl ====================================================
8862 dnl = Check if X headers exist
8863 dnl ====================================================
8864 _SAVE_CFLAGS=$CFLAGS
8865 CFLAGS="$CFLAGS $XCFLAGS"
8869 #include <X11/Xlib.h>
8870 #include <X11/Intrinsic.h>
8871 #include <X11/extensions/XShm.h>
8875 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8876 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8880 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
8881 CFLAGS="$_SAVE_CFLAGS"
8883 if test -n "$MISSING_X"; then
8884 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8889 fi # COMPILE_ENVIRONMENT
8891 dnl Set various defines and substitutions
8892 dnl ========================================================
8894 if test "$OS_ARCH" != "WINNT"; then
8898 if test "$MOZ_DEBUG"; then
8899 AC_DEFINE(MOZ_REFLOW_PERF)
8900 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8903 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
8904 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8905 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8906 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8907 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8908 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8909 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8910 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8911 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8914 if test "$MOZ_DEBUG"; then
8917 case "$MOZ_UPDATE_CHANNEL" in
8918 aurora|beta|release|esr)
8925 if test -n "$A11Y_LOG"; then
8929 AC_SUBST(MOZILLA_VERSION)
8931 AC_SUBST(ac_configure_args)
8933 dnl Spit out some output
8934 dnl ========================================================
8936 dnl The following defines are used by xpcom
8937 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8939 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8940 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8941 HAVE_CPP_PARTIAL_SPECIALIZATION
8942 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8943 NEED_CPP_UNUSED_IMPLEMENTATIONS
8946 HAVE_ICONV_WITH_CONST_INPUT
8959 AC_SUBST(STLPORT_LIBS)
8961 dnl ========================================================
8963 dnl ========================================================
8965 # Internationalization isn't built or exposed by default in non-desktop
8966 # builds. Bugs to enable:
8968 # Android: bug 864843
8971 if test "$MOZ_WIDGET_TOOLKIT" = "android" ||
8972 test "$MOZ_BUILD_APP" = "b2g"; then
8980 if test -z "$JS_SHARED_LIBRARY"; then
8981 AC_DEFINE(MOZ_STATIC_JS)
8983 AC_SUBST(JS_SHARED_LIBRARY)
8985 MOZ_CREATE_CONFIG_STATUS()
8987 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8988 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8989 MOZ_SUBCONFIGURE_ICU()
8990 MOZ_SUBCONFIGURE_FFI()
8993 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8994 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8995 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8996 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8997 # (apparently) only need this hack when egrep's "pattern" is particularly long
8998 # (as in the following code) and the first egrep on our $PATH is Apple's. See
9002 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
9009 # Run jemalloc configure script
9011 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
9012 ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
9013 if test -n "$MOZ_REPLACE_MALLOC"; then
9014 # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9015 ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9016 ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9018 if test -n "$MOZ_JEMALLOC3"; then
9019 case "${OS_ARCH}" in
9021 # We want jemalloc functions to be kept hidden on both Mac and Windows
9022 # See memory/build/mozmemory_wrap.h for details.
9023 ac_configure_args="$ac_configure_args --without-export"
9026 elif test "${OS_ARCH}" = Darwin; then
9027 # When building as a replace-malloc lib, disabling the zone allocator
9028 # forces to use pthread_atfork.
9029 ac_configure_args="$ac_configure_args --disable-zone-allocator"
9031 _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9033 if test -z "$MOZ_REPLACE_MALLOC"; then
9035 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9039 elif test -z "$MOZ_JEMALLOC3"; then
9041 JEMALLOC_WRAPPER=replace_
9043 if test -n "$MANGLE"; then
9045 if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
9046 JEMALLOC_WRAPPER=__wrap_
9048 for mangle in ${MANGLE}; do
9049 if test -n "$MANGLED"; then
9050 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9052 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9055 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9058 if test -z "$MOZ_TLS"; then
9059 ac_configure_args="$ac_configure_args --disable-tls"
9061 EXTRA_CFLAGS="$CFLAGS"
9062 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9063 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9065 if test "$CROSS_COMPILE"; then
9066 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9069 if ! test -e memory/jemalloc; then
9070 mkdir -p memory/jemalloc
9073 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9074 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9077 # Run freetype configure script
9079 if test "$MOZ_TREE_FREETYPE"; then
9080 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9081 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9082 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9083 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9084 # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
9085 # to force freetype to use our settings rather than autodetecting
9086 if test -n "$MOZ_NATIVE_PNG"; then
9087 export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
9089 export LIBPNG_CFLAGS="-I$_objdir/dist/include"
9091 export LIBPNG_LIBS="$MOZ_PNG_LIBS "
9092 export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
9093 export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
9094 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9095 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
9097 if ! test -e modules; then
9101 AC_OUTPUT_SUBDIRS(modules/freetype2,$cache_file)
9104 if test -z "$direct_nspr_config"; then
9105 dnl ========================================================
9106 dnl = Setup a nice relatively clean build environment for
9107 dnl = sub-configures.
9108 dnl ========================================================
9111 CFLAGS="$_SUBDIR_CFLAGS"
9112 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9113 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9114 LDFLAGS="$_SUBDIR_LDFLAGS"
9115 HOST_CC="$_SUBDIR_HOST_CC"
9116 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9117 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9118 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9125 # Run all configure scripts specified by a subconfigure
9126 if test -n "$_subconfigure_subdir"; then
9127 _save_srcdir="$srcdir"
9129 _save_ac_configure_args="$ac_configure_args"
9130 ac_configure_args="$_subconfigure_config_args"
9131 AC_OUTPUT_SUBDIRS("$_subconfigure_subdir",$cache_file)
9132 ac_configure_args="$_save_ac_configure_args"
9133 srcdir="$_save_srcdir"
9136 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9137 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9141 if test -n "$_WRAP_MALLOC"; then
9142 # Avoid doubling wrap malloc arguments
9143 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9146 if test -n "$MOZ_USING_CCACHE"; then
9147 # Avoid double prepending ccache by omitting --with-ccache in building NSPR.
9148 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--with-ccache[[^ ]]*//'`"
9151 MOZ_SUBCONFIGURE_NSPR()
9153 dnl ========================================================
9154 dnl = Setup a nice relatively clean build environment for
9155 dnl = sub-configures.
9156 dnl ========================================================
9159 CFLAGS="$_SUBDIR_CFLAGS"
9160 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9161 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9162 LDFLAGS="$_SUBDIR_LDFLAGS"
9163 HOST_CC="$_SUBDIR_HOST_CC"
9164 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9165 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9166 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9169 # Run the SpiderMonkey 'configure' script.
9170 dist=$MOZ_BUILD_ROOT/dist
9171 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9173 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
9175 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
9177 ac_configure_args="$ac_configure_args --enable-threadsafe"
9179 if test "$_INTL_API" = no; then
9180 ac_configure_args="$ac_configure_args --without-intl-api"
9183 if test "$BUILD_CTYPES"; then
9184 # Build js-ctypes on the platforms we can.
9185 ac_configure_args="$ac_configure_args --enable-ctypes"
9187 if test -z "$JS_SHARED_LIBRARY" ; then
9188 ac_configure_args="$ac_configure_args --disable-shared-js"
9189 if test -n "$MOZ_DISABLE_EXPORT_JS"; then
9190 ac_configure_args="$ac_configure_args --disable-export-js"
9193 if test -z "$JSGC_GENERATIONAL" ; then
9194 ac_configure_args="$ac_configure_args --disable-gcgenerational"
9196 if test -n "$JS_GCCOMPACTING" ; then
9197 ac_configure_args="$ac_configure_args --enable-gccompacting"
9199 if test -n "$JS_GC_SMALL_CHUNK_SIZE" ; then
9200 ac_configure_args="$ac_configure_args --enable-small-chunk-size"
9202 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
9203 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9204 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9206 ac_configure_args="$ac_configure_args --prefix=$dist"
9207 if test "$MOZ_MEMORY"; then
9208 ac_configure_args="$ac_configure_args --enable-jemalloc"
9210 if test -n "$MOZ_GLUE_LDFLAGS"; then
9211 export MOZ_GLUE_LDFLAGS
9213 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9214 export MOZ_GLUE_PROGRAM_LDFLAGS
9216 if test -n "$ZLIB_IN_MOZGLUE"; then
9219 export MOZ_NATIVE_ZLIB
9220 export MOZ_ZLIB_CFLAGS
9221 export MOZ_ZLIB_LIBS
9223 export DONT_POPULATE_VIRTUALENV=1
9225 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9226 export STLPORT_CPPFLAGS
9228 export JS_STANDALONE=no
9230 export ZLIB_IN_MOZGLUE
9232 if ! test -e js; then
9236 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
9237 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9239 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9241 export WRITE_MOZINFO=1
9242 dnl we need to run config.status after js/src subconfigure because we're
9243 dnl traversing its moz.build and we need its config.status for that.
9244 dnl However, writing our own config.status needs to happen before
9245 dnl subconfigures because the setup surrounding subconfigures alters
9246 dnl many AC_SUBSTed variables.
9247 MOZ_RUN_CONFIG_STATUS()