2 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
3 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
4 dnl This Source Code Form is subject to the terms of the Mozilla Public
5 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
6 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 dnl Process this file with autoconf to produce a configure script.
9 dnl ========================================================
12 AC_INIT(config/config.mk)
13 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
15 TARGET_CPU="${target_cpu}"
16 TARGET_VENDOR="${target_vendor}"
17 TARGET_OS="${target_os}"
19 dnl ========================================================
21 dnl = Don't change the following two lines. Doing so breaks:
23 dnl = CFLAGS="-foo" ./configure
25 dnl ========================================================
27 CPPFLAGS="${CPPFLAGS=}"
28 CXXFLAGS="${CXXFLAGS=}"
30 HOST_CFLAGS="${HOST_CFLAGS=}"
31 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
32 HOST_LDFLAGS="${HOST_LDFLAGS=}"
34 dnl ========================================================
35 dnl = Preserve certain environment flags passed to configure
36 dnl = We want sub projects to receive the same flags
37 dnl = untainted by this configure script
38 dnl ========================================================
41 _SUBDIR_CFLAGS="$CFLAGS"
42 _SUBDIR_CPPFLAGS="$CPPFLAGS"
43 _SUBDIR_CXXFLAGS="$CXXFLAGS"
44 _SUBDIR_LDFLAGS="$LDFLAGS"
45 _SUBDIR_HOST_CC="$HOST_CC"
46 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
47 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
48 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
49 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
51 dnl Set the version number of the libs included with mozilla
52 dnl ========================================================
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.4.2
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:
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 MOZ_ARG_WITH_STRING(gonk,
187 location of gonk dir],
190 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
191 [ --with-gonk-toolchain-prefix=DIR
192 prefix to gonk toolchain commands],
193 gonk_toolchain_prefix=$withval)
195 if test -n "$gonkdir" ; then
196 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
197 android_source="$gonkdir"
198 ANDROID_SOURCE="$android_source"
199 ANDROID_NDK="${ANDROID_SOURCE}/ndk"
202 if test -n "${PLATFORM_SDK_VERSION}"; then
203 ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
207 TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
208 AS="$gonk_toolchain_prefix"as
209 CC="$gonk_toolchain_prefix"gcc
210 CXX="$gonk_toolchain_prefix"g++
211 CPP="$gonk_toolchain_prefix"cpp
212 LD="$gonk_toolchain_prefix"ld
213 AR="$gonk_toolchain_prefix"ar
214 RANLIB="$gonk_toolchain_prefix"ranlib
215 STRIP="$gonk_toolchain_prefix"strip
216 OBJCOPY="$gonk_toolchain_prefix"objcopy
218 if ! test -e "$gonkdir/ndk/sources/cxx-stl/stlport/src/iostream.cpp"; then
219 AC_MSG_ERROR([Couldn't find path to stlport sources in the gonk tree])
221 STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include"
222 STLPORT_LIBS="$_objdir/build/stlport/libstlport_static.a"
224 case "$target_cpu" in
233 case "$ANDROID_VERSION" in
235 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"
241 AC_SUBST(MOZ_OMX_DECODER)
245 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"
246 if test -d "$gonkdir/external/bluetooth/bluez"; then
247 GONK_INCLUDES="$GONK_INCLUDES -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
250 elif test -d "$gonkdir/external/bluetooth/bluedroid"; then
252 MOZ_B2G_BT_BLUEDROID=1
259 AC_SUBST(MOZ_OMX_DECODER)
261 AC_SUBST(MOZ_OMX_ENCODER)
262 AC_DEFINE(MOZ_OMX_ENCODER)
265 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"
268 MOZ_B2G_BT_BLUEDROID=1
273 AC_DEFINE(MOZ_OMX_ENCODER)
275 AC_SUBST(MOZ_AUDIO_OFFLOAD)
276 AC_DEFINE(MOZ_AUDIO_OFFLOAD)
280 AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
283 CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/hardware/libhardware/include -I$gonkdir/external/valgrind/fxos-include $GONK_INCLUDES $CPPFLAGS"
284 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
285 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
286 dnl Add -llog by default, since we use it all over the place.
289 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"
291 dnl prevent cross compile section from using these flags as host flags
292 if test -z "$HOST_CPPFLAGS" ; then
295 if test -z "$HOST_CFLAGS" ; then
298 if test -z "$HOST_CXXFLAGS" ; then
301 if test -z "$HOST_LDFLAGS" ; then
306 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
307 AC_SUBST(ANDROID_VERSION)
308 AC_DEFINE(HAVE_SYS_UIO_H)
309 AC_DEFINE(HAVE_PTHREADS)
310 MOZ_CHROME_FILE_FORMAT=omni
316 *-android*|*-linuxandroid*)
317 if test -z "$ANDROID_PACKAGE_NAME" ; then
318 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
320 MOZ_CHROME_FILE_FORMAT=omni
324 AC_PATH_PROG(OBJCOPY,objcopy)
329 AC_SUBST(ANDROID_SOURCE)
330 AC_SUBST(ANDROID_PACKAGE_NAME)
333 dnl ========================================================
334 dnl Checks for compilers.
335 dnl ========================================================
337 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
340 if test "$COMPILE_ENVIRONMENT"; then
342 if test "$target" != "$host"; then
348 # Work around the conftest.exe access problem on Windows
353 MOZ_PATH_PROGS(AS, $AS as, $CC)
354 AC_CHECK_PROGS(AR, ar, :)
355 AC_CHECK_PROGS(LD, ld, :)
356 AC_CHECK_PROGS(STRIP, strip, :)
357 AC_CHECK_PROGS(WINDRES, windres, :)
358 if test -z "$HOST_CC"; then
361 if test -z "$HOST_CFLAGS"; then
362 HOST_CFLAGS="$CFLAGS"
364 if test -z "$HOST_CXX"; then
367 if test -z "$HOST_CXXFLAGS"; then
368 HOST_CXXFLAGS="$CXXFLAGS"
370 if test -z "$HOST_LDFLAGS"; then
371 HOST_LDFLAGS="$LDFLAGS"
373 if test -z "$HOST_RANLIB"; then
374 HOST_RANLIB="$RANLIB"
376 if test -z "$HOST_AR"; then
379 if test -z "$HOST_AR_FLAGS"; then
380 HOST_AR_FLAGS="$AR_FLAGS"
384 if test -n "$MOZ_WINCONSOLE"; then
385 AC_DEFINE(MOZ_WINCONSOLE)
390 MOZ_CHECK_COMPILER_WRAPPER
392 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
393 if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
394 test "$GCC_MAJOR_VERSION" -lt 4; then
395 AC_MSG_ERROR([Only GCC 4.4 or newer supported])
399 dnl ========================================================
400 dnl Special win32 checks
401 dnl ========================================================
403 MOZ_ARG_ENABLE_BOOL(metro,
404 [ --enable-metro Enable Windows Metro build targets],
407 if test -n "$MOZ_METRO"; then
409 # Target the Windows 8 Kit
412 # toolkit/library/makefile.in needs these, see nsDllMain.
414 CRTEXPDLLVERSION=1-1-0
416 # Target the Windows 7 SDK by default
421 AC_SUBST(CRTDLLVERSION)
422 AC_SUBST(CRTEXPDLLVERSION)
424 MOZ_ARG_WITH_STRING(windows-version,
425 [ --with-windows-version=WINSDK_TARGETVER
426 Windows SDK version to target. Lowest version
427 currently allowed is 601 (Win7), highest is 602 (Win8)],
428 WINSDK_TARGETVER=$withval)
430 # Currently only two sdk versions allowed, 601 and 602
431 case "$WINSDK_TARGETVER" in
433 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
437 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
443 if test "$GCC" != "yes" -a -z "$CLANG_CC"; then
444 # Check to see if we are really running in a msvc environemnt
446 AC_CHECK_PROGS(MIDL, midl)
448 # Make sure compilers are valid
449 CFLAGS="$CFLAGS -TC -nologo"
450 CXXFLAGS="$CXXFLAGS -TP -nologo"
453 AC_TRY_COMPILE([#include <stdio.h>],
454 [ printf("Hello World\n"); ],,
455 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
458 AC_TRY_COMPILE([#include <new.h>],
459 [ unsigned *test = new unsigned(42); ],,
460 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
464 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
467 # Determine compiler version
468 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | cut -c 1-2`
469 _CC_MINOR_VERSION=`echo ${CC_VERSION} | cut -c 3-4`
470 _MSC_VER=${CC_VERSION}
472 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | cut -c 1-2`
474 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
475 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
478 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
479 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
481 if test "$_CC_MAJOR_VERSION" = "16"; then
484 elif test "$_CC_MAJOR_VERSION" = "17"; then
487 elif test "$_CC_MAJOR_VERSION" = "18"; then
491 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
493 AC_SUBST(MSVS_VERSION)
495 # Disable SEH on clang-cl because it doesn't implement them yet.
496 if test -z "$CLANG_CL"; then
497 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
500 if test -n "$WIN32_REDIST_DIR"; then
501 if test ! -d "$WIN32_REDIST_DIR"; then
502 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
504 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
507 dnl Confirm we have the pri tools on win8 builds
508 if test -n "$MOZ_METRO"; then
509 AC_MSG_CHECKING([for makepri])
510 AC_CHECK_PROGS(MAKEPRI, makepri, "")
511 if test -z "MAKEPRI" ; then
512 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
517 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
518 dnl not something else like "magnetic tape manipulation utility".
519 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
520 if test -z "$MSMT_TOOL"; then
521 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
525 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
527 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
528 if test -z "$MSMANIFEST_TOOL_VERSION"; then
529 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
535 # Check linker version
536 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
537 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
538 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
539 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
544 # Set midl environment
547 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
550 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
554 unset _MSVC_VER_FILTER
556 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
560 _SAVE_CXXFLAGS="$CXXFLAGS"
561 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
562 AC_TRY_COMPILE([#include <exception>],
563 [std::_Throw(std::exception()); return 0;],
564 ac_cv_have_std__Throw="yes",
565 ac_cv_have_std__Throw="no")
566 CXXFLAGS="$_SAVE_CXXFLAGS"
570 if test "$ac_cv_have_std__Throw" = "yes"; then
571 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
572 ac_cv_have_dllimport_exception_bug,
576 _SAVE_CXXFLAGS="$CXXFLAGS"
577 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
578 AC_TRY_LINK([#include <vector>],
579 [std::vector<int> v; return v.at(1);],
580 ac_cv_have_dllimport_exception_bug="no",
581 ac_cv_have_dllimport_exception_bug="yes")
582 CXXFLAGS="$_SAVE_CXXFLAGS"
585 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
587 MOZ_MSVC_STL_WRAP__Throw=1
588 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
591 AC_CACHE_CHECK(for overridable _RAISE,
596 _SAVE_CXXFLAGS="$CXXFLAGS"
597 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
598 AC_TRY_COMPILE([#include <xstddef>
600 #define _RAISE(x) externallyDefinedFunction((x).what())
603 [std::vector<int> v; return v.at(1);],
604 ac_cv_have__RAISE="no",
605 ac_cv_have__RAISE="yes")
606 CXXFLAGS="$_SAVE_CXXFLAGS"
609 if test "$ac_cv_have__RAISE" = "yes"; then
611 MOZ_MSVC_STL_WRAP__RAISE=1
612 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
614 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
618 if test "$WRAP_STL_INCLUDES" = "1"; then
619 STL_FLAGS='-I$(DIST)/stl_wrappers'
621 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
622 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
623 elif test -z "$CLANG_CC"; then
624 # Check w32api version
625 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
626 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
627 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
628 AC_TRY_COMPILE([#include <w32api.h>],
629 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
630 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
631 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
632 #error "test failed."
634 , [ res=yes ], [ res=no ])
635 AC_MSG_RESULT([$res])
636 if test "$res" != "yes"; then
637 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
639 # Check windres version
640 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
641 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
642 AC_MSG_RESULT([$_WINDRES_VERSION])
643 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
644 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
645 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
646 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
647 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
648 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
649 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
650 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
651 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
652 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
653 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
654 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
656 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
659 AC_CHECK_PROGS(MIDL, $target-widl widl)
660 if test -n "$MIDL"; then
663 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
666 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
671 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
672 # causing problems with local implementations with the same name.
673 AC_DEFINE(STRSAFE_NO_DEPRECATE)
675 MOZ_WINSDK_MAXVER=0x06020000
679 if test "$GCC" != "yes" -o -n "$CLANG_CC" ; then
680 MOZ_FIND_WINSDK_VERSION
683 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
684 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
685 # Require OS features provided by IE 6.0 SP2 (XP SP2)
686 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
688 # If the maximum version supported by this SDK is lower than the target
690 AC_MSG_CHECKING([for Windows SDK being recent enough])
691 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
695 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.])
698 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
699 # Definitions matching sdkddkver.h
700 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
701 AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
702 AC_SUBST(MOZ_WINSDK_MAXVER)
709 if test -n "$_WIN32_MSVC"; then
711 SKIP_COMPILER_CHECKS=1
712 SKIP_LIBRARY_CHECKS=1
714 # Since we're skipping compiler and library checks, hard-code
717 AC_DEFINE(HAVE_SETBUF)
718 AC_DEFINE(HAVE_ISATTY)
721 fi # COMPILE_ENVIRONMENT
734 AC_SUBST(WRAP_STL_INCLUDES)
735 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
736 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
738 dnl ========================================================
739 dnl Checks for programs.
740 dnl ========================================================
744 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
745 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
746 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
748 AC_MSG_RESULT([$_perl_version])
750 if test "$_perl_res" != 0; then
751 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
755 AC_MSG_CHECKING([for full perl installation])
756 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
758 if test "$_perl_res" != 0; then
760 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
765 if test -z "$COMPILE_ENVIRONMENT"; then
766 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
768 AC_SUBST(NSINSTALL_BIN)
770 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
771 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
772 MOZ_PATH_PROGS(UNZIP, unzip)
773 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
774 AC_MSG_ERROR([unzip not found in \$PATH])
776 MOZ_PATH_PROGS(ZIP, zip)
777 if test -z "$ZIP" -o "$ZIP" = ":"; then
778 AC_MSG_ERROR([zip not found in \$PATH])
780 MOZ_PATH_PROG(XARGS, xargs)
781 if test -z "$XARGS" -o "$XARGS" = ":"; then
782 AC_MSG_ERROR([xargs not found in \$PATH .])
785 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
788 if test "$COMPILE_ENVIRONMENT"; then
790 dnl ========================================================
791 dnl = Mac OS X toolchain support
792 dnl ========================================================
794 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
795 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
796 dnl when we can run target binaries.
797 AC_SUBST(UNIVERSAL_BINARY)
798 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
800 MOZ_ARG_WITH_STRING(unify-dist,
801 [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
803 if test -n "$UNIVERSAL_BINARY"; then
804 if test -z "$UNIFY_DIST"; then
805 AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
807 case "$UNIFY_DIST" in
811 UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
817 dnl ========================================================
818 dnl Check for MacOS deployment target version
819 dnl ========================================================
821 MOZ_ARG_ENABLE_STRING(macos-target,
822 [ --enable-macos-target=VER (default=10.6)
823 Set the minimum MacOS version needed at runtime],
824 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
828 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
829 dnl Use the specified value
830 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
832 dnl No value specified on the command line or in the environment,
833 dnl use architecture minimum.
834 export MACOSX_DEPLOYMENT_TARGET=10.6
839 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
841 dnl ========================================================
842 dnl = Mac OS X SDK support
843 dnl ========================================================
845 MOZ_ARG_WITH_STRING(macos-sdk,
846 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
847 MACOS_SDK_DIR=$withval)
849 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
850 MOZ_ARG_WITH_STRING(macos-private-frameworks,
851 [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)],
852 MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
853 MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
854 MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
856 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
857 if test -z "$CROSS_COMPILE"; then
858 AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
860 if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
861 AC_MSG_ERROR([PrivateFrameworks directory not found.])
865 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
866 AC_SUBST(MACOS_SDK_DIR)
867 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
869 if test "$MACOS_SDK_DIR"; then
870 dnl Sync this section with the ones in NSPR and NSS.
871 dnl Changes to the cross environment here need to be accounted for in
872 dnl the libIDL checks (below) and xpidl build.
874 if test ! -d "$MACOS_SDK_DIR"; then
875 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
876 specify a valid SDK. SDKs are installed when the optional cross-development
877 tools are selected during the Xcode/Developer Tools installation.])
880 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
881 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
883 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
884 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
885 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
888 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
890 AC_TRY_COMPILE([#include <new>],[],
894 AC_MSG_RESULT($result)
896 if test "$result" = "no" ; then
897 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
901 fi # COMPILE_ENVIRONMENT
903 if test -n "$MAKE"; then
904 if test `echo $MAKE | grep -c make.py` != 1; then
911 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
914 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
917 if test "$GMAKE" = ":"; then
918 AC_MSG_ERROR([GNU make not found])
922 if test -z "$MAKE"; then
926 if test "$COMPILE_ENVIRONMENT"; then
932 fi # COMPILE_ENVIRONMENT
934 dnl ========================================================
935 dnl set the defaults first
936 dnl ========================================================
952 MOZ_USER_DIR=".mozilla"
955 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
957 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
958 MOZ_PNG_CFLAGS="-I$_objdir/dist/include" # needed for freetype compilation
959 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
961 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
962 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
963 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
964 XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/bin)'
965 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)'
966 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
967 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
969 # These are specially defined on Windows only
972 XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
973 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
976 XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
977 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
983 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
987 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
989 if test -n "$CROSS_COMPILE"; then
990 OS_TARGET="${target_os}"
991 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
993 case "${target_os}" in
994 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
995 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU/kFreeBSD ;;
997 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
998 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
999 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1000 dragonfly*) OS_ARCH=DragonFly OS_TARGET=DragonFly ;;
1001 freebsd*) OS_ARCH=FreeBSD OS_TARGET=FreeBSD ;;
1002 netbsd*) OS_ARCH=NetBSD OS_TARGET=NetBSD ;;
1003 openbsd*) OS_ARCH=OpenBSD OS_TARGET=OpenBSD ;;
1006 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1009 OS_TARGET=`uname -s`
1010 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1011 OS_RELEASE=`uname -r`
1014 # Before this used `uname -m` when not cross compiling
1015 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1016 OS_TEST="${target_cpu}"
1018 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1020 #######################################################################
1021 # Master "Core Components" macros for getting the OS target #
1022 #######################################################################
1025 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1026 # cross-compilation.
1030 # Define and override various archtecture-specific variables, including
1039 case "$HOST_OS_ARCH" in
1050 HOST_OS_ARCH=GNU_kFreeBSD
1056 HOST_OS_ARCH=DragonFly
1059 HOST_OS_ARCH=FreeBSD
1065 HOST_OS_ARCH=OpenBSD
1071 if test -z "$GNU_CC"; then
1072 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1077 if test -z "$GNU_CXX"; then
1078 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1079 SOLARIS_SUNPRO_CXX=1
1082 AC_SUBST(SOLARIS_SUNPRO_CC)
1083 AC_SUBST(SOLARIS_SUNPRO_CXX)
1089 if test -z "$CROSS_COMPILE" ; then
1095 # If uname -s returns "Windows_NT", we assume that we are using
1096 # the uname.exe in MKS toolkit.
1098 # The -r option of MKS uname only returns the major version number.
1099 # So we need to use its -v option to get the minor version number.
1100 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1104 OS_MINOR_RELEASE=`uname -v`
1105 if test "$OS_MINOR_RELEASE" = "00"; then
1108 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1112 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1113 # the uname.exe in the MSYS tools.
1115 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1120 OS_RELEASE=`uname -v`.`uname -r`
1121 OS_TEST=${target_cpu}
1124 case "${target_cpu}" in
1135 if test -z "$CROSS_COMPILE" ; then
1143 # Only set CPU_ARCH if we recognize the value of OS_TEST
1150 powerpc64 | ppc64 | powerpc64le | ppc64le)
1154 powerpc | ppc | rs6000)
1158 Alpha | alpha | ALPHA)
1195 if test -z "$OS_TARGET"; then
1198 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1200 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1201 dnl ===============================================================
1205 INTEL_ARCHITECTURE=1
1208 dnl Configure platform-specific CPU architecture compiler options.
1209 dnl ==============================================================
1212 dnl =================================================================
1213 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1214 dnl which is bad when cross compiling.
1215 dnl =================================================================
1216 if test "$COMPILE_ENVIRONMENT"; then
1217 configure_static_assert_macros='
1218 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1219 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1220 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1223 dnl test that the macros actually work:
1224 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1225 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1228 ac_cv_static_assertion_macros_work="yes"
1229 AC_TRY_COMPILE([$configure_static_assert_macros],
1230 [CONFIGURE_STATIC_ASSERT(1)],
1232 ac_cv_static_assertion_macros_work="no")
1233 AC_TRY_COMPILE([$configure_static_assert_macros],
1234 [CONFIGURE_STATIC_ASSERT(0)],
1235 ac_cv_static_assertion_macros_work="no",
1238 AC_TRY_COMPILE([$configure_static_assert_macros],
1239 [CONFIGURE_STATIC_ASSERT(1)],
1241 ac_cv_static_assertion_macros_work="no")
1242 AC_TRY_COMPILE([$configure_static_assert_macros],
1243 [CONFIGURE_STATIC_ASSERT(0)],
1244 ac_cv_static_assertion_macros_work="no",
1248 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1249 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1250 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1252 fi # COMPILE_ENVIRONMENT
1254 dnl ========================================================
1255 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1257 dnl ========================================================
1261 dnl ========================================================
1262 dnl Suppress Clang Argument Warnings
1263 dnl ========================================================
1264 if test -n "$CLANG_CC"; then
1265 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1266 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1268 if test -n "$CLANG_CXX"; then
1269 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1272 dnl ========================================================
1273 dnl = Use Address Sanitizer
1274 dnl ========================================================
1275 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1276 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1279 if test -n "$MOZ_ASAN"; then
1282 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1285 AC_SUBST(LLVM_SYMBOLIZER)
1287 dnl ========================================================
1288 dnl = Enable hacks required for LLVM instrumentations
1289 dnl ========================================================
1290 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1291 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1294 if test -n "$MOZ_LLVM_HACKS"; then
1298 AC_SUBST(MOZ_NO_WLZDEFS)
1299 AC_SUBST(MOZ_CFLAGS_NSS)
1301 dnl ========================================================
1302 dnl GNU specific defaults
1303 dnl ========================================================
1304 if test "$GNU_CC"; then
1305 # Per bug 719659 comment 2, some of the headers on ancient build machines
1306 # may require gnu89 inline semantics. But otherwise, we use C99.
1307 # But on OS X we just use C99 plus GNU extensions, in order to fix
1309 CFLAGS="$CFLAGS -std=gnu99"
1310 if test "${OS_ARCH}" != Darwin; then
1311 CFLAGS="$CFLAGS -fgnu89-inline"
1313 # FIXME: Let us build with strict aliasing. bug 414641.
1314 CFLAGS="$CFLAGS -fno-strict-aliasing"
1315 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1316 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1317 WARNINGS_AS_ERRORS='-Werror'
1319 DSO_PIC_CFLAGS='-fPIC'
1320 ASFLAGS="$ASFLAGS -fPIC"
1321 AC_MSG_CHECKING([for --noexecstack option to as])
1322 _SAVE_CFLAGS=$CFLAGS
1323 CFLAGS="$CFLAGS -Wa,--noexecstack"
1324 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1325 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1326 AC_MSG_RESULT([no]))
1327 CFLAGS=$_SAVE_CFLAGS
1328 AC_MSG_CHECKING([for -z noexecstack option to ld])
1329 _SAVE_LDFLAGS=$LDFLAGS
1330 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1331 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1333 LDFLAGS=$_SAVE_LDFLAGS)
1335 AC_MSG_CHECKING([for -z text option to ld])
1336 _SAVE_LDFLAGS=$LDFLAGS
1337 LDFLAGS="$LDFLAGS -Wl,-z,text"
1338 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1339 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1341 LDFLAGS=$_SAVE_LDFLAGS)
1343 AC_MSG_CHECKING([for --build-id option to ld])
1344 _SAVE_LDFLAGS=$LDFLAGS
1345 LDFLAGS="$LDFLAGS -Wl,--build-id"
1346 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1347 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1349 LDFLAGS=$_SAVE_LDFLAGS)
1351 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
1352 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
1353 _SAVE_LDFLAGS=$LDFLAGS
1354 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
1355 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1356 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
1357 AC_MSG_RESULT([no]))
1358 LDFLAGS=$_SAVE_LDFLAGS
1360 # Check for -mssse3 on $CC
1361 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1362 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1363 _SAVE_CFLAGS=$CFLAGS
1364 CFLAGS="$CFLAGS -mssse3"
1365 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1366 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1367 AC_MSG_RESULT([no]))
1368 CFLAGS=$_SAVE_CFLAGS
1370 # Check for -msse4.1 on $CC
1371 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1372 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1373 _SAVE_CFLAGS=$CFLAGS
1374 CFLAGS="$CFLAGS -msse4.1"
1375 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1376 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1377 AC_MSG_RESULT([no]))
1378 CFLAGS=$_SAVE_CFLAGS
1380 case "${CPU_ARCH}" in
1382 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
1384 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
1385 result="yes", result="no")
1386 AC_MSG_RESULT("$result")
1387 if test "$result" = "yes"; then
1389 AC_DEFINE(HAVE_X86_AVX2)
1390 AC_SUBST(HAVE_X86_AVX2)
1394 DSO_LDOPTS='-shared'
1395 if test "$GCC_USE_GNU_LD"; then
1396 # Some tools like ASan use a runtime library that is only
1397 # linked against executables, so we must allow undefined
1398 # symbols for shared objects in some cases.
1399 if test -z "$MOZ_NO_WLZDEFS"; then
1400 # Don't allow undefined symbols in libraries
1401 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1403 # BSDs need `environ' exposed for posix_spawn (bug 753046)
1404 case "$OS_TARGET" in
1405 DragonFly|FreeBSD|NetBSD|OpenBSD)
1406 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
1407 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
1409 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
1416 # Turn on GNU-specific warnings:
1417 # -Wall - turn on a lot of warnings
1418 # -Wpointer-arith - good to have
1419 # -Wdeclaration-after-statement - MSVC doesn't like these
1420 # -Werror=return-type - catches missing returns, zero false positives
1421 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
1422 # -Wtype-limits - catches overflow bugs, few false positives
1423 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1424 # -Wsign-compare - catches comparison of signed and unsigned types
1426 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1427 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1428 MOZ_C_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_c_has_werror_int_to_pointer_cast)
1429 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1430 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1431 MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1433 # Turn off the following warnings that -Wall turns on:
1434 # -Wno-unused - lots of violations in third-party code
1436 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1438 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1439 # Don't use -Wcast-align with ICC or clang
1441 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1442 hppa | ia64 | sparc | arm)
1445 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1450 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1451 _USE_CPP_INCLUDE_FLAG=1
1452 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1454 elif test "$SOLARIS_SUNPRO_CC"; then
1456 if test "$CPU_ARCH" = "sparc"; then
1457 # for Sun Studio on Solaris/SPARC
1458 DSO_PIC_CFLAGS='-xcode=pic32'
1460 DSO_PIC_CFLAGS='-KPIC'
1462 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1464 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1465 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1467 DSO_LDOPTS='-shared'
1468 if test "$GNU_LD"; then
1469 # Don't allow undefined symbols in libraries
1470 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1474 DSO_PIC_CFLAGS='-KPIC'
1475 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1478 if test "$GNU_CXX"; then
1479 # FIXME: Let us build with strict aliasing. bug 414641.
1480 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1482 # Turn on GNU-specific warnings:
1483 # -Wall - turn on a lot of warnings
1484 # -Wpointer-arith - good to have
1485 # -Woverloaded-virtual - ???
1486 # -Werror=return-type - catches missing returns, zero false positives
1487 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
1488 # -Wtype-limits - catches overflow bugs, few false positives
1489 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1490 # -Wsign-compare - catches comparison of signed and unsigned types
1492 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1493 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1494 MOZ_CXX_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_cxx_has_werror_int_to_pointer_cast)
1495 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1496 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1497 MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1499 # Turn off the following warnings that -Wall turns on:
1500 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1501 # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc
1502 # for performance reasons, and because GCC and clang accept it (though
1503 # clang warns about it).
1505 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1506 MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete)
1508 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1509 # Don't use -Wcast-align with ICC or clang
1511 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1512 hppa | ia64 | sparc | arm)
1515 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1520 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1521 _USE_CPP_INCLUDE_FLAG=1
1523 # Recent clang and gcc support C++11 deleted functions without warnings if
1524 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1525 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1526 # unused. But clang's warning can be disabled, so when compiling with clang
1527 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1528 # deleted function syntax.
1529 if test "$CLANG_CXX"; then
1530 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1531 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1535 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1538 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1539 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1540 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1541 dnl normal behavior.
1542 dnl ========================================================
1544 MKSHLIB_UNFORCE_ALL=
1546 if test "$COMPILE_ENVIRONMENT"; then
1547 if test "$GNU_CC"; then
1548 AC_MSG_CHECKING(whether ld has archive extraction flags)
1549 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1550 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1551 ac_cv_mkshlib_force_and_unforce="no"
1552 exec 3<&0 <<LOOP_INPUT
1553 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1554 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1555 force="-Wl,-all"; unforce="-Wl,-none"
1562 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1565 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1567 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1571 eval $ac_cv_mkshlib_force_and_unforce
1572 MKSHLIB_FORCE_ALL=$force
1573 MKSHLIB_UNFORCE_ALL=$unforce
1576 fi # COMPILE_ENVIRONMENT
1578 dnl ========================================================
1579 dnl Checking for 64-bit OS
1580 dnl ========================================================
1581 if test "$COMPILE_ENVIRONMENT"; then
1584 AC_MSG_CHECKING(for 64-bit OS)
1585 AC_TRY_COMPILE([$configure_static_assert_macros],
1586 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1587 result="yes", result="no")
1588 AC_MSG_RESULT("$result")
1589 if test "$result" = "yes"; then
1590 AC_DEFINE(HAVE_64BIT_OS)
1593 AC_SUBST(HAVE_64BIT_OS)
1595 fi # COMPILE_ENVIRONMENT
1597 dnl ========================================================
1598 dnl = Use profiling compile flags
1599 dnl ========================================================
1600 MOZ_ARG_ENABLE_BOOL(profiling,
1601 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1605 dnl ========================================================
1606 dnl = Turn on systrace for android/b2g.
1607 dnl ========================================================
1608 MOZ_ARG_ENABLE_BOOL(systrace,
1609 [ --enable-systrace Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1612 if test -n "$MOZ_USE_SYSTRACE"; then
1613 AC_DEFINE(MOZ_USE_SYSTRACE)
1616 # For profiling builds keep the symbol information
1617 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1618 case "$OS_TARGET" in
1619 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1620 STRIP_FLAGS="--strip-debug"
1625 dnl ========================================================
1627 dnl ========================================================
1628 MOZ_ARG_ENABLE_BOOL(valgrind,
1629 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1632 if test -n "$MOZ_VALGRIND"; then
1633 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1635 [--enable-valgrind specified but Valgrind is not installed]))
1636 AC_DEFINE(MOZ_VALGRIND)
1638 AC_SUBST(MOZ_VALGRIND)
1640 dnl ========================================================
1642 dnl ========================================================
1643 MOZ_ARG_ENABLE_BOOL(jprof,
1644 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1647 if test -n "$MOZ_JPROF"; then
1649 AC_DEFINE(MOZ_JPROF)
1652 dnl ========================================================
1654 dnl ========================================================
1655 MOZ_ENABLE_PROFILER_SPS=1
1657 case "${OS_TARGET}" in
1659 case "${CPU_ARCH}" in
1662 MOZ_ENABLE_PROFILER_SPS=
1666 case "${CPU_ARCH}" in
1669 MOZ_ENABLE_PROFILER_SPS=
1674 MOZ_ENABLE_PROFILER_SPS=
1678 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1679 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1682 dnl ========================================================
1684 dnl ========================================================
1685 MOZ_ARG_ENABLE_BOOL(shark,
1686 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1689 if test -n "$MOZ_SHARK"; then
1691 AC_DEFINE(MOZ_SHARK)
1694 dnl ========================================================
1696 dnl ========================================================
1697 MOZ_ARG_ENABLE_BOOL(instruments,
1698 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
1701 if test -n "$MOZ_INSTRUMENTS"; then
1703 AC_DEFINE(MOZ_INSTRUMENTS)
1706 dnl ========================================================
1708 dnl ========================================================
1709 MOZ_ARG_ENABLE_BOOL(callgrind,
1710 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1713 if test -n "$MOZ_CALLGRIND"; then
1715 AC_DEFINE(MOZ_CALLGRIND)
1718 dnl ========================================================
1720 dnl ========================================================
1721 MOZ_ARG_ENABLE_BOOL(vtune,
1722 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1725 if test -n "$MOZ_VTUNE"; then
1727 AC_DEFINE(MOZ_VTUNE)
1730 dnl ========================================================
1732 dnl ========================================================
1733 if test -n "$MOZ_PROFILING"; then
1734 AC_DEFINE(MOZ_PROFILING)
1737 dnl ========================================================
1738 dnl System overrides of the defaults for host
1739 dnl ========================================================
1742 if test -n "$_WIN32_MSVC"; then
1744 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
1745 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
1746 HOST_RANLIB='echo ranlib'
1748 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1750 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1751 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1752 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1753 HOST_BIN_SUFFIX=.exe
1756 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1760 case "${host_cpu}" in
1762 if test -n "$_WIN32_MSVC"; then
1763 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1767 if test -n "$_WIN32_MSVC"; then
1768 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1770 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1776 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1777 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1778 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1781 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1782 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1783 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1784 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1788 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1789 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1793 dnl Check for using a custom <inttypes.h> implementation
1794 dnl ========================================================
1795 AC_MSG_CHECKING(for custom <inttypes.h> implementation)
1796 if test "$MOZ_CUSTOM_INTTYPES_H"; then
1797 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
1798 AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
1800 AC_MSG_RESULT(none specified)
1803 dnl Get mozilla version from central milestone file
1804 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1805 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1806 MOZILLA_SYMBOLVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -symbolversion`
1808 dnl Get version of various core apps from the version files.
1809 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1811 if test -z "$FIREFOX_VERSION"; then
1812 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1815 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1816 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1817 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1818 AC_SUBST(MOZILLA_SYMBOLVERSION)
1820 MOZ_DOING_LTO(lto_is_enabled)
1822 dnl ========================================================
1823 dnl System overrides of the defaults for target
1824 dnl ========================================================
1829 if test ! "$GNU_CC"; then
1830 if test ! "$HAVE_64BIT_OS"; then
1831 # Compiling with Visual Age C++ object model compat is the
1832 # default. To compile with object model ibm, add
1833 # AIX_OBJMODEL=ibm to .mozconfig.
1834 if test "$AIX_OBJMODEL" = "ibm"; then
1835 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1842 AC_SUBST(AIX_OBJMODEL)
1843 DSO_LDOPTS='-qmkshrobj=1'
1844 DSO_CFLAGS='-qflag=w:w'
1846 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1848 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1849 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1850 if test "$COMPILE_ENVIRONMENT"; then
1853 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1855 [#if (__IBMCPP__ < 900)
1856 #error "Bad compiler"
1858 _BAD_COMPILER=,_BAD_COMPILER=1)
1859 if test -n "$_BAD_COMPILER"; then
1861 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1863 AC_MSG_RESULT([yes])
1866 TARGET_COMPILER_ABI="ibmc"
1867 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1868 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1871 case "${target_os}" in
1876 if test "$COMPILE_ENVIRONMENT"; then
1877 MOZ_CHECK_HEADERS(sys/inttypes.h)
1879 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1883 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1884 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1885 MOZ_OPTIMIZE_FLAGS="-O3"
1886 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1887 if test "$HAVE_64BIT_OS"; then
1892 STRIP_FLAGS="$STRIP_FLAGS -x -S"
1893 # Check whether we're targeting OS X or iOS
1894 AC_CACHE_CHECK(for iOS target,
1896 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1897 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1901 ac_cv_ios_target="yes",
1902 ac_cv_ios_target="no")])
1903 if test "$ac_cv_ios_target" = "yes"; then
1905 AC_DEFINE(XP_DARWIN)
1906 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1908 AC_DEFINE(XP_MACOSX)
1909 AC_DEFINE(XP_DARWIN)
1910 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1911 # The ExceptionHandling framework is needed for Objective-C exception
1912 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1914 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1916 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1922 if test "x$lto_is_enabled" = "xyes"; then
1923 echo "Skipping -dead_strip because lto is enabled."
1924 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1925 dnl ===================================================================
1926 elif test "x$enable_dtrace" = "xyes"; then
1927 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1929 dnl check for the presence of the -dead_strip linker flag
1930 AC_MSG_CHECKING([for -dead_strip option to ld])
1931 _SAVE_LDFLAGS=$LDFLAGS
1932 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1933 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1934 if test -n "$_HAVE_DEAD_STRIP" ; then
1935 AC_MSG_RESULT([yes])
1936 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1941 LDFLAGS=$_SAVE_LDFLAGS
1944 dnl With newer linkers we need to pass -allow_heap_execute because of
1945 dnl Microsoft Silverlight (5.1.10411.0 at least).
1946 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1947 _SAVE_LDFLAGS=$LDFLAGS
1948 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1949 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1950 _HAVE_ALLOW_HEAP_EXECUTE=)
1951 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1952 AC_MSG_RESULT([yes])
1953 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1957 LDFLAGS=$_SAVE_LDFLAGS
1959 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1964 if test ! "$GNU_CC"; then
1968 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1969 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1970 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1973 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1974 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1977 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1978 AC_DEFINE(_LARGEFILE64_SOURCE)
1983 if test ! "$GNU_CC"; then
1984 DSO_LDOPTS='-b -Wl,+s'
1987 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1988 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1989 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1991 DSO_LDOPTS='-b -E +s'
1992 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1993 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1995 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1996 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1999 *-android*|*-linuxandroid*)
2000 AC_DEFINE(NO_PW_GECOS)
2002 if test -n "$gonkdir"; then
2003 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2004 _PLATFORM_HAVE_RIL=1
2008 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2011 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2017 MOZ_GFX_OPTIMIZE_MOBILE=1
2018 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2022 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2023 # Similarly for GNU_CXX and INTEL_CXX.
2024 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2025 # -Os has been broken on Intel's C/C++ compilers for quite a
2026 # while; Intel recommends against using it.
2027 MOZ_OPTIMIZE_FLAGS="-O2"
2028 elif test "$GNU_CC" -o "$GNU_CXX"; then
2029 case $GCC_VERSION in
2031 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
2032 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2034 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2035 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2042 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2046 case "${target_cpu}" in
2048 CFLAGS="$CFLAGS -mieee"
2049 CXXFLAGS="$CXXFLAGS -mieee"
2053 if test -z "$MC"; then
2063 # certain versions of cygwin's makedepend barf on the
2064 # #include <string> vs -I./dist/include/string issue so don't use it
2065 XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)'
2066 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
2068 CXX="$CXX -mwindows"
2069 CPP="$CPP -mwindows"
2070 CFLAGS="$CFLAGS -mms-bitfields"
2071 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2072 DSO_LDOPTS='-shared'
2073 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2074 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2076 # Use static libgcc and libstdc++
2077 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
2078 NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
2079 # Use temp file for windres (bug 213281)
2080 RCFLAGS='-O coff --use-temp-file'
2081 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2082 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2085 IMPORT_LIB_SUFFIX=dll.a
2091 # We use mix of both POSIX and Win32 printf format across the tree, so format
2092 # warnings are useless on mingw.
2093 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2094 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2096 TARGET_COMPILER_ABI=msvc
2100 if test "$AS_BIN"; then
2101 AS="$(basename "$AS_BIN")"
2104 AR_FLAGS='-NOLOGO -OUT:$@'
2106 RANLIB='echo not_ranlib'
2107 STRIP='echo not_strip'
2118 IMPORT_LIB_SUFFIX=lib
2119 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2120 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2122 MKSHLIB_UNFORCE_ALL=
2123 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2124 _USE_CPP_INCLUDE_FLAG=1
2125 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2126 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2127 CFLAGS="$CFLAGS -W3 -Gy"
2128 CXXFLAGS="$CXXFLAGS -W3 -Gy"
2129 if test "$_CC_SUITE" -ge "12"; then
2130 dnl VS2013+ requires -FS when parallel building by make -jN.
2131 dnl If nothing, compiler sometimes causes C1041 error.
2133 dnl Visual Studio 2013 supports -Gw flags
2134 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
2135 CFLAGS="$CFLAGS -FS -Gw"
2136 CXXFLAGS="$CXXFLAGS -FS -Gw"
2138 # khuey says we can safely ignore MSVC warning C4251
2139 # MSVC warning C4244 (implicit type conversion may lose data) warns
2140 # and requires workarounds for perfectly valid code. Also, GCC/clang
2141 # don't warn about it by default. So for consistency/sanity, we turn
2142 # it off on MSVC, too.
2143 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2144 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2145 # MSVC warning C4482 warns when an enum value is refered specifing the
2146 # name of the enum itself. This behavior is allowed in C++11, and the
2147 # warning has been removed in VS2012.
2148 # MSVC warning C4800 warns when a value is implicitly cast to bool,
2149 # because this also forces narrowing to a single byte, which can be a
2150 # perf hit. But this matters so little in practice (and often we want
2151 # that behavior) that it's better to turn it off.
2152 # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2153 # on non-Western system locales even if it is in a comment.
2154 CFLAGS="$CFLAGS -wd4244 -wd4819"
2155 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2156 # make 'foo == bar;' error out
2157 CFLAGS="$CFLAGS -we4553"
2158 CXXFLAGS="$CXXFLAGS -we4553"
2159 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2160 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2161 WARNINGS_AS_ERRORS='-WX'
2162 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
2164 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2165 # Disable these flags on clang-cl since it doesn't ignore unknown arguments by default, and
2166 # autoconf insists on passing $LDFLAGS to the compiler.
2167 if test -z "$CLANG_CL"; then
2168 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2170 if test -z "$DEVELOPER_OPTIONS"; then
2171 LDFLAGS="$LDFLAGS -RELEASE"
2173 dnl For profile-guided optimization
2174 PROFILE_GEN_CFLAGS="-GL"
2175 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2176 dnl XXX: PGO builds can fail with warnings treated as errors,
2177 dnl specifically "no profile data available" appears to be
2178 dnl treated as an error sometimes. This might be a consequence
2179 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2180 dnl with the linker doing most of the work in the whole-program
2181 dnl optimization/PGO case. I think it's probably a compiler bug,
2182 dnl but we work around it here.
2183 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2184 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2185 dnl Probably also a compiler bug, but what can you do?
2186 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2187 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2188 dnl Minimum reqiurement of Gecko is VS2010 or later which supports
2189 dnl both SSSE3 and SSE4.1.
2190 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2191 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
2194 AC_DEFINE(HAVE_SNPRINTF)
2199 AC_DEFINE(HW_THREADS)
2200 AC_DEFINE(STDC_HEADERS)
2201 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2202 TARGET_MD_ARCH=win32
2203 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2205 MOZ_USER_DIR="Mozilla"
2207 dnl Hardcode to win95 for now - cls
2208 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2210 dnl set NO_X11 defines here as the general check is skipped on win32
2216 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2217 if test -n "$L10NBASEDIR"; then
2218 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2225 if test -z "$MOZ_TOOLS"; then
2226 AC_MSG_ERROR([MOZ_TOOLS is not set])
2228 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2229 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2230 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2232 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2233 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2234 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2241 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.])
2247 if test "$HAVE_64BIT_OS"; then
2248 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2251 if test -n "$GNU_CC"; then
2252 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2253 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2254 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2256 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2257 # Disable this flag on clang-cl since it doesn't ignore unknown arguments by default, and
2258 # autoconf insists on passing $LDFLAGS to the compiler.
2259 if test -z "$CLANG_CL"; then
2260 LDFLAGS="$LDFLAGS -SAFESEH"
2267 if test -n "$_WIN32_MSVC"; then
2268 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2273 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2280 CFLAGS="$CFLAGS -Dunix"
2281 CXXFLAGS="$CXXFLAGS -Dunix"
2282 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2284 DSO_PIC_CFLAGS='-fPIC -DPIC'
2285 DSO_LDOPTS='-shared'
2286 BIN_FLAGS='-Wl,--export-dynamic'
2288 DSO_PIC_CFLAGS='-fPIC -DPIC'
2289 DLL_SUFFIX=".so.1.0"
2290 DSO_LDOPTS='-shared'
2292 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2293 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2294 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2295 if test "$LIBRUNPATH"; then
2296 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2298 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
2299 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@)) -o $@'
2306 if test "$SO_VERSION"; then
2307 DLL_SUFFIX=".so.$SO_VERSION"
2309 DLL_SUFFIX=".so.1.0"
2311 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2313 DSO_PIC_CFLAGS='-fPIC'
2314 DSO_LDOPTS='-shared -fPIC'
2315 if test "$LIBRUNPATH"; then
2316 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2325 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2327 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2328 # libraries one level up (e.g. libnspr4.so)
2329 if test "$SOLARIS_SUNPRO_CC"; then
2330 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2331 LIBS="-lCrun -lCstd -lc $LIBS"
2332 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2333 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2334 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2335 LDFLAGS="-xildoff $LDFLAGS"
2336 MMX_FLAGS="-xarch=mmx -xO4"
2337 SSE_FLAGS="-xarch=sse"
2338 SSE2_FLAGS="-xarch=ssei2 -xO4"
2339 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2340 _SAVE_LDFLAGS=$LDFLAGS
2341 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2342 AC_TRY_LINK([#include <stdio.h>],
2343 [printf("Hello World\n");],
2345 [LDFLAGS=$_SAVE_LDFLAGS])
2347 MOZ_OPTIMIZE_FLAGS="-xO4"
2348 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2349 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2350 MKSHLIB_FORCE_ALL='-z allextract'
2351 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2358 AS='/usr/ccs/bin/as'
2359 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2361 TARGET_COMPILER_ABI="sunc"
2362 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2363 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2364 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2368 [#if (__SUNPRO_CC < 0x590)
2371 _BAD_COMPILER=,_BAD_COMPILER=1)
2372 if test -n "$_BAD_COMPILER"; then
2374 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2379 [#if (__SUNPRO_CC >= 0x5100)
2380 #error "Sun C++ 5.10 or above"
2382 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2383 if test "$_ABOVE_SS12U1"; then
2385 CXXFLAGS="$CXXFLAGS -xannotate=no"
2387 AC_MSG_RESULT([$_res])
2390 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2392 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2393 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2394 ASFLAGS="$ASFLAGS -fPIC"
2395 DSO_LDOPTS='-shared'
2396 WARNINGS_AS_ERRORS='-Werror'
2398 _WARNINGS_CXXFLAGS=''
2399 if test "$OS_RELEASE" = "5.3"; then
2400 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2406 if test "$OS_RELEASE" = "5.5.1"; then
2407 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2412 DSO_LDOPTS='-Bdynamic'
2413 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2414 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2416 AC_DEFINE(SPRINTF_RETURNS_STRING)
2417 case "$(target_os)" in
2419 DLL_SUFFIX='.so.1.0'
2426 AC_SUBST_LIST(MMX_FLAGS)
2427 AC_SUBST_LIST(SSE_FLAGS)
2428 AC_SUBST_LIST(SSE2_FLAGS)
2432 # Includes linux-android
2437 AC_SUBST(MOZ_LINKER)
2438 if test -n "$MOZ_LINKER"; then
2439 AC_DEFINE(MOZ_LINKER)
2442 dnl Only one oddball right now (QNX), but this gives us flexibility
2443 dnl if any other platforms need to override this in the future.
2444 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2446 dnl ========================================================
2447 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2448 dnl by now will not have any way to link most binaries (tests
2449 dnl as well as viewer, apprunner, etc.), because some symbols
2450 dnl will be left out of the "composite" .so's by ld as unneeded.
2451 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2452 dnl they can link in the static libs that provide the missing
2454 dnl ========================================================
2455 NO_LD_ARCHIVE_FLAGS=
2456 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2457 NO_LD_ARCHIVE_FLAGS=1
2461 NO_LD_ARCHIVE_FLAGS=
2464 if test -z "$GNU_CC"; then
2465 NO_LD_ARCHIVE_FLAGS=
2469 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2471 dnl ========================================================
2472 dnl = Flags to strip unused symbols from .so components and
2473 dnl = to export jemalloc symbols when linking a program
2474 dnl ========================================================
2476 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2477 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2480 if test -z "$GNU_CC"; then
2481 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2483 if test -z "$GCC_USE_GNU_LD"; then
2484 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2486 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2491 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2494 if test -n "$GNU_CC"; then
2495 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2500 if test -z "$COMPILE_ENVIRONMENT"; then
2501 SKIP_COMPILER_CHECKS=1
2502 SKIP_LIBRARY_CHECKS=1
2507 if test -z "$SKIP_COMPILER_CHECKS"; then
2508 dnl Checks for typedefs, structures, and compiler characteristics.
2509 dnl ========================================================
2518 AC_MSG_CHECKING(for ssize_t)
2519 AC_CACHE_VAL(ac_cv_type_ssize_t,
2520 [AC_TRY_COMPILE([#include <stdio.h>
2521 #include <sys/types.h>],
2523 [ac_cv_type_ssize_t=true],
2524 [ac_cv_type_ssize_t=false])])
2525 if test "$ac_cv_type_ssize_t" = true ; then
2526 AC_DEFINE(HAVE_SSIZE_T)
2531 AC_STRUCT_ST_BLKSIZE
2532 AC_MSG_CHECKING(for siginfo_t)
2533 AC_CACHE_VAL(ac_cv_siginfo_t,
2534 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2535 #include <signal.h>],
2537 [ac_cv_siginfo_t=true],
2538 [ac_cv_siginfo_t=false])])
2539 if test "$ac_cv_siginfo_t" = true ; then
2540 AC_DEFINE(HAVE_SIGINFO_T)
2552 dnl Check for .hidden assembler directive and visibility attribute.
2553 dnl Borrowed from glibc configure.in
2554 dnl ===============================================================
2555 if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
2556 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2557 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2558 case "$OS_TARGET" in
2560 VISIBILITY_FLAGS='-fvisibility=hidden'
2563 case $GCC_VERSION in
2565 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden_dso_handle.h'
2568 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2571 WRAP_SYSTEM_INCLUDES=1
2576 # visibility hidden flag for Sun Studio on Solaris
2577 if test "$SOLARIS_SUNPRO_CC"; then
2578 VISIBILITY_FLAGS='-xldscope=hidden'
2579 fi # Sun Studio on Solaris
2581 case "${OS_TARGET}" in
2582 WINNT|Darwin|Android)
2585 STL_FLAGS='-I$(DIST)/stl_wrappers'
2590 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2591 AC_SUBST(VISIBILITY_FLAGS)
2595 if test "$OS_TARGET" != WINNT; then
2596 # Only run this test with clang on non-Windows platforms, because clang
2597 # cannot do enough code gen for now to make this test work correctly.
2601 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2602 dnl ========================================================
2603 if test "$GNU_CC"; then
2604 CFLAGS_save="${CFLAGS}"
2605 CFLAGS="${CFLAGS} -Werror"
2606 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2607 ac_cv_force_align_arg_pointer,
2608 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2610 ac_cv_force_align_arg_pointer="yes",
2611 ac_cv_force_align_arg_pointer="no")])
2612 CFLAGS="${CFLAGS_save}"
2613 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2614 HAVE_GCC_ALIGN_ARG_POINTER=1
2616 HAVE_GCC_ALIGN_ARG_POINTER=
2619 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2621 dnl Checks for header files.
2622 dnl ========================================================
2624 case "$target_os" in
2626 # for stuff like -lXshm
2627 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2630 MOZ_CHECK_COMMON_HEADERS
2632 dnl These are all the places some variant of statfs can be hiding.
2633 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2636 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2637 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2639 dnl SCTP support - needs various network include headers
2640 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2642 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2644 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2645 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2646 ac_cv_sockaddr_in_sin_len,
2647 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2648 #include <sys/types.h>
2650 #include <netinet/in.h>
2651 struct sockaddr_in x;
2652 void *foo = (void*) &x.sin_len;],
2654 [ac_cv_sockaddr_in_sin_len=true],
2655 [ac_cv_sockaddr_in_sin_len=false])])
2656 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2657 AC_DEFINE(HAVE_SIN_LEN)
2658 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2659 AC_DEFINE(HAVE_SCONN_LEN)
2662 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2663 ac_cv_sockaddr_in6_sin6_len,
2664 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2665 #include <sys/types.h>
2667 #include <netinet/in.h>
2668 struct sockaddr_in6 x;
2669 void *foo = (void*) &x.sin6_len;],
2671 [ac_cv_sockaddr_in6_sin6_len=true],
2672 [ac_cv_sockaddr_in6_sin6_len=false])])
2673 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2674 AC_DEFINE(HAVE_SIN6_LEN)
2677 AC_CACHE_CHECK(for sockaddr.sa_len,
2678 ac_cv_sockaddr_sa_len,
2679 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2680 #include <sys/types.h>
2682 #include <sys/socket.h>
2684 void *foo = (void*) &x.sa_len;],
2686 [ac_cv_sockaddr_sa_len=true],
2687 [ac_cv_sockaddr_sa_len=false])])
2688 if test "$ac_cv_sockaddr_sa_len" = true ; then
2689 AC_DEFINE(HAVE_SA_LEN)
2692 AC_ARG_ENABLE(dtrace,
2693 [ --enable-dtrace build with dtrace support if available (default=no)],
2694 [enable_dtrace="yes"],)
2695 if test "x$enable_dtrace" = "xyes"; then
2696 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2697 if test -n "$HAVE_DTRACE"; then
2698 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2700 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2703 AC_SUBST(HAVE_DTRACE)
2709 MOZ_CHECK_HEADERS(sys/cdefs.h)
2713 MOZ_LINUX_PERF_EVENT
2715 dnl Checks for libraries.
2716 dnl ========================================================
2721 AC_CHECK_LIB(c_r, gethostbyname_r)
2725 dnl We don't want to link with libdl even if it's present on OS X, since
2726 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2728 dnl We don't want to link against libm or libpthread on Darwin since
2729 dnl they both are just symlinks to libSystem and explicitly linking
2730 dnl against libSystem causes issues when debugging (see bug 299601).
2735 AC_SEARCH_LIBS(dlopen, dl,
2736 MOZ_CHECK_HEADER(dlfcn.h,
2737 AC_DEFINE(HAVE_DLOPEN)))
2741 _SAVE_CFLAGS="$CFLAGS"
2742 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2743 AC_CHECK_FUNCS(dladdr memmem)
2744 CFLAGS="$_SAVE_CFLAGS"
2746 if test ! "$GNU_CXX"; then
2750 AC_CHECK_LIB(C_r, demangle)
2753 AC_CHECK_LIB(C, demangle)
2758 AC_CHECK_LIB(socket, socket)
2761 XLIBS="$X_EXTRA_LIBS"
2763 dnl ========================================================
2764 dnl Checks for X libraries.
2765 dnl Ordering is important.
2766 dnl Xt is dependent upon SM as of X11R6
2767 dnl ========================================================
2768 if test "$no_x" = "yes"; then
2771 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2772 XLIBS="-lX11 $XLIBS"
2773 _SAVE_LDFLAGS="$LDFLAGS"
2774 LDFLAGS="$XLDFLAGS $LDFLAGS"
2775 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2776 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2777 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2778 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2780 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2781 unset ac_cv_lib_Xt_XtFree
2782 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2783 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
2784 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2785 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2788 # AIX needs the motif library linked before libXt to prevent
2789 # crashes in plugins linked against Motif - Bug #98892
2790 case "${target_os}" in
2792 XT_LIBS="-lXm $XT_LIBS"
2796 dnl ========================================================
2797 dnl = Check for XShm
2798 dnl ========================================================
2799 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
2802 dnl ========================================================
2804 dnl ========================================================
2805 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
2806 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
2807 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
2808 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
2810 LDFLAGS="$_SAVE_LDFLAGS"
2820 dnl ========================================================
2821 dnl = pthread support
2822 dnl = Start by checking whether the system support pthreads
2823 dnl ========================================================
2824 case "$target_os" in
2829 MOZ_CHECK_PTHREADS(pthreads,
2830 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2831 MOZ_CHECK_PTHREADS(pthread,
2832 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2833 MOZ_CHECK_PTHREADS(c_r,
2834 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2835 MOZ_CHECK_PTHREADS(c,
2844 dnl ========================================================
2845 dnl Check the command line for --with-pthreads
2846 dnl ========================================================
2847 MOZ_ARG_WITH_BOOL(pthreads,
2848 [ --with-pthreads Force use of system pthread library with NSPR ],
2849 [ if test "$MOZ_USE_PTHREADS"x = x; then
2850 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2856 dnl ========================================================
2857 dnl Do the platform specific pthread hackery
2858 dnl ========================================================
2859 if test "$MOZ_USE_PTHREADS"x != x
2862 dnl See if -pthread is supported.
2865 ac_cv_have_dash_pthread=no
2866 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2867 echo 'int main() { return 0; }' | cat > conftest.c
2868 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2869 if test $? -eq 0; then
2870 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2871 ac_cv_have_dash_pthread=yes
2872 case "$target_os" in
2874 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2877 CFLAGS="$CFLAGS -pthread"
2878 CXXFLAGS="$CXXFLAGS -pthread"
2884 AC_MSG_RESULT($ac_cv_have_dash_pthread)
2887 dnl See if -pthreads is supported.
2889 ac_cv_have_dash_pthreads=no
2890 if test "$ac_cv_have_dash_pthread" = "no"; then
2891 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2892 echo 'int main() { return 0; }' | cat > conftest.c
2893 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2894 if test $? -eq 0; then
2895 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2896 ac_cv_have_dash_pthreads=yes
2897 CFLAGS="$CFLAGS -pthreads"
2898 CXXFLAGS="$CXXFLAGS -pthreads"
2902 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2907 AC_DEFINE(_REENTRANT)
2908 AC_DEFINE(_THREAD_SAFE)
2909 dnl -pthread links in -lpthread, so don't specify it explicitly.
2910 if test "$ac_cv_have_dash_pthread" = "yes"; then
2911 _PTHREAD_LDFLAGS="-pthread"
2915 *-*-openbsd*|*-*-bsdi*)
2916 AC_DEFINE(_REENTRANT)
2917 AC_DEFINE(_THREAD_SAFE)
2918 dnl -pthread links in -lc_r, so don't specify it explicitly.
2919 if test "$ac_cv_have_dash_pthread" = "yes"; then
2920 _PTHREAD_LDFLAGS="-pthread"
2924 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
2925 AC_DEFINE(_REENTRANT)
2929 AC_DEFINE(_REENTRANT)
2933 AC_DEFINE(_REENTRANT)
2937 AC_DEFINE(_REENTRANT)
2938 if test "$SOLARIS_SUNPRO_CC"; then
2939 CFLAGS="$CFLAGS -mt"
2940 CXXFLAGS="$CXXFLAGS -mt"
2944 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
2945 AC_SUBST(MOZ_USE_PTHREADS)
2949 dnl Checks for library functions.
2950 dnl ========================================================
2951 AC_PROG_GCC_TRADITIONAL
2953 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r)
2955 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
2956 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
2957 ac_cv_clock_monotonic,
2958 [for libs in "" -lrt; do
2961 AC_TRY_LINK([#include <time.h>],
2962 [ struct timespec ts;
2963 clock_gettime(CLOCK_MONOTONIC, &ts); ],
2964 ac_cv_clock_monotonic=$libs
2967 ac_cv_clock_monotonic=no)
2970 if test "$ac_cv_clock_monotonic" != "no"; then
2971 HAVE_CLOCK_MONOTONIC=1
2972 REALTIME_LIBS=$ac_cv_clock_monotonic
2973 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
2974 AC_SUBST(HAVE_CLOCK_MONOTONIC)
2975 AC_SUBST(REALTIME_LIBS)
2978 dnl check for wcrtomb/mbrtowc
2979 dnl =======================================================================
2980 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
2983 AC_CACHE_CHECK(for wcrtomb,
2985 [AC_TRY_LINK([#include <wchar.h>],
2986 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
2987 ac_cv_have_wcrtomb="yes",
2988 ac_cv_have_wcrtomb="no")])
2989 if test "$ac_cv_have_wcrtomb" = "yes"; then
2990 AC_DEFINE(HAVE_WCRTOMB)
2992 AC_CACHE_CHECK(for mbrtowc,
2994 [AC_TRY_LINK([#include <wchar.h>],
2995 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
2996 ac_cv_have_mbrtowc="yes",
2997 ac_cv_have_mbrtowc="no")])
2998 if test "$ac_cv_have_mbrtowc" = "yes"; then
2999 AC_DEFINE(HAVE_MBRTOWC)
3006 ac_cv_func_res_ninit,
3007 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
3008 dnl no need for res_ninit() on NetBSD and OpenBSD
3009 ac_cv_func_res_ninit=no
3013 #define _BSD_SOURCE 1
3015 #include <sys/types.h>
3016 #include <netinet/in.h>
3017 #include <arpa/nameser.h>
3020 [int foo = res_ninit(&_res);],
3021 [ac_cv_func_res_ninit=yes],
3022 [ac_cv_func_res_ninit=no])
3026 if test "$ac_cv_func_res_ninit" = "yes"; then
3027 AC_DEFINE(HAVE_RES_NINIT)
3028 dnl must add the link line we do something as foolish as this... dougt
3030 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3031 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3041 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3042 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3043 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3045 LIBS="$LIBS $_ICONV_LIBS"
3054 iconv_t h = iconv_open("", "");
3055 iconv(h, NULL, NULL, NULL, NULL);
3058 [ac_cv_func_iconv=yes],
3059 [ac_cv_func_iconv=no]
3062 if test "$ac_cv_func_iconv" = "yes"; then
3063 AC_DEFINE(HAVE_ICONV)
3064 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3065 LIBICONV="$_ICONV_LIBS"
3067 [for iconv() with const input],
3068 ac_cv_func_const_iconv,
3074 const char *input = "testing";
3075 iconv_t h = iconv_open("", "");
3076 iconv(h, &input, NULL, NULL, NULL);
3079 [ac_cv_func_const_iconv=yes],
3080 [ac_cv_func_const_iconv=no]
3083 if test "$ac_cv_func_const_iconv" = "yes"; then
3084 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3096 dnl **********************
3097 dnl *** va_copy checks ***
3098 AC_CACHE_CHECK([for an implementation of va_copy()],
3100 [AC_TRY_COMPILE([#include <stdarg.h>
3102 void f (int i, ...) {
3103 va_list args1, args2;
3104 va_start (args1, i);
3105 va_copy (args2, args1);
3106 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3108 va_end (args1); va_end (args2);
3110 [f(0, 42); return 0],
3111 [ac_cv_va_copy=yes],
3115 AC_CACHE_CHECK([whether va_list can be copied by value],
3117 [AC_TRY_COMPILE([#include <stdarg.h>
3119 void f (int i, ...) {
3120 va_list args1, args2;
3121 va_start (args1, i);
3123 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3125 va_end (args1); va_end (args2);
3127 [f(0, 42); return 0],
3128 [ac_cv_va_val_copy=yes],
3129 [ac_cv_va_val_copy=no],
3132 if test "x$ac_cv_va_copy" = "xyes"; then
3133 AC_DEFINE(VA_COPY, va_copy)
3134 AC_DEFINE(HAVE_VA_COPY)
3137 if test "x$ac_cv_va_val_copy" = "xno"; then
3138 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3141 dnl ===================================================================
3142 dnl ========================================================
3143 dnl Put your C++ language/feature checks below
3144 dnl ========================================================
3148 if test "$GNU_CC"; then
3149 if test "$CPU_ARCH" = "arm" ; then
3150 AC_CACHE_CHECK(for ARM EABI,
3154 #if defined(__ARM_EABI__)
3157 #error Not ARM EABI.
3160 ac_cv_gcc_arm_eabi="yes",
3161 ac_cv_gcc_arm_eabi="no")])
3162 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3164 ARM_ABI_PREFIX=eabi-
3166 ARM_ABI_PREFIX=oabi-
3170 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3173 dnl Check to see if we can resolve ambiguity with |using|.
3174 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3175 ac_cv_cpp_ambiguity_resolving_using,
3176 [AC_TRY_COMPILE(class X {
3177 public: int go(const X&) {return 3;}
3178 int jo(const X&) {return 3;}
3180 class Y : public X {
3181 public: int go(int) {return 2;}
3182 int jo(int) {return 2;}
3184 private: using X::go;
3187 ac_cv_cpp_ambiguity_resolving_using=yes,
3188 ac_cv_cpp_ambiguity_resolving_using=no)])
3189 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3190 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3193 dnl See if a dynamic_cast to void* gives the most derived object.
3194 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3195 ac_cv_cpp_dynamic_cast_void_ptr,
3196 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3197 class Y { int j; public: virtual ~Y() { } };
3198 class Z : public X, public Y { int k; };
3204 return !((((void*)&mdo != (void*)subx) &&
3205 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3206 (((void*)&mdo != (void*)suby) &&
3207 ((void*)&mdo == dynamic_cast<void*>(suby))));
3209 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3210 ac_cv_cpp_dynamic_cast_void_ptr=no,
3211 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3212 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3213 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3216 dnl note that this one is reversed - if the test fails, then
3217 dnl we require implementations of unused virtual methods. Which
3218 dnl really blows because it means we'll have useless vtable
3220 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3221 ac_cv_cpp_unused_required,
3222 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3224 ac_cv_cpp_unused_required=no,
3225 ac_cv_cpp_unused_required=yes)])
3226 if test "$ac_cv_cpp_unused_required" = yes ; then
3227 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3231 dnl Some compilers have trouble comparing a constant reference to a templatized
3232 dnl class to zero, and require an explicit operator==() to be defined that takes
3233 dnl an int. This test separates the strong from the weak.
3235 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3236 ac_cv_trouble_comparing_to_zero,
3237 [AC_TRY_COMPILE([#include <algorithm>
3238 template <class T> class Foo {};
3240 template <class T> int operator==(const T2*, const T&) { return 0; }
3241 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3242 [Foo<int> f; return (0 != f);],
3243 ac_cv_trouble_comparing_to_zero=no,
3244 ac_cv_trouble_comparing_to_zero=yes)])
3245 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3246 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3249 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3250 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3251 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3253 _SAVE_LDFLAGS=$LDFLAGS
3254 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3255 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3256 ac_cv_thread_keyword,
3257 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3258 [return tlsIsMainThread;],
3259 ac_cv_thread_keyword=yes,
3260 ac_cv_thread_keyword=no)])
3261 LDFLAGS=$_SAVE_LDFLAGS
3262 # The custom dynamic linker doesn't support TLS variables
3264 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3265 # mips builds fail with TLS variables because of a binutils bug.
3267 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3272 *-android*|*-linuxandroid*)
3279 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3285 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3286 if test -n "$MOZ_LINKER"; then
3287 if test "$CPU_ARCH" = arm; then
3288 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3289 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3290 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3291 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3296 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3297 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3298 dnl We however want to avoid these text relocations, and this can be done
3299 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3300 dnl doesn't contain anything at all, beside placeholders for some sections,
3301 dnl and crtbegin only contains a finalizer function that calls
3302 dnl __cxa_finalize. The custom linker actually takes care of calling
3303 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3304 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3305 dnl link crtbegin and crtend at all.
3306 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3307 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3308 ac_cv_crt_has_text_relocations,
3309 [echo 'int foo() { return 0; }' > conftest.cpp
3310 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3311 test -s conftest${DLL_SUFFIX}; then
3312 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3313 ac_cv_crt_has_text_relocations=yes
3315 ac_cv_crt_has_text_relocations=no
3318 AC_ERROR([couldn't compile a simple C file])
3321 if test "$ac_cv_crt_has_text_relocations" = yes; then
3322 dnl While we want libraries to skip the CRT files, we don't want
3323 dnl executables to be treated the same way. We thus set the flag
3324 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3325 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3326 dnl Using LDFLAGS in nspr is safe, since we only really build
3327 dnl libraries there.
3328 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3329 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3333 dnl Check for the existence of various allocation headers/functions
3335 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3338 for file in $MALLOC_HEADERS; do
3339 MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3340 if test "$MALLOC_H" != ""; then
3341 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3346 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3348 AC_CHECK_FUNCS(malloc_usable_size)
3350 dnl See if compiler supports some gcc-style attributes
3352 AC_CACHE_CHECK(for __attribute__((always_inline)),
3353 ac_cv_attribute_always_inline,
3354 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3356 ac_cv_attribute_always_inline=yes,
3357 ac_cv_attribute_always_inline=no)])
3359 AC_CACHE_CHECK(for __attribute__((malloc)),
3360 ac_cv_attribute_malloc,
3361 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3363 ac_cv_attribute_malloc=yes,
3364 ac_cv_attribute_malloc=no)])
3366 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3367 ac_cv_attribute_warn_unused,
3368 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3370 ac_cv_attribute_warn_unused=yes,
3371 ac_cv_attribute_warn_unused=no)])
3373 dnl End of C++ language/feature checks
3376 dnl ========================================================
3377 dnl = Internationalization checks
3378 dnl ========================================================
3380 dnl Internationalization and Locale support is different
3381 dnl on various UNIX platforms. Checks for specific i18n
3382 dnl features go here.
3384 dnl check for LC_MESSAGES
3385 AC_CACHE_CHECK(for LC_MESSAGES,
3386 ac_cv_i18n_lc_messages,
3387 [AC_TRY_COMPILE([#include <locale.h>],
3388 [int category = LC_MESSAGES;],
3389 ac_cv_i18n_lc_messages=yes,
3390 ac_cv_i18n_lc_messages=no)])
3391 if test "$ac_cv_i18n_lc_messages" = yes; then
3392 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3395 AC_HAVE_FUNCS(localeconv)
3396 fi # ! SKIP_COMPILER_CHECKS
3399 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3400 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3403 dnl Mozilla specific options
3404 dnl ========================================================
3405 dnl The macros used for command line options
3406 dnl are defined in build/autoconf/altoptions.m4.
3408 dnl If the compiler supports these attributes, define them as
3409 dnl convenience macros.
3410 if test "$ac_cv_attribute_malloc" = yes ; then
3411 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3413 AC_DEFINE(NS_ATTR_MALLOC,)
3416 if test "$ac_cv_attribute_warn_unused" = yes ; then
3417 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3419 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3422 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3423 dnl features that Windows actually does support.
3425 if test -n "$SKIP_COMPILER_CHECKS"; then
3426 dnl Windows has malloc.h
3427 AC_DEFINE(MALLOC_H, [<malloc.h>])
3428 AC_DEFINE(HAVE_FORCEINLINE)
3429 AC_DEFINE(HAVE_LOCALECONV)
3430 fi # SKIP_COMPILER_CHECKS
3432 dnl ========================================================
3434 dnl = Check for external package dependencies
3436 dnl ========================================================
3437 MOZ_ARG_HEADER(External Packages)
3439 MOZ_ARG_WITH_STRING(libxul-sdk,
3440 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3441 LIBXUL_SDK_DIR=$withval)
3443 if test "$LIBXUL_SDK_DIR" = "yes"; then
3444 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3445 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3446 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3448 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3449 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3453 AC_SUBST(LIBXUL_SDK)
3455 if test -n "$LIBXUL_SDK"; then
3456 LIBXUL_DIST="$LIBXUL_SDK"
3458 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3460 AC_SUBST(LIBXUL_DIST)
3464 MOZ_ARG_WITH_BOOL(system-libxul,
3465 [ --with-system-libxul Use system installed libxul SDK],
3468 dnl ========================================================
3469 dnl = If NSPR was not detected in the system,
3470 dnl = use the one in the source tree (mozilla/nsprpub)
3471 dnl ========================================================
3472 MOZ_ARG_WITH_BOOL(system-nspr,
3473 [ --with-system-nspr Use system installed NSPR],
3474 _USE_SYSTEM_NSPR=1 )
3476 if test -n "$_USE_SYSTEM_NSPR"; then
3477 AM_PATH_NSPR(4.10.6, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
3480 if test -n "$MOZ_NATIVE_NSPR"; then
3481 _SAVE_CFLAGS=$CFLAGS
3482 CFLAGS="$CFLAGS $NSPR_CFLAGS"
3483 AC_TRY_COMPILE([#include "prtypes.h"],
3484 [#ifndef PR_STATIC_ASSERT
3485 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3487 [MOZ_NATIVE_NSPR=1],
3488 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3489 AC_TRY_COMPILE([#include "prtypes.h"],
3491 #error PR_UINT64 not defined or requires including prtypes.h
3493 [MOZ_NATIVE_NSPR=1],
3494 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3495 CFLAGS=$_SAVE_CFLAGS
3497 if test -z "$LIBXUL_SDK"; then
3498 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3499 if test -n "$GNU_CC"; then
3500 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3502 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3505 NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3506 NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3510 dnl set GRE_MILESTONE
3511 dnl ========================================================
3512 if test -n "$LIBXUL_SDK"; then
3513 GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3515 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3517 AC_SUBST(GRE_MILESTONE)
3519 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3520 # The logic works like this:
3521 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3522 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3523 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3524 case "$GRE_MILESTONE" in
3527 AC_DEFINE(NIGHTLY_BUILD)
3533 AC_DEFINE(RELEASE_BUILD)
3536 AC_SUBST(NIGHTLY_BUILD)
3537 AC_SUBST(RELEASE_BUILD)
3539 dnl ========================================================
3540 dnl Disable compiling sources in unified mode.
3541 dnl ========================================================
3543 if test -z "$NIGHTLY_BUILD"; then
3544 MOZ_DISABLE_UNIFIED_COMPILATION=1
3547 MOZ_ARG_DISABLE_BOOL(unified-compilation,
3548 [ --disable-unified-compilation
3549 Disable unified compilation of some C/C++ sources],
3550 MOZ_DISABLE_UNIFIED_COMPILATION=1,
3551 MOZ_DISABLE_UNIFIED_COMPILATION=)
3552 AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
3554 dnl ========================================================
3555 dnl Multiprocess Firefox Nightly Testing UI
3556 dnl To be removed in Bug 1003313
3557 dnl ========================================================
3558 if test -z "$NIGHTLY_BUILD"; then
3562 AC_SUBST(E10S_TESTING_ONLY)
3564 dnl ========================================================
3565 dnl system libevent Support
3566 dnl ========================================================
3567 MOZ_ARG_WITH_STRING(system-libevent,
3568 [ --with-system-libevent[=PFX]
3569 Use system libevent [installed at prefix PFX]],
3570 LIBEVENT_DIR=$withval)
3572 _SAVE_CFLAGS=$CFLAGS
3573 _SAVE_LDFLAGS=$LDFLAGS
3575 if test "$LIBEVENT_DIR" = yes; then
3576 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3577 MOZ_NATIVE_LIBEVENT=1,
3580 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3581 MOZ_NATIVE_LIBEVENT=
3582 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3583 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3584 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3585 MOZ_CHECK_HEADER(event.h,
3586 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3587 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3589 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3590 AC_CHECK_LIB(event, event_init,
3591 [MOZ_NATIVE_LIBEVENT=1
3592 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3593 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3594 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3596 CFLAGS=$_SAVE_CFLAGS
3597 LDFLAGS=$_SAVE_LDFLAGS
3600 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3601 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
3602 AC_SUBST(MOZ_LIBEVENT_LIBS)
3604 dnl ========================================================
3605 dnl = If NSS was not detected in the system,
3606 dnl = use the one in the source tree (mozilla/security/nss)
3607 dnl ========================================================
3609 MOZ_ARG_WITH_BOOL(system-nss,
3610 [ --with-system-nss Use system installed NSS],
3613 if test -n "$_USE_SYSTEM_NSS"; then
3614 AM_PATH_NSS(3.16, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3617 if test -n "$MOZ_NATIVE_NSS"; then
3618 NSS_LIBS="$NSS_LIBS -lcrmf"
3620 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3622 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
3624 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3625 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3626 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3627 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3628 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3630 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3634 dnl ======================
3636 dnl ======================
3638 AC_MSG_CHECKING([for YASM assembler])
3639 AC_CHECK_PROGS(YASM, yasm, "")
3641 if test -n "$YASM"; then
3642 dnl Pull out yasm's version string
3643 YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3644 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3645 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3646 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3647 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3650 if test -z "$SKIP_LIBRARY_CHECKS"; then
3651 dnl system JPEG support
3652 dnl ========================================================
3653 MOZ_ARG_WITH_STRING(system-jpeg,
3654 [ --with-system-jpeg[=PFX]
3655 Use system libjpeg [installed at prefix PFX]],
3658 _SAVE_CFLAGS=$CFLAGS
3659 _SAVE_LDFLAGS=$LDFLAGS
3661 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3662 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3663 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3665 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3668 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3671 if test "$MOZ_NATIVE_JPEG" = 1; then
3672 AC_TRY_COMPILE([ #include <stdio.h>
3673 #include <sys/types.h>
3674 #include <jpeglib.h> ],
3675 [ #if JPEG_LIB_VERSION < $MOZJPEG
3676 #error "Insufficient JPEG library version ($MOZJPEG required)."
3678 #ifndef JCS_EXTENSIONS
3679 #error "libjpeg-turbo JCS_EXTENSIONS required"
3683 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3685 CFLAGS=$_SAVE_CFLAGS
3686 LDFLAGS=$_SAVE_LDFLAGS
3689 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3690 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3691 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3693 fi # SKIP_LIBRARY_CHECKS
3695 dnl system ZLIB support
3696 dnl ========================================================
3697 MOZ_ZLIB_CHECK([1.2.3])
3699 if test "$MOZ_NATIVE_ZLIB" != 1; then
3700 MOZ_ZLIB_CFLAGS="-I${_topsrcdir}/modules/zlib/src"
3701 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
3704 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
3705 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
3710 if test -z "$SKIP_LIBRARY_CHECKS"; then
3711 dnl system BZIP2 Support
3712 dnl ========================================================
3713 MOZ_ARG_WITH_STRING(system-bz2,
3714 [ --with-system-bz2[=PFX]
3715 Use system libbz2 [installed at prefix PFX]],
3718 _SAVE_CFLAGS=$CFLAGS
3719 _SAVE_LDFLAGS=$LDFLAGS
3721 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
3722 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
3723 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
3725 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
3728 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
3729 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
3731 CFLAGS=$_SAVE_CFLAGS
3732 LDFLAGS=$_SAVE_LDFLAGS
3735 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
3736 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
3737 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
3740 dnl ========================================================
3741 dnl system PNG Support
3742 dnl ========================================================
3743 MOZ_ARG_WITH_STRING(system-png,
3744 [ --with-system-png[=PFX]
3745 Use system libpng [installed at prefix PFX]],
3748 _SAVE_CFLAGS=$CFLAGS
3749 _SAVE_LDFLAGS=$LDFLAGS
3751 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
3752 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
3753 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
3755 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
3758 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
3759 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3760 AC_CHECK_LIB(png, png_get_acTL, ,
3761 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
3763 if test "$MOZ_NATIVE_PNG" = 1; then
3764 AC_TRY_COMPILE([ #include <stdio.h>
3765 #include <sys/types.h>
3767 [ #if PNG_LIBPNG_VER < $MOZPNG
3768 #error "Insufficient libpng version ($MOZPNG required)."
3770 #ifndef PNG_UINT_31_MAX
3771 #error "Insufficient libpng version."
3774 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3776 CFLAGS=$_SAVE_CFLAGS
3777 LDFLAGS=$_SAVE_LDFLAGS
3780 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
3781 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
3782 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
3785 MOZ_PNG_ARM_NEON_CHECK=
3786 if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
3787 MOZ_ARG_ENABLE_STRING(png-arm-neon-support,
3788 [ --enable-png-arm-neon-support=TYPE
3792 nocheck (faster but unsafe)],
3793 [MOZ_PNG_ARM_NEON_SUPPORT=$enableval ] )
3794 case "$MOZ_PNG_ARM_NEON_SUPPORT" in
3796 # enable-png-arm-neon-support = no
3799 # enable-png-arm-neon-support = nocheck
3804 MOZ_PNG_ARM_NEON_CHECK=1
3809 AC_SUBST(MOZ_PNG_ARM_NEON_CHECK)
3811 fi # SKIP_LIBRARY_CHECKS
3813 AC_SUBST(MOZ_PNG_ARM_NEON)
3815 dnl ========================================================
3816 dnl system HunSpell Support
3817 dnl ========================================================
3818 MOZ_ARG_ENABLE_BOOL(system-hunspell,
3819 [ --enable-system-hunspell
3820 Use system hunspell (located with pkgconfig)],
3821 MOZ_NATIVE_HUNSPELL=1 )
3823 if test -n "$MOZ_NATIVE_HUNSPELL"; then
3824 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
3827 AC_SUBST(MOZ_NATIVE_HUNSPELL)
3829 dnl ========================================================
3830 dnl system libffi Support
3831 dnl ========================================================
3834 if test -n "$MOZ_NATIVE_FFI"; then
3835 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
3838 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
3839 if test "$OS_ARCH" = "WINNT"; then
3843 MOZ_ARG_ENABLE_BOOL(shared-js,
3844 [ --enable-shared-js
3845 Create a shared JavaScript library.],
3846 JS_SHARED_LIBRARY=1,
3849 dnl ========================================================
3850 dnl Java SDK support
3851 dnl ========================================================
3854 MOZ_ARG_WITH_STRING(java-bin-path,
3855 [ --with-java-bin-path=dir
3856 Location of Java binaries (java, javac, jar)],
3857 JAVA_BIN_PATH=$withval)
3859 dnl ========================================================
3863 dnl ========================================================
3865 MOZ_ARG_HEADER(Application)
3868 ENABLE_SYSTEM_EXTENSION_DIRS=1
3869 MOZ_BRANDING_DIRECTORY=
3870 MOZ_OFFICIAL_BRANDING=
3874 MOZ_AUTH_EXTENSION=1
3879 MOZ_SAMPLE_TYPE_FLOAT32=
3880 MOZ_SAMPLE_TYPE_S16=
3891 MOZ_WEBRTC_SIGNALING=
3892 MOZ_WEBRTC_ASSERT_ALWAYS=1
3895 MOZ_MEDIA_NAVIGATOR=
3898 MOZ_VPX_ERROR_CONCEALMENT=
3908 LIBJPEG_TURBO_ASFLAGS=
3909 LIBJPEG_TURBO_X86_ASM=
3910 LIBJPEG_TURBO_X64_ASM=
3911 LIBJPEG_TURBO_ARM_ASM=
3912 MOZ_LOOP=$NIGHTLY_BUILD
3916 MOZ_PREF_EXTENSIONS=1
3917 MOZ_PROFILELOCKING=1
3923 MOZ_TOOLKIT_SEARCH=1
3925 MOZ_UNIVERSALCHARDET=1
3931 MOZ_DISABLE_CRYPTOLEGACY=
3934 NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device"
3935 if test -n "$MOZ_RTSP"; then
3936 NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp"
3940 MOZ_USE_NATIVE_POPUP_WINDOWS=
3941 MOZ_ANDROID_HISTORY=
3944 MOZ_ANDROID_SYNTHAPKS=
3945 MOZ_LOCALE_SWITCHER=
3949 MOZ_AUDIO_CHANNEL_MANAGER=
3951 MOZ_CONTENT_SANDBOX=
3952 MOZ_CONTENT_SANDBOX_REPORTER=1
3953 JSGC_USE_EXACT_ROOTING=
3956 case "$target_os" in
3959 AC_DEFINE(NS_ENABLE_TSF)
3964 *-android*|*-linuxandroid*)
3965 if test "$CPU_ARCH" = "arm" ; then
3970 MOZ_THEME_FASTSTRIPE=1
3978 MOZ_ARG_WITH_STRING(external-source-dir,
3979 [ --with-external-source-dir=dir
3980 External directory containing additional build files.],
3981 [ EXTERNAL_SOURCE_DIR=$withval])
3982 AC_SUBST(EXTERNAL_SOURCE_DIR)
3984 MOZ_ARG_ENABLE_STRING(application,
3985 [ --enable-application=APP
3989 tools/update-packaging (AUS-related packaging tools)],
3990 [ MOZ_BUILD_APP=$enableval ] )
3992 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
3993 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
3994 XULRUNNER_STUB_NAME=$withval)
3996 if test -z "$XULRUNNER_STUB_NAME"; then
3997 case "$target_os" in
3999 XULRUNNER_STUB_NAME=xulrunner
4002 XULRUNNER_STUB_NAME=xulrunner-stub
4005 AC_SUBST(XULRUNNER_STUB_NAME)
4007 AC_MSG_CHECKING([for application to build])
4008 if test -z "$MOZ_BUILD_APP"; then
4009 AC_MSG_RESULT([browser])
4010 MOZ_BUILD_APP=browser
4012 # "mobile" no longer exists.
4013 if test "$MOZ_BUILD_APP" = "mobile" ; then
4014 AC_MSG_RESULT([none])
4015 AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
4017 # We have a valid application only if it has a build.mk file in its top
4019 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4020 AC_MSG_RESULT([none])
4021 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4023 AC_MSG_RESULT([$MOZ_BUILD_APP])
4027 # The app update channel is 'default' when not supplied. The value is used in
4028 # the application's confvars.sh so it must be set before confvars.sh is called.
4029 MOZ_ARG_ENABLE_STRING([update-channel],
4030 [ --enable-update-channel=CHANNEL
4031 Select application update channel (default=default)],
4032 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4034 if test -z "$MOZ_UPDATE_CHANNEL"; then
4035 MOZ_UPDATE_CHANNEL=default
4037 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4038 AC_SUBST(MOZ_UPDATE_CHANNEL)
4040 # Allow to specify a Mozilla API key file that contains the secret key to be
4041 # used for various Mozilla API requests.
4042 MOZ_ARG_WITH_STRING(mozilla-api-keyfile,
4043 [ --with-mozilla-api-keyfile=file Use the secret key contained in the given keyfile for Mozilla API requests],
4044 MOZ_MOZILLA_API_KEY=`cat $withval`)
4045 if test -z "$MOZ_MOZILLA_API_KEY"; then
4046 MOZ_MOZILLA_API_KEY=no-mozilla-api-key
4048 AC_SUBST(MOZ_MOZILLA_API_KEY)
4050 # Allow to specify a Google API key file that contains the secret key to be
4051 # used for various Google API requests.
4052 MOZ_ARG_WITH_STRING(google-api-keyfile,
4053 [ --with-google-api-keyfile=file Use the secret key contained in the given keyfile for Google API requests],
4054 MOZ_GOOGLE_API_KEY=`cat $withval`)
4055 if test -z "$MOZ_GOOGLE_API_KEY"; then
4056 MOZ_GOOGLE_API_KEY=no-google-api-key
4058 AC_SUBST(MOZ_GOOGLE_API_KEY)
4060 # Allow specifying a Bing API key file that contains the client ID and the
4061 # secret key to be used for the Bing Translation API requests.
4062 MOZ_ARG_WITH_STRING(bing-api-keyfile,
4063 [ --with-bing-api-keyfile=file Use the client id and secret key contained in the given keyfile for Bing API requests],
4064 [MOZ_BING_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
4065 MOZ_BING_API_KEY=`cat $withval | cut -f 2 -d " "`])
4066 if test -z "$MOZ_BING_API_CLIENTID"; then
4067 MOZ_BING_API_CLIENTID=no-bing-api-clientid
4068 MOZ_BING_API_KEY=no-bing-api-key
4070 AC_SUBST(MOZ_BING_API_CLIENTID)
4071 AC_SUBST(MOZ_BING_API_KEY)
4073 # Allow the application to influence configure with a confvars.sh script.
4074 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4075 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4076 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4077 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4082 # Allow influencing configure with a defines.sh script.
4083 . "${srcdir}/build/defines.sh"
4085 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
4087 if test "$BUILDING_RELEASE"; then
4088 # Override value in defines.sh, if any
4089 EARLY_BETA_OR_EARLIER=
4090 elif test "$EARLY_BETA_OR_EARLIER"; then
4091 AC_DEFINE(EARLY_BETA_OR_EARLIER)
4093 AC_SUBST(EARLY_BETA_OR_EARLIER)
4095 # Allow the application to provide a subconfigure script
4096 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4097 do_output_subdirs() {
4098 if test -n "$_subconfigure_subdirs"; then
4099 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4101 _subconfigure_subdir="$1"
4102 _subconfigure_config_args="$ac_configure_args"
4104 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4105 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4106 "${srcdir}/build/autoconf/altoptions.m4" \
4107 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4112 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4113 MOZ_ARG_WITH_STRING(app-name,
4114 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4115 WITH_APP_NAME=$withval,
4118 if test -n "$WITH_APP_NAME" ; then
4119 MOZ_APP_NAME="$WITH_APP_NAME"
4122 MOZ_ARG_WITH_STRING(app-basename,
4123 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4124 WITH_APP_BASENAME=$withval,
4127 if test -n "$WITH_APP_BASENAME" ; then
4128 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4131 # Now is a good time to test for logic errors, define mismatches, etc.
4132 case "$MOZ_BUILD_APP" in
4134 if test "$LIBXUL_SDK"; then
4135 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4140 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4141 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4143 case "$MOZ_BUILD_APP" in
4145 AC_DEFINE(MOZ_PHOENIX)
4149 AC_DEFINE(MOZ_XULRUNNER)
4156 AC_DEFINE(MOZ_MULET)
4160 AC_SUBST(MOZ_BUILD_APP)
4161 AC_SUBST(MOZ_PHOENIX)
4162 AC_SUBST(MOZ_XULRUNNER)
4165 AC_SUBST(MOZ_B2G_VERSION)
4167 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4169 dnl ========================================================
4170 dnl Check android sdk version depending on mobile target
4171 dnl ========================================================
4173 if test -z "$gonkdir" ; then
4174 # Minimum Android SDK API Level we require.
4175 case "$MOZ_BUILD_APP" in
4177 android_min_api_level=16
4179 *-android*|*-linuxandroid*)
4183 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])
4189 MOZ_ANDROID_SDK($android_min_api_level)
4192 dnl ========================================================
4194 dnl = Toolkit Options
4196 dnl ========================================================
4197 MOZ_ARG_HEADER(Toolkit Options)
4199 dnl ========================================================
4200 dnl = Select the default toolkit
4201 dnl ========================================================
4202 MOZ_ARG_ENABLE_STRING(default-toolkit,
4203 [ --enable-default-toolkit=TK
4204 Select default toolkit
4205 Platform specific defaults:
4206 Mac OS X - cairo-cocoa
4207 Win32 - cairo-windows
4211 [ _DEFAULT_TOOLKIT=$enableval ],
4212 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4214 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4215 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4216 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4217 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4218 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4219 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4220 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4221 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4222 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4224 dnl nglayout only supports building with one toolkit,
4225 dnl so ignore everything after the first comma (",").
4226 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4228 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4231 MOZ_ARG_WITHOUT_BOOL(x,
4232 [ --without-x Build without X11],
4235 dnl ========================================================
4236 dnl = Enable the toolkit as needed =
4237 dnl ========================================================
4241 case "$MOZ_WIDGET_TOOLKIT" in
4244 MOZ_WIDGET_TOOLKIT=windows
4247 MOZ_INSTRUMENT_EVENT_LOOP=1
4248 if test -n "$GNU_CC"; then
4254 MOZ_WIDGET_TOOLKIT=gtk3
4257 MOZ_ENABLE_XREMOTE=1
4259 MOZ_GL_DEFAULT_PROVIDER=GLX
4265 TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4266 TK_LIBS='$(MOZ_GTK3_LIBS)'
4268 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4270 MOZ_INSTRUMENT_EVENT_LOOP=1
4273 cairo-gtk2|cairo-gtk2-x11)
4274 MOZ_WIDGET_TOOLKIT=gtk2
4277 MOZ_ENABLE_XREMOTE=1
4279 MOZ_GL_DEFAULT_PROVIDER=GLX
4285 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4286 TK_LIBS='$(MOZ_GTK2_LIBS)'
4287 AC_DEFINE(MOZ_WIDGET_GTK2)
4289 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4291 MOZ_INSTRUMENT_EVENT_LOOP=1
4295 MOZ_WIDGET_TOOLKIT=qt
4297 if test -z "$WITHOUT_X11"; then
4298 MOZ_ENABLE_XREMOTE=1
4299 MOZ_GL_DEFAULT_PROVIDER=GLX
4307 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4308 TK_LIBS='$(MOZ_QT_LIBS)'
4309 AC_DEFINE(MOZ_WIDGET_QT)
4311 AC_DEFINE(QT_NO_KEYWORDS)
4315 MOZ_WIDGET_TOOLKIT=cocoa
4316 AC_DEFINE(MOZ_WIDGET_COCOA)
4317 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4318 TK_LIBS='-framework CoreLocation -framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4319 TK_CFLAGS="-DNO_X11"
4320 CFLAGS="$CFLAGS $TK_CFLAGS"
4321 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4322 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)'
4323 MOZ_USER_DIR="Mozilla"
4324 MOZ_FS_LAYOUT=bundle
4326 MOZ_INSTRUMENT_EVENT_LOOP=1
4330 MOZ_WIDGET_TOOLKIT=uikit
4331 AC_DEFINE(MOZ_WIDGET_UIKIT)
4332 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4333 TK_CFLAGS="-DNO_X11"
4334 TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4335 CFLAGS="$CFLAGS $TK_CFLAGS"
4336 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4337 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)'
4338 MOZ_USER_DIR="Mozilla"
4339 MOZ_FS_LAYOUT=bundle
4343 AC_DEFINE(MOZ_WIDGET_ANDROID)
4344 MOZ_WIDGET_TOOLKIT=android
4345 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4346 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4349 MOZ_INSTRUMENT_EVENT_LOOP=1
4353 XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)'
4354 AC_DEFINE(MOZ_WIDGET_GONK)
4355 AC_DEFINE(MOZ_TOUCH)
4356 MOZ_WIDGET_TOOLKIT=gonk
4357 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4358 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4362 MOZ_INSTRUMENT_EVENT_LOOP=1
4367 AC_SUBST(MOZ_PDF_PRINTING)
4368 if test "$MOZ_PDF_PRINTING"; then
4369 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4370 AC_DEFINE(MOZ_PDF_PRINTING)
4373 if test "$MOZ_ENABLE_XREMOTE"; then
4374 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4377 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4378 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4381 if test "$COMPILE_ENVIRONMENT"; then
4382 if test "$MOZ_ENABLE_GTK3"; then
4383 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4385 if test "$MOZ_ENABLE_GTK"; then
4386 if test "$MOZ_X11"; then
4387 GDK_PACKAGES=gdk-x11-2.0
4390 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4393 fi # COMPILE_ENVIRONMENT
4395 AC_SUBST(MOZ_FS_LAYOUT)
4397 dnl ========================================================
4398 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4399 dnl their usage and use them in spidermonkey.
4400 dnl ========================================================
4401 MOZ_ARG_WITH_BOOL(arm-kuser,
4402 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4404 if test -n "$USE_ARM_KUSER"; then
4405 AC_DEFINE(USE_ARM_KUSER)
4408 dnl ========================================================
4409 dnl = startup-notification support module
4410 dnl ========================================================
4412 if test "$MOZ_ENABLE_GTK"
4414 MOZ_ENABLE_STARTUP_NOTIFICATION=
4416 MOZ_ARG_ENABLE_BOOL(startup-notification,
4417 [ --enable-startup-notification
4418 Enable startup-notification support (default: disabled) ],
4419 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4420 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4421 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4423 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4424 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4425 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4426 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4428 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4430 MOZ_ENABLE_STARTUP_NOTIFICATION=
4434 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4435 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4438 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4440 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4441 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4442 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4444 dnl ========================================================
4445 dnl Disable printing
4446 dnl ========================================================
4447 MOZ_ARG_DISABLE_BOOL(printing,
4448 [ --disable-printing Disable printing support],
4452 if test "$NS_PRINTING"; then
4453 AC_DEFINE(NS_PRINTING)
4454 AC_DEFINE(NS_PRINT_PREVIEW)
4457 dnl ========================================================
4459 dnl ========================================================
4460 if test "$MOZ_ENABLE_QT"
4462 MOZ_ARG_WITH_STRING(qtdir,
4463 [ --with-qtdir=\$dir Specify Qt directory ],
4466 if test -z "$QTDIR"; then
4467 AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4469 HOST_QMAKE="$QTDIR/bin/qmake"
4471 QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4473 if test -z "$QTDIR"; then
4476 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4477 PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5Quick, ,
4479 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4481 QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4482 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4483 if test "$NS_PRINTING"; then
4484 PKG_CHECK_MODULES(MOZ_QT_WIDGETS, Qt5PrintSupport, ,
4486 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase widgets development package])
4488 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT_WIDGETS_LIBS"
4489 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT_WIDGETS_CFLAGS"
4493 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4497 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4498 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4500 MOZ_QT_CFLAGS="-DQT_SHARED"
4501 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4502 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4503 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4504 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4505 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4506 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4509 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4510 MOZ_QT_LIBS="$MOZ_QT_LIBS -L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml"
4511 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4512 if test "$NS_PRINTING"; then
4513 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4514 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4518 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4522 HOST_MOC="$QTDIR/bin/moc"
4523 HOST_RCC="$QTDIR/bin/rcc"
4525 if test -z "$HOST_MOC"; then
4526 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4528 if test -z "$HOST_RCC"; then
4529 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4535 MOZ_ENABLE_QMSYSTEM2=
4536 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4537 MOZ_ENABLE_QMSYSTEM2=1,
4538 MOZ_ENABLE_QMSYSTEM2=)
4540 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4541 MOZ_ENABLE_QMSYSTEM2=1
4542 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4543 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4544 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4547 MOZ_ENABLE_QTNETWORK=
4548 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4549 MOZ_ENABLE_QTNETWORK=1,
4550 MOZ_ENABLE_QTNETWORK=)
4552 if test "$MOZ_ENABLE_QTNETWORK"; then
4553 MOZ_ENABLE_QTNETWORK=1
4554 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4557 MOZ_ENABLE_QTMOBILITY=
4558 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4559 MOZ_ENABLE_QTMOBILITY=1,
4560 MOZ_ENABLE_QTMOBILITY=)
4561 if test "$MOZ_ENABLE_QTMOBILITY"; then
4562 MOZ_ENABLE_QTMOBILITY=1
4563 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4564 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4565 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4566 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4568 AC_CHECK_LIB(QtSensors, main, [
4569 MOZ_ENABLE_QTMOBILITY=1
4570 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4571 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4572 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4573 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4574 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4578 MOZ_ENABLE_QT5FEEDBACK=
4579 PKG_CHECK_MODULES(_QT5FEEDBACK, Qt0Feedback,
4580 MOZ_ENABLE_QT5FEEDBACK=1,
4581 MOZ_ENABLE_QT5FEEDBACK=)
4582 if test "$MOZ_ENABLE_QT5FEEDBACK"; then
4583 MOZ_ENABLE_QT5FEEDBACK=1
4584 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5FEEDBACK_CFLAGS"
4585 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5FEEDBACK_LIBS"
4586 AC_DEFINE(MOZ_ENABLE_QT5FEEDBACK)
4587 AC_SUBST(MOZ_ENABLE_QT5FEEDBACK)
4590 MOZ_ENABLE_QT5GEOPOSITION=
4591 PKG_CHECK_MODULES(_QT5GEOPOSITION, Qt5Positioning,
4592 MOZ_ENABLE_QT5GEOPOSITION=1,
4593 MOZ_ENABLE_QT5GEOPOSITION=)
4594 if test "$MOZ_ENABLE_QT5GEOPOSITION"; then
4595 MOZ_ENABLE_QT5GEOPOSITION=1
4596 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5GEOPOSITION_CFLAGS"
4597 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5GEOPOSITION_LIBS"
4598 AC_DEFINE(MOZ_ENABLE_QT5GEOPOSITION)
4599 AC_SUBST(MOZ_ENABLE_QT5GEOPOSITION)
4602 if test "$MOZ_ENABLE_CONTENTACTION"; then
4603 MOZ_ENABLE_CONTENTACTION=1
4604 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4607 MOZ_ENABLE_CONTENTACTION=
4608 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
4609 if test "$MOZ_ENABLE_CONTENTACTION"; then
4610 MOZ_ENABLE_CONTENTACTION=1
4611 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
4612 MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
4613 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4614 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
4618 AC_SUBST(GTK_CONFIG)
4622 AC_SUBST(MOZ_ENABLE_GTK2)
4623 AC_SUBST(MOZ_ENABLE_GTK3)
4624 AC_SUBST(MOZ_ENABLE_GTK)
4625 AC_SUBST(MOZ_ENABLE_QT)
4626 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4627 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4628 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4629 AC_SUBST(MOZ_ENABLE_XREMOTE)
4630 AC_SUBST(MOZ_GTK2_CFLAGS)
4631 AC_SUBST(MOZ_GTK2_LIBS)
4632 AC_SUBST(MOZ_GTK3_CFLAGS)
4633 AC_SUBST(MOZ_GTK3_LIBS)
4634 AC_SUBST(MOZ_WIDGET_GTK)
4635 AC_SUBST(MOZ_QT_CFLAGS)
4636 AC_SUBST(MOZ_QT_LIBS)
4643 dnl ========================================================
4645 dnl = Components & Features
4647 dnl ========================================================
4648 MOZ_ARG_HEADER(Components and Features)
4650 dnl ========================================================
4652 dnl ========================================================
4653 MOZ_ARG_ENABLE_STRING(ui-locale,
4654 [ --enable-ui-locale=ab-CD
4655 Select the user interface locale (default: en-US)],
4656 MOZ_UI_LOCALE=$enableval )
4657 AC_SUBST(MOZ_UI_LOCALE)
4659 dnl ========================================================
4660 dnl = Trademarked Branding
4661 dnl ========================================================
4662 MOZ_ARG_ENABLE_BOOL(official-branding,
4663 [ --enable-official-branding
4664 Enable Official mozilla.org Branding
4665 Do not distribute builds with
4666 --enable-official-branding unless you have
4667 permission to use trademarks per
4668 http://www.mozilla.org/foundation/trademarks/ .],
4670 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4671 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4673 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4674 MOZ_OFFICIAL_BRANDING=1
4676 ], MOZ_OFFICIAL_BRANDING=)
4678 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4679 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4680 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4683 MOZ_ARG_WITH_STRING(branding,
4684 [ --with-branding=dir Use branding from the specified directory.],
4685 MOZ_BRANDING_DIRECTORY=$withval)
4687 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4688 if test -z "$REAL_BRANDING_DIRECTORY"; then
4689 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4692 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4693 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4696 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4698 dnl ========================================================
4699 dnl = Distribution ID
4700 dnl ========================================================
4701 MOZ_ARG_WITH_STRING(distribution-id,
4702 [ --with-distribution-id=ID
4703 Set distribution-specific id (default=org.mozilla)],
4704 [ val=`echo $withval`
4705 MOZ_DISTRIBUTION_ID="$val"])
4707 if test -z "$MOZ_DISTRIBUTION_ID"; then
4708 MOZ_DISTRIBUTION_ID="org.mozilla"
4711 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4712 AC_SUBST(MOZ_DISTRIBUTION_ID)
4715 dnl ========================================================
4717 dnl ========================================================
4718 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4720 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4722 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4723 AC_SUBST(MOZ_PANGO_CFLAGS)
4724 AC_SUBST(MOZ_PANGO_LIBS)
4727 dnl ========================================================
4728 dnl = GnomeVFS, GIO and GConf support module
4729 dnl ========================================================
4733 dnl build the GIO extension by default only when the
4734 dnl GTK2 toolkit is in use.
4735 if test "$MOZ_ENABLE_GTK"
4741 dnl ========================================================
4742 dnl = GnomeVFS support module
4743 dnl ========================================================
4744 MOZ_ARG_ENABLE_BOOL(gnomevfs,
4745 [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
4746 MOZ_ENABLE_GNOMEVFS=force,
4747 MOZ_ENABLE_GNOMEVFS=)
4749 if test "$MOZ_ENABLE_GNOMEVFS"
4751 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4752 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4753 MOZ_ENABLE_GNOMEVFS=1
4754 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4756 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4758 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4760 MOZ_ENABLE_GNOMEVFS=
4764 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4765 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4766 AC_SUBST(MOZ_GNOMEVFS_LIBS)
4768 dnl ========================================================
4769 dnl = GIO support module
4770 dnl ========================================================
4771 MOZ_ARG_DISABLE_BOOL(gio,
4772 [ --disable-gio Disable GIO support],
4774 MOZ_ENABLE_GIO=force)
4776 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
4778 if test "$MOZ_ENABLE_GTK2"
4780 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4781 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4783 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4784 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4786 AC_DEFINE(MOZ_ENABLE_GIO)
4788 if test "$MOZ_ENABLE_GIO" = "force"
4790 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4796 AC_SUBST(MOZ_ENABLE_GIO)
4797 AC_SUBST(MOZ_GIO_CFLAGS)
4798 AC_SUBST(MOZ_GIO_LIBS)
4800 dnl ========================================================
4801 dnl = GConf support module
4802 dnl ========================================================
4803 MOZ_ARG_DISABLE_BOOL(gconf,
4804 [ --disable-gconf Disable Gconf support ],
4806 MOZ_ENABLE_GCONF=force)
4808 if test "$MOZ_ENABLE_GCONF"
4810 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4811 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4814 if test "$MOZ_ENABLE_GCONF" = "force"
4816 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4822 if test "$MOZ_ENABLE_GCONF"; then
4823 AC_DEFINE(MOZ_ENABLE_GCONF)
4826 AC_SUBST(MOZ_ENABLE_GCONF)
4827 AC_SUBST(MOZ_GCONF_CFLAGS)
4828 AC_SUBST(MOZ_GCONF_LIBS)
4831 dnl ========================================================
4832 dnl = libproxy support
4833 dnl ========================================================
4835 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4837 MOZ_ENABLE_LIBPROXY=
4839 MOZ_ARG_ENABLE_BOOL(libproxy,
4840 [ --enable-libproxy Enable libproxy support ],
4841 MOZ_ENABLE_LIBPROXY=1,
4842 MOZ_ENABLE_LIBPROXY=)
4844 if test "$MOZ_ENABLE_LIBPROXY"
4846 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4847 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4850 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4851 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
4852 AC_SUBST(MOZ_LIBPROXY_LIBS)
4854 dnl ========================================================
4855 dnl = GNOME component (mozgnome)
4856 dnl ========================================================
4858 if test "$MOZ_ENABLE_GTK"
4860 MOZ_ENABLE_GNOME_COMPONENT=1
4862 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4864 dnl ========================================================
4865 dnl = libgnomeui support module
4866 dnl ========================================================
4868 if test "$MOZ_ENABLE_GTK"
4870 MOZ_ARG_ENABLE_BOOL(gnomeui,
4871 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
4872 MOZ_ENABLE_GNOMEUI=force,
4873 MOZ_ENABLE_GNOMEUI=)
4875 if test "$MOZ_ENABLE_GNOMEUI"
4877 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4879 MOZ_ENABLE_GNOMEUI=1
4881 if test "$MOZ_ENABLE_GNOMEUI" = "force"
4883 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4889 if test "$MOZ_ENABLE_GNOMEUI"; then
4890 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4894 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4895 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
4897 dnl ========================================================
4899 dnl ========================================================
4901 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4905 MOZ_ARG_DISABLE_BOOL(dbus,
4906 [ --disable-dbus Disable dbus support ],
4910 if test "$MOZ_ENABLE_DBUS"
4912 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
4913 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
4914 AC_DEFINE(MOZ_ENABLE_DBUS)
4917 AC_SUBST(MOZ_ENABLE_DBUS)
4918 AC_SUBST(MOZ_DBUS_CFLAGS)
4919 AC_SUBST(MOZ_DBUS_LIBS)
4920 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
4921 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
4923 dnl ========================================================
4924 dnl = Enable Android History instead of Places
4925 dnl ========================================================
4926 if test -n "$MOZ_ANDROID_HISTORY"; then
4927 if test -z "$MOZ_PLACES"; then
4928 AC_DEFINE(MOZ_ANDROID_HISTORY)
4930 AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
4934 dnl ========================================================
4935 dnl = Build with the Android compositor
4936 dnl ========================================================
4937 if test -n "$MOZ_ANDROID_OMTC"; then
4938 dnl Do this if defined in confvars.sh
4939 AC_DEFINE(MOZ_ANDROID_OMTC)
4942 dnl ========================================================
4943 dnl = Disable WebSMS backend
4944 dnl ========================================================
4945 MOZ_ARG_DISABLE_BOOL(websms-backend,
4946 [ --disable-websms-backend
4947 Disable WebSMS backend],
4948 MOZ_WEBSMS_BACKEND=,
4949 MOZ_WEBSMS_BACKEND=1)
4951 if test -n "$MOZ_WEBSMS_BACKEND"; then
4952 AC_DEFINE(MOZ_WEBSMS_BACKEND)
4955 dnl ========================================================
4956 dnl = Enable runtime locale switching on Android
4957 dnl ========================================================
4958 if test -n "$MOZ_LOCALE_SWITCHER"; then
4959 AC_DEFINE(MOZ_LOCALE_SWITCHER)
4962 dnl ========================================================
4963 dnl = Enable NFC permission on Android
4964 dnl ========================================================
4965 if test -n "$MOZ_ANDROID_BEAM"; then
4966 AC_DEFINE(MOZ_ANDROID_BEAM)
4969 dnl ========================================================
4970 dnl = Synthesized Webapp APKs on Android
4971 dnl ========================================================
4972 MOZ_ARG_ENABLE_BOOL(android-synthapks,
4973 [ --enable-android-synthapks Enable synthesized APKs],
4974 MOZ_ANDROID_SYNTHAPKS=1,
4975 MOZ_ANDROID_SYNTHAPKS=)
4977 if test -n "$MOZ_ANDROID_SYNTHAPKS"; then
4978 AC_DEFINE(MOZ_ANDROID_SYNTHAPKS)
4981 dnl ========================================================
4982 dnl = JS Debugger XPCOM component (js/jsd)
4983 dnl ========================================================
4984 MOZ_ARG_DISABLE_BOOL(jsd,
4985 [ --disable-jsd Disable JavaScript debug library],
4990 dnl ========================================================
4991 dnl = Enable IPDL's "expensive" unit tests
4992 dnl ========================================================
4995 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
4996 [ --enable-ipdl-tests Enable expensive IPDL tests],
5000 if test -n "$MOZ_IPDL_TESTS"; then
5001 AC_DEFINE(MOZ_IPDL_TESTS)
5004 AC_SUBST(MOZ_IPDL_TESTS)
5006 dnl ========================================================
5007 dnl = Disable building dbm
5008 dnl ========================================================
5009 MOZ_ARG_DISABLE_BOOL(dbm,
5010 [ --disable-dbm Disable building dbm],
5014 dnl ========================================================
5015 dnl accessibility support on by default on all platforms
5016 dnl ========================================================
5017 MOZ_ARG_DISABLE_BOOL(accessibility,
5018 [ --disable-accessibility Disable accessibility support],
5021 if test "$ACCESSIBILITY"; then
5024 if test -z "$MIDL"; then
5025 if test "$GCC" != "yes"; then
5026 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5028 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.])
5032 AC_DEFINE(ACCESSIBILITY)
5035 dnl ========================================================
5036 dnl Accessibility is required for the linuxgl widget
5038 dnl ========================================================
5039 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5040 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5043 dnl Turn off webrtc for OS's we don't handle yet, but allow
5044 dnl --enable-webrtc to override. Can disable for everything in
5045 dnl the master list above.
5046 if test -n "$MOZ_WEBRTC"; then
5048 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
5052 dnl default to disabled for all others
5058 AC_TRY_COMPILE([#include <linux/ethtool.h>],
5059 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
5060 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
5062 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
5064 # target_arch is from {ia32|x64|arm|ppc}
5066 x86_64 | arm | x86 | ppc* | ia64)
5070 # unsupported arch for webrtc
5076 dnl ========================================================
5077 dnl = Disable WebRTC code
5078 dnl ========================================================
5079 MOZ_ARG_DISABLE_BOOL(webrtc,
5080 [ --disable-webrtc Disable support for WebRTC],
5084 if test -n "$MOZ_WEBRTC"; then
5085 AC_DEFINE(MOZ_WEBRTC)
5086 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
5087 dnl opt/production builds (via MOZ_CRASH())
5088 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
5091 MOZ_VPX_ERROR_CONCEALMENT=1
5093 dnl enable once Signaling lands
5094 MOZ_WEBRTC_SIGNALING=1
5095 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5096 dnl enable once PeerConnection lands
5097 MOZ_PEERCONNECTION=1
5098 AC_DEFINE(MOZ_PEERCONNECTION)
5107 AC_SUBST(MOZ_WEBRTC)
5108 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5109 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5110 AC_SUBST(MOZ_PEERCONNECTION)
5111 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5115 dnl Use integers over floats for audio on B2G and Android, because audio
5116 dnl backends for those platforms don't support floats.
5117 if test "$OS_TARGET" = "Android"; then
5118 MOZ_SAMPLE_TYPE_S16=1
5119 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5120 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5122 MOZ_SAMPLE_TYPE_FLOAT32=1
5123 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5124 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5127 dnl ========================================================
5128 dnl = Disable Speech API code
5129 dnl ========================================================
5130 MOZ_ARG_DISABLE_BOOL(webspeech,
5131 [ --disable-webspeech Disable support for HTML Speech API],
5135 if test -n "$MOZ_WEBSPEECH"; then
5136 AC_DEFINE(MOZ_WEBSPEECH)
5139 AC_SUBST(MOZ_WEBSPEECH)
5141 dnl ========================================================
5142 dnl = Enable Raw Codecs
5143 dnl ========================================================
5144 MOZ_ARG_ENABLE_BOOL(raw,
5145 [ --enable-raw Enable support for RAW media],
5149 if test -n "$MOZ_RAW"; then
5155 dnl Checks for __attribute__(aligned()) directive need by libogg
5156 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5157 [ac_cv_c_attribute_aligned],
5158 [ac_cv_c_attribute_aligned=0
5159 CFLAGS_save="${CFLAGS}"
5160 CFLAGS="${CFLAGS} -Werror"
5161 for ac_cv_c_attr_align_try in 64 32 16 8; do
5162 echo "trying $ac_cv_c_attr_align_try"
5164 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5165 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5166 if test "$ac_cv_c_attribute_aligned" != 0; then
5170 CFLAGS="${CFLAGS_save}"])
5171 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5172 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5173 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5176 dnl ========================================================
5177 dnl = Disable Opus audio codec support
5178 dnl ========================================================
5179 MOZ_ARG_DISABLE_BOOL(opus,
5180 [ --disable-opus Disable support for Opus audio],
5184 dnl ========================================================
5185 dnl = Disable VP8 decoder support
5186 dnl ========================================================
5187 MOZ_ARG_DISABLE_BOOL(webm,
5188 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5192 if test -n "$MOZ_WEBM"; then
5197 dnl ========================================================
5198 dnl = DirectShow support
5199 dnl ========================================================
5200 if test "$OS_ARCH" = "WINNT"; then
5201 dnl Enable DirectShow support by default.
5205 MOZ_ARG_DISABLE_BOOL(directshow,
5206 [ --disable-directshow Disable support for DirectShow],
5210 if test -n "$MOZ_DIRECTSHOW"; then
5211 AC_DEFINE(MOZ_DIRECTSHOW)
5214 dnl ========================================================
5215 dnl = Windows Media Foundation support
5216 dnl ========================================================
5217 if test "$OS_ARCH" = "WINNT"; then
5218 dnl Enable Windows Media Foundation support by default.
5219 dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5220 dnl guaranteed to have a recent-enough SDK to build WMF.
5224 MOZ_ARG_DISABLE_BOOL(wmf,
5225 [ --disable-wmf Disable support for Windows Media Foundation],
5229 if test -n "$MOZ_WMF"; then
5233 dnl ========================================================
5234 dnl FFmpeg H264/AAC Decoding Support
5235 dnl ========================================================
5236 case "$OS_TARGET" in
5237 WINNT|Darwin|Android)
5244 MOZ_ARG_DISABLE_BOOL(ffmpeg,
5245 [ --disable-ffmpeg Disable FFmpeg for fragmented H264/AAC decoding],
5250 if test -n "$MOZ_FFMPEG"; then
5251 AC_DEFINE(MOZ_FFMPEG)
5254 dnl ========================================================
5255 dnl = Built-in fragmented MP4 support.
5256 dnl ========================================================
5257 if test -n "$MOZ_WMF" -o -n "$MOZ_FFMPEG"; then
5258 dnl Enable fragmented MP4 parser on Windows by default.
5259 dnl We will also need to enable it on other platforms as we implement
5260 dnl platform decoder support there too.
5264 MOZ_ARG_DISABLE_BOOL(fmp4,
5265 [ --disable-fmp4 Disable support for in built Fragmented MP4 parsing],
5269 if test -n "$MOZ_FMP4"; then
5274 dnl ========================================================
5275 dnl = Enable media plugin support
5276 dnl ========================================================
5277 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5278 dnl Enable support on android by default
5282 MOZ_ARG_ENABLE_BOOL(media-plugins,
5283 [ --enable-media-plugins Enable support for media plugins],
5284 MOZ_MEDIA_PLUGINS=1,
5287 if test -n "$MOZ_MEDIA_PLUGINS"; then
5288 AC_DEFINE(MOZ_MEDIA_PLUGINS)
5291 dnl ========================================================
5292 dnl = Disable platform MP3 decoder on OSX
5293 dnl ========================================================
5294 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5298 MOZ_ARG_DISABLE_BOOL(apple-media,
5299 [ --disable-apple-media Disable support for Apple AudioToolbox/VideoToolbox],
5303 if test -n "$MOZ_APPLEMEDIA"; then
5304 AC_DEFINE(MOZ_APPLEMEDIA)
5307 dnl ========================================================
5308 dnl = Enable getUserMedia support
5309 dnl ========================================================
5310 MOZ_ARG_ENABLE_BOOL(media-navigator,
5311 [ --enable-media-navigator Enable support for getUserMedia],
5312 MOZ_MEDIA_NAVIGATOR=1,
5313 MOZ_MEDIA_NAVIGATOR=)
5315 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5316 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5319 dnl ========================================================
5320 dnl = Enable building OMX media plugin (B2G or Android)
5321 dnl ========================================================
5322 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5323 dnl Enable support on android by default
5327 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5328 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5332 if test -n "$MOZ_OMX_PLUGIN"; then
5333 if test "$OS_TARGET" = "Android"; then
5334 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5335 AC_DEFINE(MOZ_OMX_PLUGIN)
5337 dnl fail if we're not building on Gonk or Android
5338 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5342 dnl system libvpx Support
5343 dnl ========================================================
5344 MOZ_ARG_WITH_BOOL(system-libvpx,
5345 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5346 MOZ_NATIVE_LIBVPX=1)
5351 if test -n "$MOZ_VPX"; then
5353 if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
5354 AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
5357 _SAVE_CFLAGS=$CFLAGS
5359 if test -n "$MOZ_NATIVE_LIBVPX"; then
5360 dnl ============================
5361 dnl === libvpx Version check ===
5362 dnl ============================
5363 dnl Check to see if we have a system libvpx package.
5364 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.3.0)
5366 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
5367 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
5369 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5370 [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.])])
5372 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5373 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5375 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
5376 [AC_CHECK_FUNC(vpx_mem_set_functions)])
5377 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
5378 "$ac_cv_func_vpx_mem_set_functions" = no; then
5379 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
5382 CFLAGS=$_SAVE_CFLAGS
5386 AC_SUBST(MOZ_NATIVE_LIBVPX)
5387 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5388 AC_SUBST(MOZ_LIBVPX_LIBS)
5390 if test "$MOZ_WEBM"; then
5391 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5398 if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then
5400 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5401 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5402 dnl We currently require gcc on all arm platforms.
5405 VPX_NEED_OBJ_INT_EXTRACT=
5407 dnl See if we have assembly on this platform.
5408 case "$OS_ARCH:$CPU_ARCH" in
5410 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5414 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5418 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5422 dnl Check for yasm 1.1 or greater.
5423 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5424 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.])
5425 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5426 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.])
5428 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5430 dnl The encoder needs obj_int_extract to get asm offsets.
5434 if test -n "$GNU_AS" ; then
5436 dnl These flags are a lie; they're just used to enable the requisite
5437 dnl opcodes; actual arch detection is done at runtime.
5438 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5439 VPX_DASH_C_FLAG="-c"
5440 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5441 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5446 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5447 VPX_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC"
5452 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5453 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5459 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5460 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.])
5463 if test -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5464 dnl We prefer to get asm offsets using inline assembler, which the above
5465 dnl compilers can do. When we're not using one of those, we have to fall
5466 dnl back to obj_int_extract, which reads them from a compiled object
5467 dnl file. Unfortunately, that only works if we're compiling on a system
5468 dnl with the header files for the appropriate object file format.
5469 VPX_NEED_OBJ_INT_EXTRACT=1
5472 if test -n "$VPX_X86_ASM"; then
5473 AC_DEFINE(VPX_X86_ASM)
5474 elif test -n "$VPX_ARM_ASM"; then
5475 AC_DEFINE(VPX_ARM_ASM)
5477 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5481 dnl ========================================================
5482 dnl = Disable Wave decoder support
5483 dnl ========================================================
5484 MOZ_ARG_DISABLE_BOOL(wave,
5485 [ --disable-wave Disable Wave decoder support],
5489 if test -n "$MOZ_WAVE"; then
5493 dnl ========================================================
5494 dnl = Handle dependent MEDIA defines
5495 dnl ========================================================
5497 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5498 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/])
5501 if test -n "$MOZ_WEBRTC" -a -z "$MOZ_OPUS"; then
5502 AC_MSG_ERROR([MOZ_WEBRTC requires MOZ_OPUS which is disabled.])
5505 if test -n "$MOZ_VORBIS"; then
5506 AC_DEFINE(MOZ_VORBIS)
5509 if test -n "$MOZ_TREMOR"; then
5510 AC_DEFINE(MOZ_TREMOR)
5513 if test -n "$MOZ_OPUS"; then
5517 if test -n "$MOZ_WEBM_ENCODER"; then
5518 AC_DEFINE(MOZ_WEBM_ENCODER)
5520 AC_SUBST(MOZ_WEBM_ENCODER)
5522 dnl ==================================
5523 dnl = Check alsa availability on Linux
5524 dnl ==================================
5526 dnl If using Linux, ensure that the alsa library is available
5527 if test "$OS_TARGET" = "Linux"; then
5531 MOZ_ARG_ENABLE_BOOL(alsa,
5532 [ --enable-alsa Enable Alsa support (default on Linux)],
5536 if test -n "$MOZ_ALSA"; then
5537 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5538 [echo "$MOZ_ALSA_PKG_ERRORS"
5539 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.)])])
5543 AC_SUBST(MOZ_ALSA_CFLAGS)
5544 AC_SUBST(MOZ_ALSA_LIBS)
5546 dnl ========================================================
5547 dnl = Disable PulseAudio
5548 dnl ========================================================
5550 dnl If using Linux, ensure that the PA library is available
5551 case "$OS_TARGET" in
5552 WINNT|Darwin|Android|OpenBSD)
5555 if test -z "$MOZ_B2G"; then
5561 MOZ_ARG_DISABLE_BOOL(pulseaudio,
5562 [ --disable-pulseaudio Disable PulseAudio support],
5566 if test -n "$MOZ_PULSEAUDIO"; then
5567 if test -z "$gonkdir"; then
5568 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5569 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5570 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
5572 MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
5576 AC_SUBST(MOZ_PULSEAUDIO)
5577 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5579 dnl ========================================================
5580 dnl = Enable GStreamer
5581 dnl ========================================================
5582 case "$OS_TARGET" in
5583 WINNT|Darwin|Android)
5587 GST_API_VERSION=0.10
5591 MOZ_ARG_ENABLE_STRING(gstreamer,
5592 [ --enable-gstreamer[=0.10] Enable GStreamer support],
5594 # API version, eg 0.10, 1.0 etc
5595 if test -z "$enableval" -o "$enableval" = "yes"; then
5596 GST_API_VERSION=0.10
5597 elif test "$enableval" = "no"; then
5600 GST_API_VERSION=$enableval
5604 if test -n "$MOZ_GSTREAMER"; then
5605 # core/base release number
5606 if test "$GST_API_VERSION" = "1.0"; then
5612 PKG_CHECK_MODULES(GSTREAMER,
5613 gstreamer-$GST_API_VERSION >= $GST_VERSION
5614 gstreamer-app-$GST_API_VERSION
5615 gstreamer-plugins-base-$GST_API_VERSION,
5616 [_HAVE_GSTREAMER=1],
5618 if test -z "$_HAVE_GSTREAMER"; then
5619 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])
5622 _SAVE_LDFLAGS=$LDFLAGS
5623 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5624 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5625 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5626 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5628 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.])
5630 LDFLAGS=$_SAVE_LDFLAGS
5632 AC_SUBST(GSTREAMER_CFLAGS)
5633 AC_SUBST(GSTREAMER_LIBS)
5636 AC_SUBST(MOZ_GSTREAMER)
5637 AC_SUBST(GST_API_VERSION)
5639 if test -n "$MOZ_GSTREAMER"; then
5640 AC_DEFINE(MOZ_GSTREAMER)
5641 AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION")
5645 dnl ========================================================
5646 dnl Permissions System
5647 dnl ========================================================
5648 MOZ_ARG_DISABLE_BOOL(permissions,
5649 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5654 dnl ========================================================
5655 dnl Child permissions, currently only used for b2g
5656 dnl ========================================================
5657 if test -n "$MOZ_B2G"; then
5658 if test -n "$MOZ_PERMISSIONS"; then
5659 MOZ_CHILD_PERMISSIONS=1
5661 AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
5664 AC_SUBST(MOZ_CHILD_PERMISSIONS)
5666 dnl ========================================================
5668 dnl ========================================================
5669 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5670 [ --disable-negotiateauth Disable GSS-API negotiation ],
5671 MOZ_AUTH_EXTENSION=,
5672 MOZ_AUTH_EXTENSION=1 )
5674 dnl ========================================================
5675 dnl Pref extensions (autoconfig)
5676 dnl ========================================================
5677 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5678 [ --disable-pref-extensions
5679 Disable pref extensions such as autoconfig],
5680 MOZ_PREF_EXTENSIONS=,
5681 MOZ_PREF_EXTENSIONS=1 )
5683 dnl ========================================================
5684 dnl Searching of system directories for extensions.
5685 dnl Note: this switch is meant to be used for test builds
5686 dnl whose behavior should not depend on what happens to be
5687 dnl installed on the local machine.
5688 dnl ========================================================
5689 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5690 [ --disable-system-extension-dirs
5691 Disable searching system- and account-global
5692 directories for extensions of any kind; use
5693 only profile-specific extension directories],
5694 ENABLE_SYSTEM_EXTENSION_DIRS=,
5695 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5696 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5697 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5700 dnl ========================================================
5701 dnl = Universalchardet
5702 dnl ========================================================
5703 MOZ_ARG_DISABLE_BOOL(universalchardet,
5704 [ --disable-universalchardet
5705 Disable universal encoding detection],
5706 MOZ_UNIVERSALCHARDET=,
5707 MOZ_UNIVERSALCHARDET=1 )
5709 if test -n "${JAVA_BIN_PATH}"; then
5710 dnl Look for javac and jar in the specified path.
5711 JAVA_PATH="$JAVA_BIN_PATH"
5713 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5714 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5717 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5718 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5719 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5720 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5721 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5722 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5724 if test -n "${JAVA_BIN_PATH}" -o \
5725 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5726 if test -z "$JAVA" -o "$JAVA" = ":"; then
5727 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}])
5729 if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5730 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}])
5732 if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5733 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}])
5735 if test -z "$JAR" -o "$JAR" = ":"; then
5736 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}])
5738 if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5739 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}])
5741 if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5742 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}])
5746 dnl ========================================================
5747 dnl = ANGLE OpenGL->D3D translator for WebGL
5748 dnl = * only applies to win32
5749 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5750 dnl ========================================================
5754 MOZ_HAS_WINSDK_WITH_D3D=
5755 MOZ_D3DCOMPILER_VISTA_DLL=
5756 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5757 MOZ_DIRECTX_SDK_PATH=
5758 MOZ_D3DCOMPILER_XP_DLL=
5759 MOZ_D3DCOMPILER_XP_CAB=
5761 case "$target_os" in
5763 MOZ_ANGLE_RENDERER=1
5767 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5768 case "${target_cpu}" in
5770 MOZ_D3D_CPU_SUFFIX=x86
5773 MOZ_D3D_CPU_SUFFIX=x64
5777 MOZ_ARG_DISABLE_BOOL(webgl,
5778 [ --disable-webgl Disable building of the WebGL implementation],
5779 MOZ_WEBGL_DISABLED=1,
5780 MOZ_WEBGL_DISABLED=)
5782 MOZ_ARG_ENABLE_BOOL(require-all-d3dc-versions,
5783 [ --enable-require-all-d3dc-versions Require all versions of the D3D compiler needed for supported Windows systems.],
5784 MOZ_REQUIRE_ALL_D3DCS=1,
5785 MOZ_REQUIRE_ALL_D3DCS=)
5787 if test -n "$MOZ_WEBGL_DISABLED"; then
5792 if test -n "$MOZ_WEBGL"; then
5793 AC_DEFINE(MOZ_WEBGL)
5796 if test -n "$MOZ_WEBGL_CONFORMANT"; then
5797 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
5800 dnl ========================================================
5801 dnl D3D compiler DLL
5802 dnl ========================================================
5803 MOZ_FOUND_D3D_COMPILERS=
5805 if test -n "$MOZ_ANGLE_RENDERER"; then
5806 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
5807 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
5810 ######################################
5811 # Find _46+ for use by Vista+.
5813 # Find a D3D compiler DLL in a Windows SDK.
5814 MOZ_D3DCOMPILER_VISTA_DLL=
5815 case "$MOZ_WINSDK_MAXVER" in
5817 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
5818 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
5821 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_46.dll
5822 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.0.])
5826 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5827 # We have a name, now track down the path.
5828 if test -n "$WINDOWSSDKDIR"; then
5829 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
5830 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5831 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5832 MOZ_HAS_WINSDK_WITH_D3D=1
5834 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5835 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
5836 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5839 AC_MSG_RESULT([Windows SDK not found.])
5843 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5844 MOZ_D3DCOMPILER_VISTA_DLL=
5847 # On mingw, check if headers are provided by toolchain.
5848 if test -n "$GNU_CC"; then
5849 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
5852 ######################################
5853 # Find _43 for use by XP.
5855 # Get the SDK path from the registry.
5856 # First try to get the June 2010 SDK
5857 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5858 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5859 # Otherwise just take whatever comes first
5860 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5862 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'`
5864 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5865 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/dxguid.lib ; then
5866 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5868 AC_MSG_RESULT([DirectX SDK not found.])
5869 MOZ_DIRECTX_SDK_PATH=
5872 # Check that our DirectX SDK is acceptable.
5873 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5874 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5875 AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
5876 MOZ_DIRECTX_SDK_PATH=
5880 if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5881 # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
5882 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5883 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'`
5885 if test -n "$MOZ_D3DX9_VERSION" ; then
5886 MOZ_D3DCOMPILER_XP_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_D3D_CPU_SUFFIX}.cab | head -n1`
5888 if test -n "$MOZ_D3DCOMPILER_XP_CAB"; then
5889 MOZ_D3DCOMPILER_XP_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5891 AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
5892 AC_MSG_ERROR([DirectX SDK at "$MOZ_DIRECTX_SDK_PATH" appears broken.])
5893 MOZ_DIRECTX_SDK_PATH=
5896 AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
5897 MOZ_DIRECTX_SDK_PATH=
5900 AC_MSG_RESULT([Couldn't find an acceptable DirectX SDK for ANGLE, needed for d3dcompiler_43.])
5901 AC_MSG_RESULT([ Either ignore, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5904 ######################################
5905 # Check that we found what we needed.
5906 MOZ_FOUND_A_D3D_COMPILER=
5907 MOZ_FOUND_BOTH_D3D_COMPILERS=1
5909 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5910 MOZ_FOUND_A_D3D_COMPILER=1
5911 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
5913 MOZ_FOUND_BOTH_D3D_COMPILERS=
5916 if test -n "$MOZ_D3DCOMPILER_XP_DLL"; then
5917 MOZ_FOUND_A_D3D_COMPILER=1
5918 AC_MSG_RESULT([Found d3dcompiler DLL for XP: $MOZ_D3DCOMPILER_XP_DLL])
5920 MOZ_FOUND_BOTH_D3D_COMPILERS=
5923 if test -z "$CROSS_COMPILE"; then
5924 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
5925 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
5926 AC_MSG_ERROR([ Either install Windows SDK 8.0+, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5929 if test -n "$MOZ_REQUIRE_ALL_D3DCS" -a -z "$MOZ_FOUND_BOTH_D3D_COMPILERS"; then
5930 AC_MSG_ERROR([Both D3D compilers _43 and _46+ are required by --enable-require-d3d-compilers.])
5931 AC_MSG_ERROR([ Install Windows SDK 8.0+, as well as DirectX SDK (June 2010 version or newer), or reconfigure without this flag.])
5937 dnl ========================================================
5939 dnl ========================================================
5941 MOZ_GAMEPAD_BACKEND=stub
5943 # Gamepad DOM is built on supported platforms by default.
5944 case "$OS_TARGET" in
5949 if test "$MOZ_WIDGET_TOOLKIT" != "gonk"; then
5957 MOZ_ARG_DISABLE_BOOL(gamepad,
5958 [ --disable-gamepad Disable gamepad support],
5962 if test "$MOZ_GAMEPAD"; then
5963 case "$OS_TARGET" in
5965 MOZ_GAMEPAD_BACKEND=cocoa
5968 case "$MOZ_WINSDK_MAXVER" in
5969 # We support building with the Windows 7 SDK otherwise, but
5970 # Gamepad support requires the Windows 8 SDK for some HID headers.
5972 AC_MSG_ERROR([The Windows 8 SDK or newer is required to build Gamepad support. Please install a newer Windows SDK or reconfigure with --disable-gamepad to disable gamepad support.])
5977 MOZ_GAMEPAD_BACKEND=windows
5980 MOZ_CHECK_HEADER([linux/joystick.h])
5981 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5982 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.])
5984 MOZ_GAMEPAD_BACKEND=linux
5987 MOZ_GAMEPAD_BACKEND=android
5993 AC_DEFINE(MOZ_GAMEPAD)
5995 AC_SUBST(MOZ_GAMEPAD)
5996 AC_SUBST(MOZ_GAMEPAD_BACKEND)
5998 dnl ========================================================
5999 dnl = Breakpad crash reporting (on by default on supported platforms)
6000 dnl ========================================================
6003 i?86-*-mingw*|x86_64-*-mingw*)
6006 i?86-apple-darwin*|x86_64-apple-darwin*)
6009 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6010 if test "$MOZ_ENABLE_GTK"; then
6014 *-android*|*-linuxandroid*)
6022 MOZ_ARG_DISABLE_BOOL(crashreporter,
6023 [ --disable-crashreporter Disable breakpad crash reporting],
6024 [MOZ_CRASHREPORTER=],
6025 [MOZ_CRASHREPORTER=F # Force enable breakpad])
6027 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
6028 if test "$MOZ_CRASHREPORTER" = F; then
6029 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
6034 if test -n "$MOZ_CRASHREPORTER"; then
6035 AC_DEFINE(MOZ_CRASHREPORTER)
6037 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
6038 test -z "$SKIP_LIBRARY_CHECKS"; then
6039 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6040 AC_SUBST(MOZ_GTHREAD_CFLAGS)
6041 AC_SUBST(MOZ_GTHREAD_LIBS)
6044 if test "$OS_ARCH" = "WINNT"; then
6045 if test -z "$HAVE_64BIT_OS"; then
6046 MOZ_CRASHREPORTER_INJECTOR=1
6047 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
6052 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6053 [ --with-crashreporter-enable-percent=NN
6054 Enable sending crash reports by default on NN% of users. (default=100)],
6055 [ val=`echo $withval | sed 's/[^0-9]//g'`
6056 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6058 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6059 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6061 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6063 dnl ========================================================
6064 dnl = libjpeg-turbo configuration
6065 dnl ========================================================
6067 if test -z "$MOZ_NATIVE_JPEG"; then
6071 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6072 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
6074 MOZ_LIBJPEG_TURBO=1)
6076 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6077 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6080 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6083 if test -n "$MOZ_LIBJPEG_TURBO"; then
6085 dnl Do we support libjpeg-turbo on this platform?
6086 case "$OS_ARCH:$OS_TEST" in
6088 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6089 LIBJPEG_TURBO_X86_ASM=1
6092 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6093 LIBJPEG_TURBO_X64_ASM=1
6095 WINNT:x86|WINNT:i?86)
6096 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6097 LIBJPEG_TURBO_X86_ASM=1
6100 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6101 LIBJPEG_TURBO_X64_ASM=1
6104 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6105 LIBJPEG_TURBO_ARM_ASM=1
6108 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6109 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6110 LIBJPEG_TURBO_X86_ASM=1
6114 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6115 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6116 LIBJPEG_TURBO_X64_ASM=1
6123 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6124 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6125 dnl it doesn't exist or we have too old of a version.
6126 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6127 LIBJPEG_TURBO_AS=$YASM
6129 if test -z "$LIBJPEG_TURBO_AS" ; then
6130 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.])
6133 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6134 dnl on Linux and 1.1 or newer everywhere else.
6135 if test "$OS_ARCH" = "Linux" ; then
6136 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
6137 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.])
6140 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6141 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.])
6146 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6147 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6148 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6149 echo "Using $AS as the assembler for ARM code."
6150 LIBJPEG_TURBO_AS=$AS
6153 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6154 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6155 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6156 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6157 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6158 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6159 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6160 dnl Warn if we're not building the optimized routines, even though the user
6161 dnl didn't specify --disable-libjpeg-turbo.
6162 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6165 dnl ========================================================
6166 dnl = Enable compilation of specific extension modules
6167 dnl ========================================================
6169 MOZ_ARG_ENABLE_STRING(extensions,
6170 [ --enable-extensions Enable extensions],
6171 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6172 if test "$option" = "yes" -o "$option" = "all"; then
6173 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6174 elif test "$option" = "no" -o "$option" = "none"; then
6176 elif test "$option" = "default"; then
6177 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6178 elif test `echo "$option" | grep -c \^-` != 0; then
6179 option=`echo $option | sed 's/^-//'`
6180 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6182 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6185 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6187 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6188 # Suppress warning on non-X11 platforms
6189 if test -n "$MOZ_X11"; then
6190 AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6192 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6195 dnl Do not build gnomevfs with libxul based apps
6196 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6197 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6200 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6201 # Suppress warning on non-X11 platforms
6202 if test -n "$MOZ_X11"; then
6203 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6205 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6208 dnl Do not build gio with libxul based apps
6209 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6210 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6213 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6215 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6217 AC_SUBST(MOZ_GIO_COMPONENT)
6219 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6220 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6221 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6225 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6227 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6228 dnl when trying to build a nonexistent extension.
6229 for extension in $MOZ_EXTENSIONS; do
6230 if test ! -d "${srcdir}/extensions/${extension}"; then
6231 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6235 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6236 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6239 dnl ========================================================
6240 dnl Build Freetype in the tree
6241 dnl ========================================================
6242 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6243 [ --enable-tree-freetype Enable Tree FreeType],
6244 MOZ_TREE_FREETYPE=1,
6245 MOZ_TREE_FREETYPE= )
6246 if test -n "$MOZ_TREE_FREETYPE"; then
6247 if test -n "$_WIN32_MSVC"; then
6248 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6250 AC_DEFINE(MOZ_TREE_FREETYPE)
6251 AC_SUBST(MOZ_TREE_FREETYPE)
6252 MOZ_ENABLE_CAIRO_FT=1
6253 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6254 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6255 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6256 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6258 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6259 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6260 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6261 AC_SUBST(CAIRO_FT_CFLAGS)
6264 dnl ========================================================
6266 dnl ========================================================
6267 dnl Abort Windows build if the required major version and
6268 dnl minimum minor version of Unicode NSIS isn't in the path
6269 dnl (unless in case of cross compiling, for which Unicode
6270 dnl is not yet sufficient).
6271 if test "$OS_ARCH" = "WINNT"; then
6272 MIN_NSIS_MAJOR_VER=2
6273 MIN_NSIS_MINOR_VER=46
6274 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-3.0a2.exe makensisu-2.46.exe makensis)
6275 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6276 AC_MSG_RESULT([yes])
6277 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null`
6279 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6281 if test "$MAKENSISU_PARSED_VER" = ""; then
6283 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
6286 MAKENSISU_MAJOR_VER=0
6287 MAKENSISU_MINOR_VER=0
6288 if test ! "$MAKENSISU_PARSED_VER" = ""; then
6289 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'`
6290 MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'`
6292 AC_MSG_CHECKING([for Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater])
6293 if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \
6294 "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER ||
6295 test "$MAKENSISU_MAJOR_VER" -gt $MIN_NSIS_MAJOR_VER; then
6296 AC_MSG_RESULT([yes])
6299 if test -z "$CROSS_COMPILE"; then
6300 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $REQ_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.])
6305 elif test -z "$CROSS_COMPILE"; then
6306 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $REQ_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.])
6312 dnl ========================================================
6314 dnl ========================================================
6315 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6316 [ --disable-webapp-runtime Disable Web App Runtime],
6317 MOZ_WEBAPP_RUNTIME=,
6318 MOZ_WEBAPP_RUNTIME=1)
6319 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a -z "$MOZ_WIDGET_GTK" ; then
6322 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6325 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6326 if test "$MOZ_WEBAPP_RUNTIME"; then
6327 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6330 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6331 if test -z "$TAR"; then
6332 AC_MSG_ERROR([no tar archiver found in \$PATH])
6336 AC_CHECK_PROGS(WGET, wget, "")
6339 dnl ========================================================
6341 dnl ========================================================
6343 if test -n "$MOZ_SIGN_CMD"; then
6344 AC_DEFINE(MOZ_SIGNING)
6347 dnl ========================================================
6348 dnl Maintenance Service
6349 dnl ========================================================
6351 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6352 [ --enable-maintenance-service Enable building of maintenanceservice],
6353 MOZ_MAINTENANCE_SERVICE=1,
6354 MOZ_MAINTENANCE_SERVICE= )
6356 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6357 if test "$OS_ARCH" = "WINNT"; then
6358 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6360 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6364 dnl ========================================================
6365 dnl Bundled fonts on desktop platforms
6366 dnl ========================================================
6368 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
6369 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
6370 MOZ_BUNDLED_FONTS=1,
6373 if test -n "$MOZ_BUNDLED_FONTS"; then
6374 AC_DEFINE(MOZ_BUNDLED_FONTS)
6377 dnl ========================================================
6378 dnl Verify MAR signatures
6379 dnl ========================================================
6381 MOZ_ARG_ENABLE_BOOL(verify-mar,
6382 [ --enable-verify-mar Enable verifying MAR signatures],
6383 MOZ_VERIFY_MAR_SIGNATURE=1,
6384 MOZ_VERIFY_MAR_SIGNATURE= )
6386 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6387 if test "$OS_ARCH" = "WINNT"; then
6388 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6390 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6394 dnl ========================================================
6395 dnl Enable building the signmar program.
6396 dnl This option is much different than the --enable-verify-mar option.
6397 dnl --enable-verify-mar is for enabling the verification check on MAR
6398 dnl files in the updater. The --enable-signmar option is for building
6399 dnl the signmar program.
6400 dnl ========================================================
6402 MOZ_ARG_ENABLE_BOOL(signmar,
6403 [ --enable-signmar Enable building the signmar program],
6404 MOZ_ENABLE_SIGNMAR=1,
6405 MOZ_ENABLE_SIGNMAR= )
6407 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6408 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6411 dnl ========================================================
6413 dnl ========================================================
6415 MOZ_ARG_DISABLE_BOOL(updater,
6416 [ --disable-updater Disable building of updater],
6420 if test -n "$MOZ_UPDATER"; then
6421 AC_DEFINE(MOZ_UPDATER)
6424 # tools/update-packaging is not checked out by default.
6425 MOZ_ARG_ENABLE_BOOL(update-packaging,
6426 [ --enable-update-packaging
6427 Enable tools/update-packaging],
6428 MOZ_UPDATE_PACKAGING=1,
6429 MOZ_UPDATE_PACKAGING= )
6430 AC_SUBST(MOZ_UPDATE_PACKAGING)
6432 dnl ========================================================
6433 dnl build the tests by default
6434 dnl ========================================================
6435 MOZ_ARG_DISABLE_BOOL(tests,
6436 [ --disable-tests Do not build test libraries & programs],
6440 if test -n "$ENABLE_TESTS"; then
6442 AC_DEFINE(ENABLE_TESTS)
6443 AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6444 AC_SUBST(GTEST_HAS_RTTI)
6445 if test -n "$_WIN32_MSVC"; then
6446 AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6448 if test "${OS_TARGET}" = "Android"; then
6449 AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6450 AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6451 AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6452 AC_SUBST(GTEST_OS_LINUX_ANDROID)
6453 AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6454 AC_SUBST(GTEST_HAS_CLONE)
6458 dnl ========================================================
6459 dnl parental controls (for Windows Vista)
6460 dnl ========================================================
6461 MOZ_ARG_DISABLE_BOOL(parental-controls,
6462 [ --disable-parental-controls
6463 Do not build parental controls],
6464 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6465 MOZ_DISABLE_PARENTAL_CONTROLS=)
6466 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6467 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6470 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6472 dnl ========================================================
6473 dnl = Disable DOMCrypto
6474 dnl ========================================================
6475 if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
6476 AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
6478 AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
6480 dnl ========================================================
6481 dnl = Disable EV certificate verification
6482 dnl ========================================================
6483 if test -n "$MOZ_NO_EV_CERTS"; then
6484 AC_DEFINE(MOZ_NO_EV_CERTS)
6486 AC_SUBST(MOZ_NO_EV_CERTS)
6488 dnl ========================================================
6489 dnl = Disable libpkix
6490 dnl ========================================================
6491 if test -n "$NSS_NO_LIBPKIX"; then
6492 AC_DEFINE(NSS_NO_LIBPKIX)
6494 AC_SUBST(NSS_NO_LIBPKIX)
6496 dnl ========================================================
6497 dnl = Content process sandboxing
6498 dnl ========================================================
6499 if test -n "$gonkdir"; then
6500 MOZ_CONTENT_SANDBOX=1
6503 MOZ_ARG_ENABLE_BOOL(content-sandbox,
6504 [ --enable-content-sandbox Enable sandboxing support for content-processes],
6505 MOZ_CONTENT_SANDBOX=1,
6506 MOZ_CONTENT_SANDBOX=)
6508 if test -n "$MOZ_CONTENT_SANDBOX"; then
6509 AC_DEFINE(MOZ_CONTENT_SANDBOX)
6512 AC_SUBST(MOZ_CONTENT_SANDBOX)
6514 MOZ_ARG_ENABLE_BOOL(content-sandbox-reporter,
6515 [ --enable-content-sandbox-reporter Enable syscall reporter to troubleshoot syscalls denied by the content-processes sandbox],
6516 MOZ_CONTENT_SANDBOX_REPORTER=1,
6517 MOZ_CONTENT_SANDBOX_REPORTER=)
6519 if test -n "$MOZ_CONTENT_SANDBOX_REPORTER"; then
6520 AC_DEFINE(MOZ_CONTENT_SANDBOX_REPORTER)
6523 AC_SUBST(MOZ_CONTENT_SANDBOX_REPORTER)
6525 dnl ========================================================
6527 dnl = Module specific options
6529 dnl ========================================================
6530 MOZ_ARG_HEADER(Individual module options)
6532 dnl ========================================================
6533 dnl = Disable feed handling components
6534 dnl ========================================================
6535 MOZ_ARG_DISABLE_BOOL(feeds,
6536 [ --disable-feeds Disable feed handling and processing components],
6539 if test -n "$MOZ_FEEDS"; then
6540 AC_DEFINE(MOZ_FEEDS)
6542 if test "$MOZ_BUILD_APP" = "browser"; then
6543 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6547 dnl ========================================================
6548 dnl Check for sqlite
6549 dnl ========================================================
6552 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6553 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6554 MOZ_NATIVE_SQLITE=1,
6555 MOZ_NATIVE_SQLITE= )
6557 if test -z "$MOZ_NATIVE_SQLITE"
6560 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6562 dnl ============================
6563 dnl === SQLite Version check ===
6564 dnl ============================
6565 dnl Check to see if the system SQLite package is new enough.
6566 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6568 dnl ==================================
6569 dnl === SQLITE_SECURE_DELETE check ===
6570 dnl ==================================
6571 dnl Check to see if the system SQLite package is compiled with
6572 dnl SQLITE_SECURE_DELETE enabled.
6573 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6574 _SAVE_CFLAGS="$CFLAGS"
6575 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6577 LIBS="$LIBS $SQLITE_LIBS"
6578 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6580 #include "sqlite3.h"
6582 int main(int argc, char **argv){
6583 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6585 ac_cv_sqlite_secure_delete=yes,
6586 ac_cv_sqlite_secure_delete=no,
6587 ac_cv_sqlite_secure_delete=no
6590 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6591 CFLAGS="$_SAVE_CFLAGS"
6593 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6594 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6597 dnl ===============================
6598 dnl === SQLITE_THREADSAFE check ===
6599 dnl ===============================
6600 dnl Check to see if the system SQLite package is compiled with
6601 dnl SQLITE_THREADSAFE enabled.
6602 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6603 _SAVE_CFLAGS="$CFLAGS"
6604 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6606 LIBS="$LIBS $SQLITE_LIBS"
6607 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6609 #include "sqlite3.h"
6611 int main(int argc, char **argv){
6612 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6614 ac_cv_sqlite_threadsafe=yes,
6615 ac_cv_sqlite_threadsafe=no,
6616 ac_cv_sqlite_threadsafe=no
6619 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6620 CFLAGS="$_SAVE_CFLAGS"
6622 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6623 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6626 dnl ================================
6627 dnl === SQLITE_ENABLE_FTS3 check ===
6628 dnl ================================
6629 dnl check to see if the system SQLite package is compiled with
6630 dnl SQLITE_ENABLE_FTS3 enabled.
6631 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6632 _SAVE_CFLAGS="$CFLAGS"
6633 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6635 LIBS="$LIBS $SQLITE_LIBS"
6636 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6638 #include "sqlite3.h"
6640 int main(int argc, char **argv){
6641 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6643 ac_cv_sqlite_enable_fts3=yes,
6644 ac_cv_sqlite_enable_fts3=no,
6645 ac_cv_sqlite_enable_fts3=no
6648 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6649 CFLAGS="$_SAVE_CFLAGS"
6651 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6652 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6655 dnl =========================================
6656 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6657 dnl =========================================
6658 dnl check to see if the system SQLite package is compiled with
6659 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6660 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6661 _SAVE_CFLAGS="$CFLAGS"
6662 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6664 LIBS="$LIBS $SQLITE_LIBS"
6665 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6667 #include "sqlite3.h"
6669 int main(int argc, char **argv){
6670 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6672 ac_cv_sqlite_enable_unlock_notify=yes,
6673 ac_cv_sqlite_enable_unlock_notify=no,
6674 ac_cv_sqlite_enable_unlock_notify=no
6677 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6678 CFLAGS="$_SAVE_CFLAGS"
6680 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6681 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6685 if test -n "$MOZ_NATIVE_SQLITE"; then
6686 AC_DEFINE(MOZ_NATIVE_SQLITE)
6688 AC_SUBST(MOZ_NATIVE_SQLITE)
6690 dnl ========================================================
6691 dnl = Enable help viewer (off by default)
6692 dnl ========================================================
6693 if test -n "$MOZ_HELP_VIEWER"; then
6694 dnl Do this if defined in confvars.sh
6695 AC_DEFINE(MOZ_HELP_VIEWER)
6698 dnl ========================================================
6699 dnl = Enable safe browsing (anti-phishing)
6700 dnl ========================================================
6701 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6702 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6703 MOZ_SAFE_BROWSING=1,
6704 MOZ_SAFE_BROWSING= )
6705 if test -n "$MOZ_SAFE_BROWSING"; then
6706 AC_DEFINE(MOZ_SAFE_BROWSING)
6708 AC_SUBST(MOZ_SAFE_BROWSING)
6710 dnl ========================================================
6711 dnl = Enable url-classifier
6712 dnl ========================================================
6713 dnl Implicitly enabled by default if building with safe-browsing
6714 if test -n "$MOZ_SAFE_BROWSING"; then
6715 MOZ_URL_CLASSIFIER=1
6717 MOZ_ARG_ENABLE_BOOL(url-classifier,
6718 [ --enable-url-classifier Enable url classifier module],
6719 MOZ_URL_CLASSIFIER=1,
6720 MOZ_URL_CLASSIFIER= )
6721 if test -n "$MOZ_URL_CLASSIFIER"; then
6722 AC_DEFINE(MOZ_URL_CLASSIFIER)
6724 AC_SUBST(MOZ_URL_CLASSIFIER)
6726 dnl ========================================================
6727 dnl = Disable zipwriter
6728 dnl ========================================================
6729 MOZ_ARG_DISABLE_BOOL(zipwriter,
6730 [ --disable-zipwriter Disable zipwriter component],
6733 AC_SUBST(MOZ_ZIPWRITER)
6735 dnl ========================================================
6737 dnl ========================================================
6739 MOZ_ARG_WITH_STRING(gl-provider,
6740 [ --with-gl-provider=ID
6741 Set GL provider backend type],
6742 [ val=`echo $withval`
6743 MOZ_GL_PROVIDER="$val"])
6745 if test -n "$MOZ_GL_PROVIDER"; then
6746 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6747 AC_SUBST(MOZ_GL_PROVIDER)
6748 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6750 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6751 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6753 dnl ========================================================
6754 dnl = faststripe theme
6755 dnl ========================================================
6756 MOZ_ARG_ENABLE_BOOL(faststripe,
6757 [ --enable-faststripe Use faststripe theme],
6758 MOZ_THEME_FASTSTRIPE=1,
6759 MOZ_THEME_FASTSTRIPE= )
6760 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6762 dnl ========================================================
6764 dnl = Feature options that require extra sources to be pulled
6766 dnl ========================================================
6767 dnl MOZ_ARG_HEADER(Features that require extra sources)
6769 dnl ========================================================
6771 dnl = Runtime debugging and Optimization Options
6773 dnl ========================================================
6774 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
6776 dnl ========================================================
6777 dnl enable mobile optimizations
6778 dnl ========================================================
6779 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6780 [ --enable-mobile-optimize
6781 Enable mobile optimizations],
6782 MOZ_GFX_OPTIMIZE_MOBILE=1)
6784 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6786 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6787 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6790 dnl ========================================================
6791 dnl = Enable code optimization. ON by default.
6792 dnl ========================================================
6793 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6794 MOZ_OPTIMIZE_FLAGS="-O"
6797 MOZ_ARG_ENABLE_STRING(optimize,
6798 [ --disable-optimize Disable compiler optimization
6799 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6800 [ if test "$enableval" != "no"; then
6802 if test -n "$enableval" -a "$enableval" != "yes"; then
6803 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6808 fi ], MOZ_OPTIMIZE=1)
6810 MOZ_SET_FRAMEPTR_FLAGS
6812 if test "$COMPILE_ENVIRONMENT"; then
6813 if test -n "$MOZ_OPTIMIZE"; then
6814 AC_MSG_CHECKING([for valid optimization flags])
6815 _SAVE_CFLAGS=$CFLAGS
6816 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6817 AC_TRY_COMPILE([#include <stdio.h>],
6818 [printf("Hello World\n");],
6821 AC_MSG_RESULT([$_results])
6822 if test "$_results" = "no"; then
6823 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6825 CFLAGS=$_SAVE_CFLAGS
6827 fi # COMPILE_ENVIRONMENT
6829 AC_SUBST(MOZ_OPTIMIZE)
6830 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6831 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6832 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6833 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6834 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6835 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6837 dnl ========================================================
6838 dnl = Enable any treating of compile warnings as errors
6839 dnl ========================================================
6840 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6841 [ --enable-warnings-as-errors
6842 Enable treating of warnings as errors],
6843 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6844 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6845 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6846 WARNINGS_AS_ERRORS=''
6847 elif test "$GNU_CC"; then
6848 # Prevent the following GCC warnings from being treated as errors:
6849 # -Wuninitialized - too many false positives
6850 # -Wmaybe-uninitialized - too many false positives
6851 # -Wdeprecated-declarations - we don't want our builds held hostage when a
6852 # platform-specific API becomes deprecated.
6853 MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
6854 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
6855 MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
6856 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
6857 MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
6858 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
6861 dnl ========================================================
6862 dnl = Disable runtime logging checks
6863 dnl ========================================================
6864 MOZ_ARG_DISABLE_BOOL(logging,
6865 [ --disable-logging Disable logging facilities],
6866 NS_DISABLE_LOGGING=1,
6867 NS_DISABLE_LOGGING= )
6868 if test "$NS_DISABLE_LOGGING"; then
6869 AC_DEFINE(NS_DISABLE_LOGGING)
6871 AC_DEFINE(MOZ_LOGGING)
6874 dnl ========================================================
6875 dnl = This will enable logging of addref, release, ctor, dtor.
6876 dnl ========================================================
6877 _ENABLE_LOGREFCNT=42
6878 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6879 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6880 _ENABLE_LOGREFCNT=1,
6881 _ENABLE_LOGREFCNT= )
6882 if test "$_ENABLE_LOGREFCNT" = "1"; then
6883 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6884 elif test -z "$_ENABLE_LOGREFCNT"; then
6885 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6888 dnl ========================================================
6889 dnl moz_dump_painting
6890 dnl ========================================================
6891 MOZ_ARG_ENABLE_BOOL(dump-painting,
6892 [ --enable-dump-painting Enable paint debugging.],
6893 MOZ_DUMP_PAINTING=1,
6894 MOZ_DUMP_PAINTING= )
6895 if test -n "$MOZ_DUMP_PAINTING"; then
6896 AC_DEFINE(MOZ_DUMP_PAINTING)
6897 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6899 if test -n "$MOZ_DEBUG"; then
6900 AC_DEFINE(MOZ_DUMP_PAINTING)
6903 dnl ========================================================
6904 dnl = Enable trace malloc
6905 dnl ========================================================
6906 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6907 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6908 [ --enable-trace-malloc Enable malloc tracing; also disables DMD and jemalloc],
6911 if test "$NS_TRACE_MALLOC"; then
6912 # Please, Mr. Linker Man, don't take away our symbol names
6913 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6914 AC_DEFINE(NS_TRACE_MALLOC)
6916 AC_SUBST(NS_TRACE_MALLOC)
6918 dnl ========================================================
6920 dnl ========================================================
6922 MOZ_ARG_ENABLE_BOOL(dmd,
6923 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
6927 dnl The two options are conflicting. Fails the configure to alert the user.
6928 if test "$NS_TRACE_MALLOC" -a "$MOZ_DMD"; then
6929 AC_MSG_ERROR([--enable-trace-malloc and --enable-dmd are conflicting options])
6932 if test "$MOZ_DMD"; then
6935 if test "${CPU_ARCH}" = "arm"; then
6936 CFLAGS="$CFLAGS -funwind-tables"
6937 CXXFLAGS="$CXXFLAGS -funwind-tables"
6940 MOZ_MEMORY=1 # DMD enables jemalloc
6941 MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
6945 dnl ========================================================
6946 dnl = Enable jemalloc
6947 dnl ========================================================
6948 MOZ_ARG_ENABLE_BOOL(jemalloc,
6949 [ --enable-jemalloc Replace memory allocator with jemalloc],
6953 if test "$NS_TRACE_MALLOC"; then
6957 if test "${OS_TARGET}" = "Android"; then
6958 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6960 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin"; then
6961 dnl On Windows and OSX, we want to link all our binaries against mozglue
6962 if test -z "$GNU_CC"; then
6963 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6965 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6968 dnl On other Unix systems, we only want to link executables against mozglue
6969 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6970 dnl On other Unix systems, where mozglue is a static library, jemalloc is
6971 dnl separated for the SDK, so we need to add it here.
6972 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6973 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6975 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6976 if test -n "$GNU_CC"; then
6977 dnl And we need mozglue symbols to be exported.
6978 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6980 if test "$MOZ_LINKER" = 1; then
6981 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
6985 dnl ========================================================
6986 dnl = Enable dynamic replacement of malloc implementation
6987 dnl ========================================================
6988 if test -n "$NIGHTLY_BUILD" -a -n "$MOZ_MEMORY"; then
6989 # Enable on central for the debugging opportunities it adds.
6990 MOZ_REPLACE_MALLOC=1
6992 MOZ_ARG_ENABLE_BOOL(replace-malloc,
6993 [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
6994 MOZ_REPLACE_MALLOC=1,
6995 MOZ_REPLACE_MALLOC= )
6997 dnl The two options are conflicting. Fails the configure to alert the user.
6998 if test "$NS_TRACE_MALLOC" -a "$MOZ_REPLACE_MALLOC"; then
6999 AC_MSG_ERROR([--enable-trace-malloc and --enable-replace-malloc are conflicting options])
7002 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
7003 dnl We don't want to enable jemalloc unconditionally because it may be a
7004 dnl deliberate choice not to enable it (bug 702250, for instance)
7005 AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
7006 elif test -n "$MOZ_REPLACE_MALLOC"; then
7007 MOZ_NATIVE_JEMALLOC=
7009 dnl Replace-malloc Mac linkage quirks
7010 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
7011 AC_CACHE_CHECK([how to do weak dynamic linking],
7012 ac_cv_weak_dynamic_linking,
7013 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
7014 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
7015 test -s conftest${DLL_SUFFIX}; then
7016 dnl There are several ways the linker can put link edit rules in a binary:
7017 dnl - classic info only (for OSX < 10.6)
7018 dnl - dyld info only
7020 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
7025 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
7030 dnl With classic info, we need to build with -flat_namespace.
7031 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
7032 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
7033 dnl forgets to set the weak flag in the dyld info.
7034 dnl See http://glandium.org/blog/?p=2764 for more details.
7036 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
7037 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
7038 dnl - "flat namespace" when -flat_namespace alone is needed
7039 dnl - "dummy library" when a dummy library and -flat_namespace are needed
7040 dnl - "compiler support" when nothing is needed
7041 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
7042 if test -n "$_CLASSIC_INFO"; then
7043 ac_cv_weak_dynamic_linking="flat namespace"
7045 ac_cv_weak_dynamic_linking="compiler support"
7048 if test -n "$_DYLD_INFO"; then
7049 ac_cv_weak_dynamic_linking="dummy library"
7051 ac_cv_weak_dynamic_linking="flat namespace"
7055 AC_ERROR([couldn't compile a simple C file])
7058 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
7061 AC_SUBST(MOZ_REPLACE_MALLOC)
7062 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
7064 dnl ========================================================
7065 dnl = Jemalloc build setup
7066 dnl ========================================================
7067 if test -z "$MOZ_MEMORY"; then
7068 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
7069 MOZ_NATIVE_JEMALLOC=1
7070 AC_CHECK_FUNCS(mallctl nallocm,,
7071 [MOZ_NATIVE_JEMALLOC=
7073 if test -n "$MOZ_NATIVE_JEMALLOC"; then
7075 AC_DEFINE(MOZ_MEMORY)
7076 AC_DEFINE(MOZ_JEMALLOC3)
7077 AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7082 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7083 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.])
7088 AC_DEFINE(MOZ_MEMORY)
7089 if test -n "$MOZ_JEMALLOC3"; then
7090 AC_DEFINE(MOZ_JEMALLOC3)
7092 if test "x$MOZ_DEBUG" = "x1"; then
7093 AC_DEFINE(MOZ_MEMORY_DEBUG)
7095 dnl The generic feature tests that determine how to compute ncpus are long and
7096 dnl complicated. Therefore, simply define special cpp variables for the
7097 dnl platforms we have special knowledge of.
7100 AC_DEFINE(MOZ_MEMORY_DARWIN)
7103 AC_DEFINE(MOZ_MEMORY_BSD)
7105 *-android*|*-linuxandroid*)
7106 AC_DEFINE(MOZ_MEMORY_LINUX)
7107 AC_DEFINE(MOZ_MEMORY_ANDROID)
7108 if test -z "$gonkdir"; then
7111 AC_DEFINE(MOZ_MEMORY_GONK)
7116 AC_DEFINE(MOZ_MEMORY_LINUX)
7119 AC_DEFINE(MOZ_MEMORY_BSD)
7122 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7125 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7126 export MOZ_NO_DEBUG_RTL=1
7127 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7128 dnl Look for a broken crtdll.obj
7129 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7130 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7131 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7132 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcprt -DEFAULTLIB:mozcrt'
7133 dnl Also pass this to NSPR/NSS
7134 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7136 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7143 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7147 AC_SUBST(MOZ_MEMORY)
7148 AC_SUBST(MOZ_JEMALLOC3)
7149 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7150 AC_SUBST(MOZ_GLUE_LDFLAGS)
7151 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7152 AC_SUBST(WIN32_CRT_LIBS)
7153 dnl Need to set this for make because NSS doesn't have configure
7156 dnl We need to wrap dlopen and related functions on Android because we use
7158 if test "$OS_TARGET" = Android; then
7159 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7160 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7161 if test "$MOZ_WIDGET_TOOLKIT" = android; then
7162 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7164 if test -z "$gonkdir"; then
7165 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7166 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=memccpy,--wrap=memchr,--wrap=memrchr,--wrap=memcmp,--wrap=memcpy,--wrap=memmove,--wrap=memset,--wrap=memmem,--wrap=index,--wrap=strchr,--wrap=strrchr,--wrap=strlen,--wrap=strcmp,--wrap=strcpy,--wrap=strcat,--wrap=strcasecmp,--wrap=strncasecmp,--wrap=strstr,--wrap=strcasestr,--wrap=strtok,--wrap=strtok_r,--wrap=strerror,--wrap=strerror_r,--wrap=strnlen,--wrap=strncat,--wrap=strncmp,--wrap=strncpy,--wrap=strlcat,--wrap=strlcpy,--wrap=strcspn,--wrap=strpbrk,--wrap=strsep,--wrap=strspn,--wrap=strcoll,--wrap=strxfrm"
7168 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
7169 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=pthread_create,--wrap=epoll_wait,--wrap=poll,--wrap=pthread_cond_timedwait,--wrap=__pthread_cond_timedwait,--wrap=pthread_cond_wait,--wrap=epoll_create,--wrap=epoll_ctl,--wrap=close,--wrap=pthread_key_create,--wrap=pthread_key_delete,--wrap=socketpair,--wrap=pthread_self,--wrap=pthread_mutex_lock,--wrap=pthread_join,--wrap=pipe,--wrap=pipe2,--wrap=tgkill"
7173 dnl ========================================================
7174 dnl = Use malloc wrapper lib
7175 dnl ========================================================
7176 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7177 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7181 if test -n "$_WRAP_MALLOC"; then
7182 if test -n "$GNU_CC"; then
7183 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7184 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7185 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7186 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=vasprintf,--wrap=asprintf"
7187 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7188 dnl Wrap operator new and operator delete on Android.
7189 if test "$OS_TARGET" = "Android"; then
7190 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7191 dnl Wrap the nothrow variants too.
7192 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7195 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7199 dnl ========================================================
7200 dnl = Location of malloc wrapper lib
7201 dnl ========================================================
7202 MOZ_ARG_WITH_STRING(wrap-malloc,
7203 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7204 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7206 dnl ========================================================
7207 dnl = Use JS Call tracing
7208 dnl ========================================================
7209 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7210 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7211 MOZ_TRACE_JSCALLS=1,
7212 MOZ_TRACE_JSCALLS= )
7213 if test -n "$MOZ_TRACE_JSCALLS"; then
7214 AC_DEFINE(MOZ_TRACE_JSCALLS)
7217 dnl ========================================================
7218 dnl JS opt-mode assertions and minidump instrumentation
7219 dnl ========================================================
7220 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7221 [ --enable-js-diagnostics
7222 Enable JS diagnostic assertions and breakpad data],
7223 JS_CRASH_DIAGNOSTICS=1,
7224 JS_CRASH_DIAGNOSTICS= )
7225 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7226 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7229 dnl ========================================================
7230 dnl = Use incremental GC
7231 dnl ========================================================
7233 MOZ_ARG_DISABLE_BOOL(gcincremental,
7234 [ --disable-gcincremental Disable incremental GC],
7236 if test -n "$JSGC_INCREMENTAL"; then
7237 AC_DEFINE(JSGC_INCREMENTAL)
7240 dnl ========================================================
7241 dnl = Use exact stack rooting for GC
7242 dnl ========================================================
7243 MOZ_ARG_DISABLE_BOOL(exact-rooting,
7244 [ --disable-exact-rooting Enable use of conservative stack scanning for GC],
7245 JSGC_USE_EXACT_ROOTING= ,
7246 JSGC_USE_EXACT_ROOTING=1 )
7247 if test -n "$JSGC_USE_EXACT_ROOTING"; then
7248 AC_DEFINE(JSGC_USE_EXACT_ROOTING)
7251 dnl ========================================================
7252 dnl = Use generational GC
7253 dnl ========================================================
7254 MOZ_ARG_DISABLE_BOOL(gcgenerational,
7255 [ --disable-gcgenerational Disable generational GC],
7256 JSGC_GENERATIONAL= ,
7257 JSGC_GENERATIONAL=1 )
7258 if test -n "$JSGC_GENERATIONAL"; then
7259 AC_DEFINE(JSGC_GENERATIONAL)
7262 dnl ========================================================
7263 dnl Zealous JavaScript GC
7264 dnl ========================================================
7265 MOZ_ARG_ENABLE_BOOL(gczeal,
7266 [ --enable-gczeal Enable zealous JavaScript GCing],
7269 if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then
7270 AC_DEFINE(JS_GC_ZEAL)
7273 dnl ========================================================
7274 dnl = Perform moving GC stack rooting analysis
7275 dnl ========================================================
7276 MOZ_ARG_ENABLE_BOOL(root-analysis,
7277 [ --enable-root-analysis Enable moving GC stack root analysis],
7278 JSGC_ROOT_ANALYSIS=1,
7279 JSGC_ROOT_ANALYSIS= )
7280 if test -n "$JSGC_ROOT_ANALYSIS"; then
7281 AC_DEFINE(JSGC_ROOT_ANALYSIS)
7286 dnl ========================================================
7287 dnl = Enable static checking using gcc-dehydra
7288 dnl ========================================================
7290 MOZ_ARG_WITH_STRING(static-checking,
7291 [ --with-static-checking=path/to/gcc_dehydra.so
7292 Enable static checking of code using GCC-dehydra],
7293 DEHYDRA_PATH=$withval,
7296 if test -n "$DEHYDRA_PATH"; then
7297 if test ! -f "$DEHYDRA_PATH"; then
7298 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7300 AC_DEFINE(NS_STATIC_CHECKING)
7302 AC_SUBST(DEHYDRA_PATH)
7304 dnl ========================================================
7305 dnl = Enable using the clang plugin to build
7306 dnl ========================================================
7308 MOZ_ARG_ENABLE_BOOL(clang-plugin,
7309 [ --enable-clang-plugin Enable building with the mozilla clang plugin ],
7310 ENABLE_CLANG_PLUGIN=1,
7311 ENABLE_CLANG_PLUGIN= )
7312 if test -n "$ENABLE_CLANG_PLUGIN"; then
7313 if test -z "$CLANG_CC"; then
7314 AC_MSG_ERROR([Can't use clang plugin without clang.])
7316 AC_DEFINE(MOZ_CLANG_PLUGIN)
7319 AC_SUBST(ENABLE_CLANG_PLUGIN)
7321 dnl ========================================================
7322 dnl = Enable stripping of libs & executables
7323 dnl ========================================================
7324 MOZ_ARG_ENABLE_BOOL(strip,
7325 [ --enable-strip Enable stripping of libs & executables ],
7329 dnl ========================================================
7330 dnl = Enable stripping of libs & executables when packaging
7331 dnl ========================================================
7332 MOZ_ARG_ENABLE_BOOL(install-strip,
7333 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7337 dnl ========================================================
7338 dnl = --disable-elf-hack
7339 dnl ========================================================
7342 MOZ_ARG_DISABLE_BOOL(elf-hack,
7343 [ --disable-elf-hack Disable elf hacks],
7345 [USE_ELF_HACK=F # Force enable elf-hack])
7347 # Disable elf hack for profiling because the built in profiler
7348 # doesn't read the segments properly with elf hack. This is
7349 # temporary and should be fixed soon in the profiler.
7350 if test "$MOZ_PROFILING" = 1; then
7351 if test "$USE_ELF_HACK" = F; then
7352 AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
7357 # Only enable elfhack where supported
7358 if test "$USE_ELF_HACK" = 1; then
7359 case "${HOST_OS_ARCH},${OS_ARCH}" in
7361 case "${CPU_ARCH}" in
7376 if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
7377 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7378 dnl memory addresses it maps to. The result is that by the time elfhack
7379 dnl kicks in, it is not possible to apply relocations because of that,
7380 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7381 dnl segment. It makes elfhack mostly useless, so considering the problems
7382 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7383 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7384 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
7385 dnl elfhack enabled, disable PT_GNU_RELRO instead.
7386 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7387 LINK_WITH_PT_GNU_RELRO,
7388 [echo "int main() {return 0;}" > conftest.${ac_ext}
7389 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7390 test -s conftest${ac_exeext}; then
7391 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7392 LINK_WITH_PT_GNU_RELRO=yes
7394 LINK_WITH_PT_GNU_RELRO=no
7397 dnl We really don't expect to get here, but just in case
7398 AC_ERROR([couldn't compile a simple C file])
7401 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7402 if test "$USE_ELF_HACK" = F; then
7403 AC_MSG_CHECKING([for -z norelro option to ld])
7404 _SAVE_LDFLAGS=$LDFLAGS
7405 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
7406 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
7407 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
7408 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.]))
7411 AC_MSG_WARN([Disabling elfhack])
7417 dnl ========================================================
7418 dnl = libstdc++ compatibility hacks
7419 dnl ========================================================
7422 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7423 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7426 if test -n "$STDCXX_COMPAT"; then
7427 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
7428 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7429 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7432 dnl ========================================================
7434 dnl = Profiling and Instrumenting
7436 dnl ========================================================
7437 MOZ_ARG_HEADER(Profiling and Instrumenting)
7439 dnl ========================================================
7440 dnl = Enable runtime visual profiling logger
7441 dnl ========================================================
7442 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7443 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7444 MOZ_VISUAL_EVENT_TRACER=1,
7445 MOZ_VISUAL_EVENT_TRACER=)
7446 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7447 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7450 dnl ========================================================
7451 dnl = Enable TaskTracer
7452 dnl ========================================================
7453 MOZ_ARG_ENABLE_BOOL(tasktracer,
7454 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
7457 if test "$MOZ_WIDGET_TOOLKIT" = "gonk" -a -n "$MOZ_TASK_TRACER"; then
7458 AC_DEFINE(MOZ_TASK_TRACER)
7459 AC_SUBST(MOZ_TASK_TRACER)
7462 dnl ========================================================
7463 dnl Turn on reflow counting
7464 dnl ========================================================
7465 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7466 [ --enable-reflow-perf Enable reflow performance tracing],
7469 if test -n "$MOZ_REFLOW_PERF"; then
7470 AC_DEFINE(MOZ_REFLOW_PERF)
7473 dnl ========================================================
7474 dnl = Offer a way to disable the startup cache
7475 dnl ========================================================
7476 MOZ_DISABLE_STARTUPCACHE=
7478 MOZ_ARG_DISABLE_BOOL(startupcache,
7479 [ --disable-startupcache Disable startup cache ],
7480 MOZ_DISABLE_STARTUPCACHE=1,
7481 MOZ_DISABLE_STARTUPCACHE=)
7483 dnl bug 988880: disable startup cache on b2g
7484 if test -n "$MOZ_B2G"; then
7485 MOZ_DISABLE_STARTUPCACHE=1
7488 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
7490 dnl ========================================================
7491 dnl = Enable Radio Interface for B2G (Gonk usually)
7492 dnl ========================================================
7493 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7494 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7497 MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL )
7498 if test -n "$MOZ_B2G_RIL"; then
7499 if test -n "$_PLATFORM_HAVE_RIL"; then
7500 AC_DEFINE(MOZ_B2G_RIL)
7502 AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.])
7505 AC_SUBST(MOZ_B2G_RIL)
7507 dnl ========================================================
7508 dnl = Enable Radio FM for B2G (Gonk usually)
7509 dnl ========================================================
7510 if test -n "$MOZ_B2G_FM"; then
7511 AC_DEFINE(MOZ_B2G_FM)
7513 AC_SUBST(MOZ_B2G_FM)
7515 dnl ========================================================
7516 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7517 dnl ========================================================
7518 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7519 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7522 if test -n "$MOZ_B2G_BT"; then
7523 AC_DEFINE(MOZ_B2G_BT)
7525 AC_SUBST(MOZ_B2G_BT)
7526 AC_SUBST(MOZ_B2G_BT_BLUEZ)
7527 AC_SUBST(MOZ_B2G_BT_BLUEDROID)
7529 dnl ========================================================
7530 dnl = Enable NFC Interface for B2G (Gonk usually)
7531 dnl ========================================================
7532 MOZ_ARG_ENABLE_BOOL(nfc,
7533 [ --enable-nfc Set compile flags necessary for compiling NFC API ],
7536 if test -n "$MOZ_NFC"; then
7541 dnl ========================================================
7542 dnl = Enable Pico Speech Synthesis (Gonk usually)
7543 dnl ========================================================
7544 MOZ_ARG_ENABLE_BOOL(synth-pico,
7545 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
7548 if test -n "$MOZ_SYNTH_PICO"; then
7549 AC_DEFINE(MOZ_SYNTH_PICO)
7551 AC_SUBST(MOZ_SYNTH_PICO)
7553 dnl ========================================================
7554 dnl = Enable Support for Time Manager API
7555 dnl ========================================================
7556 if test -n "$MOZ_TIME_MANAGER"; then
7557 AC_DEFINE(MOZ_TIME_MANAGER)
7559 AC_SUBST(MOZ_TIME_MANAGER)
7561 dnl ========================================================
7562 dnl = Enable Camera Interface for B2G (Gonk usually)
7563 dnl ========================================================
7564 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7565 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7568 if test -n "$MOZ_B2G_CAMERA"; then
7569 AC_DEFINE(MOZ_B2G_CAMERA)
7571 AC_SUBST(MOZ_B2G_CAMERA)
7573 dnl ========================================================
7574 dnl = Enable Support for Payment API
7575 dnl ========================================================
7576 if test -n "$MOZ_PAY"; then
7581 dnl ========================================================
7582 dnl = Enable Browser Support for Activities
7583 dnl ========================================================
7584 if test -n "$MOZ_ACTIVITIES"; then
7585 AC_DEFINE(MOZ_ACTIVITIES)
7587 AC_SUBST(MOZ_ACTIVITIES)
7589 dnl ========================================================
7590 dnl = Enable Support for AudioChannelManager API
7591 dnl ========================================================
7592 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7593 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7595 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7597 dnl ========================================================
7598 dnl = Enable Support for Firefox Accounts (services/fxaccounts)
7599 dnl ========================================================
7600 if test -n "$MOZ_SERVICES_FXACCOUNTS"; then
7601 AC_DEFINE(MOZ_SERVICES_FXACCOUNTS)
7603 AC_SUBST(MOZ_SERVICES_FXACCOUNTS)
7605 dnl ========================================================
7606 dnl = Support for demangling undefined symbols
7607 dnl ========================================================
7608 if test -z "$SKIP_LIBRARY_CHECKS"; then
7611 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7615 # Demangle only for debug or trace-malloc or DMD builds
7616 MOZ_DEMANGLE_SYMBOLS=
7617 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7618 MOZ_DEMANGLE_SYMBOLS=1
7619 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7621 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7623 dnl ========================================================
7624 dnl = Support for gcc stack unwinding (from gcc 3.3)
7625 dnl ========================================================
7626 if test -z "$SKIP_LIBRARY_CHECKS"; then
7629 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7633 dnl ========================================================
7635 dnl ========================================================
7637 MOZ_ARG_WITH_STRING(jitreport-granularity,
7638 [ --jitreport-granularity=N
7639 Default granularity at which to report JIT code
7642 1 - code ranges for whole functions only
7643 2 - per-line information
7644 3 - per-op information],
7645 JITREPORT_GRANULARITY=$withval,
7646 JITREPORT_GRANULARITY=3)
7648 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7650 dnl ========================================================
7654 dnl ========================================================
7655 MOZ_ARG_HEADER(Misc. Options)
7657 dnl ========================================================
7658 dnl update xterm title
7659 dnl ========================================================
7660 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7661 [ --enable-xterm-updates Update XTERM titles with current command.],
7665 dnl =========================================================
7667 dnl =========================================================
7668 MOZ_ARG_ENABLE_STRING([chrome-format],
7669 [ --enable-chrome-format=jar|flat|omni
7670 Select FORMAT of chrome files during packaging],
7671 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7673 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7674 MOZ_CHROME_FILE_FORMAT=jar
7677 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7678 AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7681 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7682 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7683 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7684 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7687 dnl ========================================================
7688 dnl = Enable Support for devtools webide
7689 dnl ========================================================
7690 MOZ_ARG_ENABLE_BOOL(devtools-webide,
7691 [ --enable-devtools-webide Set compile flags necessary for compiling devtools webide ],
7692 MOZ_DEVTOOLS_WEBIDE=1,
7693 MOZ_DEVTOOLS_WEBIDE= )
7695 if test -n "$MOZ_DEVTOOLS_WEBIDE"; then
7696 AC_DEFINE(MOZ_DEVTOOLS_WEBIDE)
7698 AC_SUBST(MOZ_DEVTOOLS_WEBIDE)
7700 dnl =========================================================
7701 dnl Omnijar packaging (bug 552121)
7702 dnl =========================================================
7703 dnl Omnijar packaging is compatible with flat packaging.
7704 dnl In unpackaged builds, omnijar looks for files as if
7705 dnl things were flat packaged. After packaging, all files
7706 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7707 dnl is set to flat since putting files into jars is only
7708 dnl done during packaging with omnijar.
7709 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7711 AC_DEFINE(MOZ_OMNIJAR)
7713 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7714 if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7715 MOZ_CHROME_FILE_FORMAT=flat
7717 MOZ_CHROME_FILE_FORMAT=symlink
7720 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7721 dnl Fennec's static resources live in the assets/ folder of the
7722 dnl APK. Adding a path to the name here works because we only
7723 dnl have one omnijar file in the final package (which is not the
7724 dnl case on desktop), and necessitates some contortions during
7725 dnl packaging so that the resources in the omnijar are considered
7726 dnl as rooted at / and not as rooted at assets/ (which again is
7727 dnl not the case on desktop: there are omnijars rooted at webrtc/,
7728 dnl etc). packager.mk handles changing the rooting of the single
7730 OMNIJAR_NAME=assets/omni.ja
7732 OMNIJAR_NAME=omni.ja
7735 AC_SUBST(OMNIJAR_NAME)
7736 AC_SUBST(MOZ_OMNIJAR)
7737 AC_SUBST(MOZ_PACKAGER_FORMAT)
7739 dnl ========================================================
7740 dnl = Define default location for MOZILLA_FIVE_HOME
7741 dnl ========================================================
7742 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7743 [ --with-default-mozilla-five-home
7744 Set the default value for MOZILLA_FIVE_HOME],
7745 [ val=`echo $withval`
7746 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7748 dnl ========================================================
7749 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7750 dnl ========================================================
7751 MOZ_ARG_WITH_STRING(user-appdir,
7752 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7753 [ val=`echo $withval`
7754 if echo "$val" | grep "\/" >/dev/null; then
7755 AC_MSG_ERROR("Homedir must be single relative path.")
7760 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7762 dnl ========================================================
7763 dnl = Doxygen configuration
7764 dnl ========================================================
7765 dnl Use commas to specify multiple dirs to this arg
7766 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7767 MOZ_ARG_WITH_STRING(doc-input-dirs,
7768 [ --with-doc-input-dirs=DIRS
7769 Header/idl dirs to create docs from],
7770 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7771 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7773 dnl Use commas to specify multiple dirs to this arg
7774 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7775 MOZ_ARG_WITH_STRING(doc-include-dirs,
7776 [ --with-doc-include-dirs=DIRS
7777 Include dirs to preprocess doc headers],
7778 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7779 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7781 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7782 MOZ_ARG_WITH_STRING(doc-output-dir,
7783 [ --with-doc-output-dir=DIR
7784 Dir to generate docs into],
7785 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7786 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7788 if test -z "$SKIP_COMPILER_CHECKS"; then
7789 dnl ========================================================
7791 dnl = Compiler Options
7793 dnl ========================================================
7794 MOZ_ARG_HEADER(Compiler Options)
7796 dnl ========================================================
7797 dnl Check for gcc -pipe support
7798 dnl ========================================================
7799 AC_MSG_CHECKING([for -pipe support])
7800 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7801 dnl Any gcc that supports firefox supports -pipe.
7802 CFLAGS="$CFLAGS -pipe"
7803 CXXFLAGS="$CXXFLAGS -pipe"
7804 AC_MSG_RESULT([yes])
7809 dnl ========================================================
7810 dnl Profile guided optimization (gcc checks)
7811 dnl ========================================================
7812 dnl Test for profiling options
7813 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7815 _SAVE_CFLAGS="$CFLAGS"
7816 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7818 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7819 AC_TRY_COMPILE([], [return 0;],
7820 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7821 result="yes" ], result="no")
7822 AC_MSG_RESULT([$result])
7824 if test $result = "yes"; then
7825 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7826 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7827 PROFILE_USE_LDFLAGS="-fprofile-use"
7830 CFLAGS="$_SAVE_CFLAGS"
7832 if test -n "$INTEL_CC"; then
7833 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7834 PROFILE_GEN_LDFLAGS=
7835 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7836 PROFILE_USE_LDFLAGS=
7839 dnl Sun Studio on Solaris
7840 if test "$SOLARIS_SUNPRO_CC"; then
7841 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7842 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7843 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7844 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7847 AC_SUBST(PROFILE_GEN_CFLAGS)
7848 AC_SUBST(PROFILE_GEN_LDFLAGS)
7849 AC_SUBST(PROFILE_USE_CFLAGS)
7850 AC_SUBST(PROFILE_USE_LDFLAGS)
7854 dnl ========================================================
7855 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7856 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7857 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7858 dnl ========================================================
7859 _SAVE_CXXFLAGS=$CXXFLAGS
7860 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7861 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7862 ac_nscap_nonconst_opeq_bug,
7871 template <class T, class U>
7872 int operator==(const Pointer<T>& rhs, U* lhs)
7874 return rhs.myPtr == lhs;
7877 template <class T, class U>
7878 int operator==(const Pointer<T>& rhs, const U* lhs)
7880 return rhs.myPtr == lhs;
7888 ac_nscap_nonconst_opeq_bug="no",
7889 ac_nscap_nonconst_opeq_bug="yes")])
7890 CXXFLAGS="$_SAVE_CXXFLAGS"
7892 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7893 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7895 fi # ! SKIP_COMPILER_CHECKS
7897 AC_DEFINE(CPP_THROW_NEW, [throw()])
7900 if test "$COMPILE_ENVIRONMENT"; then
7902 fi # COMPILE_ENVIRONMENT
7904 dnl ========================================================
7906 dnl = Build depencency options
7908 dnl ========================================================
7909 MOZ_ARG_HEADER(Build dependencies)
7911 if test "$GNU_CC" -a "$GNU_CXX"; then
7912 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7913 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7914 elif test "$SOLARIS_SUNPRO_CC"; then
7917 dnl Don't override this for MSVC
7918 if test -z "$_WIN32_MSVC"; then
7919 _USE_CPP_INCLUDE_FLAG=
7920 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7921 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7923 echo '#include <stdio.h>' > dummy-hello.c
7925 dnl This output is localized, split at the first double space or colon and space.
7926 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*stdio.h\)$"
7927 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
7928 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
7930 if ! test -e "$_CL_STDIO_PATH"; then
7931 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
7933 if test -z "$CL_INCLUDES_PREFIX"; then
7934 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7936 AC_SUBST(CL_INCLUDES_PREFIX)
7939 dnl Make sure that the build system can handle non-ASCII characters
7940 dnl in environment variables to prevent it from breaking silently on
7941 dnl non-English systems.
7942 NONASCII=$'\241\241'
7947 dnl ========================================================
7949 dnl = Static Build Options
7951 dnl ========================================================
7952 MOZ_ARG_HEADER(Static build options)
7954 AC_SUBST(LIBXUL_LIBS)
7955 XPCOM_LIBS="$LIBXUL_LIBS"
7957 if test "$OS_ARCH" = "WINNT"; then
7958 GKMEDIAS_SHARED_LIBRARY=1
7959 AC_DEFINE(GKMEDIAS_SHARED_LIBRARY)
7961 AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
7963 if test -z "$MOZ_NATIVE_ZLIB"; then
7964 if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
7966 AC_DEFINE(ZLIB_IN_MOZGLUE)
7970 AC_SUBST(ZLIB_IN_MOZGLUE)
7972 dnl ========================================================
7974 dnl = Standalone module options
7976 dnl ========================================================
7977 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7980 dnl ========================================================
7982 if test -z "$SKIP_PATH_CHECKS"; then
7983 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7984 if test "$MOZ_ENABLE_GTK" ; then
7985 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7990 if test -z "${GLIB_GMODULE_LIBS}" \
7991 -a -n "${GLIB_CONFIG}"\
7992 -a "${GLIB_CONFIG}" != no\
7994 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7997 AC_SUBST(GLIB_CFLAGS)
7999 AC_SUBST(GLIB_GMODULE_LIBS)
8001 dnl ========================================================
8002 dnl Graphics checks.
8003 dnl ========================================================
8005 if test "${OS_TARGET}" = "WINNT"; then
8006 if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then
8007 MOZ_ENABLE_DIRECT2D1_1=1
8008 AC_SUBST(MOZ_ENABLE_DIRECT2D1_1)
8012 if test "${OS_TARGET}" = "WINNT" -o \
8013 "${OS_ARCH}" = "Darwin" -o \
8014 "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
8015 "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
8016 "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
8017 "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
8018 case "${target_cpu}" in
8030 MOZ_ARG_ENABLE_BOOL(skia,
8031 [ --enable-skia Enable use of Skia],
8035 if test "$USE_FC_FREETYPE"; then
8036 if test "$COMPILE_ENVIRONMENT"; then
8037 dnl ========================================================
8038 dnl = Check for freetype2 and its functionality
8039 dnl ========================================================
8040 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
8042 if test "$_HAVE_FREETYPE2"; then
8044 _SAVE_CFLAGS="$CFLAGS"
8045 LIBS="$LIBS $FT2_LIBS"
8046 CFLAGS="$CFLAGS $FT2_CFLAGS"
8048 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
8049 ac_cv_member_FT_Bitmap_Size_y_ppem,
8050 [AC_TRY_COMPILE([#include <ft2build.h>
8051 #include FT_FREETYPE_H],
8053 if (sizeof s.y_ppem) return 0;
8055 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
8056 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
8057 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
8058 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
8060 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
8062 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
8063 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
8064 [FT_Bitmap_Size structure includes y_ppem field])
8066 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
8069 CFLAGS="$_SAVE_CFLAGS"
8072 _SAVE_CPPFLAGS="$CPPFLAGS"
8073 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8074 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8075 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8076 CPPFLAGS="$_SAVE_CPPFLAGS"
8078 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8081 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
8083 if test "$MOZ_PANGO"; then
8084 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
8085 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
8087 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
8088 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
8093 dnl ========================================================
8094 dnl Check for pixman and cairo
8095 dnl ========================================================
8097 if test "$MOZ_WIDGET_TOOLKIT" = "gtk3" ; then
8098 # cairo-gtk3 can be build with system-cairo only
8104 MOZ_ARG_ENABLE_BOOL(system-cairo,
8105 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8110 MOZ_ARG_ENABLE_BOOL(system-pixman,
8111 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8113 MOZ_TREE_PIXMAN=force,
8116 # System cairo depends on system pixman
8117 if test "$MOZ_TREE_PIXMAN" = "force"; then
8118 if test -z "$MOZ_TREE_CAIRO"; then
8119 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
8123 elif test -z "$MOZ_TREE_CAIRO"; then
8127 if test "$MOZ_TREE_PIXMAN"; then
8128 AC_DEFINE(MOZ_TREE_PIXMAN)
8129 MOZ_PIXMAN_CFLAGS=""
8130 MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8132 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8133 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8134 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8136 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8137 AC_SUBST(MOZ_PIXMAN_LIBS)
8139 # Check for headers defining standard int types.
8140 if test -n "$COMPILE_ENVIRONMENT"; then
8141 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8143 if test "${ac_cv_header_inttypes_h}" = "yes"; then
8148 AC_SUBST(HAVE_INTTYPES_H)
8150 if test "$MOZ_TREE_CAIRO"; then
8151 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8152 AC_DEFINE(MOZ_TREE_CAIRO)
8154 if test "$OS_ARCH" = "WINNT"; then
8155 # For now we assume that we will have a uint64_t available through
8156 # one of the above headers or mozstdint.h.
8157 AC_DEFINE(HAVE_UINT64_T)
8160 # Define macros for cairo-features.h
8161 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8162 if test "$MOZ_X11"; then
8163 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8164 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8165 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8166 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8167 MOZ_ENABLE_CAIRO_FT=1
8168 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8170 case "$MOZ_WIDGET_TOOLKIT" in
8172 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8175 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8176 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8177 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8180 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8181 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8182 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8183 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8184 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8185 MOZ_ENABLE_D2D_SURFACE=1
8186 MOZ_ENABLE_DWRITE_FONT=1
8188 WIN32_DWRITE_FONT_FEATURE=
8189 WIN32_D2D_SURFACE_FEATURE=
8192 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8194 dnl D3D10 Layers depend on D2D Surfaces.
8195 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8196 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8200 AC_MSG_ERROR([cairo-gtk3 toolkit is incompatible with in-tree cairo. Please add --enable-system-cairo to your build config.])
8203 if test "$USE_FC_FREETYPE"; then
8204 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8206 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8207 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8208 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8209 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8210 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8211 AC_SUBST(CAIRO_FT_CFLAGS)
8213 AC_SUBST(PS_SURFACE_FEATURE)
8214 AC_SUBST(PDF_SURFACE_FEATURE)
8215 AC_SUBST(SVG_SURFACE_FEATURE)
8216 AC_SUBST(XLIB_SURFACE_FEATURE)
8217 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8218 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8219 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8220 AC_SUBST(WIN32_SURFACE_FEATURE)
8221 AC_SUBST(OS2_SURFACE_FEATURE)
8222 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8223 AC_SUBST(FT_FONT_FEATURE)
8224 AC_SUBST(FC_FONT_FEATURE)
8225 AC_SUBST(WIN32_FONT_FEATURE)
8226 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8227 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8228 AC_SUBST(QUARTZ_FONT_FEATURE)
8229 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8230 AC_SUBST(QT_SURFACE_FEATURE)
8231 AC_SUBST(TEE_SURFACE_FEATURE)
8233 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8235 if test "$MOZ_X11"; then
8236 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8239 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8241 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8242 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8243 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8244 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8245 if test "$MOZ_X11"; then
8246 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8247 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8248 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8249 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8253 AC_SUBST(MOZ_TREE_CAIRO)
8254 AC_SUBST(MOZ_CAIRO_CFLAGS)
8255 AC_SUBST(MOZ_CAIRO_LIBS)
8256 AC_SUBST(MOZ_CAIRO_OSLIBS)
8257 AC_SUBST(MOZ_TREE_PIXMAN)
8259 dnl ========================================================
8261 dnl ========================================================
8262 if test "$MOZ_ENABLE_SKIA"; then
8263 AC_DEFINE(MOZ_ENABLE_SKIA)
8265 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8266 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8269 if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" ; then
8270 MOZ_ENABLE_SKIA_GPU=1
8271 AC_DEFINE(USE_SKIA_GPU)
8272 AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8275 AC_SUBST(MOZ_ENABLE_SKIA)
8277 dnl ========================================================
8279 dnl ========================================================
8280 MOZ_ARG_DISABLE_BOOL(xul,
8281 [ --disable-xul Disable XUL],
8283 if test "$MOZ_XUL"; then
8286 dnl remove extensions that require XUL
8287 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8292 dnl ========================================================
8293 dnl disable profile locking
8294 dnl do no use this in applications that can have more than
8295 dnl one process accessing the profile directory.
8296 dnl ========================================================
8297 MOZ_ARG_DISABLE_BOOL(profilelocking,
8298 [ --disable-profilelocking
8299 Disable profile locking],
8300 MOZ_PROFILELOCKING=,
8301 MOZ_PROFILELOCKING=1 )
8302 if test "$MOZ_PROFILELOCKING"; then
8303 AC_DEFINE(MOZ_PROFILELOCKING)
8306 dnl ========================================================
8307 dnl necko configuration options
8308 dnl ========================================================
8311 dnl option to disable various necko protocols
8313 MOZ_ARG_ENABLE_STRING(necko-protocols,
8314 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8315 Enable/disable specific protocol handlers],
8316 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8317 if test "$option" = "yes" -o "$option" = "all"; then
8318 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8319 elif test "$option" = "no" -o "$option" = "none"; then
8321 elif test "$option" = "default"; then
8322 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8323 elif test `echo "$option" | grep -c \^-` != 0; then
8324 option=`echo $option | sed 's/^-//'`
8325 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8327 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8330 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8332 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8333 AC_SUBST_SET(NECKO_PROTOCOLS)
8334 for p in $NECKO_PROTOCOLS; do
8335 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8336 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8340 dnl option to disable necko's wifi scanner
8343 case "$OS_TARGET" in
8345 if test -n "$gonkdir"; then
8349 Darwin|FreeBSD|SunOS|WINNT)
8358 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8359 [ --disable-necko-wifi Disable necko wifi scanner],
8363 if test "$NECKO_WIFI"; then
8364 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
8365 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
8367 AC_DEFINE(NECKO_WIFI)
8368 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8370 AC_SUBST(NECKO_WIFI)
8371 AC_SUBST(NECKO_WIFI_DBUS)
8374 dnl option to disable cookies
8376 MOZ_ARG_DISABLE_BOOL(cookies,
8377 [ --disable-cookies Disable cookie support],
8380 AC_SUBST(NECKO_COOKIES)
8381 if test "$NECKO_COOKIES"; then
8382 AC_DEFINE(NECKO_COOKIES)
8383 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8387 dnl Always build Marionette if not Android or B2G
8389 if test "$OS_TARGET" != Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
8390 AC_DEFINE(ENABLE_MARIONETTE)
8392 AC_SUBST(ENABLE_MARIONETTE)
8393 if test "$ENABLE_MARIONETTE"; then
8394 AC_DEFINE(ENABLE_MARIONETTE)
8398 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8400 MOZ_ARG_DISABLE_BOOL(ctypes,
8401 [ --disable-ctypes Disable js-ctypes],
8404 AC_SUBST(BUILD_CTYPES)
8405 if test "$BUILD_CTYPES"; then
8406 AC_DEFINE(BUILD_CTYPES)
8409 dnl Build Loop if required
8411 if test "$MOZ_LOOP"; then
8415 dnl Build Places if required
8416 if test "$MOZ_PLACES"; then
8417 AC_DEFINE(MOZ_PLACES)
8420 dnl Build SocialAPI if required
8421 if test "$MOZ_SOCIAL"; then
8422 AC_DEFINE(MOZ_SOCIAL)
8425 dnl Build Common JS modules provided by services.
8426 AC_SUBST(MOZ_SERVICES_COMMON)
8427 if test -n "$MOZ_SERVICES_COMMON"; then
8428 AC_DEFINE(MOZ_SERVICES_COMMON)
8431 dnl Build Services crypto component (used by Sync)
8432 AC_SUBST(MOZ_SERVICES_CRYPTO)
8433 if test -n "$MOZ_SERVICES_CRYPTO"; then
8434 AC_DEFINE(MOZ_SERVICES_CRYPTO)
8437 dnl Build Firefox Health Reporter Service
8438 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8439 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8440 AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8443 dnl Build Services metrics component
8444 AC_SUBST(MOZ_SERVICES_METRICS)
8445 if test -n "$MOZ_SERVICES_METRICS"; then
8446 AC_DEFINE(MOZ_SERVICES_METRICS)
8449 dnl Build Notifications if required
8450 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8451 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8452 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8455 dnl Build Sync Services if required
8456 AC_SUBST(MOZ_SERVICES_SYNC)
8457 if test -n "$MOZ_SERVICES_SYNC"; then
8458 AC_DEFINE(MOZ_SERVICES_SYNC)
8461 dnl Build Captive Portal Detector if required
8462 AC_SUBST(MOZ_CAPTIVEDETECT)
8463 if test -n "$MOZ_CAPTIVEDETECT"; then
8464 AC_DEFINE(MOZ_CAPTIVEDETECT)
8467 dnl Build second screen and casting features for external devices if required
8468 AC_SUBST(MOZ_DEVICES)
8469 if test -n "$MOZ_DEVICES"; then
8470 AC_DEFINE(MOZ_DEVICES)
8473 dnl ========================================================
8474 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8475 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8478 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8479 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8482 if test "$MOZ_APP_COMPONENT_MODULES"; then
8483 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8486 dnl ========================================================
8488 dnl = Maintainer debug option (no --enable equivalent)
8490 dnl ========================================================
8495 AC_SUBST(AR_EXTRACT)
8499 AC_SUBST(AS_DASH_C_FLAG)
8508 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8509 AC_SUBST(MOZ_UPDATE_XTERM)
8510 AC_SUBST(MOZ_AUTH_EXTENSION)
8511 AC_SUBST(MOZ_PERMISSIONS)
8512 AC_SUBST(MOZ_PREF_EXTENSIONS)
8513 AC_SUBST(MOZ_JS_LIBS)
8515 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8516 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8517 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8518 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8519 AC_SUBST(WARNINGS_AS_ERRORS)
8520 AC_SUBST(MOZ_EXTENSIONS)
8521 AC_SUBST(MOZ_JSDEBUGGER)
8522 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8525 AC_SUBST(MOZ_INSTRUMENTS)
8526 AC_SUBST(MOZ_CALLGRIND)
8528 AC_SUBST(MOZ_PROFILING)
8530 AC_SUBST(MOZ_PLACES)
8531 AC_SUBST(MOZ_SOCIAL)
8532 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8534 AC_SUBST(NS_PRINTING)
8536 AC_SUBST(MOZ_HELP_VIEWER)
8537 AC_SUBST(TOOLCHAIN_PREFIX)
8546 AC_SUBST(MOZ_PROFILELOCKING)
8548 AC_SUBST(ENABLE_TESTS)
8549 AC_SUBST(MOZ_UNIVERSALCHARDET)
8550 AC_SUBST(ACCESSIBILITY)
8551 AC_SUBST(MOZ_SPELLCHECK)
8552 AC_SUBST(MOZ_ANDROID_OMTC)
8553 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8554 AC_SUBST(MOZ_CRASHREPORTER)
8555 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8556 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8557 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8558 AC_SUBST(MOZ_STUB_INSTALLER)
8559 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8560 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8561 AC_SUBST(MOZ_UPDATER)
8563 AC_SUBST(MOZ_ANGLE_RENDERER)
8564 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
8565 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
8566 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
8567 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
8568 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8569 AC_SUBST(MOZ_D3DCOMPILER_XP_DLL)
8570 AC_SUBST(MOZ_D3DCOMPILER_XP_CAB)
8574 AC_SUBST(MOZ_ANDROID_HISTORY)
8575 AC_SUBST(MOZ_WEBSMS_BACKEND)
8576 AC_SUBST(MOZ_ANDROID_BEAM)
8577 AC_SUBST(MOZ_ANDROID_SYNTHAPKS)
8578 AC_SUBST(MOZ_LOCALE_SWITCHER)
8579 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
8580 AC_SUBST(ENABLE_STRIP)
8581 AC_SUBST(PKG_SKIP_STRIP)
8582 AC_SUBST(STRIP_FLAGS)
8583 AC_SUBST(USE_ELF_HACK)
8584 AC_SUBST(INCREMENTAL_LINKER)
8585 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8586 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8588 AC_SUBST(MOZ_FIX_LINK_PATHS)
8589 AC_SUBST(XPCOM_LIBS)
8590 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8591 AC_SUBST(XPCOM_GLUE_LDOPTS)
8592 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8593 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8594 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8596 AC_SUBST(USE_DEPENDENT_LIBS)
8598 AC_SUBST(MOZ_BUILD_ROOT)
8600 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8601 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8602 AC_SUBST(MOZ_LINKER_EXTRACT)
8604 AC_SUBST(MOZ_JSDOWNLOADS)
8605 if test -n "$MOZ_JSDOWNLOADS"; then
8606 AC_DEFINE(MOZ_JSDOWNLOADS)
8609 dnl ========================================================
8610 dnl = Mac bundle name prefix
8611 dnl ========================================================
8612 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8613 [ --with-macbundlename-prefix=prefix
8614 Prefix for MOZ_MACBUNDLE_NAME],
8615 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8617 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8618 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8619 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8622 if test "$MOZ_DEBUG"; then
8623 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8625 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8627 AC_SUBST(MOZ_MACBUNDLE_NAME)
8629 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8630 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8631 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8632 if test "$MOZ_DEBUG"; then
8633 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8636 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8637 AC_SUBST(MOZ_MACBUNDLE_ID)
8639 dnl ========================================================
8640 dnl = Child Process Name for IPC
8641 dnl ========================================================
8642 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8643 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8645 # We want to let Android unpack the file at install time, but it only does
8646 # so if the file is named libsomething.so. The lib/ path is also required
8647 # because the unpacked file will be under the lib/ subdirectory and will
8648 # need to be executed from that path.
8649 MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8651 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8653 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8654 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8656 # The following variables are available to branding and application
8657 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8658 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8659 # impacts profile location and user-visible fields.
8660 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8661 # versions of a given application (e.g. Aurora and Firefox both use
8662 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8663 # for application.ini's "Name" field, which controls profile location in
8664 # the absence of a "Profile" field (see below), and various system
8665 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8666 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8667 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8668 # builds (e.g. Aurora for Firefox).
8669 # - MOZ_APP_VERSION: Defines the application version number.
8670 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8671 # defaults to a lowercase form of MOZ_APP_BASENAME.
8672 # - MOZ_APP_PROFILE: When set, used for application.ini's
8673 # "Profile" field, which controls profile location.
8674 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8675 # crash reporter server url.
8676 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8677 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8679 if test -z "$MOZ_APP_NAME"; then
8680 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8683 # For extensions and langpacks, we require a max version that is compatible
8684 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8685 # 24.0a1 and 24.0a2 aren't affected
8687 # 24.1.1 becomes 24.*
8688 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8689 if test -z "$IS_ALPHA"; then
8691 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
8694 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8697 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8698 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8699 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8701 AC_SUBST(MOZ_APP_NAME)
8702 AC_SUBST(MOZ_APP_DISPLAYNAME)
8703 AC_SUBST(MOZ_APP_BASENAME)
8704 AC_SUBST(MOZ_APP_VENDOR)
8705 AC_SUBST(MOZ_APP_PROFILE)
8706 AC_SUBST(MOZ_APP_ID)
8707 AC_SUBST(MAR_CHANNEL_ID)
8708 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8709 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8710 AC_SUBST(MOZ_EXTENSION_MANAGER)
8711 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8712 AC_SUBST(MOZ_APP_UA_NAME)
8713 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8714 AC_SUBST(MOZ_APP_VERSION)
8715 AC_SUBST(MOZ_APP_MAXVERSION)
8716 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8717 AC_SUBST(FIREFOX_VERSION)
8718 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8719 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8720 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8723 AC_SUBST(MOZ_APP_STATIC_INI)
8725 AC_SUBST(MOZ_PKG_SPECIAL)
8727 AC_SUBST(MOZILLA_OFFICIAL)
8729 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8730 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8732 if test "$MOZ_TELEMETRY_REPORTING"; then
8733 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8735 # Enable Telemetry by default for nightly and aurora channels
8736 if test -z "$RELEASE_BUILD"; then
8737 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8741 dnl If we have any service that uploads data (and requires data submission
8742 dnl policy alert), set MOZ_DATA_REPORTING.
8743 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8744 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8745 MOZ_DATA_REPORTING=1
8746 AC_DEFINE(MOZ_DATA_REPORTING)
8747 AC_SUBST(MOZ_DATA_REPORTING)
8751 AC_SUBST(MOZ_BROWSE_INFO)
8752 AC_SUBST(MOZ_TOOLS_DIR)
8753 AC_SUBST(WIN32_REDIST_DIR)
8756 dnl Echo the CFLAGS to remove extra whitespace.
8762 $_WARNINGS_CXXFLAGS \
8765 COMPILE_CFLAGS=`echo \
8770 COMPILE_CXXFLAGS=`echo \
8771 $_DEFINES_CXXFLAGS \
8779 HOST_CXXFLAGS=`echo \
8783 AC_SUBST(SYSTEM_LIBXUL)
8784 AC_SUBST(MOZ_NATIVE_JPEG)
8785 AC_SUBST(MOZ_NATIVE_PNG)
8786 AC_SUBST(MOZ_NATIVE_BZ2)
8788 AC_SUBST(MOZ_JPEG_CFLAGS)
8789 AC_SUBST(MOZ_JPEG_LIBS)
8790 AC_SUBST(MOZ_BZ2_CFLAGS)
8791 AC_SUBST(MOZ_BZ2_LIBS)
8792 AC_SUBST(MOZ_PNG_CFLAGS)
8793 AC_SUBST(MOZ_PNG_LIBS)
8795 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
8796 export MOZ_NUWA_PROCESS
8797 AC_DEFINE(MOZ_NUWA_PROCESS)
8799 AC_SUBST(MOZ_NUWA_PROCESS)
8801 AC_SUBST(NSPR_CFLAGS)
8803 AC_SUBST(MOZ_NATIVE_NSPR)
8805 AC_SUBST(NSS_CFLAGS)
8807 AC_SUBST(MOZ_NATIVE_NSS)
8808 AC_SUBST(NSS_DISABLE_DBM)
8811 OS_CXXFLAGS="$CXXFLAGS"
8812 OS_CPPFLAGS="$CPPFLAGS"
8813 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8814 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8815 OS_LDFLAGS="$LDFLAGS"
8818 AC_SUBST(OS_CXXFLAGS)
8819 AC_SUBST(OS_CPPFLAGS)
8820 AC_SUBST(OS_COMPILE_CFLAGS)
8821 AC_SUBST(OS_COMPILE_CXXFLAGS)
8822 AC_SUBST(OS_LDFLAGS)
8824 AC_SUBST(CROSS_COMPILE)
8825 AC_SUBST(WCHAR_CFLAGS)
8829 AC_SUBST(HOST_CFLAGS)
8830 AC_SUBST(HOST_CXXFLAGS)
8831 AC_SUBST(HOST_LDFLAGS)
8832 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8834 AC_SUBST(HOST_AR_FLAGS)
8836 AC_SUBST(HOST_RANLIB)
8837 AC_SUBST(HOST_NSPR_MDCPUCFG)
8838 AC_SUBST(HOST_BIN_SUFFIX)
8839 AC_SUBST(HOST_OS_ARCH)
8841 AC_SUBST(TARGET_CPU)
8842 AC_SUBST(TARGET_VENDOR)
8844 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8845 AC_SUBST(TARGET_MD_ARCH)
8846 AC_SUBST(TARGET_XPCOM_ABI)
8849 AC_SUBST(OS_RELEASE)
8852 AC_SUBST(INTEL_ARCHITECTURE)
8853 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
8854 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
8856 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8858 AC_SUBST(WRAP_LDFLAGS)
8861 AC_SUBST(MKSHLIB_FORCE_ALL)
8862 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8863 AC_SUBST(DSO_CFLAGS)
8864 AC_SUBST(DSO_PIC_CFLAGS)
8865 AC_SUBST(DSO_LDOPTS)
8866 AC_SUBST(LIB_PREFIX)
8867 AC_SUBST(DLL_PREFIX)
8868 AC_SUBST(DLL_SUFFIX)
8869 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8870 AC_SUBST(LIB_SUFFIX)
8871 AC_SUBST(OBJ_SUFFIX)
8872 AC_SUBST(BIN_SUFFIX)
8873 AC_SUBST(ASM_SUFFIX)
8874 AC_SUBST(IMPORT_LIB_SUFFIX)
8876 AC_SUBST(CC_VERSION)
8877 AC_SUBST(CXX_VERSION)
8878 AC_SUBST(MSMANIFEST_TOOL)
8879 AC_SUBST(NS_ENABLE_TSF)
8880 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8881 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8884 AC_SUBST(MOZ_VORBIS)
8885 AC_SUBST(MOZ_TREMOR)
8889 AC_SUBST(MOZ_FFMPEG)
8891 AC_SUBST(MOZ_DIRECTSHOW)
8892 AC_SUBST(MOZ_MEDIA_PLUGINS)
8893 AC_SUBST(MOZ_APPLEMEDIA)
8894 AC_SUBST(MOZ_OMX_PLUGIN)
8895 AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
8898 AC_SUBST(VPX_ASFLAGS)
8899 AC_SUBST(VPX_DASH_C_FLAG)
8900 AC_SUBST(VPX_AS_CONVERSION)
8901 AC_SUBST(VPX_ASM_SUFFIX)
8902 AC_SUBST(VPX_X86_ASM)
8903 AC_SUBST(VPX_ARM_ASM)
8904 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8905 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8906 AC_SUBST(LIBJPEG_TURBO_AS)
8907 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8908 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8909 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8910 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8912 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8913 AC_SUBST(MOZ_FOLD_LIBS)
8915 AC_SUBST(MOZ_ENABLE_SZIP)
8916 AC_SUBST(MOZ_SZIP_FLAGS)
8918 if test "$MOZ_DEBUG"; then
8921 AC_SUBST(MOZ_EM_DEBUG)
8923 if test -n "$COMPILE_ENVIRONMENT"; then
8924 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
8926 dnl Check for missing components
8927 if test "$MOZ_X11"; then
8928 if test "$WITHOUT_X11"; then
8929 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8931 dnl ====================================================
8932 dnl = Check if X headers exist
8933 dnl ====================================================
8934 _SAVE_CFLAGS=$CFLAGS
8935 CFLAGS="$CFLAGS $XCFLAGS"
8939 #include <X11/Xlib.h>
8940 #include <X11/Intrinsic.h>
8941 #include <X11/extensions/XShm.h>
8945 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8946 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8950 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
8951 CFLAGS="$_SAVE_CFLAGS"
8953 if test -n "$MISSING_X"; then
8954 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8959 fi # COMPILE_ENVIRONMENT
8961 dnl Set various defines and substitutions
8962 dnl ========================================================
8964 if test "$OS_ARCH" != "WINNT"; then
8968 if test "$MOZ_DEBUG"; then
8969 AC_DEFINE(MOZ_REFLOW_PERF)
8970 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8973 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
8974 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8975 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8976 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8977 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8978 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8979 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8980 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8981 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8984 if test "$MOZ_DEBUG"; then
8987 case "$MOZ_UPDATE_CHANNEL" in
8988 aurora|beta|release|esr)
8995 if test -n "$A11Y_LOG"; then
8999 AC_SUBST(MOZILLA_VERSION)
9001 AC_SUBST(ac_configure_args)
9003 dnl Spit out some output
9004 dnl ========================================================
9006 dnl The following defines are used by xpcom
9007 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9009 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9010 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9011 HAVE_CPP_PARTIAL_SPECIALIZATION
9012 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9013 NEED_CPP_UNUSED_IMPLEMENTATIONS
9016 HAVE_ICONV_WITH_CONST_INPUT
9029 AC_SUBST(STLPORT_LIBS)
9031 dnl ========================================================
9033 dnl ========================================================
9035 # Internationalization isn't built or exposed by default in non-desktop
9036 # builds. Bugs to enable:
9038 # Android: bug 864843
9041 if test "$MOZ_WIDGET_TOOLKIT" = "android" ||
9042 test "$MOZ_BUILD_APP" = "b2g"; then
9050 if test -n "$MOZ_NATIVE_ICU"; then
9051 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_ICU_LIBS"
9054 if test -n "$JS_SHARED_LIBRARY"; then
9055 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
9057 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
9058 AC_DEFINE(MOZ_STATIC_JS)
9060 AC_SUBST(JS_SHARED_LIBRARY)
9062 AC_SUBST(UPLOAD_EXTRA_FILES)
9064 MOZ_CREATE_CONFIG_STATUS()
9066 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9067 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9068 MOZ_SUBCONFIGURE_ICU()
9069 MOZ_SUBCONFIGURE_FFI()
9072 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
9073 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
9074 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
9075 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
9076 # (apparently) only need this hack when egrep's "pattern" is particularly long
9077 # (as in the following code) and the first egrep on our $PATH is Apple's. See
9081 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
9088 # Run jemalloc configure script
9090 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
9091 ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
9092 if test -n "$MOZ_REPLACE_MALLOC"; then
9093 # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9094 ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9095 ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9097 if test -n "$MOZ_JEMALLOC3"; then
9098 case "${OS_ARCH}" in
9100 # We want jemalloc functions to be kept hidden on both Mac and Windows
9101 # See memory/build/mozmemory_wrap.h for details.
9102 ac_configure_args="$ac_configure_args --without-export"
9105 elif test "${OS_ARCH}" = Darwin; then
9106 # When building as a replace-malloc lib, disabling the zone allocator
9107 # forces to use pthread_atfork.
9108 ac_configure_args="$ac_configure_args --disable-zone-allocator"
9110 _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9112 if test -z "$MOZ_REPLACE_MALLOC"; then
9114 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9118 elif test -z "$MOZ_JEMALLOC3"; then
9120 JEMALLOC_WRAPPER=replace_
9122 if test -n "$MANGLE"; then
9124 if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
9125 JEMALLOC_WRAPPER=__wrap_
9127 for mangle in ${MANGLE}; do
9128 if test -n "$MANGLED"; then
9129 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9131 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9134 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9137 if test -z "$MOZ_TLS"; then
9138 ac_configure_args="$ac_configure_args --disable-tls"
9140 EXTRA_CFLAGS="$CFLAGS"
9141 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9142 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9144 if test "$CROSS_COMPILE"; then
9145 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9147 _save_cache_file="$cache_file"
9148 cache_file=$_objdir/memory/jemalloc/src/config.cache
9150 if ! test -e memory/jemalloc; then
9151 mkdir -p memory/jemalloc
9154 dnl jemalloc's configure uses $srcdir in AC_CONFIG_HEADERS, which syntax uses
9155 dnl colons, conflicting with the windows-style path in $srcdir.
9156 dnl Turn it into a msys path just for jemalloc's configure
9157 _save_srcdir="$srcdir"
9158 srcdir=`cd $srcdir; pwd`
9159 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9160 srcdir="$_save_srcdir"
9161 cache_file="$_save_cache_file"
9162 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9165 # Run freetype configure script
9167 if test "$MOZ_TREE_FREETYPE"; then
9168 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9169 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9170 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9171 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9172 # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
9173 # to force freetype to use our settings rather than autodetecting
9174 export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
9175 export LIBPNG_LIBS="$MOZ_PNG_LIBS "
9176 export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
9177 export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
9178 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9179 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
9181 if ! test -e modules; then
9185 AC_OUTPUT_SUBDIRS(modules/freetype2)
9188 if test -z "$direct_nspr_config"; then
9189 dnl ========================================================
9190 dnl = Setup a nice relatively clean build environment for
9191 dnl = sub-configures.
9192 dnl ========================================================
9195 CFLAGS="$_SUBDIR_CFLAGS"
9196 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9197 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9198 LDFLAGS="$_SUBDIR_LDFLAGS"
9199 HOST_CC="$_SUBDIR_HOST_CC"
9200 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9201 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9202 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9209 # Run all configure scripts specified by a subconfigure
9210 if test -n "$_subconfigure_subdir"; then
9211 _save_ac_configure_args="$ac_configure_args"
9212 ac_configure_args="$_subconfigure_config_args"
9213 AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
9214 ac_configure_args="$_save_ac_configure_args"
9217 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9218 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9222 if test -n "$_WRAP_MALLOC"; then
9223 # Avoid doubling wrap malloc arguments
9224 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9227 if test -z "$MOZ_NATIVE_NSPR"; then
9228 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9229 if test -z "$MOZ_DEBUG"; then
9230 ac_configure_args="$ac_configure_args --disable-debug"
9232 ac_configure_args="$ac_configure_args --enable-debug"
9233 if test -n "$MOZ_NO_DEBUG_RTL"; then
9234 ac_configure_args="$ac_configure_args --disable-debug-rtl"
9237 if test "$MOZ_OPTIMIZE" = "1"; then
9238 ac_configure_args="$ac_configure_args --enable-optimize"
9239 elif test -z "$MOZ_OPTIMIZE"; then
9240 ac_configure_args="$ac_configure_args --disable-optimize"
9242 if test -n "$HAVE_64BIT_OS"; then
9243 ac_configure_args="$ac_configure_args --enable-64bit"
9245 if test -n "$USE_ARM_KUSER"; then
9246 ac_configure_args="$ac_configure_args --with-arm-kuser"
9248 # A configure script generated by autoconf 2.68 does not allow the cached
9249 # values of "precious" variables such as CFLAGS and LDFLAGS to differ from
9250 # the values passed to the configure script. Since we modify CFLAGS and
9251 # LDFLAGS before passing them to NSPR's configure script, we cannot share
9252 # config.cache with NSPR. As a result, we cannot pass AS, CC, CXX, etc. to
9253 # NSPR via a shared config.cache file and must pass them to NSPR on the
9254 # configure command line.
9255 for var in AS CC CXX CPP LD AR RANLIB STRIP; do
9256 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9258 # A configure script generated by autoconf 2.68 warns if --host is
9259 # specified but --build isn't. So we always pass --build to NSPR's
9261 ac_configure_args="$ac_configure_args --build=$build"
9262 ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9264 # Save these, so we can mess with them for the subconfigure ..
9265 _SAVE_CFLAGS="$CFLAGS"
9266 _SAVE_CPPFLAGS="$CPPFLAGS"
9267 _SAVE_LDFLAGS="$LDFLAGS"
9269 if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9270 # dladdr is supported by the new linker, even when the system linker doesn't
9271 # support it. Trick nspr into using dladdr when it's not supported.
9272 export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9274 export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9275 export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
9277 # Use a separate cache file for NSPR since it uses autoconf 2.68.
9278 _save_cache_file="$cache_file"
9279 cache_file=$_objdir/nsprpub/config.cache
9281 AC_OUTPUT_SUBDIRS(nsprpub)
9283 # .. and restore them
9284 cache_file="$_save_cache_file"
9285 CFLAGS="$_SAVE_CFLAGS"
9286 CPPFLAGS="$_SAVE_CPPFLAGS"
9287 LDFLAGS="$_SAVE_LDFLAGS"
9289 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9292 dnl ========================================================
9293 dnl = Setup a nice relatively clean build environment for
9294 dnl = sub-configures.
9295 dnl ========================================================
9298 CFLAGS="$_SUBDIR_CFLAGS"
9299 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9300 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9301 LDFLAGS="$_SUBDIR_LDFLAGS"
9302 HOST_CC="$_SUBDIR_HOST_CC"
9303 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9304 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9305 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9308 if test -n "$ENABLE_CLANG_PLUGIN"; then
9309 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9310 AC_OUTPUT_SUBDIRS(build/clang-plugin)
9314 # Run the SpiderMonkey 'configure' script.
9315 dist=$MOZ_BUILD_ROOT/dist
9316 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9317 ac_configure_args="$ac_configure_args --enable-threadsafe"
9319 if test "$_INTL_API" = no; then
9320 ac_configure_args="$ac_configure_args --without-intl-api"
9323 if test "$BUILD_CTYPES"; then
9324 # Build js-ctypes on the platforms we can.
9325 ac_configure_args="$ac_configure_args --enable-ctypes"
9327 if test -z "$JS_SHARED_LIBRARY" ; then
9328 ac_configure_args="$ac_configure_args --disable-shared-js"
9329 if test -n "$MOZ_DISABLE_EXPORT_JS"; then
9330 ac_configure_args="$ac_configure_args --disable-export-js"
9333 if test -z "$JSGC_USE_EXACT_ROOTING" ; then
9334 ac_configure_args="$ac_configure_args --disable-exact-rooting"
9336 if test -z "$JSGC_GENERATIONAL" ; then
9337 ac_configure_args="$ac_configure_args --disable-gcgenerational"
9339 if test -z "$MOZ_NATIVE_NSPR"; then
9340 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9341 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9343 ac_configure_args="$ac_configure_args --prefix=$dist"
9344 if test "$MOZ_MEMORY"; then
9345 ac_configure_args="$ac_configure_args --enable-jemalloc"
9347 if test -n "$MOZ_GLUE_LDFLAGS"; then
9348 export MOZ_GLUE_LDFLAGS
9350 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9351 export MOZ_GLUE_PROGRAM_LDFLAGS
9353 if test -n "$ZLIB_IN_MOZGLUE"; then
9356 export MOZ_NATIVE_ZLIB
9357 export MOZ_ZLIB_CFLAGS
9358 export MOZ_ZLIB_LIBS
9360 export DONT_POPULATE_VIRTUALENV=1
9362 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9363 export STLPORT_CPPFLAGS
9364 export STLPORT_LDFLAGS
9366 export JS_STANDALONE=no
9368 export ZLIB_IN_MOZGLUE
9370 if ! test -e js; then
9374 AC_OUTPUT_SUBDIRS(js/src)
9375 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9377 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9379 export WRITE_MOZINFO=1
9380 dnl we need to run config.status after js/src subconfigure because we're
9381 dnl traversing its moz.build and we need its config.status for that.
9382 dnl However, writing our own config.status needs to happen before
9383 dnl subconfigures because the setup surrounding subconfigures alters
9384 dnl many AC_SUBSTed variables.
9385 MOZ_RUN_CONFIG_STATUS()