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.4
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 "$ANDROID_VERSION" in
234 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"
240 AC_SUBST(MOZ_OMX_DECODER)
246 GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include"
247 if test -d "$gonkdir/external/bluetooth/bluez"; then
248 GONK_INCLUDES="$GONK_INCLUDES -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
251 elif test -d "$gonkdir/external/bluetooth/bluedroid"; then
253 MOZ_B2G_BT_BLUEDROID=1
254 if test -d "$gonkdir/system/bluetoothd"; then
263 AC_SUBST(MOZ_OMX_DECODER)
265 AC_SUBST(MOZ_OMX_ENCODER)
266 AC_DEFINE(MOZ_OMX_ENCODER)
271 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"
274 MOZ_B2G_BT_BLUEDROID=1
275 if test -d "$gonkdir/system/bluetoothd"; then
282 AC_DEFINE(MOZ_OMX_ENCODER)
285 AC_SUBST(MOZ_AUDIO_OFFLOAD)
286 AC_DEFINE(MOZ_AUDIO_OFFLOAD)
290 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"
294 AC_DEFINE(MOZ_OMX_ENCODER)
295 AC_SUBST(MOZ_AUDIO_OFFLOAD)
296 AC_DEFINE(MOZ_AUDIO_OFFLOAD)
300 MOZ_B2G_BT_BLUEDROID=1
301 if test -d "$gonkdir/system/bluetoothd"; then
308 AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
311 CPPFLAGS="-DANDROID $TARGET_C_INCLUDES -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"
312 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
313 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
314 dnl Add -llog by default, since we use it all over the place.
317 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"
319 dnl prevent cross compile section from using these flags as host flags
320 if test -z "$HOST_CPPFLAGS" ; then
323 if test -z "$HOST_CFLAGS" ; then
326 if test -z "$HOST_CXXFLAGS" ; then
329 if test -z "$HOST_LDFLAGS" ; then
334 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
335 AC_SUBST(ANDROID_VERSION)
336 AC_DEFINE(HAVE_SYS_UIO_H)
337 AC_DEFINE(HAVE_PTHREADS)
338 MOZ_CHROME_FILE_FORMAT=omni
344 *-android*|*-linuxandroid*)
345 if test -z "$ANDROID_PACKAGE_NAME" ; then
346 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
348 MOZ_CHROME_FILE_FORMAT=omni
352 AC_PATH_PROG(OBJCOPY,objcopy)
357 AC_SUBST(ANDROID_SOURCE)
358 AC_SUBST(ANDROID_PACKAGE_NAME)
361 dnl ========================================================
362 dnl Checks for compilers.
363 dnl ========================================================
365 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
368 if test "$COMPILE_ENVIRONMENT"; then
370 if test "$target" != "$host"; then
376 # Work around the conftest.exe access problem on Windows
381 MOZ_PATH_PROGS(AS, $AS as, $CC)
382 AC_CHECK_PROGS(AR, ar, :)
383 AC_CHECK_PROGS(LD, ld, :)
384 AC_CHECK_PROGS(STRIP, strip, :)
385 AC_CHECK_PROGS(WINDRES, windres, :)
386 AC_CHECK_PROGS(OTOOL, otool, :)
387 if test -z "$HOST_CC"; then
390 if test -z "$HOST_CFLAGS"; then
391 HOST_CFLAGS="$CFLAGS"
393 if test -z "$HOST_CXX"; then
396 if test -z "$HOST_CXXFLAGS"; then
397 HOST_CXXFLAGS="$CXXFLAGS"
399 if test -z "$HOST_LDFLAGS"; then
400 HOST_LDFLAGS="$LDFLAGS"
402 if test -z "$HOST_RANLIB"; then
403 HOST_RANLIB="$RANLIB"
405 if test -z "$HOST_AR"; then
408 if test -z "$HOST_AR_FLAGS"; then
409 HOST_AR_FLAGS="$AR_FLAGS"
413 if test -n "$MOZ_WINCONSOLE"; then
414 AC_DEFINE(MOZ_WINCONSOLE)
419 MOZ_CHECK_COMPILER_WRAPPER
421 dnl ========================================================
422 dnl Special win32 checks
423 dnl ========================================================
425 MOZ_ARG_ENABLE_BOOL(metro,
426 [ --enable-metro Enable Windows Metro build targets],
429 if test -n "$MOZ_METRO"; then
431 # toolkit/library/makefile.in needs these, see nsDllMain.
433 CRTEXPDLLVERSION=1-1-0
436 AC_SUBST(CRTDLLVERSION)
437 AC_SUBST(CRTEXPDLLVERSION)
439 # Target the Windows 8.1 SDK by default
443 MOZ_ARG_WITH_STRING(windows-version,
444 [ --with-windows-version=WINSDK_TARGETVER
445 Windows SDK version to target. Win8.1 (603) is
446 currently the minimum supported version.],
447 WINSDK_TARGETVER=$withval)
449 # Currently only version 603 is allowed
450 case "$WINSDK_TARGETVER" in
452 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
456 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
462 if test "$GCC" != "yes"; then
463 # Check to see if we are really running in a msvc environemnt
465 AC_CHECK_PROGS(MIDL, midl)
467 # Make sure compilers are valid
468 CFLAGS="$CFLAGS -TC -nologo"
469 CXXFLAGS="$CXXFLAGS -TP -nologo"
472 AC_TRY_COMPILE([#include <stdio.h>],
473 [ printf("Hello World\n"); ],,
474 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
477 AC_TRY_COMPILE([#include <new.h>],
478 [ unsigned *test = new unsigned(42); ],,
479 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
483 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
486 # Determine compiler version
487 _CC_MAJOR_VERSION=`echo ${MSVC_VERSION_FULL} | cut -c 1-2`
488 _CC_MINOR_VERSION=`echo ${MSVC_VERSION_FULL} | cut -c 3-4`
489 _CC_BUILD_VERSION=`echo ${MSVC_VERSION_FULL} | cut -c 5-`
490 _MSC_VER=${CC_VERSION}
492 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | cut -c 1-2`
494 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
495 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
498 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
499 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
501 if test "$_CC_MAJOR_VERSION" = "18" -a "$_CC_BUILD_VERSION" -ge "30723"; then
504 MSVC_C_RUNTIME_DLL=msvcr120.dll
505 MSVC_CXX_RUNTIME_DLL=msvcp120.dll
507 AC_MSG_ERROR([This version (${_CC_MAJOR_VERSION}.${_CC_MINOR_VERSION}.${_CC_BUILD_VERSION}) of the MSVC compiler is unsupported.
508 You must install Visual C++ 2013 Update 3 or newer in order to build.
509 See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
511 AC_SUBST(MSVS_VERSION)
512 AC_SUBST(MSVC_C_RUNTIME_DLL)
513 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
515 # Disable SEH on clang-cl because it doesn't implement them yet.
516 if test -z "$CLANG_CL"; then
517 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
519 # Send our CFLAGS to NSS
521 AC_DEFINE_UNQUOTED(GTEST_HAS_SEH, 0)
524 if test -n "$WIN32_REDIST_DIR"; then
525 if test ! -d "$WIN32_REDIST_DIR"; then
526 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
528 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
531 dnl Confirm we have the pri tools on win8 builds
532 if test -n "$MOZ_METRO"; then
533 AC_MSG_CHECKING([for makepri])
534 AC_CHECK_PROGS(MAKEPRI, makepri, "")
535 if test -z "MAKEPRI" ; then
536 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
541 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
542 dnl not something else like "magnetic tape manipulation utility".
543 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
544 if test -z "$MSMT_TOOL"; then
545 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
549 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
551 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
552 if test -z "$MSMANIFEST_TOOL_VERSION"; then
553 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
559 # Check linker version
560 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
561 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
562 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
563 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
568 # Set midl environment
571 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
574 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
578 unset _MSVC_VER_FILTER
580 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
584 _SAVE_CXXFLAGS="$CXXFLAGS"
585 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
586 AC_TRY_COMPILE([#include <exception>],
587 [std::_Throw(std::exception()); return 0;],
588 ac_cv_have_std__Throw="yes",
589 ac_cv_have_std__Throw="no")
590 CXXFLAGS="$_SAVE_CXXFLAGS"
594 if test "$ac_cv_have_std__Throw" = "yes"; then
595 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
596 ac_cv_have_dllimport_exception_bug,
600 _SAVE_CXXFLAGS="$CXXFLAGS"
601 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
602 AC_TRY_LINK([#include <vector>],
603 [std::vector<int> v; return v.at(1);],
604 ac_cv_have_dllimport_exception_bug="no",
605 ac_cv_have_dllimport_exception_bug="yes")
606 CXXFLAGS="$_SAVE_CXXFLAGS"
609 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
611 MOZ_MSVC_STL_WRAP__Throw=1
612 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
615 AC_CACHE_CHECK(for overridable _RAISE,
620 _SAVE_CXXFLAGS="$CXXFLAGS"
621 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
622 AC_TRY_COMPILE([#include <xstddef>
624 #define _RAISE(x) externallyDefinedFunction((x).what())
627 [std::vector<int> v; return v.at(1);],
628 ac_cv_have__RAISE="no",
629 ac_cv_have__RAISE="yes")
630 CXXFLAGS="$_SAVE_CXXFLAGS"
633 if test "$ac_cv_have__RAISE" = "yes"; then
635 MOZ_MSVC_STL_WRAP__RAISE=1
636 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
638 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
642 if test "$WRAP_STL_INCLUDES" = "1"; then
643 STL_FLAGS='-I$(DIST)/stl_wrappers'
645 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
646 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
648 MOZ_FIND_WINSDK_VERSION
650 # Check w32api version
651 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
652 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
653 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
654 AC_TRY_COMPILE([#include <w32api.h>],
655 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
656 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
657 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
658 #error "test failed."
660 , [ res=yes ], [ res=no ])
661 AC_MSG_RESULT([$res])
662 if test "$res" != "yes"; then
663 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
665 # Check windres version
666 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
667 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
668 AC_MSG_RESULT([$_WINDRES_VERSION])
669 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
670 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
671 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
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 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
676 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
677 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
678 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
679 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
680 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
682 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
685 AC_CHECK_PROGS(MIDL, $target-widl widl)
686 if test -n "$MIDL"; then
689 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
692 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
697 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
698 # causing problems with local implementations with the same name.
699 AC_DEFINE(STRSAFE_NO_DEPRECATE)
701 MOZ_WINSDK_MAXVER=0x06030000
704 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
705 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
706 # Require OS features provided by IE 6.0 SP2 (XP SP2)
707 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
709 # If the maximum version supported by this SDK is lower than the target
711 AC_MSG_CHECKING([for Windows SDK being recent enough])
712 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
716 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.])
719 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
720 # Definitions matching sdkddkver.h
721 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
722 AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
723 AC_SUBST(MOZ_WINSDK_MAXVER)
730 if test -n "$_WIN32_MSVC"; then
732 SKIP_COMPILER_CHECKS=1
733 SKIP_LIBRARY_CHECKS=1
735 # Since we're skipping compiler and library checks, hard-code
738 AC_DEFINE(HAVE_SETBUF)
739 AC_DEFINE(HAVE_ISATTY)
742 fi # COMPILE_ENVIRONMENT
755 AC_SUBST(WRAP_STL_INCLUDES)
756 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
757 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
759 dnl ========================================================
760 dnl Checks for programs.
761 dnl ========================================================
765 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
766 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
768 AC_MSG_RESULT([$_perl_version])
770 if test "$_perl_res" != 0; then
771 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
774 AC_MSG_CHECKING([for full perl installation])
775 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
777 if test "$_perl_res" != 0; then
779 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
784 if test -z "$COMPILE_ENVIRONMENT"; then
785 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
787 AC_SUBST(NSINSTALL_BIN)
789 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
790 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
791 MOZ_PATH_PROGS(UNZIP, unzip)
792 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
793 AC_MSG_ERROR([unzip not found in \$PATH])
795 MOZ_PATH_PROGS(ZIP, zip)
796 if test -z "$ZIP" -o "$ZIP" = ":"; then
797 AC_MSG_ERROR([zip not found in \$PATH])
799 MOZ_PATH_PROG(XARGS, xargs)
800 if test -z "$XARGS" -o "$XARGS" = ":"; then
801 AC_MSG_ERROR([xargs not found in \$PATH .])
804 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
807 if test "$COMPILE_ENVIRONMENT"; then
809 dnl ========================================================
810 dnl = Mac OS X toolchain support
811 dnl ========================================================
813 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
814 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
815 dnl when we can run target binaries.
816 AC_SUBST(UNIVERSAL_BINARY)
817 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
819 MOZ_ARG_WITH_STRING(unify-dist,
820 [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
822 if test -n "$UNIVERSAL_BINARY"; then
823 if test -z "$UNIFY_DIST"; then
824 AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
826 case "$UNIFY_DIST" in
830 UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
836 dnl ========================================================
837 dnl Check for MacOS deployment target version
838 dnl ========================================================
840 MOZ_ARG_ENABLE_STRING(macos-target,
841 [ --enable-macos-target=VER (default=10.6)
842 Set the minimum MacOS version needed at runtime],
843 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
847 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
848 dnl Use the specified value
849 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
851 dnl No value specified on the command line or in the environment,
852 dnl use architecture minimum.
853 export MACOSX_DEPLOYMENT_TARGET=10.6
858 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
860 dnl ========================================================
861 dnl = Mac OS X SDK support
862 dnl ========================================================
864 MOZ_ARG_WITH_STRING(macos-sdk,
865 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
866 MACOS_SDK_DIR=$withval)
868 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
869 MOZ_ARG_WITH_STRING(macos-private-frameworks,
870 [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)],
871 MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
872 MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
873 MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
875 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
876 if test -z "$CROSS_COMPILE"; then
877 AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
879 if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
880 AC_MSG_ERROR([PrivateFrameworks directory not found.])
884 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
885 AC_SUBST(MACOS_SDK_DIR)
886 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
888 if test "$MACOS_SDK_DIR"; then
889 dnl Sync this section with the ones in NSPR and NSS.
890 dnl Changes to the cross environment here need to be accounted for in
891 dnl the libIDL checks (below) and xpidl build.
893 if test ! -d "$MACOS_SDK_DIR"; then
894 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
895 specify a valid SDK. SDKs are installed when the optional cross-development
896 tools are selected during the Xcode/Developer Tools installation.])
899 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
900 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
902 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
903 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
904 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
907 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
909 AC_TRY_COMPILE([#include <new>],[],
913 AC_MSG_RESULT($result)
915 if test "$result" = "no" ; then
916 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
920 fi # COMPILE_ENVIRONMENT
922 if test -n "$MAKE"; then
923 if test `echo $MAKE | grep -c make.py` != 1; then
930 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
933 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
936 if test "$GMAKE" = ":"; then
937 AC_MSG_ERROR([GNU make not found])
941 if test -z "$MAKE"; then
945 if test "$COMPILE_ENVIRONMENT"; then
951 fi # COMPILE_ENVIRONMENT
953 dnl ========================================================
954 dnl set the defaults first
955 dnl ========================================================
971 MOZ_USER_DIR=".mozilla"
973 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
979 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
981 if test -n "$CROSS_COMPILE"; then
982 OS_TARGET="${target_os}"
983 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
985 case "${target_os}" in
986 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
987 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU/kFreeBSD ;;
989 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
990 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
991 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
992 dragonfly*) OS_ARCH=DragonFly OS_TARGET=DragonFly ;;
993 freebsd*) OS_ARCH=FreeBSD OS_TARGET=FreeBSD ;;
994 netbsd*) OS_ARCH=NetBSD OS_TARGET=NetBSD ;;
995 openbsd*) OS_ARCH=OpenBSD OS_TARGET=OpenBSD ;;
998 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1001 OS_TARGET=`uname -s`
1002 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1003 OS_RELEASE=`uname -r`
1006 # Before this used `uname -m` when not cross compiling
1007 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1008 OS_TEST="${target_cpu}"
1010 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1012 #######################################################################
1013 # Master "Core Components" macros for getting the OS target #
1014 #######################################################################
1017 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1018 # cross-compilation.
1022 # Define and override various archtecture-specific variables, including
1031 case "$HOST_OS_ARCH" in
1042 HOST_OS_ARCH=GNU_kFreeBSD
1048 HOST_OS_ARCH=DragonFly
1051 HOST_OS_ARCH=FreeBSD
1057 HOST_OS_ARCH=OpenBSD
1063 if test -z "$GNU_CC"; then
1064 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1069 if test -z "$GNU_CXX"; then
1070 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1071 SOLARIS_SUNPRO_CXX=1
1074 AC_SUBST(SOLARIS_SUNPRO_CC)
1075 AC_SUBST(SOLARIS_SUNPRO_CXX)
1081 if test -z "$CROSS_COMPILE" ; then
1087 # If uname -s returns "Windows_NT", we assume that we are using
1088 # the uname.exe in MKS toolkit.
1090 # The -r option of MKS uname only returns the major version number.
1091 # So we need to use its -v option to get the minor version number.
1092 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1096 OS_MINOR_RELEASE=`uname -v`
1097 if test "$OS_MINOR_RELEASE" = "00"; then
1100 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1104 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1105 # the uname.exe in the MSYS tools.
1107 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1112 OS_RELEASE=`uname -v`.`uname -r`
1113 OS_TEST=${target_cpu}
1116 case "${target_cpu}" in
1127 if test -z "$CROSS_COMPILE" ; then
1135 # Only set CPU_ARCH if we recognize the value of OS_TEST
1142 powerpc64 | ppc64 | powerpc64le | ppc64le)
1146 powerpc | ppc | rs6000)
1150 Alpha | alpha | ALPHA)
1187 if test -z "$OS_TARGET"; then
1190 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1192 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1193 dnl ===============================================================
1197 INTEL_ARCHITECTURE=1
1200 dnl Configure platform-specific CPU architecture compiler options.
1201 dnl ==============================================================
1204 dnl =================================================================
1205 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1206 dnl which is bad when cross compiling.
1207 dnl =================================================================
1208 if test "$COMPILE_ENVIRONMENT"; then
1209 configure_static_assert_macros='
1210 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1211 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1212 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1215 dnl test that the macros actually work:
1216 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1217 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1220 ac_cv_static_assertion_macros_work="yes"
1221 AC_TRY_COMPILE([$configure_static_assert_macros],
1222 [CONFIGURE_STATIC_ASSERT(1)],
1224 ac_cv_static_assertion_macros_work="no")
1225 AC_TRY_COMPILE([$configure_static_assert_macros],
1226 [CONFIGURE_STATIC_ASSERT(0)],
1227 ac_cv_static_assertion_macros_work="no",
1230 AC_TRY_COMPILE([$configure_static_assert_macros],
1231 [CONFIGURE_STATIC_ASSERT(1)],
1233 ac_cv_static_assertion_macros_work="no")
1234 AC_TRY_COMPILE([$configure_static_assert_macros],
1235 [CONFIGURE_STATIC_ASSERT(0)],
1236 ac_cv_static_assertion_macros_work="no",
1240 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1241 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1242 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1244 fi # COMPILE_ENVIRONMENT
1246 dnl ========================================================
1247 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1249 dnl ========================================================
1253 dnl ========================================================
1254 dnl Suppress Clang Argument Warnings
1255 dnl ========================================================
1256 if test -n "${CLANG_CC}${CLANG_CL}"; then
1257 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1258 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1260 if test -n "${CLANG_CXX}${CLANG_CL}"; then
1261 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1264 dnl ========================================================
1265 dnl = Use Address Sanitizer
1266 dnl ========================================================
1267 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1268 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1271 if test -n "$MOZ_ASAN"; then
1273 if test -n "$CLANG_CL"; then
1274 # Look for clang_rt.asan_dynamic-i386.dll
1275 MOZ_CLANG_RT_ASAN_LIB=clang_rt.asan_dynamic-i386.dll
1276 # We use MOZ_PATH_PROG in order to get a Windows style path.
1277 MOZ_PATH_PROG(MOZ_CLANG_RT_ASAN_LIB_PATH, $MOZ_CLANG_RT_ASAN_LIB)
1278 if test -z "$MOZ_CLANG_RT_ASAN_LIB_PATH"; then
1279 AC_MSG_ERROR([Couldn't find $MOZ_CLANG_RT_ASAN_LIB. It should be available in the same location as clang-cl.])
1281 AC_SUBST(MOZ_CLANG_RT_ASAN_LIB_PATH)
1284 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1288 dnl ========================================================
1289 dnl = Use Memory Sanitizer
1290 dnl ========================================================
1291 MOZ_ARG_ENABLE_BOOL(memory-sanitizer,
1292 [ --enable-memory-sanitizer Enable Memory Sanitizer (default=no)],
1295 if test -n "$MOZ_MSAN"; then
1298 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1302 dnl ========================================================
1303 dnl = Use Thread Sanitizer
1304 dnl ========================================================
1305 MOZ_ARG_ENABLE_BOOL(thread-sanitizer,
1306 [ --enable-thread-sanitizer Enable Thread Sanitizer (default=no)],
1309 if test -n "$MOZ_TSAN"; then
1312 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1316 # The LLVM symbolizer is used by all sanitizers
1317 AC_SUBST(LLVM_SYMBOLIZER)
1319 dnl ========================================================
1320 dnl = Enable hacks required for LLVM instrumentations
1321 dnl ========================================================
1322 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1323 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1326 if test -n "$MOZ_LLVM_HACKS"; then
1330 AC_SUBST(MOZ_NO_WLZDEFS)
1331 AC_SUBST(MOZ_CFLAGS_NSS)
1333 dnl ========================================================
1334 dnl = Enable treating compiler warnings as errors
1335 dnl ========================================================
1336 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
1337 [ --enable-warnings-as-errors
1338 Enable treating warnings as errors],
1339 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
1340 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
1342 dnl ========================================================
1343 dnl GNU specific defaults
1344 dnl ========================================================
1345 if test "$GNU_CC"; then
1349 # Per bug 719659 comment 2, some of the headers on ancient build machines
1350 # may require gnu89 inline semantics. But otherwise, we use C99.
1351 # But on OS X we just use C99 plus GNU extensions, in order to fix
1353 CFLAGS="$CFLAGS -std=gnu99"
1354 if test "${OS_ARCH}" != Darwin; then
1355 CFLAGS="$CFLAGS -fgnu89-inline"
1357 # FIXME: Let us build with strict aliasing. bug 414641.
1358 CFLAGS="$CFLAGS -fno-strict-aliasing"
1359 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1360 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1361 WARNINGS_AS_ERRORS='-Werror'
1363 DSO_PIC_CFLAGS='-fPIC'
1364 ASFLAGS="$ASFLAGS -fPIC"
1365 AC_MSG_CHECKING([for --noexecstack option to as])
1366 _SAVE_CFLAGS=$CFLAGS
1367 CFLAGS="$CFLAGS -Wa,--noexecstack"
1368 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1369 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1370 AC_MSG_RESULT([no]))
1371 CFLAGS=$_SAVE_CFLAGS
1372 AC_MSG_CHECKING([for -z noexecstack option to ld])
1373 _SAVE_LDFLAGS=$LDFLAGS
1374 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1375 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1377 LDFLAGS=$_SAVE_LDFLAGS)
1379 AC_MSG_CHECKING([for -z text option to ld])
1380 _SAVE_LDFLAGS=$LDFLAGS
1381 LDFLAGS="$LDFLAGS -Wl,-z,text"
1382 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1383 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1385 LDFLAGS=$_SAVE_LDFLAGS)
1387 AC_MSG_CHECKING([for --build-id option to ld])
1388 _SAVE_LDFLAGS=$LDFLAGS
1389 LDFLAGS="$LDFLAGS -Wl,--build-id"
1390 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1391 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1393 LDFLAGS=$_SAVE_LDFLAGS)
1395 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
1396 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
1397 _SAVE_LDFLAGS=$LDFLAGS
1398 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
1399 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1400 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
1401 AC_MSG_RESULT([no]))
1402 LDFLAGS=$_SAVE_LDFLAGS
1404 # Check for -mssse3 on $CC
1405 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1406 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1407 _SAVE_CFLAGS=$CFLAGS
1408 CFLAGS="$CFLAGS -mssse3"
1409 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1410 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1411 AC_MSG_RESULT([no]))
1412 CFLAGS=$_SAVE_CFLAGS
1414 # Check for -msse4.1 on $CC
1415 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1416 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1417 _SAVE_CFLAGS=$CFLAGS
1418 CFLAGS="$CFLAGS -msse4.1"
1419 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1420 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1421 AC_MSG_RESULT([no]))
1422 CFLAGS=$_SAVE_CFLAGS
1424 case "${CPU_ARCH}" in
1426 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
1428 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
1429 result="yes", result="no")
1430 AC_MSG_RESULT("$result")
1431 if test "$result" = "yes"; then
1436 DSO_LDOPTS='-shared'
1437 if test "$GCC_USE_GNU_LD"; then
1438 # Some tools like ASan use a runtime library that is only
1439 # linked against executables, so we must allow undefined
1440 # symbols for shared objects in some cases.
1441 if test -z "$MOZ_NO_WLZDEFS"; then
1442 # Don't allow undefined symbols in libraries
1443 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1445 # BSDs need `environ' exposed for posix_spawn (bug 753046)
1446 case "$OS_TARGET" in
1447 DragonFly|FreeBSD|NetBSD|OpenBSD)
1448 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
1449 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
1451 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
1458 # Turn on gcc/clang warnings:
1459 # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html
1461 # -Wall - turn on a lot of warnings
1462 # -Wchar-subscripts - catches array index using signed char
1463 # -Wcomment - catches nested comments
1464 # -Wdeclaration-after-statement - MSVC doesn't like these
1465 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1466 # -Wendif-labels - catches `#else FOO` and `#endif FOO` not in comment
1467 # -Wenum-compare - catches comparison of different enum types
1468 # -Wignored-qualifiers - catches returns types with qualifiers like const
1469 # -Wint-to-pointer-cast - catches cast to pointer from integer of different size
1470 # -Wmultichar - catches multicharacter integer constants like 'THIS'
1471 # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant
1472 # -Wnonnull - catches NULL used with functions arguments marked as non-null
1473 # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void)
1474 # -Wpointer-sign - catches mixing pointers to signed and unsigned types
1475 # -Wpointer-to-int-cast - catches casts from pointer to different sized int
1476 # -Wreturn-type - catches missing returns, zero false positives
1477 # -Wsequence-point - catches undefined order behavior like `a = a++`
1478 # -Wsign-compare - catches comparison of signed and unsigned types
1479 # -Wtrigraphs - catches unlikely use of trigraphs
1480 # -Wtype-limits - catches overflow bugs, few false positives
1481 # -Wunknown-pragmas - catches unexpected #pragma directives
1483 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall"
1484 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wdeclaration-after-statement"
1485 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wempty-body"
1486 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wpointer-to-int-cast"
1487 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wsign-compare"
1488 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wtype-limits"
1490 # Treat some warnings as errors if --enable-warnings-as-errors:
1491 if test "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
1492 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=char-subscripts"
1493 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=comment"
1494 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=endif-labels"
1495 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=enum-compare"
1496 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=ignored-qualifiers"
1497 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=int-to-pointer-cast"
1498 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=multichar"
1499 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=nonnull"
1500 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=pointer-arith"
1501 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=pointer-sign"
1502 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=return-type"
1503 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=sequence-point"
1504 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=trigraphs"
1505 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=unknown-pragmas"
1507 MOZ_C_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_c_has_werror_non_literal_null_conversion)
1510 # Turn off the following warnings that -Wall turns on:
1511 # -Wno-unused - lots of violations in third-party code
1513 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1515 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1516 # Don't use -Wcast-align with ICC or clang
1518 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1519 hppa | ia64 | sparc | arm)
1522 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1527 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1528 _USE_CPP_INCLUDE_FLAG=1
1529 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1531 elif test "$SOLARIS_SUNPRO_CC"; then
1533 if test "$CPU_ARCH" = "sparc"; then
1534 # for Sun Studio on Solaris/SPARC
1535 DSO_PIC_CFLAGS='-xcode=pic32'
1537 DSO_PIC_CFLAGS='-KPIC'
1539 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1541 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1542 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1544 DSO_LDOPTS='-shared'
1545 if test "$GNU_LD"; then
1546 # Don't allow undefined symbols in libraries
1547 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1551 DSO_PIC_CFLAGS='-KPIC'
1552 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1555 if test "$GNU_CXX"; then
1556 # FIXME: Let us build with strict aliasing. bug 414641.
1557 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1559 # Turn on gcc/clang warnings:
1560 # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html
1562 # -Wall - turn on a lot of warnings
1563 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1564 # -Wendif-labels - catches `#else FOO` and `#endif FOO` not in comment
1565 # -Wint-to-pointer-cast - catches cast to pointer from integer of different size
1566 # -Wmissing-braces - catches aggregate initializers missing nested braces
1567 # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant
1568 # -Woverloaded-virtual - function declaration hides virtual function from base class
1569 # -Wparentheses - catches `if (a=b)` and operator precedence bugs
1570 # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void)
1571 # -Wreturn-type - catches missing returns, zero false positives
1572 # -Wsequence-point - catches undefined order behavior like `a = a++`
1573 # -Wsign-compare - catches comparison of signed and unsigned types
1574 # -Wswitch - catches switches without all enum cases or default case
1575 # -Wtrigraphs - catches unlikely use of trigraphs
1576 # -Wtype-limits - catches overflow bugs, few false positives
1577 # -Wunused-label - catches unused goto labels
1578 # -Wwrite-strings - catches non-const char* pointers to string literals
1580 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall"
1581 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wempty-body"
1582 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Woverloaded-virtual"
1583 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wsign-compare"
1584 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wwrite-strings"
1586 # Treat some warnings as errors if --enable-warnings-as-errors:
1587 if test "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
1588 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=endif-labels"
1589 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=int-to-pointer-cast"
1590 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=missing-braces"
1591 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=parentheses"
1592 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=pointer-arith"
1593 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1594 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=sequence-point"
1595 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=switch"
1596 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=trigraphs"
1597 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=type-limits"
1598 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=unused-label"
1600 MOZ_CXX_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_cxx_has_werror_non_literal_null_conversion)
1603 # Turn off the following warnings that -Wall turns on:
1604 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1605 # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc
1606 # for performance reasons, and because GCC and clang accept it (though
1607 # clang warns about it).
1609 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-invalid-offsetof"
1611 MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete)
1613 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1614 # Don't use -Wcast-align with ICC or clang
1616 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1617 hppa | ia64 | sparc | arm)
1620 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1625 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1626 _USE_CPP_INCLUDE_FLAG=1
1628 # Recent clang and gcc support C++11 deleted functions without warnings if
1629 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1630 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1631 # unused. But clang's warning can be disabled, so when compiling with clang
1632 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1633 # deleted function syntax.
1634 if test "$CLANG_CXX"; then
1635 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1636 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1640 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1643 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1644 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1645 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1646 dnl normal behavior.
1647 dnl ========================================================
1649 MKSHLIB_UNFORCE_ALL=
1651 if test "$COMPILE_ENVIRONMENT"; then
1652 if test "$GNU_CC"; then
1653 AC_MSG_CHECKING(whether ld has archive extraction flags)
1654 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1655 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1656 ac_cv_mkshlib_force_and_unforce="no"
1657 exec 3<&0 <<LOOP_INPUT
1658 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1659 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1660 force="-Wl,-all"; unforce="-Wl,-none"
1667 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1670 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1672 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1676 eval $ac_cv_mkshlib_force_and_unforce
1677 MKSHLIB_FORCE_ALL=$force
1678 MKSHLIB_UNFORCE_ALL=$unforce
1681 fi # COMPILE_ENVIRONMENT
1683 dnl ========================================================
1684 dnl Checking for 64-bit OS
1685 dnl ========================================================
1686 if test "$COMPILE_ENVIRONMENT"; then
1689 AC_MSG_CHECKING(for 64-bit OS)
1690 AC_TRY_COMPILE([$configure_static_assert_macros],
1691 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1692 result="yes", result="no")
1693 AC_MSG_RESULT("$result")
1694 if test "$result" = "yes"; then
1695 AC_DEFINE(HAVE_64BIT_BUILD)
1698 AC_SUBST(HAVE_64BIT_BUILD)
1700 fi # COMPILE_ENVIRONMENT
1702 dnl ========================================================
1703 dnl = Use profiling compile flags
1704 dnl ========================================================
1705 MOZ_ARG_ENABLE_BOOL(profiling,
1706 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1710 dnl ========================================================
1711 dnl = Turn on systrace for android/b2g.
1712 dnl ========================================================
1713 MOZ_ARG_ENABLE_BOOL(systrace,
1714 [ --enable-systrace Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1717 if test -n "$MOZ_USE_SYSTRACE"; then
1718 AC_DEFINE(MOZ_USE_SYSTRACE)
1721 # For profiling builds keep the symbol information
1722 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1723 case "$OS_TARGET" in
1724 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1725 STRIP_FLAGS="--strip-debug"
1730 dnl ========================================================
1732 dnl ========================================================
1733 MOZ_ARG_ENABLE_BOOL(valgrind,
1734 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1737 if test -n "$MOZ_VALGRIND"; then
1738 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1740 [--enable-valgrind specified but Valgrind is not installed]))
1741 AC_DEFINE(MOZ_VALGRIND)
1743 AC_SUBST(MOZ_VALGRIND)
1745 dnl ========================================================
1747 dnl ========================================================
1748 MOZ_ARG_ENABLE_BOOL(jprof,
1749 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1752 if test -n "$MOZ_JPROF"; then
1754 AC_DEFINE(MOZ_JPROF)
1757 dnl ========================================================
1759 dnl ========================================================
1760 MOZ_ENABLE_PROFILER_SPS=1
1762 case "${OS_TARGET}" in
1764 case "${CPU_ARCH}" in
1767 MOZ_ENABLE_PROFILER_SPS=
1771 case "${CPU_ARCH}" in
1774 MOZ_ENABLE_PROFILER_SPS=
1779 MOZ_ENABLE_PROFILER_SPS=
1783 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1784 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1787 dnl ========================================================
1789 dnl ========================================================
1790 MOZ_ARG_ENABLE_BOOL(shark,
1791 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1794 if test -n "$MOZ_SHARK"; then
1796 AC_DEFINE(MOZ_SHARK)
1799 dnl ========================================================
1801 dnl ========================================================
1802 MOZ_ARG_ENABLE_BOOL(instruments,
1803 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
1806 if test -n "$MOZ_INSTRUMENTS"; then
1808 AC_DEFINE(MOZ_INSTRUMENTS)
1811 dnl ========================================================
1813 dnl ========================================================
1814 MOZ_ARG_ENABLE_BOOL(callgrind,
1815 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1818 if test -n "$MOZ_CALLGRIND"; then
1820 AC_DEFINE(MOZ_CALLGRIND)
1823 dnl ========================================================
1825 dnl ========================================================
1826 MOZ_ARG_ENABLE_BOOL(vtune,
1827 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1830 if test -n "$MOZ_VTUNE"; then
1832 AC_DEFINE(MOZ_VTUNE)
1835 dnl ========================================================
1837 dnl ========================================================
1838 if test -n "$MOZ_PROFILING"; then
1839 AC_DEFINE(MOZ_PROFILING)
1842 dnl ========================================================
1843 dnl System overrides of the defaults for host
1844 dnl ========================================================
1847 if test -n "$_WIN32_MSVC"; then
1849 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
1850 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
1851 HOST_RANLIB='echo ranlib'
1853 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1855 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1856 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1857 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1858 HOST_BIN_SUFFIX=.exe
1861 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1865 case "${host_cpu}" in
1867 if test -n "$_WIN32_MSVC"; then
1868 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1872 if test -n "$_WIN32_MSVC"; then
1873 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1875 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1881 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1882 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1883 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1886 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1887 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1888 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1889 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1893 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1894 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1898 dnl ==============================================================
1899 dnl Get mozilla version from central milestone file
1900 dnl ==============================================================
1901 MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
1902 MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
1903 MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
1905 dnl Get version of various core apps from the version files.
1906 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1908 if test -z "$FIREFOX_VERSION"; then
1909 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1912 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1913 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1914 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1915 AC_SUBST(MOZILLA_SYMBOLVERSION)
1917 MOZ_DOING_LTO(lto_is_enabled)
1919 dnl ========================================================
1920 dnl System overrides of the defaults for target
1921 dnl ========================================================
1926 if test ! "$GNU_CC"; then
1927 if test ! "$HAVE_64BIT_BUILD"; then
1928 # Compiling with Visual Age C++ object model compat is the
1929 # default. To compile with object model ibm, add
1930 # AIX_OBJMODEL=ibm to .mozconfig.
1931 if test "$AIX_OBJMODEL" = "ibm"; then
1932 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1939 AC_SUBST(AIX_OBJMODEL)
1940 DSO_LDOPTS='-qmkshrobj=1'
1941 DSO_CFLAGS='-qflag=w:w'
1943 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1945 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1946 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1947 if test "$COMPILE_ENVIRONMENT"; then
1950 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1952 [#if (__IBMCPP__ < 900)
1953 #error "Bad compiler"
1955 _BAD_COMPILER=,_BAD_COMPILER=1)
1956 if test -n "$_BAD_COMPILER"; then
1958 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1960 AC_MSG_RESULT([yes])
1963 TARGET_COMPILER_ABI="ibmc"
1964 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1965 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1968 case "${target_os}" in
1973 if test "$COMPILE_ENVIRONMENT"; then
1974 MOZ_CHECK_HEADERS(sys/inttypes.h)
1976 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1980 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1981 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1982 MOZ_OPTIMIZE_FLAGS="-O3"
1983 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1984 if test "$HAVE_64BIT_BUILD"; then
1989 STRIP_FLAGS="$STRIP_FLAGS -x -S"
1990 # Check whether we're targeting OS X or iOS
1991 AC_CACHE_CHECK(for iOS target,
1993 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1994 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1998 ac_cv_ios_target="yes",
1999 ac_cv_ios_target="no")])
2000 if test "$ac_cv_ios_target" = "yes"; then
2002 AC_DEFINE(XP_DARWIN)
2003 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
2005 AC_DEFINE(XP_MACOSX)
2006 AC_DEFINE(XP_DARWIN)
2007 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2008 # The ExceptionHandling framework is needed for Objective-C exception
2009 # logging code in nsObjCExceptions.h. Currently we only use that in debug
2011 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
2013 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2015 if test "x$lto_is_enabled" = "xyes"; then
2016 echo "Skipping -dead_strip because lto is enabled."
2017 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2018 dnl ===================================================================
2019 elif test "x$enable_dtrace" = "xyes"; then
2020 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2022 dnl check for the presence of the -dead_strip linker flag
2023 AC_MSG_CHECKING([for -dead_strip option to ld])
2024 _SAVE_LDFLAGS=$LDFLAGS
2025 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2026 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2027 if test -n "$_HAVE_DEAD_STRIP" ; then
2028 AC_MSG_RESULT([yes])
2029 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2034 LDFLAGS=$_SAVE_LDFLAGS
2037 dnl With newer linkers we need to pass -allow_heap_execute because of
2038 dnl Microsoft Silverlight (5.1.10411.0 at least).
2039 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
2040 _SAVE_LDFLAGS=$LDFLAGS
2041 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
2042 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
2043 _HAVE_ALLOW_HEAP_EXECUTE=)
2044 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
2045 AC_MSG_RESULT([yes])
2046 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
2050 LDFLAGS=$_SAVE_LDFLAGS
2052 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2057 if test ! "$GNU_CC"; then
2061 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2062 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2063 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2066 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2067 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2070 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2071 AC_DEFINE(_LARGEFILE64_SOURCE)
2076 if test ! "$GNU_CC"; then
2077 DSO_LDOPTS='-b -Wl,+s'
2080 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2081 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2082 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2084 DSO_LDOPTS='-b -E +s'
2085 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2086 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2088 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2089 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2092 *-android*|*-linuxandroid*)
2093 AC_DEFINE(NO_PW_GECOS)
2095 if test -n "$gonkdir"; then
2096 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2097 _PLATFORM_HAVE_RIL=1
2101 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2104 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2106 MOZ_GFX_OPTIMIZE_MOBILE=1
2107 MOZ_OPTIMIZE_FLAGS="-Os -fno-reorder-functions"
2108 if test -z "$CLANG_CC"; then
2109 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
2114 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2115 # Similarly for GNU_CXX and INTEL_CXX.
2116 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2117 # -Os has been broken on Intel's C/C++ compilers for quite a
2118 # while; Intel recommends against using it.
2119 MOZ_OPTIMIZE_FLAGS="-O2"
2120 elif test "$GNU_CC" -o "$GNU_CXX"; then
2121 case $GCC_VERSION in
2123 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
2124 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2126 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2127 MOZ_OPTIMIZE_FLAGS="-Os $MOZ_OPTIMIZE_SIZE_TWEAK"
2128 if test -z "$CLANG_CC"; then
2129 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
2133 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2137 case "${target_cpu}" in
2139 CFLAGS="$CFLAGS -mieee"
2140 CXXFLAGS="$CXXFLAGS -mieee"
2144 if test -z "$MC"; then
2154 # certain versions of cygwin's makedepend barf on the
2155 # #include <string> vs -I./dist/include/string issue so don't use it
2156 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
2158 CXX="$CXX -mwindows"
2159 CPP="$CPP -mwindows"
2160 CFLAGS="$CFLAGS -mms-bitfields"
2161 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2162 DSO_LDOPTS='-shared'
2163 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2164 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2166 # Use static libgcc and libstdc++
2167 LDFLAGS="$LDFLAGS -static"
2168 NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
2169 # Use temp file for windres (bug 213281)
2170 RCFLAGS='-O coff --use-temp-file'
2171 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2172 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2177 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
2178 WIN32_GUI_EXE_LDFLAGS=-mwindows
2180 # We use mix of both POSIX and Win32 printf format across the tree, so format
2181 # warnings are useless on mingw.
2182 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2183 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2185 TARGET_COMPILER_ABI=msvc
2189 if test "$AS_BIN"; then
2190 AS="$(basename "$AS_BIN")"
2193 AR_FLAGS='-NOLOGO -OUT:$@'
2195 RANLIB='echo not_ranlib'
2196 STRIP='echo not_strip'
2207 IMPORT_LIB_SUFFIX=lib
2208 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2209 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2211 MKSHLIB_UNFORCE_ALL=
2212 dnl Set subsystem version 5 for Windows XP.
2213 if test "$CPU_ARCH" = "x86"; then
2214 WIN32_SUBSYSTEM_VERSION=5.01
2216 WIN32_SUBSYSTEM_VERSION=6.01
2218 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
2219 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
2220 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
2221 _USE_CPP_INCLUDE_FLAG=1
2222 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2223 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2224 CFLAGS="$CFLAGS -W3 -Gy"
2225 CXXFLAGS="$CXXFLAGS -W3 -Gy"
2226 if test "$_CC_SUITE" -ge "11" -a "$CPU_ARCH" = "x86"; then
2227 dnl VS2012+ defaults to -arch:SSE2.
2228 CFLAGS="$CFLAGS -arch:IA32"
2229 CXXFLAGS="$CXXFLAGS -arch:IA32"
2231 if test "$_CC_SUITE" -ge "12"; then
2232 dnl VS2013+ requires -FS when parallel building by make -jN.
2233 dnl If nothing, compiler sometimes causes C1041 error.
2234 CFLAGS="$CFLAGS -FS"
2235 CXXFLAGS="$CXXFLAGS -FS"
2237 # khuey says we can safely ignore MSVC warning C4251
2238 # MSVC warning C4244 (implicit type conversion may lose data) warns
2239 # and requires workarounds for perfectly valid code. Also, GCC/clang
2240 # don't warn about it by default. So for consistency/sanity, we turn
2241 # it off on MSVC, too.
2242 # MSVC warning C4267 warns for narrowing type conversions from size_t
2243 # to 32-bit integer types on 64-bit platforms. Since this is virtually
2244 # the same thing as C4244, we disable C4267, too.
2245 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2246 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2247 # MSVC warning C4482 warns when an enum value is refered specifing the
2248 # name of the enum itself. This behavior is allowed in C++11, and the
2249 # warning has been removed in VS2012.
2250 # MSVC warning C4800 warns when a value is implicitly cast to bool,
2251 # because this also forces narrowing to a single byte, which can be a
2252 # perf hit. But this matters so little in practice (and often we want
2253 # that behavior) that it's better to turn it off.
2254 # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2255 # on non-Western system locales even if it is in a comment.
2256 CFLAGS="$CFLAGS -wd4244 -wd4267 -wd4819"
2257 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2258 if test -n "$CLANG_CL"; then
2259 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
2260 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
2262 # make 'foo == bar;' error out
2263 CFLAGS="$CFLAGS -we4553"
2264 CXXFLAGS="$CXXFLAGS -we4553"
2265 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2266 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2267 WARNINGS_AS_ERRORS='-WX'
2268 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
2270 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2271 # Disable these flags on clang-cl since it doesn't ignore unknown arguments by default, and
2272 # autoconf insists on passing $LDFLAGS to the compiler.
2273 if test -z "$CLANG_CL"; then
2274 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2275 if test -z "$DEVELOPER_OPTIONS"; then
2276 LDFLAGS="$LDFLAGS -RELEASE"
2279 dnl For profile-guided optimization
2280 PROFILE_GEN_CFLAGS="-GL"
2281 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2282 dnl XXX: PGO builds can fail with warnings treated as errors,
2283 dnl specifically "no profile data available" appears to be
2284 dnl treated as an error sometimes. This might be a consequence
2285 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2286 dnl with the linker doing most of the work in the whole-program
2287 dnl optimization/PGO case. I think it's probably a compiler bug,
2288 dnl but we work around it here.
2289 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2290 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2291 dnl Probably also a compiler bug, but what can you do?
2292 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2293 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2294 dnl Minimum reqiurement of Gecko is VS2010 or later which supports
2295 dnl both SSSE3 and SSE4.1.
2296 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2297 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
2298 if test "$_CC_SUITE" -ge "11"; then
2299 dnl allow AVX2 code from VS2012
2304 AC_DEFINE(HAVE_SNPRINTF)
2309 AC_DEFINE(HW_THREADS)
2310 AC_DEFINE(STDC_HEADERS)
2311 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2312 TARGET_MD_ARCH=win32
2313 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2315 MOZ_USER_DIR="Mozilla"
2317 dnl Hardcode to win95 for now - cls
2318 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2320 dnl set NO_X11 defines here as the general check is skipped on win32
2326 if test -n "$L10NBASEDIR"; then
2327 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2334 if test -z "$MOZ_TOOLS"; then
2335 AC_MSG_ERROR([MOZ_TOOLS is not set])
2337 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2338 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2339 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2341 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2342 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2343 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2350 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.])
2356 if test "$HAVE_64BIT_BUILD"; then
2357 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2360 if test -n "$GNU_CC"; then
2361 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2362 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2363 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2365 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2366 # Disable this flag on clang-cl since it doesn't ignore unknown arguments by default, and
2367 # autoconf insists on passing $LDFLAGS to the compiler.
2368 if test -z "$CLANG_CL"; then
2369 LDFLAGS="$LDFLAGS -SAFESEH"
2376 if test -n "$_WIN32_MSVC"; then
2377 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2382 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2389 CFLAGS="$CFLAGS -Dunix"
2390 CXXFLAGS="$CXXFLAGS -Dunix"
2391 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2393 DSO_PIC_CFLAGS='-fPIC -DPIC'
2394 DSO_LDOPTS='-shared'
2395 BIN_FLAGS='-Wl,--export-dynamic'
2397 DSO_PIC_CFLAGS='-fPIC -DPIC'
2398 DLL_SUFFIX=".so.1.0"
2399 DSO_LDOPTS='-shared'
2401 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2402 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2403 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2404 if test "$LIBRUNPATH"; then
2405 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2407 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2408 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2412 if test "$SO_VERSION"; then
2413 DLL_SUFFIX=".so.$SO_VERSION"
2415 DLL_SUFFIX=".so.1.0"
2417 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2419 DSO_PIC_CFLAGS='-fPIC'
2420 DSO_LDOPTS='-shared -fPIC'
2421 if test "$LIBRUNPATH"; then
2422 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2428 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2430 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2431 # libraries one level up (e.g. libnspr4.so)
2432 if test "$SOLARIS_SUNPRO_CC"; then
2433 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2434 LIBS="-lCrun -lCstd -lc $LIBS"
2435 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2436 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2437 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2438 LDFLAGS="-xildoff $LDFLAGS"
2439 MMX_FLAGS="-xarch=mmx -xO4"
2440 SSE_FLAGS="-xarch=sse"
2441 SSE2_FLAGS="-xarch=ssei2 -xO4"
2442 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2443 _SAVE_LDFLAGS=$LDFLAGS
2444 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2445 AC_TRY_LINK([#include <stdio.h>],
2446 [printf("Hello World\n");],
2448 [LDFLAGS=$_SAVE_LDFLAGS])
2450 MOZ_OPTIMIZE_FLAGS="-xO4"
2451 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2452 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2453 MKSHLIB_FORCE_ALL='-z allextract'
2454 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2461 AS='/usr/ccs/bin/as'
2462 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2464 TARGET_COMPILER_ABI="sunc"
2465 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2466 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2467 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2471 [#if (__SUNPRO_CC < 0x590)
2474 _BAD_COMPILER=,_BAD_COMPILER=1)
2475 if test -n "$_BAD_COMPILER"; then
2477 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2482 [#if (__SUNPRO_CC >= 0x5100)
2483 #error "Sun C++ 5.10 or above"
2485 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2486 if test "$_ABOVE_SS12U1"; then
2488 CXXFLAGS="$CXXFLAGS -xannotate=no"
2490 AC_MSG_RESULT([$_res])
2493 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2495 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2496 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2497 ASFLAGS="$ASFLAGS -fPIC"
2498 DSO_LDOPTS='-shared'
2499 WARNINGS_AS_ERRORS='-Werror'
2501 _WARNINGS_CXXFLAGS=''
2502 if test "$OS_RELEASE" = "5.3"; then
2503 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2506 if test "$OS_RELEASE" = "5.5.1"; then
2507 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2512 DSO_LDOPTS='-Bdynamic'
2513 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2514 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2516 AC_DEFINE(SPRINTF_RETURNS_STRING)
2517 case "$(target_os)" in
2519 DLL_SUFFIX='.so.1.0'
2526 AC_SUBST_LIST(MMX_FLAGS)
2527 AC_SUBST_LIST(SSE_FLAGS)
2528 AC_SUBST_LIST(SSE2_FLAGS)
2532 # Includes linux-android
2537 AC_SUBST(MOZ_LINKER)
2538 if test -n "$MOZ_LINKER"; then
2539 AC_DEFINE(MOZ_LINKER)
2542 dnl Only one oddball right now (QNX), but this gives us flexibility
2543 dnl if any other platforms need to override this in the future.
2544 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2546 dnl ========================================================
2547 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2548 dnl by now will not have any way to link most binaries (tests
2549 dnl as well as viewer, apprunner, etc.), because some symbols
2550 dnl will be left out of the "composite" .so's by ld as unneeded.
2551 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2552 dnl they can link in the static libs that provide the missing
2554 dnl ========================================================
2555 NO_LD_ARCHIVE_FLAGS=
2556 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2557 NO_LD_ARCHIVE_FLAGS=1
2561 NO_LD_ARCHIVE_FLAGS=
2564 if test -z "$GNU_CC"; then
2565 NO_LD_ARCHIVE_FLAGS=
2569 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2571 dnl ========================================================
2572 dnl = Flags to strip unused symbols from .so components and
2573 dnl = to export jemalloc symbols when linking a program
2574 dnl ========================================================
2576 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2577 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2580 if test -z "$GNU_CC"; then
2581 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2583 if test -z "$GCC_USE_GNU_LD"; then
2584 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2586 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2591 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2594 if test -n "$GNU_CC"; then
2595 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2600 if test -z "$COMPILE_ENVIRONMENT"; then
2601 SKIP_COMPILER_CHECKS=1
2602 SKIP_LIBRARY_CHECKS=1
2607 if test -z "$SKIP_COMPILER_CHECKS"; then
2608 dnl Checks for typedefs, structures, and compiler characteristics.
2609 dnl ========================================================
2625 dnl Check for .hidden assembler directive and visibility attribute.
2626 dnl Borrowed from glibc configure.in
2627 dnl ===============================================================
2628 if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
2629 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2630 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2631 case "$OS_TARGET" in
2633 VISIBILITY_FLAGS='-fvisibility=hidden'
2636 case $GCC_VERSION in
2638 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden_dso_handle.h'
2641 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden.h'
2644 WRAP_SYSTEM_INCLUDES=1
2649 # visibility hidden flag for Sun Studio on Solaris
2650 if test "$SOLARIS_SUNPRO_CC"; then
2651 VISIBILITY_FLAGS='-xldscope=hidden'
2652 fi # Sun Studio on Solaris
2654 case "${OS_TARGET}" in
2655 WINNT|Darwin|Android)
2658 STL_FLAGS='-I$(DIST)/stl_wrappers'
2663 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2664 AC_SUBST(VISIBILITY_FLAGS)
2669 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2670 dnl ========================================================
2671 if test "$GNU_CC"; then
2672 CFLAGS_save="${CFLAGS}"
2673 CFLAGS="${CFLAGS} -Werror"
2674 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2675 ac_cv_force_align_arg_pointer,
2676 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2678 ac_cv_force_align_arg_pointer="yes",
2679 ac_cv_force_align_arg_pointer="no")])
2680 CFLAGS="${CFLAGS_save}"
2681 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2682 HAVE_GCC_ALIGN_ARG_POINTER=1
2684 HAVE_GCC_ALIGN_ARG_POINTER=
2687 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2689 dnl Checks for header files.
2690 dnl ========================================================
2692 case "$target_os" in
2694 # for stuff like -lXshm
2695 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2698 MOZ_CHECK_COMMON_HEADERS
2700 dnl These are all the places some variant of statfs can be hiding.
2701 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2704 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2705 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2707 dnl SCTP support - needs various network include headers
2708 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2710 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2712 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2713 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2714 ac_cv_sockaddr_in_sin_len,
2715 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2716 #include <sys/types.h>
2718 #include <netinet/in.h>
2719 struct sockaddr_in x;
2720 void *foo = (void*) &x.sin_len;],
2722 [ac_cv_sockaddr_in_sin_len=true],
2723 [ac_cv_sockaddr_in_sin_len=false])])
2724 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2725 AC_DEFINE(HAVE_SIN_LEN)
2726 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2727 AC_DEFINE(HAVE_SCONN_LEN)
2730 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2731 ac_cv_sockaddr_in6_sin6_len,
2732 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2733 #include <sys/types.h>
2735 #include <netinet/in.h>
2736 struct sockaddr_in6 x;
2737 void *foo = (void*) &x.sin6_len;],
2739 [ac_cv_sockaddr_in6_sin6_len=true],
2740 [ac_cv_sockaddr_in6_sin6_len=false])])
2741 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2742 AC_DEFINE(HAVE_SIN6_LEN)
2745 AC_CACHE_CHECK(for sockaddr.sa_len,
2746 ac_cv_sockaddr_sa_len,
2747 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2748 #include <sys/types.h>
2750 #include <sys/socket.h>
2752 void *foo = (void*) &x.sa_len;],
2754 [ac_cv_sockaddr_sa_len=true],
2755 [ac_cv_sockaddr_sa_len=false])])
2756 if test "$ac_cv_sockaddr_sa_len" = true ; then
2757 AC_DEFINE(HAVE_SA_LEN)
2760 MOZ_ARG_ENABLE_BOOL(dtrace,
2761 [ --enable-dtrace build with dtrace support if available (default=no)],
2762 [enable_dtrace="yes"],)
2763 if test "x$enable_dtrace" = "xyes"; then
2764 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2765 if test -n "$HAVE_DTRACE"; then
2766 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2768 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2771 AC_SUBST(HAVE_DTRACE)
2777 MOZ_CHECK_HEADERS(sys/cdefs.h)
2781 MOZ_LINUX_PERF_EVENT
2783 dnl Checks for libraries.
2784 dnl ========================================================
2789 AC_CHECK_LIB(c_r, gethostbyname_r)
2793 dnl We don't want to link with libdl even if it's present on OS X, since
2794 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2796 dnl We don't want to link against libm or libpthread on Darwin since
2797 dnl they both are just symlinks to libSystem and explicitly linking
2798 dnl against libSystem causes issues when debugging (see bug 299601).
2803 AC_SEARCH_LIBS(dlopen, dl,
2804 MOZ_CHECK_HEADER(dlfcn.h,
2805 AC_DEFINE(HAVE_DLOPEN)))
2809 _SAVE_CFLAGS="$CFLAGS"
2810 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2811 AC_CHECK_FUNCS(dladdr memmem)
2812 CFLAGS="$_SAVE_CFLAGS"
2814 if test ! "$GNU_CXX"; then
2818 AC_CHECK_LIB(C_r, demangle)
2821 AC_CHECK_LIB(C, demangle)
2826 AC_CHECK_LIB(socket, socket)
2829 XLIBS="$X_EXTRA_LIBS"
2831 dnl ========================================================
2832 dnl Checks for X libraries.
2833 dnl Ordering is important.
2834 dnl Xt is dependent upon SM as of X11R6
2835 dnl ========================================================
2836 if test "$no_x" = "yes"; then
2839 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2840 XLIBS="-lX11 $XLIBS"
2841 _SAVE_LDFLAGS="$LDFLAGS"
2842 LDFLAGS="$XLDFLAGS $LDFLAGS"
2843 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2844 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2845 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2846 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2848 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2849 unset ac_cv_lib_Xt_XtFree
2850 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2851 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
2852 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2853 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2856 # AIX needs the motif library linked before libXt to prevent
2857 # crashes in plugins linked against Motif - Bug #98892
2858 case "${target_os}" in
2860 XT_LIBS="-lXm $XT_LIBS"
2864 dnl ========================================================
2865 dnl = Check for XShm
2866 dnl ========================================================
2867 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
2870 dnl ========================================================
2872 dnl ========================================================
2873 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
2874 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
2875 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
2876 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
2878 LDFLAGS="$_SAVE_LDFLAGS"
2881 AC_SUBST_LIST(XCFLAGS)
2882 AC_SUBST_LIST(XLDFLAGS)
2883 AC_SUBST_LIST(XLIBS)
2884 AC_SUBST_LIST(XEXT_LIBS)
2885 AC_SUBST_LIST(XT_LIBS)
2886 AC_SUBST_LIST(XSS_LIBS)
2888 dnl ========================================================
2889 dnl = pthread support
2890 dnl = Start by checking whether the system support pthreads
2891 dnl ========================================================
2892 case "$target_os" in
2897 AC_CHECK_LIB(pthreads, pthread_create,
2898 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2899 AC_CHECK_LIB(pthread, pthread_create,
2900 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2901 AC_CHECK_LIB(c_r, pthread_create,
2902 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2903 AC_CHECK_LIB(c, pthread_create,
2912 dnl ========================================================
2913 dnl Check the command line for --with-pthreads
2914 dnl ========================================================
2915 MOZ_ARG_WITH_BOOL(pthreads,
2916 [ --with-pthreads Force use of system pthread library with NSPR ],
2917 [ if test "$MOZ_USE_PTHREADS"x = x; then
2918 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2924 dnl ========================================================
2925 dnl Do the platform specific pthread hackery
2926 dnl ========================================================
2927 if test "$MOZ_USE_PTHREADS"x != x
2930 dnl See if -pthread is supported.
2933 ac_cv_have_dash_pthread=no
2934 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2935 echo 'int main() { return 0; }' | cat > conftest.c
2936 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2937 if test $? -eq 0; then
2938 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2939 ac_cv_have_dash_pthread=yes
2940 case "$target_os" in
2942 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2945 CFLAGS="$CFLAGS -pthread"
2946 CXXFLAGS="$CXXFLAGS -pthread"
2952 AC_MSG_RESULT($ac_cv_have_dash_pthread)
2955 dnl See if -pthreads is supported.
2957 ac_cv_have_dash_pthreads=no
2958 if test "$ac_cv_have_dash_pthread" = "no"; then
2959 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2960 echo 'int main() { return 0; }' | cat > conftest.c
2961 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2962 if test $? -eq 0; then
2963 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2964 ac_cv_have_dash_pthreads=yes
2965 CFLAGS="$CFLAGS -pthreads"
2966 CXXFLAGS="$CXXFLAGS -pthreads"
2970 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2975 AC_DEFINE(_REENTRANT)
2976 AC_DEFINE(_THREAD_SAFE)
2977 dnl -pthread links in -lpthread, so don't specify it explicitly.
2978 if test "$ac_cv_have_dash_pthread" = "yes"; then
2979 _PTHREAD_LDFLAGS="-pthread"
2983 *-*-openbsd*|*-*-bsdi*)
2984 AC_DEFINE(_REENTRANT)
2985 AC_DEFINE(_THREAD_SAFE)
2986 dnl -pthread links in -lc_r, so don't specify it explicitly.
2987 if test "$ac_cv_have_dash_pthread" = "yes"; then
2988 _PTHREAD_LDFLAGS="-pthread"
2992 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
2993 AC_DEFINE(_REENTRANT)
2997 AC_DEFINE(_REENTRANT)
3001 AC_DEFINE(_REENTRANT)
3005 AC_DEFINE(_REENTRANT)
3006 if test "$SOLARIS_SUNPRO_CC"; then
3007 CFLAGS="$CFLAGS -mt"
3008 CXXFLAGS="$CXXFLAGS -mt"
3012 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3013 AC_SUBST(MOZ_USE_PTHREADS)
3017 dnl Checks for library functions.
3018 dnl ========================================================
3019 AC_PROG_GCC_TRADITIONAL
3021 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r arc4random arc4random_buf)
3023 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3024 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3025 ac_cv_clock_monotonic,
3026 [for libs in "" -lrt; do
3029 AC_TRY_LINK([#include <time.h>],
3030 [ struct timespec ts;
3031 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3032 ac_cv_clock_monotonic=$libs
3035 ac_cv_clock_monotonic=no)
3038 if test "$ac_cv_clock_monotonic" != "no"; then
3039 HAVE_CLOCK_MONOTONIC=1
3040 REALTIME_LIBS=$ac_cv_clock_monotonic
3041 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3042 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3043 AC_SUBST_LIST(REALTIME_LIBS)
3046 dnl check for wcrtomb/mbrtowc
3047 dnl =======================================================================
3048 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3051 AC_CACHE_CHECK(for wcrtomb,
3053 [AC_TRY_LINK([#include <wchar.h>],
3054 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3055 ac_cv_have_wcrtomb="yes",
3056 ac_cv_have_wcrtomb="no")])
3057 if test "$ac_cv_have_wcrtomb" = "yes"; then
3058 AC_DEFINE(HAVE_WCRTOMB)
3060 AC_CACHE_CHECK(for mbrtowc,
3062 [AC_TRY_LINK([#include <wchar.h>],
3063 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3064 ac_cv_have_mbrtowc="yes",
3065 ac_cv_have_mbrtowc="no")])
3066 if test "$ac_cv_have_mbrtowc" = "yes"; then
3067 AC_DEFINE(HAVE_MBRTOWC)
3074 ac_cv_func_res_ninit,
3075 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
3076 dnl no need for res_ninit() on NetBSD and OpenBSD
3077 ac_cv_func_res_ninit=no
3081 #define _BSD_SOURCE 1
3083 #include <sys/types.h>
3084 #include <netinet/in.h>
3085 #include <arpa/nameser.h>
3088 [int foo = res_ninit(&_res);],
3089 [ac_cv_func_res_ninit=yes],
3090 [ac_cv_func_res_ninit=no])
3094 if test "$ac_cv_func_res_ninit" = "yes"; then
3095 AC_DEFINE(HAVE_RES_NINIT)
3096 dnl must add the link line we do something as foolish as this... dougt
3098 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3099 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3111 AC_CHECK_LIB(c, iconv, [ICONV_LIBS=],
3112 AC_CHECK_LIB(iconv, iconv, [ICONV_LIBS="-liconv"],
3113 AC_CHECK_LIB(iconv, libiconv, [ICONV_LIBS="-liconv"])))
3115 LIBS="$LIBS $ICONV_LIBS"
3124 iconv_t h = iconv_open("", "");
3125 iconv(h, NULL, NULL, NULL, NULL);
3128 [ac_cv_func_iconv=yes],
3129 [ac_cv_func_iconv=no]
3132 if test "$ac_cv_func_iconv" = "yes"; then
3133 AC_DEFINE(HAVE_ICONV)
3134 LIBICONV="$ICONV_LIBS"
3136 [for iconv() with const input],
3137 ac_cv_func_const_iconv,
3143 const char *input = "testing";
3144 iconv_t h = iconv_open("", "");
3145 iconv(h, &input, NULL, NULL, NULL);
3148 [ac_cv_func_const_iconv=yes],
3149 [ac_cv_func_const_iconv=no]
3152 if test "$ac_cv_func_const_iconv" = "yes"; then
3153 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3161 AC_SUBST_LIST(ICONV_LIBS)
3167 dnl **********************
3168 dnl *** va_copy checks ***
3169 AC_CACHE_CHECK([for an implementation of va_copy()],
3171 [AC_TRY_COMPILE([#include <stdarg.h>
3173 void f (int i, ...) {
3174 va_list args1, args2;
3175 va_start (args1, i);
3176 va_copy (args2, args1);
3177 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3179 va_end (args1); va_end (args2);
3181 [f(0, 42); return 0],
3182 [ac_cv_va_copy=yes],
3186 AC_CACHE_CHECK([whether va_list can be copied by value],
3188 [AC_TRY_COMPILE([#include <stdarg.h>
3190 void f (int i, ...) {
3191 va_list args1, args2;
3192 va_start (args1, i);
3194 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3196 va_end (args1); va_end (args2);
3198 [f(0, 42); return 0],
3199 [ac_cv_va_val_copy=yes],
3200 [ac_cv_va_val_copy=no],
3203 if test "x$ac_cv_va_copy" = "xyes"; then
3204 AC_DEFINE(VA_COPY, va_copy)
3205 AC_DEFINE(HAVE_VA_COPY)
3208 if test "x$ac_cv_va_val_copy" = "xno"; then
3209 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3212 dnl ===================================================================
3213 dnl ========================================================
3214 dnl Put your C++ language/feature checks below
3215 dnl ========================================================
3219 if test "$GNU_CC"; then
3220 if test "$CPU_ARCH" = "arm" ; then
3221 AC_CACHE_CHECK(for ARM EABI,
3225 #if defined(__ARM_EABI__)
3228 #error Not ARM EABI.
3231 ac_cv_gcc_arm_eabi="yes",
3232 ac_cv_gcc_arm_eabi="no")])
3233 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3235 ARM_ABI_PREFIX=eabi-
3237 ARM_ABI_PREFIX=oabi-
3241 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3244 dnl Check to see if we can resolve ambiguity with |using|.
3245 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3246 ac_cv_cpp_ambiguity_resolving_using,
3247 [AC_TRY_COMPILE(class X {
3248 public: int go(const X&) {return 3;}
3249 int jo(const X&) {return 3;}
3251 class Y : public X {
3252 public: int go(int) {return 2;}
3253 int jo(int) {return 2;}
3255 private: using X::go;
3258 ac_cv_cpp_ambiguity_resolving_using=yes,
3259 ac_cv_cpp_ambiguity_resolving_using=no)])
3260 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3261 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3264 dnl See if a dynamic_cast to void* gives the most derived object.
3265 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3266 ac_cv_cpp_dynamic_cast_void_ptr,
3267 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3268 class Y { int j; public: virtual ~Y() { } };
3269 class Z : public X, public Y { int k; };
3275 return !((((void*)&mdo != (void*)subx) &&
3276 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3277 (((void*)&mdo != (void*)suby) &&
3278 ((void*)&mdo == dynamic_cast<void*>(suby))));
3280 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3281 ac_cv_cpp_dynamic_cast_void_ptr=no,
3282 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3283 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3284 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3288 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3289 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3290 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3292 _SAVE_LDFLAGS=$LDFLAGS
3293 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3294 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3295 ac_cv_thread_keyword,
3296 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3297 [return tlsIsMainThread;],
3298 ac_cv_thread_keyword=yes,
3299 ac_cv_thread_keyword=no)])
3300 LDFLAGS=$_SAVE_LDFLAGS
3301 # The custom dynamic linker doesn't support TLS variables
3303 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3304 # mips builds fail with TLS variables because of a binutils bug.
3306 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3311 *-android*|*-linuxandroid*)
3318 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3324 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3325 if test -n "$MOZ_LINKER"; then
3326 if test "$CPU_ARCH" = arm; then
3327 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3328 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3329 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3330 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3334 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
3335 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
3336 dnl Since the linker only understands the sysv ones, no need to build the
3337 dnl gnu style tables anyways.
3338 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
3341 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3342 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3343 dnl We however want to avoid these text relocations, and this can be done
3344 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3345 dnl doesn't contain anything at all, beside placeholders for some sections,
3346 dnl and crtbegin only contains a finalizer function that calls
3347 dnl __cxa_finalize. The custom linker actually takes care of calling
3348 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3349 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3350 dnl link crtbegin and crtend at all.
3351 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3352 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3353 ac_cv_crt_has_text_relocations,
3354 [echo 'int foo() { return 0; }' > conftest.cpp
3355 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3356 test -s conftest${DLL_SUFFIX}; then
3357 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3358 ac_cv_crt_has_text_relocations=yes
3360 ac_cv_crt_has_text_relocations=no
3363 AC_ERROR([couldn't compile a simple C file])
3366 if test "$ac_cv_crt_has_text_relocations" = yes; then
3367 dnl While we want libraries to skip the CRT files, we don't want
3368 dnl executables to be treated the same way. We thus set the flag
3369 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3370 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3371 dnl Using LDFLAGS in nspr is safe, since we only really build
3372 dnl libraries there.
3373 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3374 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3378 dnl Check for the existence of various allocation headers/functions
3380 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3383 for file in $MALLOC_HEADERS; do
3384 MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3385 if test "$MALLOC_H" != ""; then
3386 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3391 MOZ_CHECK_HEADERS(alloca.h)
3393 AC_CHECK_FUNCS(strndup posix_memalign memalign)
3395 AC_CHECK_FUNCS(malloc_usable_size)
3396 MALLOC_USABLE_SIZE_CONST_PTR=const
3397 MOZ_CHECK_HEADERS([malloc.h], [
3398 AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument])
3399 AC_TRY_COMPILE([#include <malloc.h>
3401 size_t malloc_usable_size(const void *ptr);],
3402 [return malloc_usable_size(0);],
3403 AC_MSG_RESULT([yes]),
3405 MALLOC_USABLE_SIZE_CONST_PTR=)
3407 AC_DEFINE_UNQUOTED([MALLOC_USABLE_SIZE_CONST_PTR],[$MALLOC_USABLE_SIZE_CONST_PTR])
3410 dnl In newer bionic headers, valloc is built but not defined,
3411 dnl so we check more carefully here.
3412 AC_MSG_CHECKING([for valloc in malloc.h])
3413 AC_EGREP_HEADER(valloc, malloc.h,
3414 AC_DEFINE(HAVE_VALLOC)
3415 AC_MSG_RESULT([yes]),
3416 AC_MSG_RESULT([no]))
3418 AC_MSG_CHECKING([for valloc in unistd.h])
3419 AC_EGREP_HEADER(valloc, unistd.h,
3420 AC_DEFINE(HAVE_VALLOC)
3421 AC_MSG_RESULT([yes]),
3422 AC_MSG_RESULT([no]))
3424 dnl See if compiler supports some gcc-style attributes
3426 AC_CACHE_CHECK(for __attribute__((always_inline)),
3427 ac_cv_attribute_always_inline,
3428 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3430 ac_cv_attribute_always_inline=yes,
3431 ac_cv_attribute_always_inline=no)])
3433 AC_CACHE_CHECK(for __attribute__((malloc)),
3434 ac_cv_attribute_malloc,
3435 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3437 ac_cv_attribute_malloc=yes,
3438 ac_cv_attribute_malloc=no)])
3440 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3441 ac_cv_attribute_warn_unused,
3442 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3444 ac_cv_attribute_warn_unused=yes,
3445 ac_cv_attribute_warn_unused=no)])
3447 dnl End of C++ language/feature checks
3450 dnl ========================================================
3451 dnl = Internationalization checks
3452 dnl ========================================================
3454 dnl Internationalization and Locale support is different
3455 dnl on various UNIX platforms. Checks for specific i18n
3456 dnl features go here.
3458 dnl check for LC_MESSAGES
3459 AC_CACHE_CHECK(for LC_MESSAGES,
3460 ac_cv_i18n_lc_messages,
3461 [AC_TRY_COMPILE([#include <locale.h>],
3462 [int category = LC_MESSAGES;],
3463 ac_cv_i18n_lc_messages=yes,
3464 ac_cv_i18n_lc_messages=no)])
3465 if test "$ac_cv_i18n_lc_messages" = yes; then
3466 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3469 AC_HAVE_FUNCS(localeconv)
3470 fi # ! SKIP_COMPILER_CHECKS
3473 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3474 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3475 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
3478 dnl Mozilla specific options
3479 dnl ========================================================
3480 dnl The macros used for command line options
3481 dnl are defined in build/autoconf/altoptions.m4.
3483 dnl If the compiler supports these attributes, define them as
3484 dnl convenience macros.
3485 if test "$ac_cv_attribute_malloc" = yes ; then
3486 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3488 AC_DEFINE(NS_ATTR_MALLOC,)
3491 if test "$ac_cv_attribute_warn_unused" = yes ; then
3492 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3494 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3497 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3498 dnl features that Windows actually does support.
3500 if test -n "$SKIP_COMPILER_CHECKS"; then
3501 dnl Windows has malloc.h
3502 AC_DEFINE(MALLOC_H, [<malloc.h>])
3503 AC_DEFINE(HAVE_FORCEINLINE)
3504 AC_DEFINE(HAVE_LOCALECONV)
3505 fi # SKIP_COMPILER_CHECKS
3507 dnl ========================================================
3509 dnl = Check for external package dependencies
3511 dnl ========================================================
3512 MOZ_ARG_HEADER(External Packages)
3514 MOZ_ARG_WITH_STRING(libxul-sdk,
3515 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3516 AC_MSG_ERROR([--with-libxul-sdk is not supported anymore.]))
3518 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3519 AC_SUBST(LIBXUL_DIST)
3523 dnl set GRE_MILESTONE
3524 dnl ========================================================
3525 if test -n "$LIBXUL_SDK"; then
3526 GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3528 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3530 AC_SUBST(GRE_MILESTONE)
3532 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3533 # The logic works like this:
3534 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3535 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3536 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3537 case "$GRE_MILESTONE" in
3540 AC_DEFINE(NIGHTLY_BUILD)
3546 AC_DEFINE(RELEASE_BUILD)
3549 AC_SUBST(NIGHTLY_BUILD)
3550 AC_SUBST(RELEASE_BUILD)
3552 dnl ========================================================
3553 dnl Disable compiling sources in unified mode.
3554 dnl ========================================================
3556 MOZ_ARG_DISABLE_BOOL(unified-compilation,
3557 [ --disable-unified-compilation
3558 Disable unified compilation of some C/C++ sources],
3559 MOZ_DISABLE_UNIFIED_COMPILATION=1,
3560 MOZ_DISABLE_UNIFIED_COMPILATION=)
3561 AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
3563 dnl ========================================================
3564 dnl Multiprocess Firefox Nightly Testing UI
3565 dnl To be removed in Bug 1003313
3566 dnl ========================================================
3567 if test -n "$NIGHTLY_BUILD"; then
3569 AC_DEFINE(E10S_TESTING_ONLY)
3572 AC_SUBST(E10S_TESTING_ONLY)
3574 dnl ========================================================
3575 dnl system libevent Support
3576 dnl ========================================================
3577 MOZ_ARG_WITH_STRING(system-libevent,
3578 [ --with-system-libevent[=PFX]
3579 Use system libevent [installed at prefix PFX]],
3580 LIBEVENT_DIR=$withval)
3582 _SAVE_CFLAGS=$CFLAGS
3583 _SAVE_LDFLAGS=$LDFLAGS
3585 if test "$LIBEVENT_DIR" = yes; then
3586 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3587 MOZ_NATIVE_LIBEVENT=1,
3590 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3591 MOZ_NATIVE_LIBEVENT=
3592 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3593 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3594 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3595 MOZ_CHECK_HEADER(event.h,
3596 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3597 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3599 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3600 AC_CHECK_LIB(event, event_init,
3601 [MOZ_NATIVE_LIBEVENT=1
3602 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3603 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3604 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3606 CFLAGS=$_SAVE_CFLAGS
3607 LDFLAGS=$_SAVE_LDFLAGS
3610 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3612 dnl ========================================================
3613 dnl = If NSS was not detected in the system,
3614 dnl = use the one in the source tree (mozilla/security/nss)
3615 dnl ========================================================
3617 MOZ_ARG_WITH_BOOL(system-nss,
3618 [ --with-system-nss Use system installed NSS],
3621 if test -n "$_USE_SYSTEM_NSS"; then
3622 AM_PATH_NSS(3.17.4, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3625 if test -n "$MOZ_NATIVE_NSS"; then
3626 NSS_LIBS="$NSS_LIBS -lcrmf"
3628 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3630 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
3632 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3633 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3634 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3635 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3636 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3638 NSS_LIBS='-L$(LIBXUL_DIST)/lib'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3642 dnl ======================
3644 dnl ======================
3646 AC_MSG_CHECKING([for YASM assembler])
3647 AC_CHECK_PROGS(YASM, yasm, "")
3649 if test -n "$YASM"; then
3650 dnl Pull out yasm's version string
3651 YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3652 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3653 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3654 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3655 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3658 if test -z "$SKIP_LIBRARY_CHECKS"; then
3659 dnl system JPEG support
3660 dnl ========================================================
3661 MOZ_ARG_WITH_STRING(system-jpeg,
3662 [ --with-system-jpeg[=PFX]
3663 Use system libjpeg [installed at prefix PFX]],
3666 _SAVE_CFLAGS=$CFLAGS
3667 _SAVE_LDFLAGS=$LDFLAGS
3669 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3670 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3671 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3673 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3676 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3679 if test "$MOZ_NATIVE_JPEG" = 1; then
3680 AC_TRY_COMPILE([ #include <stdio.h>
3681 #include <sys/types.h>
3682 #include <jpeglib.h> ],
3683 [ #if JPEG_LIB_VERSION < $MOZJPEG
3684 #error "Insufficient JPEG library version ($MOZJPEG required)."
3686 #ifndef JCS_EXTENSIONS
3687 #error "libjpeg-turbo JCS_EXTENSIONS required"
3691 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3693 CFLAGS=$_SAVE_CFLAGS
3694 LDFLAGS=$_SAVE_LDFLAGS
3697 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3698 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3699 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3701 fi # SKIP_LIBRARY_CHECKS
3703 dnl system ZLIB support
3704 dnl ========================================================
3705 MOZ_ZLIB_CHECK([1.2.3])
3707 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
3708 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
3713 if test -z "$SKIP_LIBRARY_CHECKS"; then
3714 dnl system BZIP2 Support
3715 dnl ========================================================
3716 MOZ_ARG_WITH_STRING(system-bz2,
3717 [ --with-system-bz2[=PFX]
3718 Use system libbz2 [installed at prefix PFX]],
3721 _SAVE_CFLAGS=$CFLAGS
3722 _SAVE_LDFLAGS=$LDFLAGS
3724 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
3725 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
3726 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
3728 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
3731 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
3732 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
3734 CFLAGS=$_SAVE_CFLAGS
3735 LDFLAGS=$_SAVE_LDFLAGS
3738 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
3739 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
3740 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
3743 dnl ========================================================
3744 dnl system PNG Support
3745 dnl ========================================================
3746 MOZ_ARG_WITH_STRING(system-png,
3747 [ --with-system-png[=PFX]
3748 Use system libpng [installed at prefix PFX]],
3751 _SAVE_CFLAGS=$CFLAGS
3752 _SAVE_LDFLAGS=$LDFLAGS
3754 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
3755 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
3756 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
3758 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
3761 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
3762 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3763 AC_CHECK_LIB(png, png_get_acTL, ,
3764 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
3766 if test "$MOZ_NATIVE_PNG" = 1; then
3767 AC_TRY_COMPILE([ #include <stdio.h>
3768 #include <sys/types.h>
3770 [ #if PNG_LIBPNG_VER < $MOZPNG
3771 #error "Insufficient libpng version ($MOZPNG required)."
3773 #ifndef PNG_UINT_31_MAX
3774 #error "Insufficient libpng version."
3777 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3779 CFLAGS=$_SAVE_CFLAGS
3780 LDFLAGS=$_SAVE_LDFLAGS
3783 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
3784 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
3785 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
3788 MOZ_PNG_ARM_NEON_CHECK=
3789 if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
3790 MOZ_ARG_ENABLE_STRING(png-arm-neon-support,
3791 [ --enable-png-arm-neon-support=TYPE
3795 nocheck (faster but unsafe)],
3796 [MOZ_PNG_ARM_NEON_SUPPORT=$enableval ] )
3797 case "$MOZ_PNG_ARM_NEON_SUPPORT" in
3799 # enable-png-arm-neon-support = no
3802 # enable-png-arm-neon-support = nocheck
3807 MOZ_PNG_ARM_NEON_CHECK=1
3812 AC_SUBST(MOZ_PNG_ARM_NEON_CHECK)
3814 fi # SKIP_LIBRARY_CHECKS
3816 AC_SUBST(MOZ_PNG_ARM_NEON)
3818 dnl ========================================================
3819 dnl system HunSpell Support
3820 dnl ========================================================
3821 MOZ_ARG_ENABLE_BOOL(system-hunspell,
3822 [ --enable-system-hunspell
3823 Use system hunspell (located with pkgconfig)],
3824 MOZ_NATIVE_HUNSPELL=1 )
3826 if test -n "$MOZ_NATIVE_HUNSPELL"; then
3827 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
3830 AC_SUBST(MOZ_NATIVE_HUNSPELL)
3832 dnl ========================================================
3833 dnl system libffi Support
3834 dnl ========================================================
3837 MOZ_ARG_ENABLE_BOOL(shared-js,
3838 [ --enable-shared-js
3839 Create a shared JavaScript library.],
3840 JS_SHARED_LIBRARY=1,
3843 dnl ========================================================
3844 dnl Java SDK support
3845 dnl ========================================================
3848 MOZ_ARG_WITH_STRING(java-bin-path,
3849 [ --with-java-bin-path=dir
3850 Location of Java binaries (java, javac, jar)],
3851 JAVA_BIN_PATH=$withval)
3853 dnl ========================================================
3857 dnl ========================================================
3859 MOZ_ARG_HEADER(Application)
3862 ENABLE_SYSTEM_EXTENSION_DIRS=1
3863 MOZ_BRANDING_DIRECTORY=
3864 MOZ_OFFICIAL_BRANDING=
3867 MOZ_AUTH_EXTENSION=1
3872 MOZ_SAMPLE_TYPE_FLOAT32=
3873 MOZ_SAMPLE_TYPE_S16=
3878 if test -n "$MOZ_FMP4"; then
3887 MOZ_WEBRTC_SIGNALING=
3888 MOZ_WEBRTC_ASSERT_ALWAYS=1
3889 MOZ_WEBRTC_HARDWARE_AEC_NS=
3892 MOZ_MEDIA_NAVIGATOR=
3895 MOZ_VPX_ERROR_CONCEALMENT=
3905 LIBJPEG_TURBO_ASFLAGS=
3906 LIBJPEG_TURBO_X86_ASM=
3907 LIBJPEG_TURBO_X64_ASM=
3908 LIBJPEG_TURBO_ARM_ASM=
3912 MOZ_PREF_EXTENSIONS=1
3913 MOZ_PROFILELOCKING=1
3919 MOZ_TOOLKIT_SEARCH=1
3921 MOZ_UNIVERSALCHARDET=1
3930 NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device"
3931 if test -n "$MOZ_RTSP"; then
3932 NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp"
3936 MOZ_USE_NATIVE_POPUP_WINDOWS=
3937 MOZ_ANDROID_HISTORY=
3940 MOZ_LOCALE_SWITCHER=
3941 MOZ_ANDROID_SEARCH_ACTIVITY=
3942 MOZ_ANDROID_DOWNLOADS_INTEGRATION=
3943 MOZ_ANDROID_MLS_STUMBLER=
3944 MOZ_ANDROID_SHARE_OVERLAY=
3945 MOZ_ANDROID_NEW_TABLET_UI=
3949 MOZ_AUDIO_CHANNEL_MANAGER=
3951 MOZ_CONTENT_SANDBOX=
3955 case "$target_os" in
3958 AC_DEFINE(NS_ENABLE_TSF)
3963 *-android*|*-linuxandroid*)
3964 if test "$CPU_ARCH" = "arm" ; then
3969 MOZ_THEME_FASTSTRIPE=1
3977 MOZ_ARG_WITH_STRING(external-source-dir,
3978 [ --with-external-source-dir=dir
3979 External directory containing additional build files.],
3980 [ EXTERNAL_SOURCE_DIR=$withval])
3981 AC_SUBST(EXTERNAL_SOURCE_DIR)
3983 MOZ_ARG_ENABLE_STRING(application,
3984 [ --enable-application=APP
3988 tools/update-packaging (AUS-related packaging tools)],
3989 [ MOZ_BUILD_APP=$enableval ] )
3991 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
3992 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
3993 XULRUNNER_STUB_NAME=$withval)
3995 if test -z "$XULRUNNER_STUB_NAME"; then
3996 XULRUNNER_STUB_NAME=xulrunner-stub
3998 AC_SUBST(XULRUNNER_STUB_NAME)
4000 AC_MSG_CHECKING([for application to build])
4001 if test -z "$MOZ_BUILD_APP"; then
4002 AC_MSG_RESULT([browser])
4003 MOZ_BUILD_APP=browser
4005 # "mobile" no longer exists.
4006 if test "$MOZ_BUILD_APP" = "mobile" ; then
4007 AC_MSG_RESULT([none])
4008 AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
4010 # Support comm-central.
4011 if test -n "$EXTERNAL_SOURCE_DIR" ; then
4012 MOZ_BUILD_APP="$EXTERNAL_SOURCE_DIR/$MOZ_BUILD_APP"
4013 MOZ_BUILD_APP=`${PYTHON} -c "import mozpack.path as mozpath; print(mozpath.relpath(\"${MOZ_BUILD_APP}\", \"${srcdir}\"))"`
4015 # We have a valid application only if it has a build.mk file in its top
4017 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4018 AC_MSG_RESULT([none])
4019 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4021 AC_MSG_RESULT([$MOZ_BUILD_APP])
4025 # The app update channel is 'default' when not supplied. The value is used in
4026 # the application's confvars.sh so it must be set before confvars.sh is called.
4027 MOZ_ARG_ENABLE_STRING([update-channel],
4028 [ --enable-update-channel=CHANNEL
4029 Select application update channel (default=default)],
4030 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4032 if test -z "$MOZ_UPDATE_CHANNEL"; then
4033 MOZ_UPDATE_CHANNEL=default
4035 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4036 AC_SUBST(MOZ_UPDATE_CHANNEL)
4038 # Allow to specify a Mozilla API key file that contains the secret key to be
4039 # used for various Mozilla API requests.
4040 MOZ_ARG_WITH_STRING(mozilla-api-keyfile,
4041 [ --with-mozilla-api-keyfile=file Use the secret key contained in the given keyfile for Mozilla API requests],
4042 MOZ_MOZILLA_API_KEY=`cat $withval`)
4043 if test -z "$MOZ_MOZILLA_API_KEY"; then
4044 MOZ_MOZILLA_API_KEY=no-mozilla-api-key
4046 AC_SUBST(MOZ_MOZILLA_API_KEY)
4048 # Allow to specify a Google API key file that contains the secret key to be
4049 # used for various Google API requests.
4050 MOZ_ARG_WITH_STRING(google-api-keyfile,
4051 [ --with-google-api-keyfile=file Use the secret key contained in the given keyfile for Google API requests],
4052 MOZ_GOOGLE_API_KEY=`cat $withval`)
4053 if test -z "$MOZ_GOOGLE_API_KEY"; then
4054 MOZ_GOOGLE_API_KEY=no-google-api-key
4056 AC_SUBST(MOZ_GOOGLE_API_KEY)
4058 # Allow to specify a Google OAuth API key file that contains the client ID and
4059 # the secret key to be used for various Google OAuth API requests.
4060 MOZ_ARG_WITH_STRING(google-oauth-api-keyfile,
4061 [ --with-google-oauth-api-keyfile=file Use the client id and secret key contained in the given keyfile for Google OAuth API requests],
4062 [MOZ_GOOGLE_OAUTH_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
4063 MOZ_GOOGLE_OAUTH_API_KEY=`cat $withval | cut -f 2 -d " "`])
4064 if test -z "$MOZ_GOOGLE_OAUTH_API_CLIENTID"; then
4065 MOZ_GOOGLE_OAUTH_API_CLIENTID=no-google-oauth-api-clientid
4066 MOZ_GOOGLE_OAUTH_API_KEY=no-google-oauth-api-key
4068 AC_SUBST(MOZ_GOOGLE_OAUTH_API_CLIENTID)
4069 AC_SUBST(MOZ_GOOGLE_OAUTH_API_KEY)
4071 # Allow specifying a Bing API key file that contains the client ID and the
4072 # secret key to be used for the Bing Translation API requests.
4073 MOZ_ARG_WITH_STRING(bing-api-keyfile,
4074 [ --with-bing-api-keyfile=file Use the client id and secret key contained in the given keyfile for Bing API requests],
4075 [MOZ_BING_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
4076 MOZ_BING_API_KEY=`cat $withval | cut -f 2 -d " "`])
4077 if test -z "$MOZ_BING_API_CLIENTID"; then
4078 MOZ_BING_API_CLIENTID=no-bing-api-clientid
4079 MOZ_BING_API_KEY=no-bing-api-key
4081 AC_SUBST(MOZ_BING_API_CLIENTID)
4082 AC_SUBST(MOZ_BING_API_KEY)
4084 # Whether to include optional-but-large font files in the final APK.
4085 # We want this in mobile/android/confvars.sh, so it goes early.
4086 MOZ_ARG_DISABLE_BOOL(android-include-fonts,
4087 [ --disable-android-include-fonts
4088 Disable the inclusion of fonts into the final APK],
4089 MOZ_ANDROID_EXCLUDE_FONTS=1)
4091 if test -n "$MOZ_ANDROID_EXCLUDE_FONTS"; then
4092 AC_DEFINE(MOZ_ANDROID_EXCLUDE_FONTS)
4094 AC_SUBST(MOZ_ANDROID_EXCLUDE_FONTS)
4096 # Whether this APK is destined for resource constrained devices.
4097 # We want this in mobile/android/confvars.sh, so it goes early.
4098 MOZ_ARG_ENABLE_BOOL(android-resource-constrained,
4099 [ --enable-android-resource-constrained
4100 Exclude hi-res images and similar from the final APK],
4101 MOZ_ANDROID_RESOURCE_CONSTRAINED=1)
4103 if test -n "$MOZ_ANDROID_RESOURCE_CONSTRAINED"; then
4104 AC_DEFINE(MOZ_ANDROID_RESOURCE_CONSTRAINED)
4106 AC_SUBST(MOZ_ANDROID_RESOURCE_CONSTRAINED)
4108 # Allow the application to influence configure with a confvars.sh script.
4109 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4110 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4111 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4112 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4117 # Allow influencing configure with a defines.sh script.
4118 . "${srcdir}/build/defines.sh"
4120 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
4122 if test "$BUILDING_RELEASE"; then
4123 # Override value in defines.sh, if any
4124 EARLY_BETA_OR_EARLIER=
4125 elif test "$EARLY_BETA_OR_EARLIER"; then
4126 AC_DEFINE(EARLY_BETA_OR_EARLIER)
4128 AC_SUBST(EARLY_BETA_OR_EARLIER)
4130 # Allow the application to provide a subconfigure script
4131 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4132 do_output_subdirs() {
4133 if test -n "$_subconfigure_subdirs"; then
4134 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4136 _subconfigure_subdir="$1"
4137 _subconfigure_config_args="$ac_configure_args"
4139 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4140 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4141 "${srcdir}/build/autoconf/altoptions.m4" \
4142 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4147 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4148 MOZ_ARG_WITH_STRING(app-name,
4149 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4150 WITH_APP_NAME=$withval,
4153 if test -n "$WITH_APP_NAME" ; then
4154 MOZ_APP_NAME="$WITH_APP_NAME"
4157 MOZ_ARG_WITH_STRING(app-basename,
4158 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4159 WITH_APP_BASENAME=$withval,
4162 if test -n "$WITH_APP_BASENAME" ; then
4163 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4166 # Now is a good time to test for logic errors, define mismatches, etc.
4167 case "$MOZ_BUILD_APP" in
4169 if test "$LIBXUL_SDK"; then
4170 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4175 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4176 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4178 case "$MOZ_BUILD_APP" in
4180 AC_DEFINE(MOZ_PHOENIX)
4184 AC_DEFINE(MOZ_XULRUNNER)
4191 AC_DEFINE(MOZ_MULET)
4195 AC_SUBST(MOZ_BUILD_APP)
4196 AC_SUBST(MOZ_PHOENIX)
4197 AC_SUBST(MOZ_XULRUNNER)
4200 AC_SUBST(MOZ_B2G_VERSION)
4202 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4204 case "$OS_TARGET" in
4205 WINNT|Darwin|Android)
4213 dnl ========================================================
4214 dnl Check Android SDK version depending on mobile target.
4215 dnl ========================================================
4217 if test -z "$gonkdir" ; then
4218 # Minimum Android SDK API Level we require.
4219 case "$MOZ_BUILD_APP" in
4221 android_min_api_level=17
4223 *-android*|*-linuxandroid*)
4227 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])
4233 MOZ_ANDROID_SDK($android_min_api_level)
4236 dnl ========================================================
4238 dnl = Toolkit Options
4240 dnl ========================================================
4241 MOZ_ARG_HEADER(Toolkit Options)
4243 dnl ========================================================
4244 dnl = Select the default toolkit
4245 dnl ========================================================
4246 MOZ_ARG_ENABLE_STRING(default-toolkit,
4247 [ --enable-default-toolkit=TK
4248 Select default toolkit
4249 Platform specific defaults:
4250 Mac OS X - cairo-cocoa
4251 Win32 - cairo-windows
4255 [ _DEFAULT_TOOLKIT=$enableval ],
4256 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4258 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4259 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4260 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4261 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4262 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4263 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4264 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4265 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4266 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4268 dnl nglayout only supports building with one toolkit,
4269 dnl so ignore everything after the first comma (",").
4270 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4272 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4275 MOZ_ARG_WITHOUT_BOOL(x,
4276 [ --without-x Build without X11],
4279 dnl ========================================================
4280 dnl = Enable the toolkit as needed =
4281 dnl ========================================================
4285 case "$MOZ_WIDGET_TOOLKIT" in
4288 MOZ_WIDGET_TOOLKIT=windows
4290 MOZ_INSTRUMENT_EVENT_LOOP=1
4291 if test -n "$GNU_CC"; then
4297 MOZ_WIDGET_TOOLKIT=gtk3
4300 MOZ_ENABLE_XREMOTE=1
4301 MOZ_GL_DEFAULT_PROVIDER=GLX
4307 TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4309 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4311 MOZ_INSTRUMENT_EVENT_LOOP=1
4314 cairo-gtk2|cairo-gtk2-x11)
4315 MOZ_WIDGET_TOOLKIT=gtk2
4318 MOZ_ENABLE_XREMOTE=1
4319 MOZ_GL_DEFAULT_PROVIDER=GLX
4325 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4326 TK_LIBS='$(MOZ_GTK2_LIBS)'
4327 AC_DEFINE(MOZ_WIDGET_GTK2)
4329 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4331 MOZ_INSTRUMENT_EVENT_LOOP=1
4335 MOZ_WIDGET_TOOLKIT=qt
4337 if test -z "$WITHOUT_X11"; then
4338 MOZ_ENABLE_XREMOTE=1
4339 MOZ_GL_DEFAULT_PROVIDER=GLX
4346 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4347 TK_LIBS='$(MOZ_QT_LIBS)'
4348 AC_DEFINE(MOZ_WIDGET_QT)
4350 AC_DEFINE(QT_NO_KEYWORDS)
4354 MOZ_WIDGET_TOOLKIT=cocoa
4355 AC_DEFINE(MOZ_WIDGET_COCOA)
4356 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4357 # Use -Wl as a trick to avoid -framework and framework names from
4358 # being separated by AC_SUBST_LIST.
4359 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'
4360 TK_CFLAGS="-DNO_X11"
4361 CFLAGS="$CFLAGS $TK_CFLAGS"
4362 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4363 MOZ_USER_DIR="Mozilla"
4364 MOZ_FS_LAYOUT=bundle
4365 MOZ_INSTRUMENT_EVENT_LOOP=1
4369 MOZ_WIDGET_TOOLKIT=uikit
4370 AC_DEFINE(MOZ_WIDGET_UIKIT)
4371 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4372 TK_CFLAGS="-DNO_X11"
4373 TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText'
4374 CFLAGS="$CFLAGS $TK_CFLAGS"
4375 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4376 MOZ_USER_DIR="Mozilla"
4377 MOZ_FS_LAYOUT=bundle
4381 AC_DEFINE(MOZ_WIDGET_ANDROID)
4382 MOZ_WIDGET_TOOLKIT=android
4383 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4384 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4386 MOZ_INSTRUMENT_EVENT_LOOP=1
4390 AC_DEFINE(MOZ_WIDGET_GONK)
4391 AC_DEFINE(MOZ_TOUCH)
4392 MOZ_WIDGET_TOOLKIT=gonk
4393 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4394 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4397 MOZ_INSTRUMENT_EVENT_LOOP=1
4402 AC_SUBST(MOZ_PDF_PRINTING)
4403 if test "$MOZ_PDF_PRINTING"; then
4404 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4405 AC_DEFINE(MOZ_PDF_PRINTING)
4408 if test "$MOZ_ENABLE_XREMOTE"; then
4409 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4412 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4413 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4416 if test "$COMPILE_ENVIRONMENT"; then
4417 if test "$MOZ_ENABLE_GTK3"; then
4418 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 atk-bridge-2.0 $GDK_PACKAGES)
4419 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
4420 dnl Contrary to MOZ_GTK2_LIBS, MOZ_GTK3_LIBS needs to be literally added to TK_LIBS instead
4421 dnl of a make reference because of how TK_LIBS is mangled in toolkit/library/moz.build
4422 dnl for GTK+3 builds.
4423 TK_LIBS=$MOZ_GTK3_LIBS
4425 if test "$MOZ_ENABLE_GTK"; then
4426 if test "$MOZ_X11"; then
4427 GDK_PACKAGES=gdk-x11-2.0
4430 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4431 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
4434 fi # COMPILE_ENVIRONMENT
4436 AC_SUBST(MOZ_FS_LAYOUT)
4438 dnl ========================================================
4439 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4440 dnl their usage and use them in spidermonkey.
4441 dnl ========================================================
4442 MOZ_ARG_WITH_BOOL(arm-kuser,
4443 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4445 if test -n "$USE_ARM_KUSER"; then
4446 AC_DEFINE(USE_ARM_KUSER)
4449 dnl ========================================================
4450 dnl = startup-notification support module
4451 dnl ========================================================
4453 if test "$MOZ_ENABLE_GTK"
4455 MOZ_ENABLE_STARTUP_NOTIFICATION=
4457 MOZ_ARG_ENABLE_BOOL(startup-notification,
4458 [ --enable-startup-notification
4459 Enable startup-notification support (default: disabled) ],
4460 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4461 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4462 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4464 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4465 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4466 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4467 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4469 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4471 MOZ_ENABLE_STARTUP_NOTIFICATION=
4475 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4476 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4479 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4481 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4483 dnl ========================================================
4484 dnl Disable printing
4485 dnl ========================================================
4486 MOZ_ARG_DISABLE_BOOL(printing,
4487 [ --disable-printing Disable printing support],
4491 if test "$NS_PRINTING"; then
4492 AC_DEFINE(NS_PRINTING)
4493 AC_DEFINE(NS_PRINT_PREVIEW)
4496 dnl ========================================================
4498 dnl ========================================================
4499 if test "$MOZ_ENABLE_QT"
4501 MOZ_ARG_WITH_STRING(qtdir,
4502 [ --with-qtdir=\$dir Specify Qt directory ],
4505 if test -z "$QTDIR"; then
4506 AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4508 HOST_QMAKE="$QTDIR/bin/qmake"
4510 QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4512 if test -z "$QTDIR"; then
4515 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4516 PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5Quick, ,
4518 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4520 QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4521 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4522 if test "$NS_PRINTING"; then
4523 PKG_CHECK_MODULES(MOZ_QT_WIDGETS, Qt5PrintSupport, ,
4525 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase widgets development package])
4527 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT_WIDGETS_LIBS"
4528 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT_WIDGETS_CFLAGS"
4532 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4536 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4537 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4539 MOZ_QT_CFLAGS="-DQT_SHARED"
4540 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4541 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4542 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4543 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4544 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4545 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4548 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4549 MOZ_QT_LIBS="$MOZ_QT_LIBS -L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml"
4550 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4551 if test "$NS_PRINTING"; then
4552 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4553 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4557 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4561 HOST_MOC="$QTDIR/bin/moc"
4562 HOST_RCC="$QTDIR/bin/rcc"
4564 if test -z "$HOST_MOC"; then
4565 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4567 if test -z "$HOST_RCC"; then
4568 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4574 MOZ_ENABLE_QMSYSTEM2=
4575 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4576 MOZ_ENABLE_QMSYSTEM2=1,
4577 MOZ_ENABLE_QMSYSTEM2=)
4579 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4580 MOZ_ENABLE_QMSYSTEM2=1
4581 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4582 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4583 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4586 MOZ_ENABLE_QTNETWORK=
4587 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4588 MOZ_ENABLE_QTNETWORK=1,
4589 MOZ_ENABLE_QTNETWORK=)
4591 if test "$MOZ_ENABLE_QTNETWORK"; then
4592 MOZ_ENABLE_QTNETWORK=1
4593 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4596 MOZ_ENABLE_QTMOBILITY=
4597 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4598 MOZ_ENABLE_QTMOBILITY=1,
4599 MOZ_ENABLE_QTMOBILITY=)
4600 if test "$MOZ_ENABLE_QTMOBILITY"; then
4601 MOZ_ENABLE_QTMOBILITY=1
4602 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4603 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4604 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4605 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4607 AC_CHECK_LIB(QtSensors, main, [
4608 MOZ_ENABLE_QTMOBILITY=1
4609 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4610 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4611 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4612 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4613 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4617 MOZ_ENABLE_QT5FEEDBACK=
4618 PKG_CHECK_MODULES(_QT5FEEDBACK, Qt0Feedback,
4619 MOZ_ENABLE_QT5FEEDBACK=1,
4620 MOZ_ENABLE_QT5FEEDBACK=)
4621 if test "$MOZ_ENABLE_QT5FEEDBACK"; then
4622 MOZ_ENABLE_QT5FEEDBACK=1
4623 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5FEEDBACK_CFLAGS"
4624 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5FEEDBACK_LIBS"
4625 AC_DEFINE(MOZ_ENABLE_QT5FEEDBACK)
4626 AC_SUBST(MOZ_ENABLE_QT5FEEDBACK)
4629 MOZ_ENABLE_QT5GEOPOSITION=
4630 PKG_CHECK_MODULES(_QT5GEOPOSITION, Qt5Positioning,
4631 MOZ_ENABLE_QT5GEOPOSITION=1,
4632 MOZ_ENABLE_QT5GEOPOSITION=)
4633 if test "$MOZ_ENABLE_QT5GEOPOSITION"; then
4634 MOZ_ENABLE_QT5GEOPOSITION=1
4635 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5GEOPOSITION_CFLAGS"
4636 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5GEOPOSITION_LIBS"
4637 AC_DEFINE(MOZ_ENABLE_QT5GEOPOSITION)
4638 AC_SUBST(MOZ_ENABLE_QT5GEOPOSITION)
4641 if test "$MOZ_ENABLE_CONTENTACTION"; then
4642 MOZ_ENABLE_CONTENTACTION=1
4643 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4646 MOZ_ENABLE_CONTENTACTION=
4647 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
4648 if test "$MOZ_ENABLE_CONTENTACTION"; then
4649 MOZ_ENABLE_CONTENTACTION=1
4650 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
4651 MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
4652 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4653 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
4657 AC_SUBST(GTK_CONFIG)
4658 AC_SUBST_LIST(TK_CFLAGS)
4659 AC_SUBST_LIST(TK_LIBS)
4661 AC_SUBST(MOZ_ENABLE_GTK2)
4662 AC_SUBST(MOZ_ENABLE_GTK3)
4663 AC_SUBST(MOZ_ENABLE_GTK)
4664 AC_SUBST(MOZ_ENABLE_QT)
4665 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4666 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4667 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4668 AC_SUBST(MOZ_ENABLE_XREMOTE)
4669 AC_SUBST(MOZ_WIDGET_GTK)
4670 AC_SUBST_LIST(MOZ_QT_CFLAGS)
4671 AC_SUBST_LIST(MOZ_QT_LIBS)
4678 dnl ========================================================
4680 dnl = Components & Features
4682 dnl ========================================================
4683 MOZ_ARG_HEADER(Components and Features)
4685 dnl ========================================================
4687 dnl ========================================================
4688 MOZ_ARG_ENABLE_STRING(ui-locale,
4689 [ --enable-ui-locale=ab-CD
4690 Select the user interface locale (default: en-US)],
4691 MOZ_UI_LOCALE=$enableval )
4692 AC_SUBST(MOZ_UI_LOCALE)
4694 dnl ========================================================
4695 dnl = Trademarked Branding
4696 dnl ========================================================
4697 MOZ_ARG_ENABLE_BOOL(official-branding,
4698 [ --enable-official-branding
4699 Enable Official mozilla.org Branding
4700 Do not distribute builds with
4701 --enable-official-branding unless you have
4702 permission to use trademarks per
4703 http://www.mozilla.org/foundation/trademarks/ .],
4705 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4706 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4708 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4709 MOZ_OFFICIAL_BRANDING=1
4711 ], MOZ_OFFICIAL_BRANDING=)
4713 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4714 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4715 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4718 MOZ_ARG_WITH_STRING(branding,
4719 [ --with-branding=dir Use branding from the specified directory.],
4720 MOZ_BRANDING_DIRECTORY=$withval)
4722 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4723 if test -z "$REAL_BRANDING_DIRECTORY"; then
4724 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4727 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4728 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4729 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4730 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
4733 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4735 dnl ========================================================
4736 dnl = Distribution ID
4737 dnl ========================================================
4738 MOZ_ARG_WITH_STRING(distribution-id,
4739 [ --with-distribution-id=ID
4740 Set distribution-specific id (default=org.mozilla)],
4741 [ val=`echo $withval`
4742 MOZ_DISTRIBUTION_ID="$val"])
4744 if test -z "$MOZ_DISTRIBUTION_ID"; then
4745 MOZ_DISTRIBUTION_ID="org.mozilla"
4748 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4749 AC_SUBST(MOZ_DISTRIBUTION_ID)
4752 dnl ========================================================
4753 dnl Google Play Services, placed here so it can depend on
4754 dnl values set by configure.sh above.
4755 dnl ========================================================
4757 MOZ_ANDROID_GOOGLE_PLAY_SERVICES
4760 dnl ========================================================
4762 dnl ========================================================
4763 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4765 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4767 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4770 dnl ========================================================
4771 dnl = GnomeVFS, GIO and GConf support module
4772 dnl ========================================================
4776 dnl build the GIO extension by default only when the
4777 dnl GTK2 toolkit is in use.
4778 if test "$MOZ_ENABLE_GTK"
4784 dnl ========================================================
4785 dnl = GnomeVFS support module
4786 dnl ========================================================
4787 MOZ_ARG_ENABLE_BOOL(gnomevfs,
4788 [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
4789 MOZ_ENABLE_GNOMEVFS=force,
4790 MOZ_ENABLE_GNOMEVFS=)
4792 if test "$MOZ_ENABLE_GNOMEVFS"
4794 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4795 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4796 MOZ_ENABLE_GNOMEVFS=1
4797 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4799 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4801 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4803 MOZ_ENABLE_GNOMEVFS=
4807 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4809 dnl ========================================================
4810 dnl = GIO support module
4811 dnl ========================================================
4812 MOZ_ARG_DISABLE_BOOL(gio,
4813 [ --disable-gio Disable GIO support],
4815 MOZ_ENABLE_GIO=force)
4817 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
4819 if test "$MOZ_ENABLE_GTK2"
4821 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4822 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4824 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4825 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4827 AC_DEFINE(MOZ_ENABLE_GIO)
4829 if test "$MOZ_ENABLE_GIO" = "force"
4831 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4837 AC_SUBST(MOZ_ENABLE_GIO)
4839 dnl ========================================================
4840 dnl = GConf support module
4841 dnl ========================================================
4842 MOZ_ARG_DISABLE_BOOL(gconf,
4843 [ --disable-gconf Disable Gconf support ],
4845 MOZ_ENABLE_GCONF=force)
4847 if test "$MOZ_ENABLE_GCONF"
4849 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4850 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4853 if test "$MOZ_ENABLE_GCONF" = "force"
4855 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4861 if test "$MOZ_ENABLE_GCONF"; then
4862 AC_DEFINE(MOZ_ENABLE_GCONF)
4865 AC_SUBST(MOZ_ENABLE_GCONF)
4868 dnl ========================================================
4869 dnl = libproxy support
4870 dnl ========================================================
4872 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4874 MOZ_ENABLE_LIBPROXY=
4876 MOZ_ARG_ENABLE_BOOL(libproxy,
4877 [ --enable-libproxy Enable libproxy support ],
4878 MOZ_ENABLE_LIBPROXY=1,
4879 MOZ_ENABLE_LIBPROXY=)
4881 if test "$MOZ_ENABLE_LIBPROXY"
4883 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4884 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4887 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4889 dnl ========================================================
4890 dnl = GNOME component (mozgnome)
4891 dnl ========================================================
4893 if test "$MOZ_ENABLE_GTK"
4895 MOZ_ENABLE_GNOME_COMPONENT=1
4897 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4899 dnl ========================================================
4900 dnl = libgnomeui support module
4901 dnl ========================================================
4903 if test "$MOZ_ENABLE_GTK"
4905 MOZ_ARG_ENABLE_BOOL(gnomeui,
4906 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
4907 MOZ_ENABLE_GNOMEUI=force,
4908 MOZ_ENABLE_GNOMEUI=)
4910 if test "$MOZ_ENABLE_GNOMEUI"
4912 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4914 MOZ_ENABLE_GNOMEUI=1
4916 if test "$MOZ_ENABLE_GNOMEUI" = "force"
4918 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4924 if test "$MOZ_ENABLE_GNOMEUI"; then
4925 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4929 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4931 dnl ========================================================
4933 dnl ========================================================
4935 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4939 MOZ_ARG_DISABLE_BOOL(dbus,
4940 [ --disable-dbus Disable dbus support ],
4944 if test "$MOZ_ENABLE_DBUS"
4946 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
4947 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
4948 AC_DEFINE(MOZ_ENABLE_DBUS)
4951 AC_SUBST(MOZ_ENABLE_DBUS)
4953 dnl ========================================================
4954 dnl = Enable Android History instead of Places
4955 dnl ========================================================
4956 if test -n "$MOZ_ANDROID_HISTORY"; then
4957 if test -z "$MOZ_PLACES"; then
4958 AC_DEFINE(MOZ_ANDROID_HISTORY)
4960 AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
4964 dnl ========================================================
4965 dnl = Enable the C++ async pan/zoom code instead of the Java version
4966 dnl ========================================================
4967 MOZ_ARG_ENABLE_BOOL(android-apz,
4968 [ --enable-android-apz Switch to C++ pan/zoom code],
4971 if test -n "$MOZ_ANDROID_APZ"; then
4972 dnl Do this if defined in confvars.sh
4973 AC_DEFINE(MOZ_ANDROID_APZ)
4976 dnl ========================================================
4977 dnl = Disable WebSMS backend
4978 dnl ========================================================
4979 MOZ_ARG_DISABLE_BOOL(websms-backend,
4980 [ --disable-websms-backend
4981 Disable WebSMS backend],
4982 MOZ_WEBSMS_BACKEND=,
4983 MOZ_WEBSMS_BACKEND=1)
4985 if test -n "$MOZ_WEBSMS_BACKEND"; then
4986 AC_DEFINE(MOZ_WEBSMS_BACKEND)
4989 dnl ========================================================
4990 dnl = Enable runtime locale switching on Android
4991 dnl ========================================================
4992 if test -n "$MOZ_LOCALE_SWITCHER"; then
4993 AC_DEFINE(MOZ_LOCALE_SWITCHER)
4996 dnl ========================================================
4997 dnl = Enable system download manager on Android
4998 dnl ========================================================
4999 if test -n "$MOZ_ANDROID_DOWNLOADS_INTEGRATION"; then
5000 AC_DEFINE(MOZ_ANDROID_DOWNLOADS_INTEGRATION)
5003 dnl ========================================================
5004 dnl = Enable NFC permission on Android
5005 dnl ========================================================
5006 if test -n "$MOZ_ANDROID_BEAM"; then
5007 AC_DEFINE(MOZ_ANDROID_BEAM)
5010 dnl ========================================================
5011 dnl = Include Search Activity on Android
5012 dnl ========================================================
5013 if test -n "$MOZ_ANDROID_SEARCH_ACTIVITY"; then
5014 AC_DEFINE(MOZ_ANDROID_SEARCH_ACTIVITY)
5017 dnl ========================================================
5018 dnl = Include Mozilla Location Service Stumbler on Android
5019 dnl ========================================================
5020 if test -n "$MOZ_ANDROID_MLS_STUMBLER"; then
5021 AC_DEFINE(MOZ_ANDROID_MLS_STUMBLER)
5024 dnl ========================================================
5025 dnl = Include share overlay on Android
5026 dnl ========================================================
5027 if test -n "$MOZ_ANDROID_SHARE_OVERLAY"; then
5028 AC_DEFINE(MOZ_ANDROID_SHARE_OVERLAY)
5031 dnl ========================================================
5032 dnl = Include New Tablet UI on Android
5033 dnl = Temporary build flag to allow development in Nightly
5034 dnl ========================================================
5035 if test -n "$MOZ_ANDROID_NEW_TABLET_UI"; then
5036 AC_DEFINE(MOZ_ANDROID_NEW_TABLET_UI)
5039 dnl ========================================================
5040 dnl = Enable IPDL's "expensive" unit tests
5041 dnl ========================================================
5044 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5045 [ --enable-ipdl-tests Enable expensive IPDL tests],
5049 if test -n "$MOZ_IPDL_TESTS"; then
5050 AC_DEFINE(MOZ_IPDL_TESTS)
5053 AC_SUBST(MOZ_IPDL_TESTS)
5055 dnl ========================================================
5056 dnl = Disable building dbm
5057 dnl ========================================================
5058 MOZ_ARG_DISABLE_BOOL(dbm,
5059 [ --disable-dbm Disable building dbm],
5063 dnl ========================================================
5064 dnl accessibility support on by default on all platforms
5065 dnl ========================================================
5066 MOZ_ARG_DISABLE_BOOL(accessibility,
5067 [ --disable-accessibility Disable accessibility support],
5070 if test "$ACCESSIBILITY"; then
5073 if test -z "$MIDL"; then
5074 if test "$GCC" != "yes"; then
5075 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5077 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.])
5081 AC_DEFINE(ACCESSIBILITY)
5084 dnl ========================================================
5085 dnl Accessibility is required for the linuxgl widget
5087 dnl ========================================================
5088 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5089 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5092 dnl Turn off webrtc for OS's we don't handle yet, but allow
5093 dnl --enable-webrtc to override. Can disable for everything in
5094 dnl the master list above.
5095 if test -n "$MOZ_WEBRTC"; then
5097 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
5101 dnl default to disabled for all others
5107 AC_TRY_COMPILE([#include <linux/ethtool.h>],
5108 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
5109 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
5111 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
5113 # target_arch is from {ia32|x64|arm|ppc}
5115 x86_64 | arm | x86 | ppc* | ia64)
5119 # unsupported arch for webrtc
5125 dnl ========================================================
5126 dnl = Disable WebRTC code
5127 dnl ========================================================
5128 MOZ_ARG_DISABLE_BOOL(webrtc,
5129 [ --disable-webrtc Disable support for WebRTC],
5133 if test -n "$MOZ_WEBRTC"; then
5134 AC_DEFINE(MOZ_WEBRTC)
5135 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
5136 dnl opt/production builds (via MOZ_CRASH())
5137 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
5140 MOZ_VPX_ERROR_CONCEALMENT=1
5142 dnl enable once Signaling lands
5143 MOZ_WEBRTC_SIGNALING=1
5144 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5145 dnl enable once PeerConnection lands
5146 MOZ_PEERCONNECTION=1
5147 AC_DEFINE(MOZ_PEERCONNECTION)
5152 if test -n "$MOZ_X11"; then
5153 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
5159 dnl ========================================================
5160 dnl = Force hardware AEC, disable webrtc.org AEC
5161 dnl ========================================================
5162 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
5163 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
5164 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
5165 MOZ_WEBRTC_HARDWARE_AEC_NS=)
5167 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
5168 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
5171 AC_SUBST(MOZ_WEBRTC)
5172 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5173 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5174 AC_SUBST(MOZ_PEERCONNECTION)
5175 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5176 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
5179 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
5181 dnl Use integers over floats for audio on B2G and Android
5182 dnl (regarless of the CPU architecture, because audio
5183 dnl backends for those platforms don't support floats. We also
5184 dnl use integers on ARM with other OS, because it's more efficient.
5185 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
5186 MOZ_SAMPLE_TYPE_S16=1
5187 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5188 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5190 MOZ_SAMPLE_TYPE_FLOAT32=1
5191 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5192 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5195 dnl ========================================================
5196 dnl = Disable Speech API code
5197 dnl ========================================================
5198 MOZ_ARG_DISABLE_BOOL(webspeech,
5199 [ --disable-webspeech Disable support for HTML Speech API],
5203 if test -n "$MOZ_WEBSPEECH"; then
5204 AC_DEFINE(MOZ_WEBSPEECH)
5207 AC_SUBST(MOZ_WEBSPEECH)
5209 dnl ========================================================
5210 dnl = Enable Raw Codecs
5211 dnl ========================================================
5212 MOZ_ARG_ENABLE_BOOL(raw,
5213 [ --enable-raw Enable support for RAW media],
5217 if test -n "$MOZ_RAW"; then
5223 dnl Checks for __attribute__(aligned()) directive need by libogg
5224 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5225 [ac_cv_c_attribute_aligned],
5226 [ac_cv_c_attribute_aligned=0
5227 CFLAGS_save="${CFLAGS}"
5228 CFLAGS="${CFLAGS} -Werror"
5229 for ac_cv_c_attr_align_try in 64 32 16 8; do
5230 echo "trying $ac_cv_c_attr_align_try"
5232 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5233 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5234 if test "$ac_cv_c_attribute_aligned" != 0; then
5238 CFLAGS="${CFLAGS_save}"])
5239 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5240 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5241 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5244 dnl ========================================================
5245 dnl = Disable VP8 decoder support
5246 dnl ========================================================
5247 MOZ_ARG_DISABLE_BOOL(webm,
5248 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5252 if test -n "$MOZ_WEBM"; then
5257 dnl ========================================================
5258 dnl = Apple platform decoder support
5259 dnl ========================================================
5260 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5264 if test -n "$MOZ_APPLEMEDIA"; then
5265 AC_DEFINE(MOZ_APPLEMEDIA)
5266 # hack in frameworks for fmp4 - see bug 1029974
5267 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
5268 LDFLAGS="$LDFLAGS -framework AudioToolbox"
5269 dnl Verify CoreMedia is available.
5270 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
5271 [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
5274 dnl ========================================================
5275 dnl = DirectShow support
5276 dnl ========================================================
5277 if test "$OS_ARCH" = "WINNT"; then
5278 dnl Enable DirectShow support by default.
5282 MOZ_ARG_DISABLE_BOOL(directshow,
5283 [ --disable-directshow Disable support for DirectShow],
5287 if test -n "$MOZ_DIRECTSHOW"; then
5288 AC_DEFINE(MOZ_DIRECTSHOW)
5291 dnl ========================================================
5292 dnl = Windows Media Foundation support
5293 dnl ========================================================
5294 if test "$OS_ARCH" = "WINNT"; then
5295 dnl Enable Windows Media Foundation support by default.
5296 dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5297 dnl guaranteed to have a recent-enough SDK to build WMF.
5301 MOZ_ARG_DISABLE_BOOL(wmf,
5302 [ --disable-wmf Disable support for Windows Media Foundation],
5306 if test -n "$MOZ_WMF"; then
5310 dnl ========================================================
5311 dnl FFmpeg H264/AAC Decoding Support
5312 dnl ========================================================
5313 case "$OS_TARGET" in
5314 WINNT|Darwin|Android)
5321 MOZ_ARG_DISABLE_BOOL(ffmpeg,
5322 [ --disable-ffmpeg Disable FFmpeg for fragmented H264/AAC decoding],
5327 if test -n "$MOZ_FFMPEG"; then
5328 AC_DEFINE(MOZ_FFMPEG)
5331 dnl ========================================================
5332 dnl = Built-in fragmented MP4 support.
5333 dnl ========================================================
5335 if test "$OS_TARGET" = Android -a -z "$gonkdir"; then
5339 if test -n "$MOZ_WMF" -o -n "$MOZ_FFMPEG" -o -n "$MOZ_APPLEMEDIA"; then
5340 dnl Enable fragmented MP4 parser on Windows by default.
5341 dnl We will also need to enable it on other platforms as we implement
5342 dnl platform decoder support there too.
5346 MOZ_ARG_DISABLE_BOOL(fmp4,
5347 [ --disable-fmp4 Disable support for in built Fragmented MP4 parsing],
5351 if test -n "$MOZ_FMP4"; then
5356 dnl ========================================================
5358 dnl ========================================================
5360 MOZ_ARG_DISABLE_BOOL(eme,
5361 [ --disable-eme Disable support for Encrypted Media Extensions],
5365 if test -n "$MOZ_EME"; then
5366 if test -z "$MOZ_FMP4"; then
5367 AC_MSG_ERROR([Encrypted Media Extension support requires Fragmented MP4 support])
5372 dnl ========================================================
5373 dnl = Enable media plugin support
5374 dnl ========================================================
5375 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5376 dnl Enable support on android by default
5380 MOZ_ARG_ENABLE_BOOL(android-omx,
5381 [ --enable-android-omx Enable support for Android OMX media backend],
5385 if test -n "$MOZ_ANDROID_OMX"; then
5386 AC_DEFINE(MOZ_ANDROID_OMX)
5389 dnl ========================================================
5390 dnl = Enable getUserMedia support
5391 dnl ========================================================
5392 MOZ_ARG_ENABLE_BOOL(media-navigator,
5393 [ --enable-media-navigator Enable support for getUserMedia],
5394 MOZ_MEDIA_NAVIGATOR=1,
5395 MOZ_MEDIA_NAVIGATOR=)
5397 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5398 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5401 dnl ========================================================
5402 dnl = Enable building OMX media plugin (B2G or Android)
5403 dnl ========================================================
5404 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5405 dnl Enable support on android by default
5409 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5410 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5414 if test -n "$MOZ_OMX_PLUGIN"; then
5415 if test "$OS_TARGET" = "Android"; then
5416 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5417 AC_DEFINE(MOZ_OMX_PLUGIN)
5419 dnl fail if we're not building on Gonk or Android
5420 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5424 dnl system libvpx Support
5425 dnl ========================================================
5426 MOZ_ARG_WITH_BOOL(system-libvpx,
5427 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5428 MOZ_NATIVE_LIBVPX=1)
5433 if test -n "$MOZ_VPX"; then
5435 if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
5436 AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
5439 _SAVE_CFLAGS=$CFLAGS
5441 if test -n "$MOZ_NATIVE_LIBVPX"; then
5442 dnl ============================
5443 dnl === libvpx Version check ===
5444 dnl ============================
5445 dnl Check to see if we have a system libvpx package.
5446 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.3.0)
5448 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
5449 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
5451 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5452 [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.])])
5454 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5455 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5457 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
5458 [AC_CHECK_FUNC(vpx_mem_set_functions)])
5459 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
5460 "$ac_cv_func_vpx_mem_set_functions" = no; then
5461 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
5464 CFLAGS=$_SAVE_CFLAGS
5468 AC_SUBST(MOZ_NATIVE_LIBVPX)
5469 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
5470 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
5472 if test "$MOZ_WEBM"; then
5473 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5480 if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then
5482 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5483 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5484 dnl We currently require gcc on all arm platforms.
5487 VPX_NEED_OBJ_INT_EXTRACT=
5489 dnl See if we have assembly on this platform.
5490 case "$OS_ARCH:$CPU_ARCH" in
5492 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5496 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5500 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5504 dnl Check for yasm 1.1 or greater.
5505 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5506 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.])
5507 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5508 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.])
5510 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5512 dnl The encoder needs obj_int_extract to get asm offsets.
5516 if test -n "$GNU_AS" ; then
5518 dnl These flags are a lie; they're just used to enable the requisite
5519 dnl opcodes; actual arch detection is done at runtime.
5520 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5521 VPX_DASH_C_FLAG="-c"
5522 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5523 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5528 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5529 VPX_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC"
5534 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5535 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5541 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5542 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.])
5545 if test -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5546 dnl We prefer to get asm offsets using inline assembler, which the above
5547 dnl compilers can do. When we're not using one of those, we have to fall
5548 dnl back to obj_int_extract, which reads them from a compiled object
5549 dnl file. Unfortunately, that only works if we're compiling on a system
5550 dnl with the header files for the appropriate object file format.
5551 VPX_NEED_OBJ_INT_EXTRACT=1
5554 if test -n "$VPX_X86_ASM"; then
5555 AC_DEFINE(VPX_X86_ASM)
5556 elif test -n "$VPX_ARM_ASM"; then
5557 AC_DEFINE(VPX_ARM_ASM)
5559 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5563 dnl ========================================================
5564 dnl = Disable Wave decoder support
5565 dnl ========================================================
5566 MOZ_ARG_DISABLE_BOOL(wave,
5567 [ --disable-wave Disable Wave decoder support],
5571 if test -n "$MOZ_WAVE"; then
5575 dnl ========================================================
5576 dnl = Handle dependent MEDIA defines
5577 dnl ========================================================
5579 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5580 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/])
5583 if test -n "$MOZ_VORBIS"; then
5584 AC_DEFINE(MOZ_VORBIS)
5587 if test -n "$MOZ_TREMOR"; then
5588 AC_DEFINE(MOZ_TREMOR)
5589 # Tremor doesn't have an encoder.
5593 if test -n "$MOZ_WEBM_ENCODER"; then
5594 AC_DEFINE(MOZ_WEBM_ENCODER)
5596 AC_SUBST(MOZ_WEBM_ENCODER)
5598 dnl ==================================
5599 dnl = Check alsa availability on Linux
5600 dnl ==================================
5602 dnl If using Linux, ensure that the alsa library is available
5603 if test "$OS_TARGET" = "Linux"; then
5607 MOZ_ARG_ENABLE_BOOL(alsa,
5608 [ --enable-alsa Enable Alsa support (default on Linux)],
5612 if test -n "$MOZ_ALSA"; then
5613 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5614 [echo "$MOZ_ALSA_PKG_ERRORS"
5615 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.)])])
5620 dnl ========================================================
5621 dnl = Disable PulseAudio
5622 dnl ========================================================
5624 dnl If using Linux, ensure that the PA library is available
5625 case "$OS_TARGET" in
5626 WINNT|Darwin|Android|OpenBSD)
5629 if test -z "$MOZ_B2G"; then
5635 MOZ_ARG_DISABLE_BOOL(pulseaudio,
5636 [ --disable-pulseaudio Disable PulseAudio support],
5640 if test -n "$MOZ_PULSEAUDIO"; then
5641 if test -z "$gonkdir"; then
5642 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5643 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5644 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
5646 MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
5650 AC_SUBST(MOZ_PULSEAUDIO)
5652 dnl ========================================================
5653 dnl = Enable GStreamer
5654 dnl ========================================================
5655 case "$OS_TARGET" in
5656 WINNT|Darwin|Android)
5660 GST_API_VERSION=0.10
5664 MOZ_ARG_ENABLE_STRING(gstreamer,
5665 [ --enable-gstreamer[=0.10] Enable GStreamer support],
5667 # API version, eg 0.10, 1.0 etc
5668 if test -z "$enableval" -o "$enableval" = "yes"; then
5669 GST_API_VERSION=0.10
5670 elif test "$enableval" = "no"; then
5673 GST_API_VERSION=$enableval
5677 if test -n "$MOZ_GSTREAMER"; then
5678 # core/base release number
5679 if test "$GST_API_VERSION" = "1.0"; then
5685 PKG_CHECK_MODULES(GSTREAMER,
5686 gstreamer-$GST_API_VERSION >= $GST_VERSION
5687 gstreamer-app-$GST_API_VERSION
5688 gstreamer-plugins-base-$GST_API_VERSION,
5689 [_HAVE_GSTREAMER=1],
5691 if test -z "$_HAVE_GSTREAMER"; then
5692 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])
5695 _SAVE_LDFLAGS=$LDFLAGS
5696 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5697 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5698 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5699 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5701 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.])
5703 LDFLAGS=$_SAVE_LDFLAGS
5706 AC_SUBST(MOZ_GSTREAMER)
5707 AC_SUBST(GST_API_VERSION)
5709 if test -n "$MOZ_GSTREAMER"; then
5710 AC_DEFINE(MOZ_GSTREAMER)
5711 AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION")
5715 dnl ========================================================
5716 dnl Permissions System
5717 dnl ========================================================
5718 MOZ_ARG_DISABLE_BOOL(permissions,
5719 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5724 dnl ========================================================
5725 dnl Child permissions, currently only used for b2g
5726 dnl ========================================================
5727 if test -n "$MOZ_B2G"; then
5728 if test -n "$MOZ_PERMISSIONS"; then
5729 MOZ_CHILD_PERMISSIONS=1
5731 AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
5734 AC_SUBST(MOZ_CHILD_PERMISSIONS)
5736 dnl ========================================================
5738 dnl ========================================================
5739 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5740 [ --disable-negotiateauth Disable GSS-API negotiation ],
5741 MOZ_AUTH_EXTENSION=,
5742 MOZ_AUTH_EXTENSION=1 )
5744 dnl ========================================================
5745 dnl Pref extensions (autoconfig)
5746 dnl ========================================================
5747 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5748 [ --disable-pref-extensions
5749 Disable pref extensions such as autoconfig],
5750 MOZ_PREF_EXTENSIONS=,
5751 MOZ_PREF_EXTENSIONS=1 )
5753 dnl ========================================================
5754 dnl Searching of system directories for extensions.
5755 dnl Note: this switch is meant to be used for test builds
5756 dnl whose behavior should not depend on what happens to be
5757 dnl installed on the local machine.
5758 dnl ========================================================
5759 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5760 [ --disable-system-extension-dirs
5761 Disable searching system- and account-global
5762 directories for extensions of any kind; use
5763 only profile-specific extension directories],
5764 ENABLE_SYSTEM_EXTENSION_DIRS=,
5765 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5766 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5767 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5770 dnl ========================================================
5771 dnl = Universalchardet
5772 dnl ========================================================
5773 MOZ_ARG_DISABLE_BOOL(universalchardet,
5774 [ --disable-universalchardet
5775 Disable universal encoding detection],
5776 MOZ_UNIVERSALCHARDET=,
5777 MOZ_UNIVERSALCHARDET=1 )
5779 if test -n "${JAVA_BIN_PATH}"; then
5780 dnl Look for javac and jar in the specified path.
5781 JAVA_PATH="$JAVA_BIN_PATH"
5783 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5784 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5787 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5788 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5789 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5790 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5791 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5792 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5794 if test -n "${JAVA_BIN_PATH}" -o \
5795 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5796 if test -z "$JAVA" -o "$JAVA" = ":"; then
5797 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}])
5799 if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5800 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}])
5802 if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5803 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}])
5805 if test -z "$JAR" -o "$JAR" = ":"; then
5806 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}])
5808 if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5809 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}])
5811 if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5812 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}])
5815 AC_MSG_CHECKING([for minimum required javac version >= 1.7])
5817 dnl Javac spits out something like `javac 1.7.0`. This line cuts off the 'javac'
5818 _javac_version=$($JAVAC -version 2>&1 | cut -d ' ' -f 2)
5820 dnl Here, we extract the major (1) and minor (7) version numbers from the
5821 dnl acquired version string.
5822 _javac_major_version=$(echo $_javac_version | cut -d '.' -f 1)
5823 _javac_minor_version=$(echo $_javac_version | cut -d '.' -f 2)
5825 AC_MSG_RESULT([$_javac_version])
5827 dnl Fail if we have a version other than 1.7.X
5828 if test "$_javac_major_version" -ne "1" -o \
5829 \( "$_javac_minor_version" -lt "7" \); then
5830 AC_MSG_ERROR([javac 1.7 or higher is required.])
5834 dnl ========================================================
5835 dnl = ANGLE OpenGL->D3D translator for WebGL
5836 dnl = * only applies to win32
5837 dnl ========================================================
5841 MOZ_HAS_WINSDK_WITH_D3D=
5842 MOZ_D3DCOMPILER_VISTA_DLL=
5843 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5844 MOZ_DIRECTX_SDK_PATH=
5845 MOZ_D3DCOMPILER_XP_DLL=
5846 MOZ_D3DCOMPILER_XP_CAB=
5848 case "$target_os" in
5850 MOZ_ANGLE_RENDERER=1
5854 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5855 case "${target_cpu}" in
5857 MOZ_D3D_CPU_SUFFIX=x86
5860 MOZ_D3D_CPU_SUFFIX=x64
5864 MOZ_ARG_ENABLE_BOOL(require-all-d3dc-versions,
5865 [ --enable-require-all-d3dc-versions Require all versions of the D3D compiler needed for supported Windows systems.],
5866 MOZ_REQUIRE_ALL_D3DCS=1,
5867 MOZ_REQUIRE_ALL_D3DCS=)
5869 # This is potentially set in external mozconfig files; if it's set,
5870 # then the build exposes the "webgl" context name, which is reserved
5871 # for conformant implementations.
5872 if test -n "$MOZ_WEBGL_CONFORMANT"; then
5873 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
5876 dnl ========================================================
5877 dnl D3D compiler DLL
5878 dnl ========================================================
5879 MOZ_FOUND_D3D_COMPILERS=
5881 if test -n "$MOZ_ANGLE_RENDERER"; then
5882 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
5883 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
5886 ######################################
5887 # Find _46+ for use by Vista+.
5889 # Find a D3D compiler DLL in a Windows SDK.
5890 MOZ_D3DCOMPILER_VISTA_DLL=
5891 case "$MOZ_WINSDK_MAXVER" in
5893 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
5894 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
5898 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5899 # We have a name, now track down the path.
5900 if test -n "$WINDOWSSDKDIR"; then
5901 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
5902 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5903 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5904 MOZ_HAS_WINSDK_WITH_D3D=1
5906 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5907 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
5908 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5911 AC_MSG_RESULT([Windows SDK not found.])
5915 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5916 MOZ_D3DCOMPILER_VISTA_DLL=
5919 # On mingw, check if headers are provided by toolchain.
5920 if test -n "$GNU_CC"; then
5921 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
5924 ######################################
5925 # Find _43 for use by XP.
5927 if test "$HAVE_64BIT_BUILD"; then
5928 AC_MSG_RESULT([We are building a 64-bit binary, skip checking d3dcompiler_43.])
5930 # Get the SDK path from the registry.
5931 # First try to get the June 2010 SDK
5932 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5933 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5934 # Otherwise just take whatever comes first
5935 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5937 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'`
5939 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5940 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/dxguid.lib ; then
5941 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5943 AC_MSG_RESULT([DirectX SDK not found.])
5944 MOZ_DIRECTX_SDK_PATH=
5947 # Check that our DirectX SDK is acceptable.
5948 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5949 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5950 AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
5951 MOZ_DIRECTX_SDK_PATH=
5955 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5956 # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
5957 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5958 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'`
5960 if test -n "$MOZ_D3DX9_VERSION" ; then
5961 MOZ_D3DCOMPILER_XP_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_D3D_CPU_SUFFIX}.cab | head -n1`
5963 if test -n "$MOZ_D3DCOMPILER_XP_CAB"; then
5964 MOZ_D3DCOMPILER_XP_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5966 AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
5967 AC_MSG_ERROR([DirectX SDK at "$MOZ_DIRECTX_SDK_PATH" appears broken.])
5968 MOZ_DIRECTX_SDK_PATH=
5971 AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
5972 MOZ_DIRECTX_SDK_PATH=
5975 AC_MSG_RESULT([Couldn't find an acceptable DirectX SDK for ANGLE, needed for d3dcompiler_43.])
5976 AC_MSG_RESULT([ Either ignore, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5980 ######################################
5981 # Check that we found what we needed.
5982 MOZ_FOUND_A_D3D_COMPILER=
5983 MOZ_FOUND_BOTH_D3D_COMPILERS=1
5985 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5986 MOZ_FOUND_A_D3D_COMPILER=1
5987 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
5989 MOZ_FOUND_BOTH_D3D_COMPILERS=
5992 if test -n "$MOZ_D3DCOMPILER_XP_DLL"; then
5993 MOZ_FOUND_A_D3D_COMPILER=1
5994 AC_MSG_RESULT([Found d3dcompiler DLL for XP: $MOZ_D3DCOMPILER_XP_DLL])
5996 MOZ_FOUND_BOTH_D3D_COMPILERS=
5999 if test -z "$CROSS_COMPILE"; then
6000 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
6001 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
6002 AC_MSG_ERROR([ Either install Windows SDK 8.0+, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
6005 if test -n "$MOZ_REQUIRE_ALL_D3DCS" -a -z "$MOZ_FOUND_BOTH_D3D_COMPILERS"; then
6006 AC_MSG_ERROR([Both D3D compilers _43 and _46+ are required by --enable-require-d3d-compilers.])
6007 AC_MSG_ERROR([ Install Windows SDK 8.0+, as well as DirectX SDK (June 2010 version or newer), or reconfigure without this flag.])
6013 dnl ========================================================
6015 dnl ========================================================
6017 MOZ_GAMEPAD_BACKEND=stub
6019 # Gamepad DOM is built on supported platforms by default.
6020 case "$OS_TARGET" in
6025 if test "$MOZ_WIDGET_TOOLKIT" != "gonk"; then
6033 MOZ_ARG_DISABLE_BOOL(gamepad,
6034 [ --disable-gamepad Disable gamepad support],
6038 if test "$MOZ_GAMEPAD"; then
6039 case "$OS_TARGET" in
6041 MOZ_GAMEPAD_BACKEND=cocoa
6044 MOZ_GAMEPAD_BACKEND=windows
6047 MOZ_CHECK_HEADER([linux/joystick.h])
6048 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
6049 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.])
6051 MOZ_GAMEPAD_BACKEND=linux
6054 MOZ_GAMEPAD_BACKEND=android
6060 AC_DEFINE(MOZ_GAMEPAD)
6062 AC_SUBST(MOZ_GAMEPAD)
6063 AC_SUBST(MOZ_GAMEPAD_BACKEND)
6065 dnl ========================================================
6066 dnl = Breakpad crash reporting (on by default on supported platforms)
6067 dnl ========================================================
6070 i?86-*-mingw*|x86_64-*-mingw*)
6073 i?86-apple-darwin*|x86_64-apple-darwin*)
6076 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6077 if test "$MOZ_ENABLE_GTK"; then
6081 *-android*|*-linuxandroid*)
6089 MOZ_ARG_DISABLE_BOOL(crashreporter,
6090 [ --disable-crashreporter Disable breakpad crash reporting],
6091 [MOZ_CRASHREPORTER=],
6092 [MOZ_CRASHREPORTER=F # Force enable breakpad])
6094 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
6095 if test "$MOZ_CRASHREPORTER" = F; then
6096 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
6101 if test -n "$MOZ_CRASHREPORTER"; then
6102 AC_DEFINE(MOZ_CRASHREPORTER)
6104 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
6105 test -z "$SKIP_LIBRARY_CHECKS"; then
6106 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6109 if test "$OS_ARCH" = "WINNT"; then
6110 if test -z "$HAVE_64BIT_BUILD"; then
6111 MOZ_CRASHREPORTER_INJECTOR=1
6112 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
6117 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6118 [ --with-crashreporter-enable-percent=NN
6119 Enable sending crash reports by default on NN% of users. (default=100)],
6120 [ val=`echo $withval | sed 's/[^0-9]//g'`
6121 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6123 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6124 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6126 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6128 dnl ========================================================
6129 dnl = libjpeg-turbo configuration
6130 dnl ========================================================
6132 if test -z "$MOZ_NATIVE_JPEG"; then
6136 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6137 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
6139 MOZ_LIBJPEG_TURBO=1)
6141 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6142 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6145 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6148 if test -n "$MOZ_LIBJPEG_TURBO"; then
6150 dnl Do we support libjpeg-turbo on this platform?
6151 case "$OS_ARCH:$OS_TEST" in
6153 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6154 LIBJPEG_TURBO_X86_ASM=1
6157 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6158 LIBJPEG_TURBO_X64_ASM=1
6160 WINNT:x86|WINNT:i?86)
6161 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6162 LIBJPEG_TURBO_X86_ASM=1
6165 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6166 LIBJPEG_TURBO_X64_ASM=1
6169 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6170 LIBJPEG_TURBO_ARM_ASM=1
6173 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6174 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6175 LIBJPEG_TURBO_X86_ASM=1
6179 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6180 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6181 LIBJPEG_TURBO_X64_ASM=1
6188 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6189 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6190 dnl it doesn't exist or we have too old of a version.
6191 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6192 LIBJPEG_TURBO_AS=$YASM
6194 if test -z "$LIBJPEG_TURBO_AS" ; then
6195 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.])
6198 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6199 dnl on Linux and 1.1 or newer everywhere else.
6200 if test "$OS_ARCH" = "Linux" ; then
6201 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
6202 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.])
6205 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6206 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.])
6211 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6212 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6213 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6214 echo "Using $AS as the assembler for ARM code."
6215 LIBJPEG_TURBO_AS=$AS
6218 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6219 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6220 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6221 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6222 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6223 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6224 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6225 dnl Warn if we're not building the optimized routines, even though the user
6226 dnl didn't specify --disable-libjpeg-turbo.
6227 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6230 dnl ========================================================
6231 dnl = Enable compilation of specific extension modules
6232 dnl ========================================================
6234 MOZ_ARG_ENABLE_STRING(extensions,
6235 [ --enable-extensions Enable extensions],
6236 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6237 if test "$option" = "yes" -o "$option" = "all"; then
6238 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6239 elif test "$option" = "no" -o "$option" = "none"; then
6241 elif test "$option" = "default"; then
6242 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6243 elif test `echo "$option" | grep -c \^-` != 0; then
6244 option=`echo $option | sed 's/^-//'`
6245 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6247 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6250 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6252 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6253 # Suppress warning on non-X11 platforms
6254 if test -n "$MOZ_X11"; then
6255 AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6257 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6260 dnl Do not build gnomevfs with libxul based apps
6261 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6262 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6265 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6266 # Suppress warning on non-X11 platforms
6267 if test -n "$MOZ_X11"; then
6268 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6270 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6273 dnl Do not build gio with libxul based apps
6274 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6275 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6278 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6280 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6282 AC_SUBST(MOZ_GIO_COMPONENT)
6285 MOZ_EXTENSIONS=`$PYTHON ${srcdir}/build/unix/uniq.py ${MOZ_EXTENSIONS}`
6287 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6288 dnl when trying to build a nonexistent extension.
6289 for extension in $MOZ_EXTENSIONS; do
6290 if test ! -d "${srcdir}/extensions/${extension}"; then
6291 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6295 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6296 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6299 dnl ========================================================
6300 dnl Build Freetype in the tree
6301 dnl ========================================================
6302 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6303 [ --enable-tree-freetype Enable Tree FreeType],
6304 MOZ_TREE_FREETYPE=1,
6305 MOZ_TREE_FREETYPE= )
6306 if test -n "$MOZ_TREE_FREETYPE"; then
6307 if test -n "$_WIN32_MSVC"; then
6308 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6310 AC_DEFINE(MOZ_TREE_FREETYPE)
6311 AC_SUBST(MOZ_TREE_FREETYPE)
6312 MOZ_ENABLE_CAIRO_FT=1
6313 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6314 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6315 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6317 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6318 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6319 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6320 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
6323 dnl ========================================================
6325 dnl ========================================================
6326 dnl Abort Windows build if the required major version and
6327 dnl minimum minor version of Unicode NSIS isn't in the path
6328 dnl (unless in case of cross compiling, for which Unicode
6329 dnl is not yet sufficient).
6330 if test "$OS_ARCH" = "WINNT"; then
6331 MIN_NSIS_MAJOR_VER=2
6332 MIN_NSIS_MINOR_VER=46
6333 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-3.0a2.exe makensisu-2.46.exe makensis)
6334 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6335 AC_MSG_RESULT([yes])
6336 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null`
6338 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6340 if test "$MAKENSISU_PARSED_VER" = ""; then
6342 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
6345 MAKENSISU_MAJOR_VER=0
6346 MAKENSISU_MINOR_VER=0
6347 if test ! "$MAKENSISU_PARSED_VER" = ""; then
6348 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'`
6349 MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'`
6351 AC_MSG_CHECKING([for Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater])
6352 if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \
6353 "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER ||
6354 test "$MAKENSISU_MAJOR_VER" -gt $MIN_NSIS_MAJOR_VER; then
6355 AC_MSG_RESULT([yes])
6358 if test -z "$CROSS_COMPILE"; then
6359 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.])
6364 elif test -z "$CROSS_COMPILE"; then
6365 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.])
6371 dnl ========================================================
6373 dnl ========================================================
6374 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6375 [ --disable-webapp-runtime Disable Web App Runtime],
6376 MOZ_WEBAPP_RUNTIME=,
6377 MOZ_WEBAPP_RUNTIME=1)
6378 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a -z "$MOZ_WIDGET_GTK" ; then
6381 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6384 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6385 if test "$MOZ_WEBAPP_RUNTIME"; then
6386 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6389 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6390 if test -z "$TAR"; then
6391 AC_MSG_ERROR([no tar archiver found in \$PATH])
6395 AC_CHECK_PROGS(WGET, wget, "")
6398 dnl ========================================================
6400 dnl ========================================================
6402 if test -n "$MOZ_SIGN_CMD"; then
6403 AC_DEFINE(MOZ_SIGNING)
6406 dnl ========================================================
6407 dnl Maintenance Service
6408 dnl ========================================================
6410 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6411 [ --enable-maintenance-service Enable building of maintenanceservice],
6412 MOZ_MAINTENANCE_SERVICE=1,
6413 MOZ_MAINTENANCE_SERVICE= )
6415 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6416 if test "$OS_ARCH" = "WINNT"; then
6417 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6419 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6423 dnl ========================================================
6424 dnl Bundled fonts on desktop platforms
6425 dnl ========================================================
6427 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
6428 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
6429 MOZ_BUNDLED_FONTS=1,
6432 if test -n "$MOZ_BUNDLED_FONTS"; then
6433 AC_DEFINE(MOZ_BUNDLED_FONTS)
6436 dnl ========================================================
6437 dnl Verify MAR signatures
6438 dnl ========================================================
6440 MOZ_ARG_ENABLE_BOOL(verify-mar,
6441 [ --enable-verify-mar Enable verifying MAR signatures],
6442 MOZ_VERIFY_MAR_SIGNATURE=1,
6443 MOZ_VERIFY_MAR_SIGNATURE= )
6445 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6446 if test "$OS_ARCH" = "WINNT"; then
6447 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6449 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6453 dnl ========================================================
6454 dnl Enable building the signmar program.
6455 dnl This option is much different than the --enable-verify-mar option.
6456 dnl --enable-verify-mar is for enabling the verification check on MAR
6457 dnl files in the updater. The --enable-signmar option is for building
6458 dnl the signmar program.
6459 dnl ========================================================
6461 MOZ_ARG_ENABLE_BOOL(signmar,
6462 [ --enable-signmar Enable building the signmar program],
6463 MOZ_ENABLE_SIGNMAR=1,
6464 MOZ_ENABLE_SIGNMAR= )
6466 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6467 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6470 dnl ========================================================
6472 dnl ========================================================
6474 MOZ_ARG_DISABLE_BOOL(updater,
6475 [ --disable-updater Disable building of updater],
6479 if test -n "$MOZ_UPDATER"; then
6480 AC_DEFINE(MOZ_UPDATER)
6483 # tools/update-packaging is not checked out by default.
6484 MOZ_ARG_ENABLE_BOOL(update-packaging,
6485 [ --enable-update-packaging
6486 Enable tools/update-packaging],
6487 MOZ_UPDATE_PACKAGING=1,
6488 MOZ_UPDATE_PACKAGING= )
6489 AC_SUBST(MOZ_UPDATE_PACKAGING)
6491 dnl ========================================================
6492 dnl build the tests by default
6493 dnl ========================================================
6494 MOZ_ARG_DISABLE_BOOL(tests,
6495 [ --disable-tests Do not build test libraries & programs],
6499 if test -n "$ENABLE_TESTS"; then
6501 AC_DEFINE(ENABLE_TESTS)
6502 AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6503 AC_SUBST(GTEST_HAS_RTTI)
6504 if test -n "$_WIN32_MSVC"; then
6505 AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6507 if test "${OS_TARGET}" = "Android"; then
6508 AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6509 AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6510 AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6511 AC_SUBST(GTEST_OS_LINUX_ANDROID)
6512 AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6513 AC_SUBST(GTEST_HAS_CLONE)
6517 dnl ========================================================
6518 dnl parental controls (for Windows Vista)
6519 dnl ========================================================
6520 MOZ_ARG_DISABLE_BOOL(parental-controls,
6521 [ --disable-parental-controls
6522 Do not build parental controls],
6523 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6524 MOZ_DISABLE_PARENTAL_CONTROLS=)
6525 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6526 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6529 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6531 dnl ========================================================
6532 dnl = Disable smartcard support
6533 dnl ========================================================
6534 if test -n "$MOZ_NO_SMART_CARDS"; then
6535 AC_DEFINE(MOZ_NO_SMART_CARDS)
6537 AC_SUBST(MOZ_NO_SMART_CARDS)
6539 dnl ========================================================
6540 dnl = Disable EV certificate verification
6541 dnl ========================================================
6542 if test -n "$MOZ_NO_EV_CERTS"; then
6543 AC_DEFINE(MOZ_NO_EV_CERTS)
6545 AC_SUBST(MOZ_NO_EV_CERTS)
6547 dnl ========================================================
6548 dnl = Disable libpkix
6549 dnl ========================================================
6550 if test -n "$NSS_NO_LIBPKIX"; then
6551 AC_DEFINE(NSS_NO_LIBPKIX)
6553 AC_SUBST(NSS_NO_LIBPKIX)
6555 dnl ========================================================
6556 dnl = Sandboxing support
6557 dnl ========================================================
6558 MOZ_ARG_DISABLE_BOOL(sandbox,
6559 [ --disable-sandbox Disable sandboxing support],
6563 dnl ========================================================
6564 dnl = Content process sandboxing
6565 dnl ========================================================
6566 if test -n "$gonkdir"; then
6567 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6570 case "$OS_TARGET:$NIGHTLY_BUILD" in
6572 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6575 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6579 MOZ_ARG_ENABLE_BOOL(content-sandbox,
6580 [ --enable-content-sandbox Enable sandboxing support for content-processes
6581 --disable-content-sandbox Disable sandboxing support for content-processes],
6582 MOZ_CONTENT_SANDBOX=1,
6583 MOZ_CONTENT_SANDBOX=)
6585 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
6586 AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
6589 if test -n "$MOZ_CONTENT_SANDBOX"; then
6590 AC_DEFINE(MOZ_CONTENT_SANDBOX)
6593 AC_SUBST(MOZ_CONTENT_SANDBOX)
6595 dnl ========================================================
6596 dnl = Gecko Media Plugin sandboxing
6597 dnl ========================================================
6600 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6605 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6610 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6614 if test -n "$MOZ_GMP_SANDBOX"; then
6615 AC_DEFINE(MOZ_GMP_SANDBOX)
6618 AC_SUBST(MOZ_GMP_SANDBOX)
6620 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
6624 if test -n "$MOZ_SANDBOX"; then
6625 AC_DEFINE(MOZ_SANDBOX)
6628 AC_SUBST(MOZ_SANDBOX)
6631 dnl ========================================================
6633 dnl = Module specific options
6635 dnl ========================================================
6636 MOZ_ARG_HEADER(Individual module options)
6638 dnl ========================================================
6639 dnl = Disable feed handling components
6640 dnl ========================================================
6641 MOZ_ARG_DISABLE_BOOL(feeds,
6642 [ --disable-feeds Disable feed handling and processing components],
6645 if test -n "$MOZ_FEEDS"; then
6646 AC_DEFINE(MOZ_FEEDS)
6648 if test "$MOZ_BUILD_APP" = "browser"; then
6649 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6653 dnl ========================================================
6654 dnl Check for sqlite
6655 dnl ========================================================
6658 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6659 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6660 MOZ_NATIVE_SQLITE=1,
6661 MOZ_NATIVE_SQLITE= )
6663 if test -n "$MOZ_NATIVE_SQLITE"
6665 dnl ============================
6666 dnl === SQLite Version check ===
6667 dnl ============================
6668 dnl Check to see if the system SQLite package is new enough.
6669 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6671 dnl ==================================
6672 dnl === SQLITE_SECURE_DELETE check ===
6673 dnl ==================================
6674 dnl Check to see if the system SQLite package is compiled with
6675 dnl SQLITE_SECURE_DELETE enabled.
6676 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6677 _SAVE_CFLAGS="$CFLAGS"
6678 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6680 LIBS="$LIBS $SQLITE_LIBS"
6681 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6683 #include "sqlite3.h"
6685 int main(int argc, char **argv){
6686 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6688 ac_cv_sqlite_secure_delete=yes,
6689 ac_cv_sqlite_secure_delete=no,
6690 ac_cv_sqlite_secure_delete=no
6693 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6694 CFLAGS="$_SAVE_CFLAGS"
6696 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6697 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6700 dnl ===============================
6701 dnl === SQLITE_THREADSAFE check ===
6702 dnl ===============================
6703 dnl Check to see if the system SQLite package is compiled with
6704 dnl SQLITE_THREADSAFE enabled.
6705 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6706 _SAVE_CFLAGS="$CFLAGS"
6707 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6709 LIBS="$LIBS $SQLITE_LIBS"
6710 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6712 #include "sqlite3.h"
6714 int main(int argc, char **argv){
6715 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6717 ac_cv_sqlite_threadsafe=yes,
6718 ac_cv_sqlite_threadsafe=no,
6719 ac_cv_sqlite_threadsafe=no
6722 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6723 CFLAGS="$_SAVE_CFLAGS"
6725 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6726 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6729 dnl ================================
6730 dnl === SQLITE_ENABLE_FTS3 check ===
6731 dnl ================================
6732 dnl check to see if the system SQLite package is compiled with
6733 dnl SQLITE_ENABLE_FTS3 enabled.
6734 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6735 _SAVE_CFLAGS="$CFLAGS"
6736 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6738 LIBS="$LIBS $SQLITE_LIBS"
6739 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6741 #include "sqlite3.h"
6743 int main(int argc, char **argv){
6744 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6746 ac_cv_sqlite_enable_fts3=yes,
6747 ac_cv_sqlite_enable_fts3=no,
6748 ac_cv_sqlite_enable_fts3=no
6751 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6752 CFLAGS="$_SAVE_CFLAGS"
6754 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6755 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6758 dnl =========================================
6759 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6760 dnl =========================================
6761 dnl check to see if the system SQLite package is compiled with
6762 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6763 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6764 _SAVE_CFLAGS="$CFLAGS"
6765 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6767 LIBS="$LIBS $SQLITE_LIBS"
6768 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6770 #include "sqlite3.h"
6772 int main(int argc, char **argv){
6773 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6775 ac_cv_sqlite_enable_unlock_notify=yes,
6776 ac_cv_sqlite_enable_unlock_notify=no,
6777 ac_cv_sqlite_enable_unlock_notify=no
6780 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6781 CFLAGS="$_SAVE_CFLAGS"
6783 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6784 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6788 if test -n "$MOZ_NATIVE_SQLITE"; then
6789 AC_DEFINE(MOZ_NATIVE_SQLITE)
6791 AC_SUBST(MOZ_NATIVE_SQLITE)
6793 dnl ========================================================
6794 dnl = Enable help viewer (off by default)
6795 dnl ========================================================
6796 if test -n "$MOZ_HELP_VIEWER"; then
6797 dnl Do this if defined in confvars.sh
6798 AC_DEFINE(MOZ_HELP_VIEWER)
6801 dnl ========================================================
6802 dnl = Enable safe browsing (anti-phishing)
6803 dnl ========================================================
6804 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6805 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6806 MOZ_SAFE_BROWSING=1,
6807 MOZ_SAFE_BROWSING= )
6808 if test -n "$MOZ_SAFE_BROWSING"; then
6809 AC_DEFINE(MOZ_SAFE_BROWSING)
6811 AC_SUBST(MOZ_SAFE_BROWSING)
6813 dnl ========================================================
6814 dnl = Enable url-classifier
6815 dnl ========================================================
6816 dnl Implicitly enabled by default if building with safe-browsing
6817 if test -n "$MOZ_SAFE_BROWSING"; then
6818 MOZ_URL_CLASSIFIER=1
6820 MOZ_ARG_ENABLE_BOOL(url-classifier,
6821 [ --enable-url-classifier Enable url classifier module],
6822 MOZ_URL_CLASSIFIER=1,
6823 MOZ_URL_CLASSIFIER= )
6824 if test -n "$MOZ_URL_CLASSIFIER"; then
6825 AC_DEFINE(MOZ_URL_CLASSIFIER)
6827 AC_SUBST(MOZ_URL_CLASSIFIER)
6829 dnl ========================================================
6830 dnl = Disable zipwriter
6831 dnl ========================================================
6832 MOZ_ARG_DISABLE_BOOL(zipwriter,
6833 [ --disable-zipwriter Disable zipwriter component],
6836 AC_SUBST(MOZ_ZIPWRITER)
6838 dnl ========================================================
6840 dnl ========================================================
6842 MOZ_ARG_WITH_STRING(gl-provider,
6843 [ --with-gl-provider=ID
6844 Set GL provider backend type],
6845 [ val=`echo $withval`
6846 MOZ_GL_PROVIDER="$val"])
6848 if test -n "$MOZ_GL_PROVIDER"; then
6849 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6850 AC_SUBST(MOZ_GL_PROVIDER)
6851 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6853 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6854 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6856 dnl ========================================================
6857 dnl = faststripe theme
6858 dnl ========================================================
6859 MOZ_ARG_ENABLE_BOOL(faststripe,
6860 [ --enable-faststripe Use faststripe theme],
6861 MOZ_THEME_FASTSTRIPE=1,
6862 MOZ_THEME_FASTSTRIPE= )
6863 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6865 dnl ========================================================
6867 dnl = Feature options that require extra sources to be pulled
6869 dnl ========================================================
6870 dnl MOZ_ARG_HEADER(Features that require extra sources)
6872 dnl ========================================================
6874 dnl = Runtime debugging and Optimization Options
6876 dnl ========================================================
6877 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
6879 dnl ========================================================
6880 dnl enable mobile optimizations
6881 dnl ========================================================
6882 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6883 [ --enable-mobile-optimize
6884 Enable mobile optimizations],
6885 MOZ_GFX_OPTIMIZE_MOBILE=1)
6887 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6889 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6890 # We ignore paint will resample on mobile for performance.
6891 # We may want to revisit this later.
6892 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
6894 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6895 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
6898 dnl ========================================================
6899 dnl = Enable code optimization. ON by default.
6900 dnl ========================================================
6901 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6902 MOZ_OPTIMIZE_FLAGS="-O"
6905 MOZ_ARG_ENABLE_STRING(optimize,
6906 [ --disable-optimize Disable compiler optimization
6907 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6908 [ if test "$enableval" != "no"; then
6910 if test -n "$enableval" -a "$enableval" != "yes"; then
6911 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6916 fi ], MOZ_OPTIMIZE=1)
6918 MOZ_SET_FRAMEPTR_FLAGS
6920 if test "$COMPILE_ENVIRONMENT"; then
6921 if test -n "$MOZ_OPTIMIZE"; then
6922 AC_MSG_CHECKING([for valid optimization flags])
6923 _SAVE_CFLAGS=$CFLAGS
6924 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6925 AC_TRY_COMPILE([#include <stdio.h>],
6926 [printf("Hello World\n");],
6929 AC_MSG_RESULT([$_results])
6930 if test "$_results" = "no"; then
6931 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6933 CFLAGS=$_SAVE_CFLAGS
6935 fi # COMPILE_ENVIRONMENT
6937 AC_SUBST(MOZ_OPTIMIZE)
6938 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6939 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6940 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6941 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6942 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6944 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6946 dnl ========================================================
6947 dnl = Enable NS_StackWalk.
6948 dnl ========================================================
6950 # On Windows, NS_StackWalk will only work correctly if we have frame pointers
6951 # available. That will only be true for non-optimized builds, debug builds or
6952 # builds with --enable-profiling in the .mozconfig (which is turned on in
6953 # Nightly by default.)
6954 case "$OS_TARGET" in
6956 if test -z "$MOZ_OPTIMIZE" -o -n "$MOZ_PROFILING" -o -n "$MOZ_DEBUG"; then
6967 if test -n "$MOZ_STACKWALKING"; then
6968 AC_DEFINE(MOZ_STACKWALKING)
6971 AC_SUBST(MOZ_STACKWALKING)
6973 dnl ========================================================
6974 dnl = Disable treating compiler warnings as errors
6975 dnl ========================================================
6976 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6977 WARNINGS_AS_ERRORS=''
6978 elif test "$GNU_CC"; then
6979 # Prevent the following GCC warnings from being treated as errors:
6980 # -Wuninitialized - too many false positives
6981 # -Wmaybe-uninitialized - too many false positives
6982 # -Wdeprecated-declarations - we don't want our builds held hostage when a
6983 # platform-specific API becomes deprecated.
6984 MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
6985 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
6986 MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
6987 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
6988 MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
6989 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
6991 if test -n "$MOZ_PGO"; then
6992 MOZ_C_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_c_has_noerror_coverage_mismatch)
6993 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_cxx_has_noerror_coverage_mismatch)
6997 dnl ========================================================
6998 dnl = Disable runtime logging checks
6999 dnl ========================================================
7000 MOZ_ARG_DISABLE_BOOL(logging,
7001 [ --disable-logging Disable logging facilities],
7002 NS_DISABLE_LOGGING=1,
7003 NS_DISABLE_LOGGING= )
7004 if test "$NS_DISABLE_LOGGING"; then
7005 AC_DEFINE(NS_DISABLE_LOGGING)
7007 AC_DEFINE(MOZ_LOGGING)
7008 AC_DEFINE(FORCE_PR_LOG)
7011 dnl ========================================================
7012 dnl = This will enable logging of addref, release, ctor, dtor.
7013 dnl ========================================================
7014 _ENABLE_LOGREFCNT=42
7015 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7016 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
7017 _ENABLE_LOGREFCNT=1,
7018 _ENABLE_LOGREFCNT= )
7019 if test "$_ENABLE_LOGREFCNT" = "1"; then
7020 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7021 elif test -z "$_ENABLE_LOGREFCNT"; then
7022 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7025 dnl ========================================================
7026 dnl moz_aproximate_location
7027 dnl ========================================================
7028 MOZ_ARG_ENABLE_BOOL(approximate_location,
7029 [ --enable-approximate-location Enable approximate location ],
7030 MOZ_APPROX_LOCATION=1,
7031 MOZ_APPROX_LOCATION= )
7032 if test -n "$MOZ_APPROX_LOCATION"; then
7033 AC_DEFINE(MOZ_APPROX_LOCATION)
7036 dnl ========================================================
7038 dnl ========================================================
7039 MOZ_ARG_ENABLE_BOOL(gps_debug,
7040 [ --enable-gps-debug Enable gps specific debug messages ],
7043 if test -n "$MOZ_GPS_DEBUG"; then
7044 AC_DEFINE(MOZ_GPS_DEBUG)
7046 if test -n "$MOZ_DEBUG"; then
7047 AC_DEFINE(MOZ_GPS_DEBUG)
7050 dnl ========================================================
7051 dnl moz_dump_painting
7052 dnl ========================================================
7053 MOZ_ARG_ENABLE_BOOL(dump-painting,
7054 [ --enable-dump-painting Enable paint debugging.],
7055 MOZ_DUMP_PAINTING=1,
7056 MOZ_DUMP_PAINTING= )
7057 if test -n "$MOZ_DUMP_PAINTING"; then
7058 AC_DEFINE(MOZ_DUMP_PAINTING)
7059 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
7061 if test -n "$MOZ_DEBUG"; then
7062 AC_DEFINE(MOZ_DUMP_PAINTING)
7065 dnl ========================================================
7067 dnl ========================================================
7069 MOZ_ARG_ENABLE_BOOL(dmd,
7070 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
7074 if test "$MOZ_DMD"; then
7077 if test "${CPU_ARCH}" = "arm"; then
7078 CFLAGS="$CFLAGS -funwind-tables"
7079 CXXFLAGS="$CXXFLAGS -funwind-tables"
7082 MOZ_MEMORY=1 # DMD enables jemalloc
7083 MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
7087 dnl ========================================================
7088 dnl = Enable jemalloc
7089 dnl ========================================================
7090 MOZ_ARG_ENABLE_BOOL(jemalloc,
7091 [ --enable-jemalloc Replace memory allocator with jemalloc],
7095 case "${OS_TARGET}" in
7096 Android|WINNT|Darwin)
7097 MOZ_GLUE_IN_PROGRAM=
7100 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
7101 MOZ_GLUE_IN_PROGRAM=1
7105 dnl ========================================================
7106 dnl = Enable dynamic replacement of malloc implementation
7107 dnl ========================================================
7108 if test -n "$NIGHTLY_BUILD" -a -n "$MOZ_MEMORY"; then
7109 # Enable on central for the debugging opportunities it adds.
7110 MOZ_REPLACE_MALLOC=1
7112 MOZ_ARG_ENABLE_BOOL(replace-malloc,
7113 [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
7114 MOZ_REPLACE_MALLOC=1,
7115 MOZ_REPLACE_MALLOC= )
7117 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
7118 dnl We don't want to enable jemalloc unconditionally because it may be a
7119 dnl deliberate choice not to enable it (bug 702250, for instance)
7120 AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
7121 elif test -n "$MOZ_REPLACE_MALLOC"; then
7122 AC_DEFINE(MOZ_REPLACE_MALLOC)
7123 MOZ_NATIVE_JEMALLOC=
7125 dnl Replace-malloc Mac linkage quirks
7126 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
7127 AC_CACHE_CHECK([how to do weak dynamic linking],
7128 ac_cv_weak_dynamic_linking,
7129 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
7130 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
7131 test -s conftest${DLL_SUFFIX}; then
7132 dnl There are several ways the linker can put link edit rules in a binary:
7133 dnl - classic info only (for OSX < 10.6)
7134 dnl - dyld info only
7136 if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
7141 if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
7146 dnl With classic info, we need to build with -flat_namespace.
7147 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
7148 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
7149 dnl forgets to set the weak flag in the dyld info.
7150 dnl See http://glandium.org/blog/?p=2764 for more details.
7152 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
7153 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
7154 dnl - "flat namespace" when -flat_namespace alone is needed
7155 dnl - "dummy library" when a dummy library and -flat_namespace are needed
7156 dnl - "compiler support" when nothing is needed
7157 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
7158 if test -n "$_CLASSIC_INFO"; then
7159 ac_cv_weak_dynamic_linking="flat namespace"
7161 ac_cv_weak_dynamic_linking="compiler support"
7164 if test -n "$_DYLD_INFO"; then
7165 ac_cv_weak_dynamic_linking="dummy library"
7167 ac_cv_weak_dynamic_linking="flat namespace"
7171 AC_ERROR([couldn't compile a simple C file])
7174 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
7177 AC_SUBST(MOZ_REPLACE_MALLOC)
7178 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
7180 dnl ========================================================
7181 dnl = Jemalloc build setup
7182 dnl ========================================================
7183 if test -z "$MOZ_MEMORY"; then
7184 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
7185 MOZ_NATIVE_JEMALLOC=1
7186 AC_CHECK_FUNCS(mallctl nallocx,,
7187 [MOZ_NATIVE_JEMALLOC=
7189 if test -n "$MOZ_NATIVE_JEMALLOC"; then
7191 AC_DEFINE(MOZ_MEMORY)
7192 AC_DEFINE(MOZ_JEMALLOC3)
7193 AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7198 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7199 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.])
7204 AC_DEFINE(MOZ_MEMORY)
7205 if test -n "$MOZ_JEMALLOC3"; then
7206 AC_DEFINE(MOZ_JEMALLOC3)
7208 if test "x$MOZ_DEBUG" = "x1"; then
7209 AC_DEFINE(MOZ_MEMORY_DEBUG)
7211 dnl The generic feature tests that determine how to compute ncpus are long and
7212 dnl complicated. Therefore, simply define special cpp variables for the
7213 dnl platforms we have special knowledge of.
7216 AC_DEFINE(MOZ_MEMORY_DARWIN)
7219 AC_DEFINE(MOZ_MEMORY_BSD)
7221 *-android*|*-linuxandroid*)
7222 AC_DEFINE(MOZ_MEMORY_LINUX)
7223 AC_DEFINE(MOZ_MEMORY_ANDROID)
7224 if test -n "$gonkdir"; then
7225 AC_DEFINE(MOZ_MEMORY_GONK)
7229 AC_DEFINE(MOZ_MEMORY_LINUX)
7232 AC_DEFINE(MOZ_MEMORY_BSD)
7235 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7238 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7239 export MOZ_NO_DEBUG_RTL=1
7240 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7241 dnl Look for a broken crtdll.obj
7242 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7243 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7244 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7250 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7254 AC_SUBST(MOZ_MEMORY)
7255 AC_SUBST(MOZ_JEMALLOC3)
7256 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7259 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
7260 AC_SUBST_LIST(WIN32_CRT_LIBS)
7262 dnl We need to wrap dlopen and related functions on Android because we use
7264 if test "$OS_TARGET" = Android; then
7265 MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7266 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
7267 MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=pthread_create,--wrap=epoll_wait,--wrap=poll,--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"
7269 if test "$MOZ_WIDGET_TOOLKIT" = android; then
7270 MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7274 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
7275 export MOZ_GLUE_WRAP_LDFLAGS
7277 dnl ========================================================
7278 dnl JS opt-mode assertions and minidump instrumentation
7279 dnl ========================================================
7280 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7281 [ --enable-js-diagnostics
7282 Enable JS diagnostic assertions and breakpad data],
7283 JS_CRASH_DIAGNOSTICS=1,
7284 JS_CRASH_DIAGNOSTICS= )
7285 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7286 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7289 dnl ========================================================
7290 dnl = Enable static checking using gcc-dehydra
7291 dnl ========================================================
7293 MOZ_ARG_WITH_STRING(static-checking,
7294 [ --with-static-checking=path/to/gcc_dehydra.so
7295 Enable static checking of code using GCC-dehydra],
7296 DEHYDRA_PATH=$withval,
7299 if test -n "$DEHYDRA_PATH"; then
7300 if test ! -f "$DEHYDRA_PATH"; then
7301 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7303 AC_DEFINE(NS_STATIC_CHECKING)
7305 AC_SUBST(DEHYDRA_PATH)
7307 dnl ========================================================
7308 dnl = Enable using the clang plugin to build
7309 dnl ========================================================
7311 MOZ_CONFIG_CLANG_PLUGIN
7313 dnl ========================================================
7314 dnl = Enable stripping of libs & executables
7315 dnl ========================================================
7316 MOZ_ARG_ENABLE_BOOL(strip,
7317 [ --enable-strip Enable stripping of libs & executables ],
7321 dnl ========================================================
7322 dnl = Enable stripping of libs & executables when packaging
7323 dnl ========================================================
7324 MOZ_ARG_ENABLE_BOOL(install-strip,
7325 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7329 dnl ========================================================
7330 dnl = --disable-elf-hack
7331 dnl ========================================================
7334 MOZ_ARG_DISABLE_BOOL(elf-hack,
7335 [ --disable-elf-hack Disable elf hacks],
7339 # Only enable elfhack where supported
7340 if test "$USE_ELF_HACK" = 1; then
7341 case "${HOST_OS_ARCH},${OS_ARCH}" in
7343 case "${CPU_ARCH}" in
7358 if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
7359 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7360 dnl memory addresses it maps to. The result is that by the time elfhack
7361 dnl kicks in, it is not possible to apply relocations because of that,
7362 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7363 dnl segment. It makes elfhack mostly useless, so considering the problems
7364 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7365 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7366 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
7367 dnl elfhack enabled, disable PT_GNU_RELRO instead.
7368 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7369 LINK_WITH_PT_GNU_RELRO,
7370 [echo "int main() {return 0;}" > conftest.${ac_ext}
7371 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7372 test -s conftest${ac_exeext}; then
7373 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7374 LINK_WITH_PT_GNU_RELRO=yes
7376 LINK_WITH_PT_GNU_RELRO=no
7379 dnl We really don't expect to get here, but just in case
7380 AC_ERROR([couldn't compile a simple C file])
7383 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7384 if test "$USE_ELF_HACK" = F; then
7385 AC_MSG_CHECKING([for -z norelro option to ld])
7386 _SAVE_LDFLAGS=$LDFLAGS
7387 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
7388 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
7389 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
7390 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.]))
7393 AC_MSG_WARN([Disabling elfhack])
7399 dnl ========================================================
7400 dnl = libstdc++ compatibility hacks
7401 dnl ========================================================
7404 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7405 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7408 if test -n "$STDCXX_COMPAT"; then
7409 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
7410 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7411 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7414 dnl ========================================================
7416 dnl = Profiling and Instrumenting
7418 dnl ========================================================
7419 MOZ_ARG_HEADER(Profiling and Instrumenting)
7421 dnl ========================================================
7422 dnl = Enable runtime visual profiling logger
7423 dnl ========================================================
7424 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7425 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7426 MOZ_VISUAL_EVENT_TRACER=1,
7427 MOZ_VISUAL_EVENT_TRACER=)
7428 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7429 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7432 dnl ========================================================
7433 dnl = Enable TaskTracer
7434 dnl ========================================================
7435 MOZ_ARG_ENABLE_BOOL(tasktracer,
7436 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
7439 if test "$MOZ_WIDGET_TOOLKIT" = "gonk" -a -n "$MOZ_TASK_TRACER"; then
7440 AC_DEFINE(MOZ_TASK_TRACER)
7441 AC_SUBST(MOZ_TASK_TRACER)
7444 dnl ========================================================
7445 dnl Turn on reflow counting
7446 dnl ========================================================
7447 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7448 [ --enable-reflow-perf Enable reflow performance tracing],
7451 if test -n "$MOZ_REFLOW_PERF"; then
7452 AC_DEFINE(MOZ_REFLOW_PERF)
7455 dnl ========================================================
7456 dnl = Offer a way to disable the startup cache
7457 dnl ========================================================
7459 MOZ_ARG_DISABLE_BOOL(startupcache,
7460 [ --disable-startupcache Disable startup cache ],
7461 MOZ_DISABLE_STARTUPCACHE=1,
7462 MOZ_DISABLE_STARTUPCACHE=)
7464 dnl bug 988880: disable startup cache on b2g
7465 if test -n "$MOZ_B2G"; then
7466 MOZ_DISABLE_STARTUPCACHE=1
7468 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
7469 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
7471 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
7473 dnl ========================================================
7474 dnl = Enable Radio Interface for B2G (Gonk usually)
7475 dnl ========================================================
7476 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7477 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7480 MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL )
7481 if test -n "$MOZ_B2G_RIL"; then
7482 if test -n "$_PLATFORM_HAVE_RIL"; then
7483 AC_DEFINE(MOZ_B2G_RIL)
7485 AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.])
7488 AC_SUBST(MOZ_B2G_RIL)
7490 dnl ========================================================
7491 dnl = Enable Radio FM for B2G (Gonk usually)
7492 dnl ========================================================
7493 if test -n "$MOZ_B2G_FM"; then
7494 AC_DEFINE(MOZ_B2G_FM)
7496 AC_SUBST(MOZ_B2G_FM)
7498 dnl ========================================================
7499 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7500 dnl ========================================================
7501 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7502 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7505 if test -n "$MOZ_B2G_BT"; then
7506 AC_DEFINE(MOZ_B2G_BT)
7508 AC_SUBST(MOZ_B2G_BT)
7509 AC_SUBST(MOZ_B2G_BT_BLUEZ)
7510 AC_SUBST(MOZ_B2G_BT_BLUEDROID)
7511 AC_SUBST(MOZ_B2G_BT_DAEMON)
7513 dnl ========================================================
7514 dnl = Enable NFC Interface for B2G (Gonk usually)
7515 dnl ========================================================
7516 MOZ_ARG_ENABLE_BOOL(nfc,
7517 [ --enable-nfc Set compile flags necessary for compiling NFC API ],
7520 if test -n "$MOZ_NFC"; then
7525 dnl ========================================================
7526 dnl = Enable Pico Speech Synthesis (Gonk usually)
7527 dnl ========================================================
7528 MOZ_ARG_ENABLE_BOOL(synth-pico,
7529 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
7532 if test -n "$MOZ_SYNTH_PICO"; then
7533 AC_DEFINE(MOZ_SYNTH_PICO)
7535 AC_SUBST(MOZ_SYNTH_PICO)
7537 dnl ========================================================
7538 dnl = Enable Support for Time Manager API
7539 dnl ========================================================
7540 if test -n "$MOZ_TIME_MANAGER"; then
7541 AC_DEFINE(MOZ_TIME_MANAGER)
7543 AC_SUBST(MOZ_TIME_MANAGER)
7545 dnl ========================================================
7546 dnl = Enable Camera Interface for B2G (Gonk usually)
7547 dnl ========================================================
7548 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7549 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7552 if test -n "$MOZ_B2G_CAMERA"; then
7553 AC_DEFINE(MOZ_B2G_CAMERA)
7555 AC_SUBST(MOZ_B2G_CAMERA)
7557 dnl ========================================================
7558 dnl = Enable Support for Payment API
7559 dnl ========================================================
7560 if test -n "$MOZ_PAY"; then
7565 dnl ========================================================
7566 dnl = Enable Browser Support for Activities
7567 dnl ========================================================
7568 if test -n "$MOZ_ACTIVITIES"; then
7569 AC_DEFINE(MOZ_ACTIVITIES)
7571 AC_SUBST(MOZ_ACTIVITIES)
7573 dnl ========================================================
7574 dnl = Enable Support for AudioChannelManager API
7575 dnl ========================================================
7576 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7577 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7579 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7581 dnl ========================================================
7582 dnl = Enable Support for Secure Element API
7583 dnl ========================================================
7584 MOZ_SECUREELEMENT=1,
7585 if test -n "$MOZ_SECUREELEMENT"; then
7586 AC_DEFINE(MOZ_SECUREELEMENT)
7588 AC_SUBST(MOZ_SECUREELEMENT)
7590 dnl ========================================================
7591 dnl = Support for demangling undefined symbols
7592 dnl ========================================================
7593 if test -z "$SKIP_LIBRARY_CHECKS"; then
7596 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7600 # Demangle only for debug or DMD builds
7601 MOZ_DEMANGLE_SYMBOLS=
7602 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
7603 MOZ_DEMANGLE_SYMBOLS=1
7604 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7606 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7608 dnl ========================================================
7609 dnl = Support for gcc stack unwinding (from gcc 3.3)
7610 dnl ========================================================
7611 if test -z "$SKIP_LIBRARY_CHECKS"; then
7614 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7618 dnl ========================================================
7620 dnl ========================================================
7622 MOZ_ARG_WITH_STRING(jitreport-granularity,
7623 [ --jitreport-granularity=N
7624 Default granularity at which to report JIT code
7627 1 - code ranges for whole functions only
7628 2 - per-line information
7629 3 - per-op information],
7630 JITREPORT_GRANULARITY=$withval,
7631 JITREPORT_GRANULARITY=3)
7633 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7635 dnl ========================================================
7636 dnl = Disable Mozilla's versions of RIL and Geolocation
7637 dnl ========================================================
7638 MOZ_ARG_DISABLE_BOOL(mozril-geoloc,
7639 [ --disable-mozril-geoloc Disable Mozilla's RIL and geolocation],
7640 DISABLE_MOZ_RIL_GEOLOC=1,
7641 DISABLE_MOZ_RIL_GEOLOC= )
7642 if test -n "$DISABLE_MOZ_RIL_GEOLOC"; then
7643 AC_DEFINE(DISABLE_MOZ_RIL_GEOLOC)
7645 AC_SUBST(DISABLE_MOZ_RIL_GEOLOC)
7647 dnl ========================================================
7651 dnl ========================================================
7652 MOZ_ARG_HEADER(Misc. Options)
7654 dnl ========================================================
7655 dnl update xterm title
7656 dnl ========================================================
7657 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7658 [ --enable-xterm-updates Update XTERM titles with current command.],
7662 dnl =========================================================
7664 dnl =========================================================
7665 MOZ_ARG_ENABLE_STRING([chrome-format],
7666 [ --enable-chrome-format=jar|flat|omni
7667 Select FORMAT of chrome files during packaging],
7668 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7670 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7671 MOZ_CHROME_FILE_FORMAT=jar
7674 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7675 AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7678 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7679 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7680 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7681 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7684 dnl =========================================================
7685 dnl Enable support for revamped devtools Performance Tools
7686 dnl =========================================================
7688 MOZ_ARG_ENABLE_BOOL(devtools-perf,
7689 [ --enable-devtools-perf Set compile flags necessary for compiling devtools perftools],
7690 MOZ_DEVTOOLS_PERFTOOLS=1,
7691 MOZ_DEVTOOLS_PERFTOOLS= )
7692 if test -n "$MOZ_DEVTOOLS_PERFTOOLS"; then
7693 AC_DEFINE(MOZ_DEVTOOLS_PERFTOOLS)
7695 AC_SUBST(MOZ_DEVTOOLS_PERFTOOLS)
7697 dnl =========================================================
7698 dnl Omnijar packaging (bug 552121)
7699 dnl =========================================================
7700 dnl Omnijar packaging is compatible with flat packaging.
7701 dnl In unpackaged builds, omnijar looks for files as if
7702 dnl things were flat packaged. After packaging, all files
7703 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7704 dnl is set to flat since putting files into jars is only
7705 dnl done during packaging with omnijar.
7706 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7708 AC_DEFINE(MOZ_OMNIJAR)
7710 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7711 if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7712 MOZ_CHROME_FILE_FORMAT=flat
7714 MOZ_CHROME_FILE_FORMAT=symlink
7717 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7718 dnl Fennec's static resources live in the assets/ folder of the
7719 dnl APK. Adding a path to the name here works because we only
7720 dnl have one omnijar file in the final package (which is not the
7721 dnl case on desktop), and necessitates some contortions during
7722 dnl packaging so that the resources in the omnijar are considered
7723 dnl as rooted at / and not as rooted at assets/ (which again is
7724 dnl not the case on desktop: there are omnijars rooted at webrtc/,
7725 dnl etc). packager.mk handles changing the rooting of the single
7727 OMNIJAR_NAME=assets/omni.ja
7729 OMNIJAR_NAME=omni.ja
7732 AC_SUBST(OMNIJAR_NAME)
7733 AC_SUBST(MOZ_OMNIJAR)
7734 AC_SUBST(MOZ_PACKAGER_FORMAT)
7736 dnl ========================================================
7737 dnl = Define default location for MOZILLA_FIVE_HOME
7738 dnl ========================================================
7739 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7740 [ --with-default-mozilla-five-home
7741 Set the default value for MOZILLA_FIVE_HOME],
7742 [ val=`echo $withval`
7743 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7745 dnl ========================================================
7746 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7747 dnl ========================================================
7748 MOZ_ARG_WITH_STRING(user-appdir,
7749 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7750 [ val=`echo $withval`
7751 if echo "$val" | grep "\/" >/dev/null; then
7752 AC_MSG_ERROR("Homedir must be single relative path.")
7757 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7759 dnl ========================================================
7760 dnl = Doxygen configuration
7761 dnl ========================================================
7762 dnl Use commas to specify multiple dirs to this arg
7763 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7764 MOZ_ARG_WITH_STRING(doc-input-dirs,
7765 [ --with-doc-input-dirs=DIRS
7766 Header/idl dirs to create docs from],
7767 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7768 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7770 dnl Use commas to specify multiple dirs to this arg
7771 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7772 MOZ_ARG_WITH_STRING(doc-include-dirs,
7773 [ --with-doc-include-dirs=DIRS
7774 Include dirs to preprocess doc headers],
7775 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7776 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7778 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7779 MOZ_ARG_WITH_STRING(doc-output-dir,
7780 [ --with-doc-output-dir=DIR
7781 Dir to generate docs into],
7782 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7783 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7785 if test -z "$SKIP_COMPILER_CHECKS"; then
7786 dnl ========================================================
7788 dnl = Compiler Options
7790 dnl ========================================================
7791 MOZ_ARG_HEADER(Compiler Options)
7793 dnl ========================================================
7794 dnl Check for gcc -pipe support
7795 dnl ========================================================
7796 AC_MSG_CHECKING([for -pipe support])
7797 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7798 dnl Any gcc that supports firefox supports -pipe.
7799 CFLAGS="$CFLAGS -pipe"
7800 CXXFLAGS="$CXXFLAGS -pipe"
7801 AC_MSG_RESULT([yes])
7806 dnl ========================================================
7807 dnl Profile guided optimization (gcc checks)
7808 dnl ========================================================
7809 dnl Test for profiling options
7810 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7812 _SAVE_CFLAGS="$CFLAGS"
7813 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7815 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7816 AC_TRY_COMPILE([], [return 0;],
7817 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7818 result="yes" ], result="no")
7819 AC_MSG_RESULT([$result])
7821 if test $result = "yes"; then
7822 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7823 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7824 PROFILE_USE_LDFLAGS="-fprofile-use"
7827 CFLAGS="$_SAVE_CFLAGS"
7829 if test -n "$INTEL_CC"; then
7830 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7831 PROFILE_GEN_LDFLAGS=
7832 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7833 PROFILE_USE_LDFLAGS=
7836 dnl Sun Studio on Solaris
7837 if test "$SOLARIS_SUNPRO_CC"; then
7838 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7839 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7840 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7841 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7844 AC_SUBST(PROFILE_GEN_CFLAGS)
7845 AC_SUBST(PROFILE_GEN_LDFLAGS)
7846 AC_SUBST(PROFILE_USE_CFLAGS)
7847 AC_SUBST(PROFILE_USE_LDFLAGS)
7849 dnl =============================================
7850 dnl Support for -fno-integrated-as (recent clang)
7851 dnl =============================================
7852 dnl Under clang 3.4+, use -fno-integrated-as to
7853 dnl build libvpx's vp8_asm_enc_offsets.c
7855 _SAVE_CFLAGS="$CFLAGS"
7856 CFLAGS="$CFLAGS -fno-integrated-as -S"
7858 AC_MSG_CHECKING([whether C compiler supports -fno-integrated-as])
7859 AC_TRY_COMPILE([], [return 0;],
7860 [ NO_INTEGRATED_AS_CFLAGS="-fno-integrated-as"
7861 result="yes" ], result="no")
7862 AC_MSG_RESULT([$result])
7864 CFLAGS="$_SAVE_CFLAGS"
7866 AC_SUBST(NO_INTEGRATED_AS_CFLAGS)
7868 fi # ! SKIP_COMPILER_CHECKS
7870 AC_DEFINE(CPP_THROW_NEW, [throw()])
7873 if test "$COMPILE_ENVIRONMENT"; then
7875 fi # COMPILE_ENVIRONMENT
7877 dnl ========================================================
7879 dnl = Build depencency options
7881 dnl ========================================================
7882 MOZ_ARG_HEADER(Build dependencies)
7884 if test "$GNU_CC" -a "$GNU_CXX"; then
7885 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7886 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7887 elif test "$SOLARIS_SUNPRO_CC"; then
7890 dnl Don't override this for MSVC
7891 if test -z "$_WIN32_MSVC"; then
7892 _USE_CPP_INCLUDE_FLAG=
7893 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7894 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7896 echo '#include <stdio.h>' > dummy-hello.c
7898 dnl This output is localized, split at the first double space or colon and space.
7899 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
7900 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
7901 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
7903 if ! test -e "$_CL_STDIO_PATH"; then
7904 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
7906 if test -z "$CL_INCLUDES_PREFIX"; then
7907 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7909 AC_SUBST(CL_INCLUDES_PREFIX)
7912 dnl Make sure that the build system can handle non-ASCII characters
7913 dnl in environment variables to prevent it from breaking silently on
7914 dnl non-English systems.
7915 NONASCII=$'\241\241'
7920 dnl ========================================================
7922 dnl = Static Build Options
7924 dnl ========================================================
7925 MOZ_ARG_HEADER(Static build options)
7927 if test -n "$GKMEDIAS_SHARED_LIBRARY"; then
7928 AC_DEFINE(GKMEDIAS_SHARED_LIBRARY)
7930 AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
7932 if test -z "$MOZ_NATIVE_ZLIB"; then
7933 if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
7935 AC_DEFINE(ZLIB_IN_MOZGLUE)
7939 AC_SUBST(ZLIB_IN_MOZGLUE)
7941 dnl ========================================================
7943 dnl = Standalone module options
7945 dnl ========================================================
7946 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7949 dnl ========================================================
7951 if test -z "$SKIP_PATH_CHECKS"; then
7952 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7953 if test "$MOZ_ENABLE_GTK" ; then
7954 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7959 if test -z "${GLIB_GMODULE_LIBS}" \
7960 -a -n "${GLIB_CONFIG}"\
7961 -a "${GLIB_CONFIG}" != no\
7963 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7966 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
7968 dnl ========================================================
7969 dnl Graphics checks.
7970 dnl ========================================================
7972 if test "${OS_TARGET}" = "WINNT" -o \
7973 "${OS_ARCH}" = "Darwin" -o \
7974 "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
7975 "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
7976 "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
7977 "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
7978 case "${target_cpu}" in
7990 MOZ_ARG_ENABLE_BOOL(skia,
7991 [ --enable-skia Enable use of Skia],
7995 MOZ_ARG_DISABLE_BOOL(skia-gpu,
7996 [ --disable-skia-gpu Disable use of Skia-GPU],
7997 MOZ_DISABLE_SKIA_GPU=1,
7998 MOZ_DISABLE_SKIA_GPU=)
8000 if test "$USE_FC_FREETYPE"; then
8001 if test "$COMPILE_ENVIRONMENT"; then
8002 dnl ========================================================
8003 dnl = Check for freetype2 and its functionality
8004 dnl ========================================================
8005 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
8007 if test "$_HAVE_FREETYPE2"; then
8009 _SAVE_CFLAGS="$CFLAGS"
8010 LIBS="$LIBS $FT2_LIBS"
8011 CFLAGS="$CFLAGS $FT2_CFLAGS"
8013 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
8014 ac_cv_member_FT_Bitmap_Size_y_ppem,
8015 [AC_TRY_COMPILE([#include <ft2build.h>
8016 #include FT_FREETYPE_H],
8018 if (sizeof s.y_ppem) return 0;
8020 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
8021 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
8022 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
8023 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
8025 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
8027 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
8028 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
8029 [FT_Bitmap_Size structure includes y_ppem field])
8031 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
8034 CFLAGS="$_SAVE_CFLAGS"
8037 _SAVE_CPPFLAGS="$CPPFLAGS"
8038 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8039 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8040 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8041 CPPFLAGS="$_SAVE_CPPFLAGS"
8043 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8046 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
8048 if test "$MOZ_PANGO"; then
8049 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
8050 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
8052 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
8053 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
8058 dnl ========================================================
8059 dnl Check for pixman and cairo
8060 dnl ========================================================
8062 if test "$MOZ_WIDGET_TOOLKIT" = "gtk3" ; then
8063 # cairo-gtk3 can be build with system-cairo only
8069 MOZ_ARG_ENABLE_BOOL(system-cairo,
8070 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8075 MOZ_ARG_ENABLE_BOOL(system-pixman,
8076 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8078 MOZ_TREE_PIXMAN=force,
8081 # System cairo depends on system pixman
8082 if test "$MOZ_TREE_PIXMAN" = "force"; then
8083 if test -z "$MOZ_TREE_CAIRO"; then
8084 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
8088 elif test -z "$MOZ_TREE_CAIRO"; then
8092 if test "$MOZ_TREE_PIXMAN"; then
8093 AC_DEFINE(MOZ_TREE_PIXMAN)
8095 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8096 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8097 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8099 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8100 AC_SUBST_LIST(MOZ_PIXMAN_LIBS)
8102 # Check for headers defining standard int types.
8103 if test -n "$COMPILE_ENVIRONMENT"; then
8104 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8106 if test "${ac_cv_header_inttypes_h}" = "yes"; then
8111 AC_SUBST(HAVE_INTTYPES_H)
8113 if test "$MOZ_TREE_CAIRO"; then
8114 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8115 AC_DEFINE(MOZ_TREE_CAIRO)
8117 if test "$OS_ARCH" = "WINNT"; then
8118 # For now we assume that we will have a uint64_t available through
8119 # one of the above headers or mozstdint.h.
8120 AC_DEFINE(HAVE_UINT64_T)
8123 # Define macros for cairo-features.h
8124 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8125 if test "$MOZ_X11"; then
8126 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8127 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8128 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8130 if test "$_HAVE_FREETYPE2"; then
8131 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8132 MOZ_ENABLE_CAIRO_FT=1
8133 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8136 case "$MOZ_WIDGET_TOOLKIT" in
8138 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8141 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8142 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8143 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8146 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8147 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8148 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8149 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8150 MOZ_ENABLE_D2D_SURFACE=1
8151 MOZ_ENABLE_DWRITE_FONT=1
8153 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8155 dnl D3D10 Layers depend on D2D Surfaces.
8156 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8157 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8161 AC_MSG_ERROR([cairo-gtk3 toolkit is incompatible with in-tree cairo. Please add --enable-system-cairo to your build config.])
8164 if test "$USE_FC_FREETYPE"; then
8165 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8167 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8168 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8169 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8170 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8171 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8173 AC_SUBST(PS_SURFACE_FEATURE)
8174 AC_SUBST(PDF_SURFACE_FEATURE)
8175 AC_SUBST(SVG_SURFACE_FEATURE)
8176 AC_SUBST(XLIB_SURFACE_FEATURE)
8177 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8178 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8179 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8180 AC_SUBST(WIN32_SURFACE_FEATURE)
8181 AC_SUBST(OS2_SURFACE_FEATURE)
8182 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8183 AC_SUBST(FT_FONT_FEATURE)
8184 AC_SUBST(FC_FONT_FEATURE)
8185 AC_SUBST(WIN32_FONT_FEATURE)
8186 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8187 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8188 AC_SUBST(QUARTZ_FONT_FEATURE)
8189 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8190 AC_SUBST(QT_SURFACE_FEATURE)
8191 AC_SUBST(TEE_SURFACE_FEATURE)
8193 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8195 if test "$MOZ_X11"; then
8196 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8199 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8201 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8202 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8203 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8204 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8205 if test "$MOZ_X11"; then
8206 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8207 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8208 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8209 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8213 AC_SUBST(MOZ_TREE_CAIRO)
8214 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
8215 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
8216 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
8217 AC_SUBST(MOZ_TREE_PIXMAN)
8219 dnl ========================================================
8221 dnl ========================================================
8222 if test "$MOZ_ENABLE_SKIA"; then
8223 AC_DEFINE(MOZ_ENABLE_SKIA)
8225 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8226 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8229 if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" -a -z "$MOZ_DISABLE_SKIA_GPU" ; then
8230 MOZ_ENABLE_SKIA_GPU=1
8231 AC_DEFINE(USE_SKIA_GPU)
8232 AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8235 AC_SUBST(MOZ_ENABLE_SKIA)
8237 dnl ========================================================
8239 dnl ========================================================
8240 MOZ_ARG_DISABLE_BOOL(xul,
8241 [ --disable-xul Disable XUL],
8243 if test "$MOZ_XUL"; then
8246 dnl remove extensions that require XUL
8247 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
8252 dnl ========================================================
8253 dnl disable profile locking
8254 dnl do no use this in applications that can have more than
8255 dnl one process accessing the profile directory.
8256 dnl ========================================================
8257 MOZ_ARG_DISABLE_BOOL(profilelocking,
8258 [ --disable-profilelocking
8259 Disable profile locking],
8260 MOZ_PROFILELOCKING=,
8261 MOZ_PROFILELOCKING=1 )
8262 if test "$MOZ_PROFILELOCKING"; then
8263 AC_DEFINE(MOZ_PROFILELOCKING)
8266 dnl ========================================================
8267 dnl necko configuration options
8268 dnl ========================================================
8271 dnl option to disable various necko protocols
8273 MOZ_ARG_ENABLE_STRING(necko-protocols,
8274 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8275 Enable/disable specific protocol handlers],
8276 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8277 if test "$option" = "yes" -o "$option" = "all"; then
8278 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8279 elif test "$option" = "no" -o "$option" = "none"; then
8281 elif test "$option" = "default"; then
8282 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8283 elif test `echo "$option" | grep -c \^-` != 0; then
8284 option=`echo $option | sed 's/^-//'`
8285 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8287 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8290 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8292 NECKO_PROTOCOLS=`$PYTHON ${srcdir}/build/unix/uniq.py ${NECKO_PROTOCOLS}`
8293 AC_SUBST_SET(NECKO_PROTOCOLS)
8294 for p in $NECKO_PROTOCOLS; do
8295 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8296 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8300 dnl option to disable necko's wifi scanner
8303 case "$OS_TARGET" in
8305 if test -n "$gonkdir"; then
8309 Darwin|DragonFly|FreeBSD|SunOS|WINNT)
8318 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8319 [ --disable-necko-wifi Disable necko wifi scanner],
8323 if test "$NECKO_WIFI"; then
8324 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
8325 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
8327 AC_DEFINE(NECKO_WIFI)
8328 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8330 AC_SUBST(NECKO_WIFI)
8331 AC_SUBST(NECKO_WIFI_DBUS)
8334 dnl option to disable cookies
8336 MOZ_ARG_DISABLE_BOOL(cookies,
8337 [ --disable-cookies Disable cookie support],
8340 AC_SUBST(NECKO_COOKIES)
8341 if test "$NECKO_COOKIES"; then
8342 AC_DEFINE(NECKO_COOKIES)
8343 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8347 dnl Always build Marionette if not Android or B2G
8349 if test "$OS_TARGET" != Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
8350 AC_DEFINE(ENABLE_MARIONETTE)
8352 AC_SUBST(ENABLE_MARIONETTE)
8353 if test "$ENABLE_MARIONETTE"; then
8354 AC_DEFINE(ENABLE_MARIONETTE)
8358 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8360 MOZ_ARG_DISABLE_BOOL(ctypes,
8361 [ --disable-ctypes Disable js-ctypes],
8364 AC_SUBST(BUILD_CTYPES)
8365 if test "$BUILD_CTYPES"; then
8366 AC_DEFINE(BUILD_CTYPES)
8369 dnl Build Places if required
8370 if test "$MOZ_PLACES"; then
8371 AC_DEFINE(MOZ_PLACES)
8374 dnl Build SocialAPI if required
8375 if test "$MOZ_SOCIAL"; then
8376 AC_DEFINE(MOZ_SOCIAL)
8379 dnl Build Common JS modules provided by services.
8380 AC_SUBST(MOZ_SERVICES_COMMON)
8381 if test -n "$MOZ_SERVICES_COMMON"; then
8382 AC_DEFINE(MOZ_SERVICES_COMMON)
8385 dnl Build Services crypto component (used by Sync)
8386 AC_SUBST(MOZ_SERVICES_CRYPTO)
8387 if test -n "$MOZ_SERVICES_CRYPTO"; then
8388 AC_DEFINE(MOZ_SERVICES_CRYPTO)
8391 dnl Build Firefox Health Reporter Service
8392 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8393 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8394 AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8397 dnl Build Services metrics component
8398 AC_SUBST(MOZ_SERVICES_METRICS)
8399 if test -n "$MOZ_SERVICES_METRICS"; then
8400 AC_DEFINE(MOZ_SERVICES_METRICS)
8403 dnl Build Notifications if required
8404 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8405 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8406 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8409 dnl Build Sync Services if required
8410 AC_SUBST(MOZ_SERVICES_SYNC)
8411 if test -n "$MOZ_SERVICES_SYNC"; then
8412 AC_DEFINE(MOZ_SERVICES_SYNC)
8415 dnl Build Services/CloudSync if required
8416 AC_SUBST(MOZ_SERVICES_CLOUDSYNC)
8417 if test -n "$MOZ_SERVICES_CLOUDSYNC"; then
8418 AC_DEFINE(MOZ_SERVICES_CLOUDSYNC)
8421 dnl Build Captive Portal Detector if required
8422 AC_SUBST(MOZ_CAPTIVEDETECT)
8423 if test -n "$MOZ_CAPTIVEDETECT"; then
8424 AC_DEFINE(MOZ_CAPTIVEDETECT)
8427 dnl Build second screen and casting features for external devices if required
8428 AC_SUBST(MOZ_DEVICES)
8429 if test -n "$MOZ_DEVICES"; then
8430 AC_DEFINE(MOZ_DEVICES)
8433 dnl ========================================================
8434 if test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
8435 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8438 dnl ========================================================
8440 dnl = Maintainer debug option (no --enable equivalent)
8442 dnl ========================================================
8447 AC_SUBST(AR_EXTRACT)
8451 AC_SUBST(AS_DASH_C_FLAG)
8460 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8461 AC_SUBST(MOZ_UPDATE_XTERM)
8462 AC_SUBST(MOZ_AUTH_EXTENSION)
8463 AC_SUBST(MOZ_PERMISSIONS)
8464 AC_SUBST(MOZ_PREF_EXTENSIONS)
8466 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8467 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8468 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8469 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8470 AC_SUBST(WARNINGS_AS_ERRORS)
8471 AC_SUBST(MOZ_EXTENSIONS)
8472 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8475 AC_SUBST(MOZ_INSTRUMENTS)
8476 AC_SUBST(MOZ_CALLGRIND)
8478 AC_SUBST(MOZ_PROFILING)
8480 AC_SUBST(MOZ_PLACES)
8481 AC_SUBST(MOZ_SOCIAL)
8482 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8484 AC_SUBST(NS_PRINTING)
8485 AC_SUBST(MOZ_HELP_VIEWER)
8486 AC_SUBST(TOOLCHAIN_PREFIX)
8495 AC_SUBST(MOZ_PROFILELOCKING)
8497 AC_SUBST(ENABLE_TESTS)
8498 AC_SUBST(MOZ_UNIVERSALCHARDET)
8499 AC_SUBST(ACCESSIBILITY)
8500 AC_SUBST(MOZ_SPELLCHECK)
8501 AC_SUBST(MOZ_ANDROID_APZ)
8502 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8503 AC_SUBST(MOZ_CRASHREPORTER)
8504 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8505 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8506 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8507 AC_SUBST(MOZ_STUB_INSTALLER)
8508 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8509 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8510 AC_SUBST(MOZ_UPDATER)
8512 AC_SUBST(MOZ_ANGLE_RENDERER)
8513 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
8514 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
8515 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
8516 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
8517 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8518 AC_SUBST(MOZ_D3DCOMPILER_XP_DLL)
8519 AC_SUBST(MOZ_D3DCOMPILER_XP_CAB)
8523 AC_SUBST(MOZ_ANDROID_HISTORY)
8524 AC_SUBST(MOZ_WEBSMS_BACKEND)
8525 AC_SUBST(MOZ_ANDROID_BEAM)
8526 AC_SUBST(MOZ_LOCALE_SWITCHER)
8527 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
8528 AC_SUBST(MOZ_ANDROID_SEARCH_ACTIVITY)
8529 AC_SUBST(MOZ_ANDROID_SHARE_OVERLAY)
8530 AC_SUBST(MOZ_ANDROID_NEW_TABLET_UI)
8531 AC_SUBST(MOZ_ANDROID_MLS_STUMBLER)
8532 AC_SUBST(MOZ_ANDROID_DOWNLOADS_INTEGRATION)
8533 AC_SUBST(ENABLE_STRIP)
8534 AC_SUBST(PKG_SKIP_STRIP)
8535 AC_SUBST(STRIP_FLAGS)
8536 AC_SUBST(USE_ELF_HACK)
8537 AC_SUBST(INCREMENTAL_LINKER)
8538 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8539 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8541 AC_SUBST(MOZ_FIX_LINK_PATHS)
8543 AC_SUBST(USE_DEPENDENT_LIBS)
8545 AC_SUBST(MOZ_BUILD_ROOT)
8547 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8548 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8549 AC_SUBST(MOZ_LINKER_EXTRACT)
8551 AC_SUBST(MOZ_JSDOWNLOADS)
8552 if test -n "$MOZ_JSDOWNLOADS"; then
8553 AC_DEFINE(MOZ_JSDOWNLOADS)
8556 dnl ========================================================
8557 dnl = Mac bundle name prefix
8558 dnl ========================================================
8559 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8560 [ --with-macbundlename-prefix=prefix
8561 Prefix for MOZ_MACBUNDLE_NAME],
8562 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8564 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8565 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8566 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8569 if test "$MOZ_DEBUG"; then
8570 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8572 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8574 AC_SUBST(MOZ_MACBUNDLE_NAME)
8576 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8577 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8578 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8579 if test "$MOZ_DEBUG"; then
8580 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8583 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8584 AC_SUBST(MOZ_MACBUNDLE_ID)
8586 dnl ========================================================
8587 dnl = Child Process Name for IPC
8588 dnl ========================================================
8589 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8590 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8592 # We want to let Android unpack the file at install time, but it only does
8593 # so if the file is named libsomething.so. The lib/ path is also required
8594 # because the unpacked file will be under the lib/ subdirectory and will
8595 # need to be executed from that path.
8596 MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8598 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8600 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8601 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8603 # The following variables are available to branding and application
8604 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8605 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8606 # impacts profile location and user-visible fields.
8607 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8608 # versions of a given application (e.g. Aurora and Firefox both use
8609 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8610 # for application.ini's "Name" field, which controls profile location in
8611 # the absence of a "Profile" field (see below), and various system
8612 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8613 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8614 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8615 # builds (e.g. Aurora for Firefox).
8616 # - MOZ_APP_VERSION: Defines the application version number.
8617 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8618 # defaults to a lowercase form of MOZ_APP_BASENAME.
8619 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
8620 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
8621 # - MOZ_APP_PROFILE: When set, used for application.ini's
8622 # "Profile" field, which controls profile location.
8623 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8624 # crash reporter server url.
8625 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8627 if test -z "$MOZ_APP_NAME"; then
8628 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8631 if test -z "$MOZ_APP_REMOTINGNAME"; then
8632 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
8635 # For extensions and langpacks, we require a max version that is compatible
8636 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8637 # 24.0a1 and 24.0a2 aren't affected
8639 # 24.1.1 becomes 24.*
8640 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8641 if test -z "$IS_ALPHA"; then
8643 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
8646 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8649 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8650 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8651 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8653 AC_SUBST(MOZ_APP_NAME)
8654 AC_SUBST(MOZ_APP_REMOTINGNAME)
8655 AC_SUBST(MOZ_APP_DISPLAYNAME)
8656 AC_SUBST(MOZ_APP_BASENAME)
8657 AC_SUBST(MOZ_APP_VENDOR)
8658 AC_SUBST(MOZ_APP_PROFILE)
8659 AC_SUBST(MOZ_APP_ID)
8660 AC_SUBST(MAR_CHANNEL_ID)
8661 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8662 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8663 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8664 AC_SUBST(MOZ_APP_UA_NAME)
8665 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8666 AC_SUBST(MOZ_APP_VERSION)
8667 AC_SUBST(MOZ_APP_MAXVERSION)
8668 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8669 AC_SUBST(FIREFOX_VERSION)
8670 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8671 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8672 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8675 AC_SUBST(MOZ_APP_STATIC_INI)
8677 AC_SUBST(MOZ_PKG_SPECIAL)
8679 AC_SUBST(MOZILLA_OFFICIAL)
8681 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8682 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8684 if test "$MOZ_TELEMETRY_REPORTING"; then
8685 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8687 # Enable Telemetry by default for nightly and aurora channels
8688 if test -z "$RELEASE_BUILD"; then
8689 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8693 dnl If we have any service that uploads data (and requires data submission
8694 dnl policy alert), set MOZ_DATA_REPORTING.
8695 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8696 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8697 MOZ_DATA_REPORTING=1
8698 AC_DEFINE(MOZ_DATA_REPORTING)
8699 AC_SUBST(MOZ_DATA_REPORTING)
8703 AC_SUBST(MOZ_BROWSE_INFO)
8704 AC_SUBST(MOZ_TOOLS_DIR)
8705 AC_SUBST(WIN32_REDIST_DIR)
8708 dnl Echo the CFLAGS to remove extra whitespace.
8714 $_WARNINGS_CXXFLAGS \
8717 COMPILE_CFLAGS=`echo \
8722 COMPILE_CXXFLAGS=`echo \
8723 $_DEFINES_CXXFLAGS \
8731 HOST_CXXFLAGS=`echo \
8735 AC_SUBST(MOZ_NATIVE_JPEG)
8736 AC_SUBST(MOZ_NATIVE_PNG)
8737 AC_SUBST(MOZ_NATIVE_BZ2)
8739 AC_SUBST(MOZ_JPEG_CFLAGS)
8740 AC_SUBST_LIST(MOZ_JPEG_LIBS)
8741 AC_SUBST(MOZ_BZ2_CFLAGS)
8742 AC_SUBST_LIST(MOZ_BZ2_LIBS)
8743 AC_SUBST(MOZ_PNG_CFLAGS)
8744 AC_SUBST_LIST(MOZ_PNG_LIBS)
8746 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
8747 export MOZ_NUWA_PROCESS
8748 AC_DEFINE(MOZ_NUWA_PROCESS)
8750 AC_SUBST(MOZ_NUWA_PROCESS)
8751 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_B2G_LOADER"; then
8752 if test -z "$MOZ_NUWA_PROCESS"; then
8753 AC_MSG_ERROR([B2G loader works with Nuwa]);
8755 export MOZ_B2G_LOADER
8756 AC_DEFINE(MOZ_B2G_LOADER)
8758 AC_SUBST(MOZ_B2G_LOADER)
8760 AC_SUBST(NSPR_CFLAGS)
8761 AC_SUBST(MOZ_NATIVE_NSPR)
8763 AC_SUBST(NSS_CFLAGS)
8764 AC_SUBST(MOZ_NATIVE_NSS)
8765 AC_SUBST(NSS_DISABLE_DBM)
8768 OS_CXXFLAGS="$CXXFLAGS"
8769 OS_CPPFLAGS="$CPPFLAGS"
8770 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8771 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8772 OS_LDFLAGS="$LDFLAGS"
8775 AC_SUBST(OS_CXXFLAGS)
8776 AC_SUBST(OS_CPPFLAGS)
8777 AC_SUBST(OS_COMPILE_CFLAGS)
8778 AC_SUBST(OS_COMPILE_CXXFLAGS)
8779 AC_SUBST(OS_LDFLAGS)
8781 AC_SUBST(CROSS_COMPILE)
8782 AC_SUBST(WCHAR_CFLAGS)
8786 AC_SUBST(HOST_CFLAGS)
8787 AC_SUBST(HOST_CXXFLAGS)
8788 AC_SUBST(HOST_LDFLAGS)
8789 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8791 AC_SUBST(HOST_AR_FLAGS)
8793 AC_SUBST(HOST_RANLIB)
8794 AC_SUBST(HOST_NSPR_MDCPUCFG)
8795 AC_SUBST(HOST_BIN_SUFFIX)
8796 AC_SUBST(HOST_OS_ARCH)
8798 AC_SUBST(TARGET_CPU)
8799 AC_SUBST(TARGET_VENDOR)
8801 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8802 AC_SUBST(TARGET_MD_ARCH)
8803 AC_SUBST(TARGET_XPCOM_ABI)
8806 AC_SUBST(OS_RELEASE)
8809 AC_SUBST(INTEL_ARCHITECTURE)
8810 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
8811 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
8812 AC_SUBST(HAVE_X86_AVX2)
8813 AC_SUBST(GCC_USE_GNU_LD)
8815 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8817 AC_SUBST(WRAP_LDFLAGS)
8820 AC_SUBST(MKSHLIB_FORCE_ALL)
8821 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8822 AC_SUBST(DSO_CFLAGS)
8823 AC_SUBST(DSO_PIC_CFLAGS)
8824 AC_SUBST(DSO_LDOPTS)
8825 AC_SUBST(LIB_PREFIX)
8826 AC_SUBST(DLL_PREFIX)
8827 AC_SUBST(DLL_SUFFIX)
8828 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8829 AC_SUBST(LIB_SUFFIX)
8830 AC_SUBST(OBJ_SUFFIX)
8831 AC_SUBST(BIN_SUFFIX)
8832 AC_SUBST(ASM_SUFFIX)
8833 AC_SUBST(IMPORT_LIB_SUFFIX)
8835 AC_SUBST(CC_VERSION)
8836 AC_SUBST(CXX_VERSION)
8837 AC_SUBST(MSMANIFEST_TOOL)
8838 AC_SUBST(NS_ENABLE_TSF)
8839 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
8840 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
8843 AC_SUBST(MOZ_VORBIS)
8844 AC_SUBST(MOZ_TREMOR)
8847 AC_SUBST(MOZ_FFMPEG)
8850 AC_SUBST(MOZ_DIRECTSHOW)
8851 AC_SUBST(MOZ_ANDROID_OMX)
8852 AC_SUBST(MOZ_APPLEMEDIA)
8853 AC_SUBST(MOZ_OMX_PLUGIN)
8854 AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
8857 AC_SUBST(VPX_ASFLAGS)
8858 AC_SUBST(VPX_DASH_C_FLAG)
8859 AC_SUBST(VPX_AS_CONVERSION)
8860 AC_SUBST(VPX_ASM_SUFFIX)
8861 AC_SUBST(VPX_X86_ASM)
8862 AC_SUBST(VPX_ARM_ASM)
8863 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8864 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8865 AC_SUBST(MOZ_CODE_COVERAGE)
8866 AC_SUBST(LIBJPEG_TURBO_AS)
8867 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8868 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8869 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8870 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8872 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8873 AC_SUBST(MOZ_FOLD_LIBS)
8875 AC_SUBST(MOZ_ENABLE_SZIP)
8876 AC_SUBST(MOZ_SZIP_FLAGS)
8878 dnl Host JavaScript runtime, if any, to use during cross compiles.
8881 if test "$MOZ_DEBUG"; then
8884 AC_SUBST(MOZ_EM_DEBUG)
8886 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
8888 if test -n "$COMPILE_ENVIRONMENT"; then
8889 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
8891 dnl Check for missing components
8892 if test "$MOZ_X11"; then
8893 if test "$WITHOUT_X11"; then
8894 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8896 dnl ====================================================
8897 dnl = Check if X headers exist
8898 dnl ====================================================
8899 _SAVE_CFLAGS=$CFLAGS
8900 CFLAGS="$CFLAGS $XCFLAGS"
8904 #include <X11/Xlib.h>
8905 #include <X11/Intrinsic.h>
8906 #include <X11/extensions/XShm.h>
8910 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8911 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8915 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
8916 CFLAGS="$_SAVE_CFLAGS"
8918 if test -n "$MISSING_X"; then
8919 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8924 fi # COMPILE_ENVIRONMENT
8926 dnl Set various defines and substitutions
8927 dnl ========================================================
8929 if test "$OS_ARCH" != "WINNT"; then
8933 if test "$MOZ_DEBUG"; then
8934 AC_DEFINE(MOZ_REFLOW_PERF)
8935 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8938 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
8939 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8940 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8941 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8942 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8943 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8944 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8945 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8946 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8949 if test -n "$MOZ_DEV_EDITION"; then
8950 AC_DEFINE(MOZ_DEV_EDITION)
8953 if test "$MOZ_DEBUG"; then
8956 case "$MOZ_UPDATE_CHANNEL" in
8957 aurora|beta|release|esr)
8964 if test -n "$A11Y_LOG"; then
8968 AC_SUBST(MOZILLA_VERSION)
8970 AC_SUBST(ac_configure_args)
8972 dnl Spit out some output
8973 dnl ========================================================
8975 dnl The following defines are used by xpcom
8976 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8978 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8979 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8980 HAVE_CPP_PARTIAL_SPECIALIZATION
8983 HAVE_ICONV_WITH_CONST_INPUT
8996 dnl ========================================================
8998 dnl ========================================================
9000 # Internationalization isn't built or exposed by default in non-desktop
9001 # builds. Bugs to enable:
9003 # Android: bug 864843
9006 if test "$MOZ_WIDGET_TOOLKIT" = "android" ||
9007 test "$MOZ_BUILD_APP" = "b2g" ||
9008 test "$MOZ_BUILD_APP" = "b2g/dev"; then
9014 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
9018 if test "$OS_TARGET" = WINNT; then
9024 if test -z "$JS_SHARED_LIBRARY"; then
9025 AC_DEFINE(MOZ_STATIC_JS)
9027 AC_SUBST(JS_SHARED_LIBRARY)
9029 MOZ_CREATE_CONFIG_STATUS()
9031 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9032 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9033 MOZ_SUBCONFIGURE_ICU()
9034 MOZ_SUBCONFIGURE_FFI()
9037 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
9038 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
9039 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
9040 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
9041 # (apparently) only need this hack when egrep's "pattern" is particularly long
9042 # (as in the following code) and the first egrep on our $PATH is Apple's. See
9046 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
9053 # Run jemalloc configure script
9055 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
9056 ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_ --disable-valgrind"
9057 if test -n "$MOZ_REPLACE_MALLOC"; then
9058 # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9059 ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9060 ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9062 if test -n "$MOZ_JEMALLOC3"; then
9063 case "${OS_ARCH}" in
9065 # We want jemalloc functions to be kept hidden on both Mac and Windows
9066 # See memory/build/mozmemory_wrap.h for details.
9067 ac_configure_args="$ac_configure_args --without-export"
9070 elif test "${OS_ARCH}" = Darwin; then
9071 # When building as a replace-malloc lib, disabling the zone allocator
9072 # forces to use pthread_atfork.
9073 ac_configure_args="$ac_configure_args --disable-zone-allocator"
9075 _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9077 if test -z "$MOZ_REPLACE_MALLOC"; then
9079 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9083 elif test -z "$MOZ_JEMALLOC3"; then
9085 JEMALLOC_WRAPPER=replace_
9087 if test -n "$MANGLE"; then
9089 for mangle in ${MANGLE}; do
9090 if test -n "$MANGLED"; then
9091 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9093 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9096 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9099 if test -z "$MOZ_TLS"; then
9100 ac_configure_args="$ac_configure_args --disable-tls"
9102 EXTRA_CFLAGS="$CFLAGS"
9103 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9104 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9106 if test "$CROSS_COMPILE"; then
9107 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9110 if ! test -e memory/jemalloc; then
9111 mkdir -p memory/jemalloc
9114 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9115 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9118 # Run freetype configure script
9120 if test "$MOZ_TREE_FREETYPE"; then
9121 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9122 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9123 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9124 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9125 # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
9126 # to force freetype to use our settings rather than autodetecting
9127 if test -n "$MOZ_NATIVE_PNG"; then
9128 export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
9130 export LIBPNG_CFLAGS="-I$_objdir/dist/include"
9132 export LIBPNG_LIBS="$MOZ_PNG_LIBS "
9133 export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
9134 export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
9135 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9136 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
9138 if ! test -e modules; then
9141 # Only export CC, CXX and RANLIB for the subconfigure, and avoid spilling
9142 # that further down the road.
9143 (export CC CXX RANLIB;
9144 AC_OUTPUT_SUBDIRS(modules/freetype2)
9148 if test -z "$direct_nspr_config"; then
9149 dnl ========================================================
9150 dnl = Setup a nice relatively clean build environment for
9151 dnl = sub-configures.
9152 dnl ========================================================
9155 CFLAGS="$_SUBDIR_CFLAGS"
9156 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9157 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9158 LDFLAGS="$_SUBDIR_LDFLAGS"
9159 HOST_CC="$_SUBDIR_HOST_CC"
9160 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9161 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9162 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9169 # Run all configure scripts specified by a subconfigure
9170 if test -n "$_subconfigure_subdir"; then
9171 _save_srcdir="$srcdir"
9173 _save_ac_configure_args="$ac_configure_args"
9174 ac_configure_args="$_subconfigure_config_args"
9175 AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
9176 ac_configure_args="$_save_ac_configure_args"
9177 srcdir="$_save_srcdir"
9180 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9181 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9185 MOZ_SUBCONFIGURE_NSPR()
9187 dnl ========================================================
9188 dnl = Setup a nice relatively clean build environment for
9189 dnl = sub-configures.
9190 dnl ========================================================
9193 CFLAGS="$_SUBDIR_CFLAGS"
9194 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9195 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9196 LDFLAGS="$_SUBDIR_LDFLAGS"
9197 HOST_CC="$_SUBDIR_HOST_CC"
9198 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9199 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9200 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9203 # Run the SpiderMonkey 'configure' script.
9204 dist=$MOZ_BUILD_ROOT/dist
9205 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9207 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
9209 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
9211 ac_configure_args="$ac_configure_args --enable-threadsafe"
9213 if test "$_INTL_API" = no; then
9214 ac_configure_args="$ac_configure_args --without-intl-api"
9217 if test "$BUILD_CTYPES"; then
9218 # Build js-ctypes on the platforms we can.
9219 ac_configure_args="$ac_configure_args --enable-ctypes"
9221 if test -z "$JS_SHARED_LIBRARY" ; then
9222 ac_configure_args="$ac_configure_args --disable-shared-js"
9223 if test -n "$MOZ_DISABLE_EXPORT_JS"; then
9224 ac_configure_args="$ac_configure_args --disable-export-js"
9227 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
9228 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9229 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9231 ac_configure_args="$ac_configure_args --prefix=$dist"
9232 if test "$MOZ_MEMORY"; then
9233 ac_configure_args="$ac_configure_args --enable-jemalloc"
9235 if test -n "$MOZ_GLUE_IN_PROGRAM"; then
9236 export MOZ_GLUE_IN_PROGRAM
9238 if test -n "$ZLIB_IN_MOZGLUE"; then
9241 export MOZ_NATIVE_ZLIB
9242 export MOZ_ZLIB_CFLAGS
9243 export MOZ_ZLIB_LIBS
9245 export MOZ_APP_REMOTINGNAME
9246 export DONT_POPULATE_VIRTUALENV=1
9248 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9249 export STLPORT_CPPFLAGS
9251 export JS_STANDALONE=no
9253 export ZLIB_IN_MOZGLUE
9255 if ! test -e js; then
9259 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
9260 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9262 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9264 export WRITE_MOZINFO=1
9265 dnl we need to run config.status after js/src subconfigure because we're
9266 dnl traversing its moz.build and we need its config.status for that.
9267 dnl However, writing our own config.status needs to happen before
9268 dnl subconfigures because the setup surrounding subconfigures alters
9269 dnl many AC_SUBSTed variables.
9270 MOZ_RUN_CONFIG_STATUS()