1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl This Source Code Form is subject to the terms of the Mozilla Public
4 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
5 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 dnl Process this file with autoconf to produce a configure script.
8 dnl ========================================================
11 AC_INIT(config/config.mk)
12 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
14 TARGET_CPU="${target_cpu}"
15 TARGET_VENDOR="${target_vendor}"
16 TARGET_OS="${target_os}"
18 dnl ========================================================
20 dnl = Don't change the following two lines. Doing so breaks:
22 dnl = CFLAGS="-foo" ./configure
24 dnl ========================================================
26 CPPFLAGS="${CPPFLAGS=}"
27 CXXFLAGS="${CXXFLAGS=}"
29 HOST_CFLAGS="${HOST_CFLAGS=}"
30 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
31 HOST_LDFLAGS="${HOST_LDFLAGS=}"
33 dnl ========================================================
34 dnl = Preserve certain environment flags passed to configure
35 dnl = We want sub projects to receive the same flags
36 dnl = untainted by this configure script
37 dnl ========================================================
40 _SUBDIR_CFLAGS="$CFLAGS"
41 _SUBDIR_CPPFLAGS="$CPPFLAGS"
42 _SUBDIR_CXXFLAGS="$CXXFLAGS"
43 _SUBDIR_LDFLAGS="$LDFLAGS"
44 _SUBDIR_HOST_CC="$HOST_CC"
45 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
46 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
47 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
48 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
50 dnl Set the version number of the libs included with mozilla
51 dnl ========================================================
58 dnl Set the minimum version of toolkit libs used by mozilla
59 dnl ========================================================
66 WINDRES_VERSION=2.14.90
72 STARTUP_NOTIFICATION_VERSION=0.8
74 SQLITE_VERSION=3.8.7.1
78 dnl Set various checks
79 dnl ========================================================
83 dnl Initialize the Pthread test variables early so they can be
84 dnl overridden by each platform.
85 dnl ========================================================
89 dnl Do not allow objdir == srcdir builds.
90 dnl ==============================================================
91 _topsrcdir=`cd \`dirname $0\`; pwd`
95 dnl TODO Don't exempt L10N builds once bug 842760 is resolved.
96 if test "$_topsrcdir" = "$_objdir" -a "${with_l10n_base+set}" != set; then
98 echo " * Building directly in the main source directory is not allowed."
100 echo " * To build, you must run configure from a separate directory"
101 echo " * (referred to as an object directory)."
103 echo " * If you are building with a mozconfig, you will need to change your"
104 echo " * mozconfig to point to a different object directory."
109 # Check for a couple representative files in the source tree
111 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
112 if test -f $file; then
113 _conflict_files="$_conflict_files $file"
116 if test "$_conflict_files"; then
118 echo "* Your source tree contains these files:"
119 for file in $_conflict_files; do
123 * This indicates that you previously built in the source tree.
124 * A source tree build can confuse the separate objdir build.
126 * To clean up the source tree:
134 MOZ_BUILD_ROOT=`pwd -W 2>/dev/null || pwd`
140 COMPILE_ENVIRONMENT=1
141 MOZ_ARG_DISABLE_BOOL(compile-environment,
142 [ --disable-compile-environment
143 Disable compiler/library checks.],
144 COMPILE_ENVIRONMENT= )
145 AC_SUBST(COMPILE_ENVIRONMENT)
147 MOZ_ARG_WITH_STRING(l10n-base,
148 [ --with-l10n-base=DIR path to l10n repositories],
149 L10NBASEDIR=$withval)
150 if test -n "$L10NBASEDIR"; then
151 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
152 AC_MSG_ERROR([--with-l10n-base must specify a path])
153 elif test -d "$L10NBASEDIR"; then
154 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
156 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
159 AC_SUBST(L10NBASEDIR)
161 dnl Check for Perl first -- needed for win32 SDK checks
162 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
163 if test -z "$PERL" -o "$PERL" = ":"; then
164 AC_MSG_ERROR([perl not found in \$PATH])
167 if test -n "$GAIADIR" -a ! -d "$GAIADIR" ; then
168 AC_MSG_ERROR([GAIADIR '$GAIADIR' isn't a valid directory])
172 if test -n "$GAIADIR" ; then
173 AC_DEFINE(PACKAGE_GAIA)
176 if test -n "$FXOS_SIMULATOR" -a -z "$GAIADIR" ; then
177 AC_MSG_ERROR([FXOS_SIMULATOR=1 requires GAIADIR to be defined])
180 if test -n "$FXOS_SIMULATOR" ; then
181 AC_DEFINE(FXOS_SIMULATOR)
182 AC_SUBST(FXOS_SIMULATOR)
185 if test -n "$MOZTTDIR" -a ! -d "$MOZTTDIR" ; then
186 AC_MSG_ERROR([MOZTTDIR '$MOZTTDIR' isn't a valid directory])
190 if test -n "$MOZTTDIR" ; then
191 AC_DEFINE(PACKAGE_MOZTT)
194 MOZ_ARG_WITH_STRING(gonk,
196 location of gonk dir],
199 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
200 [ --with-gonk-toolchain-prefix=DIR
201 prefix to gonk toolchain commands],
202 gonk_toolchain_prefix=$withval)
204 if test -n "$gonkdir" ; then
205 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
206 android_source="$gonkdir"
207 ANDROID_SOURCE="$android_source"
208 ANDROID_NDK="${ANDROID_SOURCE}/ndk"
211 if test -n "${PLATFORM_SDK_VERSION}"; then
212 ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
216 TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
217 AS="$gonk_toolchain_prefix"as
218 CC="$gonk_toolchain_prefix"gcc
219 CXX="$gonk_toolchain_prefix"g++
220 CPP="$gonk_toolchain_prefix"cpp
221 LD="$gonk_toolchain_prefix"ld
222 AR="$gonk_toolchain_prefix"ar
223 RANLIB="$gonk_toolchain_prefix"ranlib
224 STRIP="$gonk_toolchain_prefix"strip
225 OBJCOPY="$gonk_toolchain_prefix"objcopy
227 if ! test -e "$gonkdir/ndk/sources/cxx-stl/stlport/src/iostream.cpp"; then
228 AC_MSG_ERROR([Couldn't find path to stlport sources in the gonk tree])
230 STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include"
232 case "$target_cpu" in
241 case "$ANDROID_VERSION" in
243 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"
249 AC_SUBST(MOZ_OMX_DECODER)
253 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"
254 if test -d "$gonkdir/external/bluetooth/bluez"; then
255 GONK_INCLUDES="$GONK_INCLUDES -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
258 elif test -d "$gonkdir/external/bluetooth/bluedroid"; then
260 MOZ_B2G_BT_BLUEDROID=1
261 if test -d "$gonkdir/system/bluetoothd"; then
270 AC_SUBST(MOZ_OMX_DECODER)
272 AC_SUBST(MOZ_OMX_ENCODER)
273 AC_DEFINE(MOZ_OMX_ENCODER)
277 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"
280 MOZ_B2G_BT_BLUEDROID=1
281 if test -d "$gonkdir/system/bluetoothd"; then
288 AC_DEFINE(MOZ_OMX_ENCODER)
290 AC_SUBST(MOZ_AUDIO_OFFLOAD)
291 AC_DEFINE(MOZ_AUDIO_OFFLOAD)
295 AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
298 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"
299 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
300 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
301 dnl Add -llog by default, since we use it all over the place.
304 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"
306 dnl prevent cross compile section from using these flags as host flags
307 if test -z "$HOST_CPPFLAGS" ; then
310 if test -z "$HOST_CFLAGS" ; then
313 if test -z "$HOST_CXXFLAGS" ; then
316 if test -z "$HOST_LDFLAGS" ; then
321 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
322 AC_SUBST(ANDROID_VERSION)
323 AC_DEFINE(HAVE_SYS_UIO_H)
324 AC_DEFINE(HAVE_PTHREADS)
325 MOZ_CHROME_FILE_FORMAT=omni
331 *-android*|*-linuxandroid*)
332 if test -z "$ANDROID_PACKAGE_NAME" ; then
333 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
335 MOZ_CHROME_FILE_FORMAT=omni
339 AC_PATH_PROG(OBJCOPY,objcopy)
344 AC_SUBST(ANDROID_SOURCE)
345 AC_SUBST(ANDROID_PACKAGE_NAME)
348 dnl ========================================================
349 dnl Checks for compilers.
350 dnl ========================================================
352 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
355 if test "$COMPILE_ENVIRONMENT"; then
357 if test "$target" != "$host"; then
363 # Work around the conftest.exe access problem on Windows
368 MOZ_PATH_PROGS(AS, $AS as, $CC)
369 AC_CHECK_PROGS(AR, ar, :)
370 AC_CHECK_PROGS(LD, ld, :)
371 AC_CHECK_PROGS(STRIP, strip, :)
372 AC_CHECK_PROGS(WINDRES, windres, :)
373 if test -z "$HOST_CC"; then
376 if test -z "$HOST_CFLAGS"; then
377 HOST_CFLAGS="$CFLAGS"
379 if test -z "$HOST_CXX"; then
382 if test -z "$HOST_CXXFLAGS"; then
383 HOST_CXXFLAGS="$CXXFLAGS"
385 if test -z "$HOST_LDFLAGS"; then
386 HOST_LDFLAGS="$LDFLAGS"
388 if test -z "$HOST_RANLIB"; then
389 HOST_RANLIB="$RANLIB"
391 if test -z "$HOST_AR"; then
394 if test -z "$HOST_AR_FLAGS"; then
395 HOST_AR_FLAGS="$AR_FLAGS"
399 if test -n "$MOZ_WINCONSOLE"; then
400 AC_DEFINE(MOZ_WINCONSOLE)
405 MOZ_CHECK_COMPILER_WRAPPER
407 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
408 if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
409 test "$GCC_MAJOR_VERSION" -lt 4; then
410 AC_MSG_ERROR([Only GCC 4.4 or newer supported])
414 dnl ========================================================
415 dnl Special win32 checks
416 dnl ========================================================
418 MOZ_ARG_ENABLE_BOOL(metro,
419 [ --enable-metro Enable Windows Metro build targets],
422 if test -n "$MOZ_METRO"; then
424 # Target the Windows 8 Kit
427 # toolkit/library/makefile.in needs these, see nsDllMain.
429 CRTEXPDLLVERSION=1-1-0
431 # Target the Windows 7 SDK by default
436 AC_SUBST(CRTDLLVERSION)
437 AC_SUBST(CRTEXPDLLVERSION)
439 MOZ_ARG_WITH_STRING(windows-version,
440 [ --with-windows-version=WINSDK_TARGETVER
441 Windows SDK version to target. Lowest version
442 currently allowed is 601 (Win7), highest is 602 (Win8)],
443 WINSDK_TARGETVER=$withval)
445 # Currently only two sdk versions allowed, 601 and 602
446 case "$WINSDK_TARGETVER" in
448 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
452 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
458 if test "$GCC" != "yes"; then
459 # Check to see if we are really running in a msvc environemnt
461 AC_CHECK_PROGS(MIDL, midl)
463 # Make sure compilers are valid
464 CFLAGS="$CFLAGS -TC -nologo"
465 CXXFLAGS="$CXXFLAGS -TP -nologo"
468 AC_TRY_COMPILE([#include <stdio.h>],
469 [ printf("Hello World\n"); ],,
470 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
473 AC_TRY_COMPILE([#include <new.h>],
474 [ unsigned *test = new unsigned(42); ],,
475 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
479 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
482 # Determine compiler version
483 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | cut -c 1-2`
484 _CC_MINOR_VERSION=`echo ${CC_VERSION} | cut -c 3-4`
485 _MSC_VER=${CC_VERSION}
487 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | cut -c 1-2`
489 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
490 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
493 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
494 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
496 if test "$_CC_MAJOR_VERSION" = "16"; then
499 MSVC_C_RUNTIME_DLL=msvcr100.dll
500 MSVC_CXX_RUNTIME_DLL=msvcp100.dll
501 elif test "$_CC_MAJOR_VERSION" = "17"; then
504 MSVC_C_RUNTIME_DLL=msvcr110.dll
505 MSVC_CXX_RUNTIME_DLL=msvcp110.dll
506 elif test "$_CC_MAJOR_VERSION" = "18"; then
509 MSVC_C_RUNTIME_DLL=msvcr120.dll
510 MSVC_CXX_RUNTIME_DLL=msvcp120.dll
512 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
514 AC_SUBST(MSVS_VERSION)
515 AC_SUBST(MSVC_C_RUNTIME_DLL)
516 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
518 # Disable SEH on clang-cl because it doesn't implement them yet.
519 if test -z "$CLANG_CL"; then
520 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
522 # Send our CFLAGS to NSS
524 AC_DEFINE_UNQUOTED(GTEST_HAS_SEH, 0)
527 if test -n "$WIN32_REDIST_DIR"; then
528 if test ! -d "$WIN32_REDIST_DIR"; then
529 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
531 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
534 dnl Confirm we have the pri tools on win8 builds
535 if test -n "$MOZ_METRO"; then
536 AC_MSG_CHECKING([for makepri])
537 AC_CHECK_PROGS(MAKEPRI, makepri, "")
538 if test -z "MAKEPRI" ; then
539 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
544 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
545 dnl not something else like "magnetic tape manipulation utility".
546 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
547 if test -z "$MSMT_TOOL"; then
548 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
552 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
554 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
555 if test -z "$MSMANIFEST_TOOL_VERSION"; then
556 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
562 # Check linker version
563 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
564 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
565 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
566 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
571 # Set midl environment
574 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
577 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
581 unset _MSVC_VER_FILTER
583 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
587 _SAVE_CXXFLAGS="$CXXFLAGS"
588 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
589 AC_TRY_COMPILE([#include <exception>],
590 [std::_Throw(std::exception()); return 0;],
591 ac_cv_have_std__Throw="yes",
592 ac_cv_have_std__Throw="no")
593 CXXFLAGS="$_SAVE_CXXFLAGS"
597 if test "$ac_cv_have_std__Throw" = "yes"; then
598 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
599 ac_cv_have_dllimport_exception_bug,
603 _SAVE_CXXFLAGS="$CXXFLAGS"
604 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
605 AC_TRY_LINK([#include <vector>],
606 [std::vector<int> v; return v.at(1);],
607 ac_cv_have_dllimport_exception_bug="no",
608 ac_cv_have_dllimport_exception_bug="yes")
609 CXXFLAGS="$_SAVE_CXXFLAGS"
612 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
614 MOZ_MSVC_STL_WRAP__Throw=1
615 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
618 AC_CACHE_CHECK(for overridable _RAISE,
623 _SAVE_CXXFLAGS="$CXXFLAGS"
624 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
625 AC_TRY_COMPILE([#include <xstddef>
627 #define _RAISE(x) externallyDefinedFunction((x).what())
630 [std::vector<int> v; return v.at(1);],
631 ac_cv_have__RAISE="no",
632 ac_cv_have__RAISE="yes")
633 CXXFLAGS="$_SAVE_CXXFLAGS"
636 if test "$ac_cv_have__RAISE" = "yes"; then
638 MOZ_MSVC_STL_WRAP__RAISE=1
639 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
641 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
645 if test "$WRAP_STL_INCLUDES" = "1"; then
646 STL_FLAGS='-I$(DIST)/stl_wrappers'
648 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
649 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
651 MOZ_FIND_WINSDK_VERSION
653 # Check w32api version
654 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
655 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
656 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
657 AC_TRY_COMPILE([#include <w32api.h>],
658 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
659 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
660 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
661 #error "test failed."
663 , [ res=yes ], [ res=no ])
664 AC_MSG_RESULT([$res])
665 if test "$res" != "yes"; then
666 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
668 # Check windres version
669 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
670 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
671 AC_MSG_RESULT([$_WINDRES_VERSION])
672 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
673 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
674 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
675 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
676 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
677 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
678 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
679 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
680 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
681 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
682 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
683 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
685 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
688 AC_CHECK_PROGS(MIDL, $target-widl widl)
689 if test -n "$MIDL"; then
692 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
695 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
700 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
701 # causing problems with local implementations with the same name.
702 AC_DEFINE(STRSAFE_NO_DEPRECATE)
704 MOZ_WINSDK_MAXVER=0x06020000
707 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
708 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
709 # Require OS features provided by IE 6.0 SP2 (XP SP2)
710 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
712 # If the maximum version supported by this SDK is lower than the target
714 AC_MSG_CHECKING([for Windows SDK being recent enough])
715 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
719 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.])
722 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
723 # Definitions matching sdkddkver.h
724 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
725 AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
726 AC_SUBST(MOZ_WINSDK_MAXVER)
733 if test -n "$_WIN32_MSVC"; then
735 SKIP_COMPILER_CHECKS=1
736 SKIP_LIBRARY_CHECKS=1
738 # Since we're skipping compiler and library checks, hard-code
741 AC_DEFINE(HAVE_SETBUF)
742 AC_DEFINE(HAVE_ISATTY)
745 fi # COMPILE_ENVIRONMENT
758 AC_SUBST(WRAP_STL_INCLUDES)
759 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
760 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
762 dnl ========================================================
763 dnl Checks for programs.
764 dnl ========================================================
768 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
769 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
770 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
772 AC_MSG_RESULT([$_perl_version])
774 if test "$_perl_res" != 0; then
775 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
779 AC_MSG_CHECKING([for full perl installation])
780 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
782 if test "$_perl_res" != 0; then
784 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
789 if test -z "$COMPILE_ENVIRONMENT"; then
790 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
792 AC_SUBST(NSINSTALL_BIN)
794 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
795 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
796 MOZ_PATH_PROGS(UNZIP, unzip)
797 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
798 AC_MSG_ERROR([unzip not found in \$PATH])
800 MOZ_PATH_PROGS(ZIP, zip)
801 if test -z "$ZIP" -o "$ZIP" = ":"; then
802 AC_MSG_ERROR([zip not found in \$PATH])
804 MOZ_PATH_PROG(XARGS, xargs)
805 if test -z "$XARGS" -o "$XARGS" = ":"; then
806 AC_MSG_ERROR([xargs not found in \$PATH .])
809 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
812 if test "$COMPILE_ENVIRONMENT"; then
814 dnl ========================================================
815 dnl = Mac OS X toolchain support
816 dnl ========================================================
818 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
819 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
820 dnl when we can run target binaries.
821 AC_SUBST(UNIVERSAL_BINARY)
822 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
824 MOZ_ARG_WITH_STRING(unify-dist,
825 [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
827 if test -n "$UNIVERSAL_BINARY"; then
828 if test -z "$UNIFY_DIST"; then
829 AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
831 case "$UNIFY_DIST" in
835 UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
841 dnl ========================================================
842 dnl Check for MacOS deployment target version
843 dnl ========================================================
845 MOZ_ARG_ENABLE_STRING(macos-target,
846 [ --enable-macos-target=VER (default=10.6)
847 Set the minimum MacOS version needed at runtime],
848 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
852 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
853 dnl Use the specified value
854 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
856 dnl No value specified on the command line or in the environment,
857 dnl use architecture minimum.
858 export MACOSX_DEPLOYMENT_TARGET=10.6
863 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
865 dnl ========================================================
866 dnl = Mac OS X SDK support
867 dnl ========================================================
869 MOZ_ARG_WITH_STRING(macos-sdk,
870 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
871 MACOS_SDK_DIR=$withval)
873 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
874 MOZ_ARG_WITH_STRING(macos-private-frameworks,
875 [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)],
876 MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
877 MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
878 MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
880 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
881 if test -z "$CROSS_COMPILE"; then
882 AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
884 if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
885 AC_MSG_ERROR([PrivateFrameworks directory not found.])
889 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
890 AC_SUBST(MACOS_SDK_DIR)
891 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
893 if test "$MACOS_SDK_DIR"; then
894 dnl Sync this section with the ones in NSPR and NSS.
895 dnl Changes to the cross environment here need to be accounted for in
896 dnl the libIDL checks (below) and xpidl build.
898 if test ! -d "$MACOS_SDK_DIR"; then
899 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
900 specify a valid SDK. SDKs are installed when the optional cross-development
901 tools are selected during the Xcode/Developer Tools installation.])
904 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
905 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
907 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
908 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
909 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
912 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
914 AC_TRY_COMPILE([#include <new>],[],
918 AC_MSG_RESULT($result)
920 if test "$result" = "no" ; then
921 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
925 fi # COMPILE_ENVIRONMENT
927 if test -n "$MAKE"; then
928 if test `echo $MAKE | grep -c make.py` != 1; then
935 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
938 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
941 if test "$GMAKE" = ":"; then
942 AC_MSG_ERROR([GNU make not found])
946 if test -z "$MAKE"; then
950 if test "$COMPILE_ENVIRONMENT"; then
956 fi # COMPILE_ENVIRONMENT
958 dnl ========================================================
959 dnl set the defaults first
960 dnl ========================================================
976 MOZ_USER_DIR=".mozilla"
978 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
984 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
986 if test -n "$CROSS_COMPILE"; then
987 OS_TARGET="${target_os}"
988 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
990 case "${target_os}" in
991 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
992 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU/kFreeBSD ;;
994 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
995 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
996 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
997 dragonfly*) OS_ARCH=DragonFly OS_TARGET=DragonFly ;;
998 freebsd*) OS_ARCH=FreeBSD OS_TARGET=FreeBSD ;;
999 netbsd*) OS_ARCH=NetBSD OS_TARGET=NetBSD ;;
1000 openbsd*) OS_ARCH=OpenBSD OS_TARGET=OpenBSD ;;
1003 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1006 OS_TARGET=`uname -s`
1007 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1008 OS_RELEASE=`uname -r`
1011 # Before this used `uname -m` when not cross compiling
1012 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1013 OS_TEST="${target_cpu}"
1015 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1017 #######################################################################
1018 # Master "Core Components" macros for getting the OS target #
1019 #######################################################################
1022 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1023 # cross-compilation.
1027 # Define and override various archtecture-specific variables, including
1036 case "$HOST_OS_ARCH" in
1047 HOST_OS_ARCH=GNU_kFreeBSD
1053 HOST_OS_ARCH=DragonFly
1056 HOST_OS_ARCH=FreeBSD
1062 HOST_OS_ARCH=OpenBSD
1068 if test -z "$GNU_CC"; then
1069 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1074 if test -z "$GNU_CXX"; then
1075 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1076 SOLARIS_SUNPRO_CXX=1
1079 AC_SUBST(SOLARIS_SUNPRO_CC)
1080 AC_SUBST(SOLARIS_SUNPRO_CXX)
1086 if test -z "$CROSS_COMPILE" ; then
1092 # If uname -s returns "Windows_NT", we assume that we are using
1093 # the uname.exe in MKS toolkit.
1095 # The -r option of MKS uname only returns the major version number.
1096 # So we need to use its -v option to get the minor version number.
1097 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1101 OS_MINOR_RELEASE=`uname -v`
1102 if test "$OS_MINOR_RELEASE" = "00"; then
1105 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1109 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1110 # the uname.exe in the MSYS tools.
1112 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1117 OS_RELEASE=`uname -v`.`uname -r`
1118 OS_TEST=${target_cpu}
1121 case "${target_cpu}" in
1132 if test -z "$CROSS_COMPILE" ; then
1140 # Only set CPU_ARCH if we recognize the value of OS_TEST
1147 powerpc64 | ppc64 | powerpc64le | ppc64le)
1151 powerpc | ppc | rs6000)
1155 Alpha | alpha | ALPHA)
1192 if test -z "$OS_TARGET"; then
1195 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1197 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1198 dnl ===============================================================
1202 INTEL_ARCHITECTURE=1
1205 dnl Configure platform-specific CPU architecture compiler options.
1206 dnl ==============================================================
1209 dnl =================================================================
1210 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1211 dnl which is bad when cross compiling.
1212 dnl =================================================================
1213 if test "$COMPILE_ENVIRONMENT"; then
1214 configure_static_assert_macros='
1215 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1216 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1217 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1220 dnl test that the macros actually work:
1221 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1222 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1225 ac_cv_static_assertion_macros_work="yes"
1226 AC_TRY_COMPILE([$configure_static_assert_macros],
1227 [CONFIGURE_STATIC_ASSERT(1)],
1229 ac_cv_static_assertion_macros_work="no")
1230 AC_TRY_COMPILE([$configure_static_assert_macros],
1231 [CONFIGURE_STATIC_ASSERT(0)],
1232 ac_cv_static_assertion_macros_work="no",
1235 AC_TRY_COMPILE([$configure_static_assert_macros],
1236 [CONFIGURE_STATIC_ASSERT(1)],
1238 ac_cv_static_assertion_macros_work="no")
1239 AC_TRY_COMPILE([$configure_static_assert_macros],
1240 [CONFIGURE_STATIC_ASSERT(0)],
1241 ac_cv_static_assertion_macros_work="no",
1245 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1246 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1247 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1249 fi # COMPILE_ENVIRONMENT
1251 dnl ========================================================
1252 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1254 dnl ========================================================
1258 dnl ========================================================
1259 dnl Suppress Clang Argument Warnings
1260 dnl ========================================================
1261 if test -n "$CLANG_CC"; then
1262 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1263 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1265 if test -n "$CLANG_CXX"; then
1266 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1269 dnl ========================================================
1270 dnl = Use Address Sanitizer
1271 dnl ========================================================
1272 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1273 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1276 if test -n "$MOZ_ASAN"; then
1278 if test -n "$CLANG_CL"; then
1279 # Look for clang_rt.asan_dynamic-i386.dll
1280 MOZ_CLANG_RT_ASAN_LIB=clang_rt.asan_dynamic-i386.dll
1281 # We use MOZ_PATH_PROG in order to get a Windows style path.
1282 MOZ_PATH_PROG(MOZ_CLANG_RT_ASAN_LIB_PATH, $MOZ_CLANG_RT_ASAN_LIB)
1283 if test -z "$MOZ_CLANG_RT_ASAN_LIB_PATH"; then
1284 AC_MSG_ERROR([Couldn't find $MOZ_CLANG_RT_ASAN_LIB. It should be available in the same location as clang-cl.])
1286 AC_SUBST(MOZ_CLANG_RT_ASAN_LIB_PATH)
1289 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1293 dnl ========================================================
1294 dnl = Use Memory Sanitizer
1295 dnl ========================================================
1296 MOZ_ARG_ENABLE_BOOL(memory-sanitizer,
1297 [ --enable-memory-sanitizer Enable Memory Sanitizer (default=no)],
1300 if test -n "$MOZ_MSAN"; then
1303 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1307 # The LLVM symbolizer is used by all sanitizers
1308 AC_SUBST(LLVM_SYMBOLIZER)
1310 dnl ========================================================
1311 dnl = Enable hacks required for LLVM instrumentations
1312 dnl ========================================================
1313 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1314 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1317 if test -n "$MOZ_LLVM_HACKS"; then
1321 AC_SUBST(MOZ_NO_WLZDEFS)
1322 AC_SUBST(MOZ_CFLAGS_NSS)
1324 dnl ========================================================
1325 dnl = Enable treating compiler warnings as errors
1326 dnl ========================================================
1327 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
1328 [ --enable-warnings-as-errors
1329 Enable treating warnings as errors],
1330 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
1331 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
1333 dnl ========================================================
1334 dnl GNU specific defaults
1335 dnl ========================================================
1336 if test "$GNU_CC"; then
1340 # Per bug 719659 comment 2, some of the headers on ancient build machines
1341 # may require gnu89 inline semantics. But otherwise, we use C99.
1342 # But on OS X we just use C99 plus GNU extensions, in order to fix
1344 CFLAGS="$CFLAGS -std=gnu99"
1345 if test "${OS_ARCH}" != Darwin; then
1346 CFLAGS="$CFLAGS -fgnu89-inline"
1348 # FIXME: Let us build with strict aliasing. bug 414641.
1349 CFLAGS="$CFLAGS -fno-strict-aliasing"
1350 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1351 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1352 WARNINGS_AS_ERRORS='-Werror'
1354 DSO_PIC_CFLAGS='-fPIC'
1355 ASFLAGS="$ASFLAGS -fPIC"
1356 AC_MSG_CHECKING([for --noexecstack option to as])
1357 _SAVE_CFLAGS=$CFLAGS
1358 CFLAGS="$CFLAGS -Wa,--noexecstack"
1359 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1360 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1361 AC_MSG_RESULT([no]))
1362 CFLAGS=$_SAVE_CFLAGS
1363 AC_MSG_CHECKING([for -z noexecstack option to ld])
1364 _SAVE_LDFLAGS=$LDFLAGS
1365 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1366 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1368 LDFLAGS=$_SAVE_LDFLAGS)
1370 AC_MSG_CHECKING([for -z text option to ld])
1371 _SAVE_LDFLAGS=$LDFLAGS
1372 LDFLAGS="$LDFLAGS -Wl,-z,text"
1373 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1374 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1376 LDFLAGS=$_SAVE_LDFLAGS)
1378 AC_MSG_CHECKING([for --build-id option to ld])
1379 _SAVE_LDFLAGS=$LDFLAGS
1380 LDFLAGS="$LDFLAGS -Wl,--build-id"
1381 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1382 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1384 LDFLAGS=$_SAVE_LDFLAGS)
1386 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
1387 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
1388 _SAVE_LDFLAGS=$LDFLAGS
1389 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
1390 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1391 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
1392 AC_MSG_RESULT([no]))
1393 LDFLAGS=$_SAVE_LDFLAGS
1395 # Check for -mssse3 on $CC
1396 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1397 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1398 _SAVE_CFLAGS=$CFLAGS
1399 CFLAGS="$CFLAGS -mssse3"
1400 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1401 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1402 AC_MSG_RESULT([no]))
1403 CFLAGS=$_SAVE_CFLAGS
1405 # Check for -msse4.1 on $CC
1406 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1407 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1408 _SAVE_CFLAGS=$CFLAGS
1409 CFLAGS="$CFLAGS -msse4.1"
1410 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1411 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1412 AC_MSG_RESULT([no]))
1413 CFLAGS=$_SAVE_CFLAGS
1415 case "${CPU_ARCH}" in
1417 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
1419 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
1420 result="yes", result="no")
1421 AC_MSG_RESULT("$result")
1422 if test "$result" = "yes"; then
1427 DSO_LDOPTS='-shared'
1428 if test "$GCC_USE_GNU_LD"; then
1429 # Some tools like ASan use a runtime library that is only
1430 # linked against executables, so we must allow undefined
1431 # symbols for shared objects in some cases.
1432 if test -z "$MOZ_NO_WLZDEFS"; then
1433 # Don't allow undefined symbols in libraries
1434 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1436 # BSDs need `environ' exposed for posix_spawn (bug 753046)
1437 case "$OS_TARGET" in
1438 DragonFly|FreeBSD|NetBSD|OpenBSD)
1439 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
1440 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
1442 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
1449 # Turn on gcc/clang warnings:
1450 # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html
1452 # -Wall - turn on a lot of warnings
1453 # -Wchar-subscripts - catches array index using signed char
1454 # -Wcomment - catches nested comments
1455 # -Wdeclaration-after-statement - MSVC doesn't like these
1456 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1457 # -Wendif-labels - catches `#else FOO` and `#endif FOO` not in comment
1458 # -Wenum-compare - catches comparison of different enum types
1459 # -Wignored-qualifiers - catches returns types with qualifiers like const
1460 # -Wint-to-pointer-cast - catches cast to pointer from integer of different size
1461 # -Wmultichar - catches multicharacter integer constants like 'THIS'
1462 # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant
1463 # -Wnonnull - catches NULL used with functions arguments marked as non-null
1464 # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void)
1465 # -Wpointer-sign - catches mixing pointers to signed and unsigned types
1466 # -Wpointer-to-int-cast - catches casts from pointer to different sized int
1467 # -Wreturn-type - catches missing returns, zero false positives
1468 # -Wsequence-point - catches undefined order behavior like `a = a++`
1469 # -Wsign-compare - catches comparison of signed and unsigned types
1470 # -Wtrigraphs - catches unlikely use of trigraphs
1471 # -Wtype-limits - catches overflow bugs, few false positives
1472 # -Wunknown-pragmas - catches unexpected #pragma directives
1474 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall"
1475 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wdeclaration-after-statement"
1476 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wempty-body"
1477 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wpointer-to-int-cast"
1478 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wsign-compare"
1479 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wtype-limits"
1481 # Treat some warnings as errors if --enable-warnings-as-errors:
1482 if test "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
1483 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=char-subscripts"
1484 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=comment"
1485 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=endif-labels"
1486 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=enum-compare"
1487 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=ignored-qualifiers"
1488 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=int-to-pointer-cast"
1489 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=multichar"
1490 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=nonnull"
1491 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=pointer-arith"
1492 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=pointer-sign"
1493 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=return-type"
1494 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=sequence-point"
1495 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=trigraphs"
1496 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=unknown-pragmas"
1498 MOZ_C_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_c_has_werror_non_literal_null_conversion)
1501 # Turn off the following warnings that -Wall turns on:
1502 # -Wno-unused - lots of violations in third-party code
1504 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1506 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1507 # Don't use -Wcast-align with ICC or clang
1509 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1510 hppa | ia64 | sparc | arm)
1513 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1518 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1519 _USE_CPP_INCLUDE_FLAG=1
1520 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1522 elif test "$SOLARIS_SUNPRO_CC"; then
1524 if test "$CPU_ARCH" = "sparc"; then
1525 # for Sun Studio on Solaris/SPARC
1526 DSO_PIC_CFLAGS='-xcode=pic32'
1528 DSO_PIC_CFLAGS='-KPIC'
1530 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1532 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1533 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1535 DSO_LDOPTS='-shared'
1536 if test "$GNU_LD"; then
1537 # Don't allow undefined symbols in libraries
1538 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1542 DSO_PIC_CFLAGS='-KPIC'
1543 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1546 if test "$GNU_CXX"; then
1547 # FIXME: Let us build with strict aliasing. bug 414641.
1548 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1550 # Turn on gcc/clang warnings:
1551 # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html
1553 # -Wall - turn on a lot of warnings
1554 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1555 # -Wendif-labels - catches `#else FOO` and `#endif FOO` not in comment
1556 # -Wint-to-pointer-cast - catches cast to pointer from integer of different size
1557 # -Wmissing-braces - catches aggregate initializers missing nested braces
1558 # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant
1559 # -Woverloaded-virtual - function declaration hides virtual function from base class
1560 # -Wparentheses - catches `if (a=b)` and operator precedence bugs
1561 # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void)
1562 # -Wreturn-type - catches missing returns, zero false positives
1563 # -Wsequence-point - catches undefined order behavior like `a = a++`
1564 # -Wsign-compare - catches comparison of signed and unsigned types
1565 # -Wswitch - catches switches without all enum cases or default case
1566 # -Wtrigraphs - catches unlikely use of trigraphs
1567 # -Wtype-limits - catches overflow bugs, few false positives
1568 # -Wunused-label - catches unused goto labels
1569 # -Wwrite-strings - catches non-const char* pointers to string literals
1571 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall"
1572 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wempty-body"
1573 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Woverloaded-virtual"
1574 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wsign-compare"
1575 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wwrite-strings"
1577 # Treat some warnings as errors if --enable-warnings-as-errors:
1578 if test "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
1579 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=endif-labels"
1580 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=int-to-pointer-cast"
1581 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=missing-braces"
1582 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=parentheses"
1583 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=pointer-arith"
1584 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1585 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=sequence-point"
1586 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=switch"
1587 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=trigraphs"
1588 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=type-limits"
1589 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=unused-label"
1591 MOZ_CXX_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_cxx_has_werror_non_literal_null_conversion)
1594 # Turn off the following warnings that -Wall turns on:
1595 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1596 # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc
1597 # for performance reasons, and because GCC and clang accept it (though
1598 # clang warns about it).
1600 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-invalid-offsetof"
1602 MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete)
1604 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1605 # Don't use -Wcast-align with ICC or clang
1607 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1608 hppa | ia64 | sparc | arm)
1611 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1616 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1617 _USE_CPP_INCLUDE_FLAG=1
1619 # Recent clang and gcc support C++11 deleted functions without warnings if
1620 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1621 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1622 # unused. But clang's warning can be disabled, so when compiling with clang
1623 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1624 # deleted function syntax.
1625 if test "$CLANG_CXX"; then
1626 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1627 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1631 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1634 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1635 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1636 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1637 dnl normal behavior.
1638 dnl ========================================================
1640 MKSHLIB_UNFORCE_ALL=
1642 if test "$COMPILE_ENVIRONMENT"; then
1643 if test "$GNU_CC"; then
1644 AC_MSG_CHECKING(whether ld has archive extraction flags)
1645 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1646 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1647 ac_cv_mkshlib_force_and_unforce="no"
1648 exec 3<&0 <<LOOP_INPUT
1649 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1650 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1651 force="-Wl,-all"; unforce="-Wl,-none"
1658 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1661 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1663 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1667 eval $ac_cv_mkshlib_force_and_unforce
1668 MKSHLIB_FORCE_ALL=$force
1669 MKSHLIB_UNFORCE_ALL=$unforce
1672 fi # COMPILE_ENVIRONMENT
1674 dnl ========================================================
1675 dnl Checking for 64-bit OS
1676 dnl ========================================================
1677 if test "$COMPILE_ENVIRONMENT"; then
1680 AC_MSG_CHECKING(for 64-bit OS)
1681 AC_TRY_COMPILE([$configure_static_assert_macros],
1682 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1683 result="yes", result="no")
1684 AC_MSG_RESULT("$result")
1685 if test "$result" = "yes"; then
1686 AC_DEFINE(HAVE_64BIT_BUILD)
1689 AC_SUBST(HAVE_64BIT_BUILD)
1691 fi # COMPILE_ENVIRONMENT
1693 dnl ========================================================
1694 dnl = Use profiling compile flags
1695 dnl ========================================================
1696 MOZ_ARG_ENABLE_BOOL(profiling,
1697 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1701 dnl ========================================================
1702 dnl = Turn on systrace for android/b2g.
1703 dnl ========================================================
1704 MOZ_ARG_ENABLE_BOOL(systrace,
1705 [ --enable-systrace Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1708 if test -n "$MOZ_USE_SYSTRACE"; then
1709 AC_DEFINE(MOZ_USE_SYSTRACE)
1712 # For profiling builds keep the symbol information
1713 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1714 case "$OS_TARGET" in
1715 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1716 STRIP_FLAGS="--strip-debug"
1721 dnl ========================================================
1723 dnl ========================================================
1724 MOZ_ARG_ENABLE_BOOL(valgrind,
1725 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1728 if test -n "$MOZ_VALGRIND"; then
1729 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1731 [--enable-valgrind specified but Valgrind is not installed]))
1732 AC_DEFINE(MOZ_VALGRIND)
1734 AC_SUBST(MOZ_VALGRIND)
1736 dnl ========================================================
1738 dnl ========================================================
1739 MOZ_ARG_ENABLE_BOOL(jprof,
1740 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1743 if test -n "$MOZ_JPROF"; then
1745 AC_DEFINE(MOZ_JPROF)
1748 dnl ========================================================
1750 dnl ========================================================
1751 MOZ_ENABLE_PROFILER_SPS=1
1753 case "${OS_TARGET}" in
1755 case "${CPU_ARCH}" in
1758 MOZ_ENABLE_PROFILER_SPS=
1762 case "${CPU_ARCH}" in
1765 MOZ_ENABLE_PROFILER_SPS=
1770 MOZ_ENABLE_PROFILER_SPS=
1774 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1775 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1778 dnl ========================================================
1780 dnl ========================================================
1781 MOZ_ARG_ENABLE_BOOL(shark,
1782 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1785 if test -n "$MOZ_SHARK"; then
1787 AC_DEFINE(MOZ_SHARK)
1790 dnl ========================================================
1792 dnl ========================================================
1793 MOZ_ARG_ENABLE_BOOL(instruments,
1794 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
1797 if test -n "$MOZ_INSTRUMENTS"; then
1799 AC_DEFINE(MOZ_INSTRUMENTS)
1802 dnl ========================================================
1804 dnl ========================================================
1805 MOZ_ARG_ENABLE_BOOL(callgrind,
1806 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1809 if test -n "$MOZ_CALLGRIND"; then
1811 AC_DEFINE(MOZ_CALLGRIND)
1814 dnl ========================================================
1816 dnl ========================================================
1817 MOZ_ARG_ENABLE_BOOL(vtune,
1818 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1821 if test -n "$MOZ_VTUNE"; then
1823 AC_DEFINE(MOZ_VTUNE)
1826 dnl ========================================================
1828 dnl ========================================================
1829 if test -n "$MOZ_PROFILING"; then
1830 AC_DEFINE(MOZ_PROFILING)
1833 dnl ========================================================
1834 dnl System overrides of the defaults for host
1835 dnl ========================================================
1838 if test -n "$_WIN32_MSVC"; then
1840 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
1841 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
1842 HOST_RANLIB='echo ranlib'
1844 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1846 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1847 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1848 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1849 HOST_BIN_SUFFIX=.exe
1852 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1856 case "${host_cpu}" in
1858 if test -n "$_WIN32_MSVC"; then
1859 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1863 if test -n "$_WIN32_MSVC"; then
1864 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1866 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1872 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1873 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1874 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1877 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1878 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1879 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1880 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1884 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1885 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1889 dnl Check for using a custom <inttypes.h> implementation
1890 dnl ========================================================
1891 AC_MSG_CHECKING(for custom <inttypes.h> implementation)
1892 if test "$MOZ_CUSTOM_INTTYPES_H"; then
1893 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
1894 AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
1896 AC_MSG_RESULT(none specified)
1899 dnl Get mozilla version from central milestone file
1900 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1901 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1902 MOZILLA_SYMBOLVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -symbolversion`
1904 dnl Get version of various core apps from the version files.
1905 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1907 if test -z "$FIREFOX_VERSION"; then
1908 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1911 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1912 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1913 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1914 AC_SUBST(MOZILLA_SYMBOLVERSION)
1916 MOZ_DOING_LTO(lto_is_enabled)
1918 dnl ========================================================
1919 dnl System overrides of the defaults for target
1920 dnl ========================================================
1925 if test ! "$GNU_CC"; then
1926 if test ! "$HAVE_64BIT_BUILD"; then
1927 # Compiling with Visual Age C++ object model compat is the
1928 # default. To compile with object model ibm, add
1929 # AIX_OBJMODEL=ibm to .mozconfig.
1930 if test "$AIX_OBJMODEL" = "ibm"; then
1931 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1938 AC_SUBST(AIX_OBJMODEL)
1939 DSO_LDOPTS='-qmkshrobj=1'
1940 DSO_CFLAGS='-qflag=w:w'
1942 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1944 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1945 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1946 if test "$COMPILE_ENVIRONMENT"; then
1949 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1951 [#if (__IBMCPP__ < 900)
1952 #error "Bad compiler"
1954 _BAD_COMPILER=,_BAD_COMPILER=1)
1955 if test -n "$_BAD_COMPILER"; then
1957 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1959 AC_MSG_RESULT([yes])
1962 TARGET_COMPILER_ABI="ibmc"
1963 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1964 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1967 case "${target_os}" in
1972 if test "$COMPILE_ENVIRONMENT"; then
1973 MOZ_CHECK_HEADERS(sys/inttypes.h)
1975 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1979 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1980 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1981 MOZ_OPTIMIZE_FLAGS="-O3"
1982 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1983 if test "$HAVE_64BIT_BUILD"; then
1988 STRIP_FLAGS="$STRIP_FLAGS -x -S"
1989 # Check whether we're targeting OS X or iOS
1990 AC_CACHE_CHECK(for iOS target,
1992 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1993 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1997 ac_cv_ios_target="yes",
1998 ac_cv_ios_target="no")])
1999 if test "$ac_cv_ios_target" = "yes"; then
2001 AC_DEFINE(XP_DARWIN)
2002 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
2004 AC_DEFINE(XP_MACOSX)
2005 AC_DEFINE(XP_DARWIN)
2006 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2007 # The ExceptionHandling framework is needed for Objective-C exception
2008 # logging code in nsObjCExceptions.h. Currently we only use that in debug
2010 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
2012 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2014 if test "x$lto_is_enabled" = "xyes"; then
2015 echo "Skipping -dead_strip because lto is enabled."
2016 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2017 dnl ===================================================================
2018 elif test "x$enable_dtrace" = "xyes"; then
2019 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2021 dnl check for the presence of the -dead_strip linker flag
2022 AC_MSG_CHECKING([for -dead_strip option to ld])
2023 _SAVE_LDFLAGS=$LDFLAGS
2024 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2025 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2026 if test -n "$_HAVE_DEAD_STRIP" ; then
2027 AC_MSG_RESULT([yes])
2028 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2033 LDFLAGS=$_SAVE_LDFLAGS
2036 dnl With newer linkers we need to pass -allow_heap_execute because of
2037 dnl Microsoft Silverlight (5.1.10411.0 at least).
2038 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
2039 _SAVE_LDFLAGS=$LDFLAGS
2040 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
2041 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
2042 _HAVE_ALLOW_HEAP_EXECUTE=)
2043 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
2044 AC_MSG_RESULT([yes])
2045 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
2049 LDFLAGS=$_SAVE_LDFLAGS
2051 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2056 if test ! "$GNU_CC"; then
2060 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2061 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2062 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2065 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2066 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2069 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2070 AC_DEFINE(_LARGEFILE64_SOURCE)
2075 if test ! "$GNU_CC"; then
2076 DSO_LDOPTS='-b -Wl,+s'
2079 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2080 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2081 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2083 DSO_LDOPTS='-b -E +s'
2084 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2085 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2087 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2088 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2091 *-android*|*-linuxandroid*)
2092 AC_DEFINE(NO_PW_GECOS)
2094 if test -n "$gonkdir"; then
2095 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2096 _PLATFORM_HAVE_RIL=1
2100 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2103 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2105 MOZ_GFX_OPTIMIZE_MOBILE=1
2106 MOZ_OPTIMIZE_FLAGS="-Os -fno-reorder-functions"
2107 if test -z "$CLANG_CC"; then
2108 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
2113 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2114 # Similarly for GNU_CXX and INTEL_CXX.
2115 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2116 # -Os has been broken on Intel's C/C++ compilers for quite a
2117 # while; Intel recommends against using it.
2118 MOZ_OPTIMIZE_FLAGS="-O2"
2119 elif test "$GNU_CC" -o "$GNU_CXX"; then
2120 case $GCC_VERSION in
2122 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
2123 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2125 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2126 MOZ_OPTIMIZE_FLAGS="-Os $MOZ_OPTIMIZE_SIZE_TWEAK"
2127 if test -z "$CLANG_CC"; then
2128 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
2132 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2136 case "${target_cpu}" in
2138 CFLAGS="$CFLAGS -mieee"
2139 CXXFLAGS="$CXXFLAGS -mieee"
2143 if test -z "$MC"; then
2153 # certain versions of cygwin's makedepend barf on the
2154 # #include <string> vs -I./dist/include/string issue so don't use it
2155 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
2157 CXX="$CXX -mwindows"
2158 CPP="$CPP -mwindows"
2159 CFLAGS="$CFLAGS -mms-bitfields"
2160 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2161 DSO_LDOPTS='-shared'
2162 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2163 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2165 # Use static libgcc and libstdc++
2166 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
2167 NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
2168 # Use temp file for windres (bug 213281)
2169 RCFLAGS='-O coff --use-temp-file'
2170 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2171 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2176 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
2177 WIN32_GUI_EXE_LDFLAGS=-mwindows
2179 # We use mix of both POSIX and Win32 printf format across the tree, so format
2180 # warnings are useless on mingw.
2181 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2182 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2184 TARGET_COMPILER_ABI=msvc
2188 if test "$AS_BIN"; then
2189 AS="$(basename "$AS_BIN")"
2192 AR_FLAGS='-NOLOGO -OUT:$@'
2194 RANLIB='echo not_ranlib'
2195 STRIP='echo not_strip'
2206 IMPORT_LIB_SUFFIX=lib
2207 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2208 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2210 MKSHLIB_UNFORCE_ALL=
2211 dnl Set subsystem version 5 for Windows XP.
2212 if test "$CPU_ARCH" = "x86"; then
2213 WIN32_SUBSYSTEM_VERSION=5.01
2215 WIN32_SUBSYSTEM_VERSION=5.02
2217 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
2218 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
2219 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
2220 _USE_CPP_INCLUDE_FLAG=1
2221 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2222 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2223 CFLAGS="$CFLAGS -W3 -Gy"
2224 CXXFLAGS="$CXXFLAGS -W3 -Gy"
2225 if test "$_CC_SUITE" -ge "11" -a "$CPU_ARCH" = "x86"; then
2226 dnl VS2012+ defaults to -arch:SSE2.
2227 CFLAGS="$CFLAGS -arch:IA32"
2228 CXXFLAGS="$CXXFLAGS -arch:IA32"
2230 if test "$_CC_SUITE" -ge "12"; then
2231 dnl VS2013+ requires -FS when parallel building by make -jN.
2232 dnl If nothing, compiler sometimes causes C1041 error.
2233 CFLAGS="$CFLAGS -FS"
2234 CXXFLAGS="$CXXFLAGS -FS"
2236 # khuey says we can safely ignore MSVC warning C4251
2237 # MSVC warning C4244 (implicit type conversion may lose data) warns
2238 # and requires workarounds for perfectly valid code. Also, GCC/clang
2239 # don't warn about it by default. So for consistency/sanity, we turn
2240 # it off on MSVC, too.
2241 # MSVC warning C4267 warns for narrowing type conversions from size_t
2242 # to 32-bit integer types on 64-bit platforms. Since this is virtually
2243 # the same thing as C4244, we disable C4267, too.
2244 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2245 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2246 # MSVC warning C4482 warns when an enum value is refered specifing the
2247 # name of the enum itself. This behavior is allowed in C++11, and the
2248 # warning has been removed in VS2012.
2249 # MSVC warning C4800 warns when a value is implicitly cast to bool,
2250 # because this also forces narrowing to a single byte, which can be a
2251 # perf hit. But this matters so little in practice (and often we want
2252 # that behavior) that it's better to turn it off.
2253 # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2254 # on non-Western system locales even if it is in a comment.
2255 CFLAGS="$CFLAGS -wd4244 -wd4267 -wd4819"
2256 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2257 if test -n "$CLANG_CL"; then
2258 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
2259 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
2261 # make 'foo == bar;' error out
2262 CFLAGS="$CFLAGS -we4553"
2263 CXXFLAGS="$CXXFLAGS -we4553"
2264 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2265 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2266 WARNINGS_AS_ERRORS='-WX'
2267 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
2269 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2270 # Disable these flags on clang-cl since it doesn't ignore unknown arguments by default, and
2271 # autoconf insists on passing $LDFLAGS to the compiler.
2272 if test -z "$CLANG_CL"; then
2273 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2274 if test -z "$DEVELOPER_OPTIONS"; then
2275 LDFLAGS="$LDFLAGS -RELEASE"
2278 dnl For profile-guided optimization
2279 PROFILE_GEN_CFLAGS="-GL"
2280 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2281 dnl XXX: PGO builds can fail with warnings treated as errors,
2282 dnl specifically "no profile data available" appears to be
2283 dnl treated as an error sometimes. This might be a consequence
2284 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2285 dnl with the linker doing most of the work in the whole-program
2286 dnl optimization/PGO case. I think it's probably a compiler bug,
2287 dnl but we work around it here.
2288 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2289 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2290 dnl Probably also a compiler bug, but what can you do?
2291 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2292 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2293 dnl Minimum reqiurement of Gecko is VS2010 or later which supports
2294 dnl both SSSE3 and SSE4.1.
2295 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2296 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
2297 if test "$_CC_SUITE" -ge "11"; then
2298 dnl allow AVX2 code from VS2012
2303 AC_DEFINE(HAVE_SNPRINTF)
2308 AC_DEFINE(HW_THREADS)
2309 AC_DEFINE(STDC_HEADERS)
2310 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2311 TARGET_MD_ARCH=win32
2312 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2314 MOZ_USER_DIR="Mozilla"
2316 dnl Hardcode to win95 for now - cls
2317 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2319 dnl set NO_X11 defines here as the general check is skipped on win32
2325 if test -n "$L10NBASEDIR"; then
2326 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2333 if test -z "$MOZ_TOOLS"; then
2334 AC_MSG_ERROR([MOZ_TOOLS is not set])
2336 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2337 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2338 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2340 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2341 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2342 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2349 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.])
2355 if test "$HAVE_64BIT_BUILD"; then
2356 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2359 if test -n "$GNU_CC"; then
2360 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2361 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2362 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2364 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2365 # Disable this flag on clang-cl since it doesn't ignore unknown arguments by default, and
2366 # autoconf insists on passing $LDFLAGS to the compiler.
2367 if test -z "$CLANG_CL"; then
2368 LDFLAGS="$LDFLAGS -SAFESEH"
2375 if test -n "$_WIN32_MSVC"; then
2376 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2381 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2388 CFLAGS="$CFLAGS -Dunix"
2389 CXXFLAGS="$CXXFLAGS -Dunix"
2390 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2392 DSO_PIC_CFLAGS='-fPIC -DPIC'
2393 DSO_LDOPTS='-shared'
2394 BIN_FLAGS='-Wl,--export-dynamic'
2396 DSO_PIC_CFLAGS='-fPIC -DPIC'
2397 DLL_SUFFIX=".so.1.0"
2398 DSO_LDOPTS='-shared'
2400 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2401 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2402 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2403 if test "$LIBRUNPATH"; then
2404 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2406 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2407 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2411 if test "$SO_VERSION"; then
2412 DLL_SUFFIX=".so.$SO_VERSION"
2414 DLL_SUFFIX=".so.1.0"
2416 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2418 DSO_PIC_CFLAGS='-fPIC'
2419 DSO_LDOPTS='-shared -fPIC'
2420 if test "$LIBRUNPATH"; then
2421 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2427 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2429 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2430 # libraries one level up (e.g. libnspr4.so)
2431 if test "$SOLARIS_SUNPRO_CC"; then
2432 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2433 LIBS="-lCrun -lCstd -lc $LIBS"
2434 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2435 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2436 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2437 LDFLAGS="-xildoff $LDFLAGS"
2438 MMX_FLAGS="-xarch=mmx -xO4"
2439 SSE_FLAGS="-xarch=sse"
2440 SSE2_FLAGS="-xarch=ssei2 -xO4"
2441 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2442 _SAVE_LDFLAGS=$LDFLAGS
2443 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2444 AC_TRY_LINK([#include <stdio.h>],
2445 [printf("Hello World\n");],
2447 [LDFLAGS=$_SAVE_LDFLAGS])
2449 MOZ_OPTIMIZE_FLAGS="-xO4"
2450 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2451 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2452 MKSHLIB_FORCE_ALL='-z allextract'
2453 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2460 AS='/usr/ccs/bin/as'
2461 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2463 TARGET_COMPILER_ABI="sunc"
2464 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2465 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2466 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2470 [#if (__SUNPRO_CC < 0x590)
2473 _BAD_COMPILER=,_BAD_COMPILER=1)
2474 if test -n "$_BAD_COMPILER"; then
2476 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2481 [#if (__SUNPRO_CC >= 0x5100)
2482 #error "Sun C++ 5.10 or above"
2484 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2485 if test "$_ABOVE_SS12U1"; then
2487 CXXFLAGS="$CXXFLAGS -xannotate=no"
2489 AC_MSG_RESULT([$_res])
2492 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2494 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2495 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2496 ASFLAGS="$ASFLAGS -fPIC"
2497 DSO_LDOPTS='-shared'
2498 WARNINGS_AS_ERRORS='-Werror'
2500 _WARNINGS_CXXFLAGS=''
2501 if test "$OS_RELEASE" = "5.3"; then
2502 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2505 if test "$OS_RELEASE" = "5.5.1"; then
2506 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2511 DSO_LDOPTS='-Bdynamic'
2512 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2513 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2515 AC_DEFINE(SPRINTF_RETURNS_STRING)
2516 case "$(target_os)" in
2518 DLL_SUFFIX='.so.1.0'
2525 AC_SUBST_LIST(MMX_FLAGS)
2526 AC_SUBST_LIST(SSE_FLAGS)
2527 AC_SUBST_LIST(SSE2_FLAGS)
2531 # Includes linux-android
2536 AC_SUBST(MOZ_LINKER)
2537 if test -n "$MOZ_LINKER"; then
2538 AC_DEFINE(MOZ_LINKER)
2541 dnl Only one oddball right now (QNX), but this gives us flexibility
2542 dnl if any other platforms need to override this in the future.
2543 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2545 dnl ========================================================
2546 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2547 dnl by now will not have any way to link most binaries (tests
2548 dnl as well as viewer, apprunner, etc.), because some symbols
2549 dnl will be left out of the "composite" .so's by ld as unneeded.
2550 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2551 dnl they can link in the static libs that provide the missing
2553 dnl ========================================================
2554 NO_LD_ARCHIVE_FLAGS=
2555 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2556 NO_LD_ARCHIVE_FLAGS=1
2560 NO_LD_ARCHIVE_FLAGS=
2563 if test -z "$GNU_CC"; then
2564 NO_LD_ARCHIVE_FLAGS=
2568 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2570 dnl ========================================================
2571 dnl = Flags to strip unused symbols from .so components and
2572 dnl = to export jemalloc symbols when linking a program
2573 dnl ========================================================
2575 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2576 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2579 if test -z "$GNU_CC"; then
2580 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2582 if test -z "$GCC_USE_GNU_LD"; then
2583 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2585 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2590 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2593 if test -n "$GNU_CC"; then
2594 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2599 if test -z "$COMPILE_ENVIRONMENT"; then
2600 SKIP_COMPILER_CHECKS=1
2601 SKIP_LIBRARY_CHECKS=1
2606 if test -z "$SKIP_COMPILER_CHECKS"; then
2607 dnl Checks for typedefs, structures, and compiler characteristics.
2608 dnl ========================================================
2624 dnl Check for .hidden assembler directive and visibility attribute.
2625 dnl Borrowed from glibc configure.in
2626 dnl ===============================================================
2627 if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
2628 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2629 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2630 case "$OS_TARGET" in
2632 VISIBILITY_FLAGS='-fvisibility=hidden'
2635 case $GCC_VERSION in
2637 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden_dso_handle.h'
2640 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden.h'
2643 WRAP_SYSTEM_INCLUDES=1
2648 # visibility hidden flag for Sun Studio on Solaris
2649 if test "$SOLARIS_SUNPRO_CC"; then
2650 VISIBILITY_FLAGS='-xldscope=hidden'
2651 fi # Sun Studio on Solaris
2653 case "${OS_TARGET}" in
2654 WINNT|Darwin|Android)
2657 STL_FLAGS='-I$(DIST)/stl_wrappers'
2662 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2663 AC_SUBST(VISIBILITY_FLAGS)
2667 if test "$OS_TARGET" != WINNT; then
2668 # Only run this test with clang on non-Windows platforms, because clang
2669 # cannot do enough code gen for now to make this test work correctly.
2673 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2674 dnl ========================================================
2675 if test "$GNU_CC"; then
2676 CFLAGS_save="${CFLAGS}"
2677 CFLAGS="${CFLAGS} -Werror"
2678 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2679 ac_cv_force_align_arg_pointer,
2680 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2682 ac_cv_force_align_arg_pointer="yes",
2683 ac_cv_force_align_arg_pointer="no")])
2684 CFLAGS="${CFLAGS_save}"
2685 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2686 HAVE_GCC_ALIGN_ARG_POINTER=1
2688 HAVE_GCC_ALIGN_ARG_POINTER=
2691 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2693 dnl Checks for header files.
2694 dnl ========================================================
2696 case "$target_os" in
2698 # for stuff like -lXshm
2699 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2702 MOZ_CHECK_COMMON_HEADERS
2704 dnl These are all the places some variant of statfs can be hiding.
2705 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2708 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2709 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2711 dnl SCTP support - needs various network include headers
2712 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2714 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2716 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2717 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2718 ac_cv_sockaddr_in_sin_len,
2719 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2720 #include <sys/types.h>
2722 #include <netinet/in.h>
2723 struct sockaddr_in x;
2724 void *foo = (void*) &x.sin_len;],
2726 [ac_cv_sockaddr_in_sin_len=true],
2727 [ac_cv_sockaddr_in_sin_len=false])])
2728 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2729 AC_DEFINE(HAVE_SIN_LEN)
2730 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2731 AC_DEFINE(HAVE_SCONN_LEN)
2734 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2735 ac_cv_sockaddr_in6_sin6_len,
2736 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2737 #include <sys/types.h>
2739 #include <netinet/in.h>
2740 struct sockaddr_in6 x;
2741 void *foo = (void*) &x.sin6_len;],
2743 [ac_cv_sockaddr_in6_sin6_len=true],
2744 [ac_cv_sockaddr_in6_sin6_len=false])])
2745 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2746 AC_DEFINE(HAVE_SIN6_LEN)
2749 AC_CACHE_CHECK(for sockaddr.sa_len,
2750 ac_cv_sockaddr_sa_len,
2751 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2752 #include <sys/types.h>
2754 #include <sys/socket.h>
2756 void *foo = (void*) &x.sa_len;],
2758 [ac_cv_sockaddr_sa_len=true],
2759 [ac_cv_sockaddr_sa_len=false])])
2760 if test "$ac_cv_sockaddr_sa_len" = true ; then
2761 AC_DEFINE(HAVE_SA_LEN)
2764 MOZ_ARG_ENABLE_BOOL(dtrace,
2765 [ --enable-dtrace build with dtrace support if available (default=no)],
2766 [enable_dtrace="yes"],)
2767 if test "x$enable_dtrace" = "xyes"; then
2768 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2769 if test -n "$HAVE_DTRACE"; then
2770 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2772 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2775 AC_SUBST(HAVE_DTRACE)
2781 MOZ_CHECK_HEADERS(sys/cdefs.h)
2785 MOZ_LINUX_PERF_EVENT
2787 dnl Checks for libraries.
2788 dnl ========================================================
2793 AC_CHECK_LIB(c_r, gethostbyname_r)
2797 dnl We don't want to link with libdl even if it's present on OS X, since
2798 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2800 dnl We don't want to link against libm or libpthread on Darwin since
2801 dnl they both are just symlinks to libSystem and explicitly linking
2802 dnl against libSystem causes issues when debugging (see bug 299601).
2807 AC_SEARCH_LIBS(dlopen, dl,
2808 MOZ_CHECK_HEADER(dlfcn.h,
2809 AC_DEFINE(HAVE_DLOPEN)))
2813 _SAVE_CFLAGS="$CFLAGS"
2814 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2815 AC_CHECK_FUNCS(dladdr memmem)
2816 CFLAGS="$_SAVE_CFLAGS"
2818 if test ! "$GNU_CXX"; then
2822 AC_CHECK_LIB(C_r, demangle)
2825 AC_CHECK_LIB(C, demangle)
2830 AC_CHECK_LIB(socket, socket)
2833 XLIBS="$X_EXTRA_LIBS"
2835 dnl ========================================================
2836 dnl Checks for X libraries.
2837 dnl Ordering is important.
2838 dnl Xt is dependent upon SM as of X11R6
2839 dnl ========================================================
2840 if test "$no_x" = "yes"; then
2843 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2844 XLIBS="-lX11 $XLIBS"
2845 _SAVE_LDFLAGS="$LDFLAGS"
2846 LDFLAGS="$XLDFLAGS $LDFLAGS"
2847 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2848 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2849 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2850 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2852 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2853 unset ac_cv_lib_Xt_XtFree
2854 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2855 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
2856 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2857 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2860 # AIX needs the motif library linked before libXt to prevent
2861 # crashes in plugins linked against Motif - Bug #98892
2862 case "${target_os}" in
2864 XT_LIBS="-lXm $XT_LIBS"
2868 dnl ========================================================
2869 dnl = Check for XShm
2870 dnl ========================================================
2871 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
2874 dnl ========================================================
2876 dnl ========================================================
2877 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
2878 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
2879 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
2880 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
2882 LDFLAGS="$_SAVE_LDFLAGS"
2885 AC_SUBST_LIST(XCFLAGS)
2886 AC_SUBST_LIST(XLDFLAGS)
2887 AC_SUBST_LIST(XLIBS)
2888 AC_SUBST_LIST(XEXT_LIBS)
2889 AC_SUBST_LIST(XT_LIBS)
2890 AC_SUBST_LIST(XSS_LIBS)
2892 dnl ========================================================
2893 dnl = pthread support
2894 dnl = Start by checking whether the system support pthreads
2895 dnl ========================================================
2896 case "$target_os" in
2901 AC_CHECK_LIB(pthreads, pthread_create,
2902 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2903 AC_CHECK_LIB(pthread, pthread_create,
2904 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2905 AC_CHECK_LIB(c_r, pthread_create,
2906 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2907 AC_CHECK_LIB(c, pthread_create,
2916 dnl ========================================================
2917 dnl Check the command line for --with-pthreads
2918 dnl ========================================================
2919 MOZ_ARG_WITH_BOOL(pthreads,
2920 [ --with-pthreads Force use of system pthread library with NSPR ],
2921 [ if test "$MOZ_USE_PTHREADS"x = x; then
2922 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2928 dnl ========================================================
2929 dnl Do the platform specific pthread hackery
2930 dnl ========================================================
2931 if test "$MOZ_USE_PTHREADS"x != x
2934 dnl See if -pthread is supported.
2937 ac_cv_have_dash_pthread=no
2938 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2939 echo 'int main() { return 0; }' | cat > conftest.c
2940 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2941 if test $? -eq 0; then
2942 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2943 ac_cv_have_dash_pthread=yes
2944 case "$target_os" in
2946 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2949 CFLAGS="$CFLAGS -pthread"
2950 CXXFLAGS="$CXXFLAGS -pthread"
2956 AC_MSG_RESULT($ac_cv_have_dash_pthread)
2959 dnl See if -pthreads is supported.
2961 ac_cv_have_dash_pthreads=no
2962 if test "$ac_cv_have_dash_pthread" = "no"; then
2963 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2964 echo 'int main() { return 0; }' | cat > conftest.c
2965 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2966 if test $? -eq 0; then
2967 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2968 ac_cv_have_dash_pthreads=yes
2969 CFLAGS="$CFLAGS -pthreads"
2970 CXXFLAGS="$CXXFLAGS -pthreads"
2974 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2979 AC_DEFINE(_REENTRANT)
2980 AC_DEFINE(_THREAD_SAFE)
2981 dnl -pthread links in -lpthread, so don't specify it explicitly.
2982 if test "$ac_cv_have_dash_pthread" = "yes"; then
2983 _PTHREAD_LDFLAGS="-pthread"
2987 *-*-openbsd*|*-*-bsdi*)
2988 AC_DEFINE(_REENTRANT)
2989 AC_DEFINE(_THREAD_SAFE)
2990 dnl -pthread links in -lc_r, so don't specify it explicitly.
2991 if test "$ac_cv_have_dash_pthread" = "yes"; then
2992 _PTHREAD_LDFLAGS="-pthread"
2996 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
2997 AC_DEFINE(_REENTRANT)
3001 AC_DEFINE(_REENTRANT)
3005 AC_DEFINE(_REENTRANT)
3009 AC_DEFINE(_REENTRANT)
3010 if test "$SOLARIS_SUNPRO_CC"; then
3011 CFLAGS="$CFLAGS -mt"
3012 CXXFLAGS="$CXXFLAGS -mt"
3016 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3017 AC_SUBST(MOZ_USE_PTHREADS)
3021 dnl Checks for library functions.
3022 dnl ========================================================
3023 AC_PROG_GCC_TRADITIONAL
3025 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r arc4random arc4random_buf)
3027 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3028 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3029 ac_cv_clock_monotonic,
3030 [for libs in "" -lrt; do
3033 AC_TRY_LINK([#include <time.h>],
3034 [ struct timespec ts;
3035 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3036 ac_cv_clock_monotonic=$libs
3039 ac_cv_clock_monotonic=no)
3042 if test "$ac_cv_clock_monotonic" != "no"; then
3043 HAVE_CLOCK_MONOTONIC=1
3044 REALTIME_LIBS=$ac_cv_clock_monotonic
3045 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3046 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3047 AC_SUBST_LIST(REALTIME_LIBS)
3050 dnl check for wcrtomb/mbrtowc
3051 dnl =======================================================================
3052 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3055 AC_CACHE_CHECK(for wcrtomb,
3057 [AC_TRY_LINK([#include <wchar.h>],
3058 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3059 ac_cv_have_wcrtomb="yes",
3060 ac_cv_have_wcrtomb="no")])
3061 if test "$ac_cv_have_wcrtomb" = "yes"; then
3062 AC_DEFINE(HAVE_WCRTOMB)
3064 AC_CACHE_CHECK(for mbrtowc,
3066 [AC_TRY_LINK([#include <wchar.h>],
3067 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3068 ac_cv_have_mbrtowc="yes",
3069 ac_cv_have_mbrtowc="no")])
3070 if test "$ac_cv_have_mbrtowc" = "yes"; then
3071 AC_DEFINE(HAVE_MBRTOWC)
3078 ac_cv_func_res_ninit,
3079 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
3080 dnl no need for res_ninit() on NetBSD and OpenBSD
3081 ac_cv_func_res_ninit=no
3085 #define _BSD_SOURCE 1
3087 #include <sys/types.h>
3088 #include <netinet/in.h>
3089 #include <arpa/nameser.h>
3092 [int foo = res_ninit(&_res);],
3093 [ac_cv_func_res_ninit=yes],
3094 [ac_cv_func_res_ninit=no])
3098 if test "$ac_cv_func_res_ninit" = "yes"; then
3099 AC_DEFINE(HAVE_RES_NINIT)
3100 dnl must add the link line we do something as foolish as this... dougt
3102 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3103 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3115 AC_CHECK_LIB(c, iconv, [ICONV_LIBS=],
3116 AC_CHECK_LIB(iconv, iconv, [ICONV_LIBS="-liconv"],
3117 AC_CHECK_LIB(iconv, libiconv, [ICONV_LIBS="-liconv"])))
3119 LIBS="$LIBS $ICONV_LIBS"
3128 iconv_t h = iconv_open("", "");
3129 iconv(h, NULL, NULL, NULL, NULL);
3132 [ac_cv_func_iconv=yes],
3133 [ac_cv_func_iconv=no]
3136 if test "$ac_cv_func_iconv" = "yes"; then
3137 AC_DEFINE(HAVE_ICONV)
3138 LIBICONV="$ICONV_LIBS"
3140 [for iconv() with const input],
3141 ac_cv_func_const_iconv,
3147 const char *input = "testing";
3148 iconv_t h = iconv_open("", "");
3149 iconv(h, &input, NULL, NULL, NULL);
3152 [ac_cv_func_const_iconv=yes],
3153 [ac_cv_func_const_iconv=no]
3156 if test "$ac_cv_func_const_iconv" = "yes"; then
3157 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3165 AC_SUBST_LIST(ICONV_LIBS)
3171 dnl **********************
3172 dnl *** va_copy checks ***
3173 AC_CACHE_CHECK([for an implementation of va_copy()],
3175 [AC_TRY_COMPILE([#include <stdarg.h>
3177 void f (int i, ...) {
3178 va_list args1, args2;
3179 va_start (args1, i);
3180 va_copy (args2, args1);
3181 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3183 va_end (args1); va_end (args2);
3185 [f(0, 42); return 0],
3186 [ac_cv_va_copy=yes],
3190 AC_CACHE_CHECK([whether va_list can be copied by value],
3192 [AC_TRY_COMPILE([#include <stdarg.h>
3194 void f (int i, ...) {
3195 va_list args1, args2;
3196 va_start (args1, i);
3198 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3200 va_end (args1); va_end (args2);
3202 [f(0, 42); return 0],
3203 [ac_cv_va_val_copy=yes],
3204 [ac_cv_va_val_copy=no],
3207 if test "x$ac_cv_va_copy" = "xyes"; then
3208 AC_DEFINE(VA_COPY, va_copy)
3209 AC_DEFINE(HAVE_VA_COPY)
3212 if test "x$ac_cv_va_val_copy" = "xno"; then
3213 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3216 dnl ===================================================================
3217 dnl ========================================================
3218 dnl Put your C++ language/feature checks below
3219 dnl ========================================================
3223 if test "$GNU_CC"; then
3224 if test "$CPU_ARCH" = "arm" ; then
3225 AC_CACHE_CHECK(for ARM EABI,
3229 #if defined(__ARM_EABI__)
3232 #error Not ARM EABI.
3235 ac_cv_gcc_arm_eabi="yes",
3236 ac_cv_gcc_arm_eabi="no")])
3237 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3239 ARM_ABI_PREFIX=eabi-
3241 ARM_ABI_PREFIX=oabi-
3245 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3248 dnl Check to see if we can resolve ambiguity with |using|.
3249 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3250 ac_cv_cpp_ambiguity_resolving_using,
3251 [AC_TRY_COMPILE(class X {
3252 public: int go(const X&) {return 3;}
3253 int jo(const X&) {return 3;}
3255 class Y : public X {
3256 public: int go(int) {return 2;}
3257 int jo(int) {return 2;}
3259 private: using X::go;
3262 ac_cv_cpp_ambiguity_resolving_using=yes,
3263 ac_cv_cpp_ambiguity_resolving_using=no)])
3264 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3265 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3268 dnl See if a dynamic_cast to void* gives the most derived object.
3269 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3270 ac_cv_cpp_dynamic_cast_void_ptr,
3271 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3272 class Y { int j; public: virtual ~Y() { } };
3273 class Z : public X, public Y { int k; };
3279 return !((((void*)&mdo != (void*)subx) &&
3280 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3281 (((void*)&mdo != (void*)suby) &&
3282 ((void*)&mdo == dynamic_cast<void*>(suby))));
3284 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3285 ac_cv_cpp_dynamic_cast_void_ptr=no,
3286 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3287 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3288 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3291 dnl note that this one is reversed - if the test fails, then
3292 dnl we require implementations of unused virtual methods. Which
3293 dnl really blows because it means we'll have useless vtable
3295 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3296 ac_cv_cpp_unused_required,
3297 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3299 ac_cv_cpp_unused_required=no,
3300 ac_cv_cpp_unused_required=yes)])
3301 if test "$ac_cv_cpp_unused_required" = yes ; then
3302 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3306 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3307 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3308 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3310 _SAVE_LDFLAGS=$LDFLAGS
3311 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3312 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3313 ac_cv_thread_keyword,
3314 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3315 [return tlsIsMainThread;],
3316 ac_cv_thread_keyword=yes,
3317 ac_cv_thread_keyword=no)])
3318 LDFLAGS=$_SAVE_LDFLAGS
3319 # The custom dynamic linker doesn't support TLS variables
3321 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3322 # mips builds fail with TLS variables because of a binutils bug.
3324 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3329 *-android*|*-linuxandroid*)
3336 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3342 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3343 if test -n "$MOZ_LINKER"; then
3344 if test "$CPU_ARCH" = arm; then
3345 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3346 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3347 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3348 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3352 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
3353 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
3354 dnl Since the linker only understands the sysv ones, no need to build the
3355 dnl gnu style tables anyways.
3356 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
3359 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3360 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3361 dnl We however want to avoid these text relocations, and this can be done
3362 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3363 dnl doesn't contain anything at all, beside placeholders for some sections,
3364 dnl and crtbegin only contains a finalizer function that calls
3365 dnl __cxa_finalize. The custom linker actually takes care of calling
3366 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3367 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3368 dnl link crtbegin and crtend at all.
3369 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3370 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3371 ac_cv_crt_has_text_relocations,
3372 [echo 'int foo() { return 0; }' > conftest.cpp
3373 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3374 test -s conftest${DLL_SUFFIX}; then
3375 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3376 ac_cv_crt_has_text_relocations=yes
3378 ac_cv_crt_has_text_relocations=no
3381 AC_ERROR([couldn't compile a simple C file])
3384 if test "$ac_cv_crt_has_text_relocations" = yes; then
3385 dnl While we want libraries to skip the CRT files, we don't want
3386 dnl executables to be treated the same way. We thus set the flag
3387 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3388 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3389 dnl Using LDFLAGS in nspr is safe, since we only really build
3390 dnl libraries there.
3391 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3392 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3396 dnl Check for the existence of various allocation headers/functions
3398 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3401 for file in $MALLOC_HEADERS; do
3402 MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3403 if test "$MALLOC_H" != ""; then
3404 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3409 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3411 AC_CHECK_FUNCS(malloc_usable_size)
3413 dnl See if compiler supports some gcc-style attributes
3415 AC_CACHE_CHECK(for __attribute__((always_inline)),
3416 ac_cv_attribute_always_inline,
3417 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3419 ac_cv_attribute_always_inline=yes,
3420 ac_cv_attribute_always_inline=no)])
3422 AC_CACHE_CHECK(for __attribute__((malloc)),
3423 ac_cv_attribute_malloc,
3424 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3426 ac_cv_attribute_malloc=yes,
3427 ac_cv_attribute_malloc=no)])
3429 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3430 ac_cv_attribute_warn_unused,
3431 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3433 ac_cv_attribute_warn_unused=yes,
3434 ac_cv_attribute_warn_unused=no)])
3436 dnl End of C++ language/feature checks
3439 dnl ========================================================
3440 dnl = Internationalization checks
3441 dnl ========================================================
3443 dnl Internationalization and Locale support is different
3444 dnl on various UNIX platforms. Checks for specific i18n
3445 dnl features go here.
3447 dnl check for LC_MESSAGES
3448 AC_CACHE_CHECK(for LC_MESSAGES,
3449 ac_cv_i18n_lc_messages,
3450 [AC_TRY_COMPILE([#include <locale.h>],
3451 [int category = LC_MESSAGES;],
3452 ac_cv_i18n_lc_messages=yes,
3453 ac_cv_i18n_lc_messages=no)])
3454 if test "$ac_cv_i18n_lc_messages" = yes; then
3455 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3458 AC_HAVE_FUNCS(localeconv)
3459 fi # ! SKIP_COMPILER_CHECKS
3462 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3463 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3464 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
3467 dnl Mozilla specific options
3468 dnl ========================================================
3469 dnl The macros used for command line options
3470 dnl are defined in build/autoconf/altoptions.m4.
3472 dnl If the compiler supports these attributes, define them as
3473 dnl convenience macros.
3474 if test "$ac_cv_attribute_malloc" = yes ; then
3475 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3477 AC_DEFINE(NS_ATTR_MALLOC,)
3480 if test "$ac_cv_attribute_warn_unused" = yes ; then
3481 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3483 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3486 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3487 dnl features that Windows actually does support.
3489 if test -n "$SKIP_COMPILER_CHECKS"; then
3490 dnl Windows has malloc.h
3491 AC_DEFINE(MALLOC_H, [<malloc.h>])
3492 AC_DEFINE(HAVE_FORCEINLINE)
3493 AC_DEFINE(HAVE_LOCALECONV)
3494 fi # SKIP_COMPILER_CHECKS
3496 dnl ========================================================
3498 dnl = Check for external package dependencies
3500 dnl ========================================================
3501 MOZ_ARG_HEADER(External Packages)
3503 MOZ_ARG_WITH_STRING(libxul-sdk,
3504 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3505 AC_MSG_ERROR([--with-libxul-sdk is not supported anymore.]))
3507 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3508 AC_SUBST(LIBXUL_DIST)
3512 dnl set GRE_MILESTONE
3513 dnl ========================================================
3514 if test -n "$LIBXUL_SDK"; then
3515 GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3517 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3519 AC_SUBST(GRE_MILESTONE)
3521 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3522 # The logic works like this:
3523 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3524 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3525 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3526 case "$GRE_MILESTONE" in
3529 AC_DEFINE(NIGHTLY_BUILD)
3535 AC_DEFINE(RELEASE_BUILD)
3538 AC_SUBST(NIGHTLY_BUILD)
3539 AC_SUBST(RELEASE_BUILD)
3541 dnl ========================================================
3542 dnl Disable compiling sources in unified mode.
3543 dnl ========================================================
3545 if test -z "$NIGHTLY_BUILD"; then
3546 MOZ_DISABLE_UNIFIED_COMPILATION=1
3549 MOZ_ARG_DISABLE_BOOL(unified-compilation,
3550 [ --disable-unified-compilation
3551 Disable unified compilation of some C/C++ sources],
3552 MOZ_DISABLE_UNIFIED_COMPILATION=1,
3553 MOZ_DISABLE_UNIFIED_COMPILATION=)
3554 AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
3556 dnl ========================================================
3557 dnl Multiprocess Firefox Nightly Testing UI
3558 dnl To be removed in Bug 1003313
3559 dnl ========================================================
3560 if test -n "$NIGHTLY_BUILD"; then
3562 AC_DEFINE(E10S_TESTING_ONLY)
3565 AC_SUBST(E10S_TESTING_ONLY)
3567 dnl ========================================================
3568 dnl system libevent Support
3569 dnl ========================================================
3570 MOZ_ARG_WITH_STRING(system-libevent,
3571 [ --with-system-libevent[=PFX]
3572 Use system libevent [installed at prefix PFX]],
3573 LIBEVENT_DIR=$withval)
3575 _SAVE_CFLAGS=$CFLAGS
3576 _SAVE_LDFLAGS=$LDFLAGS
3578 if test "$LIBEVENT_DIR" = yes; then
3579 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3580 MOZ_NATIVE_LIBEVENT=1,
3583 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3584 MOZ_NATIVE_LIBEVENT=
3585 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3586 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3587 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3588 MOZ_CHECK_HEADER(event.h,
3589 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3590 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3592 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3593 AC_CHECK_LIB(event, event_init,
3594 [MOZ_NATIVE_LIBEVENT=1
3595 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3596 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3597 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3599 CFLAGS=$_SAVE_CFLAGS
3600 LDFLAGS=$_SAVE_LDFLAGS
3603 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3605 dnl ========================================================
3606 dnl = If NSS was not detected in the system,
3607 dnl = use the one in the source tree (mozilla/security/nss)
3608 dnl ========================================================
3610 MOZ_ARG_WITH_BOOL(system-nss,
3611 [ --with-system-nss Use system installed NSS],
3614 if test -n "$_USE_SYSTEM_NSS"; then
3615 AM_PATH_NSS(3.17.2, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3618 if test -n "$MOZ_NATIVE_NSS"; then
3619 NSS_LIBS="$NSS_LIBS -lcrmf"
3621 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3623 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
3625 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3626 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3627 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3628 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3629 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3631 NSS_LIBS='-L$(LIBXUL_DIST)/lib'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3635 dnl ======================
3637 dnl ======================
3639 AC_MSG_CHECKING([for YASM assembler])
3640 AC_CHECK_PROGS(YASM, yasm, "")
3642 if test -n "$YASM"; then
3643 dnl Pull out yasm's version string
3644 YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3645 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3646 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3647 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3648 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3651 if test -z "$SKIP_LIBRARY_CHECKS"; then
3652 dnl system JPEG support
3653 dnl ========================================================
3654 MOZ_ARG_WITH_STRING(system-jpeg,
3655 [ --with-system-jpeg[=PFX]
3656 Use system libjpeg [installed at prefix PFX]],
3659 _SAVE_CFLAGS=$CFLAGS
3660 _SAVE_LDFLAGS=$LDFLAGS
3662 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3663 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3664 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3666 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3669 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3672 if test "$MOZ_NATIVE_JPEG" = 1; then
3673 AC_TRY_COMPILE([ #include <stdio.h>
3674 #include <sys/types.h>
3675 #include <jpeglib.h> ],
3676 [ #if JPEG_LIB_VERSION < $MOZJPEG
3677 #error "Insufficient JPEG library version ($MOZJPEG required)."
3679 #ifndef JCS_EXTENSIONS
3680 #error "libjpeg-turbo JCS_EXTENSIONS required"
3684 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3686 CFLAGS=$_SAVE_CFLAGS
3687 LDFLAGS=$_SAVE_LDFLAGS
3690 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3691 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3692 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3694 fi # SKIP_LIBRARY_CHECKS
3696 dnl system ZLIB support
3697 dnl ========================================================
3698 MOZ_ZLIB_CHECK([1.2.3])
3700 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
3701 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
3706 if test -z "$SKIP_LIBRARY_CHECKS"; then
3707 dnl system BZIP2 Support
3708 dnl ========================================================
3709 MOZ_ARG_WITH_STRING(system-bz2,
3710 [ --with-system-bz2[=PFX]
3711 Use system libbz2 [installed at prefix PFX]],
3714 _SAVE_CFLAGS=$CFLAGS
3715 _SAVE_LDFLAGS=$LDFLAGS
3717 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
3718 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
3719 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
3721 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
3724 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
3725 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
3727 CFLAGS=$_SAVE_CFLAGS
3728 LDFLAGS=$_SAVE_LDFLAGS
3731 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
3732 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
3733 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
3736 dnl ========================================================
3737 dnl system PNG Support
3738 dnl ========================================================
3739 MOZ_ARG_WITH_STRING(system-png,
3740 [ --with-system-png[=PFX]
3741 Use system libpng [installed at prefix PFX]],
3744 _SAVE_CFLAGS=$CFLAGS
3745 _SAVE_LDFLAGS=$LDFLAGS
3747 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
3748 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
3749 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
3751 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
3754 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
3755 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3756 AC_CHECK_LIB(png, png_get_acTL, ,
3757 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
3759 if test "$MOZ_NATIVE_PNG" = 1; then
3760 AC_TRY_COMPILE([ #include <stdio.h>
3761 #include <sys/types.h>
3763 [ #if PNG_LIBPNG_VER < $MOZPNG
3764 #error "Insufficient libpng version ($MOZPNG required)."
3766 #ifndef PNG_UINT_31_MAX
3767 #error "Insufficient libpng version."
3770 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3772 CFLAGS=$_SAVE_CFLAGS
3773 LDFLAGS=$_SAVE_LDFLAGS
3776 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
3777 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
3778 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
3781 MOZ_PNG_ARM_NEON_CHECK=
3782 if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
3783 MOZ_ARG_ENABLE_STRING(png-arm-neon-support,
3784 [ --enable-png-arm-neon-support=TYPE
3788 nocheck (faster but unsafe)],
3789 [MOZ_PNG_ARM_NEON_SUPPORT=$enableval ] )
3790 case "$MOZ_PNG_ARM_NEON_SUPPORT" in
3792 # enable-png-arm-neon-support = no
3795 # enable-png-arm-neon-support = nocheck
3800 MOZ_PNG_ARM_NEON_CHECK=1
3805 AC_SUBST(MOZ_PNG_ARM_NEON_CHECK)
3807 fi # SKIP_LIBRARY_CHECKS
3809 AC_SUBST(MOZ_PNG_ARM_NEON)
3811 dnl ========================================================
3812 dnl system HunSpell Support
3813 dnl ========================================================
3814 MOZ_ARG_ENABLE_BOOL(system-hunspell,
3815 [ --enable-system-hunspell
3816 Use system hunspell (located with pkgconfig)],
3817 MOZ_NATIVE_HUNSPELL=1 )
3819 if test -n "$MOZ_NATIVE_HUNSPELL"; then
3820 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
3823 AC_SUBST(MOZ_NATIVE_HUNSPELL)
3825 dnl ========================================================
3826 dnl system libffi Support
3827 dnl ========================================================
3830 MOZ_ARG_ENABLE_BOOL(shared-js,
3831 [ --enable-shared-js
3832 Create a shared JavaScript library.],
3833 JS_SHARED_LIBRARY=1,
3836 dnl ========================================================
3837 dnl Java SDK support
3838 dnl ========================================================
3841 MOZ_ARG_WITH_STRING(java-bin-path,
3842 [ --with-java-bin-path=dir
3843 Location of Java binaries (java, javac, jar)],
3844 JAVA_BIN_PATH=$withval)
3846 dnl ========================================================
3850 dnl ========================================================
3852 MOZ_ARG_HEADER(Application)
3855 ENABLE_SYSTEM_EXTENSION_DIRS=1
3856 MOZ_BRANDING_DIRECTORY=
3857 MOZ_OFFICIAL_BRANDING=
3860 MOZ_AUTH_EXTENSION=1
3865 MOZ_SAMPLE_TYPE_FLOAT32=
3866 MOZ_SAMPLE_TYPE_S16=
3872 if test -n "$MOZ_FMP4"; then
3882 MOZ_WEBRTC_SIGNALING=
3883 MOZ_WEBRTC_ASSERT_ALWAYS=1
3884 MOZ_WEBRTC_HARDWARE_AEC_NS=
3887 MOZ_MEDIA_NAVIGATOR=
3890 MOZ_VPX_ERROR_CONCEALMENT=
3900 LIBJPEG_TURBO_ASFLAGS=
3901 LIBJPEG_TURBO_X86_ASM=
3902 LIBJPEG_TURBO_X64_ASM=
3903 LIBJPEG_TURBO_ARM_ASM=
3907 MOZ_PREF_EXTENSIONS=1
3908 MOZ_PROFILELOCKING=1
3914 MOZ_TOOLKIT_SEARCH=1
3916 MOZ_UNIVERSALCHARDET=1
3925 NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device"
3926 if test -n "$MOZ_RTSP"; then
3927 NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp"
3931 MOZ_USE_NATIVE_POPUP_WINDOWS=
3932 MOZ_ANDROID_HISTORY=
3935 MOZ_LOCALE_SWITCHER=
3936 MOZ_ANDROID_SEARCH_ACTIVITY=
3937 MOZ_ANDROID_DOWNLOADS_INTEGRATION=
3938 MOZ_ANDROID_MLS_STUMBLER=
3939 MOZ_ANDROID_SHARE_OVERLAY=
3940 MOZ_ANDROID_NEW_TABLET_UI=
3944 MOZ_AUDIO_CHANNEL_MANAGER=
3946 MOZ_CONTENT_SANDBOX=
3950 case "$target_os" in
3953 AC_DEFINE(NS_ENABLE_TSF)
3958 *-android*|*-linuxandroid*)
3959 if test "$CPU_ARCH" = "arm" ; then
3964 MOZ_THEME_FASTSTRIPE=1
3972 MOZ_ARG_WITH_STRING(external-source-dir,
3973 [ --with-external-source-dir=dir
3974 External directory containing additional build files.],
3975 [ EXTERNAL_SOURCE_DIR=$withval])
3976 AC_SUBST(EXTERNAL_SOURCE_DIR)
3978 MOZ_ARG_ENABLE_STRING(application,
3979 [ --enable-application=APP
3983 tools/update-packaging (AUS-related packaging tools)],
3984 [ MOZ_BUILD_APP=$enableval ] )
3986 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
3987 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
3988 XULRUNNER_STUB_NAME=$withval)
3990 if test -z "$XULRUNNER_STUB_NAME"; then
3991 case "$target_os" in
3993 XULRUNNER_STUB_NAME=xulrunner
3996 XULRUNNER_STUB_NAME=xulrunner-stub
3999 AC_SUBST(XULRUNNER_STUB_NAME)
4001 AC_MSG_CHECKING([for application to build])
4002 if test -z "$MOZ_BUILD_APP"; then
4003 AC_MSG_RESULT([browser])
4004 MOZ_BUILD_APP=browser
4006 # "mobile" no longer exists.
4007 if test "$MOZ_BUILD_APP" = "mobile" ; then
4008 AC_MSG_RESULT([none])
4009 AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
4011 # Support comm-central.
4012 if test -n "$EXTERNAL_SOURCE_DIR" ; then
4013 MOZ_BUILD_APP="$EXTERNAL_SOURCE_DIR/$MOZ_BUILD_APP"
4014 MOZ_BUILD_APP=`${PYTHON} -c "import mozpack.path as mozpath; print(mozpath.relpath(\"${MOZ_BUILD_APP}\", \"${srcdir}\"))"`
4016 # We have a valid application only if it has a build.mk file in its top
4018 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4019 AC_MSG_RESULT([none])
4020 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4022 AC_MSG_RESULT([$MOZ_BUILD_APP])
4026 # The app update channel is 'default' when not supplied. The value is used in
4027 # the application's confvars.sh so it must be set before confvars.sh is called.
4028 MOZ_ARG_ENABLE_STRING([update-channel],
4029 [ --enable-update-channel=CHANNEL
4030 Select application update channel (default=default)],
4031 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4033 if test -z "$MOZ_UPDATE_CHANNEL"; then
4034 MOZ_UPDATE_CHANNEL=default
4036 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4037 AC_SUBST(MOZ_UPDATE_CHANNEL)
4039 # Allow to specify a Mozilla API key file that contains the secret key to be
4040 # used for various Mozilla API requests.
4041 MOZ_ARG_WITH_STRING(mozilla-api-keyfile,
4042 [ --with-mozilla-api-keyfile=file Use the secret key contained in the given keyfile for Mozilla API requests],
4043 MOZ_MOZILLA_API_KEY=`cat $withval`)
4044 if test -z "$MOZ_MOZILLA_API_KEY"; then
4045 MOZ_MOZILLA_API_KEY=no-mozilla-api-key
4047 AC_SUBST(MOZ_MOZILLA_API_KEY)
4049 # Allow to specify a Google API key file that contains the secret key to be
4050 # used for various Google API requests.
4051 MOZ_ARG_WITH_STRING(google-api-keyfile,
4052 [ --with-google-api-keyfile=file Use the secret key contained in the given keyfile for Google API requests],
4053 MOZ_GOOGLE_API_KEY=`cat $withval`)
4054 if test -z "$MOZ_GOOGLE_API_KEY"; then
4055 MOZ_GOOGLE_API_KEY=no-google-api-key
4057 AC_SUBST(MOZ_GOOGLE_API_KEY)
4059 # Allow to specify a Google OAuth API key file that contains the client ID and
4060 # the secret key to be used for various Google OAuth API requests.
4061 MOZ_ARG_WITH_STRING(google-oauth-api-keyfile,
4062 [ --with-google-oauth-api-keyfile=file Use the client id and secret key contained in the given keyfile for Google OAuth API requests],
4063 [MOZ_GOOGLE_OAUTH_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
4064 MOZ_GOOGLE_OAUTH_API_KEY=`cat $withval | cut -f 2 -d " "`])
4065 if test -z "$MOZ_GOOGLE_OAUTH_API_CLIENTID"; then
4066 MOZ_GOOGLE_OAUTH_API_CLIENTID=no-google-oauth-api-clientid
4067 MOZ_GOOGLE_OAUTH_API_KEY=no-google-oauth-api-key
4069 AC_SUBST(MOZ_GOOGLE_OAUTH_API_CLIENTID)
4070 AC_SUBST(MOZ_GOOGLE_OAUTH_API_KEY)
4072 # Allow specifying a Bing API key file that contains the client ID and the
4073 # secret key to be used for the Bing Translation API requests.
4074 MOZ_ARG_WITH_STRING(bing-api-keyfile,
4075 [ --with-bing-api-keyfile=file Use the client id and secret key contained in the given keyfile for Bing API requests],
4076 [MOZ_BING_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
4077 MOZ_BING_API_KEY=`cat $withval | cut -f 2 -d " "`])
4078 if test -z "$MOZ_BING_API_CLIENTID"; then
4079 MOZ_BING_API_CLIENTID=no-bing-api-clientid
4080 MOZ_BING_API_KEY=no-bing-api-key
4082 AC_SUBST(MOZ_BING_API_CLIENTID)
4083 AC_SUBST(MOZ_BING_API_KEY)
4085 # Whether to include optional-but-large font files in the final APK.
4086 # We want this in mobile/android/confvars.sh, so it goes early.
4087 MOZ_ARG_DISABLE_BOOL(android-include-fonts,
4088 [ --disable-android-include-fonts
4089 Disable the inclusion of fonts into the final APK],
4090 MOZ_ANDROID_EXCLUDE_FONTS=1)
4092 if test -n "$MOZ_ANDROID_EXCLUDE_FONTS"; then
4093 AC_DEFINE(MOZ_ANDROID_EXCLUDE_FONTS)
4095 AC_SUBST(MOZ_ANDROID_EXCLUDE_FONTS)
4097 # Whether this APK is destined for resource constrained devices.
4098 # We want this in mobile/android/confvars.sh, so it goes early.
4099 MOZ_ARG_ENABLE_BOOL(android-resource-constrained,
4100 [ --enable-android-resource-constrained
4101 Exclude hi-res images and similar from the final APK],
4102 MOZ_ANDROID_RESOURCE_CONSTRAINED=1)
4104 if test -n "$MOZ_ANDROID_RESOURCE_CONSTRAINED"; then
4105 AC_DEFINE(MOZ_ANDROID_RESOURCE_CONSTRAINED)
4107 AC_SUBST(MOZ_ANDROID_RESOURCE_CONSTRAINED)
4109 # Allow the application to influence configure with a confvars.sh script.
4110 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4111 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4112 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4113 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4118 # Allow influencing configure with a defines.sh script.
4119 . "${srcdir}/build/defines.sh"
4121 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
4123 if test "$BUILDING_RELEASE"; then
4124 # Override value in defines.sh, if any
4125 EARLY_BETA_OR_EARLIER=
4126 elif test "$EARLY_BETA_OR_EARLIER"; then
4127 AC_DEFINE(EARLY_BETA_OR_EARLIER)
4129 AC_SUBST(EARLY_BETA_OR_EARLIER)
4131 # Allow the application to provide a subconfigure script
4132 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4133 do_output_subdirs() {
4134 if test -n "$_subconfigure_subdirs"; then
4135 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4137 _subconfigure_subdir="$1"
4138 _subconfigure_config_args="$ac_configure_args"
4140 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4141 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4142 "${srcdir}/build/autoconf/altoptions.m4" \
4143 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4148 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4149 MOZ_ARG_WITH_STRING(app-name,
4150 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4151 WITH_APP_NAME=$withval,
4154 if test -n "$WITH_APP_NAME" ; then
4155 MOZ_APP_NAME="$WITH_APP_NAME"
4158 MOZ_ARG_WITH_STRING(app-basename,
4159 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4160 WITH_APP_BASENAME=$withval,
4163 if test -n "$WITH_APP_BASENAME" ; then
4164 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4167 # Now is a good time to test for logic errors, define mismatches, etc.
4168 case "$MOZ_BUILD_APP" in
4170 if test "$LIBXUL_SDK"; then
4171 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4176 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4177 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4179 case "$MOZ_BUILD_APP" in
4181 AC_DEFINE(MOZ_PHOENIX)
4185 AC_DEFINE(MOZ_XULRUNNER)
4192 AC_DEFINE(MOZ_MULET)
4196 AC_SUBST(MOZ_BUILD_APP)
4197 AC_SUBST(MOZ_PHOENIX)
4198 AC_SUBST(MOZ_XULRUNNER)
4201 AC_SUBST(MOZ_B2G_VERSION)
4203 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4205 case "$OS_TARGET" in
4206 WINNT|Darwin|Android)
4214 dnl ========================================================
4215 dnl Check Android SDK version depending on mobile target.
4216 dnl ========================================================
4218 if test -z "$gonkdir" ; then
4219 # Minimum Android SDK API Level we require.
4220 case "$MOZ_BUILD_APP" in
4222 android_min_api_level=17
4224 *-android*|*-linuxandroid*)
4228 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])
4234 MOZ_ANDROID_SDK($android_min_api_level)
4237 dnl ========================================================
4239 dnl = Toolkit Options
4241 dnl ========================================================
4242 MOZ_ARG_HEADER(Toolkit Options)
4244 dnl ========================================================
4245 dnl = Select the default toolkit
4246 dnl ========================================================
4247 MOZ_ARG_ENABLE_STRING(default-toolkit,
4248 [ --enable-default-toolkit=TK
4249 Select default toolkit
4250 Platform specific defaults:
4251 Mac OS X - cairo-cocoa
4252 Win32 - cairo-windows
4256 [ _DEFAULT_TOOLKIT=$enableval ],
4257 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4259 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4260 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4261 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4262 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4263 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4264 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4265 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4266 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4267 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4269 dnl nglayout only supports building with one toolkit,
4270 dnl so ignore everything after the first comma (",").
4271 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4273 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4276 MOZ_ARG_WITHOUT_BOOL(x,
4277 [ --without-x Build without X11],
4280 dnl ========================================================
4281 dnl = Enable the toolkit as needed =
4282 dnl ========================================================
4286 case "$MOZ_WIDGET_TOOLKIT" in
4289 MOZ_WIDGET_TOOLKIT=windows
4291 MOZ_INSTRUMENT_EVENT_LOOP=1
4292 if test -n "$GNU_CC"; then
4298 MOZ_WIDGET_TOOLKIT=gtk3
4301 MOZ_ENABLE_XREMOTE=1
4302 MOZ_GL_DEFAULT_PROVIDER=GLX
4308 TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4310 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4312 MOZ_INSTRUMENT_EVENT_LOOP=1
4315 cairo-gtk2|cairo-gtk2-x11)
4316 MOZ_WIDGET_TOOLKIT=gtk2
4319 MOZ_ENABLE_XREMOTE=1
4320 MOZ_GL_DEFAULT_PROVIDER=GLX
4326 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4327 TK_LIBS='$(MOZ_GTK2_LIBS)'
4328 AC_DEFINE(MOZ_WIDGET_GTK2)
4330 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4332 MOZ_INSTRUMENT_EVENT_LOOP=1
4336 MOZ_WIDGET_TOOLKIT=qt
4338 if test -z "$WITHOUT_X11"; then
4339 MOZ_ENABLE_XREMOTE=1
4340 MOZ_GL_DEFAULT_PROVIDER=GLX
4347 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4348 TK_LIBS='$(MOZ_QT_LIBS)'
4349 AC_DEFINE(MOZ_WIDGET_QT)
4351 AC_DEFINE(QT_NO_KEYWORDS)
4355 MOZ_WIDGET_TOOLKIT=cocoa
4356 AC_DEFINE(MOZ_WIDGET_COCOA)
4357 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4358 # Use -Wl as a trick to avoid -framework and framework names from
4359 # being separated by AC_SUBST_LIST.
4360 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'
4361 TK_CFLAGS="-DNO_X11"
4362 CFLAGS="$CFLAGS $TK_CFLAGS"
4363 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4364 MOZ_USER_DIR="Mozilla"
4365 MOZ_FS_LAYOUT=bundle
4366 MOZ_INSTRUMENT_EVENT_LOOP=1
4370 MOZ_WIDGET_TOOLKIT=uikit
4371 AC_DEFINE(MOZ_WIDGET_UIKIT)
4372 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4373 TK_CFLAGS="-DNO_X11"
4374 TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText'
4375 CFLAGS="$CFLAGS $TK_CFLAGS"
4376 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4377 MOZ_USER_DIR="Mozilla"
4378 MOZ_FS_LAYOUT=bundle
4382 AC_DEFINE(MOZ_WIDGET_ANDROID)
4383 MOZ_WIDGET_TOOLKIT=android
4384 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4385 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4387 MOZ_INSTRUMENT_EVENT_LOOP=1
4391 AC_DEFINE(MOZ_WIDGET_GONK)
4392 AC_DEFINE(MOZ_TOUCH)
4393 MOZ_WIDGET_TOOLKIT=gonk
4394 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4395 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4398 MOZ_INSTRUMENT_EVENT_LOOP=1
4403 AC_SUBST(MOZ_PDF_PRINTING)
4404 if test "$MOZ_PDF_PRINTING"; then
4405 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4406 AC_DEFINE(MOZ_PDF_PRINTING)
4409 if test "$MOZ_ENABLE_XREMOTE"; then
4410 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4413 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4414 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4417 if test "$COMPILE_ENVIRONMENT"; then
4418 if test "$MOZ_ENABLE_GTK3"; then
4419 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4420 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
4421 dnl Contrary to MOZ_GTK2_LIBS, MOZ_GTK3_LIBS needs to be literally added to TK_LIBS instead
4422 dnl of a make reference because of how TK_LIBS is mangled in toolkit/library/moz.build
4423 dnl for GTK+3 builds.
4424 TK_LIBS=$MOZ_GTK3_LIBS
4426 if test "$MOZ_ENABLE_GTK"; then
4427 if test "$MOZ_X11"; then
4428 GDK_PACKAGES=gdk-x11-2.0
4431 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4432 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
4435 fi # COMPILE_ENVIRONMENT
4437 AC_SUBST(MOZ_FS_LAYOUT)
4439 dnl ========================================================
4440 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4441 dnl their usage and use them in spidermonkey.
4442 dnl ========================================================
4443 MOZ_ARG_WITH_BOOL(arm-kuser,
4444 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4446 if test -n "$USE_ARM_KUSER"; then
4447 AC_DEFINE(USE_ARM_KUSER)
4450 dnl ========================================================
4451 dnl = startup-notification support module
4452 dnl ========================================================
4454 if test "$MOZ_ENABLE_GTK"
4456 MOZ_ENABLE_STARTUP_NOTIFICATION=
4458 MOZ_ARG_ENABLE_BOOL(startup-notification,
4459 [ --enable-startup-notification
4460 Enable startup-notification support (default: disabled) ],
4461 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4462 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4463 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4465 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4466 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4467 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4468 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4470 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4472 MOZ_ENABLE_STARTUP_NOTIFICATION=
4476 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4477 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4480 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4482 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4484 dnl ========================================================
4485 dnl Disable printing
4486 dnl ========================================================
4487 MOZ_ARG_DISABLE_BOOL(printing,
4488 [ --disable-printing Disable printing support],
4492 if test "$NS_PRINTING"; then
4493 AC_DEFINE(NS_PRINTING)
4494 AC_DEFINE(NS_PRINT_PREVIEW)
4497 dnl ========================================================
4499 dnl ========================================================
4500 if test "$MOZ_ENABLE_QT"
4502 MOZ_ARG_WITH_STRING(qtdir,
4503 [ --with-qtdir=\$dir Specify Qt directory ],
4506 if test -z "$QTDIR"; then
4507 AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4509 HOST_QMAKE="$QTDIR/bin/qmake"
4511 QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4513 if test -z "$QTDIR"; then
4516 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4517 PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5Quick, ,
4519 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4521 QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4522 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4523 if test "$NS_PRINTING"; then
4524 PKG_CHECK_MODULES(MOZ_QT_WIDGETS, Qt5PrintSupport, ,
4526 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase widgets development package])
4528 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT_WIDGETS_LIBS"
4529 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT_WIDGETS_CFLAGS"
4533 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4537 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4538 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4540 MOZ_QT_CFLAGS="-DQT_SHARED"
4541 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4542 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4543 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4544 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4545 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4546 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4549 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4550 MOZ_QT_LIBS="$MOZ_QT_LIBS -L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml"
4551 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4552 if test "$NS_PRINTING"; then
4553 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4554 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4558 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4562 HOST_MOC="$QTDIR/bin/moc"
4563 HOST_RCC="$QTDIR/bin/rcc"
4565 if test -z "$HOST_MOC"; then
4566 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4568 if test -z "$HOST_RCC"; then
4569 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4575 MOZ_ENABLE_QMSYSTEM2=
4576 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4577 MOZ_ENABLE_QMSYSTEM2=1,
4578 MOZ_ENABLE_QMSYSTEM2=)
4580 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4581 MOZ_ENABLE_QMSYSTEM2=1
4582 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4583 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4584 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4587 MOZ_ENABLE_QTNETWORK=
4588 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4589 MOZ_ENABLE_QTNETWORK=1,
4590 MOZ_ENABLE_QTNETWORK=)
4592 if test "$MOZ_ENABLE_QTNETWORK"; then
4593 MOZ_ENABLE_QTNETWORK=1
4594 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4597 MOZ_ENABLE_QTMOBILITY=
4598 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4599 MOZ_ENABLE_QTMOBILITY=1,
4600 MOZ_ENABLE_QTMOBILITY=)
4601 if test "$MOZ_ENABLE_QTMOBILITY"; then
4602 MOZ_ENABLE_QTMOBILITY=1
4603 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4604 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4605 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4606 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4608 AC_CHECK_LIB(QtSensors, main, [
4609 MOZ_ENABLE_QTMOBILITY=1
4610 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4611 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4612 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4613 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4614 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4618 MOZ_ENABLE_QT5FEEDBACK=
4619 PKG_CHECK_MODULES(_QT5FEEDBACK, Qt0Feedback,
4620 MOZ_ENABLE_QT5FEEDBACK=1,
4621 MOZ_ENABLE_QT5FEEDBACK=)
4622 if test "$MOZ_ENABLE_QT5FEEDBACK"; then
4623 MOZ_ENABLE_QT5FEEDBACK=1
4624 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5FEEDBACK_CFLAGS"
4625 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5FEEDBACK_LIBS"
4626 AC_DEFINE(MOZ_ENABLE_QT5FEEDBACK)
4627 AC_SUBST(MOZ_ENABLE_QT5FEEDBACK)
4630 MOZ_ENABLE_QT5GEOPOSITION=
4631 PKG_CHECK_MODULES(_QT5GEOPOSITION, Qt5Positioning,
4632 MOZ_ENABLE_QT5GEOPOSITION=1,
4633 MOZ_ENABLE_QT5GEOPOSITION=)
4634 if test "$MOZ_ENABLE_QT5GEOPOSITION"; then
4635 MOZ_ENABLE_QT5GEOPOSITION=1
4636 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5GEOPOSITION_CFLAGS"
4637 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5GEOPOSITION_LIBS"
4638 AC_DEFINE(MOZ_ENABLE_QT5GEOPOSITION)
4639 AC_SUBST(MOZ_ENABLE_QT5GEOPOSITION)
4642 if test "$MOZ_ENABLE_CONTENTACTION"; then
4643 MOZ_ENABLE_CONTENTACTION=1
4644 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4647 MOZ_ENABLE_CONTENTACTION=
4648 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
4649 if test "$MOZ_ENABLE_CONTENTACTION"; then
4650 MOZ_ENABLE_CONTENTACTION=1
4651 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
4652 MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
4653 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4654 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
4658 AC_SUBST(GTK_CONFIG)
4659 AC_SUBST_LIST(TK_CFLAGS)
4660 AC_SUBST_LIST(TK_LIBS)
4662 AC_SUBST(MOZ_ENABLE_GTK2)
4663 AC_SUBST(MOZ_ENABLE_GTK3)
4664 AC_SUBST(MOZ_ENABLE_GTK)
4665 AC_SUBST(MOZ_ENABLE_QT)
4666 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4667 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4668 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4669 AC_SUBST(MOZ_ENABLE_XREMOTE)
4670 AC_SUBST(MOZ_WIDGET_GTK)
4671 AC_SUBST_LIST(MOZ_QT_CFLAGS)
4672 AC_SUBST_LIST(MOZ_QT_LIBS)
4679 dnl ========================================================
4681 dnl = Components & Features
4683 dnl ========================================================
4684 MOZ_ARG_HEADER(Components and Features)
4686 dnl ========================================================
4688 dnl ========================================================
4689 MOZ_ARG_ENABLE_STRING(ui-locale,
4690 [ --enable-ui-locale=ab-CD
4691 Select the user interface locale (default: en-US)],
4692 MOZ_UI_LOCALE=$enableval )
4693 AC_SUBST(MOZ_UI_LOCALE)
4695 dnl ========================================================
4696 dnl = Trademarked Branding
4697 dnl ========================================================
4698 MOZ_ARG_ENABLE_BOOL(official-branding,
4699 [ --enable-official-branding
4700 Enable Official mozilla.org Branding
4701 Do not distribute builds with
4702 --enable-official-branding unless you have
4703 permission to use trademarks per
4704 http://www.mozilla.org/foundation/trademarks/ .],
4706 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4707 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4709 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4710 MOZ_OFFICIAL_BRANDING=1
4712 ], MOZ_OFFICIAL_BRANDING=)
4714 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4715 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4716 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4719 MOZ_ARG_WITH_STRING(branding,
4720 [ --with-branding=dir Use branding from the specified directory.],
4721 MOZ_BRANDING_DIRECTORY=$withval)
4723 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4724 if test -z "$REAL_BRANDING_DIRECTORY"; then
4725 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4728 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4729 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4730 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4731 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
4734 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4736 dnl ========================================================
4737 dnl = Distribution ID
4738 dnl ========================================================
4739 MOZ_ARG_WITH_STRING(distribution-id,
4740 [ --with-distribution-id=ID
4741 Set distribution-specific id (default=org.mozilla)],
4742 [ val=`echo $withval`
4743 MOZ_DISTRIBUTION_ID="$val"])
4745 if test -z "$MOZ_DISTRIBUTION_ID"; then
4746 MOZ_DISTRIBUTION_ID="org.mozilla"
4749 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4750 AC_SUBST(MOZ_DISTRIBUTION_ID)
4753 dnl ========================================================
4754 dnl Google Play Services, placed here so it can depend on
4755 dnl values set by configure.sh above.
4756 dnl ========================================================
4758 MOZ_ANDROID_GOOGLE_PLAY_SERVICES
4761 dnl ========================================================
4763 dnl ========================================================
4764 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4766 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4768 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4771 dnl ========================================================
4772 dnl = GnomeVFS, GIO and GConf support module
4773 dnl ========================================================
4777 dnl build the GIO extension by default only when the
4778 dnl GTK2 toolkit is in use.
4779 if test "$MOZ_ENABLE_GTK"
4785 dnl ========================================================
4786 dnl = GnomeVFS support module
4787 dnl ========================================================
4788 MOZ_ARG_ENABLE_BOOL(gnomevfs,
4789 [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
4790 MOZ_ENABLE_GNOMEVFS=force,
4791 MOZ_ENABLE_GNOMEVFS=)
4793 if test "$MOZ_ENABLE_GNOMEVFS"
4795 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4796 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4797 MOZ_ENABLE_GNOMEVFS=1
4798 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4800 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4802 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4804 MOZ_ENABLE_GNOMEVFS=
4808 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4810 dnl ========================================================
4811 dnl = GIO support module
4812 dnl ========================================================
4813 MOZ_ARG_DISABLE_BOOL(gio,
4814 [ --disable-gio Disable GIO support],
4816 MOZ_ENABLE_GIO=force)
4818 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
4820 if test "$MOZ_ENABLE_GTK2"
4822 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4823 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4825 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4826 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4828 AC_DEFINE(MOZ_ENABLE_GIO)
4830 if test "$MOZ_ENABLE_GIO" = "force"
4832 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4838 AC_SUBST(MOZ_ENABLE_GIO)
4840 dnl ========================================================
4841 dnl = GConf support module
4842 dnl ========================================================
4843 MOZ_ARG_DISABLE_BOOL(gconf,
4844 [ --disable-gconf Disable Gconf support ],
4846 MOZ_ENABLE_GCONF=force)
4848 if test "$MOZ_ENABLE_GCONF"
4850 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4851 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4854 if test "$MOZ_ENABLE_GCONF" = "force"
4856 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4862 if test "$MOZ_ENABLE_GCONF"; then
4863 AC_DEFINE(MOZ_ENABLE_GCONF)
4866 AC_SUBST(MOZ_ENABLE_GCONF)
4869 dnl ========================================================
4870 dnl = libproxy support
4871 dnl ========================================================
4873 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4875 MOZ_ENABLE_LIBPROXY=
4877 MOZ_ARG_ENABLE_BOOL(libproxy,
4878 [ --enable-libproxy Enable libproxy support ],
4879 MOZ_ENABLE_LIBPROXY=1,
4880 MOZ_ENABLE_LIBPROXY=)
4882 if test "$MOZ_ENABLE_LIBPROXY"
4884 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4885 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4888 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4890 dnl ========================================================
4891 dnl = GNOME component (mozgnome)
4892 dnl ========================================================
4894 if test "$MOZ_ENABLE_GTK"
4896 MOZ_ENABLE_GNOME_COMPONENT=1
4898 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4900 dnl ========================================================
4901 dnl = libgnomeui support module
4902 dnl ========================================================
4904 if test "$MOZ_ENABLE_GTK"
4906 MOZ_ARG_ENABLE_BOOL(gnomeui,
4907 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
4908 MOZ_ENABLE_GNOMEUI=force,
4909 MOZ_ENABLE_GNOMEUI=)
4911 if test "$MOZ_ENABLE_GNOMEUI"
4913 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4915 MOZ_ENABLE_GNOMEUI=1
4917 if test "$MOZ_ENABLE_GNOMEUI" = "force"
4919 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4925 if test "$MOZ_ENABLE_GNOMEUI"; then
4926 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4930 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4932 dnl ========================================================
4934 dnl ========================================================
4936 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4940 MOZ_ARG_DISABLE_BOOL(dbus,
4941 [ --disable-dbus Disable dbus support ],
4945 if test "$MOZ_ENABLE_DBUS"
4947 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
4948 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
4949 AC_DEFINE(MOZ_ENABLE_DBUS)
4952 AC_SUBST(MOZ_ENABLE_DBUS)
4954 dnl ========================================================
4955 dnl = Enable Android History instead of Places
4956 dnl ========================================================
4957 if test -n "$MOZ_ANDROID_HISTORY"; then
4958 if test -z "$MOZ_PLACES"; then
4959 AC_DEFINE(MOZ_ANDROID_HISTORY)
4961 AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
4965 dnl ========================================================
4966 dnl = Enable the C++ async pan/zoom code instead of the Java version
4967 dnl ========================================================
4968 MOZ_ARG_ENABLE_BOOL(android-apz,
4969 [ --enable-android-apz Switch to C++ pan/zoom code],
4972 if test -n "$MOZ_ANDROID_APZ"; then
4973 dnl Do this if defined in confvars.sh
4974 AC_DEFINE(MOZ_ANDROID_APZ)
4977 dnl ========================================================
4978 dnl = Disable WebSMS backend
4979 dnl ========================================================
4980 MOZ_ARG_DISABLE_BOOL(websms-backend,
4981 [ --disable-websms-backend
4982 Disable WebSMS backend],
4983 MOZ_WEBSMS_BACKEND=,
4984 MOZ_WEBSMS_BACKEND=1)
4986 if test -n "$MOZ_WEBSMS_BACKEND"; then
4987 AC_DEFINE(MOZ_WEBSMS_BACKEND)
4990 dnl ========================================================
4991 dnl = Enable runtime locale switching on Android
4992 dnl ========================================================
4993 if test -n "$MOZ_LOCALE_SWITCHER"; then
4994 AC_DEFINE(MOZ_LOCALE_SWITCHER)
4997 dnl ========================================================
4998 dnl = Enable system download manager on Android
4999 dnl ========================================================
5000 if test -n "$MOZ_ANDROID_DOWNLOADS_INTEGRATION"; then
5001 AC_DEFINE(MOZ_ANDROID_DOWNLOADS_INTEGRATION)
5004 dnl ========================================================
5005 dnl = Enable NFC permission on Android
5006 dnl ========================================================
5007 if test -n "$MOZ_ANDROID_BEAM"; then
5008 AC_DEFINE(MOZ_ANDROID_BEAM)
5011 dnl ========================================================
5012 dnl = Include Search Activity on Android
5013 dnl ========================================================
5014 if test -n "$MOZ_ANDROID_SEARCH_ACTIVITY"; then
5015 AC_DEFINE(MOZ_ANDROID_SEARCH_ACTIVITY)
5018 dnl ========================================================
5019 dnl = Include Mozilla Location Service Stumbler on Android
5020 dnl ========================================================
5021 if test -n "$MOZ_ANDROID_MLS_STUMBLER"; then
5022 AC_DEFINE(MOZ_ANDROID_MLS_STUMBLER)
5025 dnl ========================================================
5026 dnl = Include share overlay on Android
5027 dnl ========================================================
5028 if test -n "$MOZ_ANDROID_SHARE_OVERLAY"; then
5029 AC_DEFINE(MOZ_ANDROID_SHARE_OVERLAY)
5032 dnl ========================================================
5033 dnl = Include New Tablet UI on Android
5034 dnl = Temporary build flag to allow development in Nightly
5035 dnl ========================================================
5036 if test -n "$MOZ_ANDROID_NEW_TABLET_UI"; then
5037 AC_DEFINE(MOZ_ANDROID_NEW_TABLET_UI)
5040 dnl ========================================================
5041 dnl = Enable IPDL's "expensive" unit tests
5042 dnl ========================================================
5045 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5046 [ --enable-ipdl-tests Enable expensive IPDL tests],
5050 if test -n "$MOZ_IPDL_TESTS"; then
5051 AC_DEFINE(MOZ_IPDL_TESTS)
5054 AC_SUBST(MOZ_IPDL_TESTS)
5056 dnl ========================================================
5057 dnl = Disable building dbm
5058 dnl ========================================================
5059 MOZ_ARG_DISABLE_BOOL(dbm,
5060 [ --disable-dbm Disable building dbm],
5064 dnl ========================================================
5065 dnl accessibility support on by default on all platforms
5066 dnl ========================================================
5067 MOZ_ARG_DISABLE_BOOL(accessibility,
5068 [ --disable-accessibility Disable accessibility support],
5071 if test "$ACCESSIBILITY"; then
5074 if test -z "$MIDL"; then
5075 if test "$GCC" != "yes"; then
5076 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5078 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.])
5082 AC_DEFINE(ACCESSIBILITY)
5085 dnl ========================================================
5086 dnl Accessibility is required for the linuxgl widget
5088 dnl ========================================================
5089 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5090 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5093 dnl Turn off webrtc for OS's we don't handle yet, but allow
5094 dnl --enable-webrtc to override. Can disable for everything in
5095 dnl the master list above.
5096 if test -n "$MOZ_WEBRTC"; then
5098 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
5102 dnl default to disabled for all others
5108 AC_TRY_COMPILE([#include <linux/ethtool.h>],
5109 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
5110 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
5112 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
5114 # target_arch is from {ia32|x64|arm|ppc}
5116 x86_64 | arm | x86 | ppc* | ia64)
5120 # unsupported arch for webrtc
5126 dnl ========================================================
5127 dnl = Disable WebRTC code
5128 dnl ========================================================
5129 MOZ_ARG_DISABLE_BOOL(webrtc,
5130 [ --disable-webrtc Disable support for WebRTC],
5134 if test -n "$MOZ_WEBRTC"; then
5135 AC_DEFINE(MOZ_WEBRTC)
5136 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
5137 dnl opt/production builds (via MOZ_CRASH())
5138 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
5141 MOZ_VPX_ERROR_CONCEALMENT=1
5143 dnl enable once Signaling lands
5144 MOZ_WEBRTC_SIGNALING=1
5145 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5146 dnl enable once PeerConnection lands
5147 MOZ_PEERCONNECTION=1
5148 AC_DEFINE(MOZ_PEERCONNECTION)
5153 if test -n "$MOZ_X11"; then
5154 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
5160 dnl ========================================================
5161 dnl = Force hardware AEC, disable webrtc.org AEC
5162 dnl ========================================================
5163 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
5164 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
5165 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
5166 MOZ_WEBRTC_HARDWARE_AEC_NS=)
5168 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
5169 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
5172 AC_SUBST(MOZ_WEBRTC)
5173 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5174 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5175 AC_SUBST(MOZ_PEERCONNECTION)
5176 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5177 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
5180 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
5182 dnl Use integers over floats for audio on B2G and Android
5183 dnl (regarless of the CPU architecture, because audio
5184 dnl backends for those platforms don't support floats. We also
5185 dnl use integers on ARM with other OS, because it's more efficient.
5186 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
5187 MOZ_SAMPLE_TYPE_S16=1
5188 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5189 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5191 MOZ_SAMPLE_TYPE_FLOAT32=1
5192 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5193 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5196 dnl ========================================================
5197 dnl = Disable Speech API code
5198 dnl ========================================================
5199 MOZ_ARG_DISABLE_BOOL(webspeech,
5200 [ --disable-webspeech Disable support for HTML Speech API],
5204 if test -n "$MOZ_WEBSPEECH"; then
5205 AC_DEFINE(MOZ_WEBSPEECH)
5208 AC_SUBST(MOZ_WEBSPEECH)
5210 dnl ========================================================
5211 dnl = Enable Raw Codecs
5212 dnl ========================================================
5213 MOZ_ARG_ENABLE_BOOL(raw,
5214 [ --enable-raw Enable support for RAW media],
5218 if test -n "$MOZ_RAW"; then
5224 dnl Checks for __attribute__(aligned()) directive need by libogg
5225 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5226 [ac_cv_c_attribute_aligned],
5227 [ac_cv_c_attribute_aligned=0
5228 CFLAGS_save="${CFLAGS}"
5229 CFLAGS="${CFLAGS} -Werror"
5230 for ac_cv_c_attr_align_try in 64 32 16 8; do
5231 echo "trying $ac_cv_c_attr_align_try"
5233 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5234 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5235 if test "$ac_cv_c_attribute_aligned" != 0; then
5239 CFLAGS="${CFLAGS_save}"])
5240 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5241 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5242 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5245 dnl ========================================================
5246 dnl = Disable Opus audio codec support
5247 dnl ========================================================
5248 MOZ_ARG_DISABLE_BOOL(opus,
5249 [ --disable-opus Disable support for Opus audio],
5253 dnl ========================================================
5254 dnl = Disable VP8 decoder support
5255 dnl ========================================================
5256 MOZ_ARG_DISABLE_BOOL(webm,
5257 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5261 if test -n "$MOZ_WEBM"; then
5266 dnl ========================================================
5267 dnl = Apple platform decoder support
5268 dnl ========================================================
5269 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5273 if test -n "$MOZ_APPLEMEDIA"; then
5274 AC_DEFINE(MOZ_APPLEMEDIA)
5275 # hack in frameworks for fmp4 - see bug 1029974
5276 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
5277 LDFLAGS="$LDFLAGS -framework AudioToolbox"
5278 dnl Verify CoreMedia is available.
5279 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
5280 [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
5283 dnl ========================================================
5284 dnl = DirectShow support
5285 dnl ========================================================
5286 if test "$OS_ARCH" = "WINNT"; then
5287 dnl Enable DirectShow support by default.
5291 MOZ_ARG_DISABLE_BOOL(directshow,
5292 [ --disable-directshow Disable support for DirectShow],
5296 if test -n "$MOZ_DIRECTSHOW"; then
5297 AC_DEFINE(MOZ_DIRECTSHOW)
5300 dnl ========================================================
5301 dnl = Windows Media Foundation support
5302 dnl ========================================================
5303 if test "$OS_ARCH" = "WINNT"; then
5304 dnl Enable Windows Media Foundation support by default.
5305 dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5306 dnl guaranteed to have a recent-enough SDK to build WMF.
5310 MOZ_ARG_DISABLE_BOOL(wmf,
5311 [ --disable-wmf Disable support for Windows Media Foundation],
5315 if test -n "$MOZ_WMF"; then
5319 dnl ========================================================
5320 dnl FFmpeg H264/AAC Decoding Support
5321 dnl ========================================================
5322 case "$OS_TARGET" in
5323 WINNT|Darwin|Android)
5330 MOZ_ARG_DISABLE_BOOL(ffmpeg,
5331 [ --disable-ffmpeg Disable FFmpeg for fragmented H264/AAC decoding],
5336 if test -n "$MOZ_FFMPEG"; then
5337 AC_DEFINE(MOZ_FFMPEG)
5340 dnl ========================================================
5341 dnl = Built-in fragmented MP4 support.
5342 dnl ========================================================
5344 if test "$OS_TARGET" = Android; then
5348 if test -n "$MOZ_WMF" -o -n "$MOZ_FFMPEG" -o -n "$MOZ_APPLEMEDIA"; then
5349 dnl Enable fragmented MP4 parser on Windows by default.
5350 dnl We will also need to enable it on other platforms as we implement
5351 dnl platform decoder support there too.
5355 MOZ_ARG_DISABLE_BOOL(fmp4,
5356 [ --disable-fmp4 Disable support for in built Fragmented MP4 parsing],
5360 if test -n "$MOZ_FMP4"; then
5364 dnl ========================================================
5366 dnl ========================================================
5368 MOZ_ARG_DISABLE_BOOL(eme,
5369 [ --disable-eme Disable support for Encrypted Media Extensions],
5373 if test -n "$MOZ_EME"; then
5377 dnl ========================================================
5378 dnl = Enable media plugin support
5379 dnl ========================================================
5380 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5381 dnl Enable support on android by default
5385 MOZ_ARG_ENABLE_BOOL(android-omx,
5386 [ --enable-android-omx Enable support for Android OMX media backend],
5390 if test -n "$MOZ_ANDROID_OMX"; then
5391 AC_DEFINE(MOZ_ANDROID_OMX)
5394 dnl ========================================================
5395 dnl = Enable getUserMedia support
5396 dnl ========================================================
5397 MOZ_ARG_ENABLE_BOOL(media-navigator,
5398 [ --enable-media-navigator Enable support for getUserMedia],
5399 MOZ_MEDIA_NAVIGATOR=1,
5400 MOZ_MEDIA_NAVIGATOR=)
5402 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5403 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5406 dnl ========================================================
5407 dnl = Enable building OMX media plugin (B2G or Android)
5408 dnl ========================================================
5409 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5410 dnl Enable support on android by default
5414 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5415 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5419 if test -n "$MOZ_OMX_PLUGIN"; then
5420 if test "$OS_TARGET" = "Android"; then
5421 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5422 AC_DEFINE(MOZ_OMX_PLUGIN)
5424 dnl fail if we're not building on Gonk or Android
5425 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5429 dnl system libvpx Support
5430 dnl ========================================================
5431 MOZ_ARG_WITH_BOOL(system-libvpx,
5432 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5433 MOZ_NATIVE_LIBVPX=1)
5438 if test -n "$MOZ_VPX"; then
5440 if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
5441 AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
5444 _SAVE_CFLAGS=$CFLAGS
5446 if test -n "$MOZ_NATIVE_LIBVPX"; then
5447 dnl ============================
5448 dnl === libvpx Version check ===
5449 dnl ============================
5450 dnl Check to see if we have a system libvpx package.
5451 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.3.0)
5453 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
5454 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
5456 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5457 [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.])])
5459 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5460 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5462 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
5463 [AC_CHECK_FUNC(vpx_mem_set_functions)])
5464 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
5465 "$ac_cv_func_vpx_mem_set_functions" = no; then
5466 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
5469 CFLAGS=$_SAVE_CFLAGS
5473 AC_SUBST(MOZ_NATIVE_LIBVPX)
5474 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
5475 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
5477 if test "$MOZ_WEBM"; then
5478 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5485 if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then
5487 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5488 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5489 dnl We currently require gcc on all arm platforms.
5492 VPX_NEED_OBJ_INT_EXTRACT=
5494 dnl See if we have assembly on this platform.
5495 case "$OS_ARCH:$CPU_ARCH" in
5497 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5501 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5505 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5509 dnl Check for yasm 1.1 or greater.
5510 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5511 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.])
5512 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5513 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.])
5515 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5517 dnl The encoder needs obj_int_extract to get asm offsets.
5521 if test -n "$GNU_AS" ; then
5523 dnl These flags are a lie; they're just used to enable the requisite
5524 dnl opcodes; actual arch detection is done at runtime.
5525 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5526 VPX_DASH_C_FLAG="-c"
5527 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5528 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5533 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5534 VPX_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC"
5539 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5540 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5546 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5547 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.])
5550 if test -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5551 dnl We prefer to get asm offsets using inline assembler, which the above
5552 dnl compilers can do. When we're not using one of those, we have to fall
5553 dnl back to obj_int_extract, which reads them from a compiled object
5554 dnl file. Unfortunately, that only works if we're compiling on a system
5555 dnl with the header files for the appropriate object file format.
5556 VPX_NEED_OBJ_INT_EXTRACT=1
5559 if test -n "$VPX_X86_ASM"; then
5560 AC_DEFINE(VPX_X86_ASM)
5561 elif test -n "$VPX_ARM_ASM"; then
5562 AC_DEFINE(VPX_ARM_ASM)
5564 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5568 dnl ========================================================
5569 dnl = Disable Wave decoder support
5570 dnl ========================================================
5571 MOZ_ARG_DISABLE_BOOL(wave,
5572 [ --disable-wave Disable Wave decoder support],
5576 if test -n "$MOZ_WAVE"; then
5580 dnl ========================================================
5581 dnl = Handle dependent MEDIA defines
5582 dnl ========================================================
5584 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5585 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/])
5588 if test -n "$MOZ_WEBRTC" -a -z "$MOZ_OPUS"; then
5589 AC_MSG_ERROR([MOZ_WEBRTC requires MOZ_OPUS which is disabled.])
5592 if test -n "$MOZ_VORBIS"; then
5593 AC_DEFINE(MOZ_VORBIS)
5596 if test -n "$MOZ_TREMOR"; then
5597 AC_DEFINE(MOZ_TREMOR)
5598 # Tremor doesn't have an encoder.
5602 if test -n "$MOZ_OPUS"; then
5606 if test -n "$MOZ_WEBM_ENCODER"; then
5607 AC_DEFINE(MOZ_WEBM_ENCODER)
5609 AC_SUBST(MOZ_WEBM_ENCODER)
5611 dnl ==================================
5612 dnl = Check alsa availability on Linux
5613 dnl ==================================
5615 dnl If using Linux, ensure that the alsa library is available
5616 if test "$OS_TARGET" = "Linux"; then
5620 MOZ_ARG_ENABLE_BOOL(alsa,
5621 [ --enable-alsa Enable Alsa support (default on Linux)],
5625 if test -n "$MOZ_ALSA"; then
5626 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5627 [echo "$MOZ_ALSA_PKG_ERRORS"
5628 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.)])])
5633 dnl ========================================================
5634 dnl = Disable PulseAudio
5635 dnl ========================================================
5637 dnl If using Linux, ensure that the PA library is available
5638 case "$OS_TARGET" in
5639 WINNT|Darwin|Android|OpenBSD)
5642 if test -z "$MOZ_B2G"; then
5648 MOZ_ARG_DISABLE_BOOL(pulseaudio,
5649 [ --disable-pulseaudio Disable PulseAudio support],
5653 if test -n "$MOZ_PULSEAUDIO"; then
5654 if test -z "$gonkdir"; then
5655 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5656 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5657 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
5659 MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
5663 AC_SUBST(MOZ_PULSEAUDIO)
5665 dnl ========================================================
5666 dnl = Enable GStreamer
5667 dnl ========================================================
5668 case "$OS_TARGET" in
5669 WINNT|Darwin|Android)
5673 GST_API_VERSION=0.10
5677 MOZ_ARG_ENABLE_STRING(gstreamer,
5678 [ --enable-gstreamer[=0.10] Enable GStreamer support],
5680 # API version, eg 0.10, 1.0 etc
5681 if test -z "$enableval" -o "$enableval" = "yes"; then
5682 GST_API_VERSION=0.10
5683 elif test "$enableval" = "no"; then
5686 GST_API_VERSION=$enableval
5690 if test -n "$MOZ_GSTREAMER"; then
5691 # core/base release number
5692 if test "$GST_API_VERSION" = "1.0"; then
5698 PKG_CHECK_MODULES(GSTREAMER,
5699 gstreamer-$GST_API_VERSION >= $GST_VERSION
5700 gstreamer-app-$GST_API_VERSION
5701 gstreamer-plugins-base-$GST_API_VERSION,
5702 [_HAVE_GSTREAMER=1],
5704 if test -z "$_HAVE_GSTREAMER"; then
5705 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])
5708 _SAVE_LDFLAGS=$LDFLAGS
5709 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5710 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5711 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5712 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5714 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.])
5716 LDFLAGS=$_SAVE_LDFLAGS
5719 AC_SUBST(MOZ_GSTREAMER)
5720 AC_SUBST(GST_API_VERSION)
5722 if test -n "$MOZ_GSTREAMER"; then
5723 AC_DEFINE(MOZ_GSTREAMER)
5724 AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION")
5728 dnl ========================================================
5729 dnl Permissions System
5730 dnl ========================================================
5731 MOZ_ARG_DISABLE_BOOL(permissions,
5732 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5737 dnl ========================================================
5738 dnl Child permissions, currently only used for b2g
5739 dnl ========================================================
5740 if test -n "$MOZ_B2G"; then
5741 if test -n "$MOZ_PERMISSIONS"; then
5742 MOZ_CHILD_PERMISSIONS=1
5744 AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
5747 AC_SUBST(MOZ_CHILD_PERMISSIONS)
5749 dnl ========================================================
5751 dnl ========================================================
5752 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5753 [ --disable-negotiateauth Disable GSS-API negotiation ],
5754 MOZ_AUTH_EXTENSION=,
5755 MOZ_AUTH_EXTENSION=1 )
5757 dnl ========================================================
5758 dnl Pref extensions (autoconfig)
5759 dnl ========================================================
5760 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5761 [ --disable-pref-extensions
5762 Disable pref extensions such as autoconfig],
5763 MOZ_PREF_EXTENSIONS=,
5764 MOZ_PREF_EXTENSIONS=1 )
5766 dnl ========================================================
5767 dnl Searching of system directories for extensions.
5768 dnl Note: this switch is meant to be used for test builds
5769 dnl whose behavior should not depend on what happens to be
5770 dnl installed on the local machine.
5771 dnl ========================================================
5772 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5773 [ --disable-system-extension-dirs
5774 Disable searching system- and account-global
5775 directories for extensions of any kind; use
5776 only profile-specific extension directories],
5777 ENABLE_SYSTEM_EXTENSION_DIRS=,
5778 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5779 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5780 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5783 dnl ========================================================
5784 dnl = Universalchardet
5785 dnl ========================================================
5786 MOZ_ARG_DISABLE_BOOL(universalchardet,
5787 [ --disable-universalchardet
5788 Disable universal encoding detection],
5789 MOZ_UNIVERSALCHARDET=,
5790 MOZ_UNIVERSALCHARDET=1 )
5792 if test -n "${JAVA_BIN_PATH}"; then
5793 dnl Look for javac and jar in the specified path.
5794 JAVA_PATH="$JAVA_BIN_PATH"
5796 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5797 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5800 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5801 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5802 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5803 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5804 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5805 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5807 if test -n "${JAVA_BIN_PATH}" -o \
5808 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5809 if test -z "$JAVA" -o "$JAVA" = ":"; then
5810 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}])
5812 if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5813 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}])
5815 if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5816 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}])
5818 if test -z "$JAR" -o "$JAR" = ":"; then
5819 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}])
5821 if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5822 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}])
5824 if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5825 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}])
5828 AC_MSG_CHECKING([for minimum required javac version >= 1.7])
5830 dnl Javac spits out something like `javac 1.7.0`. This line cuts off the 'javac'
5831 _javac_version=$($JAVAC -version 2>&1 | cut -d ' ' -f 2)
5833 dnl Here, we extract the major (1) and minor (7) version numbers from the
5834 dnl acquired version string.
5835 _javac_major_version=$(echo $_javac_version | cut -d '.' -f 1)
5836 _javac_minor_version=$(echo $_javac_version | cut -d '.' -f 2)
5838 AC_MSG_RESULT([$_javac_version])
5840 dnl Fail if we have a version other than 1.7.X
5841 if test "$_javac_major_version" -ne "1" -o \
5842 \( "$_javac_minor_version" -lt "7" \); then
5843 AC_MSG_ERROR([javac 1.7 or higher is required.])
5847 dnl ========================================================
5848 dnl = ANGLE OpenGL->D3D translator for WebGL
5849 dnl = * only applies to win32
5850 dnl ========================================================
5854 MOZ_HAS_WINSDK_WITH_D3D=
5855 MOZ_D3DCOMPILER_VISTA_DLL=
5856 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5857 MOZ_DIRECTX_SDK_PATH=
5858 MOZ_D3DCOMPILER_XP_DLL=
5859 MOZ_D3DCOMPILER_XP_CAB=
5861 case "$target_os" in
5863 MOZ_ANGLE_RENDERER=1
5867 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5868 case "${target_cpu}" in
5870 MOZ_D3D_CPU_SUFFIX=x86
5873 MOZ_D3D_CPU_SUFFIX=x64
5877 MOZ_ARG_ENABLE_BOOL(require-all-d3dc-versions,
5878 [ --enable-require-all-d3dc-versions Require all versions of the D3D compiler needed for supported Windows systems.],
5879 MOZ_REQUIRE_ALL_D3DCS=1,
5880 MOZ_REQUIRE_ALL_D3DCS=)
5882 # This is potentially set in external mozconfig files; if it's set,
5883 # then the build exposes the "webgl" context name, which is reserved
5884 # for conformant implementations.
5885 if test -n "$MOZ_WEBGL_CONFORMANT"; then
5886 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
5889 dnl ========================================================
5890 dnl D3D compiler DLL
5891 dnl ========================================================
5892 MOZ_FOUND_D3D_COMPILERS=
5894 if test -n "$MOZ_ANGLE_RENDERER"; then
5895 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
5896 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
5899 ######################################
5900 # Find _46+ for use by Vista+.
5902 # Find a D3D compiler DLL in a Windows SDK.
5903 MOZ_D3DCOMPILER_VISTA_DLL=
5904 case "$MOZ_WINSDK_MAXVER" in
5906 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
5907 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
5910 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_46.dll
5911 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.0.])
5915 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5916 # We have a name, now track down the path.
5917 if test -n "$WINDOWSSDKDIR"; then
5918 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
5919 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5920 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5921 MOZ_HAS_WINSDK_WITH_D3D=1
5923 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5924 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
5925 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5928 AC_MSG_RESULT([Windows SDK not found.])
5932 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5933 MOZ_D3DCOMPILER_VISTA_DLL=
5936 # On mingw, check if headers are provided by toolchain.
5937 if test -n "$GNU_CC"; then
5938 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
5941 ######################################
5942 # Find _43 for use by XP.
5944 # Get the SDK path from the registry.
5945 # First try to get the June 2010 SDK
5946 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5947 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5948 # Otherwise just take whatever comes first
5949 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5951 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'`
5953 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5954 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/dxguid.lib ; then
5955 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5957 AC_MSG_RESULT([DirectX SDK not found.])
5958 MOZ_DIRECTX_SDK_PATH=
5961 # Check that our DirectX SDK is acceptable.
5962 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5963 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5964 AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
5965 MOZ_DIRECTX_SDK_PATH=
5969 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5970 # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
5971 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5972 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'`
5974 if test -n "$MOZ_D3DX9_VERSION" ; then
5975 MOZ_D3DCOMPILER_XP_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_D3D_CPU_SUFFIX}.cab | head -n1`
5977 if test -n "$MOZ_D3DCOMPILER_XP_CAB"; then
5978 MOZ_D3DCOMPILER_XP_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5980 AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
5981 AC_MSG_ERROR([DirectX SDK at "$MOZ_DIRECTX_SDK_PATH" appears broken.])
5982 MOZ_DIRECTX_SDK_PATH=
5985 AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
5986 MOZ_DIRECTX_SDK_PATH=
5989 AC_MSG_RESULT([Couldn't find an acceptable DirectX SDK for ANGLE, needed for d3dcompiler_43.])
5990 AC_MSG_RESULT([ Either ignore, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5993 ######################################
5994 # Check that we found what we needed.
5995 MOZ_FOUND_A_D3D_COMPILER=
5996 MOZ_FOUND_BOTH_D3D_COMPILERS=1
5998 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5999 MOZ_FOUND_A_D3D_COMPILER=1
6000 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
6002 MOZ_FOUND_BOTH_D3D_COMPILERS=
6005 if test -n "$MOZ_D3DCOMPILER_XP_DLL"; then
6006 MOZ_FOUND_A_D3D_COMPILER=1
6007 AC_MSG_RESULT([Found d3dcompiler DLL for XP: $MOZ_D3DCOMPILER_XP_DLL])
6009 MOZ_FOUND_BOTH_D3D_COMPILERS=
6012 if test -z "$CROSS_COMPILE"; then
6013 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
6014 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
6015 AC_MSG_ERROR([ Either install Windows SDK 8.0+, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
6018 if test -n "$MOZ_REQUIRE_ALL_D3DCS" -a -z "$MOZ_FOUND_BOTH_D3D_COMPILERS"; then
6019 AC_MSG_ERROR([Both D3D compilers _43 and _46+ are required by --enable-require-d3d-compilers.])
6020 AC_MSG_ERROR([ Install Windows SDK 8.0+, as well as DirectX SDK (June 2010 version or newer), or reconfigure without this flag.])
6026 dnl ========================================================
6028 dnl ========================================================
6030 MOZ_GAMEPAD_BACKEND=stub
6032 # Gamepad DOM is built on supported platforms by default.
6033 case "$OS_TARGET" in
6038 if test "$MOZ_WIDGET_TOOLKIT" != "gonk"; then
6046 MOZ_ARG_DISABLE_BOOL(gamepad,
6047 [ --disable-gamepad Disable gamepad support],
6051 if test "$MOZ_GAMEPAD"; then
6052 case "$OS_TARGET" in
6054 MOZ_GAMEPAD_BACKEND=cocoa
6057 case "$MOZ_WINSDK_MAXVER" in
6058 # We support building with the Windows 7 SDK otherwise, but
6059 # Gamepad support requires the Windows 8 SDK for some HID headers.
6061 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.])
6066 MOZ_GAMEPAD_BACKEND=windows
6069 MOZ_CHECK_HEADER([linux/joystick.h])
6070 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
6071 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.])
6073 MOZ_GAMEPAD_BACKEND=linux
6076 MOZ_GAMEPAD_BACKEND=android
6082 AC_DEFINE(MOZ_GAMEPAD)
6084 AC_SUBST(MOZ_GAMEPAD)
6085 AC_SUBST(MOZ_GAMEPAD_BACKEND)
6087 dnl ========================================================
6088 dnl = Breakpad crash reporting (on by default on supported platforms)
6089 dnl ========================================================
6092 i?86-*-mingw*|x86_64-*-mingw*)
6095 i?86-apple-darwin*|x86_64-apple-darwin*)
6098 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6099 if test "$MOZ_ENABLE_GTK"; then
6103 *-android*|*-linuxandroid*)
6111 MOZ_ARG_DISABLE_BOOL(crashreporter,
6112 [ --disable-crashreporter Disable breakpad crash reporting],
6113 [MOZ_CRASHREPORTER=],
6114 [MOZ_CRASHREPORTER=F # Force enable breakpad])
6116 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
6117 if test "$MOZ_CRASHREPORTER" = F; then
6118 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
6123 if test -n "$MOZ_CRASHREPORTER"; then
6124 AC_DEFINE(MOZ_CRASHREPORTER)
6126 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
6127 test -z "$SKIP_LIBRARY_CHECKS"; then
6128 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6131 if test "$OS_ARCH" = "WINNT"; then
6132 if test -z "$HAVE_64BIT_BUILD"; then
6133 MOZ_CRASHREPORTER_INJECTOR=1
6134 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
6139 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6140 [ --with-crashreporter-enable-percent=NN
6141 Enable sending crash reports by default on NN% of users. (default=100)],
6142 [ val=`echo $withval | sed 's/[^0-9]//g'`
6143 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6145 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6146 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6148 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6150 dnl ========================================================
6151 dnl = libjpeg-turbo configuration
6152 dnl ========================================================
6154 if test -z "$MOZ_NATIVE_JPEG"; then
6158 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6159 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
6161 MOZ_LIBJPEG_TURBO=1)
6163 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6164 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6167 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6170 if test -n "$MOZ_LIBJPEG_TURBO"; then
6172 dnl Do we support libjpeg-turbo on this platform?
6173 case "$OS_ARCH:$OS_TEST" in
6175 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6176 LIBJPEG_TURBO_X86_ASM=1
6179 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6180 LIBJPEG_TURBO_X64_ASM=1
6182 WINNT:x86|WINNT:i?86)
6183 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6184 LIBJPEG_TURBO_X86_ASM=1
6187 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6188 LIBJPEG_TURBO_X64_ASM=1
6191 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6192 LIBJPEG_TURBO_ARM_ASM=1
6195 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6196 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6197 LIBJPEG_TURBO_X86_ASM=1
6201 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6202 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6203 LIBJPEG_TURBO_X64_ASM=1
6210 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6211 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6212 dnl it doesn't exist or we have too old of a version.
6213 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6214 LIBJPEG_TURBO_AS=$YASM
6216 if test -z "$LIBJPEG_TURBO_AS" ; then
6217 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.])
6220 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6221 dnl on Linux and 1.1 or newer everywhere else.
6222 if test "$OS_ARCH" = "Linux" ; then
6223 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
6224 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.])
6227 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6228 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.])
6233 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6234 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6235 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6236 echo "Using $AS as the assembler for ARM code."
6237 LIBJPEG_TURBO_AS=$AS
6240 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6241 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6242 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6243 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6244 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6245 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6246 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6247 dnl Warn if we're not building the optimized routines, even though the user
6248 dnl didn't specify --disable-libjpeg-turbo.
6249 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6252 dnl ========================================================
6253 dnl = Enable compilation of specific extension modules
6254 dnl ========================================================
6256 MOZ_ARG_ENABLE_STRING(extensions,
6257 [ --enable-extensions Enable extensions],
6258 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6259 if test "$option" = "yes" -o "$option" = "all"; then
6260 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6261 elif test "$option" = "no" -o "$option" = "none"; then
6263 elif test "$option" = "default"; then
6264 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6265 elif test `echo "$option" | grep -c \^-` != 0; then
6266 option=`echo $option | sed 's/^-//'`
6267 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6269 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6272 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6274 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6275 # Suppress warning on non-X11 platforms
6276 if test -n "$MOZ_X11"; then
6277 AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6279 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6282 dnl Do not build gnomevfs with libxul based apps
6283 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6284 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6287 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6288 # Suppress warning on non-X11 platforms
6289 if test -n "$MOZ_X11"; then
6290 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6292 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6295 dnl Do not build gio with libxul based apps
6296 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6297 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6300 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6302 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6304 AC_SUBST(MOZ_GIO_COMPONENT)
6307 MOZ_EXTENSIONS=`$PYTHON ${srcdir}/build/unix/uniq.py ${MOZ_EXTENSIONS}`
6309 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6310 dnl when trying to build a nonexistent extension.
6311 for extension in $MOZ_EXTENSIONS; do
6312 if test ! -d "${srcdir}/extensions/${extension}"; then
6313 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6317 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6318 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6321 dnl ========================================================
6322 dnl Build Freetype in the tree
6323 dnl ========================================================
6324 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6325 [ --enable-tree-freetype Enable Tree FreeType],
6326 MOZ_TREE_FREETYPE=1,
6327 MOZ_TREE_FREETYPE= )
6328 if test -n "$MOZ_TREE_FREETYPE"; then
6329 if test -n "$_WIN32_MSVC"; then
6330 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6332 AC_DEFINE(MOZ_TREE_FREETYPE)
6333 AC_SUBST(MOZ_TREE_FREETYPE)
6334 MOZ_ENABLE_CAIRO_FT=1
6335 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6336 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6337 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6339 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6340 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6341 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6342 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
6345 dnl ========================================================
6347 dnl ========================================================
6348 dnl Abort Windows build if the required major version and
6349 dnl minimum minor version of Unicode NSIS isn't in the path
6350 dnl (unless in case of cross compiling, for which Unicode
6351 dnl is not yet sufficient).
6352 if test "$OS_ARCH" = "WINNT"; then
6353 MIN_NSIS_MAJOR_VER=2
6354 MIN_NSIS_MINOR_VER=46
6355 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-3.0a2.exe makensisu-2.46.exe makensis)
6356 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6357 AC_MSG_RESULT([yes])
6358 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null`
6360 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6362 if test "$MAKENSISU_PARSED_VER" = ""; then
6364 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
6367 MAKENSISU_MAJOR_VER=0
6368 MAKENSISU_MINOR_VER=0
6369 if test ! "$MAKENSISU_PARSED_VER" = ""; then
6370 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'`
6371 MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'`
6373 AC_MSG_CHECKING([for Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater])
6374 if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \
6375 "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER ||
6376 test "$MAKENSISU_MAJOR_VER" -gt $MIN_NSIS_MAJOR_VER; then
6377 AC_MSG_RESULT([yes])
6380 if test -z "$CROSS_COMPILE"; then
6381 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.])
6386 elif test -z "$CROSS_COMPILE"; then
6387 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.])
6393 dnl ========================================================
6395 dnl ========================================================
6396 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6397 [ --disable-webapp-runtime Disable Web App Runtime],
6398 MOZ_WEBAPP_RUNTIME=,
6399 MOZ_WEBAPP_RUNTIME=1)
6400 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a -z "$MOZ_WIDGET_GTK" ; then
6403 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6406 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6407 if test "$MOZ_WEBAPP_RUNTIME"; then
6408 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6411 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6412 if test -z "$TAR"; then
6413 AC_MSG_ERROR([no tar archiver found in \$PATH])
6417 AC_CHECK_PROGS(WGET, wget, "")
6420 dnl ========================================================
6422 dnl ========================================================
6424 if test -n "$MOZ_SIGN_CMD"; then
6425 AC_DEFINE(MOZ_SIGNING)
6428 dnl ========================================================
6429 dnl Maintenance Service
6430 dnl ========================================================
6432 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6433 [ --enable-maintenance-service Enable building of maintenanceservice],
6434 MOZ_MAINTENANCE_SERVICE=1,
6435 MOZ_MAINTENANCE_SERVICE= )
6437 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6438 if test "$OS_ARCH" = "WINNT"; then
6439 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6441 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6445 dnl ========================================================
6446 dnl Bundled fonts on desktop platforms
6447 dnl ========================================================
6449 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
6450 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
6451 MOZ_BUNDLED_FONTS=1,
6454 if test -n "$MOZ_BUNDLED_FONTS"; then
6455 AC_DEFINE(MOZ_BUNDLED_FONTS)
6458 dnl ========================================================
6459 dnl Verify MAR signatures
6460 dnl ========================================================
6462 MOZ_ARG_ENABLE_BOOL(verify-mar,
6463 [ --enable-verify-mar Enable verifying MAR signatures],
6464 MOZ_VERIFY_MAR_SIGNATURE=1,
6465 MOZ_VERIFY_MAR_SIGNATURE= )
6467 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6468 if test "$OS_ARCH" = "WINNT"; then
6469 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6471 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6475 dnl ========================================================
6476 dnl Enable building the signmar program.
6477 dnl This option is much different than the --enable-verify-mar option.
6478 dnl --enable-verify-mar is for enabling the verification check on MAR
6479 dnl files in the updater. The --enable-signmar option is for building
6480 dnl the signmar program.
6481 dnl ========================================================
6483 MOZ_ARG_ENABLE_BOOL(signmar,
6484 [ --enable-signmar Enable building the signmar program],
6485 MOZ_ENABLE_SIGNMAR=1,
6486 MOZ_ENABLE_SIGNMAR= )
6488 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6489 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6492 dnl ========================================================
6494 dnl ========================================================
6496 MOZ_ARG_DISABLE_BOOL(updater,
6497 [ --disable-updater Disable building of updater],
6501 if test -n "$MOZ_UPDATER"; then
6502 AC_DEFINE(MOZ_UPDATER)
6505 # tools/update-packaging is not checked out by default.
6506 MOZ_ARG_ENABLE_BOOL(update-packaging,
6507 [ --enable-update-packaging
6508 Enable tools/update-packaging],
6509 MOZ_UPDATE_PACKAGING=1,
6510 MOZ_UPDATE_PACKAGING= )
6511 AC_SUBST(MOZ_UPDATE_PACKAGING)
6513 dnl ========================================================
6514 dnl build the tests by default
6515 dnl ========================================================
6516 MOZ_ARG_DISABLE_BOOL(tests,
6517 [ --disable-tests Do not build test libraries & programs],
6521 if test -n "$ENABLE_TESTS"; then
6523 AC_DEFINE(ENABLE_TESTS)
6524 AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6525 AC_SUBST(GTEST_HAS_RTTI)
6526 if test -n "$_WIN32_MSVC"; then
6527 AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6529 if test "${OS_TARGET}" = "Android"; then
6530 AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6531 AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6532 AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6533 AC_SUBST(GTEST_OS_LINUX_ANDROID)
6534 AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6535 AC_SUBST(GTEST_HAS_CLONE)
6539 dnl ========================================================
6540 dnl parental controls (for Windows Vista)
6541 dnl ========================================================
6542 MOZ_ARG_DISABLE_BOOL(parental-controls,
6543 [ --disable-parental-controls
6544 Do not build parental controls],
6545 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6546 MOZ_DISABLE_PARENTAL_CONTROLS=)
6547 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6548 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6551 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6553 dnl ========================================================
6554 dnl = Disable smartcard support
6555 dnl ========================================================
6556 if test -n "$MOZ_NO_SMART_CARDS"; then
6557 AC_DEFINE(MOZ_NO_SMART_CARDS)
6559 AC_SUBST(MOZ_NO_SMART_CARDS)
6561 dnl ========================================================
6562 dnl = Disable EV certificate verification
6563 dnl ========================================================
6564 if test -n "$MOZ_NO_EV_CERTS"; then
6565 AC_DEFINE(MOZ_NO_EV_CERTS)
6567 AC_SUBST(MOZ_NO_EV_CERTS)
6569 dnl ========================================================
6570 dnl = Disable libpkix
6571 dnl ========================================================
6572 if test -n "$NSS_NO_LIBPKIX"; then
6573 AC_DEFINE(NSS_NO_LIBPKIX)
6575 AC_SUBST(NSS_NO_LIBPKIX)
6577 dnl ========================================================
6578 dnl = Sandboxing support
6579 dnl ========================================================
6580 MOZ_ARG_DISABLE_BOOL(sandbox,
6581 [ --disable-sandbox Disable sandboxing support],
6585 dnl ========================================================
6586 dnl = Content process sandboxing
6587 dnl ========================================================
6588 if test -n "$gonkdir"; then
6589 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6592 case "$OS_TARGET:$NIGHTLY_BUILD" in
6594 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6597 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6600 MOZ_ARG_ENABLE_BOOL(content-sandbox,
6601 [ --enable-content-sandbox Enable sandboxing support for content-processes],
6602 MOZ_CONTENT_SANDBOX=1,
6603 MOZ_CONTENT_SANDBOX=)
6607 if test -n "$MOZ_CONTENT_SANDBOX"; then
6608 AC_DEFINE(MOZ_CONTENT_SANDBOX)
6611 AC_SUBST(MOZ_CONTENT_SANDBOX)
6613 dnl ========================================================
6614 dnl = Gecko Media Plugin sandboxing
6615 dnl ========================================================
6618 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6623 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6628 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6632 if test -n "$MOZ_GMP_SANDBOX"; then
6633 AC_DEFINE(MOZ_GMP_SANDBOX)
6636 AC_SUBST(MOZ_GMP_SANDBOX)
6638 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
6642 if test -n "$MOZ_SANDBOX"; then
6643 AC_DEFINE(MOZ_SANDBOX)
6646 AC_SUBST(MOZ_SANDBOX)
6649 dnl ========================================================
6651 dnl = Module specific options
6653 dnl ========================================================
6654 MOZ_ARG_HEADER(Individual module options)
6656 dnl ========================================================
6657 dnl = Disable feed handling components
6658 dnl ========================================================
6659 MOZ_ARG_DISABLE_BOOL(feeds,
6660 [ --disable-feeds Disable feed handling and processing components],
6663 if test -n "$MOZ_FEEDS"; then
6664 AC_DEFINE(MOZ_FEEDS)
6666 if test "$MOZ_BUILD_APP" = "browser"; then
6667 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6671 dnl ========================================================
6672 dnl Check for sqlite
6673 dnl ========================================================
6676 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6677 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6678 MOZ_NATIVE_SQLITE=1,
6679 MOZ_NATIVE_SQLITE= )
6681 if test -n "$MOZ_NATIVE_SQLITE"
6683 dnl ============================
6684 dnl === SQLite Version check ===
6685 dnl ============================
6686 dnl Check to see if the system SQLite package is new enough.
6687 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6689 dnl ==================================
6690 dnl === SQLITE_SECURE_DELETE check ===
6691 dnl ==================================
6692 dnl Check to see if the system SQLite package is compiled with
6693 dnl SQLITE_SECURE_DELETE enabled.
6694 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6695 _SAVE_CFLAGS="$CFLAGS"
6696 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6698 LIBS="$LIBS $SQLITE_LIBS"
6699 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6701 #include "sqlite3.h"
6703 int main(int argc, char **argv){
6704 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6706 ac_cv_sqlite_secure_delete=yes,
6707 ac_cv_sqlite_secure_delete=no,
6708 ac_cv_sqlite_secure_delete=no
6711 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6712 CFLAGS="$_SAVE_CFLAGS"
6714 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6715 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6718 dnl ===============================
6719 dnl === SQLITE_THREADSAFE check ===
6720 dnl ===============================
6721 dnl Check to see if the system SQLite package is compiled with
6722 dnl SQLITE_THREADSAFE enabled.
6723 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6724 _SAVE_CFLAGS="$CFLAGS"
6725 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6727 LIBS="$LIBS $SQLITE_LIBS"
6728 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6730 #include "sqlite3.h"
6732 int main(int argc, char **argv){
6733 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6735 ac_cv_sqlite_threadsafe=yes,
6736 ac_cv_sqlite_threadsafe=no,
6737 ac_cv_sqlite_threadsafe=no
6740 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6741 CFLAGS="$_SAVE_CFLAGS"
6743 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6744 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6747 dnl ================================
6748 dnl === SQLITE_ENABLE_FTS3 check ===
6749 dnl ================================
6750 dnl check to see if the system SQLite package is compiled with
6751 dnl SQLITE_ENABLE_FTS3 enabled.
6752 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6753 _SAVE_CFLAGS="$CFLAGS"
6754 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6756 LIBS="$LIBS $SQLITE_LIBS"
6757 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6759 #include "sqlite3.h"
6761 int main(int argc, char **argv){
6762 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6764 ac_cv_sqlite_enable_fts3=yes,
6765 ac_cv_sqlite_enable_fts3=no,
6766 ac_cv_sqlite_enable_fts3=no
6769 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6770 CFLAGS="$_SAVE_CFLAGS"
6772 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6773 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6776 dnl =========================================
6777 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6778 dnl =========================================
6779 dnl check to see if the system SQLite package is compiled with
6780 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6781 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6782 _SAVE_CFLAGS="$CFLAGS"
6783 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6785 LIBS="$LIBS $SQLITE_LIBS"
6786 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6788 #include "sqlite3.h"
6790 int main(int argc, char **argv){
6791 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6793 ac_cv_sqlite_enable_unlock_notify=yes,
6794 ac_cv_sqlite_enable_unlock_notify=no,
6795 ac_cv_sqlite_enable_unlock_notify=no
6798 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6799 CFLAGS="$_SAVE_CFLAGS"
6801 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6802 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6806 if test -n "$MOZ_NATIVE_SQLITE"; then
6807 AC_DEFINE(MOZ_NATIVE_SQLITE)
6809 AC_SUBST(MOZ_NATIVE_SQLITE)
6811 dnl ========================================================
6812 dnl = Enable help viewer (off by default)
6813 dnl ========================================================
6814 if test -n "$MOZ_HELP_VIEWER"; then
6815 dnl Do this if defined in confvars.sh
6816 AC_DEFINE(MOZ_HELP_VIEWER)
6819 dnl ========================================================
6820 dnl = Enable safe browsing (anti-phishing)
6821 dnl ========================================================
6822 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6823 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6824 MOZ_SAFE_BROWSING=1,
6825 MOZ_SAFE_BROWSING= )
6826 if test -n "$MOZ_SAFE_BROWSING"; then
6827 AC_DEFINE(MOZ_SAFE_BROWSING)
6829 AC_SUBST(MOZ_SAFE_BROWSING)
6831 dnl ========================================================
6832 dnl = Enable url-classifier
6833 dnl ========================================================
6834 dnl Implicitly enabled by default if building with safe-browsing
6835 if test -n "$MOZ_SAFE_BROWSING"; then
6836 MOZ_URL_CLASSIFIER=1
6838 MOZ_ARG_ENABLE_BOOL(url-classifier,
6839 [ --enable-url-classifier Enable url classifier module],
6840 MOZ_URL_CLASSIFIER=1,
6841 MOZ_URL_CLASSIFIER= )
6842 if test -n "$MOZ_URL_CLASSIFIER"; then
6843 AC_DEFINE(MOZ_URL_CLASSIFIER)
6845 AC_SUBST(MOZ_URL_CLASSIFIER)
6847 dnl ========================================================
6848 dnl = Disable zipwriter
6849 dnl ========================================================
6850 MOZ_ARG_DISABLE_BOOL(zipwriter,
6851 [ --disable-zipwriter Disable zipwriter component],
6854 AC_SUBST(MOZ_ZIPWRITER)
6856 dnl ========================================================
6858 dnl ========================================================
6860 MOZ_ARG_WITH_STRING(gl-provider,
6861 [ --with-gl-provider=ID
6862 Set GL provider backend type],
6863 [ val=`echo $withval`
6864 MOZ_GL_PROVIDER="$val"])
6866 if test -n "$MOZ_GL_PROVIDER"; then
6867 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6868 AC_SUBST(MOZ_GL_PROVIDER)
6869 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6871 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6872 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6874 dnl ========================================================
6875 dnl = faststripe theme
6876 dnl ========================================================
6877 MOZ_ARG_ENABLE_BOOL(faststripe,
6878 [ --enable-faststripe Use faststripe theme],
6879 MOZ_THEME_FASTSTRIPE=1,
6880 MOZ_THEME_FASTSTRIPE= )
6881 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6883 dnl ========================================================
6885 dnl = Feature options that require extra sources to be pulled
6887 dnl ========================================================
6888 dnl MOZ_ARG_HEADER(Features that require extra sources)
6890 dnl ========================================================
6892 dnl = Runtime debugging and Optimization Options
6894 dnl ========================================================
6895 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
6897 dnl ========================================================
6898 dnl enable mobile optimizations
6899 dnl ========================================================
6900 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6901 [ --enable-mobile-optimize
6902 Enable mobile optimizations],
6903 MOZ_GFX_OPTIMIZE_MOBILE=1)
6905 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6907 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6908 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6911 dnl ========================================================
6912 dnl = Enable code optimization. ON by default.
6913 dnl ========================================================
6914 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6915 MOZ_OPTIMIZE_FLAGS="-O"
6918 MOZ_ARG_ENABLE_STRING(optimize,
6919 [ --disable-optimize Disable compiler optimization
6920 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6921 [ if test "$enableval" != "no"; then
6923 if test -n "$enableval" -a "$enableval" != "yes"; then
6924 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6929 fi ], MOZ_OPTIMIZE=1)
6931 MOZ_SET_FRAMEPTR_FLAGS
6933 if test "$COMPILE_ENVIRONMENT"; then
6934 if test -n "$MOZ_OPTIMIZE"; then
6935 AC_MSG_CHECKING([for valid optimization flags])
6936 _SAVE_CFLAGS=$CFLAGS
6937 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6938 AC_TRY_COMPILE([#include <stdio.h>],
6939 [printf("Hello World\n");],
6942 AC_MSG_RESULT([$_results])
6943 if test "$_results" = "no"; then
6944 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6946 CFLAGS=$_SAVE_CFLAGS
6948 fi # COMPILE_ENVIRONMENT
6950 AC_SUBST(MOZ_OPTIMIZE)
6951 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6952 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6953 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6954 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6955 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6957 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6959 dnl ========================================================
6960 dnl = Enable NS_StackWalk.
6961 dnl ========================================================
6963 # On Windows, NS_StackWalk will only work correctly if we have frame pointers
6964 # available. That will only be true for non-optimized builds, debug builds or
6965 # builds with --enable-profiling in the .mozconfig (which is turned on in
6966 # Nightly by default.)
6967 case "$OS_TARGET" in
6969 if test -z "$MOZ_OPTIMIZE" -o -n "$MOZ_PROFILING" -o -n "$MOZ_DEBUG"; then
6980 if test -n "$MOZ_STACKWALKING"; then
6981 AC_DEFINE(MOZ_STACKWALKING)
6984 AC_SUBST(MOZ_STACKWALKING)
6986 dnl ========================================================
6987 dnl = Disable treating compiler warnings as errors
6988 dnl ========================================================
6989 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6990 WARNINGS_AS_ERRORS=''
6991 elif test "$GNU_CC"; then
6992 # Prevent the following GCC warnings from being treated as errors:
6993 # -Wuninitialized - too many false positives
6994 # -Wmaybe-uninitialized - too many false positives
6995 # -Wdeprecated-declarations - we don't want our builds held hostage when a
6996 # platform-specific API becomes deprecated.
6997 MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
6998 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
6999 MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
7000 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
7001 MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
7002 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
7004 if test -n "$MOZ_PGO"; then
7005 MOZ_C_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_c_has_noerror_coverage_mismatch)
7006 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_cxx_has_noerror_coverage_mismatch)
7010 dnl ========================================================
7011 dnl = Disable runtime logging checks
7012 dnl ========================================================
7013 MOZ_ARG_DISABLE_BOOL(logging,
7014 [ --disable-logging Disable logging facilities],
7015 NS_DISABLE_LOGGING=1,
7016 NS_DISABLE_LOGGING= )
7017 if test "$NS_DISABLE_LOGGING"; then
7018 AC_DEFINE(NS_DISABLE_LOGGING)
7020 AC_DEFINE(MOZ_LOGGING)
7021 AC_DEFINE(FORCE_PR_LOG)
7024 dnl ========================================================
7025 dnl = This will enable logging of addref, release, ctor, dtor.
7026 dnl ========================================================
7027 _ENABLE_LOGREFCNT=42
7028 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7029 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
7030 _ENABLE_LOGREFCNT=1,
7031 _ENABLE_LOGREFCNT= )
7032 if test "$_ENABLE_LOGREFCNT" = "1"; then
7033 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7034 elif test -z "$_ENABLE_LOGREFCNT"; then
7035 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7038 dnl ========================================================
7039 dnl moz_aproximate_location
7040 dnl ========================================================
7041 MOZ_ARG_ENABLE_BOOL(approximate_location,
7042 [ --enable-approximate-location Enable approximate location ],
7043 MOZ_APPROX_LOCATION=1,
7044 MOZ_APPROX_LOCATION= )
7045 if test -n "$MOZ_APPROX_LOCATION"; then
7046 AC_DEFINE(MOZ_APPROX_LOCATION)
7049 dnl ========================================================
7051 dnl ========================================================
7052 MOZ_ARG_ENABLE_BOOL(gps_debug,
7053 [ --enable-gps-debug Enable gps specific debug messages ],
7056 if test -n "$MOZ_GPS_DEBUG"; then
7057 AC_DEFINE(MOZ_GPS_DEBUG)
7059 if test -n "$MOZ_DEBUG"; then
7060 AC_DEFINE(MOZ_GPS_DEBUG)
7063 dnl ========================================================
7064 dnl moz_dump_painting
7065 dnl ========================================================
7066 MOZ_ARG_ENABLE_BOOL(dump-painting,
7067 [ --enable-dump-painting Enable paint debugging.],
7068 MOZ_DUMP_PAINTING=1,
7069 MOZ_DUMP_PAINTING= )
7070 if test -n "$MOZ_DUMP_PAINTING"; then
7071 AC_DEFINE(MOZ_DUMP_PAINTING)
7072 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
7074 if test -n "$MOZ_DEBUG"; then
7075 AC_DEFINE(MOZ_DUMP_PAINTING)
7078 dnl ========================================================
7079 dnl = Enable trace malloc
7080 dnl ========================================================
7081 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7082 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7083 [ --enable-trace-malloc Enable malloc tracing; also disables DMD and jemalloc],
7086 if test "$NS_TRACE_MALLOC"; then
7087 # Please, Mr. Linker Man, don't take away our symbol names
7088 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7089 AC_DEFINE(NS_TRACE_MALLOC)
7091 AC_SUBST(NS_TRACE_MALLOC)
7093 dnl ========================================================
7095 dnl ========================================================
7097 MOZ_ARG_ENABLE_BOOL(dmd,
7098 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
7102 dnl The two options are conflicting. Fails the configure to alert the user.
7103 if test "$NS_TRACE_MALLOC" -a "$MOZ_DMD"; then
7104 AC_MSG_ERROR([--enable-trace-malloc and --enable-dmd are conflicting options])
7107 if test "$MOZ_DMD"; then
7110 if test "${CPU_ARCH}" = "arm"; then
7111 CFLAGS="$CFLAGS -funwind-tables"
7112 CXXFLAGS="$CXXFLAGS -funwind-tables"
7115 MOZ_MEMORY=1 # DMD enables jemalloc
7116 MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
7120 dnl ========================================================
7121 dnl = Enable jemalloc
7122 dnl ========================================================
7123 MOZ_ARG_ENABLE_BOOL(jemalloc,
7124 [ --enable-jemalloc Replace memory allocator with jemalloc],
7128 if test "$NS_TRACE_MALLOC"; then
7132 case "${OS_TARGET}" in
7133 Android|WINNT|Darwin)
7134 MOZ_GLUE_IN_PROGRAM=
7137 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
7138 MOZ_GLUE_IN_PROGRAM=1
7142 dnl ========================================================
7143 dnl = Enable dynamic replacement of malloc implementation
7144 dnl ========================================================
7145 if test -n "$NIGHTLY_BUILD" -a -n "$MOZ_MEMORY"; then
7146 # Enable on central for the debugging opportunities it adds.
7147 MOZ_REPLACE_MALLOC=1
7149 MOZ_ARG_ENABLE_BOOL(replace-malloc,
7150 [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
7151 MOZ_REPLACE_MALLOC=1,
7152 MOZ_REPLACE_MALLOC= )
7154 dnl The two options are conflicting. Fails the configure to alert the user.
7155 if test "$NS_TRACE_MALLOC" -a "$MOZ_REPLACE_MALLOC"; then
7156 AC_MSG_ERROR([--enable-trace-malloc and --enable-replace-malloc are conflicting options])
7159 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
7160 dnl We don't want to enable jemalloc unconditionally because it may be a
7161 dnl deliberate choice not to enable it (bug 702250, for instance)
7162 AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
7163 elif test -n "$MOZ_REPLACE_MALLOC"; then
7164 MOZ_NATIVE_JEMALLOC=
7166 dnl Replace-malloc Mac linkage quirks
7167 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
7168 AC_CACHE_CHECK([how to do weak dynamic linking],
7169 ac_cv_weak_dynamic_linking,
7170 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
7171 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
7172 test -s conftest${DLL_SUFFIX}; then
7173 dnl There are several ways the linker can put link edit rules in a binary:
7174 dnl - classic info only (for OSX < 10.6)
7175 dnl - dyld info only
7177 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
7182 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
7187 dnl With classic info, we need to build with -flat_namespace.
7188 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
7189 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
7190 dnl forgets to set the weak flag in the dyld info.
7191 dnl See http://glandium.org/blog/?p=2764 for more details.
7193 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
7194 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
7195 dnl - "flat namespace" when -flat_namespace alone is needed
7196 dnl - "dummy library" when a dummy library and -flat_namespace are needed
7197 dnl - "compiler support" when nothing is needed
7198 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
7199 if test -n "$_CLASSIC_INFO"; then
7200 ac_cv_weak_dynamic_linking="flat namespace"
7202 ac_cv_weak_dynamic_linking="compiler support"
7205 if test -n "$_DYLD_INFO"; then
7206 ac_cv_weak_dynamic_linking="dummy library"
7208 ac_cv_weak_dynamic_linking="flat namespace"
7212 AC_ERROR([couldn't compile a simple C file])
7215 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
7218 AC_SUBST(MOZ_REPLACE_MALLOC)
7219 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
7221 dnl ========================================================
7222 dnl = Jemalloc build setup
7223 dnl ========================================================
7224 if test -z "$MOZ_MEMORY"; then
7225 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
7226 MOZ_NATIVE_JEMALLOC=1
7227 AC_CHECK_FUNCS(mallctl nallocm,,
7228 [MOZ_NATIVE_JEMALLOC=
7230 if test -n "$MOZ_NATIVE_JEMALLOC"; then
7232 AC_DEFINE(MOZ_MEMORY)
7233 AC_DEFINE(MOZ_JEMALLOC3)
7234 AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7239 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7240 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.])
7245 AC_DEFINE(MOZ_MEMORY)
7246 if test -n "$MOZ_JEMALLOC3"; then
7247 AC_DEFINE(MOZ_JEMALLOC3)
7249 if test "x$MOZ_DEBUG" = "x1"; then
7250 AC_DEFINE(MOZ_MEMORY_DEBUG)
7252 dnl The generic feature tests that determine how to compute ncpus are long and
7253 dnl complicated. Therefore, simply define special cpp variables for the
7254 dnl platforms we have special knowledge of.
7257 AC_DEFINE(MOZ_MEMORY_DARWIN)
7260 AC_DEFINE(MOZ_MEMORY_BSD)
7262 *-android*|*-linuxandroid*)
7263 AC_DEFINE(MOZ_MEMORY_LINUX)
7264 AC_DEFINE(MOZ_MEMORY_ANDROID)
7265 if test -n "$gonkdir"; then
7266 AC_DEFINE(MOZ_MEMORY_GONK)
7270 AC_DEFINE(MOZ_MEMORY_LINUX)
7273 AC_DEFINE(MOZ_MEMORY_BSD)
7276 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7279 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7280 export MOZ_NO_DEBUG_RTL=1
7281 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7282 dnl Look for a broken crtdll.obj
7283 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7284 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7285 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7291 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7295 AC_SUBST(MOZ_MEMORY)
7296 AC_SUBST(MOZ_JEMALLOC3)
7297 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7300 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
7301 AC_SUBST_LIST(WIN32_CRT_LIBS)
7303 dnl We need to wrap dlopen and related functions on Android because we use
7305 if test "$OS_TARGET" = Android; then
7306 MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7307 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
7308 MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_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"
7312 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
7313 export MOZ_GLUE_WRAP_LDFLAGS
7315 dnl ========================================================
7316 dnl = Use JS Call tracing
7317 dnl ========================================================
7318 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7319 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7320 MOZ_TRACE_JSCALLS=1,
7321 MOZ_TRACE_JSCALLS= )
7322 if test -n "$MOZ_TRACE_JSCALLS"; then
7323 AC_DEFINE(MOZ_TRACE_JSCALLS)
7326 dnl ========================================================
7327 dnl JS opt-mode assertions and minidump instrumentation
7328 dnl ========================================================
7329 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7330 [ --enable-js-diagnostics
7331 Enable JS diagnostic assertions and breakpad data],
7332 JS_CRASH_DIAGNOSTICS=1,
7333 JS_CRASH_DIAGNOSTICS= )
7334 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7335 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7338 dnl ========================================================
7339 dnl = Enable static checking using gcc-dehydra
7340 dnl ========================================================
7342 MOZ_ARG_WITH_STRING(static-checking,
7343 [ --with-static-checking=path/to/gcc_dehydra.so
7344 Enable static checking of code using GCC-dehydra],
7345 DEHYDRA_PATH=$withval,
7348 if test -n "$DEHYDRA_PATH"; then
7349 if test ! -f "$DEHYDRA_PATH"; then
7350 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7352 AC_DEFINE(NS_STATIC_CHECKING)
7354 AC_SUBST(DEHYDRA_PATH)
7356 dnl ========================================================
7357 dnl = Enable using the clang plugin to build
7358 dnl ========================================================
7360 MOZ_CONFIG_CLANG_PLUGIN
7362 dnl ========================================================
7363 dnl = Enable stripping of libs & executables
7364 dnl ========================================================
7365 MOZ_ARG_ENABLE_BOOL(strip,
7366 [ --enable-strip Enable stripping of libs & executables ],
7370 dnl ========================================================
7371 dnl = Enable stripping of libs & executables when packaging
7372 dnl ========================================================
7373 MOZ_ARG_ENABLE_BOOL(install-strip,
7374 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7378 dnl ========================================================
7379 dnl = --disable-elf-hack
7380 dnl ========================================================
7383 MOZ_ARG_DISABLE_BOOL(elf-hack,
7384 [ --disable-elf-hack Disable elf hacks],
7386 [USE_ELF_HACK=F # Force enable elf-hack])
7388 # Disable elf hack for profiling because the built in profiler
7389 # doesn't read the segments properly with elf hack. This is
7390 # temporary and should be fixed soon in the profiler.
7391 if test "$MOZ_PROFILING" = 1; then
7392 if test "$USE_ELF_HACK" = F; then
7393 AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
7398 # Only enable elfhack where supported
7399 if test "$USE_ELF_HACK" = 1; then
7400 case "${HOST_OS_ARCH},${OS_ARCH}" in
7402 case "${CPU_ARCH}" in
7417 if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
7418 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7419 dnl memory addresses it maps to. The result is that by the time elfhack
7420 dnl kicks in, it is not possible to apply relocations because of that,
7421 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7422 dnl segment. It makes elfhack mostly useless, so considering the problems
7423 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7424 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7425 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
7426 dnl elfhack enabled, disable PT_GNU_RELRO instead.
7427 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7428 LINK_WITH_PT_GNU_RELRO,
7429 [echo "int main() {return 0;}" > conftest.${ac_ext}
7430 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7431 test -s conftest${ac_exeext}; then
7432 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7433 LINK_WITH_PT_GNU_RELRO=yes
7435 LINK_WITH_PT_GNU_RELRO=no
7438 dnl We really don't expect to get here, but just in case
7439 AC_ERROR([couldn't compile a simple C file])
7442 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7443 if test "$USE_ELF_HACK" = F; then
7444 AC_MSG_CHECKING([for -z norelro option to ld])
7445 _SAVE_LDFLAGS=$LDFLAGS
7446 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
7447 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
7448 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
7449 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.]))
7452 AC_MSG_WARN([Disabling elfhack])
7458 dnl ========================================================
7459 dnl = libstdc++ compatibility hacks
7460 dnl ========================================================
7463 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7464 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7467 if test -n "$STDCXX_COMPAT"; then
7468 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
7469 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7470 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7473 dnl ========================================================
7475 dnl = Profiling and Instrumenting
7477 dnl ========================================================
7478 MOZ_ARG_HEADER(Profiling and Instrumenting)
7480 dnl ========================================================
7481 dnl = Enable runtime visual profiling logger
7482 dnl ========================================================
7483 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7484 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7485 MOZ_VISUAL_EVENT_TRACER=1,
7486 MOZ_VISUAL_EVENT_TRACER=)
7487 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7488 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7491 dnl ========================================================
7492 dnl = Enable TaskTracer
7493 dnl ========================================================
7494 MOZ_ARG_ENABLE_BOOL(tasktracer,
7495 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
7498 if test "$MOZ_WIDGET_TOOLKIT" = "gonk" -a -n "$MOZ_TASK_TRACER"; then
7499 AC_DEFINE(MOZ_TASK_TRACER)
7500 AC_SUBST(MOZ_TASK_TRACER)
7503 dnl ========================================================
7504 dnl Turn on reflow counting
7505 dnl ========================================================
7506 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7507 [ --enable-reflow-perf Enable reflow performance tracing],
7510 if test -n "$MOZ_REFLOW_PERF"; then
7511 AC_DEFINE(MOZ_REFLOW_PERF)
7514 dnl ========================================================
7515 dnl = Offer a way to disable the startup cache
7516 dnl ========================================================
7517 MOZ_DISABLE_STARTUPCACHE=
7519 MOZ_ARG_DISABLE_BOOL(startupcache,
7520 [ --disable-startupcache Disable startup cache ],
7521 MOZ_DISABLE_STARTUPCACHE=1,
7522 MOZ_DISABLE_STARTUPCACHE=)
7524 dnl bug 988880: disable startup cache on b2g
7525 if test -n "$MOZ_B2G"; then
7526 MOZ_DISABLE_STARTUPCACHE=1
7529 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
7531 dnl ========================================================
7532 dnl = Enable Radio Interface for B2G (Gonk usually)
7533 dnl ========================================================
7534 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7535 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7538 MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL )
7539 if test -n "$MOZ_B2G_RIL"; then
7540 if test -n "$_PLATFORM_HAVE_RIL"; then
7541 AC_DEFINE(MOZ_B2G_RIL)
7543 AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.])
7546 AC_SUBST(MOZ_B2G_RIL)
7548 dnl ========================================================
7549 dnl = Enable Radio FM for B2G (Gonk usually)
7550 dnl ========================================================
7551 if test -n "$MOZ_B2G_FM"; then
7552 AC_DEFINE(MOZ_B2G_FM)
7554 AC_SUBST(MOZ_B2G_FM)
7556 dnl ========================================================
7557 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7558 dnl ========================================================
7559 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7560 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7563 if test -n "$MOZ_B2G_BT"; then
7564 AC_DEFINE(MOZ_B2G_BT)
7566 AC_SUBST(MOZ_B2G_BT)
7567 AC_SUBST(MOZ_B2G_BT_BLUEZ)
7568 AC_SUBST(MOZ_B2G_BT_BLUEDROID)
7569 AC_SUBST(MOZ_B2G_BT_DAEMON)
7571 dnl ========================================================
7572 dnl = Enable NFC Interface for B2G (Gonk usually)
7573 dnl ========================================================
7574 MOZ_ARG_ENABLE_BOOL(nfc,
7575 [ --enable-nfc Set compile flags necessary for compiling NFC API ],
7578 if test -n "$MOZ_NFC"; then
7583 dnl ========================================================
7584 dnl = Enable Pico Speech Synthesis (Gonk usually)
7585 dnl ========================================================
7586 MOZ_ARG_ENABLE_BOOL(synth-pico,
7587 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
7590 if test -n "$MOZ_SYNTH_PICO"; then
7591 AC_DEFINE(MOZ_SYNTH_PICO)
7593 AC_SUBST(MOZ_SYNTH_PICO)
7595 dnl ========================================================
7596 dnl = Enable Support for Time Manager API
7597 dnl ========================================================
7598 if test -n "$MOZ_TIME_MANAGER"; then
7599 AC_DEFINE(MOZ_TIME_MANAGER)
7601 AC_SUBST(MOZ_TIME_MANAGER)
7603 dnl ========================================================
7604 dnl = Enable Camera Interface for B2G (Gonk usually)
7605 dnl ========================================================
7606 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7607 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7610 if test -n "$MOZ_B2G_CAMERA"; then
7611 AC_DEFINE(MOZ_B2G_CAMERA)
7613 AC_SUBST(MOZ_B2G_CAMERA)
7615 dnl ========================================================
7616 dnl = Enable Support for Payment API
7617 dnl ========================================================
7618 if test -n "$MOZ_PAY"; then
7623 dnl ========================================================
7624 dnl = Enable Browser Support for Activities
7625 dnl ========================================================
7626 if test -n "$MOZ_ACTIVITIES"; then
7627 AC_DEFINE(MOZ_ACTIVITIES)
7629 AC_SUBST(MOZ_ACTIVITIES)
7631 dnl ========================================================
7632 dnl = Enable Support for AudioChannelManager API
7633 dnl ========================================================
7634 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7635 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7637 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7639 dnl ========================================================
7640 dnl = Support for demangling undefined symbols
7641 dnl ========================================================
7642 if test -z "$SKIP_LIBRARY_CHECKS"; then
7645 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7649 # Demangle only for debug or trace-malloc or DMD builds
7650 MOZ_DEMANGLE_SYMBOLS=
7651 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7652 MOZ_DEMANGLE_SYMBOLS=1
7653 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7655 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7657 dnl ========================================================
7658 dnl = Support for gcc stack unwinding (from gcc 3.3)
7659 dnl ========================================================
7660 if test -z "$SKIP_LIBRARY_CHECKS"; then
7663 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7667 dnl ========================================================
7669 dnl ========================================================
7671 MOZ_ARG_WITH_STRING(jitreport-granularity,
7672 [ --jitreport-granularity=N
7673 Default granularity at which to report JIT code
7676 1 - code ranges for whole functions only
7677 2 - per-line information
7678 3 - per-op information],
7679 JITREPORT_GRANULARITY=$withval,
7680 JITREPORT_GRANULARITY=3)
7682 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7684 dnl ========================================================
7688 dnl ========================================================
7689 MOZ_ARG_HEADER(Misc. Options)
7691 dnl ========================================================
7692 dnl update xterm title
7693 dnl ========================================================
7694 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7695 [ --enable-xterm-updates Update XTERM titles with current command.],
7699 dnl =========================================================
7701 dnl =========================================================
7702 MOZ_ARG_ENABLE_STRING([chrome-format],
7703 [ --enable-chrome-format=jar|flat|omni
7704 Select FORMAT of chrome files during packaging],
7705 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7707 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7708 MOZ_CHROME_FILE_FORMAT=jar
7711 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7712 AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7715 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7716 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7717 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7718 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7721 dnl =========================================================
7722 dnl Enable support for revamped devtools Performance Tools
7723 dnl =========================================================
7725 MOZ_ARG_ENABLE_BOOL(devtools-perf,
7726 [ --enable-devtools-perf Set compile flags necessary for compiling devtools perftools],
7727 MOZ_DEVTOOLS_PERFTOOLS=1,
7728 MOZ_DEVTOOLS_PERFTOOLS= )
7729 if test -n "$MOZ_DEVTOOLS_PERFTOOLS"; then
7730 AC_DEFINE(MOZ_DEVTOOLS_PERFTOOLS)
7732 AC_SUBST(MOZ_DEVTOOLS_PERFTOOLS)
7734 dnl =========================================================
7735 dnl Omnijar packaging (bug 552121)
7736 dnl =========================================================
7737 dnl Omnijar packaging is compatible with flat packaging.
7738 dnl In unpackaged builds, omnijar looks for files as if
7739 dnl things were flat packaged. After packaging, all files
7740 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7741 dnl is set to flat since putting files into jars is only
7742 dnl done during packaging with omnijar.
7743 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7745 AC_DEFINE(MOZ_OMNIJAR)
7747 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7748 if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7749 MOZ_CHROME_FILE_FORMAT=flat
7751 MOZ_CHROME_FILE_FORMAT=symlink
7754 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7755 dnl Fennec's static resources live in the assets/ folder of the
7756 dnl APK. Adding a path to the name here works because we only
7757 dnl have one omnijar file in the final package (which is not the
7758 dnl case on desktop), and necessitates some contortions during
7759 dnl packaging so that the resources in the omnijar are considered
7760 dnl as rooted at / and not as rooted at assets/ (which again is
7761 dnl not the case on desktop: there are omnijars rooted at webrtc/,
7762 dnl etc). packager.mk handles changing the rooting of the single
7764 OMNIJAR_NAME=assets/omni.ja
7766 OMNIJAR_NAME=omni.ja
7769 AC_SUBST(OMNIJAR_NAME)
7770 AC_SUBST(MOZ_OMNIJAR)
7771 AC_SUBST(MOZ_PACKAGER_FORMAT)
7773 dnl ========================================================
7774 dnl = Define default location for MOZILLA_FIVE_HOME
7775 dnl ========================================================
7776 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7777 [ --with-default-mozilla-five-home
7778 Set the default value for MOZILLA_FIVE_HOME],
7779 [ val=`echo $withval`
7780 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7782 dnl ========================================================
7783 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7784 dnl ========================================================
7785 MOZ_ARG_WITH_STRING(user-appdir,
7786 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7787 [ val=`echo $withval`
7788 if echo "$val" | grep "\/" >/dev/null; then
7789 AC_MSG_ERROR("Homedir must be single relative path.")
7794 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7796 dnl ========================================================
7797 dnl = Doxygen configuration
7798 dnl ========================================================
7799 dnl Use commas to specify multiple dirs to this arg
7800 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7801 MOZ_ARG_WITH_STRING(doc-input-dirs,
7802 [ --with-doc-input-dirs=DIRS
7803 Header/idl dirs to create docs from],
7804 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7805 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7807 dnl Use commas to specify multiple dirs to this arg
7808 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7809 MOZ_ARG_WITH_STRING(doc-include-dirs,
7810 [ --with-doc-include-dirs=DIRS
7811 Include dirs to preprocess doc headers],
7812 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7813 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7815 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7816 MOZ_ARG_WITH_STRING(doc-output-dir,
7817 [ --with-doc-output-dir=DIR
7818 Dir to generate docs into],
7819 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7820 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7822 if test -z "$SKIP_COMPILER_CHECKS"; then
7823 dnl ========================================================
7825 dnl = Compiler Options
7827 dnl ========================================================
7828 MOZ_ARG_HEADER(Compiler Options)
7830 dnl ========================================================
7831 dnl Check for gcc -pipe support
7832 dnl ========================================================
7833 AC_MSG_CHECKING([for -pipe support])
7834 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7835 dnl Any gcc that supports firefox supports -pipe.
7836 CFLAGS="$CFLAGS -pipe"
7837 CXXFLAGS="$CXXFLAGS -pipe"
7838 AC_MSG_RESULT([yes])
7843 dnl ========================================================
7844 dnl Profile guided optimization (gcc checks)
7845 dnl ========================================================
7846 dnl Test for profiling options
7847 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7849 _SAVE_CFLAGS="$CFLAGS"
7850 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7852 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7853 AC_TRY_COMPILE([], [return 0;],
7854 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7855 result="yes" ], result="no")
7856 AC_MSG_RESULT([$result])
7858 if test $result = "yes"; then
7859 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7860 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7861 PROFILE_USE_LDFLAGS="-fprofile-use"
7864 CFLAGS="$_SAVE_CFLAGS"
7866 if test -n "$INTEL_CC"; then
7867 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7868 PROFILE_GEN_LDFLAGS=
7869 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7870 PROFILE_USE_LDFLAGS=
7873 dnl Sun Studio on Solaris
7874 if test "$SOLARIS_SUNPRO_CC"; then
7875 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7876 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7877 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7878 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7881 AC_SUBST(PROFILE_GEN_CFLAGS)
7882 AC_SUBST(PROFILE_GEN_LDFLAGS)
7883 AC_SUBST(PROFILE_USE_CFLAGS)
7884 AC_SUBST(PROFILE_USE_LDFLAGS)
7886 dnl =============================================
7887 dnl Support for -fno-integrated-as (recent clang)
7888 dnl =============================================
7889 dnl Under clang 3.4+, use -fno-integrated-as to
7890 dnl build libvpx's vp8_asm_enc_offsets.c
7892 _SAVE_CFLAGS="$CFLAGS"
7893 CFLAGS="$CFLAGS -fno-integrated-as -S"
7895 AC_MSG_CHECKING([whether C compiler supports -fno-integrated-as])
7896 AC_TRY_COMPILE([], [return 0;],
7897 [ NO_INTEGRATED_AS_CFLAGS="-fno-integrated-as"
7898 result="yes" ], result="no")
7899 AC_MSG_RESULT([$result])
7901 CFLAGS="$_SAVE_CFLAGS"
7903 AC_SUBST(NO_INTEGRATED_AS_CFLAGS)
7905 fi # ! SKIP_COMPILER_CHECKS
7907 AC_DEFINE(CPP_THROW_NEW, [throw()])
7910 if test "$COMPILE_ENVIRONMENT"; then
7912 fi # COMPILE_ENVIRONMENT
7914 dnl ========================================================
7916 dnl = Build depencency options
7918 dnl ========================================================
7919 MOZ_ARG_HEADER(Build dependencies)
7921 if test "$GNU_CC" -a "$GNU_CXX"; then
7922 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7923 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7924 elif test "$SOLARIS_SUNPRO_CC"; then
7927 dnl Don't override this for MSVC
7928 if test -z "$_WIN32_MSVC"; then
7929 _USE_CPP_INCLUDE_FLAG=
7930 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7931 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7933 echo '#include <stdio.h>' > dummy-hello.c
7935 dnl This output is localized, split at the first double space or colon and space.
7936 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
7937 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
7938 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
7940 if ! test -e "$_CL_STDIO_PATH"; then
7941 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
7943 if test -z "$CL_INCLUDES_PREFIX"; then
7944 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7946 AC_SUBST(CL_INCLUDES_PREFIX)
7949 dnl Make sure that the build system can handle non-ASCII characters
7950 dnl in environment variables to prevent it from breaking silently on
7951 dnl non-English systems.
7952 NONASCII=$'\241\241'
7957 dnl ========================================================
7959 dnl = Static Build Options
7961 dnl ========================================================
7962 MOZ_ARG_HEADER(Static build options)
7964 if test -n "$GKMEDIAS_SHARED_LIBRARY"; then
7965 AC_DEFINE(GKMEDIAS_SHARED_LIBRARY)
7967 AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
7969 if test -z "$MOZ_NATIVE_ZLIB"; then
7970 if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
7972 AC_DEFINE(ZLIB_IN_MOZGLUE)
7976 AC_SUBST(ZLIB_IN_MOZGLUE)
7978 dnl ========================================================
7980 dnl = Standalone module options
7982 dnl ========================================================
7983 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7986 dnl ========================================================
7988 if test -z "$SKIP_PATH_CHECKS"; then
7989 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7990 if test "$MOZ_ENABLE_GTK" ; then
7991 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7996 if test -z "${GLIB_GMODULE_LIBS}" \
7997 -a -n "${GLIB_CONFIG}"\
7998 -a "${GLIB_CONFIG}" != no\
8000 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8003 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
8005 dnl ========================================================
8006 dnl Graphics checks.
8007 dnl ========================================================
8009 if test "${OS_TARGET}" = "WINNT"; then
8010 if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then
8011 MOZ_ENABLE_DIRECT2D1_1=1
8012 AC_SUBST(MOZ_ENABLE_DIRECT2D1_1)
8016 if test "${OS_TARGET}" = "WINNT" -o \
8017 "${OS_ARCH}" = "Darwin" -o \
8018 "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
8019 "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
8020 "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
8021 "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
8022 case "${target_cpu}" in
8034 MOZ_ARG_ENABLE_BOOL(skia,
8035 [ --enable-skia Enable use of Skia],
8039 MOZ_ARG_DISABLE_BOOL(skia-gpu,
8040 [ --disable-skia-gpu Disable use of Skia-GPU],
8041 MOZ_DISABLE_SKIA_GPU=1,
8042 MOZ_DISABLE_SKIA_GPU=)
8044 if test "$USE_FC_FREETYPE"; then
8045 if test "$COMPILE_ENVIRONMENT"; then
8046 dnl ========================================================
8047 dnl = Check for freetype2 and its functionality
8048 dnl ========================================================
8049 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
8051 if test "$_HAVE_FREETYPE2"; then
8053 _SAVE_CFLAGS="$CFLAGS"
8054 LIBS="$LIBS $FT2_LIBS"
8055 CFLAGS="$CFLAGS $FT2_CFLAGS"
8057 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
8058 ac_cv_member_FT_Bitmap_Size_y_ppem,
8059 [AC_TRY_COMPILE([#include <ft2build.h>
8060 #include FT_FREETYPE_H],
8062 if (sizeof s.y_ppem) return 0;
8064 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
8065 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
8066 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
8067 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
8069 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
8071 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
8072 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
8073 [FT_Bitmap_Size structure includes y_ppem field])
8075 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
8078 CFLAGS="$_SAVE_CFLAGS"
8081 _SAVE_CPPFLAGS="$CPPFLAGS"
8082 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8083 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8084 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8085 CPPFLAGS="$_SAVE_CPPFLAGS"
8087 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8090 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
8092 if test "$MOZ_PANGO"; then
8093 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
8094 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
8096 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
8097 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
8102 dnl ========================================================
8103 dnl Check for pixman and cairo
8104 dnl ========================================================
8106 if test "$MOZ_WIDGET_TOOLKIT" = "gtk3" ; then
8107 # cairo-gtk3 can be build with system-cairo only
8113 MOZ_ARG_ENABLE_BOOL(system-cairo,
8114 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8119 MOZ_ARG_ENABLE_BOOL(system-pixman,
8120 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8122 MOZ_TREE_PIXMAN=force,
8125 # System cairo depends on system pixman
8126 if test "$MOZ_TREE_PIXMAN" = "force"; then
8127 if test -z "$MOZ_TREE_CAIRO"; then
8128 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
8132 elif test -z "$MOZ_TREE_CAIRO"; then
8136 if test "$MOZ_TREE_PIXMAN"; then
8137 AC_DEFINE(MOZ_TREE_PIXMAN)
8139 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8140 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8141 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8143 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8144 AC_SUBST_LIST(MOZ_PIXMAN_LIBS)
8146 # Check for headers defining standard int types.
8147 if test -n "$COMPILE_ENVIRONMENT"; then
8148 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8150 if test "${ac_cv_header_inttypes_h}" = "yes"; then
8155 AC_SUBST(HAVE_INTTYPES_H)
8157 if test "$MOZ_TREE_CAIRO"; then
8158 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8159 AC_DEFINE(MOZ_TREE_CAIRO)
8161 if test "$OS_ARCH" = "WINNT"; then
8162 # For now we assume that we will have a uint64_t available through
8163 # one of the above headers or mozstdint.h.
8164 AC_DEFINE(HAVE_UINT64_T)
8167 # Define macros for cairo-features.h
8168 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8169 if test "$MOZ_X11"; then
8170 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8171 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8172 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8174 if test "$_HAVE_FREETYPE2"; then
8175 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8176 MOZ_ENABLE_CAIRO_FT=1
8177 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8180 case "$MOZ_WIDGET_TOOLKIT" in
8182 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8185 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8186 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8187 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8190 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8191 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8192 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8193 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8194 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8195 MOZ_ENABLE_D2D_SURFACE=1
8196 MOZ_ENABLE_DWRITE_FONT=1
8198 WIN32_DWRITE_FONT_FEATURE=
8199 WIN32_D2D_SURFACE_FEATURE=
8202 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8204 dnl D3D10 Layers depend on D2D Surfaces.
8205 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8206 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8210 AC_MSG_ERROR([cairo-gtk3 toolkit is incompatible with in-tree cairo. Please add --enable-system-cairo to your build config.])
8213 if test "$USE_FC_FREETYPE"; then
8214 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8216 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8217 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8218 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8219 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8220 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8222 AC_SUBST(PS_SURFACE_FEATURE)
8223 AC_SUBST(PDF_SURFACE_FEATURE)
8224 AC_SUBST(SVG_SURFACE_FEATURE)
8225 AC_SUBST(XLIB_SURFACE_FEATURE)
8226 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8227 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8228 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8229 AC_SUBST(WIN32_SURFACE_FEATURE)
8230 AC_SUBST(OS2_SURFACE_FEATURE)
8231 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8232 AC_SUBST(FT_FONT_FEATURE)
8233 AC_SUBST(FC_FONT_FEATURE)
8234 AC_SUBST(WIN32_FONT_FEATURE)
8235 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8236 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8237 AC_SUBST(QUARTZ_FONT_FEATURE)
8238 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8239 AC_SUBST(QT_SURFACE_FEATURE)
8240 AC_SUBST(TEE_SURFACE_FEATURE)
8242 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8244 if test "$MOZ_X11"; then
8245 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8248 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8250 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8251 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8252 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8253 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8254 if test "$MOZ_X11"; then
8255 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8256 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8257 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8258 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8262 AC_SUBST(MOZ_TREE_CAIRO)
8263 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
8264 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
8265 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
8266 AC_SUBST(MOZ_TREE_PIXMAN)
8268 dnl ========================================================
8270 dnl ========================================================
8271 if test "$MOZ_ENABLE_SKIA"; then
8272 AC_DEFINE(MOZ_ENABLE_SKIA)
8274 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8275 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8278 if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" -a -z "$MOZ_DISABLE_SKIA_GPU" ; then
8279 MOZ_ENABLE_SKIA_GPU=1
8280 AC_DEFINE(USE_SKIA_GPU)
8281 AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8284 AC_SUBST(MOZ_ENABLE_SKIA)
8286 dnl ========================================================
8288 dnl ========================================================
8289 MOZ_ARG_DISABLE_BOOL(xul,
8290 [ --disable-xul Disable XUL],
8292 if test "$MOZ_XUL"; then
8295 dnl remove extensions that require XUL
8296 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
8301 dnl ========================================================
8302 dnl disable profile locking
8303 dnl do no use this in applications that can have more than
8304 dnl one process accessing the profile directory.
8305 dnl ========================================================
8306 MOZ_ARG_DISABLE_BOOL(profilelocking,
8307 [ --disable-profilelocking
8308 Disable profile locking],
8309 MOZ_PROFILELOCKING=,
8310 MOZ_PROFILELOCKING=1 )
8311 if test "$MOZ_PROFILELOCKING"; then
8312 AC_DEFINE(MOZ_PROFILELOCKING)
8315 dnl ========================================================
8316 dnl necko configuration options
8317 dnl ========================================================
8320 dnl option to disable various necko protocols
8322 MOZ_ARG_ENABLE_STRING(necko-protocols,
8323 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8324 Enable/disable specific protocol handlers],
8325 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8326 if test "$option" = "yes" -o "$option" = "all"; then
8327 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8328 elif test "$option" = "no" -o "$option" = "none"; then
8330 elif test "$option" = "default"; then
8331 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8332 elif test `echo "$option" | grep -c \^-` != 0; then
8333 option=`echo $option | sed 's/^-//'`
8334 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8336 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8339 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8341 NECKO_PROTOCOLS=`$PYTHON ${srcdir}/build/unix/uniq.py ${NECKO_PROTOCOLS}`
8342 AC_SUBST_SET(NECKO_PROTOCOLS)
8343 for p in $NECKO_PROTOCOLS; do
8344 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8345 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8349 dnl option to disable necko's wifi scanner
8352 case "$OS_TARGET" in
8354 if test -n "$gonkdir"; then
8358 Darwin|FreeBSD|SunOS|WINNT)
8367 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8368 [ --disable-necko-wifi Disable necko wifi scanner],
8372 if test "$NECKO_WIFI"; then
8373 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
8374 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
8376 AC_DEFINE(NECKO_WIFI)
8377 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8379 AC_SUBST(NECKO_WIFI)
8380 AC_SUBST(NECKO_WIFI_DBUS)
8383 dnl option to disable cookies
8385 MOZ_ARG_DISABLE_BOOL(cookies,
8386 [ --disable-cookies Disable cookie support],
8389 AC_SUBST(NECKO_COOKIES)
8390 if test "$NECKO_COOKIES"; then
8391 AC_DEFINE(NECKO_COOKIES)
8392 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8396 dnl Always build Marionette if not Android or B2G
8398 if test "$OS_TARGET" != Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
8399 AC_DEFINE(ENABLE_MARIONETTE)
8401 AC_SUBST(ENABLE_MARIONETTE)
8402 if test "$ENABLE_MARIONETTE"; then
8403 AC_DEFINE(ENABLE_MARIONETTE)
8407 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8409 MOZ_ARG_DISABLE_BOOL(ctypes,
8410 [ --disable-ctypes Disable js-ctypes],
8413 AC_SUBST(BUILD_CTYPES)
8414 if test "$BUILD_CTYPES"; then
8415 AC_DEFINE(BUILD_CTYPES)
8418 dnl Build Places if required
8419 if test "$MOZ_PLACES"; then
8420 AC_DEFINE(MOZ_PLACES)
8423 dnl Build SocialAPI if required
8424 if test "$MOZ_SOCIAL"; then
8425 AC_DEFINE(MOZ_SOCIAL)
8428 dnl Build Common JS modules provided by services.
8429 AC_SUBST(MOZ_SERVICES_COMMON)
8430 if test -n "$MOZ_SERVICES_COMMON"; then
8431 AC_DEFINE(MOZ_SERVICES_COMMON)
8434 dnl Build Services crypto component (used by Sync)
8435 AC_SUBST(MOZ_SERVICES_CRYPTO)
8436 if test -n "$MOZ_SERVICES_CRYPTO"; then
8437 AC_DEFINE(MOZ_SERVICES_CRYPTO)
8440 dnl Build Firefox Health Reporter Service
8441 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8442 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8443 AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8446 dnl Build Services metrics component
8447 AC_SUBST(MOZ_SERVICES_METRICS)
8448 if test -n "$MOZ_SERVICES_METRICS"; then
8449 AC_DEFINE(MOZ_SERVICES_METRICS)
8452 dnl Build Notifications if required
8453 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8454 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8455 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8458 dnl Build Sync Services if required
8459 AC_SUBST(MOZ_SERVICES_SYNC)
8460 if test -n "$MOZ_SERVICES_SYNC"; then
8461 AC_DEFINE(MOZ_SERVICES_SYNC)
8464 dnl Build Services/CloudSync if required
8465 AC_SUBST(MOZ_SERVICES_CLOUDSYNC)
8466 if test -n "$MOZ_SERVICES_CLOUDSYNC"; then
8467 AC_DEFINE(MOZ_SERVICES_CLOUDSYNC)
8470 dnl Build Captive Portal Detector if required
8471 AC_SUBST(MOZ_CAPTIVEDETECT)
8472 if test -n "$MOZ_CAPTIVEDETECT"; then
8473 AC_DEFINE(MOZ_CAPTIVEDETECT)
8476 dnl Build second screen and casting features for external devices if required
8477 AC_SUBST(MOZ_DEVICES)
8478 if test -n "$MOZ_DEVICES"; then
8479 AC_DEFINE(MOZ_DEVICES)
8482 dnl ========================================================
8483 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8484 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8487 dnl ========================================================
8489 dnl = Maintainer debug option (no --enable equivalent)
8491 dnl ========================================================
8496 AC_SUBST(AR_EXTRACT)
8500 AC_SUBST(AS_DASH_C_FLAG)
8509 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8510 AC_SUBST(MOZ_UPDATE_XTERM)
8511 AC_SUBST(MOZ_AUTH_EXTENSION)
8512 AC_SUBST(MOZ_PERMISSIONS)
8513 AC_SUBST(MOZ_PREF_EXTENSIONS)
8515 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8516 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8517 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8518 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8519 AC_SUBST(WARNINGS_AS_ERRORS)
8520 AC_SUBST(MOZ_EXTENSIONS)
8521 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8524 AC_SUBST(MOZ_INSTRUMENTS)
8525 AC_SUBST(MOZ_CALLGRIND)
8527 AC_SUBST(MOZ_PROFILING)
8529 AC_SUBST(MOZ_PLACES)
8530 AC_SUBST(MOZ_SOCIAL)
8531 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8533 AC_SUBST(NS_PRINTING)
8534 AC_SUBST(MOZ_HELP_VIEWER)
8535 AC_SUBST(TOOLCHAIN_PREFIX)
8544 AC_SUBST(MOZ_PROFILELOCKING)
8546 AC_SUBST(ENABLE_TESTS)
8547 AC_SUBST(MOZ_UNIVERSALCHARDET)
8548 AC_SUBST(ACCESSIBILITY)
8549 AC_SUBST(MOZ_SPELLCHECK)
8550 AC_SUBST(MOZ_ANDROID_APZ)
8551 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8552 AC_SUBST(MOZ_CRASHREPORTER)
8553 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8554 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8555 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8556 AC_SUBST(MOZ_STUB_INSTALLER)
8557 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8558 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8559 AC_SUBST(MOZ_UPDATER)
8561 AC_SUBST(MOZ_ANGLE_RENDERER)
8562 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
8563 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
8564 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
8565 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
8566 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8567 AC_SUBST(MOZ_D3DCOMPILER_XP_DLL)
8568 AC_SUBST(MOZ_D3DCOMPILER_XP_CAB)
8572 AC_SUBST(MOZ_ANDROID_HISTORY)
8573 AC_SUBST(MOZ_WEBSMS_BACKEND)
8574 AC_SUBST(MOZ_ANDROID_BEAM)
8575 AC_SUBST(MOZ_LOCALE_SWITCHER)
8576 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
8577 AC_SUBST(MOZ_ANDROID_SEARCH_ACTIVITY)
8578 AC_SUBST(MOZ_ANDROID_SHARE_OVERLAY)
8579 AC_SUBST(MOZ_ANDROID_NEW_TABLET_UI)
8580 AC_SUBST(MOZ_ANDROID_MLS_STUMBLER)
8581 AC_SUBST(MOZ_ANDROID_DOWNLOADS_INTEGRATION)
8582 AC_SUBST(ENABLE_STRIP)
8583 AC_SUBST(PKG_SKIP_STRIP)
8584 AC_SUBST(STRIP_FLAGS)
8585 AC_SUBST(USE_ELF_HACK)
8586 AC_SUBST(INCREMENTAL_LINKER)
8587 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8588 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8590 AC_SUBST(MOZ_FIX_LINK_PATHS)
8592 AC_SUBST(USE_DEPENDENT_LIBS)
8594 AC_SUBST(MOZ_BUILD_ROOT)
8596 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8597 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8598 AC_SUBST(MOZ_LINKER_EXTRACT)
8600 AC_SUBST(MOZ_JSDOWNLOADS)
8601 if test -n "$MOZ_JSDOWNLOADS"; then
8602 AC_DEFINE(MOZ_JSDOWNLOADS)
8605 dnl ========================================================
8606 dnl = Mac bundle name prefix
8607 dnl ========================================================
8608 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8609 [ --with-macbundlename-prefix=prefix
8610 Prefix for MOZ_MACBUNDLE_NAME],
8611 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8613 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8614 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8615 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8618 if test "$MOZ_DEBUG"; then
8619 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8621 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8623 AC_SUBST(MOZ_MACBUNDLE_NAME)
8625 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8626 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8627 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8628 if test "$MOZ_DEBUG"; then
8629 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8632 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8633 AC_SUBST(MOZ_MACBUNDLE_ID)
8635 dnl ========================================================
8636 dnl = Child Process Name for IPC
8637 dnl ========================================================
8638 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8639 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8641 # We want to let Android unpack the file at install time, but it only does
8642 # so if the file is named libsomething.so. The lib/ path is also required
8643 # because the unpacked file will be under the lib/ subdirectory and will
8644 # need to be executed from that path.
8645 MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8647 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8649 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8650 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8652 # The following variables are available to branding and application
8653 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8654 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8655 # impacts profile location and user-visible fields.
8656 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8657 # versions of a given application (e.g. Aurora and Firefox both use
8658 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8659 # for application.ini's "Name" field, which controls profile location in
8660 # the absence of a "Profile" field (see below), and various system
8661 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8662 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8663 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8664 # builds (e.g. Aurora for Firefox).
8665 # - MOZ_APP_VERSION: Defines the application version number.
8666 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8667 # defaults to a lowercase form of MOZ_APP_BASENAME.
8668 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
8669 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
8670 # - MOZ_APP_PROFILE: When set, used for application.ini's
8671 # "Profile" field, which controls profile location.
8672 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8673 # crash reporter server url.
8674 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8676 if test -z "$MOZ_APP_NAME"; then
8677 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8680 if test -z "$MOZ_APP_REMOTINGNAME"; then
8681 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
8684 # For extensions and langpacks, we require a max version that is compatible
8685 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8686 # 24.0a1 and 24.0a2 aren't affected
8688 # 24.1.1 becomes 24.*
8689 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8690 if test -z "$IS_ALPHA"; then
8692 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
8695 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8698 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8699 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8700 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8702 AC_SUBST(MOZ_APP_NAME)
8703 AC_SUBST(MOZ_APP_REMOTINGNAME)
8704 AC_SUBST(MOZ_APP_DISPLAYNAME)
8705 AC_SUBST(MOZ_APP_BASENAME)
8706 AC_SUBST(MOZ_APP_VENDOR)
8707 AC_SUBST(MOZ_APP_PROFILE)
8708 AC_SUBST(MOZ_APP_ID)
8709 AC_SUBST(MAR_CHANNEL_ID)
8710 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8711 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8712 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8713 AC_SUBST(MOZ_APP_UA_NAME)
8714 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8715 AC_SUBST(MOZ_APP_VERSION)
8716 AC_SUBST(MOZ_APP_MAXVERSION)
8717 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8718 AC_SUBST(FIREFOX_VERSION)
8719 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8720 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8721 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8724 AC_SUBST(MOZ_APP_STATIC_INI)
8726 AC_SUBST(MOZ_PKG_SPECIAL)
8728 AC_SUBST(MOZILLA_OFFICIAL)
8730 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8731 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8733 if test "$MOZ_TELEMETRY_REPORTING"; then
8734 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8736 # Enable Telemetry by default for nightly and aurora channels
8737 if test -z "$RELEASE_BUILD"; then
8738 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8742 dnl If we have any service that uploads data (and requires data submission
8743 dnl policy alert), set MOZ_DATA_REPORTING.
8744 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8745 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8746 MOZ_DATA_REPORTING=1
8747 AC_DEFINE(MOZ_DATA_REPORTING)
8748 AC_SUBST(MOZ_DATA_REPORTING)
8752 AC_SUBST(MOZ_BROWSE_INFO)
8753 AC_SUBST(MOZ_TOOLS_DIR)
8754 AC_SUBST(WIN32_REDIST_DIR)
8757 dnl Echo the CFLAGS to remove extra whitespace.
8763 $_WARNINGS_CXXFLAGS \
8766 COMPILE_CFLAGS=`echo \
8771 COMPILE_CXXFLAGS=`echo \
8772 $_DEFINES_CXXFLAGS \
8780 HOST_CXXFLAGS=`echo \
8784 AC_SUBST(MOZ_NATIVE_JPEG)
8785 AC_SUBST(MOZ_NATIVE_PNG)
8786 AC_SUBST(MOZ_NATIVE_BZ2)
8788 AC_SUBST(MOZ_JPEG_CFLAGS)
8789 AC_SUBST_LIST(MOZ_JPEG_LIBS)
8790 AC_SUBST(MOZ_BZ2_CFLAGS)
8791 AC_SUBST_LIST(MOZ_BZ2_LIBS)
8792 AC_SUBST(MOZ_PNG_CFLAGS)
8793 AC_SUBST_LIST(MOZ_PNG_LIBS)
8795 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
8796 export MOZ_NUWA_PROCESS
8797 AC_DEFINE(MOZ_NUWA_PROCESS)
8799 AC_SUBST(MOZ_NUWA_PROCESS)
8800 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_B2G_LOADER"; then
8801 if test -z "$MOZ_NUWA_PROCESS"; then
8802 AC_MSG_ERROR([B2G loader works with Nuwa]);
8804 export MOZ_B2G_LOADER
8805 AC_DEFINE(MOZ_B2G_LOADER)
8807 AC_SUBST(MOZ_B2G_LOADER)
8809 AC_SUBST(NSPR_CFLAGS)
8810 AC_SUBST(MOZ_NATIVE_NSPR)
8812 AC_SUBST(NSS_CFLAGS)
8813 AC_SUBST(MOZ_NATIVE_NSS)
8814 AC_SUBST(NSS_DISABLE_DBM)
8817 OS_CXXFLAGS="$CXXFLAGS"
8818 OS_CPPFLAGS="$CPPFLAGS"
8819 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8820 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8821 OS_LDFLAGS="$LDFLAGS"
8824 AC_SUBST(OS_CXXFLAGS)
8825 AC_SUBST(OS_CPPFLAGS)
8826 AC_SUBST(OS_COMPILE_CFLAGS)
8827 AC_SUBST(OS_COMPILE_CXXFLAGS)
8828 AC_SUBST(OS_LDFLAGS)
8830 AC_SUBST(CROSS_COMPILE)
8831 AC_SUBST(WCHAR_CFLAGS)
8835 AC_SUBST(HOST_CFLAGS)
8836 AC_SUBST(HOST_CXXFLAGS)
8837 AC_SUBST(HOST_LDFLAGS)
8838 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8840 AC_SUBST(HOST_AR_FLAGS)
8842 AC_SUBST(HOST_RANLIB)
8843 AC_SUBST(HOST_NSPR_MDCPUCFG)
8844 AC_SUBST(HOST_BIN_SUFFIX)
8845 AC_SUBST(HOST_OS_ARCH)
8847 AC_SUBST(TARGET_CPU)
8848 AC_SUBST(TARGET_VENDOR)
8850 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8851 AC_SUBST(TARGET_MD_ARCH)
8852 AC_SUBST(TARGET_XPCOM_ABI)
8855 AC_SUBST(OS_RELEASE)
8858 AC_SUBST(INTEL_ARCHITECTURE)
8859 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
8860 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
8861 AC_SUBST(HAVE_X86_AVX2)
8862 AC_SUBST(GCC_USE_GNU_LD)
8864 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8866 AC_SUBST(WRAP_LDFLAGS)
8869 AC_SUBST(MKSHLIB_FORCE_ALL)
8870 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8871 AC_SUBST(DSO_CFLAGS)
8872 AC_SUBST(DSO_PIC_CFLAGS)
8873 AC_SUBST(DSO_LDOPTS)
8874 AC_SUBST(LIB_PREFIX)
8875 AC_SUBST(DLL_PREFIX)
8876 AC_SUBST(DLL_SUFFIX)
8877 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8878 AC_SUBST(LIB_SUFFIX)
8879 AC_SUBST(OBJ_SUFFIX)
8880 AC_SUBST(BIN_SUFFIX)
8881 AC_SUBST(ASM_SUFFIX)
8882 AC_SUBST(IMPORT_LIB_SUFFIX)
8884 AC_SUBST(CC_VERSION)
8885 AC_SUBST(CXX_VERSION)
8886 AC_SUBST(MSMANIFEST_TOOL)
8887 AC_SUBST(NS_ENABLE_TSF)
8888 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
8889 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
8892 AC_SUBST(MOZ_VORBIS)
8893 AC_SUBST(MOZ_TREMOR)
8897 AC_SUBST(MOZ_FFMPEG)
8900 AC_SUBST(MOZ_DIRECTSHOW)
8901 AC_SUBST(MOZ_ANDROID_OMX)
8902 AC_SUBST(MOZ_APPLEMEDIA)
8903 AC_SUBST(MOZ_OMX_PLUGIN)
8904 AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
8907 AC_SUBST(VPX_ASFLAGS)
8908 AC_SUBST(VPX_DASH_C_FLAG)
8909 AC_SUBST(VPX_AS_CONVERSION)
8910 AC_SUBST(VPX_ASM_SUFFIX)
8911 AC_SUBST(VPX_X86_ASM)
8912 AC_SUBST(VPX_ARM_ASM)
8913 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8914 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8915 AC_SUBST(MOZ_CODE_COVERAGE)
8916 AC_SUBST(LIBJPEG_TURBO_AS)
8917 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8918 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8919 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8920 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8922 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8923 AC_SUBST(MOZ_FOLD_LIBS)
8925 AC_SUBST(MOZ_ENABLE_SZIP)
8926 AC_SUBST(MOZ_SZIP_FLAGS)
8928 dnl Host JavaScript runtime, if any, to use during cross compiles.
8931 if test "$MOZ_DEBUG"; then
8934 AC_SUBST(MOZ_EM_DEBUG)
8936 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
8938 if test -n "$COMPILE_ENVIRONMENT"; then
8939 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
8941 dnl Check for missing components
8942 if test "$MOZ_X11"; then
8943 if test "$WITHOUT_X11"; then
8944 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8946 dnl ====================================================
8947 dnl = Check if X headers exist
8948 dnl ====================================================
8949 _SAVE_CFLAGS=$CFLAGS
8950 CFLAGS="$CFLAGS $XCFLAGS"
8954 #include <X11/Xlib.h>
8955 #include <X11/Intrinsic.h>
8956 #include <X11/extensions/XShm.h>
8960 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8961 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8965 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
8966 CFLAGS="$_SAVE_CFLAGS"
8968 if test -n "$MISSING_X"; then
8969 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8974 fi # COMPILE_ENVIRONMENT
8976 dnl Set various defines and substitutions
8977 dnl ========================================================
8979 if test "$OS_ARCH" != "WINNT"; then
8983 if test "$MOZ_DEBUG"; then
8984 AC_DEFINE(MOZ_REFLOW_PERF)
8985 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8988 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
8989 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8990 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8991 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8992 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8993 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8994 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8995 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8996 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8999 if test -n "$MOZ_DEV_EDITION"; then
9000 AC_DEFINE(MOZ_DEV_EDITION)
9003 if test "$MOZ_DEBUG"; then
9006 case "$MOZ_UPDATE_CHANNEL" in
9007 aurora|beta|release|esr)
9014 if test -n "$A11Y_LOG"; then
9018 AC_SUBST(MOZILLA_VERSION)
9020 AC_SUBST(ac_configure_args)
9022 dnl Spit out some output
9023 dnl ========================================================
9025 dnl The following defines are used by xpcom
9026 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9028 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9029 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9030 HAVE_CPP_PARTIAL_SPECIALIZATION
9031 NEED_CPP_UNUSED_IMPLEMENTATIONS
9034 HAVE_ICONV_WITH_CONST_INPUT
9047 dnl ========================================================
9049 dnl ========================================================
9051 # Internationalization isn't built or exposed by default in non-desktop
9052 # builds. Bugs to enable:
9054 # Android: bug 864843
9057 if test "$MOZ_WIDGET_TOOLKIT" = "android" ||
9058 test "$MOZ_BUILD_APP" = "b2g"; then
9064 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
9068 if test "$OS_TARGET" = WINNT; then
9074 if test -z "$JS_SHARED_LIBRARY"; then
9075 AC_DEFINE(MOZ_STATIC_JS)
9077 AC_SUBST(JS_SHARED_LIBRARY)
9079 MOZ_CREATE_CONFIG_STATUS()
9081 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9082 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9083 MOZ_SUBCONFIGURE_ICU()
9084 MOZ_SUBCONFIGURE_FFI()
9087 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
9088 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
9089 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
9090 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
9091 # (apparently) only need this hack when egrep's "pattern" is particularly long
9092 # (as in the following code) and the first egrep on our $PATH is Apple's. See
9096 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
9103 # Run jemalloc configure script
9105 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
9106 ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
9107 if test -n "$MOZ_REPLACE_MALLOC"; then
9108 # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9109 ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9110 ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9112 if test -n "$MOZ_JEMALLOC3"; then
9113 case "${OS_ARCH}" in
9115 # We want jemalloc functions to be kept hidden on both Mac and Windows
9116 # See memory/build/mozmemory_wrap.h for details.
9117 ac_configure_args="$ac_configure_args --without-export"
9120 elif test "${OS_ARCH}" = Darwin; then
9121 # When building as a replace-malloc lib, disabling the zone allocator
9122 # forces to use pthread_atfork.
9123 ac_configure_args="$ac_configure_args --disable-zone-allocator"
9125 _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9127 if test -z "$MOZ_REPLACE_MALLOC"; then
9129 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9133 elif test -z "$MOZ_JEMALLOC3"; then
9135 JEMALLOC_WRAPPER=replace_
9137 if test -n "$MANGLE"; then
9139 for mangle in ${MANGLE}; do
9140 if test -n "$MANGLED"; then
9141 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9143 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9146 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9149 if test -z "$MOZ_TLS"; then
9150 ac_configure_args="$ac_configure_args --disable-tls"
9152 EXTRA_CFLAGS="$CFLAGS"
9153 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9154 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9156 if test "$CROSS_COMPILE"; then
9157 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9160 if ! test -e memory/jemalloc; then
9161 mkdir -p memory/jemalloc
9164 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9165 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9168 # Run freetype configure script
9170 if test "$MOZ_TREE_FREETYPE"; then
9171 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9172 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9173 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9174 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9175 # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
9176 # to force freetype to use our settings rather than autodetecting
9177 if test -n "$MOZ_NATIVE_PNG"; then
9178 export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
9180 export LIBPNG_CFLAGS="-I$_objdir/dist/include"
9182 export LIBPNG_LIBS="$MOZ_PNG_LIBS "
9183 export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
9184 export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
9185 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9186 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
9188 if ! test -e modules; then
9191 # Only export CC, CXX and RANLIB for the subconfigure, and avoid spilling
9192 # that further down the road.
9193 (export CC CXX RANLIB;
9194 AC_OUTPUT_SUBDIRS(modules/freetype2)
9198 if test -z "$direct_nspr_config"; then
9199 dnl ========================================================
9200 dnl = Setup a nice relatively clean build environment for
9201 dnl = sub-configures.
9202 dnl ========================================================
9205 CFLAGS="$_SUBDIR_CFLAGS"
9206 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9207 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9208 LDFLAGS="$_SUBDIR_LDFLAGS"
9209 HOST_CC="$_SUBDIR_HOST_CC"
9210 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9211 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9212 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9219 # Run all configure scripts specified by a subconfigure
9220 if test -n "$_subconfigure_subdir"; then
9221 _save_srcdir="$srcdir"
9223 _save_ac_configure_args="$ac_configure_args"
9224 ac_configure_args="$_subconfigure_config_args"
9225 AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
9226 ac_configure_args="$_save_ac_configure_args"
9227 srcdir="$_save_srcdir"
9230 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9231 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9235 MOZ_SUBCONFIGURE_NSPR()
9237 dnl ========================================================
9238 dnl = Setup a nice relatively clean build environment for
9239 dnl = sub-configures.
9240 dnl ========================================================
9243 CFLAGS="$_SUBDIR_CFLAGS"
9244 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9245 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9246 LDFLAGS="$_SUBDIR_LDFLAGS"
9247 HOST_CC="$_SUBDIR_HOST_CC"
9248 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9249 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9250 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9253 # Run the SpiderMonkey 'configure' script.
9254 dist=$MOZ_BUILD_ROOT/dist
9255 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9257 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
9259 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
9261 ac_configure_args="$ac_configure_args --enable-threadsafe"
9263 if test "$_INTL_API" = no; then
9264 ac_configure_args="$ac_configure_args --without-intl-api"
9267 if test "$BUILD_CTYPES"; then
9268 # Build js-ctypes on the platforms we can.
9269 ac_configure_args="$ac_configure_args --enable-ctypes"
9271 if test -z "$JS_SHARED_LIBRARY" ; then
9272 ac_configure_args="$ac_configure_args --disable-shared-js"
9273 if test -n "$MOZ_DISABLE_EXPORT_JS"; then
9274 ac_configure_args="$ac_configure_args --disable-export-js"
9277 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
9278 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9279 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9281 ac_configure_args="$ac_configure_args --prefix=$dist"
9282 if test "$MOZ_MEMORY"; then
9283 ac_configure_args="$ac_configure_args --enable-jemalloc"
9285 if test -n "$MOZ_GLUE_IN_PROGRAM"; then
9286 export MOZ_GLUE_IN_PROGRAM
9288 if test -n "$ZLIB_IN_MOZGLUE"; then
9291 export MOZ_NATIVE_ZLIB
9292 export MOZ_ZLIB_CFLAGS
9293 export MOZ_ZLIB_LIBS
9295 export MOZ_APP_REMOTINGNAME
9296 export DONT_POPULATE_VIRTUALENV=1
9298 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9299 export STLPORT_CPPFLAGS
9301 export JS_STANDALONE=no
9303 export ZLIB_IN_MOZGLUE
9305 if ! test -e js; then
9309 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
9310 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9312 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9314 export WRITE_MOZINFO=1
9315 dnl we need to run config.status after js/src subconfigure because we're
9316 dnl traversing its moz.build and we need its config.status for that.
9317 dnl However, writing our own config.status needs to happen before
9318 dnl subconfigures because the setup surrounding subconfigures alters
9319 dnl many AC_SUBSTed variables.
9320 MOZ_RUN_CONFIG_STATUS()