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.0.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`
96 dnl TODO Don't exempt L10N builds once bug 842760 is resolved.
97 if test "$_topsrcdir" = "$_objdir" -a "${with_l10n_base+set}" != set; then
99 echo " * Building directly in the main source directory is not allowed."
101 echo " * To build, you must run configure from a separate directory"
102 echo " * (referred to as an object directory)."
104 echo " * If you are building with a mozconfig, you will need to change your"
105 echo " * mozconfig to point to a different object directory."
110 # Check for a couple representative files in the source tree
112 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
113 if test -f $file; then
114 _conflict_files="$_conflict_files $file"
117 if test "$_conflict_files"; then
119 echo "* Your source tree contains these files:"
120 for file in $_conflict_files; do
124 * This indicates that you previously built in the source tree.
125 * A source tree build can confuse the separate objdir build.
127 * To clean up the source tree:
141 COMPILE_ENVIRONMENT=1
142 MOZ_ARG_DISABLE_BOOL(compile-environment,
143 [ --disable-compile-environment
144 Disable compiler/library checks.],
145 COMPILE_ENVIRONMENT= )
146 AC_SUBST(COMPILE_ENVIRONMENT)
148 MOZ_ARG_WITH_STRING(l10n-base,
149 [ --with-l10n-base=DIR path to l10n repositories],
150 L10NBASEDIR=$withval)
151 if test -n "$L10NBASEDIR"; then
152 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
153 AC_MSG_ERROR([--with-l10n-base must specify a path])
154 elif test -d "$L10NBASEDIR"; then
155 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
157 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
160 AC_SUBST(L10NBASEDIR)
162 dnl Check for Perl first -- needed for win32 SDK checks
163 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
164 if test -z "$PERL" -o "$PERL" = ":"; then
165 AC_MSG_ERROR([perl not found in \$PATH])
169 if test -n "$GAIADIR" ; then
170 AC_DEFINE(PACKAGE_GAIA)
173 MOZ_ARG_WITH_STRING(gonk,
175 location of gonk dir],
178 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
179 [ --with-gonk-toolchain-prefix=DIR
180 prefix to gonk toolchain commands],
181 gonk_toolchain_prefix=$withval)
183 if test -n "$gonkdir" ; then
184 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
185 android_source="$gonkdir"
186 ANDROID_SOURCE="$android_source"
187 ANDROID_NDK="${ANDROID_SOURCE}/ndk"
190 if test -n "${PLATFORM_SDK_VERSION}"; then
191 ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
195 TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
196 AS="$gonk_toolchain_prefix"as
197 CC="$gonk_toolchain_prefix"gcc
198 CXX="$gonk_toolchain_prefix"g++
199 CPP="$gonk_toolchain_prefix"cpp
200 LD="$gonk_toolchain_prefix"ld
201 AR="$gonk_toolchain_prefix"ar
202 RANLIB="$gonk_toolchain_prefix"ranlib
203 STRIP="$gonk_toolchain_prefix"strip
204 OBJCOPY="$gonk_toolchain_prefix"objcopy
206 if ! test -e "$gonkdir/ndk/sources/cxx-stl/stlport/src/iostream.cpp"; then
207 AC_MSG_ERROR([Couldn't find path to stlport sources in the gonk tree])
209 STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include"
210 STLPORT_LIBS="$_objdir/build/stlport/libstlport_static.a"
212 case "$target_cpu" in
221 case "$ANDROID_VERSION" in
223 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/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"
228 AC_SUBST(MOZ_OMX_DECODER)
232 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"
233 if test -d "$gonkdir/external/bluetooth/bluez"; then
234 GONK_INCLUDES="$GONK_INCLUDES -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
237 elif test -d "$gonkdir/external/bluetooth/bluedroid"; then
239 MOZ_B2G_BT_BLUEDROID=1
244 AC_SUBST(MOZ_OMX_DECODER)
247 AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
250 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"
251 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
252 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
253 dnl Add -llog by default, since we use it all over the place.
256 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"
258 dnl prevent cross compile section from using these flags as host flags
259 if test -z "$HOST_CPPFLAGS" ; then
262 if test -z "$HOST_CFLAGS" ; then
265 if test -z "$HOST_CXXFLAGS" ; then
268 if test -z "$HOST_LDFLAGS" ; then
273 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
274 AC_SUBST(ANDROID_VERSION)
275 AC_DEFINE(HAVE_SYS_UIO_H)
276 AC_DEFINE(HAVE_PTHREADS)
278 MOZ_CHROME_FILE_FORMAT=omni
284 *-android*|*-linuxandroid*)
285 if test -z "$ANDROID_PACKAGE_NAME" ; then
286 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
288 MOZ_CHROME_FILE_FORMAT=omni
292 AC_PATH_PROG(OBJCOPY,objcopy)
297 AC_SUBST(ANDROID_SOURCE)
298 AC_SUBST(ANDROID_PACKAGE_NAME)
301 dnl ========================================================
302 dnl Checks for compilers.
303 dnl ========================================================
304 dnl Set CROSS_COMPILE in the environment when running configure
305 dnl to use the cross-compile setup for now
306 dnl ========================================================
308 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
311 if test "$COMPILE_ENVIRONMENT"; then
313 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
319 # Work around the conftest.exe access problem on Windows
324 MOZ_PATH_PROGS(AS, $AS as, $CC)
325 AC_CHECK_PROGS(AR, ar, :)
326 AC_CHECK_PROGS(LD, ld, :)
327 AC_CHECK_PROGS(STRIP, strip, :)
328 AC_CHECK_PROGS(WINDRES, windres, :)
329 if test -z "$HOST_CC"; then
332 if test -z "$HOST_CFLAGS"; then
333 HOST_CFLAGS="$CFLAGS"
335 if test -z "$HOST_CXX"; then
338 if test -z "$HOST_CXXFLAGS"; then
339 HOST_CXXFLAGS="$CXXFLAGS"
341 if test -z "$HOST_LDFLAGS"; then
342 HOST_LDFLAGS="$LDFLAGS"
344 if test -z "$HOST_RANLIB"; then
345 HOST_RANLIB="$RANLIB"
347 if test -z "$HOST_AR"; then
350 if test -z "$HOST_AR_FLAGS"; then
351 HOST_AR_FLAGS="$AR_FLAGS"
355 if test -n "$MOZ_WINCONSOLE"; then
356 AC_DEFINE(MOZ_WINCONSOLE)
361 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
362 if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
363 test "$GCC_MAJOR_VERSION" -lt 4; then
364 AC_MSG_ERROR([Only GCC 4.4 or newer supported])
368 dnl ========================================================
369 dnl Special win32 checks
370 dnl ========================================================
372 MOZ_ARG_ENABLE_BOOL(metro,
373 [ --enable-metro Enable Windows Metro build targets],
376 if test -n "$MOZ_METRO"; then
378 # Target the Windows 8 Kit
381 # toolkit/library/makefile.in needs these, see nsDllMain.
383 CRTEXPDLLVERSION=1-1-0
385 # Target the Windows 7 SDK by default
390 AC_SUBST(CRTDLLVERSION)
391 AC_SUBST(CRTEXPDLLVERSION)
393 MOZ_ARG_WITH_STRING(windows-version,
394 [ --with-windows-version=WINSDK_TARGETVER
395 Windows SDK version to target. Lowest version
396 currently allowed is 601 (Win7), highest is 602 (Win8)],
397 WINSDK_TARGETVER=$withval)
399 # Currently only two sdk versions allowed, 601 and 602
400 case "$WINSDK_TARGETVER" in
402 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
406 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
412 if test "$GCC" != "yes" -a -z "$CLANG_CC"; then
413 # Check to see if we are really running in a msvc environemnt
415 AC_CHECK_PROGS(MIDL, midl)
417 # Make sure compilers are valid
418 CFLAGS="$CFLAGS -TC -nologo"
419 CXXFLAGS="$CXXFLAGS -TP -nologo"
422 AC_TRY_COMPILE([#include <stdio.h>],
423 [ printf("Hello World\n"); ],,
424 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
427 AC_TRY_COMPILE([#include <new.h>],
428 [ unsigned *test = new unsigned(42); ],,
429 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
433 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
436 # Determine compiler version
437 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
438 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
439 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
440 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
441 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
442 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
444 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
445 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
447 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
448 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
451 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
452 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
454 if test "$_CC_MAJOR_VERSION" = "16"; then
457 elif test "$_CC_MAJOR_VERSION" = "17"; then
460 elif test "$_CC_MAJOR_VERSION" = "18"; then
464 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
467 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
469 if test -n "$WIN32_REDIST_DIR"; then
470 if test ! -d "$WIN32_REDIST_DIR"; then
471 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
473 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
476 dnl Confirm we have the pri tools on win8 builds
477 if test -n "$MOZ_METRO"; then
478 AC_MSG_CHECKING([for makepri])
479 AC_CHECK_PROGS(MAKEPRI, makepri, "")
480 if test -z "MAKEPRI" ; then
481 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
486 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
487 dnl not something else like "magnetic tape manipulation utility".
488 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
489 if test -z "$MSMT_TOOL"; then
490 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
494 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
496 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
497 if test -z "$MSMANIFEST_TOOL_VERSION"; then
498 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
504 # Check linker version
505 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
506 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
507 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
508 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
513 # Set midl environment
516 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
519 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
523 unset _MSVC_VER_FILTER
525 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
529 _SAVE_CXXFLAGS="$CXXFLAGS"
530 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
531 AC_TRY_COMPILE([#include <exception>],
532 [std::_Throw(std::exception()); return 0;],
533 ac_cv_have_std__Throw="yes",
534 ac_cv_have_std__Throw="no")
535 CXXFLAGS="$_SAVE_CXXFLAGS"
539 if test "$ac_cv_have_std__Throw" = "yes"; then
540 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
541 ac_cv_have_dllimport_exception_bug,
545 _SAVE_CXXFLAGS="$CXXFLAGS"
546 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
547 AC_TRY_LINK([#include <vector>],
548 [std::vector<int> v; return v.at(1);],
549 ac_cv_have_dllimport_exception_bug="no",
550 ac_cv_have_dllimport_exception_bug="yes")
551 CXXFLAGS="$_SAVE_CXXFLAGS"
554 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
556 MOZ_MSVC_STL_WRAP__Throw=1
557 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
560 AC_CACHE_CHECK(for overridable _RAISE,
565 _SAVE_CXXFLAGS="$CXXFLAGS"
566 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
567 AC_TRY_COMPILE([#include <xstddef>
569 #define _RAISE(x) externallyDefinedFunction((x).what())
572 [std::vector<int> v; return v.at(1);],
573 ac_cv_have__RAISE="no",
574 ac_cv_have__RAISE="yes")
575 CXXFLAGS="$_SAVE_CXXFLAGS"
578 if test "$ac_cv_have__RAISE" = "yes"; then
580 MOZ_MSVC_STL_WRAP__RAISE=1
581 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
583 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
587 if test "$WRAP_STL_INCLUDES" = "1"; then
588 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
590 elif test -z "$CLANG_CC"; then
591 # Check w32api version
592 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
593 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
594 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
595 AC_TRY_COMPILE([#include <w32api.h>],
596 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
597 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
598 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
599 #error "test failed."
601 , [ res=yes ], [ res=no ])
602 AC_MSG_RESULT([$res])
603 if test "$res" != "yes"; then
604 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
606 # Check windres version
607 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
608 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
609 AC_MSG_RESULT([$_WINDRES_VERSION])
610 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
611 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
612 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
613 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
614 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
615 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
616 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
617 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
618 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
619 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
620 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
621 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
623 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
626 AC_CHECK_PROGS(MIDL, $target-widl widl)
627 if test -n "$MIDL"; then
630 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
633 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
638 MOZ_WINSDK_MAXVER=0x06020000
642 if test "$GCC" != "yes" -o -n "$CLANG_CC" ; then
643 MOZ_FIND_WINSDK_VERSION
646 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
647 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
648 # Require OS features provided by IE 6.0 SP2 (XP SP2)
649 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
651 # If the maximum version supported by this SDK is lower than the target
653 AC_MSG_CHECKING([for Windows SDK being recent enough])
654 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
658 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.])
661 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
662 # Definitions matching sdkddkver.h
663 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
664 AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
665 AC_SUBST(MOZ_WINSDK_MAXVER)
672 if test -n "$_WIN32_MSVC"; then
674 SKIP_COMPILER_CHECKS=1
675 SKIP_LIBRARY_CHECKS=1
677 # Since we're skipping compiler and library checks, hard-code
680 AC_DEFINE(HAVE_SETBUF)
681 AC_DEFINE(HAVE_ISATTY)
684 fi # COMPILE_ENVIRONMENT
697 AC_SUBST(WRAP_STL_INCLUDES)
698 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
699 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
701 dnl ========================================================
702 dnl Checks for programs.
703 dnl ========================================================
707 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
708 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
709 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
711 AC_MSG_RESULT([$_perl_version])
713 if test "$_perl_res" != 0; then
714 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
718 AC_MSG_CHECKING([for full perl installation])
719 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
721 if test "$_perl_res" != 0; then
723 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
728 if test -z "$COMPILE_ENVIRONMENT"; then
729 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
731 AC_SUBST(NSINSTALL_BIN)
733 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
734 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
735 MOZ_PATH_PROGS(UNZIP, unzip)
736 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
737 AC_MSG_ERROR([unzip not found in \$PATH])
739 MOZ_PATH_PROGS(ZIP, zip)
740 if test -z "$ZIP" -o "$ZIP" = ":"; then
741 AC_MSG_ERROR([zip not found in \$PATH])
743 MOZ_PATH_PROG(XARGS, xargs)
744 if test -z "$XARGS" -o "$XARGS" = ":"; then
745 AC_MSG_ERROR([xargs not found in \$PATH .])
748 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
751 if test "$COMPILE_ENVIRONMENT"; then
753 dnl ========================================================
754 dnl = Mac OS X toolchain support
755 dnl ========================================================
757 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
758 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
759 dnl when we can run target binaries.
760 AC_SUBST(UNIVERSAL_BINARY)
761 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
763 MOZ_ARG_WITH_STRING(unify-dist,
764 [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
766 if test -n "$UNIVERSAL_BINARY"; then
767 if test -z "$UNIFY_DIST"; then
768 AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
770 case "$UNIFY_DIST" in
774 UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
780 dnl ========================================================
781 dnl Check for MacOS deployment target version
782 dnl ========================================================
784 MOZ_ARG_ENABLE_STRING(macos-target,
785 [ --enable-macos-target=VER (default=10.6)
786 Set the minimum MacOS version needed at runtime],
787 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
791 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
792 dnl Use the specified value
793 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
795 dnl No value specified on the command line or in the environment,
796 dnl use architecture minimum.
797 export MACOSX_DEPLOYMENT_TARGET=10.6
802 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
804 dnl ========================================================
805 dnl = Mac OS X SDK support
806 dnl ========================================================
809 MOZ_ARG_WITH_STRING(macos-sdk,
810 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
811 MACOS_SDK_DIR=$withval)
813 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
814 dnl NEXT_ROOT will be set and exported only if it's needed.
815 AC_SUBST(MACOS_SDK_DIR)
818 if test "$MACOS_SDK_DIR"; then
819 dnl Sync this section with the ones in NSPR and NSS.
820 dnl Changes to the cross environment here need to be accounted for in
821 dnl the libIDL checks (below) and xpidl build.
823 if test ! -d "$MACOS_SDK_DIR"; then
824 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
825 specify a valid SDK. SDKs are installed when the optional cross-development
826 tools are selected during the Xcode/Developer Tools installation.])
829 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
830 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
832 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
833 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
834 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
837 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
839 AC_TRY_COMPILE([#include <new>],[],
843 AC_MSG_RESULT($result)
845 if test "$result" = "no" ; then
846 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
850 fi # COMPILE_ENVIRONMENT
852 AC_MSG_CHECKING([compiler version])
853 # Just print it so it shows up in the logs.
854 cc_version=$($CC --version)
855 AC_MSG_RESULT([$cc_version])
857 if test -n "$MAKE"; then
858 if test `echo $MAKE | grep -c make.py` != 1; then
865 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
868 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
871 if test "$GMAKE" = ":"; then
872 AC_MSG_ERROR([GNU make not found])
876 if test -z "$MAKE"; then
880 if test "$COMPILE_ENVIRONMENT"; then
886 fi # COMPILE_ENVIRONMENT
888 dnl ========================================================
889 dnl set the defaults first
890 dnl ========================================================
906 MOZ_USER_DIR=".mozilla"
909 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
911 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
913 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
915 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
916 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
917 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
918 XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/bin)'
919 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)'
920 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
921 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
923 # These are specially defined on Windows only
926 XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
927 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
930 XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
931 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
937 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
941 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
943 if test -n "$CROSS_COMPILE"; then
944 OS_TARGET="${target_os}"
945 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
947 case "${target_os}" in
948 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
949 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
951 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
952 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
953 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
956 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
960 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
961 OS_RELEASE=`uname -r`
964 # Before this used `uname -m` when not cross compiling
965 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
966 OS_TEST="${target_cpu}"
968 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
970 #######################################################################
971 # Master "Core Components" macros for getting the OS target #
972 #######################################################################
975 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
980 # Define and override various archtecture-specific variables, including
989 case "$HOST_OS_ARCH" in
1003 if test -z "$GNU_CC"; then
1004 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1009 if test -z "$GNU_CXX"; then
1010 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1011 SOLARIS_SUNPRO_CXX=1
1014 AC_SUBST(SOLARIS_SUNPRO_CC)
1015 AC_SUBST(SOLARIS_SUNPRO_CXX)
1024 if test -z "$CROSS_COMPILE" ; then
1030 # If uname -s returns "Windows_NT", we assume that we are using
1031 # the uname.exe in MKS toolkit.
1033 # The -r option of MKS uname only returns the major version number.
1034 # So we need to use its -v option to get the minor version number.
1035 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1039 OS_MINOR_RELEASE=`uname -v`
1040 if test "$OS_MINOR_RELEASE" = "00"; then
1043 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1047 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1048 # the uname.exe in the MSYS tools.
1050 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1055 OS_RELEASE=`uname -v`.`uname -r`
1056 OS_TEST=${target_cpu}
1061 OS_RELEASE=`uname -v`
1064 case "${target_cpu}" in
1075 if test -z "$CROSS_COMPILE" ; then
1083 # Only set CPU_ARCH if we recognize the value of OS_TEST
1094 powerpc | ppc | rs6000)
1098 Alpha | alpha | ALPHA)
1131 if test -z "$OS_TARGET"; then
1134 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1136 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1137 dnl ===============================================================
1141 INTEL_ARCHITECTURE=1
1144 dnl Configure platform-specific CPU architecture compiler options.
1145 dnl ==============================================================
1148 dnl =================================================================
1149 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1150 dnl which is bad when cross compiling.
1151 dnl =================================================================
1152 if test "$COMPILE_ENVIRONMENT"; then
1153 configure_static_assert_macros='
1154 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1155 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1156 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1159 dnl test that the macros actually work:
1160 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1161 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1164 ac_cv_static_assertion_macros_work="yes"
1165 AC_TRY_COMPILE([$configure_static_assert_macros],
1166 [CONFIGURE_STATIC_ASSERT(1)],
1168 ac_cv_static_assertion_macros_work="no")
1169 AC_TRY_COMPILE([$configure_static_assert_macros],
1170 [CONFIGURE_STATIC_ASSERT(0)],
1171 ac_cv_static_assertion_macros_work="no",
1174 AC_TRY_COMPILE([$configure_static_assert_macros],
1175 [CONFIGURE_STATIC_ASSERT(1)],
1177 ac_cv_static_assertion_macros_work="no")
1178 AC_TRY_COMPILE([$configure_static_assert_macros],
1179 [CONFIGURE_STATIC_ASSERT(0)],
1180 ac_cv_static_assertion_macros_work="no",
1184 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1185 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1186 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1188 fi # COMPILE_ENVIRONMENT
1190 dnl ========================================================
1191 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1193 dnl ========================================================
1197 dnl ========================================================
1198 dnl Suppress Clang Argument Warnings
1199 dnl ========================================================
1200 if test -n "$CLANG_CC"; then
1201 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1202 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1204 if test -n "$CLANG_CXX"; then
1205 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1208 dnl ========================================================
1209 dnl = Use Address Sanitizer
1210 dnl ========================================================
1211 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1212 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1215 if test -n "$MOZ_ASAN"; then
1218 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1221 AC_SUBST(LLVM_SYMBOLIZER)
1223 dnl ========================================================
1224 dnl = Enable hacks required for LLVM instrumentations
1225 dnl ========================================================
1226 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1227 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1230 if test -n "$MOZ_LLVM_HACKS"; then
1234 AC_SUBST(MOZ_NO_WLZDEFS)
1235 AC_SUBST(MOZ_CFLAGS_NSS)
1237 dnl ========================================================
1238 dnl GNU specific defaults
1239 dnl ========================================================
1240 if test "$GNU_CC"; then
1241 # Per bug 719659 comment 2, some of the headers on ancient build machines
1242 # may require gnu89 inline semantics. But otherwise, we use C99.
1243 # But on OS X we just use C99 plus GNU extensions, in order to fix
1245 CFLAGS="$CFLAGS -std=gnu99"
1246 if test "${OS_ARCH}" != Darwin; then
1247 CFLAGS="$CFLAGS -fgnu89-inline"
1249 # FIXME: Let us build with strict aliasing. bug 414641.
1250 CFLAGS="$CFLAGS -fno-strict-aliasing"
1251 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1252 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1253 DSO_LDOPTS='-shared'
1254 if test "$GCC_USE_GNU_LD"; then
1255 # Some tools like ASan use a runtime library that is only
1256 # linked against executables, so we must allow undefined
1257 # symbols for shared objects in some cases.
1258 if test -z "$MOZ_NO_WLZDEFS"; then
1259 # Don't allow undefined symbols in libraries
1260 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1263 WARNINGS_AS_ERRORS='-Werror'
1265 DSO_PIC_CFLAGS='-fPIC'
1266 ASFLAGS="$ASFLAGS -fPIC"
1267 AC_MSG_CHECKING([for --noexecstack option to as])
1268 _SAVE_CFLAGS=$CFLAGS
1269 CFLAGS="$CFLAGS -Wa,--noexecstack"
1270 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1271 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1272 AC_MSG_RESULT([no]))
1273 CFLAGS=$_SAVE_CFLAGS
1274 AC_MSG_CHECKING([for -z noexecstack option to ld])
1275 _SAVE_LDFLAGS=$LDFLAGS
1276 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1277 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1279 LDFLAGS=$_SAVE_LDFLAGS)
1281 AC_MSG_CHECKING([for -z text option to ld])
1282 _SAVE_LDFLAGS=$LDFLAGS
1283 LDFLAGS="$LDFLAGS -Wl,-z,text"
1284 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1285 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1287 LDFLAGS=$_SAVE_LDFLAGS)
1289 AC_MSG_CHECKING([for --build-id option to ld])
1290 _SAVE_LDFLAGS=$LDFLAGS
1291 LDFLAGS="$LDFLAGS -Wl,--build-id"
1292 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1293 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1295 LDFLAGS=$_SAVE_LDFLAGS)
1298 # Check for -mssse3 on $CC
1299 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1300 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1301 _SAVE_CFLAGS=$CFLAGS
1302 CFLAGS="$CFLAGS -mssse3"
1303 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1304 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1305 AC_MSG_RESULT([no]))
1306 CFLAGS=$_SAVE_CFLAGS
1308 # Check for -msse4.1 on $CC
1309 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1310 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1311 _SAVE_CFLAGS=$CFLAGS
1312 CFLAGS="$CFLAGS -msse4.1"
1313 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1314 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1315 AC_MSG_RESULT([no]))
1316 CFLAGS=$_SAVE_CFLAGS
1318 # Turn on GNU-specific warnings:
1319 # -Wall - turn on a lot of warnings
1320 # -Wpointer-arith - good to have
1321 # -Wdeclaration-after-statement - MSVC doesn't like these
1322 # -Werror=return-type - catches missing returns, zero false positives
1323 # -Wtype-limits - catches overflow bugs, few false positives
1324 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1325 # -Wsign-compare - catches comparison of signed and unsigned types
1327 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1328 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1329 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1330 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1331 MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1333 # Turn off the following warnings that -Wall turns on:
1334 # -Wno-unused - lots of violations in third-party code
1336 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1338 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1339 # Don't use -Wcast-align with ICC or clang
1341 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1342 hppa | ia64 | sparc | arm)
1345 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1350 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1351 _USE_CPP_INCLUDE_FLAG=1
1352 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1354 elif test "$SOLARIS_SUNPRO_CC"; then
1356 if test "$CPU_ARCH" = "sparc"; then
1357 # for Sun Studio on Solaris/SPARC
1358 DSO_PIC_CFLAGS='-xcode=pic32'
1360 DSO_PIC_CFLAGS='-KPIC'
1362 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1364 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1365 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1367 DSO_LDOPTS='-shared'
1368 if test "$GNU_LD"; then
1369 # Don't allow undefined symbols in libraries
1370 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1374 DSO_PIC_CFLAGS='-KPIC'
1375 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1378 if test "$GNU_CXX"; then
1379 # FIXME: Let us build with strict aliasing. bug 414641.
1380 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1382 # Turn on GNU-specific warnings:
1383 # -Wall - turn on a lot of warnings
1384 # -Wpointer-arith - good to have
1385 # -Woverloaded-virtual - ???
1386 # -Werror=return-type - catches missing returns, zero false positives
1387 # -Wtype-limits - catches overflow bugs, few false positives
1388 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1389 # -Wsign-compare - catches comparison of signed and unsigned types
1391 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1392 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1393 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1394 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1395 MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1397 # Turn off the following warnings that -Wall turns on:
1398 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1400 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1402 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1403 # Don't use -Wcast-align with ICC or clang
1405 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1406 hppa | ia64 | sparc | arm)
1409 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1414 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1415 _USE_CPP_INCLUDE_FLAG=1
1417 # Recent clang and gcc support C++11 deleted functions without warnings if
1418 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1419 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1420 # unused. But clang's warning can be disabled, so when compiling with clang
1421 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1422 # deleted function syntax.
1423 if test "$CLANG_CXX"; then
1424 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1425 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1429 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1432 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1433 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1434 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1435 dnl normal behavior.
1436 dnl ========================================================
1438 MKSHLIB_UNFORCE_ALL=
1440 if test "$COMPILE_ENVIRONMENT"; then
1441 if test "$GNU_CC"; then
1442 AC_MSG_CHECKING(whether ld has archive extraction flags)
1443 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1444 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1445 ac_cv_mkshlib_force_and_unforce="no"
1446 exec 3<&0 <<LOOP_INPUT
1447 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1448 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1449 force="-Wl,-all"; unforce="-Wl,-none"
1456 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1459 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1461 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1465 eval $ac_cv_mkshlib_force_and_unforce
1466 MKSHLIB_FORCE_ALL=$force
1467 MKSHLIB_UNFORCE_ALL=$unforce
1470 fi # COMPILE_ENVIRONMENT
1472 dnl ========================================================
1473 dnl Checking for 64-bit OS
1474 dnl ========================================================
1475 if test "$COMPILE_ENVIRONMENT"; then
1478 AC_MSG_CHECKING(for 64-bit OS)
1479 AC_TRY_COMPILE([$configure_static_assert_macros],
1480 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1481 result="yes", result="no")
1482 AC_MSG_RESULT("$result")
1483 if test "$result" = "yes"; then
1484 AC_DEFINE(HAVE_64BIT_OS)
1487 AC_SUBST(HAVE_64BIT_OS)
1489 fi # COMPILE_ENVIRONMENT
1491 dnl ========================================================
1492 dnl Enable high-memory support on OS/2 by default.
1493 dnl ========================================================
1494 MOZ_OS2_HIGH_MEMORY=1
1495 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1496 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1497 MOZ_OS2_HIGH_MEMORY=,
1498 MOZ_OS2_HIGH_MEMORY=1 )
1499 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1501 dnl ========================================================
1502 dnl = Use profiling compile flags
1503 dnl ========================================================
1504 MOZ_ARG_ENABLE_BOOL(profiling,
1505 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1509 # For profiling builds keep the symbol information
1510 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1511 case "$OS_TARGET" in
1512 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1513 STRIP_FLAGS="--strip-debug"
1518 dnl ========================================================
1519 dnl = Use incremental GC
1520 dnl ========================================================
1522 MOZ_ARG_DISABLE_BOOL(gcincremental,
1523 [ --disable-gcincremental Disable incremental GC],
1525 if test -n "$JSGC_INCREMENTAL"; then
1526 AC_DEFINE(JSGC_INCREMENTAL)
1529 dnl ========================================================
1530 dnl = Use generational GC
1531 dnl ========================================================
1532 MOZ_ARG_ENABLE_BOOL(gcgenerational,
1533 [ --enable-gcgenerational Enable generational GC],
1534 JSGC_GENERATIONAL=1,
1535 JSGC_GENERATIONAL= )
1536 if test -n "$JSGC_GENERATIONAL"; then
1537 AC_DEFINE(JSGC_GENERATIONAL)
1540 dnl ========================================================
1541 dnl = Perform moving GC stack rooting analysis
1542 dnl ========================================================
1543 MOZ_ARG_ENABLE_BOOL(root-analysis,
1544 [ --enable-root-analysis Enable moving GC stack root analysis],
1545 JSGC_ROOT_ANALYSIS=1,
1546 JSGC_ROOT_ANALYSIS= )
1547 if test -n "$JSGC_ROOT_ANALYSIS"; then
1548 AC_DEFINE(JSGC_ROOT_ANALYSIS)
1551 dnl ========================================================
1552 dnl = Use exact stack rooting for GC
1553 dnl ========================================================
1554 MOZ_ARG_ENABLE_BOOL(exact-rooting,
1555 [ --enable-exact-rooting Enable use of exact stack roots for GC],
1556 JSGC_USE_EXACT_ROOTING=1,
1557 JSGC_USE_EXACT_ROOTING= )
1558 if test -n "$JSGC_USE_EXACT_ROOTING"; then
1559 AC_DEFINE(JSGC_USE_EXACT_ROOTING)
1562 dnl ========================================================
1564 dnl ========================================================
1565 MOZ_ARG_ENABLE_BOOL(valgrind,
1566 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1569 if test -n "$MOZ_VALGRIND"; then
1570 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1572 [--enable-valgrind specified but Valgrind is not installed]))
1573 AC_DEFINE(MOZ_VALGRIND)
1575 AC_SUBST(MOZ_VALGRIND)
1577 dnl ========================================================
1579 dnl ========================================================
1580 MOZ_ARG_ENABLE_BOOL(jprof,
1581 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1584 if test -n "$MOZ_JPROF"; then
1586 AC_DEFINE(MOZ_JPROF)
1589 dnl ========================================================
1591 dnl ========================================================
1592 MOZ_ENABLE_PROFILER_SPS=1
1594 case "${OS_TARGET}" in
1596 case "${CPU_ARCH}" in
1599 MOZ_ENABLE_PROFILER_SPS=
1603 case "${CPU_ARCH}" in
1606 MOZ_ENABLE_PROFILER_SPS=
1611 MOZ_ENABLE_PROFILER_SPS=
1615 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1616 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1619 dnl ========================================================
1621 dnl ========================================================
1622 MOZ_ARG_ENABLE_BOOL(shark,
1623 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1626 if test -n "$MOZ_SHARK"; then
1628 AC_DEFINE(MOZ_SHARK)
1631 dnl ========================================================
1633 dnl ========================================================
1634 MOZ_ARG_ENABLE_BOOL(instruments,
1635 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
1638 if test -n "$MOZ_INSTRUMENTS"; then
1640 AC_DEFINE(MOZ_INSTRUMENTS)
1643 dnl ========================================================
1645 dnl ========================================================
1646 MOZ_ARG_ENABLE_BOOL(callgrind,
1647 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1650 if test -n "$MOZ_CALLGRIND"; then
1652 AC_DEFINE(MOZ_CALLGRIND)
1655 dnl ========================================================
1657 dnl ========================================================
1658 MOZ_ARG_ENABLE_BOOL(vtune,
1659 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1662 if test -n "$MOZ_VTUNE"; then
1664 AC_DEFINE(MOZ_VTUNE)
1667 dnl ========================================================
1669 dnl ========================================================
1670 if test -n "$MOZ_PROFILING"; then
1671 AC_DEFINE(MOZ_PROFILING)
1674 dnl ========================================================
1675 dnl System overrides of the defaults for host
1676 dnl ========================================================
1679 if test -n "$_WIN32_MSVC"; then
1681 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1682 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1683 HOST_RANLIB='echo ranlib'
1685 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1687 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1688 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1689 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1690 HOST_BIN_SUFFIX=.exe
1693 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1697 case "${host_cpu}" in
1699 if test -n "$_WIN32_MSVC"; then
1700 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1704 if test -n "$_WIN32_MSVC"; then
1705 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1707 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1713 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1714 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1715 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1718 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1719 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1720 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1721 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1725 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1726 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1727 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1728 HOST_BIN_SUFFIX=.exe
1733 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1734 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1738 dnl Check for using a custom <inttypes.h> implementation
1739 dnl ========================================================
1740 AC_MSG_CHECKING(for custom <inttypes.h> implementation)
1741 if test "$MOZ_CUSTOM_INTTYPES_H"; then
1742 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
1743 AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
1745 AC_MSG_RESULT(none specified)
1748 dnl Get mozilla version from central milestone file
1749 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1750 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1752 dnl Get version of various core apps from the version files.
1753 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1755 if test -z "$FIREFOX_VERSION"; then
1756 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1759 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1760 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1761 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1763 MOZ_DOING_LTO(lto_is_enabled)
1765 dnl ========================================================
1766 dnl System overrides of the defaults for target
1767 dnl ========================================================
1772 if test ! "$GNU_CC"; then
1773 if test ! "$HAVE_64BIT_OS"; then
1774 # Compiling with Visual Age C++ object model compat is the
1775 # default. To compile with object model ibm, add
1776 # AIX_OBJMODEL=ibm to .mozconfig.
1777 if test "$AIX_OBJMODEL" = "ibm"; then
1778 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1785 AC_SUBST(AIX_OBJMODEL)
1786 DSO_LDOPTS='-qmkshrobj=1'
1787 DSO_CFLAGS='-qflag=w:w'
1789 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1791 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1792 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1793 if test "$COMPILE_ENVIRONMENT"; then
1796 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1798 [#if (__IBMCPP__ < 900)
1799 #error "Bad compiler"
1801 _BAD_COMPILER=,_BAD_COMPILER=1)
1802 if test -n "$_BAD_COMPILER"; then
1804 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1806 AC_MSG_RESULT([yes])
1809 TARGET_COMPILER_ABI="ibmc"
1810 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1811 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1814 case "${target_os}" in
1819 if test "$COMPILE_ENVIRONMENT"; then
1820 MOZ_CHECK_HEADERS(sys/inttypes.h)
1822 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1826 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1827 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1828 MOZ_OPTIMIZE_FLAGS="-O3"
1829 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1830 if test "$HAVE_64BIT_OS"; then
1835 STRIP_FLAGS="$STRIP_FLAGS -x -S"
1836 # Check whether we're targeting OS X or iOS
1837 AC_CACHE_CHECK(for iOS target,
1839 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1840 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1844 ac_cv_ios_target="yes",
1845 ac_cv_ios_target="no")])
1846 if test "$ac_cv_ios_target" = "yes"; then
1848 AC_DEFINE(XP_DARWIN)
1849 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1851 AC_DEFINE(XP_MACOSX)
1852 AC_DEFINE(XP_DARWIN)
1853 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1854 # The ExceptionHandling framework is needed for Objective-C exception
1855 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1857 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1859 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1862 if test "x$lto_is_enabled" = "xyes"; then
1863 echo "Skipping -dead_strip because lto is enabled."
1864 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1865 dnl ===================================================================
1866 elif test "x$enable_dtrace" = "xyes"; then
1867 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1869 dnl check for the presence of the -dead_strip linker flag
1870 AC_MSG_CHECKING([for -dead_strip option to ld])
1871 _SAVE_LDFLAGS=$LDFLAGS
1872 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1873 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1874 if test -n "$_HAVE_DEAD_STRIP" ; then
1875 AC_MSG_RESULT([yes])
1876 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1881 LDFLAGS=$_SAVE_LDFLAGS
1884 dnl With newer linkers we need to pass -allow_heap_execute because of
1885 dnl Microsoft Silverlight (5.1.10411.0 at least).
1886 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1887 _SAVE_LDFLAGS=$LDFLAGS
1888 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1889 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1890 _HAVE_ALLOW_HEAP_EXECUTE=)
1891 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1892 AC_MSG_RESULT([yes])
1893 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1897 LDFLAGS=$_SAVE_LDFLAGS
1899 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1904 if test ! "$GNU_CC"; then
1908 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1909 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1910 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1913 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1914 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1917 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1918 AC_DEFINE(_LARGEFILE64_SOURCE)
1923 if test ! "$GNU_CC"; then
1924 DSO_LDOPTS='-b -Wl,+s'
1927 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1928 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1929 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1931 DSO_LDOPTS='-b -E +s'
1932 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1933 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1935 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1936 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1939 *-android*|*-linuxandroid*)
1940 AC_DEFINE(NO_PW_GECOS)
1942 if test -n "$gonkdir"; then
1943 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
1948 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
1951 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1953 MOZ_GFX_OPTIMIZE_MOBILE=1
1954 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
1958 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
1959 # Similarly for GNU_CXX and INTEL_CXX.
1960 if test "$INTEL_CC" -o "$INTEL_CXX"; then
1961 # -Os has been broken on Intel's C/C++ compilers for quite a
1962 # while; Intel recommends against using it.
1963 MOZ_OPTIMIZE_FLAGS="-O2"
1964 elif test "$GNU_CC" -o "$GNU_CXX"; then
1965 case $GCC_VERSION in
1967 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
1968 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1970 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
1971 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
1974 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1978 case "${target_cpu}" in
1980 CFLAGS="$CFLAGS -mieee"
1981 CXXFLAGS="$CXXFLAGS -mieee"
1988 if test -z "$MC"; then
1998 # certain versions of cygwin's makedepend barf on the
1999 # #include <string> vs -I./dist/include/string issue so don't use it
2000 XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)'
2001 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
2003 CXX="$CXX -mwindows"
2004 CPP="$CPP -mwindows"
2005 CFLAGS="$CFLAGS -mms-bitfields"
2006 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2007 DSO_LDOPTS='-shared'
2008 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2009 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2011 # Use static libgcc and libstdc++
2012 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
2013 NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
2014 # Use temp file for windres (bug 213281)
2015 RCFLAGS='-O coff --use-temp-file'
2016 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2017 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2020 IMPORT_LIB_SUFFIX=dll.a
2022 # We use mix of both POSIX and Win32 printf format across the tree, so format
2023 # warnings are useless on mingw.
2024 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2025 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2027 TARGET_COMPILER_ABI=msvc
2031 if test "$AS_BIN"; then
2032 AS="$(basename "$AS_BIN")"
2035 AR_FLAGS='-NOLOGO -OUT:"$@"'
2037 RANLIB='echo not_ranlib'
2038 STRIP='echo not_strip'
2049 IMPORT_LIB_SUFFIX=lib
2050 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2051 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2053 MKSHLIB_UNFORCE_ALL=
2054 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2055 _USE_CPP_INCLUDE_FLAG=1
2056 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2057 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2058 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2059 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2060 if test "$_CC_SUITE" -ge "12"; then
2061 dnl VS2013+ requires -FS when parallel building by make -jN.
2062 dnl If nothing, compiler sometimes causes C1041 error.
2063 CFLAGS="$CFLAGS -FS"
2064 CXXFLAGS="$CXXFLAGS -FS"
2066 # khuey says we can safely ignore MSVC warning C4251
2067 # MSVC warning C4244 (implicit type conversion may lose data) warns
2068 # and requires workarounds for perfectly valid code. Also, GCC/clang
2069 # don't warn about it by default. So for consistency/sanity, we turn
2070 # it off on MSVC, too.
2071 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2072 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2073 # MSVC warning C4482 warns when an enum value is refered specifing the
2074 # name of the enum itself. This behavior is allowed in C++11, and the
2075 # warning has been removed in VS2012.
2076 # MSVC warning C4800 warns when a value is implicitly cast to bool,
2077 # because this also forces narrowing to a single byte, which can be a
2078 # perf hit. But this matters so little in practice (and often we want
2079 # that behavior) that it's better to turn it off.
2080 # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2081 # on non-Western system locales even if it is in a comment.
2082 CFLAGS="$CFLAGS -wd4244 -wd4819"
2083 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2084 # make 'foo == bar;' error out
2085 CFLAGS="$CFLAGS -we4553"
2086 CXXFLAGS="$CXXFLAGS -we4553"
2087 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2088 MOZ_DEBUG_FLAGS='-Zi'
2089 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2090 WARNINGS_AS_ERRORS='-WX'
2091 MOZ_OPTIMIZE_FLAGS='-O1'
2093 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2094 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2095 if test -z "$DEVELOPER_OPTIONS"; then
2096 LDFLAGS="$LDFLAGS -RELEASE"
2098 dnl For profile-guided optimization
2099 PROFILE_GEN_CFLAGS="-GL"
2100 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2101 dnl XXX: PGO builds can fail with warnings treated as errors,
2102 dnl specifically "no profile data available" appears to be
2103 dnl treated as an error sometimes. This might be a consequence
2104 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2105 dnl with the linker doing most of the work in the whole-program
2106 dnl optimization/PGO case. I think it's probably a compiler bug,
2107 dnl but we work around it here.
2108 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2109 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2110 dnl Probably also a compiler bug, but what can you do?
2111 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2112 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2113 dnl Minimum reqiurement of Gecko is VS2010 or later which supports
2114 dnl both SSSE3 and SSE4.1.
2115 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2116 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
2118 AC_DEFINE(HAVE_SNPRINTF)
2123 AC_DEFINE(HW_THREADS)
2124 AC_DEFINE(STDC_HEADERS)
2125 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2126 TARGET_MD_ARCH=win32
2127 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2129 MOZ_USER_DIR="Mozilla"
2131 dnl Hardcode to win95 for now - cls
2132 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2134 dnl set NO_X11 defines here as the general check is skipped on win32
2140 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2141 if test -n "$L10NBASEDIR"; then
2142 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2149 if test -z "$MOZ_TOOLS"; then
2150 AC_MSG_ERROR([MOZ_TOOLS is not set])
2152 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2153 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2154 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2156 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2157 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2158 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2165 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.])
2171 if test "$HAVE_64BIT_OS"; then
2172 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2175 if test -n "$GNU_CC"; then
2176 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2177 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2178 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2180 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2181 LDFLAGS="$LDFLAGS -SAFESEH"
2187 if test -n "$_WIN32_MSVC"; then
2188 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2193 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2200 CFLAGS="$CFLAGS -Dunix"
2201 CXXFLAGS="$CXXFLAGS -Dunix"
2202 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2204 DSO_PIC_CFLAGS='-fPIC -DPIC'
2205 DSO_LDOPTS='-shared'
2206 BIN_FLAGS='-Wl,--export-dynamic'
2208 DSO_PIC_CFLAGS='-fPIC -DPIC'
2209 DLL_SUFFIX=".so.1.0"
2210 DSO_LDOPTS='-shared'
2212 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2213 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2214 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2215 if test "$LIBRUNPATH"; then
2216 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2218 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
2219 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@)) -o $@'
2223 if test "$SO_VERSION"; then
2224 DLL_SUFFIX=".so.$SO_VERSION"
2226 DLL_SUFFIX=".so.1.0"
2228 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2230 DSO_PIC_CFLAGS='-fPIC'
2231 DSO_LDOPTS='-shared -fPIC'
2232 if test "$LIBRUNPATH"; then
2233 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2238 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2239 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2242 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2243 AC_DEFINE(TCPV40HDRS)
2249 IMPORT_LIB_SUFFIX=lib
2253 CFLAGS="$CFLAGS -Zomf"
2254 CXXFLAGS="$CXXFLAGS -Zomf"
2256 BIN_FLAGS='-Zlinker /ST:0x100000'
2260 WARNINGS_AS_ERRORS='-Werror'
2261 MOZ_DEBUG_FLAGS="-g -fno-inline"
2262 MOZ_OPTIMIZE_FLAGS="-O2"
2263 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2264 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2266 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2270 MOZ_USER_DIR="Mozilla"
2273 STRIP_FLAGS="/yua /ydd /yxd /ynl /anp /b- /cs+ /d /i- /ml1 /mr2 /mf2 /r+ /u+ /x- /zs:0 /zx /zd"
2275 if test "$MOZTOOLS"; then
2276 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2278 AC_MSG_ERROR([MOZTOOLS is not set])
2280 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2281 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2282 LDFLAGS="$LDFLAGS -Zhigh-mem"
2283 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2284 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2287 # GCC for OS/2 currently predefines these, but we don't want them
2288 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2289 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2291 AC_CACHE_CHECK(for __declspec(dllexport),
2293 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2295 ac_os2_declspec="yes",
2296 ac_os2_declspec="no")])
2297 if test "$ac_os2_declspec" != "yes"; then
2298 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2304 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2306 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2307 # libraries one level up (e.g. libnspr4.so)
2308 if test "$SOLARIS_SUNPRO_CC"; then
2309 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2310 LIBS="-lCrun -lCstd -lc $LIBS"
2311 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2312 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2313 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2314 LDFLAGS="-xildoff $LDFLAGS"
2315 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2316 _SAVE_LDFLAGS=$LDFLAGS
2317 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2318 AC_TRY_LINK([#include <stdio.h>],
2319 [printf("Hello World\n");],
2321 [LDFLAGS=$_SAVE_LDFLAGS])
2323 MOZ_OPTIMIZE_FLAGS="-xO4"
2324 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2325 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2326 MKSHLIB_FORCE_ALL='-z allextract'
2327 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2334 AS='/usr/ccs/bin/as'
2335 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2337 TARGET_COMPILER_ABI="sunc"
2338 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2339 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2340 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2344 [#if (__SUNPRO_CC < 0x590)
2347 _BAD_COMPILER=,_BAD_COMPILER=1)
2348 if test -n "$_BAD_COMPILER"; then
2350 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2355 [#if (__SUNPRO_CC >= 0x5100)
2356 #error "Sun C++ 5.10 or above"
2358 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2359 if test "$_ABOVE_SS12U1"; then
2361 CXXFLAGS="$CXXFLAGS -xannotate=no"
2363 AC_MSG_RESULT([$_res])
2366 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2368 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2369 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2370 ASFLAGS="$ASFLAGS -fPIC"
2371 DSO_LDOPTS='-shared'
2372 WARNINGS_AS_ERRORS='-Werror'
2374 _WARNINGS_CXXFLAGS=''
2375 if test "$OS_RELEASE" = "5.3"; then
2376 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2379 if test "$OS_RELEASE" = "5.5.1"; then
2380 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2385 DSO_LDOPTS='-Bdynamic'
2386 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2387 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2389 AC_DEFINE(SPRINTF_RETURNS_STRING)
2390 case "$(target_os)" in
2392 DLL_SUFFIX='.so.1.0'
2398 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2405 # Includes linux-android
2410 AC_SUBST(MOZ_LINKER)
2411 if test -n "$MOZ_LINKER"; then
2412 AC_DEFINE(MOZ_LINKER)
2415 dnl Only one oddball right now (QNX), but this gives us flexibility
2416 dnl if any other platforms need to override this in the future.
2417 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2419 dnl ========================================================
2420 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2421 dnl by now will not have any way to link most binaries (tests
2422 dnl as well as viewer, apprunner, etc.), because some symbols
2423 dnl will be left out of the "composite" .so's by ld as unneeded.
2424 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2425 dnl they can link in the static libs that provide the missing
2427 dnl ========================================================
2428 NO_LD_ARCHIVE_FLAGS=
2429 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2430 NO_LD_ARCHIVE_FLAGS=1
2434 NO_LD_ARCHIVE_FLAGS=
2437 NO_LD_ARCHIVE_FLAGS=
2440 if test -z "$GNU_CC"; then
2441 NO_LD_ARCHIVE_FLAGS=
2445 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2447 dnl ========================================================
2448 dnl = Flags to strip unused symbols from .so components and
2449 dnl = to export jemalloc symbols when linking a program
2450 dnl ========================================================
2452 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2453 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2456 if test -z "$GNU_CC"; then
2457 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2459 if test -z "$GCC_USE_GNU_LD"; then
2460 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2462 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2467 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2470 if test -n "$GNU_CC"; then
2471 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2476 if test -z "$COMPILE_ENVIRONMENT"; then
2477 SKIP_COMPILER_CHECKS=1
2478 SKIP_LIBRARY_CHECKS=1
2482 if test -z "$SKIP_COMPILER_CHECKS"; then
2483 dnl Checks for typedefs, structures, and compiler characteristics.
2484 dnl ========================================================
2493 AC_MSG_CHECKING(for ssize_t)
2494 AC_CACHE_VAL(ac_cv_type_ssize_t,
2495 [AC_TRY_COMPILE([#include <stdio.h>
2496 #include <sys/types.h>],
2498 [ac_cv_type_ssize_t=true],
2499 [ac_cv_type_ssize_t=false])])
2500 if test "$ac_cv_type_ssize_t" = true ; then
2501 AC_DEFINE(HAVE_SSIZE_T)
2506 AC_STRUCT_ST_BLKSIZE
2507 AC_MSG_CHECKING(for siginfo_t)
2508 AC_CACHE_VAL(ac_cv_siginfo_t,
2509 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2510 #include <signal.h>],
2512 [ac_cv_siginfo_t=true],
2513 [ac_cv_siginfo_t=false])])
2514 if test "$ac_cv_siginfo_t" = true ; then
2515 AC_DEFINE(HAVE_SIGINFO_T)
2527 dnl Check for .hidden assembler directive and visibility attribute.
2528 dnl Borrowed from glibc configure.in
2529 dnl ===============================================================
2530 if test "$GNU_CC"; then
2531 AC_CACHE_CHECK(for visibility(hidden) attribute,
2532 ac_cv_visibility_hidden,
2533 [cat > conftest.c <<EOF
2534 int foo __attribute__ ((visibility ("hidden"))) = 1;
2536 ac_cv_visibility_hidden=no
2537 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2538 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2539 ac_cv_visibility_hidden=yes
2544 if test "$ac_cv_visibility_hidden" = "yes"; then
2545 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2547 AC_CACHE_CHECK(for visibility(default) attribute,
2548 ac_cv_visibility_default,
2549 [cat > conftest.c <<EOF
2550 int foo __attribute__ ((visibility ("default"))) = 1;
2552 ac_cv_visibility_default=no
2553 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2554 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2555 ac_cv_visibility_default=yes
2560 if test "$ac_cv_visibility_default" = "yes"; then
2561 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2563 AC_CACHE_CHECK(for visibility pragma support,
2564 ac_cv_visibility_pragma,
2565 [cat > conftest.c <<EOF
2566 #pragma GCC visibility push(hidden)
2568 #pragma GCC visibility push(default)
2569 int foo_default = 1;
2571 ac_cv_visibility_pragma=no
2572 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2573 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2574 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2575 ac_cv_visibility_pragma=yes
2581 if test "$ac_cv_visibility_pragma" = "yes"; then
2582 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2583 ac_cv_have_visibility_class_bug,
2584 [cat > conftest.c <<EOF
2585 #pragma GCC visibility push(hidden)
2586 struct __attribute__ ((visibility ("default"))) TestStruct {
2589 __attribute__ ((visibility ("default"))) void TestFunc() {
2593 ac_cv_have_visibility_class_bug=no
2594 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2595 ac_cv_have_visibility_class_bug=yes
2597 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2598 ac_cv_have_visibility_class_bug=yes
2601 rm -rf conftest.{c,S}
2604 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2605 ac_cv_have_visibility_builtin_bug,
2606 [cat > conftest.c <<EOF
2607 #pragma GCC visibility push(hidden)
2608 #pragma GCC visibility push(default)
2610 #pragma GCC visibility pop
2612 __attribute__ ((visibility ("default"))) void Func() {
2614 memset(c, 0, sizeof(c));
2617 ac_cv_have_visibility_builtin_bug=no
2618 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2619 ac_cv_have_visibility_builtin_bug=yes
2621 if test `grep -c "@PLT" conftest.S` = 0; then
2622 ac_cv_visibility_builtin_bug=yes
2625 rm -f conftest.{c,S}
2627 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2628 "$ac_cv_have_visibility_class_bug" = "no"; then
2629 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2630 WRAP_SYSTEM_INCLUDES=1
2631 STL_FLAGS='-I$(DIST)/stl_wrappers'
2634 VISIBILITY_FLAGS='-fvisibility=hidden'
2635 fi # have visibility pragma bug
2636 fi # have visibility pragma
2637 fi # have visibility(default) attribute
2638 fi # have visibility(hidden) attribute
2641 # visibility hidden flag for Sun Studio on Solaris
2642 if test "$SOLARIS_SUNPRO_CC"; then
2643 VISIBILITY_FLAGS='-xldscope=hidden'
2644 fi # Sun Studio on Solaris
2646 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2647 AC_SUBST(VISIBILITY_FLAGS)
2651 if test "$OS_TARGET" != WINNT; then
2652 # Only run this test with clang on non-Windows platforms, because clang
2653 # cannot do enough code gen for now to make this test work correctly.
2657 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2658 dnl ========================================================
2659 if test "$GNU_CC"; then
2660 CFLAGS_save="${CFLAGS}"
2661 CFLAGS="${CFLAGS} -Werror"
2662 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2663 ac_cv_force_align_arg_pointer,
2664 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2666 ac_cv_force_align_arg_pointer="yes",
2667 ac_cv_force_align_arg_pointer="no")])
2668 CFLAGS="${CFLAGS_save}"
2669 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2670 HAVE_GCC_ALIGN_ARG_POINTER=1
2672 HAVE_GCC_ALIGN_ARG_POINTER=
2675 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2677 dnl Checks for header files.
2678 dnl ========================================================
2680 case "$target_os" in
2682 # for stuff like -lXshm
2683 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2686 MOZ_CHECK_COMMON_HEADERS
2688 dnl These are all the places some variant of statfs can be hiding.
2689 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2692 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2693 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2695 dnl SCTP support - needs various network include headers
2696 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2698 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2700 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2701 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2702 ac_cv_sockaddr_in_sin_len,
2703 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2704 #include <sys/types.h>
2706 #include <netinet/in.h>
2707 struct sockaddr_in x;
2708 void *foo = (void*) &x.sin_len;],
2710 [ac_cv_sockaddr_in_sin_len=true],
2711 [ac_cv_sockaddr_in_sin_len=false])])
2712 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2713 AC_DEFINE(HAVE_SIN_LEN)
2714 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2715 AC_DEFINE(HAVE_SCONN_LEN)
2718 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2719 ac_cv_sockaddr_in6_sin6_len,
2720 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2721 #include <sys/types.h>
2723 #include <netinet/in.h>
2724 struct sockaddr_in6 x;
2725 void *foo = (void*) &x.sin6_len;],
2727 [ac_cv_sockaddr_in6_sin6_len=true],
2728 [ac_cv_sockaddr_in6_sin6_len=false])])
2729 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2730 AC_DEFINE(HAVE_SIN6_LEN)
2733 AC_CACHE_CHECK(for sockaddr.sa_len,
2734 ac_cv_sockaddr_sa_len,
2735 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2736 #include <sys/types.h>
2738 #include <sys/socket.h>
2740 void *foo = (void*) &x.sa_len;],
2742 [ac_cv_sockaddr_sa_len=true],
2743 [ac_cv_sockaddr_sa_len=false])])
2744 if test "$ac_cv_sockaddr_sa_len" = true ; then
2745 AC_DEFINE(HAVE_SA_LEN)
2748 AC_ARG_ENABLE(dtrace,
2749 [ --enable-dtrace build with dtrace support if available (default=no)],
2750 [enable_dtrace="yes"],)
2751 if test "x$enable_dtrace" = "xyes"; then
2752 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2753 if test -n "$HAVE_DTRACE"; then
2754 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2756 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2759 AC_SUBST(HAVE_DTRACE)
2765 MOZ_CHECK_HEADERS(sys/cdefs.h)
2769 MOZ_LINUX_PERF_EVENT
2771 dnl Checks for libraries.
2772 dnl ========================================================
2777 AC_CHECK_LIB(c_r, gethostbyname_r)
2781 dnl We don't want to link with libdl even if it's present on OS X, since
2782 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2784 dnl We don't want to link against libm or libpthread on Darwin since
2785 dnl they both are just symlinks to libSystem and explicitly linking
2786 dnl against libSystem causes issues when debugging (see bug 299601).
2793 AC_SEARCH_LIBS(dlopen, dl,
2794 MOZ_CHECK_HEADER(dlfcn.h,
2795 AC_DEFINE(HAVE_DLOPEN)))
2799 _SAVE_CFLAGS="$CFLAGS"
2800 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2801 AC_CHECK_FUNCS(dladdr memmem)
2802 CFLAGS="$_SAVE_CFLAGS"
2804 if test ! "$GNU_CXX"; then
2808 AC_CHECK_LIB(C_r, demangle)
2811 AC_CHECK_LIB(C, demangle)
2816 dnl OS/2 has socket in libc.
2821 AC_CHECK_LIB(socket, socket)
2825 XLIBS="$X_EXTRA_LIBS"
2827 dnl ========================================================
2828 dnl Checks for X libraries.
2829 dnl Ordering is important.
2830 dnl Xt is dependent upon SM as of X11R6
2831 dnl ========================================================
2832 if test "$no_x" = "yes"; then
2835 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2836 XLIBS="-lX11 $XLIBS"
2837 _SAVE_LDFLAGS="$LDFLAGS"
2838 LDFLAGS="$XLDFLAGS $LDFLAGS"
2839 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2840 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2841 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2842 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2844 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2845 unset ac_cv_lib_Xt_XtFree
2846 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2847 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
2848 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2849 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2852 # AIX needs the motif library linked before libXt to prevent
2853 # crashes in plugins linked against Motif - Bug #98892
2854 case "${target_os}" in
2856 XT_LIBS="-lXm $XT_LIBS"
2860 dnl ========================================================
2861 dnl = Check for XShm
2862 dnl ========================================================
2863 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
2866 dnl ========================================================
2868 dnl ========================================================
2869 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
2870 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
2871 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
2872 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
2874 LDFLAGS="$_SAVE_LDFLAGS"
2884 dnl ========================================================
2885 dnl = pthread support
2886 dnl = Start by checking whether the system support pthreads
2887 dnl ========================================================
2888 case "$target_os" in
2893 MOZ_CHECK_PTHREADS(pthreads,
2894 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2895 MOZ_CHECK_PTHREADS(pthread,
2896 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2897 MOZ_CHECK_PTHREADS(c_r,
2898 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2899 MOZ_CHECK_PTHREADS(c,
2908 dnl ========================================================
2909 dnl Check the command line for --with-pthreads
2910 dnl ========================================================
2911 MOZ_ARG_WITH_BOOL(pthreads,
2912 [ --with-pthreads Force use of system pthread library with NSPR ],
2913 [ if test "$MOZ_USE_PTHREADS"x = x; then
2914 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2920 dnl ========================================================
2921 dnl Do the platform specific pthread hackery
2922 dnl ========================================================
2923 if test "$MOZ_USE_PTHREADS"x != x
2926 dnl See if -pthread is supported.
2929 ac_cv_have_dash_pthread=no
2930 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2931 echo 'int main() { return 0; }' | cat > conftest.c
2932 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2933 if test $? -eq 0; then
2934 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2935 ac_cv_have_dash_pthread=yes
2936 case "$target_os" in
2938 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2941 CFLAGS="$CFLAGS -pthread"
2942 CXXFLAGS="$CXXFLAGS -pthread"
2948 AC_MSG_RESULT($ac_cv_have_dash_pthread)
2951 dnl See if -pthreads is supported.
2953 ac_cv_have_dash_pthreads=no
2954 if test "$ac_cv_have_dash_pthread" = "no"; then
2955 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2956 echo 'int main() { return 0; }' | cat > conftest.c
2957 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2958 if test $? -eq 0; then
2959 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2960 ac_cv_have_dash_pthreads=yes
2961 CFLAGS="$CFLAGS -pthreads"
2962 CXXFLAGS="$CXXFLAGS -pthreads"
2966 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2971 AC_DEFINE(_REENTRANT)
2972 AC_DEFINE(_THREAD_SAFE)
2973 dnl -pthread links in -lpthread, so don't specify it explicitly.
2974 if test "$ac_cv_have_dash_pthread" = "yes"; then
2975 _PTHREAD_LDFLAGS="-pthread"
2979 *-*-openbsd*|*-*-bsdi*)
2980 AC_DEFINE(_REENTRANT)
2981 AC_DEFINE(_THREAD_SAFE)
2982 dnl -pthread links in -lc_r, so don't specify it explicitly.
2983 if test "$ac_cv_have_dash_pthread" = "yes"; then
2984 _PTHREAD_LDFLAGS="-pthread"
2988 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
2989 AC_DEFINE(_REENTRANT)
2993 AC_DEFINE(_REENTRANT)
2997 AC_DEFINE(_REENTRANT)
3001 AC_DEFINE(_REENTRANT)
3002 if test "$SOLARIS_SUNPRO_CC"; then
3003 CFLAGS="$CFLAGS -mt"
3004 CXXFLAGS="$CXXFLAGS -mt"
3008 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3009 AC_SUBST(MOZ_USE_PTHREADS)
3013 dnl Checks for library functions.
3014 dnl ========================================================
3015 AC_PROG_GCC_TRADITIONAL
3017 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf memmove stat64 lstat64 truncate64 setbuf isatty)
3018 AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
3019 AC_CHECK_FUNCS(flockfile getpagesize)
3020 AC_CHECK_FUNCS(localtime_r strtok_r)
3022 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3023 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3024 ac_cv_clock_monotonic,
3025 [for libs in "" -lrt; do
3028 AC_TRY_LINK([#include <time.h>],
3029 [ struct timespec ts;
3030 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3031 ac_cv_clock_monotonic=$libs
3034 ac_cv_clock_monotonic=no)
3037 if test "$ac_cv_clock_monotonic" != "no"; then
3038 HAVE_CLOCK_MONOTONIC=1
3039 REALTIME_LIBS=$ac_cv_clock_monotonic
3040 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3041 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3042 AC_SUBST(REALTIME_LIBS)
3045 dnl check for wcrtomb/mbrtowc
3046 dnl =======================================================================
3047 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3050 AC_CACHE_CHECK(for wcrtomb,
3052 [AC_TRY_LINK([#include <wchar.h>],
3053 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3054 ac_cv_have_wcrtomb="yes",
3055 ac_cv_have_wcrtomb="no")])
3056 if test "$ac_cv_have_wcrtomb" = "yes"; then
3057 AC_DEFINE(HAVE_WCRTOMB)
3059 AC_CACHE_CHECK(for mbrtowc,
3061 [AC_TRY_LINK([#include <wchar.h>],
3062 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3063 ac_cv_have_mbrtowc="yes",
3064 ac_cv_have_mbrtowc="no")])
3065 if test "$ac_cv_have_mbrtowc" = "yes"; then
3066 AC_DEFINE(HAVE_MBRTOWC)
3073 ac_cv_func_res_ninit,
3076 #define _BSD_SOURCE 1
3080 [int foo = res_ninit(&_res);],
3081 [ac_cv_func_res_ninit=yes],
3082 [ac_cv_func_res_ninit=no])
3085 if test "$ac_cv_func_res_ninit" = "yes"; then
3086 AC_DEFINE(HAVE_RES_NINIT)
3087 dnl must add the link line we do something as foolish as this... dougt
3089 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3090 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3096 darwin*|mingw*|os2*)
3100 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3101 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3102 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3104 LIBS="$LIBS $_ICONV_LIBS"
3113 iconv_t h = iconv_open("", "");
3114 iconv(h, NULL, NULL, NULL, NULL);
3117 [ac_cv_func_iconv=yes],
3118 [ac_cv_func_iconv=no]
3121 if test "$ac_cv_func_iconv" = "yes"; then
3122 AC_DEFINE(HAVE_ICONV)
3123 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3124 LIBICONV="$_ICONV_LIBS"
3126 [for iconv() with const input],
3127 ac_cv_func_const_iconv,
3133 const char *input = "testing";
3134 iconv_t h = iconv_open("", "");
3135 iconv(h, &input, NULL, NULL, NULL);
3138 [ac_cv_func_const_iconv=yes],
3139 [ac_cv_func_const_iconv=no]
3142 if test "$ac_cv_func_const_iconv" = "yes"; then
3143 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3155 dnl **********************
3156 dnl *** va_copy checks ***
3157 dnl **********************
3158 dnl we currently check for all three va_copy possibilities, so we get
3159 dnl all results in config.log for bug reports.
3160 AC_MSG_CHECKING(for an implementation of va_copy())
3161 AC_CACHE_VAL(ac_cv_va_copy,[
3164 void f (int i, ...) {
3165 va_list args1, args2;
3166 va_start (args1, i);
3167 va_copy (args2, args1);
3168 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3170 va_end (args1); va_end (args2);
3172 int main() { f (0, 42); return 0; }],
3178 AC_MSG_RESULT($ac_cv_va_copy)
3179 AC_MSG_CHECKING(for an implementation of __va_copy())
3180 AC_CACHE_VAL(ac_cv___va_copy,[
3183 void f (int i, ...) {
3184 va_list args1, args2;
3185 va_start (args1, i);
3186 __va_copy (args2, args1);
3187 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3189 va_end (args1); va_end (args2);
3191 int main() { f (0, 42); return 0; }],
3192 ac_cv___va_copy=yes,
3197 AC_MSG_RESULT($ac_cv___va_copy)
3198 AC_MSG_CHECKING(whether va_lists can be copied by value)
3199 AC_CACHE_VAL(ac_cv_va_val_copy,[
3202 void f (int i, ...) {
3203 va_list args1, args2;
3204 va_start (args1, i);
3206 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3208 va_end (args1); va_end (args2);
3210 int main() { f (0, 42); return 0; }],
3211 ac_cv_va_val_copy=yes,
3212 ac_cv_va_val_copy=no,
3213 ac_cv_va_val_copy=yes
3216 if test "x$ac_cv_va_copy" = "xyes"; then
3217 AC_DEFINE(VA_COPY, va_copy)
3218 AC_DEFINE(HAVE_VA_COPY)
3219 elif test "x$ac_cv___va_copy" = "xyes"; then
3220 AC_DEFINE(VA_COPY, __va_copy)
3221 AC_DEFINE(HAVE_VA_COPY)
3224 if test "x$ac_cv_va_val_copy" = "xno"; then
3225 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3227 AC_MSG_RESULT($ac_cv_va_val_copy)
3229 dnl ===================================================================
3230 dnl ========================================================
3231 dnl Put your C++ language/feature checks below
3232 dnl ========================================================
3236 if test "$GNU_CC"; then
3237 if test "$CPU_ARCH" = "arm" ; then
3238 AC_CACHE_CHECK(for ARM EABI,
3242 #if defined(__ARM_EABI__)
3245 #error Not ARM EABI.
3248 ac_cv_gcc_arm_eabi="yes",
3249 ac_cv_gcc_arm_eabi="no")])
3250 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3252 ARM_ABI_PREFIX=eabi-
3254 ARM_ABI_PREFIX=oabi-
3258 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3261 dnl Check to see if we can resolve ambiguity with |using|.
3262 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3263 ac_cv_cpp_ambiguity_resolving_using,
3264 [AC_TRY_COMPILE(class X {
3265 public: int go(const X&) {return 3;}
3266 int jo(const X&) {return 3;}
3268 class Y : public X {
3269 public: int go(int) {return 2;}
3270 int jo(int) {return 2;}
3272 private: using X::go;
3275 ac_cv_cpp_ambiguity_resolving_using=yes,
3276 ac_cv_cpp_ambiguity_resolving_using=no)])
3277 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3278 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3281 dnl See if a dynamic_cast to void* gives the most derived object.
3282 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3283 ac_cv_cpp_dynamic_cast_void_ptr,
3284 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3285 class Y { int j; public: virtual ~Y() { } };
3286 class Z : public X, public Y { int k; };
3292 return !((((void*)&mdo != (void*)subx) &&
3293 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3294 (((void*)&mdo != (void*)suby) &&
3295 ((void*)&mdo == dynamic_cast<void*>(suby))));
3297 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3298 ac_cv_cpp_dynamic_cast_void_ptr=no,
3299 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3300 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3301 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3305 dnl note that this one is reversed - if the test fails, then
3306 dnl we require implementations of unused virtual methods. Which
3307 dnl really blows because it means we'll have useless vtable
3309 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3310 ac_cv_cpp_unused_required,
3311 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3313 ac_cv_cpp_unused_required=no,
3314 ac_cv_cpp_unused_required=yes)])
3315 if test "$ac_cv_cpp_unused_required" = yes ; then
3316 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3320 dnl Some compilers have trouble comparing a constant reference to a templatized
3321 dnl class to zero, and require an explicit operator==() to be defined that takes
3322 dnl an int. This test separates the strong from the weak.
3324 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3325 ac_cv_trouble_comparing_to_zero,
3326 [AC_TRY_COMPILE([#include <algorithm>
3327 template <class T> class Foo {};
3329 template <class T> int operator==(const T2*, const T&) { return 0; }
3330 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3331 [Foo<int> f; return (0 != f);],
3332 ac_cv_trouble_comparing_to_zero=no,
3333 ac_cv_trouble_comparing_to_zero=yes)])
3334 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3335 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3338 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3339 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3340 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3342 _SAVE_LDFLAGS=$LDFLAGS
3343 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3344 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3345 ac_cv_thread_keyword,
3346 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3347 [return tlsIsMainThread;],
3348 ac_cv_thread_keyword=yes,
3349 ac_cv_thread_keyword=no)])
3350 LDFLAGS=$_SAVE_LDFLAGS
3351 # The custom dynamic linker doesn't support TLS variables
3353 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3354 # mips builds fail with TLS variables because of a binutils bug.
3356 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3361 *-android*|*-linuxandroid*)
3368 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3374 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3375 if test -n "$MOZ_LINKER"; then
3376 if test "$CPU_ARCH" = arm; then
3377 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3378 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3379 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3380 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3385 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3386 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3387 dnl We however want to avoid these text relocations, and this can be done
3388 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3389 dnl doesn't contain anything at all, beside placeholders for some sections,
3390 dnl and crtbegin only contains a finalizer function that calls
3391 dnl __cxa_finalize. The custom linker actually takes care of calling
3392 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3393 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3394 dnl link crtbegin and crtend at all.
3395 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3396 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3397 ac_cv_crt_has_text_relocations,
3398 [echo 'int foo() { return 0; }' > conftest.cpp
3399 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3400 test -s conftest${DLL_SUFFIX}; then
3401 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3402 ac_cv_crt_has_text_relocations=yes
3404 ac_cv_crt_has_text_relocations=no
3407 AC_ERROR([couldn't compile a simple C file])
3410 if test "$ac_cv_crt_has_text_relocations" = yes; then
3411 dnl While we want libraries to skip the CRT files, we don't want
3412 dnl executables to be treated the same way. We thus set the flag
3413 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3414 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3415 dnl Using LDFLAGS in nspr is safe, since we only really build
3416 dnl libraries there.
3417 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3418 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3422 dnl Check for the existence of various allocation headers/functions
3424 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3427 for file in $MALLOC_HEADERS; do
3428 MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3429 if test "$MALLOC_H" != ""; then
3430 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3435 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3437 AC_CHECK_FUNCS(malloc_usable_size)
3439 dnl See if compiler supports some gcc-style attributes
3441 AC_CACHE_CHECK(for __attribute__((always_inline)),
3442 ac_cv_attribute_always_inline,
3443 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3445 ac_cv_attribute_always_inline=yes,
3446 ac_cv_attribute_always_inline=no)])
3448 AC_CACHE_CHECK(for __attribute__((malloc)),
3449 ac_cv_attribute_malloc,
3450 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3452 ac_cv_attribute_malloc=yes,
3453 ac_cv_attribute_malloc=no)])
3455 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3456 ac_cv_attribute_warn_unused,
3457 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3459 ac_cv_attribute_warn_unused=yes,
3460 ac_cv_attribute_warn_unused=no)])
3462 dnl End of C++ language/feature checks
3465 dnl ========================================================
3466 dnl = Internationalization checks
3467 dnl ========================================================
3469 dnl Internationalization and Locale support is different
3470 dnl on various UNIX platforms. Checks for specific i18n
3471 dnl features go here.
3473 dnl check for LC_MESSAGES
3474 AC_CACHE_CHECK(for LC_MESSAGES,
3475 ac_cv_i18n_lc_messages,
3476 [AC_TRY_COMPILE([#include <locale.h>],
3477 [int category = LC_MESSAGES;],
3478 ac_cv_i18n_lc_messages=yes,
3479 ac_cv_i18n_lc_messages=no)])
3480 if test "$ac_cv_i18n_lc_messages" = yes; then
3481 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3484 AC_HAVE_FUNCS(localeconv)
3485 fi # ! SKIP_COMPILER_CHECKS
3488 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3489 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3492 dnl Mozilla specific options
3493 dnl ========================================================
3494 dnl The macros used for command line options
3495 dnl are defined in build/autoconf/altoptions.m4.
3497 dnl If the compiler supports these attributes, define them as
3498 dnl convenience macros.
3499 if test "$ac_cv_attribute_malloc" = yes ; then
3500 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3502 AC_DEFINE(NS_ATTR_MALLOC,)
3505 if test "$ac_cv_attribute_warn_unused" = yes ; then
3506 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3508 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3511 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3512 dnl features that Windows actually does support.
3514 if test -n "$SKIP_COMPILER_CHECKS"; then
3515 dnl Windows has malloc.h
3516 AC_DEFINE(MALLOC_H, [<malloc.h>])
3517 AC_DEFINE(HAVE_FORCEINLINE)
3518 AC_DEFINE(HAVE_LOCALECONV)
3519 fi # SKIP_COMPILER_CHECKS
3521 dnl ========================================================
3523 dnl = Check for external package dependencies
3525 dnl ========================================================
3526 MOZ_ARG_HEADER(External Packages)
3528 MOZ_ARG_WITH_STRING(libxul-sdk,
3529 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3530 LIBXUL_SDK_DIR=$withval)
3532 if test "$LIBXUL_SDK_DIR" = "yes"; then
3533 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3534 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3535 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3537 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3538 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3542 AC_SUBST(LIBXUL_SDK)
3544 if test -n "$LIBXUL_SDK"; then
3545 LIBXUL_DIST="$LIBXUL_SDK"
3547 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3549 AC_SUBST(LIBXUL_DIST)
3553 MOZ_ARG_WITH_BOOL(system-libxul,
3554 [ --with-system-libxul Use system installed libxul SDK],
3557 dnl ========================================================
3558 dnl = If NSPR was not detected in the system,
3559 dnl = use the one in the source tree (mozilla/nsprpub)
3560 dnl ========================================================
3561 MOZ_ARG_WITH_BOOL(system-nspr,
3562 [ --with-system-nspr Use system installed NSPR],
3563 _USE_SYSTEM_NSPR=1 )
3565 if test -n "$_USE_SYSTEM_NSPR"; then
3566 AM_PATH_NSPR(4.9.6, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
3569 if test -n "$MOZ_NATIVE_NSPR"; then
3570 _SAVE_CFLAGS=$CFLAGS
3571 CFLAGS="$CFLAGS $NSPR_CFLAGS"
3572 AC_TRY_COMPILE([#include "prtypes.h"],
3573 [#ifndef PR_STATIC_ASSERT
3574 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3576 [MOZ_NATIVE_NSPR=1],
3577 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3578 AC_TRY_COMPILE([#include "prtypes.h"],
3580 #error PR_UINT64 not defined or requires including prtypes.h
3582 [MOZ_NATIVE_NSPR=1],
3583 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3584 CFLAGS=$_SAVE_CFLAGS
3586 if test -z "$LIBXUL_SDK"; then
3587 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3588 if test -n "$GNU_CC"; then
3589 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3591 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3594 NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3595 NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3599 dnl set GRE_MILESTONE
3600 dnl ========================================================
3601 if test -n "$LIBXUL_SDK"; then
3602 GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3604 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3606 AC_SUBST(GRE_MILESTONE)
3608 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3609 # The logic works like this:
3610 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3611 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3612 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3613 case "$GRE_MILESTONE" in
3616 AC_DEFINE(NIGHTLY_BUILD)
3622 AC_DEFINE(RELEASE_BUILD)
3625 AC_SUBST(NIGHTLY_BUILD)
3626 AC_SUBST(RELEASE_BUILD)
3628 dnl system libevent Support
3629 dnl ========================================================
3630 MOZ_ARG_WITH_STRING(system-libevent,
3631 [ --with-system-libevent[=PFX]
3632 Use system libevent [installed at prefix PFX]],
3633 LIBEVENT_DIR=$withval)
3635 _SAVE_CFLAGS=$CFLAGS
3636 _SAVE_LDFLAGS=$LDFLAGS
3638 if test "$LIBEVENT_DIR" = yes; then
3639 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3640 MOZ_NATIVE_LIBEVENT=1,
3643 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3644 MOZ_NATIVE_LIBEVENT=
3645 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3646 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3647 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3648 MOZ_CHECK_HEADER(event.h,
3649 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3650 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3652 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3653 AC_CHECK_LIB(event, event_init,
3654 [MOZ_NATIVE_LIBEVENT=1
3655 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3656 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3657 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3659 CFLAGS=$_SAVE_CFLAGS
3660 LDFLAGS=$_SAVE_LDFLAGS
3663 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3664 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
3665 AC_SUBST(MOZ_LIBEVENT_LIBS)
3667 dnl ========================================================
3668 dnl = If NSS was not detected in the system,
3669 dnl = use the one in the source tree (mozilla/security/nss)
3670 dnl ========================================================
3672 MOZ_ARG_WITH_BOOL(system-nss,
3673 [ --with-system-nss Use system installed NSS],
3676 if test -n "$_USE_SYSTEM_NSS"; then
3677 AM_PATH_NSS(3.15, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3680 if test -n "$MOZ_NATIVE_NSS"; then
3681 NSS_LIBS="$NSS_LIBS -lcrmf"
3683 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3685 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
3687 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3688 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3689 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3690 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3691 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3693 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3697 dnl ======================
3699 dnl ======================
3701 AC_MSG_CHECKING([for YASM assembler])
3702 AC_CHECK_PROGS(YASM, yasm, "")
3704 if test -n "$YASM"; then
3705 dnl Pull out yasm's version string
3706 YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3707 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3708 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3709 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3710 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3713 if test -z "$SKIP_LIBRARY_CHECKS"; then
3714 dnl system JPEG support
3715 dnl ========================================================
3716 MOZ_ARG_WITH_STRING(system-jpeg,
3717 [ --with-system-jpeg[=PFX]
3718 Use system libjpeg [installed at prefix PFX]],
3721 _SAVE_CFLAGS=$CFLAGS
3722 _SAVE_LDFLAGS=$LDFLAGS
3724 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3725 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3726 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3728 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3731 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3734 if test "$MOZ_NATIVE_JPEG" = 1; then
3735 AC_TRY_COMPILE([ #include <stdio.h>
3736 #include <sys/types.h>
3737 #include <jpeglib.h> ],
3738 [ #if JPEG_LIB_VERSION < $MOZJPEG
3739 #error "Insufficient JPEG library version ($MOZJPEG required)."
3741 #ifndef JCS_EXTENSIONS
3742 #error "libjpeg-turbo JCS_EXTENSIONS required"
3746 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3748 CFLAGS=$_SAVE_CFLAGS
3749 LDFLAGS=$_SAVE_LDFLAGS
3752 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3753 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3754 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3756 fi # SKIP_LIBRARY_CHECKS
3758 dnl system ZLIB support
3759 dnl ========================================================
3760 MOZ_ZLIB_CHECK([1.2.3])
3762 if test "$MOZ_NATIVE_ZLIB" != 1; then
3764 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
3767 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
3768 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
3771 if test -z "$SKIP_LIBRARY_CHECKS"; then
3772 dnl system BZIP2 Support
3773 dnl ========================================================
3774 MOZ_ARG_WITH_STRING(system-bz2,
3775 [ --with-system-bz2[=PFX]
3776 Use system libbz2 [installed at prefix PFX]],
3779 _SAVE_CFLAGS=$CFLAGS
3780 _SAVE_LDFLAGS=$LDFLAGS
3782 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
3783 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
3784 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
3786 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
3789 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
3790 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
3792 CFLAGS=$_SAVE_CFLAGS
3793 LDFLAGS=$_SAVE_LDFLAGS
3796 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
3797 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
3798 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
3801 dnl system PNG Support
3802 dnl ========================================================
3803 MOZ_ARG_WITH_STRING(system-png,
3804 [ --with-system-png[=PFX]
3805 Use system libpng [installed at prefix PFX]],
3808 _SAVE_CFLAGS=$CFLAGS
3809 _SAVE_LDFLAGS=$LDFLAGS
3811 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
3812 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
3813 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
3815 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
3818 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
3819 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3820 AC_CHECK_LIB(png, png_get_acTL, ,
3821 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
3823 if test "$MOZ_NATIVE_PNG" = 1; then
3824 AC_TRY_COMPILE([ #include <stdio.h>
3825 #include <sys/types.h>
3827 [ #if PNG_LIBPNG_VER < $MOZPNG
3828 #error "Insufficient libpng version ($MOZPNG required)."
3830 #ifndef PNG_UINT_31_MAX
3831 #error "Insufficient libpng version."
3834 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3836 CFLAGS=$_SAVE_CFLAGS
3837 LDFLAGS=$_SAVE_LDFLAGS
3840 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
3841 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
3842 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
3846 if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
3849 AC_SUBST(MOZ_PNG_ARM_NEON)
3851 fi # SKIP_LIBRARY_CHECKS
3853 dnl system HunSpell Support
3854 dnl ========================================================
3855 MOZ_ARG_ENABLE_BOOL(system-hunspell,
3856 [ --enable-system-hunspell
3857 Use system hunspell (located with pkgconfig)],
3858 MOZ_NATIVE_HUNSPELL=1 )
3860 if test -n "$MOZ_NATIVE_HUNSPELL"; then
3861 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
3864 AC_SUBST(MOZ_NATIVE_HUNSPELL)
3866 dnl ========================================================
3867 dnl system libffi Support
3868 dnl ========================================================
3869 MOZ_ARG_ENABLE_BOOL(system-ffi,
3870 [ --enable-system-ffi Use system libffi (located with pkgconfig)],
3873 if test -n "$MOZ_NATIVE_FFI"; then
3874 # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
3875 # for non-GCC compilers.
3876 if test -z "$GNU_CC"; then
3877 PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
3879 PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
3881 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
3884 dnl ========================================================
3885 dnl System ICU Support
3886 dnl ========================================================
3888 MOZ_ARG_WITH_BOOL(system-icu,
3890 Use system ICU (located with pkgconfig)],
3893 if test -n "$MOZ_NATIVE_ICU"; then
3894 PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1)
3895 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_ICU_LIBS"
3898 AC_SUBST(MOZ_NATIVE_ICU)
3900 dnl ========================================================
3901 dnl Java SDK support
3902 dnl ========================================================
3905 MOZ_ARG_WITH_STRING(java-bin-path,
3906 [ --with-java-bin-path=dir
3907 Location of Java binaries (java, javac, jar)],
3908 JAVA_BIN_PATH=$withval)
3910 dnl ========================================================
3914 dnl ========================================================
3916 MOZ_ARG_HEADER(Application)
3919 ENABLE_SYSTEM_EXTENSION_DIRS=1
3920 MOZ_BRANDING_DIRECTORY=
3921 MOZ_OFFICIAL_BRANDING=
3925 MOZ_AUTH_EXTENSION=1
3928 MOZ_SPEEX_RESAMPLER=1
3934 MOZ_SAMPLE_TYPE_FLOAT32=
3935 MOZ_SAMPLE_TYPE_S16=
3944 MOZ_WEBRTC_SIGNALING=
3945 MOZ_WEBRTC_ASSERT_ALWAYS=1
3948 MOZ_MEDIA_NAVIGATOR=
3951 MOZ_VP8_ERROR_CONCEALMENT=
3962 LIBJPEG_TURBO_ASFLAGS=
3963 LIBJPEG_TURBO_X86_ASM=
3964 LIBJPEG_TURBO_X64_ASM=
3965 LIBJPEG_TURBO_ARM_ASM=
3970 MOZ_PREF_EXTENSIONS=1
3971 MOZ_PROFILELOCKING=1
3977 MOZ_TOOLKIT_SEARCH=1
3979 MOZ_UNIVERSALCHARDET=1
3985 MOZ_DISABLE_CRYPTOLEGACY=
3988 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
3991 MOZ_USE_NATIVE_POPUP_WINDOWS=
3992 MOZ_ANDROID_HISTORY=
3998 MOZ_AUDIO_CHANNEL_MANAGER=
4000 MOZ_CONTENT_SANDBOX=
4001 MOZ_CONTENT_SANDBOX_REPORTER=
4003 case "$target_os" in
4006 AC_DEFINE(NS_ENABLE_TSF)
4011 *-android*|*-linuxandroid*)
4012 if test "$CPU_ARCH" = "arm" ; then
4017 MOZ_THEME_FASTSTRIPE=1
4025 MOZ_ARG_WITH_STRING(external-source-dir,
4026 [ --with-external-source-dir=dir
4027 External directory containing additional build files.],
4028 [ EXTERNAL_SOURCE_DIR=$withval])
4029 AC_SUBST(EXTERNAL_SOURCE_DIR)
4031 MOZ_ARG_ENABLE_STRING(application,
4032 [ --enable-application=APP
4036 tools/update-packaging (AUS-related packaging tools)],
4037 [ MOZ_BUILD_APP=$enableval ] )
4039 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4040 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4041 XULRUNNER_STUB_NAME=$withval)
4043 if test -z "$XULRUNNER_STUB_NAME"; then
4044 case "$target_os" in
4046 XULRUNNER_STUB_NAME=xulrunner
4049 XULRUNNER_STUB_NAME=xulrunner-stub
4052 AC_SUBST(XULRUNNER_STUB_NAME)
4054 AC_MSG_CHECKING([for application to build])
4055 if test -z "$MOZ_BUILD_APP"; then
4056 AC_MSG_RESULT([browser])
4057 MOZ_BUILD_APP=browser
4059 # "mobile" no longer exists.
4060 if test "$MOZ_BUILD_APP" = "mobile" ; then
4061 AC_MSG_RESULT([none])
4062 AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
4064 # We have a valid application only if it has a build.mk file in its top
4066 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4067 AC_MSG_RESULT([none])
4068 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4070 AC_MSG_RESULT([$MOZ_BUILD_APP])
4074 # The app update channel is 'default' when not supplied. The value is used in
4075 # the application's confvars.sh so it must be set before confvars.sh is called.
4076 MOZ_ARG_ENABLE_STRING([update-channel],
4077 [ --enable-update-channel=CHANNEL
4078 Select application update channel (default=default)],
4079 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4081 if test -z "$MOZ_UPDATE_CHANNEL"; then
4082 MOZ_UPDATE_CHANNEL=default
4084 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4085 AC_SUBST(MOZ_UPDATE_CHANNEL)
4087 # Allow to specify a Google API key file that contains the secret key to be
4088 # used for various Google API requests.
4089 MOZ_ARG_WITH_STRING(google-api-keyfile,
4090 [ --with-google-api-keyfile=file Use the secret key contained in the given keyfile for Google API requests],
4091 MOZ_GOOGLE_API_KEY=`cat $withval`)
4092 if test -z "$MOZ_GOOGLE_API_KEY"; then
4093 MOZ_GOOGLE_API_KEY=no-google-api-key
4095 AC_SUBST(MOZ_GOOGLE_API_KEY)
4097 # Allow the application to influence configure with a confvars.sh script.
4098 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4099 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4100 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4101 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4106 # Allow influencing configure with a defines.sh script.
4107 . "${srcdir}/build/defines.sh"
4109 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
4111 if test "$BUILDING_RELEASE"; then
4112 # Override value in defines.sh, if any
4113 EARLY_BETA_OR_EARLIER=
4114 elif test "$EARLY_BETA_OR_EARLIER"; then
4115 AC_DEFINE(EARLY_BETA_OR_EARLIER)
4117 AC_SUBST(EARLY_BETA_OR_EARLIER)
4119 # Allow the application to provide a subconfigure script
4120 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4121 do_output_subdirs() {
4122 if test -n "$_subconfigure_subdirs"; then
4123 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4125 _subconfigure_subdir="$1"
4126 _subconfigure_config_args="$ac_configure_args"
4128 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4129 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4130 "${srcdir}/build/autoconf/altoptions.m4" \
4131 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4136 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4137 MOZ_ARG_WITH_STRING(app-name,
4138 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4139 WITH_APP_NAME=$withval,
4142 if test -n "$WITH_APP_NAME" ; then
4143 MOZ_APP_NAME="$WITH_APP_NAME"
4146 MOZ_ARG_WITH_STRING(app-basename,
4147 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4148 WITH_APP_BASENAME=$withval,
4151 if test -n "$WITH_APP_BASENAME" ; then
4152 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4155 # Now is a good time to test for logic errors, define mismatches, etc.
4156 case "$MOZ_BUILD_APP" in
4158 if test "$LIBXUL_SDK"; then
4159 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4164 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4165 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4167 case "$MOZ_BUILD_APP" in
4169 AC_DEFINE(MOZ_PHOENIX)
4173 AC_DEFINE(MOZ_XULRUNNER)
4180 AC_SUBST(MOZ_BUILD_APP)
4181 AC_SUBST(MOZ_PHOENIX)
4182 AC_SUBST(MOZ_XULRUNNER)
4185 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4187 dnl ========================================================
4188 dnl Check android sdk version depending on mobile target
4189 dnl ========================================================
4191 if test -z "$gonkdir" ; then
4192 # Minimum Android SDK API Level we require.
4193 case "$MOZ_BUILD_APP" in
4195 android_min_api_level=16
4197 *-android*|*-linuxandroid*)
4201 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])
4207 MOZ_ANDROID_SDK($android_min_api_level)
4210 dnl ========================================================
4212 dnl = Toolkit Options
4214 dnl ========================================================
4215 MOZ_ARG_HEADER(Toolkit Options)
4217 dnl ========================================================
4218 dnl = Select the default toolkit
4219 dnl ========================================================
4220 MOZ_ARG_ENABLE_STRING(default-toolkit,
4221 [ --enable-default-toolkit=TK
4222 Select default toolkit
4223 Platform specific defaults:
4224 Mac OS X - cairo-cocoa
4226 Win32 - cairo-windows
4230 [ _DEFAULT_TOOLKIT=$enableval ],
4231 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4233 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4234 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4235 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4236 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4237 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4238 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4239 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4240 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4241 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4242 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4244 dnl nglayout only supports building with one toolkit,
4245 dnl so ignore everything after the first comma (",").
4246 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4248 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4251 MOZ_ARG_WITHOUT_BOOL(x,
4252 [ --without-x Build without X11],
4255 dnl ========================================================
4256 dnl = Enable the toolkit as needed =
4257 dnl ========================================================
4261 case "$MOZ_WIDGET_TOOLKIT" in
4264 MOZ_WIDGET_TOOLKIT=windows
4267 MOZ_INSTRUMENT_EVENT_LOOP=1
4268 if test -n "$GNU_CC"; then
4274 MOZ_WIDGET_TOOLKIT=gtk3
4277 MOZ_ENABLE_XREMOTE=1
4279 MOZ_GL_DEFAULT_PROVIDER=GLX
4285 TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4286 TK_LIBS='$(MOZ_GTK3_LIBS)'
4288 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4290 MOZ_INSTRUMENT_EVENT_LOOP=1
4293 cairo-gtk2|cairo-gtk2-x11)
4294 MOZ_WIDGET_TOOLKIT=gtk2
4297 MOZ_ENABLE_XREMOTE=1
4299 MOZ_GL_DEFAULT_PROVIDER=GLX
4305 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4306 TK_LIBS='$(MOZ_GTK2_LIBS)'
4307 AC_DEFINE(MOZ_WIDGET_GTK2)
4309 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4311 MOZ_INSTRUMENT_EVENT_LOOP=1
4315 MOZ_WIDGET_TOOLKIT=qt
4317 if test -z "$WITHOUT_X11"; then
4318 MOZ_ENABLE_XREMOTE=1
4319 MOZ_GL_DEFAULT_PROVIDER=GLX
4328 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4329 TK_LIBS='$(MOZ_QT_LIBS)'
4330 AC_DEFINE(MOZ_WIDGET_QT)
4332 AC_DEFINE(QT_NO_KEYWORDS)
4336 MOZ_WIDGET_TOOLKIT=os2
4338 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4339 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4344 MOZ_WIDGET_TOOLKIT=cocoa
4345 AC_DEFINE(MOZ_WIDGET_COCOA)
4346 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4347 TK_LIBS='-framework CoreLocation -framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4348 TK_CFLAGS="-DNO_X11"
4349 CFLAGS="$CFLAGS $TK_CFLAGS"
4350 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4351 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)'
4352 MOZ_USER_DIR="Mozilla"
4353 MOZ_FS_LAYOUT=bundle
4355 MOZ_INSTRUMENT_EVENT_LOOP=1
4359 MOZ_WIDGET_TOOLKIT=uikit
4360 AC_DEFINE(MOZ_WIDGET_UIKIT)
4361 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4362 TK_CFLAGS="-DNO_X11"
4363 TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4364 CFLAGS="$CFLAGS $TK_CFLAGS"
4365 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4366 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)'
4367 MOZ_USER_DIR="Mozilla"
4368 MOZ_FS_LAYOUT=bundle
4372 AC_DEFINE(MOZ_WIDGET_ANDROID)
4373 MOZ_WIDGET_TOOLKIT=android
4374 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4375 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4378 MOZ_INSTRUMENT_EVENT_LOOP=1
4382 XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)'
4383 AC_DEFINE(MOZ_WIDGET_GONK)
4384 AC_DEFINE(MOZ_TOUCH)
4385 MOZ_WIDGET_TOOLKIT=gonk
4386 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4387 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4395 AC_SUBST(MOZ_PDF_PRINTING)
4396 if test "$MOZ_PDF_PRINTING"; then
4397 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4398 AC_DEFINE(MOZ_PDF_PRINTING)
4401 if test "$MOZ_ENABLE_XREMOTE"; then
4402 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4405 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4406 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4409 if test "$COMPILE_ENVIRONMENT"; then
4410 if test "$MOZ_ENABLE_GTK3"; then
4411 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4413 if test "$MOZ_ENABLE_GTK2"; then
4414 if test "$MOZ_X11"; then
4415 GDK_PACKAGES=gdk-x11-2.0
4418 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4421 fi # COMPILE_ENVIRONMENT
4423 AC_SUBST(MOZ_FS_LAYOUT)
4425 dnl ========================================================
4426 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4427 dnl their usage and use them in spidermonkey.
4428 dnl ========================================================
4429 MOZ_ARG_WITH_BOOL(arm-kuser,
4430 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4432 if test -n "$USE_ARM_KUSER"; then
4433 AC_DEFINE(USE_ARM_KUSER)
4436 dnl ========================================================
4437 dnl = startup-notification support module
4438 dnl ========================================================
4440 if test "$MOZ_ENABLE_GTK"
4442 MOZ_ENABLE_STARTUP_NOTIFICATION=
4444 MOZ_ARG_ENABLE_BOOL(startup-notification,
4445 [ --enable-startup-notification
4446 Enable startup-notification support (default: disabled) ],
4447 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4448 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4449 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4451 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4452 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4453 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4454 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4456 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4458 MOZ_ENABLE_STARTUP_NOTIFICATION=
4462 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4463 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4466 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4468 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4469 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4470 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4472 dnl ========================================================
4474 dnl ========================================================
4475 if test "$MOZ_ENABLE_QT"
4477 MOZ_ARG_WITH_STRING(qtdir,
4478 [ --with-qtdir=\$dir Specify Qt directory ],
4481 if test -z "$QTDIR"; then
4482 AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4484 HOST_QMAKE="$QTDIR/bin/qmake"
4486 QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4488 if test -z "$QTDIR"; then
4491 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4492 PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5OpenGL Qt5Widgets Qt5PrintSupport, ,
4494 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4496 QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4497 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4500 AC_MSG_RESULT("Using qt4: $QT_VERSION")
4501 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL, ,
4503 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qt4 development package, (On Ubuntu, you might try installing the packages libqt4-dev libqt4-opengl-dev.)])
4507 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4511 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4512 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4514 MOZ_QT_CFLAGS="-DQT_SHARED"
4515 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4516 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4517 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4518 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4519 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4520 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4524 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4525 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml -lQt5OpenGL"
4526 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4527 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4528 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4529 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4532 AC_MSG_RESULT("Using qt4: $QT_VERSION")
4533 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4534 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4537 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4541 HOST_MOC="$QTDIR/bin/moc"
4542 HOST_RCC="$QTDIR/bin/rcc"
4544 if test -z "$HOST_MOC"; then
4545 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4548 if test -z "$HOST_RCC"; then
4549 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4556 MOZ_ENABLE_QMSYSTEM2=
4557 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4558 MOZ_ENABLE_QMSYSTEM2=1,
4559 MOZ_ENABLE_QMSYSTEM2=)
4561 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4562 MOZ_ENABLE_QMSYSTEM2=1
4563 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4564 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4565 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4568 MOZ_ENABLE_QTNETWORK=
4569 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4570 MOZ_ENABLE_QTNETWORK=1,
4571 MOZ_ENABLE_QTNETWORK=)
4573 if test "$MOZ_ENABLE_QTNETWORK"; then
4574 MOZ_ENABLE_QTNETWORK=1
4575 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4578 MOZ_ENABLE_QTMOBILITY=
4579 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4580 MOZ_ENABLE_QTMOBILITY=1,
4581 MOZ_ENABLE_QTMOBILITY=)
4582 if test "$MOZ_ENABLE_QTMOBILITY"; then
4583 MOZ_ENABLE_QTMOBILITY=1
4584 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4585 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4586 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4587 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4589 AC_CHECK_LIB(QtSensors, main, [
4590 MOZ_ENABLE_QTMOBILITY=1
4591 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4592 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4593 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4594 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4595 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4599 if test "$MOZ_ENABLE_CONTENTACTION"; then
4600 MOZ_ENABLE_CONTENTACTION=1
4601 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4604 MOZ_ENABLE_CONTENTACTION=
4605 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
4606 if test "$MOZ_ENABLE_CONTENTACTION"; then
4607 MOZ_ENABLE_CONTENTACTION=1
4608 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
4609 MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
4610 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4611 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
4615 AC_SUBST(GTK_CONFIG)
4619 AC_SUBST(MOZ_ENABLE_GTK2)
4620 AC_SUBST(MOZ_ENABLE_GTK3)
4621 AC_SUBST(MOZ_ENABLE_GTK)
4622 AC_SUBST(MOZ_ENABLE_QT)
4623 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4624 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4625 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4626 AC_SUBST(MOZ_ENABLE_XREMOTE)
4627 AC_SUBST(MOZ_GTK2_CFLAGS)
4628 AC_SUBST(MOZ_GTK2_LIBS)
4629 AC_SUBST(MOZ_GTK3_CFLAGS)
4630 AC_SUBST(MOZ_GTK3_LIBS)
4631 AC_SUBST(MOZ_WIDGET_GTK)
4632 AC_SUBST(MOZ_QT_CFLAGS)
4633 AC_SUBST(MOZ_QT_LIBS)
4640 dnl ========================================================
4642 dnl = Components & Features
4644 dnl ========================================================
4645 MOZ_ARG_HEADER(Components and Features)
4647 dnl ========================================================
4649 dnl ========================================================
4650 MOZ_ARG_ENABLE_STRING(ui-locale,
4651 [ --enable-ui-locale=ab-CD
4652 Select the user interface locale (default: en-US)],
4653 MOZ_UI_LOCALE=$enableval )
4654 AC_SUBST(MOZ_UI_LOCALE)
4656 dnl ========================================================
4657 dnl = Trademarked Branding
4658 dnl ========================================================
4659 MOZ_ARG_ENABLE_BOOL(official-branding,
4660 [ --enable-official-branding
4661 Enable Official mozilla.org Branding
4662 Do not distribute builds with
4663 --enable-official-branding unless you have
4664 permission to use trademarks per
4665 http://www.mozilla.org/foundation/trademarks/ .],
4667 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4668 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4670 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4671 MOZ_OFFICIAL_BRANDING=1
4673 ], MOZ_OFFICIAL_BRANDING=)
4675 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4676 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4677 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4680 MOZ_ARG_WITH_STRING(branding,
4681 [ --with-branding=dir Use branding from the specified directory.],
4682 MOZ_BRANDING_DIRECTORY=$withval)
4684 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4685 if test -z "$REAL_BRANDING_DIRECTORY"; then
4686 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4689 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4690 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4693 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4695 dnl ========================================================
4696 dnl = Distribution ID
4697 dnl ========================================================
4698 MOZ_ARG_WITH_STRING(distribution-id,
4699 [ --with-distribution-id=ID
4700 Set distribution-specific id (default=org.mozilla)],
4701 [ val=`echo $withval`
4702 MOZ_DISTRIBUTION_ID="$val"])
4704 if test -z "$MOZ_DISTRIBUTION_ID"; then
4705 MOZ_DISTRIBUTION_ID="org.mozilla"
4708 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4709 AC_SUBST(MOZ_DISTRIBUTION_ID)
4712 dnl ========================================================
4713 dnl complex text support off by default
4714 dnl ========================================================
4715 MOZ_ARG_DISABLE_BOOL(pango,
4716 [ --disable-pango Disable usage of Pango ],
4720 dnl ========================================================
4722 dnl ========================================================
4723 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4727 if test "$MOZ_PANGO"
4729 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4731 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4732 AC_SUBST(MOZ_PANGO_CFLAGS)
4733 AC_SUBST(MOZ_PANGO_LIBS)
4734 AC_DEFINE(MOZ_PANGO)
4736 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
4737 AC_SUBST(FT2_CFLAGS)
4742 dnl ========================================================
4743 dnl = GnomeVFS, GIO and GConf support module
4744 dnl ========================================================
4748 dnl build the GIO extension by default only when the
4749 dnl GTK2 toolkit is in use.
4750 if test "$MOZ_ENABLE_GTK"
4756 dnl ========================================================
4757 dnl = GnomeVFS support module
4758 dnl ========================================================
4759 MOZ_ARG_ENABLE_BOOL(gnomevfs,
4760 [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
4761 MOZ_ENABLE_GNOMEVFS=force,
4762 MOZ_ENABLE_GNOMEVFS=)
4764 if test "$MOZ_ENABLE_GNOMEVFS"
4766 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4767 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4768 MOZ_ENABLE_GNOMEVFS=1
4769 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4771 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4773 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4775 MOZ_ENABLE_GNOMEVFS=
4779 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4780 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4781 AC_SUBST(MOZ_GNOMEVFS_LIBS)
4783 dnl ========================================================
4784 dnl = GIO support module
4785 dnl ========================================================
4786 MOZ_ARG_DISABLE_BOOL(gio,
4787 [ --disable-gio Disable GIO support],
4789 MOZ_ENABLE_GIO=force)
4791 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
4793 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4794 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4795 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4796 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4798 AC_DEFINE(MOZ_ENABLE_GIO)
4800 if test "$MOZ_ENABLE_GIO" = "force"
4802 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4808 AC_SUBST(MOZ_ENABLE_GIO)
4809 AC_SUBST(MOZ_GIO_CFLAGS)
4810 AC_SUBST(MOZ_GIO_LIBS)
4812 dnl ========================================================
4813 dnl = GConf support module
4814 dnl ========================================================
4815 MOZ_ARG_DISABLE_BOOL(gconf,
4816 [ --disable-gconf Disable Gconf support ],
4818 MOZ_ENABLE_GCONF=force)
4820 if test "$MOZ_ENABLE_GCONF"
4822 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4823 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4826 if test "$MOZ_ENABLE_GCONF" = "force"
4828 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4834 if test "$MOZ_ENABLE_GCONF"; then
4835 AC_DEFINE(MOZ_ENABLE_GCONF)
4838 AC_SUBST(MOZ_ENABLE_GCONF)
4839 AC_SUBST(MOZ_GCONF_CFLAGS)
4840 AC_SUBST(MOZ_GCONF_LIBS)
4843 dnl ========================================================
4844 dnl = libproxy support
4845 dnl ========================================================
4847 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4849 MOZ_ENABLE_LIBPROXY=
4851 MOZ_ARG_ENABLE_BOOL(libproxy,
4852 [ --enable-libproxy Enable libproxy support ],
4853 MOZ_ENABLE_LIBPROXY=1,
4854 MOZ_ENABLE_LIBPROXY=)
4856 if test "$MOZ_ENABLE_LIBPROXY"
4858 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4859 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4862 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4863 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
4864 AC_SUBST(MOZ_LIBPROXY_LIBS)
4866 dnl ========================================================
4867 dnl = GNOME component (mozgnome)
4868 dnl ========================================================
4870 if test "$MOZ_ENABLE_GTK2"
4872 MOZ_ENABLE_GNOME_COMPONENT=1
4874 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4876 dnl ========================================================
4877 dnl = libgnomeui support module
4878 dnl ========================================================
4880 if test "$MOZ_ENABLE_GTK"
4882 MOZ_ARG_ENABLE_BOOL(gnomeui,
4883 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
4884 MOZ_ENABLE_GNOMEUI=force,
4885 MOZ_ENABLE_GNOMEUI=)
4887 if test "$MOZ_ENABLE_GNOMEUI"
4889 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4891 MOZ_ENABLE_GNOMEUI=1
4893 if test "$MOZ_ENABLE_GNOMEUI" = "force"
4895 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4901 if test "$MOZ_ENABLE_GNOMEUI"; then
4902 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4906 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4907 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
4909 dnl ========================================================
4911 dnl ========================================================
4913 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4917 MOZ_ARG_DISABLE_BOOL(dbus,
4918 [ --disable-dbus Disable dbus support ],
4922 if test "$MOZ_ENABLE_DBUS"
4924 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
4925 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
4926 AC_DEFINE(MOZ_ENABLE_DBUS)
4929 AC_SUBST(MOZ_ENABLE_DBUS)
4930 AC_SUBST(MOZ_DBUS_CFLAGS)
4931 AC_SUBST(MOZ_DBUS_LIBS)
4932 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
4933 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
4935 dnl ========================================================
4936 dnl = Enable Android History instead of Places
4937 dnl ========================================================
4938 if test -n "$MOZ_ANDROID_HISTORY"; then
4939 if test -z "$MOZ_PLACES"; then
4940 AC_DEFINE(MOZ_ANDROID_HISTORY)
4942 AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
4946 dnl ========================================================
4947 dnl = Build with the Android compositor
4948 dnl ========================================================
4949 if test -n "$MOZ_ANDROID_OMTC"; then
4950 dnl Do this if defined in confvars.sh
4951 AC_DEFINE(MOZ_ANDROID_OMTC)
4954 dnl ========================================================
4955 dnl = Disable WebSMS backend
4956 dnl ========================================================
4957 MOZ_ARG_DISABLE_BOOL(websms-backend,
4958 [ --disable-websms-backend
4959 Disable WebSMS backend],
4960 MOZ_WEBSMS_BACKEND=,
4961 MOZ_WEBSMS_BACKEND=1)
4963 if test -n "$MOZ_WEBSMS_BACKEND"; then
4964 AC_DEFINE(MOZ_WEBSMS_BACKEND)
4967 dnl ========================================================
4968 dnl = Enable NFC permission on Android
4969 dnl ========================================================
4970 if test -n "$MOZ_ANDROID_BEAM"; then
4971 AC_DEFINE(MOZ_ANDROID_BEAM)
4974 dnl ========================================================
4975 dnl = JS Debugger XPCOM component (js/jsd)
4976 dnl ========================================================
4977 MOZ_ARG_DISABLE_BOOL(jsd,
4978 [ --disable-jsd Disable JavaScript debug library],
4983 dnl ========================================================
4984 dnl = Enable IPDL's "expensive" unit tests
4985 dnl ========================================================
4988 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
4989 [ --enable-ipdl-tests Enable expensive IPDL tests],
4993 if test -n "$MOZ_IPDL_TESTS"; then
4994 AC_DEFINE(MOZ_IPDL_TESTS)
4997 AC_SUBST(MOZ_IPDL_TESTS)
4999 dnl ========================================================
5000 dnl = Disable building dbm
5001 dnl ========================================================
5002 MOZ_ARG_DISABLE_BOOL(dbm,
5003 [ --disable-dbm Disable building dbm],
5007 dnl bi-directional support always on
5011 dnl ========================================================
5012 dnl accessibility support on by default on all platforms
5013 dnl ========================================================
5014 MOZ_ARG_DISABLE_BOOL(accessibility,
5015 [ --disable-accessibility Disable accessibility support],
5018 if test "$ACCESSIBILITY"; then
5021 if test -z "$MIDL"; then
5022 if test "$GCC" != "yes"; then
5023 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5025 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.])
5029 AC_DEFINE(ACCESSIBILITY)
5032 dnl ========================================================
5033 dnl Accessibility is required for the linuxgl widget
5035 dnl ========================================================
5036 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5037 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5040 dnl ========================================================
5041 dnl Disable printing
5042 dnl ========================================================
5043 MOZ_ARG_DISABLE_BOOL(printing,
5044 [ --disable-printing Disable printing support],
5048 if test "$NS_PRINTING"; then
5049 AC_DEFINE(NS_PRINTING)
5050 AC_DEFINE(NS_PRINT_PREVIEW)
5053 dnl Turn off webrtc for OS's we don't handle yet, but allow
5054 dnl --enable-webrtc to override. Can disable for everything in
5055 dnl the master list above.
5056 if test -n "$MOZ_WEBRTC"; then
5058 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
5062 dnl default to disabled for all others
5068 AC_TRY_COMPILE([#include <linux/ethtool.h>],
5069 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
5070 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
5072 # target_arch is from {ia32|x64|arm|ppc}
5075 WEBRTC_TARGET_ARCH=x64
5079 WEBRTC_TARGET_ARCH=arm
5083 WEBRTC_TARGET_ARCH=ia32
5087 WEBRTC_TARGET_ARCH=ppc
5090 WEBRTC_TARGET_ARCH=ia64
5093 # unsupported arch for webrtc
5094 WEBRTC_TARGET_ARCH=unknown
5100 dnl ========================================================
5101 dnl = Disable WebRTC code
5102 dnl ========================================================
5103 MOZ_ARG_DISABLE_BOOL(webrtc,
5104 [ --disable-webrtc Disable support for WebRTC],
5108 if test -n "$MOZ_WEBRTC"; then
5109 AC_DEFINE(MOZ_WEBRTC)
5110 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
5111 dnl opt/production builds (via MOZ_CRASH())
5112 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
5116 MOZ_VP8_ERROR_CONCEALMENT=1
5118 dnl enable once Signaling lands
5119 MOZ_WEBRTC_SIGNALING=1
5120 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5121 dnl enable once PeerConnection lands
5122 MOZ_PEERCONNECTION=1
5123 AC_DEFINE(MOZ_PEERCONNECTION)
5130 AC_SUBST(MOZ_WEBRTC)
5131 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5132 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5133 AC_SUBST(MOZ_PEERCONNECTION)
5134 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5138 dnl Use integers over floats for audio on B2G and Android, because audio
5139 dnl backends for those platforms don't support floats.
5140 if test "$OS_TARGET" = "Android"; then
5141 MOZ_SAMPLE_TYPE_S16=1
5142 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5143 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5145 MOZ_SAMPLE_TYPE_FLOAT32=1
5146 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5147 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5150 dnl ========================================================
5151 dnl = Disable Speech API code
5152 dnl ========================================================
5153 MOZ_ARG_DISABLE_BOOL(webspeech,
5154 [ --disable-webspeech Disable support for HTML Speech API],
5158 if test -n "$MOZ_WEBSPEECH"; then
5159 AC_DEFINE(MOZ_WEBSPEECH)
5162 AC_SUBST(MOZ_WEBSPEECH)
5164 dnl ========================================================
5165 dnl = Enable Raw Codecs
5166 dnl ========================================================
5167 MOZ_ARG_ENABLE_BOOL(raw,
5168 [ --enable-raw Enable support for RAW media],
5172 if test -n "$MOZ_RAW"; then
5178 dnl ========================================================
5179 dnl = Disable Ogg Codecs
5180 dnl ========================================================
5181 MOZ_ARG_DISABLE_BOOL(ogg,
5182 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5186 if test -n "$MOZ_OGG"; then
5190 dnl Checks for __attribute__(aligned()) directive
5191 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5192 [ac_cv_c_attribute_aligned],
5193 [ac_cv_c_attribute_aligned=0
5194 CFLAGS_save="${CFLAGS}"
5195 CFLAGS="${CFLAGS} -Werror"
5196 for ac_cv_c_attr_align_try in 64 32 16 8; do
5197 echo "trying $ac_cv_c_attr_align_try"
5199 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5200 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5201 if test "$ac_cv_c_attribute_aligned" != 0; then
5205 CFLAGS="${CFLAGS_save}"])
5206 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5207 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5208 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5212 dnl ========================================================
5213 dnl = Disable Opus audio codec support
5214 dnl ========================================================
5215 MOZ_ARG_DISABLE_BOOL(opus,
5216 [ --disable-opus Disable support for Opus audio],
5220 dnl ========================================================
5221 dnl = Disable VP8 decoder support
5222 dnl ========================================================
5223 MOZ_ARG_DISABLE_BOOL(webm,
5224 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5228 if test -n "$MOZ_WEBM"; then
5233 dnl ========================================================
5234 dnl = DirectShow support
5235 dnl ========================================================
5236 if test "$OS_ARCH" = "WINNT"; then
5237 dnl Enable DirectShow support by default.
5241 MOZ_ARG_DISABLE_BOOL(directshow,
5242 [ --disable-directshow Disable support for DirectShow],
5246 if test -n "$MOZ_DIRECTSHOW"; then
5247 AC_DEFINE(MOZ_DIRECTSHOW)
5251 dnl ========================================================
5252 dnl = Windows Media Foundation support
5253 dnl ========================================================
5254 if test "$OS_ARCH" = "WINNT"; then
5255 dnl Enable Windows Media Foundation support by default.
5256 dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5257 dnl guaranteed to have a recent-enough SDK to build WMF.
5261 MOZ_ARG_DISABLE_BOOL(wmf,
5262 [ --disable-wmf Disable support for Windows Media Foundation],
5266 if test -n "$MOZ_WMF"; then
5271 dnl ========================================================
5272 dnl = Enable media plugin support
5273 dnl ========================================================
5274 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5275 dnl Enable support on android by default
5279 MOZ_ARG_ENABLE_BOOL(media-plugins,
5280 [ --enable-media-plugins Enable support for media plugins],
5281 MOZ_MEDIA_PLUGINS=1,
5284 if test -n "$MOZ_MEDIA_PLUGINS"; then
5285 AC_DEFINE(MOZ_MEDIA_PLUGINS)
5288 dnl ========================================================
5289 dnl = Disable platform MP3 decoder on OSX
5290 dnl ========================================================
5291 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5295 MOZ_ARG_DISABLE_BOOL(apple-media,
5296 [ --disable-apple-media Disable support for Apple AudioToolbox/VideoToolbox],
5300 if test -n "$MOZ_APPLEMEDIA"; then
5301 AC_DEFINE(MOZ_APPLEMEDIA)
5304 dnl ========================================================
5305 dnl = Enable getUserMedia support
5306 dnl ========================================================
5307 MOZ_ARG_ENABLE_BOOL(media-navigator,
5308 [ --enable-media-navigator Enable support for getUserMedia],
5309 MOZ_MEDIA_NAVIGATOR=1,
5310 MOZ_MEDIA_NAVIGATOR=)
5312 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5313 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5316 dnl ========================================================
5317 dnl = Enable building OMX media plugin (B2G or Android)
5318 dnl ========================================================
5319 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5320 dnl Enable support on android by default
5324 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5325 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5329 if test -n "$MOZ_OMX_PLUGIN"; then
5330 if test "$OS_TARGET" = "Android"; then
5331 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5332 AC_DEFINE(MOZ_OMX_PLUGIN)
5334 dnl fail if we're not building on Gonk or Android
5335 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5339 dnl system libvpx Support
5340 dnl ========================================================
5341 MOZ_ARG_WITH_BOOL(system-libvpx,
5342 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5343 MOZ_NATIVE_LIBVPX=1)
5348 if test -n "$MOZ_VP8"; then
5350 if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5351 AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5353 if test -n "$MOZ_VP8_ENCODER" ; then
5354 AC_DEFINE(MOZ_VP8_ENCODER)
5357 if test -n "$MOZ_NATIVE_LIBVPX"; then
5358 dnl ============================
5359 dnl === libvpx Version check ===
5360 dnl ============================
5361 dnl Check to see if we have a system libvpx package.
5362 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5364 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5365 [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.])])
5368 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5369 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5374 AC_SUBST(MOZ_NATIVE_LIBVPX)
5375 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5376 AC_SUBST(MOZ_LIBVPX_LIBS)
5378 if test "$MOZ_WEBM" -o "$MOZ_OGG"; then
5380 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5387 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5389 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5390 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5391 dnl We currently require gcc on all arm platforms.
5394 VPX_NEED_OBJ_INT_EXTRACT=
5396 dnl See if we have assembly on this platform.
5397 case "$OS_ARCH:$CPU_ARCH" in
5399 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5403 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5407 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5411 dnl Check for yasm 1.1 or greater.
5412 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5413 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.])
5414 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5415 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.])
5417 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5419 dnl The encoder needs obj_int_extract to get asm offsets.
5423 if test -n "$GNU_AS" ; then
5425 dnl These flags are a lie; they're just used to enable the requisite
5426 dnl opcodes; actual arch detection is done at runtime.
5427 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5428 VPX_DASH_C_FLAG="-c"
5429 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5430 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5435 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5436 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5441 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5442 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5448 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5449 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.])
5452 if test -n "$MOZ_VP8_ENCODER" -a \
5453 -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5454 dnl We prefer to get asm offsets using inline assembler, which the above
5455 dnl compilers can do. When we're not using one of those, we have to fall
5456 dnl back to obj_int_extract, which reads them from a compiled object
5457 dnl file. Unfortunately, that only works if we're compiling on a system
5458 dnl with the header files for the appropriate object file format.
5459 VPX_NEED_OBJ_INT_EXTRACT=1
5462 if test -n "$VPX_X86_ASM"; then
5463 AC_DEFINE(VPX_X86_ASM)
5464 elif test -n "$VPX_ARM_ASM"; then
5465 AC_DEFINE(VPX_ARM_ASM)
5467 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5471 dnl ========================================================
5472 dnl = Disable Wave decoder support
5473 dnl ========================================================
5474 MOZ_ARG_DISABLE_BOOL(wave,
5475 [ --disable-wave Disable Wave decoder support],
5479 if test -n "$MOZ_WAVE"; then
5484 dnl ========================================================
5485 dnl = Handle dependent CUBEB and MEDIA defines
5486 dnl ========================================================
5488 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5489 AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5492 if test -n "$MOZ_SOUNDTOUCH"; then
5493 AC_DEFINE(MOZ_SOUNDTOUCH)
5496 if test -n "$MOZ_CUBEB"; then
5497 AC_DEFINE(MOZ_CUBEB)
5500 if test -n "$MOZ_OPUS" -a -z "$MOZ_OGG"; then
5501 AC_MSG_ERROR([MOZ_OPUS requires MOZ_OGG which is disabled.])
5504 if test -n "$MOZ_VORBIS" -a -z "$MOZ_OGG"; then
5505 AC_MSG_ERROR([MOZ_VORBIS requires MOZ_OGG which is disabled.
5506 Note that you need vorbis support for WebM playback.])
5509 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5510 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/])
5513 if test -n "$MOZ_WEBRTC" -a -z "$MOZ_OPUS"; then
5514 AC_MSG_ERROR([MOZ_WEBRTC requires MOZ_OPUS which is disabled.])
5517 if test -n "$MOZ_VORBIS"; then
5518 AC_DEFINE(MOZ_VORBIS)
5521 if test -n "$MOZ_TREMOR"; then
5522 AC_DEFINE(MOZ_TREMOR)
5525 if test -n "$MOZ_OPUS"; then
5529 dnl ========================================================
5530 dnl = Check alsa availability on Linux if using sydneyaudio
5531 dnl ========================================================
5533 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5534 if test -n "$MOZ_CUBEB" -a "$OS_TARGET" = "Linux"; then
5538 MOZ_ARG_ENABLE_BOOL(alsa,
5539 [ --enable-alsa Enable Alsa support (default on Linux)],
5543 if test -n "$MOZ_ALSA"; then
5544 AC_DEFINE(MOZ_CUBEB)
5545 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5546 [echo "$MOZ_ALSA_PKG_ERRORS"
5547 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.)])])
5551 AC_SUBST(MOZ_ALSA_CFLAGS)
5552 AC_SUBST(MOZ_ALSA_LIBS)
5554 dnl ========================================================
5555 dnl = Enable PulseAudio
5556 dnl ========================================================
5558 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5559 [ --enable-pulseaudio Enable PulseAudio support (experimental)],
5563 if test -n "$MOZ_PULSEAUDIO"; then
5564 AC_DEFINE(MOZ_CUBEB)
5565 if test -z "$gonkdir"; then
5566 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5567 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5568 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
5570 MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
5571 MOZ_PULSEAUDIO_LIBS="-lpulse"
5575 AC_SUBST(MOZ_PULSEAUDIO)
5576 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5577 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5579 dnl ========================================================
5580 dnl = Enable GStreamer
5581 dnl ========================================================
5582 if test "$OS_TARGET" = "Linux"; then
5586 MOZ_ARG_ENABLE_BOOL(gstreamer,
5587 [ --enable-gstreamer Enable GStreamer support],
5591 if test "$MOZ_GSTREAMER"; then
5592 # API version, eg 0.10, 1.0 etc
5593 GST_API_VERSION=0.10
5594 # core/base release number
5596 PKG_CHECK_MODULES(GSTREAMER,
5597 gstreamer-$GST_API_VERSION >= $GST_VERSION
5598 gstreamer-app-$GST_API_VERSION
5599 gstreamer-plugins-base-$GST_API_VERSION, ,
5600 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]))
5601 if test -n "$GSTREAMER_LIBS"; then
5602 _SAVE_LDFLAGS=$LDFLAGS
5603 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5604 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5605 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5606 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5608 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.])
5610 LDFLAGS=$_SAVE_LDFLAGS
5612 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])
5615 AC_SUBST(GSTREAMER_CFLAGS)
5616 AC_SUBST(GSTREAMER_LIBS)
5617 AC_SUBST(MOZ_GSTREAMER)
5619 if test -n "$MOZ_GSTREAMER"; then
5620 AC_DEFINE(MOZ_GSTREAMER)
5624 dnl ========================================================
5625 dnl Permissions System
5626 dnl ========================================================
5627 MOZ_ARG_DISABLE_BOOL(permissions,
5628 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5633 dnl ========================================================
5634 dnl Child permissions, currently only used for b2g
5635 dnl ========================================================
5636 if test -n "$MOZ_B2G"; then
5637 if test -n "$MOZ_PERMISSIONS"; then
5638 MOZ_CHILD_PERMISSIONS=1
5640 AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
5643 AC_SUBST(MOZ_CHILD_PERMISSIONS)
5645 dnl ========================================================
5647 dnl ========================================================
5648 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5649 [ --disable-negotiateauth Disable GSS-API negotiation ],
5650 MOZ_AUTH_EXTENSION=,
5651 MOZ_AUTH_EXTENSION=1 )
5653 dnl ========================================================
5654 dnl Pref extensions (autoconfig)
5655 dnl ========================================================
5656 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5657 [ --disable-pref-extensions
5658 Disable pref extensions such as autoconfig],
5659 MOZ_PREF_EXTENSIONS=,
5660 MOZ_PREF_EXTENSIONS=1 )
5662 dnl ========================================================
5663 dnl Searching of system directories for extensions.
5664 dnl Note: this switch is meant to be used for test builds
5665 dnl whose behavior should not depend on what happens to be
5666 dnl installed on the local machine.
5667 dnl ========================================================
5668 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5669 [ --disable-system-extension-dirs
5670 Disable searching system- and account-global
5671 directories for extensions of any kind; use
5672 only profile-specific extension directories],
5673 ENABLE_SYSTEM_EXTENSION_DIRS=,
5674 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5675 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5676 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5679 dnl ========================================================
5680 dnl = Universalchardet
5681 dnl ========================================================
5682 MOZ_ARG_DISABLE_BOOL(universalchardet,
5683 [ --disable-universalchardet
5684 Disable universal encoding detection],
5685 MOZ_UNIVERSALCHARDET=,
5686 MOZ_UNIVERSALCHARDET=1 )
5688 if test -n "${JAVA_BIN_PATH}"; then
5689 dnl Look for javac and jar in the specified path.
5690 JAVA_PATH="$JAVA_BIN_PATH"
5692 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5693 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5696 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5697 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5698 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5699 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5700 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5701 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5703 if test -n "${JAVA_BIN_PATH}" -o \
5704 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5705 if test -z "$JAVA" -o "$JAVA" = ":"; then
5706 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}])
5708 if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5709 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}])
5711 if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5712 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}])
5714 if test -z "$JAR" -o "$JAR" = ":"; then
5715 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}])
5717 if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5718 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}])
5720 if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5721 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}])
5725 dnl ========================================================
5726 dnl = ANGLE OpenGL->D3D translator for WebGL
5727 dnl = * only applies to win32
5728 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5729 dnl ========================================================
5731 MOZ_DIRECTX_SDK_PATH=
5732 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5733 MOZ_D3DCOMPILER_CAB=
5734 MOZ_D3DCOMPILER_DLL=
5735 case "$target_os" in
5737 MOZ_ANGLE_RENDERER=1
5741 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5742 case "${target_cpu}" in
5744 MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5747 MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5751 MOZ_ARG_DISABLE_BOOL(webgl,
5752 [ --disable-webgl Disable building of the WebGL implementation],
5753 MOZ_WEBGL_DISABLED=1,
5754 MOZ_WEBGL_DISABLED=)
5756 if test -n "$MOZ_WEBGL_DISABLED"; then
5761 if test -n "$MOZ_WEBGL"; then
5762 AC_DEFINE(MOZ_WEBGL)
5765 if test -n "$MOZ_WEBGL_CONFORMANT"; then
5766 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
5769 # Locate a DirectX SDK here so we can use it for both ANGLE and
5771 if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
5772 # Get the SDK path from the registry.
5773 # First try to get the June 2010 SDK
5774 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5775 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5776 # Otherwise just take whatever comes first
5777 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5779 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'`
5782 if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
5783 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5784 AC_MSG_ERROR([Found the February 2010 DirectX SDK. Need the June 2010 DirectX SDK, or newer. Upgrade your SDK or reconfigure with --disable-webgl.])
5787 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5788 test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5789 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5790 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5792 AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for WebGL. Either install it (June 2010 version or newer), or reconfigure with --disable-webgl.])
5795 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5796 MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
5798 if test -z "$MOZ_D3DX9_VERSION" ; then
5799 AC_MSG_ERROR([Couldn't determine the D3DX9 version, needed for WebGL. Either reinstall the DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5802 MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5804 if test -z "$MOZ_D3DCOMPILER_CAB"; then
5805 AC_MSG_ERROR([Couldn't find the DirectX redistributable files. Either reinstall the DirectX SDK (making sure the "DirectX Redistributable Files" option is selected), or reconfigure with --disable-webgl.])
5808 MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5811 dnl ========================================================
5813 dnl ========================================================
5815 MOZ_GAMEPAD_BACKEND=stub
5817 # Gamepad DOM is built on supported platforms by default.
5818 case "$OS_TARGET" in
5826 MOZ_ARG_DISABLE_BOOL(gamepad,
5827 [ --disable-gamepad Disable gamepad support],
5831 if test "$MOZ_GAMEPAD"; then
5832 case "$OS_TARGET" in
5834 MOZ_GAMEPAD_BACKEND=cocoa
5837 if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
5838 if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5841 elif test "$GCC" != "yes"; then
5844 if test -z "$MOZ_GAMEPAD"; then
5845 AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for gamepad support. Please install it or, reconfigure with --disable-gamepad to disable gamepad support.])
5847 MOZ_GAMEPAD_BACKEND=windows
5850 MOZ_CHECK_HEADER([linux/joystick.h])
5851 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5852 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.])
5854 MOZ_GAMEPAD_BACKEND=linux
5860 AC_DEFINE(MOZ_GAMEPAD)
5862 AC_SUBST(MOZ_GAMEPAD)
5863 AC_SUBST(MOZ_GAMEPAD_BACKEND)
5865 dnl ========================================================
5866 dnl = Breakpad crash reporting (on by default on supported platforms)
5867 dnl ========================================================
5870 i?86-*-mingw*|x86_64-*-mingw*)
5873 i?86-apple-darwin*|x86_64-apple-darwin*)
5876 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5877 if test "$MOZ_ENABLE_GTK"; then
5881 *-android*|*-linuxandroid*)
5889 MOZ_ARG_DISABLE_BOOL(crashreporter,
5890 [ --disable-crashreporter Disable breakpad crash reporting],
5891 [MOZ_CRASHREPORTER=],
5892 [MOZ_CRASHREPORTER=F # Force enable breakpad])
5894 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
5895 if test "$MOZ_CRASHREPORTER" = F; then
5896 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
5901 if test -n "$MOZ_CRASHREPORTER"; then
5902 AC_DEFINE(MOZ_CRASHREPORTER)
5904 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5905 test -z "$SKIP_LIBRARY_CHECKS"; then
5906 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5907 AC_SUBST(MOZ_GTHREAD_CFLAGS)
5908 AC_SUBST(MOZ_GTHREAD_LIBS)
5911 if test "$OS_ARCH" = "WINNT"; then
5912 if test -z "$HAVE_64BIT_OS"; then
5913 MOZ_CRASHREPORTER_INJECTOR=1
5914 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5919 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5920 [ --with-crashreporter-enable-percent=NN
5921 Enable sending crash reports by default on NN% of users. (default=100)],
5922 [ val=`echo $withval | sed 's/[^0-9]//g'`
5923 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5925 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5926 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5928 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5930 dnl ========================================================
5931 dnl = libjpeg-turbo configuration
5932 dnl ========================================================
5934 if test -z "$MOZ_NATIVE_JPEG"; then
5938 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5939 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
5941 MOZ_LIBJPEG_TURBO=1)
5943 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
5944 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
5947 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
5950 if test -n "$MOZ_LIBJPEG_TURBO"; then
5952 dnl Do we support libjpeg-turbo on this platform?
5953 case "$OS_ARCH:$OS_TEST" in
5955 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
5956 LIBJPEG_TURBO_X86_ASM=1
5959 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
5960 LIBJPEG_TURBO_X64_ASM=1
5962 WINNT:x86|WINNT:i?86)
5963 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
5964 LIBJPEG_TURBO_X86_ASM=1
5967 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
5968 LIBJPEG_TURBO_X64_ASM=1
5971 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
5972 LIBJPEG_TURBO_ARM_ASM=1
5975 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5976 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
5977 LIBJPEG_TURBO_X86_ASM=1
5981 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5982 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
5983 LIBJPEG_TURBO_X64_ASM=1
5990 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
5991 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
5992 dnl it doesn't exist or we have too old of a version.
5993 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
5994 LIBJPEG_TURBO_AS=$YASM
5996 if test -z "$LIBJPEG_TURBO_AS" ; then
5997 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.])
6000 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6001 dnl on Linux and 1.1 or newer everywhere else.
6002 if test "$OS_ARCH" = "Linux" ; then
6003 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
6004 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.])
6007 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6008 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.])
6013 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6014 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6015 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6016 echo "Using $AS as the assembler for ARM code."
6017 LIBJPEG_TURBO_AS=$AS
6020 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6021 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6022 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6023 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6024 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6025 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6026 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6027 dnl Warn if we're not building the optimized routines, even though the user
6028 dnl didn't specify --disable-libjpeg-turbo.
6029 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6032 dnl ========================================================
6033 dnl = Enable compilation of specific extension modules
6034 dnl ========================================================
6036 MOZ_ARG_ENABLE_STRING(extensions,
6037 [ --enable-extensions Enable extensions],
6038 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6039 if test "$option" = "yes" -o "$option" = "all"; then
6040 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6041 elif test "$option" = "no" -o "$option" = "none"; then
6043 elif test "$option" = "default"; then
6044 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6045 elif test `echo "$option" | grep -c \^-` != 0; then
6046 option=`echo $option | sed 's/^-//'`
6047 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6049 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6052 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6054 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6055 # Suppress warning on non-X11 platforms
6056 if test -n "$MOZ_X11"; then
6057 AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6059 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6062 dnl Do not build gnomevfs with libxul based apps
6063 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6064 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6067 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6068 # Suppress warning on non-X11 platforms
6069 if test -n "$MOZ_X11"; then
6070 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6072 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6075 dnl Do not build gio with libxul based apps
6076 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6077 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6080 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6082 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6084 AC_SUBST(MOZ_GIO_COMPONENT)
6086 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6087 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6088 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6092 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6094 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6095 dnl when trying to build a nonexistent extension.
6096 for extension in $MOZ_EXTENSIONS; do
6097 if test ! -d "${srcdir}/extensions/${extension}"; then
6098 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6102 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6103 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6106 dnl ========================================================
6107 dnl Build Freetype in the tree
6108 dnl ========================================================
6109 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6110 [ --enable-tree-freetype Enable Tree FreeType],
6111 MOZ_TREE_FREETYPE=1,
6112 MOZ_TREE_FREETYPE= )
6113 if test -n "$MOZ_TREE_FREETYPE"; then
6114 if test -n "$_WIN32_MSVC"; then
6115 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6117 AC_DEFINE(MOZ_TREE_FREETYPE)
6118 AC_SUBST(MOZ_TREE_FREETYPE)
6119 MOZ_ENABLE_CAIRO_FT=1
6120 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6121 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6122 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6123 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6125 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6126 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6127 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6128 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6129 AC_SUBST(CAIRO_FT_CFLAGS)
6132 dnl ========================================================
6134 dnl ========================================================
6135 dnl Abort Windows build if the required major version and
6136 dnl minimum minor version of Unicode NSIS isn't in the path
6137 dnl (unless in case of cross compiling, for which Unicode
6138 dnl is not yet sufficient).
6139 if test "$OS_ARCH" = "WINNT"; then
6140 REQ_NSIS_MAJOR_VER=2
6141 MIN_NSIS_MINOR_VER=46
6142 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensis)
6143 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6144 AC_MSG_RESULT([yes])
6146 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6148 if test ! "$MAKENSISU_VER" = ""; then
6149 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6150 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6152 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6153 if test "$MAKENSISU_VER" = "" || \
6154 test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6155 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6157 if test -z "$CROSS_COMPILE"; then
6158 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path.])
6163 elif test -z "$CROSS_COMPILE"; then
6164 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path.])
6170 dnl ========================================================
6172 dnl ========================================================
6173 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6174 [ --disable-webapp-runtime Disable Web App Runtime],
6175 MOZ_WEBAPP_RUNTIME=,
6176 MOZ_WEBAPP_RUNTIME=1)
6177 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6180 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6183 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6184 if test "$MOZ_WEBAPP_RUNTIME"; then
6185 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6188 AC_MSG_CHECKING([for tar archiver])
6189 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6190 if test -z "$TAR"; then
6191 AC_MSG_ERROR([no tar archiver found in \$PATH])
6193 AC_MSG_RESULT([$TAR])
6196 AC_MSG_CHECKING([for wget])
6197 AC_CHECK_PROGS(WGET, wget, "")
6198 AC_MSG_RESULT([$WGET])
6201 dnl ========================================================
6203 dnl ========================================================
6205 if test -n "$MOZ_SIGN_CMD"; then
6206 AC_DEFINE(MOZ_SIGNING)
6209 dnl ========================================================
6210 dnl Maintenance Service
6211 dnl ========================================================
6213 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6214 [ --enable-maintenance-service Enable building of maintenanceservice],
6215 MOZ_MAINTENANCE_SERVICE=1,
6216 MOZ_MAINTENANCE_SERVICE= )
6218 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6219 if test "$OS_ARCH" = "WINNT"; then
6220 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6222 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6226 dnl ========================================================
6227 dnl Verify MAR signatures
6228 dnl ========================================================
6230 MOZ_ARG_ENABLE_BOOL(verify-mar,
6231 [ --enable-verify-mar Enable verifying MAR signatures],
6232 MOZ_VERIFY_MAR_SIGNATURE=1,
6233 MOZ_VERIFY_MAR_SIGNATURE= )
6235 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6236 if test "$OS_ARCH" = "WINNT"; then
6237 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6239 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6243 dnl ========================================================
6244 dnl Enable building the signmar program.
6245 dnl This option is much different than the --enable-verify-mar option.
6246 dnl --enable-verify-mar is for enabling the verification check on MAR
6247 dnl files in the updater. The --enable-signmar option is for building
6248 dnl the signmar program.
6249 dnl ========================================================
6251 MOZ_ARG_ENABLE_BOOL(signmar,
6252 [ --enable-signmar Enable building the signmar program],
6253 MOZ_ENABLE_SIGNMAR=1,
6254 MOZ_ENABLE_SIGNMAR= )
6256 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6257 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6260 dnl ========================================================
6262 dnl ========================================================
6264 MOZ_ARG_DISABLE_BOOL(updater,
6265 [ --disable-updater Disable building of updater],
6269 if test -n "$MOZ_UPDATER"; then
6270 AC_DEFINE(MOZ_UPDATER)
6273 # tools/update-packaging is not checked out by default.
6274 MOZ_ARG_ENABLE_BOOL(update-packaging,
6275 [ --enable-update-packaging
6276 Enable tools/update-packaging],
6277 MOZ_UPDATE_PACKAGING=1,
6278 MOZ_UPDATE_PACKAGING= )
6279 AC_SUBST(MOZ_UPDATE_PACKAGING)
6281 dnl ========================================================
6282 dnl build the tests by default
6283 dnl ========================================================
6284 MOZ_ARG_DISABLE_BOOL(tests,
6285 [ --disable-tests Do not build test libraries & programs],
6289 if test -n "$ENABLE_TESTS"; then
6292 AC_DEFINE(MOZ_ENABLE_GTEST)
6293 AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6294 AC_SUBST(MOZ_ENABLE_GTEST)
6295 AC_SUBST(GTEST_HAS_RTTI)
6296 if test -n "$_WIN32_MSVC"; then
6297 AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6299 if test "${OS_TARGET}" = "Android"; then
6300 AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6301 AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6302 AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6303 AC_SUBST(GTEST_OS_LINUX_ANDROID)
6304 AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6305 AC_SUBST(GTEST_HAS_CLONE)
6309 dnl ========================================================
6310 dnl parental controls (for Windows Vista)
6311 dnl ========================================================
6312 MOZ_ARG_DISABLE_BOOL(parental-controls,
6313 [ --disable-parental-controls
6314 Do not build parental controls],
6315 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6316 MOZ_DISABLE_PARENTAL_CONTROLS=)
6317 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6318 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6321 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6323 dnl ========================================================
6324 dnl = Disable DOMCrypto
6325 dnl ========================================================
6326 if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
6327 AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
6329 AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
6331 dnl ========================================================
6332 dnl = Disable libpkix
6333 dnl ========================================================
6334 if test -n "$NSS_NO_LIBPKIX"; then
6335 AC_DEFINE(NSS_NO_LIBPKIX)
6337 AC_SUBST(NSS_NO_LIBPKIX)
6339 dnl ========================================================
6340 dnl = Content process sandboxing
6341 dnl ========================================================
6342 if test -n "$gonkdir"; then
6343 MOZ_CONTENT_SANDBOX=1
6346 MOZ_ARG_ENABLE_BOOL(content-sandbox,
6347 [ --enable-content-sandbox Enable sandboxing support for content-processes],
6348 MOZ_CONTENT_SANDBOX=1,
6349 MOZ_CONTENT_SANDBOX=)
6351 if test -n "$MOZ_CONTENT_SANDBOX"; then
6352 AC_DEFINE(MOZ_CONTENT_SANDBOX)
6355 AC_SUBST(MOZ_CONTENT_SANDBOX)
6357 MOZ_ARG_ENABLE_BOOL(content-sandbox-reporter,
6358 [ --enable-content-sandbox-reporter Enable syscall reporter to troubleshoot syscalls denied by the content-processes sandbox],
6359 MOZ_CONTENT_SANDBOX_REPORTER=1,
6360 MOZ_CONTENT_SANDBOX_REPORTER=)
6362 if test -n "$MOZ_CONTENT_SANDBOX_REPORTER"; then
6363 AC_DEFINE(MOZ_CONTENT_SANDBOX_REPORTER)
6366 AC_SUBST(MOZ_CONTENT_SANDBOX_REPORTER)
6368 dnl ========================================================
6370 dnl = Module specific options
6372 dnl ========================================================
6373 MOZ_ARG_HEADER(Individual module options)
6375 dnl ========================================================
6376 dnl = Disable feed handling components
6377 dnl ========================================================
6378 MOZ_ARG_DISABLE_BOOL(feeds,
6379 [ --disable-feeds Disable feed handling and processing components],
6382 if test -n "$MOZ_FEEDS"; then
6383 AC_DEFINE(MOZ_FEEDS)
6385 if test "$MOZ_BUILD_APP" = "browser"; then
6386 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6390 dnl ========================================================
6391 dnl Check for sqlite
6392 dnl ========================================================
6395 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6396 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6397 MOZ_NATIVE_SQLITE=1,
6398 MOZ_NATIVE_SQLITE= )
6400 if test -z "$MOZ_NATIVE_SQLITE"
6403 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6405 dnl ============================
6406 dnl === SQLite Version check ===
6407 dnl ============================
6408 dnl Check to see if the system SQLite package is new enough.
6409 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6411 dnl ==================================
6412 dnl === SQLITE_SECURE_DELETE check ===
6413 dnl ==================================
6414 dnl Check to see if the system SQLite package is compiled with
6415 dnl SQLITE_SECURE_DELETE enabled.
6416 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6417 _SAVE_CFLAGS="$CFLAGS"
6418 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6420 LIBS="$LIBS $SQLITE_LIBS"
6421 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6423 #include "sqlite3.h"
6425 int main(int argc, char **argv){
6426 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6428 ac_cv_sqlite_secure_delete=yes,
6429 ac_cv_sqlite_secure_delete=no,
6430 ac_cv_sqlite_secure_delete=no
6433 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6434 CFLAGS="$_SAVE_CFLAGS"
6436 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6437 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6440 dnl ===============================
6441 dnl === SQLITE_THREADSAFE check ===
6442 dnl ===============================
6443 dnl Check to see if the system SQLite package is compiled with
6444 dnl SQLITE_THREADSAFE enabled.
6445 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6446 _SAVE_CFLAGS="$CFLAGS"
6447 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6449 LIBS="$LIBS $SQLITE_LIBS"
6450 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6452 #include "sqlite3.h"
6454 int main(int argc, char **argv){
6455 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6457 ac_cv_sqlite_threadsafe=yes,
6458 ac_cv_sqlite_threadsafe=no,
6459 ac_cv_sqlite_threadsafe=no
6462 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6463 CFLAGS="$_SAVE_CFLAGS"
6465 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6466 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6469 dnl ================================
6470 dnl === SQLITE_ENABLE_FTS3 check ===
6471 dnl ================================
6472 dnl check to see if the system SQLite package is compiled with
6473 dnl SQLITE_ENABLE_FTS3 enabled.
6474 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6475 _SAVE_CFLAGS="$CFLAGS"
6476 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6478 LIBS="$LIBS $SQLITE_LIBS"
6479 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6481 #include "sqlite3.h"
6483 int main(int argc, char **argv){
6484 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6486 ac_cv_sqlite_enable_fts3=yes,
6487 ac_cv_sqlite_enable_fts3=no,
6488 ac_cv_sqlite_enable_fts3=no
6491 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6492 CFLAGS="$_SAVE_CFLAGS"
6494 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6495 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6498 dnl =========================================
6499 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6500 dnl =========================================
6501 dnl check to see if the system SQLite package is compiled with
6502 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6503 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6504 _SAVE_CFLAGS="$CFLAGS"
6505 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6507 LIBS="$LIBS $SQLITE_LIBS"
6508 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6510 #include "sqlite3.h"
6512 int main(int argc, char **argv){
6513 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6515 ac_cv_sqlite_enable_unlock_notify=yes,
6516 ac_cv_sqlite_enable_unlock_notify=no,
6517 ac_cv_sqlite_enable_unlock_notify=no
6520 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6521 CFLAGS="$_SAVE_CFLAGS"
6523 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6524 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6528 if test -n "$MOZ_NATIVE_SQLITE"; then
6529 AC_DEFINE(MOZ_NATIVE_SQLITE)
6531 AC_SUBST(MOZ_NATIVE_SQLITE)
6533 dnl ========================================================
6534 dnl = Enable help viewer (off by default)
6535 dnl ========================================================
6536 if test -n "$MOZ_HELP_VIEWER"; then
6537 dnl Do this if defined in confvars.sh
6538 AC_DEFINE(MOZ_HELP_VIEWER)
6541 dnl ========================================================
6542 dnl = Enable safe browsing (anti-phishing)
6543 dnl ========================================================
6544 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6545 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6546 MOZ_SAFE_BROWSING=1,
6547 MOZ_SAFE_BROWSING= )
6548 if test -n "$MOZ_SAFE_BROWSING"; then
6549 AC_DEFINE(MOZ_SAFE_BROWSING)
6551 AC_SUBST(MOZ_SAFE_BROWSING)
6553 dnl ========================================================
6554 dnl = Enable url-classifier
6555 dnl ========================================================
6556 dnl Implicitly enabled by default if building with safe-browsing
6557 if test -n "$MOZ_SAFE_BROWSING"; then
6558 MOZ_URL_CLASSIFIER=1
6560 MOZ_ARG_ENABLE_BOOL(url-classifier,
6561 [ --enable-url-classifier Enable url classifier module],
6562 MOZ_URL_CLASSIFIER=1,
6563 MOZ_URL_CLASSIFIER= )
6564 if test -n "$MOZ_URL_CLASSIFIER"; then
6565 AC_DEFINE(MOZ_URL_CLASSIFIER)
6567 AC_SUBST(MOZ_URL_CLASSIFIER)
6569 dnl ========================================================
6570 dnl = Disable zipwriter
6571 dnl ========================================================
6572 MOZ_ARG_DISABLE_BOOL(zipwriter,
6573 [ --disable-zipwriter Disable zipwriter component],
6576 AC_SUBST(MOZ_ZIPWRITER)
6578 dnl ========================================================
6580 dnl ========================================================
6582 MOZ_ARG_WITH_STRING(gl-provider,
6583 [ --with-gl-provider=ID
6584 Set GL provider backend type],
6585 [ val=`echo $withval`
6586 MOZ_GL_PROVIDER="$val"])
6588 if test -n "$MOZ_GL_PROVIDER"; then
6589 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6590 AC_SUBST(MOZ_GL_PROVIDER)
6591 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6593 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6594 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6596 dnl ========================================================
6597 dnl = faststripe theme
6598 dnl ========================================================
6599 MOZ_ARG_ENABLE_BOOL(faststripe,
6600 [ --enable-faststripe Use faststripe theme],
6601 MOZ_THEME_FASTSTRIPE=1,
6602 MOZ_THEME_FASTSTRIPE= )
6603 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6605 dnl ========================================================
6607 dnl = Feature options that require extra sources to be pulled
6609 dnl ========================================================
6610 dnl MOZ_ARG_HEADER(Features that require extra sources)
6612 dnl ========================================================
6614 dnl = Runtime debugging and Optimization Options
6616 dnl ========================================================
6617 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
6619 dnl ========================================================
6620 dnl enable mobile optimizations
6621 dnl ========================================================
6622 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6623 [ --enable-mobile-optimize
6624 Enable mobile optimizations],
6625 MOZ_GFX_OPTIMIZE_MOBILE=1)
6627 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6629 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6630 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6633 dnl ========================================================
6634 dnl = Enable code optimization. ON by default.
6635 dnl ========================================================
6636 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6637 MOZ_OPTIMIZE_FLAGS="-O"
6640 MOZ_ARG_ENABLE_STRING(optimize,
6641 [ --disable-optimize Disable compiler optimization
6642 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6643 [ if test "$enableval" != "no"; then
6645 if test -n "$enableval" -a "$enableval" != "yes"; then
6646 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6651 fi ], MOZ_OPTIMIZE=1)
6653 MOZ_SET_FRAMEPTR_FLAGS
6655 if test "$COMPILE_ENVIRONMENT"; then
6656 if test -n "$MOZ_OPTIMIZE"; then
6657 AC_MSG_CHECKING([for valid optimization flags])
6658 _SAVE_CFLAGS=$CFLAGS
6659 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6660 AC_TRY_COMPILE([#include <stdio.h>],
6661 [printf("Hello World\n");],
6664 AC_MSG_RESULT([$_results])
6665 if test "$_results" = "no"; then
6666 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6668 CFLAGS=$_SAVE_CFLAGS
6670 fi # COMPILE_ENVIRONMENT
6672 AC_SUBST(MOZ_OPTIMIZE)
6673 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6674 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6675 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6676 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6677 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6678 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6680 dnl ========================================================
6681 dnl = Enable any treating of compile warnings as errors
6682 dnl ========================================================
6683 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6684 [ --enable-warnings-as-errors
6685 Enable treating of warnings as errors],
6686 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6687 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6688 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6689 WARNINGS_AS_ERRORS=''
6690 elif test "$GNU_CC"; then
6691 # Prevent the following GCC warnings from being treated as errors:
6692 # -Wuninitialized - too many false positives
6693 # -Wmaybe-uninitialized - too many false positives
6694 # -Wdeprecated-declarations - we don't want our builds held hostage when a
6695 # platform-specific API becomes deprecated.
6696 MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
6697 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
6698 MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
6699 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
6700 MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
6701 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
6704 dnl ========================================================
6705 dnl = Disable runtime logging checks
6706 dnl ========================================================
6707 MOZ_ARG_DISABLE_BOOL(logging,
6708 [ --disable-logging Disable logging facilities],
6709 NS_DISABLE_LOGGING=1,
6710 NS_DISABLE_LOGGING= )
6711 if test "$NS_DISABLE_LOGGING"; then
6712 AC_DEFINE(NS_DISABLE_LOGGING)
6714 AC_DEFINE(MOZ_LOGGING)
6717 dnl ========================================================
6718 dnl = This will enable logging of addref, release, ctor, dtor.
6719 dnl ========================================================
6720 _ENABLE_LOGREFCNT=42
6721 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6722 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6723 _ENABLE_LOGREFCNT=1,
6724 _ENABLE_LOGREFCNT= )
6725 if test "$_ENABLE_LOGREFCNT" = "1"; then
6726 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6727 elif test -z "$_ENABLE_LOGREFCNT"; then
6728 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6731 dnl ========================================================
6732 dnl moz_dump_painting
6733 dnl ========================================================
6734 MOZ_ARG_ENABLE_BOOL(dump-painting,
6735 [ --enable-dump-painting Enable paint debugging.],
6736 MOZ_DUMP_PAINTING=1,
6737 MOZ_DUMP_PAINTING= )
6738 if test -n "$MOZ_DUMP_PAINTING"; then
6739 AC_DEFINE(MOZ_DUMP_PAINTING)
6740 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6742 if test -n "$MOZ_DEBUG"; then
6743 AC_DEFINE(MOZ_DUMP_PAINTING)
6746 dnl ========================================================
6747 dnl = Enable trace malloc
6748 dnl ========================================================
6749 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6750 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6751 [ --enable-trace-malloc Enable malloc tracing; also disables DMD and jemalloc],
6754 if test "$NS_TRACE_MALLOC"; then
6755 # Please, Mr. Linker Man, don't take away our symbol names
6756 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6758 AC_DEFINE(NS_TRACE_MALLOC)
6760 AC_SUBST(NS_TRACE_MALLOC)
6762 dnl ========================================================
6764 dnl ========================================================
6766 MOZ_ARG_ENABLE_BOOL(dmd,
6767 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
6771 if test "$NS_TRACE_MALLOC"; then # trace-malloc disables DMD
6774 if test "$MOZ_DMD"; then
6778 if test "${CPU_ARCH}" = "arm"; then
6779 CFLAGS="$CFLAGS -funwind-tables"
6780 CXXFLAGS="$CXXFLAGS -funwind-tables"
6783 MOZ_MEMORY=1 # DMD enables jemalloc
6784 MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
6788 dnl ========================================================
6789 dnl = Enable jemalloc
6790 dnl ========================================================
6791 MOZ_ARG_ENABLE_BOOL(jemalloc,
6792 [ --enable-jemalloc Replace memory allocator with jemalloc],
6796 if test "$NS_TRACE_MALLOC"; then
6800 if test "${OS_TARGET}" = "Android"; then
6801 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6803 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
6804 dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
6805 if test -z "$GNU_CC"; then
6806 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6808 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6811 dnl On other Unix systems, we only want to link executables against mozglue
6812 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6813 dnl On other Unix systems, where mozglue is a static library, jemalloc is
6814 dnl separated for the SDK, so we need to add it here.
6815 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6816 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6818 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6819 if test -n "$GNU_CC"; then
6820 dnl And we need mozglue symbols to be exported.
6821 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6823 if test "$MOZ_LINKER" = 1; then
6824 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
6828 dnl ========================================================
6829 dnl = Enable dynamic replacement of malloc implementation
6830 dnl ========================================================
6831 MOZ_ARG_ENABLE_BOOL(replace-malloc,
6832 [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
6833 MOZ_REPLACE_MALLOC=1,
6834 MOZ_REPLACE_MALLOC= )
6836 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
6837 dnl We don't want to enable jemalloc unconditionally because it may be a
6838 dnl deliberate choice not to enable it (bug 702250, for instance)
6839 AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
6840 elif test -n "$MOZ_REPLACE_MALLOC"; then
6841 MOZ_NATIVE_JEMALLOC=
6843 dnl Replace-malloc Mac linkage quirks
6844 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
6845 AC_CACHE_CHECK([how to do weak dynamic linking],
6846 ac_cv_weak_dynamic_linking,
6847 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
6848 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
6849 test -s conftest${DLL_SUFFIX}; then
6850 dnl There are several ways the linker can put link edit rules in a binary:
6851 dnl - classic info only (for OSX < 10.6)
6852 dnl - dyld info only
6854 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
6859 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
6864 dnl With classic info, we need to build with -flat_namespace.
6865 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
6866 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
6867 dnl forgets to set the weak flag in the dyld info.
6868 dnl See http://glandium.org/blog/?p=2764 for more details.
6870 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
6871 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
6872 dnl - "flat namespace" when -flat_namespace alone is needed
6873 dnl - "dummy library" when a dummy library and -flat_namespace are needed
6874 dnl - "compiler support" when nothing is needed
6875 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
6876 if test -n "$_CLASSIC_INFO"; then
6877 ac_cv_weak_dynamic_linking="flat namespace"
6879 ac_cv_weak_dynamic_linking="compiler support"
6882 if test -n "$_DYLD_INFO"; then
6883 ac_cv_weak_dynamic_linking="dummy library"
6885 ac_cv_weak_dynamic_linking="flat namespace"
6889 AC_ERROR([couldn't compile a simple C file])
6892 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
6895 AC_SUBST(MOZ_REPLACE_MALLOC)
6896 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
6898 dnl ========================================================
6899 dnl = Jemalloc build setup
6900 dnl ========================================================
6901 if test -z "$MOZ_MEMORY"; then
6902 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
6903 MOZ_NATIVE_JEMALLOC=1
6904 AC_CHECK_FUNCS(mallctl nallocm,,
6905 [MOZ_NATIVE_JEMALLOC=
6907 if test -n "$MOZ_NATIVE_JEMALLOC"; then
6909 AC_DEFINE(MOZ_MEMORY)
6910 AC_DEFINE(MOZ_JEMALLOC3)
6911 AC_DEFINE(MOZ_NATIVE_JEMALLOC)
6916 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
6917 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.])
6922 AC_DEFINE(MOZ_MEMORY)
6923 if test -n "$MOZ_JEMALLOC3"; then
6924 AC_DEFINE(MOZ_JEMALLOC3)
6926 if test "x$MOZ_DEBUG" = "x1"; then
6927 AC_DEFINE(MOZ_MEMORY_DEBUG)
6929 dnl The generic feature tests that determine how to compute ncpus are long and
6930 dnl complicated. Therefore, simply define special cpp variables for the
6931 dnl platforms we have special knowledge of.
6934 AC_DEFINE(MOZ_MEMORY_DARWIN)
6937 AC_DEFINE(MOZ_MEMORY_BSD)
6939 *-android*|*-linuxandroid*)
6940 AC_DEFINE(MOZ_MEMORY_LINUX)
6941 AC_DEFINE(MOZ_MEMORY_ANDROID)
6942 if test -z "$gonkdir"; then
6945 AC_DEFINE(MOZ_MEMORY_GONK)
6950 AC_DEFINE(MOZ_MEMORY_LINUX)
6953 AC_DEFINE(MOZ_MEMORY_BSD)
6956 AC_DEFINE(MOZ_MEMORY_SOLARIS)
6959 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6960 if test -z "$MOZ_DEBUG"; then
6961 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
6963 WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
6965 dnl Look for a broken crtdll.obj
6966 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
6967 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
6968 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
6969 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
6970 dnl Also pass this to NSPR/NSS
6971 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
6973 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
6980 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6984 AC_SUBST(MOZ_MEMORY)
6985 AC_SUBST(MOZ_JEMALLOC3)
6986 AC_SUBST(MOZ_NATIVE_JEMALLOC)
6987 AC_SUBST(MOZ_GLUE_LDFLAGS)
6988 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
6989 AC_SUBST(WIN32_CRT_LIBS)
6990 dnl Need to set this for make because NSS doesn't have configure
6993 dnl We need to wrap dlopen and related functions on Android because we use
6995 if test "$OS_TARGET" = Android; then
6996 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
6997 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
6998 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
6999 if test -z "$gonkdir"; then
7000 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7001 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=memccpy,--wrap=memchr,--wrap=memrchr,--wrap=memcmp,--wrap=memcpy,--wrap=memmove,--wrap=memset,--wrap=memmem,--wrap=memswap,--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"
7003 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
7004 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"
7008 dnl ========================================================
7009 dnl = Use malloc wrapper lib
7010 dnl ========================================================
7011 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7012 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7016 if test -n "$_WRAP_MALLOC"; then
7017 if test -n "$GNU_CC"; then
7018 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7019 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7020 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7021 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7022 dnl Wrap operator new and operator delete on Android.
7023 if test "$OS_TARGET" = "Android"; then
7024 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7025 dnl Wrap the nothrow variants too.
7026 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7029 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7033 dnl ========================================================
7034 dnl = Location of malloc wrapper lib
7035 dnl ========================================================
7036 MOZ_ARG_WITH_STRING(wrap-malloc,
7037 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7038 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7040 dnl ========================================================
7041 dnl = Use JS Call tracing
7042 dnl ========================================================
7043 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7044 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7045 MOZ_TRACE_JSCALLS=1,
7046 MOZ_TRACE_JSCALLS= )
7047 if test -n "$MOZ_TRACE_JSCALLS"; then
7048 AC_DEFINE(MOZ_TRACE_JSCALLS)
7051 dnl ========================================================
7052 dnl = Use incremental GC
7053 dnl ========================================================
7055 MOZ_ARG_DISABLE_BOOL(gcincremental,
7056 [ --disable-gcincremental Disable incremental GC],
7058 if test -n "$JSGC_INCREMENTAL"; then
7059 AC_DEFINE(JSGC_INCREMENTAL)
7062 dnl ========================================================
7063 dnl Zealous JavaScript GC
7064 dnl ========================================================
7065 MOZ_ARG_ENABLE_BOOL(gczeal,
7066 [ --enable-gczeal Enable zealous JavaScript GCing],
7069 if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then
7070 AC_DEFINE(JS_GC_ZEAL)
7073 dnl ========================================================
7074 dnl JS opt-mode assertions and minidump instrumentation
7075 dnl ========================================================
7076 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7077 [ --enable-js-diagnostics
7078 Enable JS diagnostic assertions and breakpad data],
7079 JS_CRASH_DIAGNOSTICS=1,
7080 JS_CRASH_DIAGNOSTICS= )
7081 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7082 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7086 MOZ_CHECK_COMPILER_WRAPPER
7088 dnl ========================================================
7089 dnl = Enable static checking using gcc-dehydra
7090 dnl ========================================================
7092 MOZ_ARG_WITH_STRING(static-checking,
7093 [ --with-static-checking=path/to/gcc_dehydra.so
7094 Enable static checking of code using GCC-dehydra],
7095 DEHYDRA_PATH=$withval,
7098 if test -n "$DEHYDRA_PATH"; then
7099 if test ! -f "$DEHYDRA_PATH"; then
7100 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7102 AC_DEFINE(NS_STATIC_CHECKING)
7104 AC_SUBST(DEHYDRA_PATH)
7106 dnl ========================================================
7107 dnl = Enable using the clang plugin to build
7108 dnl ========================================================
7110 MOZ_ARG_ENABLE_BOOL(clang-plugin,
7111 [ --enable-clang-plugin Enable building with the mozilla clang plugin ],
7112 ENABLE_CLANG_PLUGIN=1,
7113 ENABLE_CLANG_PLUGIN= )
7114 if test -n "$ENABLE_CLANG_PLUGIN"; then
7115 if test -z "$CLANG_CC"; then
7116 AC_MSG_ERROR([Can't use clang plugin without clang.])
7118 AC_DEFINE(MOZ_CLANG_PLUGIN)
7121 AC_SUBST(ENABLE_CLANG_PLUGIN)
7123 dnl ========================================================
7124 dnl = Enable stripping of libs & executables
7125 dnl ========================================================
7126 MOZ_ARG_ENABLE_BOOL(strip,
7127 [ --enable-strip Enable stripping of libs & executables ],
7131 dnl ========================================================
7132 dnl = Enable stripping of libs & executables when packaging
7133 dnl ========================================================
7134 MOZ_ARG_ENABLE_BOOL(install-strip,
7135 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7139 dnl ========================================================
7140 dnl = --enable-elf-dynstr-gc
7141 dnl ========================================================
7142 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7143 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7144 USE_ELF_DYNSTR_GC=1,
7145 USE_ELF_DYNSTR_GC= )
7147 dnl ========================================================
7148 dnl = --disable-elf-hack
7149 dnl ========================================================
7152 MOZ_ARG_DISABLE_BOOL(elf-hack,
7153 [ --disable-elf-hack Disable elf hacks],
7155 [USE_ELF_HACK=F # Force enable elf-hack])
7157 # Disable elf hack for profiling because the built in profiler
7158 # doesn't read the segments properly with elf hack. This is
7159 # temporary and should be fixed soon in the profiler.
7160 if test "$MOZ_PROFILING" = 1; then
7161 if test "$USE_ELF_HACK" = F; then
7162 AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
7167 # Only enable elfhack where supported
7168 if test "$USE_ELF_HACK" = 1; then
7169 case "${HOST_OS_ARCH},${OS_ARCH}" in
7171 case "${CPU_ARCH}" in
7186 if test -n "$USE_ELF_HACK"; then
7187 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7188 dnl memory addresses it maps to. The result is that by the time elfhack
7189 dnl kicks in, it is not possible to apply relocations because of that,
7190 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7191 dnl segment. It makes elfhack mostly useless, so considering the problems
7192 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7193 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7194 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
7195 dnl elfhack enabled, disable PT_GNU_RELRO instead.
7196 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7197 LINK_WITH_PT_GNU_RELRO,
7198 [echo "int main() {return 0;}" > conftest.${ac_ext}
7199 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7200 test -s conftest${ac_exeext}; then
7201 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7202 LINK_WITH_PT_GNU_RELRO=yes
7204 LINK_WITH_PT_GNU_RELRO=no
7207 dnl We really don't expect to get here, but just in case
7208 AC_ERROR([couldn't compile a simple C file])
7211 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7212 if test "$USE_ELF_HACK" = F; then
7213 AC_MSG_CHECKING([for -z norelro option to ld])
7214 _SAVE_LDFLAGS=$LDFLAGS
7215 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
7216 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
7217 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
7218 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.]))
7221 AC_MSG_WARN([Disabling elfhack])
7227 dnl ========================================================
7228 dnl = libstdc++ compatibility hacks
7229 dnl ========================================================
7232 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7233 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7236 if test -n "$STDCXX_COMPAT"; then
7237 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7238 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7239 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7242 dnl ========================================================
7244 dnl = Profiling and Instrumenting
7246 dnl ========================================================
7247 MOZ_ARG_HEADER(Profiling and Instrumenting)
7249 dnl ========================================================
7250 dnl = Enable runtime visual profiling logger
7251 dnl ========================================================
7252 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7253 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7254 MOZ_VISUAL_EVENT_TRACER=1,
7255 MOZ_VISUAL_EVENT_TRACER=)
7256 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7257 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7260 dnl ========================================================
7261 dnl Turn on reflow counting
7262 dnl ========================================================
7263 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7264 [ --enable-reflow-perf Enable reflow performance tracing],
7267 if test -n "$MOZ_REFLOW_PERF"; then
7268 AC_DEFINE(MOZ_REFLOW_PERF)
7271 dnl ========================================================
7272 dnl = Enable Radio Interface for B2G (Gonk usually)
7273 dnl ========================================================
7274 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7275 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7278 if test -n "$MOZ_B2G_RIL"; then
7279 AC_DEFINE(MOZ_B2G_RIL)
7281 AC_SUBST(MOZ_B2G_RIL)
7283 dnl ========================================================
7284 dnl = Enable Radio FM for B2G (Gonk usually)
7285 dnl ========================================================
7286 if test -n "$MOZ_B2G_FM"; then
7287 AC_DEFINE(MOZ_B2G_FM)
7289 AC_SUBST(MOZ_B2G_FM)
7291 dnl ========================================================
7292 dnl = Enable Rtsp Protocol for B2G (Gonk usually)
7293 dnl ========================================================
7294 if test -n "$MOZ_RTSP"; then
7299 dnl ========================================================
7300 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7301 dnl ========================================================
7302 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7303 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7306 if test -n "$MOZ_B2G_BT"; then
7307 AC_DEFINE(MOZ_B2G_BT)
7309 AC_SUBST(MOZ_B2G_BT)
7310 AC_SUBST(MOZ_B2G_BT_BLUEZ)
7311 AC_SUBST(MOZ_B2G_BT_BLUEDROID)
7313 dnl ========================================================
7314 dnl = Enable Pico Speech Synthesis (Gonk usually)
7315 dnl ========================================================
7316 MOZ_ARG_ENABLE_BOOL(synth-pico,
7317 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
7320 if test -n "$MOZ_SYNTH_PICO"; then
7321 AC_DEFINE(MOZ_SYNTH_PICO)
7323 AC_SUBST(MOZ_SYNTH_PICO)
7325 dnl ========================================================
7326 dnl = Enable Support for Time Manager API
7327 dnl ========================================================
7328 if test -n "$MOZ_TIME_MANAGER"; then
7329 AC_DEFINE(MOZ_TIME_MANAGER)
7331 AC_SUBST(MOZ_TIME_MANAGER)
7333 dnl ========================================================
7334 dnl = Enable Camera Interface for B2G (Gonk usually)
7335 dnl ========================================================
7336 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7337 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7340 if test -n "$MOZ_B2G_CAMERA"; then
7341 AC_DEFINE(MOZ_B2G_CAMERA)
7343 AC_SUBST(MOZ_B2G_CAMERA)
7345 dnl ========================================================
7346 dnl = Enable Support B2G-specific changes to the NSS
7347 dnl = certificate trust database.
7348 dnl ========================================================
7349 if test -n "$MOZ_B2G_CERTDATA"; then
7350 AC_DEFINE(MOZ_B2G_CERTDATA)
7352 AC_SUBST(MOZ_B2G_CERTDATA)
7354 dnl ========================================================
7355 dnl = Enable Support for Payment API
7356 dnl ========================================================
7357 if test -n "$MOZ_PAY"; then
7362 dnl ========================================================
7363 dnl = Enable Support for AudioChannelManager API
7364 dnl ========================================================
7365 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7366 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7368 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7370 dnl ========================================================
7371 dnl = Support for demangling undefined symbols
7372 dnl ========================================================
7373 if test -z "$SKIP_LIBRARY_CHECKS"; then
7376 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7380 # Demangle only for debug or trace-malloc or DMD builds
7381 MOZ_DEMANGLE_SYMBOLS=
7382 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7383 MOZ_DEMANGLE_SYMBOLS=1
7384 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7386 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7388 dnl ========================================================
7389 dnl = Support for gcc stack unwinding (from gcc 3.3)
7390 dnl ========================================================
7391 if test -z "$SKIP_LIBRARY_CHECKS"; then
7392 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7395 dnl ========================================================
7397 dnl ========================================================
7399 MOZ_ARG_WITH_STRING(jitreport-granularity,
7400 [ --jitreport-granularity=N
7401 Default granularity at which to report JIT code
7404 1 - code ranges for whole functions only
7405 2 - per-line information
7406 3 - per-op information],
7407 JITREPORT_GRANULARITY=$withval,
7408 JITREPORT_GRANULARITY=3)
7410 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7412 dnl ========================================================
7416 dnl ========================================================
7417 MOZ_ARG_HEADER(Misc. Options)
7419 dnl ========================================================
7420 dnl update xterm title
7421 dnl ========================================================
7422 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7423 [ --enable-xterm-updates Update XTERM titles with current command.],
7427 dnl =========================================================
7429 dnl =========================================================
7430 MOZ_ARG_ENABLE_STRING([chrome-format],
7431 [ --enable-chrome-format=jar|flat|omni
7432 Select FORMAT of chrome files during packaging],
7433 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7435 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7436 MOZ_CHROME_FILE_FORMAT=jar
7439 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7440 AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7443 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7444 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7445 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7446 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7449 dnl =========================================================
7450 dnl Omnijar packaging (bug 552121)
7451 dnl =========================================================
7452 dnl Omnijar packaging is compatible with flat packaging.
7453 dnl In unpackaged builds, omnijar looks for files as if
7454 dnl things were flat packaged. After packaging, all files
7455 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7456 dnl is set to flat since putting files into jars is only
7457 dnl done during packaging with omnijar.
7458 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7460 AC_DEFINE(MOZ_OMNIJAR)
7462 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7463 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7464 MOZ_CHROME_FILE_FORMAT=flat
7466 MOZ_CHROME_FILE_FORMAT=symlink
7469 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7470 dnl Fennec's static resources live in the assets/ folder of the
7471 dnl APK. Adding a path to the name here works because we only
7472 dnl have one omnijar file in the final package (which is not the
7473 dnl case on desktop), and necessitates some contortions during
7474 dnl packaging so that the resources in the omnijar are considered
7475 dnl as rooted at / and not as rooted at assets/ (which again is
7476 dnl not the case on desktop: there are omnijars rooted at webrtc/,
7477 dnl etc). packager.mk handles changing the rooting of the single
7479 OMNIJAR_NAME=assets/omni.ja
7481 OMNIJAR_NAME=omni.ja
7484 AC_SUBST(OMNIJAR_NAME)
7485 AC_SUBST(MOZ_OMNIJAR)
7486 AC_SUBST(MOZ_PACKAGER_FORMAT)
7488 dnl ========================================================
7489 dnl = Define default location for MOZILLA_FIVE_HOME
7490 dnl ========================================================
7491 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7492 [ --with-default-mozilla-five-home
7493 Set the default value for MOZILLA_FIVE_HOME],
7494 [ val=`echo $withval`
7495 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7497 dnl ========================================================
7498 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7499 dnl ========================================================
7500 MOZ_ARG_WITH_STRING(user-appdir,
7501 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7502 [ val=`echo $withval`
7503 if echo "$val" | grep "\/" >/dev/null; then
7504 AC_MSG_ERROR("Homedir must be single relative path.")
7509 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7511 dnl ========================================================
7512 dnl = Doxygen configuration
7513 dnl ========================================================
7514 dnl Use commas to specify multiple dirs to this arg
7515 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7516 MOZ_ARG_WITH_STRING(doc-input-dirs,
7517 [ --with-doc-input-dirs=DIRS
7518 Header/idl dirs to create docs from],
7519 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7520 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7522 dnl Use commas to specify multiple dirs to this arg
7523 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7524 MOZ_ARG_WITH_STRING(doc-include-dirs,
7525 [ --with-doc-include-dirs=DIRS
7526 Include dirs to preprocess doc headers],
7527 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7528 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7530 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7531 MOZ_ARG_WITH_STRING(doc-output-dir,
7532 [ --with-doc-output-dir=DIR
7533 Dir to generate docs into],
7534 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7535 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7537 if test -z "$SKIP_COMPILER_CHECKS"; then
7538 dnl ========================================================
7540 dnl = Compiler Options
7542 dnl ========================================================
7543 MOZ_ARG_HEADER(Compiler Options)
7545 dnl ========================================================
7546 dnl Check for gcc -pipe support
7547 dnl ========================================================
7548 AC_MSG_CHECKING([for -pipe support])
7549 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7550 dnl Any gcc that supports firefox supports -pipe.
7551 CFLAGS="$CFLAGS -pipe"
7552 CXXFLAGS="$CXXFLAGS -pipe"
7553 AC_MSG_RESULT([yes])
7558 dnl ========================================================
7559 dnl Profile guided optimization (gcc checks)
7560 dnl ========================================================
7561 dnl Test for profiling options
7562 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7564 _SAVE_CFLAGS="$CFLAGS"
7565 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7567 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7568 AC_TRY_COMPILE([], [return 0;],
7569 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7570 result="yes" ], result="no")
7571 AC_MSG_RESULT([$result])
7573 if test $result = "yes"; then
7574 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7575 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7576 PROFILE_USE_LDFLAGS="-fprofile-use"
7579 CFLAGS="$_SAVE_CFLAGS"
7581 if test -n "$INTEL_CC"; then
7582 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7583 PROFILE_GEN_LDFLAGS=
7584 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7585 PROFILE_USE_LDFLAGS=
7588 dnl Sun Studio on Solaris
7589 if test "$SOLARIS_SUNPRO_CC"; then
7590 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7591 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7592 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7593 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7596 AC_SUBST(PROFILE_GEN_CFLAGS)
7597 AC_SUBST(PROFILE_GEN_LDFLAGS)
7598 AC_SUBST(PROFILE_USE_CFLAGS)
7599 AC_SUBST(PROFILE_USE_LDFLAGS)
7603 dnl ========================================================
7604 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7605 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7606 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7607 dnl ========================================================
7608 _SAVE_CXXFLAGS=$CXXFLAGS
7609 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7610 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7611 ac_nscap_nonconst_opeq_bug,
7620 template <class T, class U>
7621 int operator==(const Pointer<T>& rhs, U* lhs)
7623 return rhs.myPtr == lhs;
7626 template <class T, class U>
7627 int operator==(const Pointer<T>& rhs, const U* lhs)
7629 return rhs.myPtr == lhs;
7637 ac_nscap_nonconst_opeq_bug="no",
7638 ac_nscap_nonconst_opeq_bug="yes")])
7639 CXXFLAGS="$_SAVE_CXXFLAGS"
7641 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7642 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7644 fi # ! SKIP_COMPILER_CHECKS
7646 AC_DEFINE(CPP_THROW_NEW, [throw()])
7649 if test "$COMPILE_ENVIRONMENT"; then
7651 fi # COMPILE_ENVIRONMENT
7653 dnl ========================================================
7655 dnl = Build depencency options
7657 dnl ========================================================
7658 MOZ_ARG_HEADER(Build dependencies)
7660 if test "$GNU_CC" -a "$GNU_CXX"; then
7661 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7662 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7663 elif test "$SOLARIS_SUNPRO_CC"; then
7666 dnl Don't override this for MSVC
7667 if test -z "$_WIN32_MSVC"; then
7668 _USE_CPP_INCLUDE_FLAG=
7669 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7670 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7672 echo '#include <stdio.h>' > dummy-hello.c
7674 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7676 if test -z "$CL_INCLUDES_PREFIX"; then
7677 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7679 AC_SUBST(CL_INCLUDES_PREFIX)
7684 dnl ========================================================
7686 dnl = Static Build Options
7688 dnl ========================================================
7689 MOZ_ARG_HEADER(Static build options)
7691 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7692 if test "$OS_ARCH" = "WINNT"; then
7696 MOZ_ARG_ENABLE_BOOL(shared-js,
7697 [ --enable-shared-js
7698 Create a shared JavaScript library.],
7702 if test -n "$ENABLE_SHARED_JS"; then
7704 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7706 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7707 AC_DEFINE(MOZ_STATIC_JS)
7709 AC_SUBST(JS_SHARED_LIBRARY)
7711 AC_SUBST(LIBXUL_LIBS)
7712 XPCOM_LIBS="$LIBXUL_LIBS"
7714 dnl ========================================================
7716 dnl = Standalone module options
7718 dnl ========================================================
7719 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7722 dnl ========================================================
7724 if test -z "$SKIP_PATH_CHECKS"; then
7725 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7726 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7727 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7732 if test -z "${GLIB_GMODULE_LIBS}" \
7733 -a -n "${GLIB_CONFIG}"\
7734 -a "${GLIB_CONFIG}" != no\
7736 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7739 AC_SUBST(GLIB_CFLAGS)
7741 AC_SUBST(GLIB_GMODULE_LIBS)
7743 dnl ========================================================
7744 dnl Graphics checks.
7745 dnl ========================================================
7747 if test "${OS_TARGET}" = "WINNT"; then
7748 if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then
7749 MOZ_ENABLE_DIRECT2D1_1=1
7750 AC_SUBST(MOZ_ENABLE_DIRECT2D1_1)
7754 if test "${OS_TARGET}" = "WINNT" -o \
7755 "${OS_ARCH}" = "Darwin" -o \
7756 "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
7757 "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
7758 "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
7759 "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
7760 case "${target_cpu}" in
7772 MOZ_ARG_ENABLE_BOOL(skia,
7773 [ --enable-skia Enable use of Skia],
7777 if test "$USE_FC_FREETYPE"; then
7778 if test "$COMPILE_ENVIRONMENT"; then
7779 dnl ========================================================
7780 dnl = Check for freetype2 and its functionality
7781 dnl ========================================================
7782 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7784 if test "$_HAVE_FREETYPE2"; then
7786 _SAVE_CFLAGS="$CFLAGS"
7787 LIBS="$LIBS $FT2_LIBS"
7788 CFLAGS="$CFLAGS $FT2_CFLAGS"
7790 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7791 ac_cv_member_FT_Bitmap_Size_y_ppem,
7792 [AC_TRY_COMPILE([#include <ft2build.h>
7793 #include FT_FREETYPE_H],
7795 if (sizeof s.y_ppem) return 0;
7797 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7798 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7799 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7800 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7802 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7804 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7805 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7806 [FT_Bitmap_Size structure includes y_ppem field])
7808 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
7811 CFLAGS="$_SAVE_CFLAGS"
7814 _SAVE_CPPFLAGS="$CPPFLAGS"
7815 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7816 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7817 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7818 CPPFLAGS="$_SAVE_CPPFLAGS"
7820 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7823 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
7825 if test "$MOZ_PANGO"; then
7826 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
7827 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
7829 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
7830 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
7835 dnl ========================================================
7836 dnl Check for pixman and cairo
7837 dnl ========================================================
7840 MOZ_ARG_ENABLE_BOOL(system-cairo,
7841 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7846 MOZ_ARG_ENABLE_BOOL(system-pixman,
7847 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7849 MOZ_TREE_PIXMAN=force,
7852 # System cairo depends on system pixman
7853 if test "$MOZ_TREE_PIXMAN" = "force"; then
7854 if test -z "$MOZ_TREE_CAIRO"; then
7855 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7859 elif test -z "$MOZ_TREE_CAIRO"; then
7863 if test "$MOZ_TREE_PIXMAN"; then
7864 AC_DEFINE(MOZ_TREE_PIXMAN)
7865 MOZ_PIXMAN_CFLAGS=""
7866 MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
7868 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
7869 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
7870 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
7872 AC_SUBST(MOZ_PIXMAN_CFLAGS)
7873 AC_SUBST(MOZ_PIXMAN_LIBS)
7875 # Check for headers defining standard int types.
7876 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7878 if test "$MOZ_TREE_CAIRO"; then
7879 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7880 AC_DEFINE(MOZ_TREE_CAIRO)
7882 # For now we assume that we will have a uint64_t available through
7883 # one of the above headers or mozstdint.h.
7884 AC_DEFINE(HAVE_UINT64_T)
7886 # Define macros for cairo-features.h
7887 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
7888 if test "$MOZ_X11"; then
7889 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7890 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7891 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7892 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7893 MOZ_ENABLE_CAIRO_FT=1
7894 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7896 case "$MOZ_WIDGET_TOOLKIT" in
7898 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7901 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7902 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7903 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7906 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7907 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7908 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7909 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7910 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7911 MOZ_ENABLE_D2D_SURFACE=1
7912 MOZ_ENABLE_DWRITE_FONT=1
7914 WIN32_DWRITE_FONT_FEATURE=
7915 WIN32_D2D_SURFACE_FEATURE=
7918 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
7920 dnl D3D10 Layers depend on D2D Surfaces.
7921 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
7922 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
7926 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7927 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7928 MOZ_ENABLE_CAIRO_FT=1
7929 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7930 CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7934 if test "$USE_FC_FREETYPE"; then
7935 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7937 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7938 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
7939 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
7940 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
7941 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
7942 AC_SUBST(CAIRO_FT_CFLAGS)
7944 AC_SUBST(PS_SURFACE_FEATURE)
7945 AC_SUBST(PDF_SURFACE_FEATURE)
7946 AC_SUBST(SVG_SURFACE_FEATURE)
7947 AC_SUBST(XLIB_SURFACE_FEATURE)
7948 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7949 AC_SUBST(QUARTZ_SURFACE_FEATURE)
7950 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7951 AC_SUBST(WIN32_SURFACE_FEATURE)
7952 AC_SUBST(OS2_SURFACE_FEATURE)
7953 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7954 AC_SUBST(FT_FONT_FEATURE)
7955 AC_SUBST(FC_FONT_FEATURE)
7956 AC_SUBST(WIN32_FONT_FEATURE)
7957 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
7958 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
7959 AC_SUBST(QUARTZ_FONT_FEATURE)
7960 AC_SUBST(PNG_FUNCTIONS_FEATURE)
7961 AC_SUBST(QT_SURFACE_FEATURE)
7962 AC_SUBST(TEE_SURFACE_FEATURE)
7964 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
7965 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
7967 if test "$MOZ_X11"; then
7968 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
7971 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7973 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
7974 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
7975 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
7976 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
7977 if test "$MOZ_X11"; then
7978 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7979 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7980 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
7981 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7985 AC_SUBST(MOZ_TREE_CAIRO)
7986 AC_SUBST(MOZ_CAIRO_CFLAGS)
7987 AC_SUBST(MOZ_CAIRO_LIBS)
7988 AC_SUBST(MOZ_CAIRO_OSLIBS)
7989 AC_SUBST(MOZ_TREE_PIXMAN)
7991 dnl ========================================================
7993 dnl ========================================================
7995 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
7998 dnl ========================================================
8000 dnl ========================================================
8001 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8002 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8004 dnl ========================================================
8006 dnl ========================================================
8007 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8008 AC_SUBST(MOZ_GRAPHITE_LIBS)
8010 dnl ========================================================
8012 dnl ========================================================
8013 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8014 AC_SUBST(MOZ_OTS_LIBS)
8016 dnl ========================================================
8018 dnl ========================================================
8019 if test "$MOZ_ENABLE_SKIA"; then
8020 MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8021 AC_DEFINE(MOZ_ENABLE_SKIA)
8023 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8024 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8025 elif test "$OS_ARCH" = "WINNT"; then
8030 if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64"; then
8031 MOZ_ENABLE_SKIA_GPU=1
8032 AC_DEFINE(USE_SKIA_GPU)
8033 AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8038 AC_SUBST(MOZ_ENABLE_SKIA)
8039 AC_SUBST(MOZ_SKIA_LIBS)
8041 dnl ========================================================
8043 dnl ========================================================
8044 MOZ_ARG_DISABLE_BOOL(xul,
8045 [ --disable-xul Disable XUL],
8047 if test "$MOZ_XUL"; then
8050 dnl remove extensions that require XUL
8051 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8056 dnl ========================================================
8057 dnl disable profile locking
8058 dnl do no use this in applications that can have more than
8059 dnl one process accessing the profile directory.
8060 dnl ========================================================
8061 MOZ_ARG_DISABLE_BOOL(profilelocking,
8062 [ --disable-profilelocking
8063 Disable profile locking],
8064 MOZ_PROFILELOCKING=,
8065 MOZ_PROFILELOCKING=1 )
8066 if test "$MOZ_PROFILELOCKING"; then
8067 AC_DEFINE(MOZ_PROFILELOCKING)
8070 dnl ========================================================
8071 dnl necko configuration options
8072 dnl ========================================================
8075 dnl option to disable various necko protocols
8077 MOZ_ARG_ENABLE_STRING(necko-protocols,
8078 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8079 Enable/disable specific protocol handlers],
8080 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8081 if test "$option" = "yes" -o "$option" = "all"; then
8082 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8083 elif test "$option" = "no" -o "$option" = "none"; then
8085 elif test "$option" = "default"; then
8086 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8087 elif test `echo "$option" | grep -c \^-` != 0; then
8088 option=`echo $option | sed 's/^-//'`
8089 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8091 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8094 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8096 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8097 AC_SUBST(NECKO_PROTOCOLS)
8098 for p in $NECKO_PROTOCOLS; do
8099 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8100 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8104 dnl option to disable necko's wifi scanner
8107 case "$OS_TARGET" in
8109 if test -n "$gonkdir"; then
8122 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8123 [ --disable-necko-wifi Disable necko wifi scanner],
8127 if test "$NECKO_WIFI"; then
8128 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
8129 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
8131 AC_DEFINE(NECKO_WIFI)
8132 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8134 AC_SUBST(NECKO_WIFI)
8135 AC_SUBST(NECKO_WIFI_DBUS)
8138 dnl option to disable cookies
8140 MOZ_ARG_DISABLE_BOOL(cookies,
8141 [ --disable-cookies Disable cookie support],
8144 AC_SUBST(NECKO_COOKIES)
8145 if test "$NECKO_COOKIES"; then
8146 AC_DEFINE(NECKO_COOKIES)
8147 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8151 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8153 MOZ_ARG_DISABLE_BOOL(ctypes,
8154 [ --disable-ctypes Disable js-ctypes],
8157 AC_SUBST(BUILD_CTYPES)
8158 if test "$BUILD_CTYPES"; then
8159 AC_DEFINE(BUILD_CTYPES)
8162 dnl Build Places if required
8163 if test "$MOZ_PLACES"; then
8164 AC_DEFINE(MOZ_PLACES)
8167 dnl Build SocialAPI if required
8168 if test "$MOZ_SOCIAL"; then
8169 AC_DEFINE(MOZ_SOCIAL)
8172 dnl Build Common JS modules provided by services.
8173 AC_SUBST(MOZ_SERVICES_COMMON)
8174 if test -n "$MOZ_SERVICES_COMMON"; then
8175 AC_DEFINE(MOZ_SERVICES_COMMON)
8178 dnl Build Services crypto component (used by Sync)
8179 AC_SUBST(MOZ_SERVICES_CRYPTO)
8180 if test -n "$MOZ_SERVICES_CRYPTO"; then
8181 AC_DEFINE(MOZ_SERVICES_CRYPTO)
8184 dnl Build Firefox Health Reporter Service
8185 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8186 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8187 AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8190 dnl Build Services metrics component
8191 AC_SUBST(MOZ_SERVICES_METRICS)
8192 if test -n "$MOZ_SERVICES_METRICS"; then
8193 AC_DEFINE(MOZ_SERVICES_METRICS)
8196 dnl Build Notifications if required
8197 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8198 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8199 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8202 dnl Build Sync Services if required
8203 AC_SUBST(MOZ_SERVICES_SYNC)
8204 if test -n "$MOZ_SERVICES_SYNC"; then
8205 AC_DEFINE(MOZ_SERVICES_SYNC)
8208 dnl Build Captive Portal Detector if required
8209 AC_SUBST(MOZ_CAPTIVEDETECT)
8210 if test -n "$MOZ_CAPTIVEDETECT"; then
8211 AC_DEFINE(MOZ_CAPTIVEDETECT)
8214 dnl ========================================================
8215 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8216 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8219 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8220 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8223 if test "$MOZ_APP_COMPONENT_MODULES"; then
8224 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8227 dnl ========================================================
8229 dnl = Maintainer debug option (no --enable equivalent)
8231 dnl ========================================================
8236 AC_SUBST(AR_EXTRACT)
8240 AC_SUBST(AS_DASH_C_FLAG)
8249 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8250 AC_SUBST(MOZ_UPDATE_XTERM)
8251 AC_SUBST(MOZ_AUTH_EXTENSION)
8252 AC_SUBST(MOZ_PERMISSIONS)
8253 AC_SUBST(MOZ_PREF_EXTENSIONS)
8254 AC_SUBST(MOZ_JS_LIBS)
8256 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8257 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8258 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8259 AC_SUBST(MOZ_DEBUG_FLAGS)
8260 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8261 AC_SUBST(WARNINGS_AS_ERRORS)
8262 AC_SUBST(MOZ_EXTENSIONS)
8263 AC_SUBST(MOZ_JSDEBUGGER)
8264 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8267 AC_SUBST(MOZ_INSTRUMENTS)
8268 AC_SUBST(MOZ_CALLGRIND)
8270 AC_SUBST(MOZ_PROFILING)
8272 AC_SUBST(MOZ_PLACES)
8273 AC_SUBST(MOZ_SOCIAL)
8274 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8276 AC_SUBST(NS_PRINTING)
8278 AC_SUBST(MOZ_HELP_VIEWER)
8279 AC_SUBST(TOOLCHAIN_PREFIX)
8288 AC_SUBST(MOZ_PROFILELOCKING)
8290 AC_SUBST(ENABLE_TESTS)
8291 AC_SUBST(ENABLE_MARIONETTE)
8293 AC_SUBST(MOZ_UNIVERSALCHARDET)
8294 AC_SUBST(ACCESSIBILITY)
8295 AC_SUBST(MOZ_SPELLCHECK)
8296 AC_SUBST(MOZ_ANDROID_OMTC)
8297 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8298 AC_SUBST(MOZ_CRASHREPORTER)
8299 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8300 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8301 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8302 AC_SUBST(MOZ_STUB_INSTALLER)
8303 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8304 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8305 AC_SUBST(MOZ_UPDATER)
8306 AC_SUBST(MOZ_ANGLE_RENDERER)
8307 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8308 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8309 AC_SUBST(MOZ_D3DX9_VERSION)
8310 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8311 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8314 AC_SUBST(MOZ_ANDROID_HISTORY)
8315 AC_SUBST(MOZ_WEBSMS_BACKEND)
8316 AC_SUBST(MOZ_ANDROID_BEAM)
8317 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
8318 AC_SUBST(ENABLE_STRIP)
8319 AC_SUBST(PKG_SKIP_STRIP)
8320 AC_SUBST(STRIP_FLAGS)
8321 AC_SUBST(USE_ELF_DYNSTR_GC)
8322 AC_SUBST(USE_ELF_HACK)
8323 AC_SUBST(INCREMENTAL_LINKER)
8324 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8325 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8327 AC_SUBST(MOZ_FIX_LINK_PATHS)
8328 AC_SUBST(XPCOM_LIBS)
8329 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8330 AC_SUBST(XPCOM_GLUE_LDOPTS)
8331 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8332 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8333 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8335 AC_SUBST(USE_DEPENDENT_LIBS)
8337 AC_SUBST(MOZ_BUILD_ROOT)
8338 AC_SUBST(MOZ_OS2_TOOLS)
8340 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8341 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8342 AC_SUBST(MOZ_LINKER_EXTRACT)
8344 AC_SUBST(MOZ_JSDOWNLOADS)
8345 if test -n "$MOZ_JSDOWNLOADS"; then
8346 AC_DEFINE(MOZ_JSDOWNLOADS)
8349 dnl ========================================================
8350 dnl = Mac bundle name prefix
8351 dnl ========================================================
8352 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8353 [ --with-macbundlename-prefix=prefix
8354 Prefix for MOZ_MACBUNDLE_NAME],
8355 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8357 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8358 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8359 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8362 if test "$MOZ_DEBUG"; then
8363 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8365 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8367 AC_SUBST(MOZ_MACBUNDLE_NAME)
8369 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8370 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8371 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8372 if test "$MOZ_DEBUG"; then
8373 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8376 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8377 AC_SUBST(MOZ_MACBUNDLE_ID)
8379 dnl ========================================================
8380 dnl = Child Process Name for IPC
8381 dnl ========================================================
8382 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8383 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8385 # We want to let Android unpack the file at install time, but it only does
8386 # so if the file is named libsomething.so. The lib/ path is also required
8387 # because the unpacked file will be under the lib/ subdirectory and will
8388 # need to be executed from that path.
8389 MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8391 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8393 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8394 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8396 # The following variables are available to branding and application
8397 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8398 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8399 # impacts profile location and user-visible fields.
8400 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8401 # versions of a given application (e.g. Aurora and Firefox both use
8402 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8403 # for application.ini's "Name" field, which controls profile location in
8404 # the absence of a "Profile" field (see below), and various system
8405 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8406 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8407 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8408 # builds (e.g. Aurora for Firefox).
8409 # - MOZ_APP_VERSION: Defines the application version number.
8410 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8411 # defaults to a lowercase form of MOZ_APP_BASENAME.
8412 # - MOZ_APP_PROFILE: When set, used for application.ini's
8413 # "Profile" field, which controls profile location.
8414 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8415 # crash reporter server url.
8416 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8417 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8419 if test -z "$MOZ_APP_NAME"; then
8420 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8423 # For extensions and langpacks, we require a max version that is compatible
8424 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8425 # 10.0a1 and 10.0a2 aren't affected
8426 # 10.0 becomes 10.0.*
8427 # 10.0.1 becomes 10.0.*
8428 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8429 if test -z "$IS_ALPHA"; then
8431 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8434 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8437 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8438 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8439 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8441 AC_SUBST(MOZ_APP_NAME)
8442 AC_SUBST(MOZ_APP_DISPLAYNAME)
8443 AC_SUBST(MOZ_APP_BASENAME)
8444 AC_SUBST(MOZ_APP_VENDOR)
8445 AC_SUBST(MOZ_APP_PROFILE)
8446 AC_SUBST(MOZ_APP_ID)
8447 AC_SUBST(MAR_CHANNEL_ID)
8448 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8449 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8450 AC_SUBST(MOZ_EXTENSION_MANAGER)
8451 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8452 AC_SUBST(MOZ_APP_UA_NAME)
8453 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8454 AC_SUBST(MOZ_APP_VERSION)
8455 AC_SUBST(MOZ_APP_MAXVERSION)
8456 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8457 AC_SUBST(FIREFOX_VERSION)
8458 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8459 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8460 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8463 AC_SUBST(MOZ_APP_STATIC_INI)
8465 AC_SUBST(MOZ_PKG_SPECIAL)
8467 AC_SUBST(MOZILLA_OFFICIAL)
8469 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8470 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8472 if test "$MOZ_TELEMETRY_REPORTING"; then
8473 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8475 # Enable Telemetry by default for nightly and aurora channels
8476 if test -z "$RELEASE_BUILD"; then
8477 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8481 dnl If we have any service that uploads data (and requires data submission
8482 dnl policy alert), set MOZ_DATA_REPORTING.
8483 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8484 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8485 MOZ_DATA_REPORTING=1
8486 AC_DEFINE(MOZ_DATA_REPORTING)
8487 AC_SUBST(MOZ_DATA_REPORTING)
8491 AC_SUBST(MOZ_BROWSE_INFO)
8492 AC_SUBST(MOZ_TOOLS_DIR)
8493 AC_SUBST(WIN32_REDIST_DIR)
8496 dnl Echo the CFLAGS to remove extra whitespace.
8502 $_WARNINGS_CXXFLAGS \
8505 COMPILE_CFLAGS=`echo \
8510 COMPILE_CXXFLAGS=`echo \
8511 $_DEFINES_CXXFLAGS \
8519 HOST_CXXFLAGS=`echo \
8523 AC_SUBST(SYSTEM_LIBXUL)
8524 AC_SUBST(MOZ_NATIVE_JPEG)
8525 AC_SUBST(MOZ_NATIVE_PNG)
8526 AC_SUBST(MOZ_NATIVE_BZ2)
8528 AC_SUBST(MOZ_JPEG_CFLAGS)
8529 AC_SUBST(MOZ_JPEG_LIBS)
8530 AC_SUBST(MOZ_BZ2_CFLAGS)
8531 AC_SUBST(MOZ_BZ2_LIBS)
8532 AC_SUBST(MOZ_PNG_CFLAGS)
8533 AC_SUBST(MOZ_PNG_LIBS)
8535 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
8536 export MOZ_NUWA_PROCESS
8537 AC_DEFINE(MOZ_NUWA_PROCESS)
8539 AC_SUBST(MOZ_NUWA_PROCESS)
8541 AC_SUBST(NSPR_CFLAGS)
8543 AC_SUBST(MOZ_NATIVE_NSPR)
8545 AC_SUBST(NSS_CFLAGS)
8547 AC_SUBST(MOZ_NATIVE_NSS)
8548 AC_SUBST(NSS_DISABLE_DBM)
8551 OS_CXXFLAGS="$CXXFLAGS"
8552 OS_CPPFLAGS="$CPPFLAGS"
8553 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8554 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8555 OS_LDFLAGS="$LDFLAGS"
8558 AC_SUBST(OS_CXXFLAGS)
8559 AC_SUBST(OS_CPPFLAGS)
8560 AC_SUBST(OS_COMPILE_CFLAGS)
8561 AC_SUBST(OS_COMPILE_CXXFLAGS)
8562 AC_SUBST(OS_LDFLAGS)
8564 AC_SUBST(CROSS_COMPILE)
8565 AC_SUBST(WCHAR_CFLAGS)
8569 AC_SUBST(HOST_CFLAGS)
8570 AC_SUBST(HOST_CXXFLAGS)
8571 AC_SUBST(HOST_LDFLAGS)
8572 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8574 AC_SUBST(HOST_AR_FLAGS)
8576 AC_SUBST(HOST_RANLIB)
8577 AC_SUBST(HOST_NSPR_MDCPUCFG)
8578 AC_SUBST(HOST_BIN_SUFFIX)
8579 AC_SUBST(HOST_OS_ARCH)
8581 AC_SUBST(TARGET_CPU)
8582 AC_SUBST(TARGET_VENDOR)
8584 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8585 AC_SUBST(TARGET_MD_ARCH)
8586 AC_SUBST(TARGET_XPCOM_ABI)
8589 AC_SUBST(OS_RELEASE)
8592 AC_SUBST(INTEL_ARCHITECTURE)
8593 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
8594 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
8596 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8598 AC_SUBST(WRAP_LDFLAGS)
8601 AC_SUBST(MKSHLIB_FORCE_ALL)
8602 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8603 AC_SUBST(DSO_CFLAGS)
8604 AC_SUBST(DSO_PIC_CFLAGS)
8605 AC_SUBST(DSO_LDOPTS)
8606 AC_SUBST(LIB_PREFIX)
8607 AC_SUBST(DLL_PREFIX)
8608 AC_SUBST(DLL_SUFFIX)
8609 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8610 AC_SUBST(LIB_SUFFIX)
8611 AC_SUBST(OBJ_SUFFIX)
8612 AC_SUBST(BIN_SUFFIX)
8613 AC_SUBST(ASM_SUFFIX)
8614 AC_SUBST(IMPORT_LIB_SUFFIX)
8616 AC_SUBST(CC_VERSION)
8617 AC_SUBST(CXX_VERSION)
8618 AC_SUBST(MSMANIFEST_TOOL)
8619 AC_SUBST(NS_ENABLE_TSF)
8620 AC_SUBST(MOZ_NSS_PATCH)
8621 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8622 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8624 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8625 AC_SUBST(MOZ_SOUNDTOUCH)
8628 AC_SUBST(MOZ_VORBIS)
8629 AC_SUBST(MOZ_TREMOR)
8634 AC_SUBST(MOZ_DIRECTSHOW)
8635 AC_SUBST(MOZ_MEDIA_PLUGINS)
8636 AC_SUBST(MOZ_APPLEMEDIA)
8637 AC_SUBST(MOZ_OMX_PLUGIN)
8638 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8639 AC_SUBST(MOZ_VP8_ENCODER)
8643 AC_SUBST(VPX_ASFLAGS)
8644 AC_SUBST(VPX_DASH_C_FLAG)
8645 AC_SUBST(VPX_AS_CONVERSION)
8646 AC_SUBST(VPX_ASM_SUFFIX)
8647 AC_SUBST(VPX_X86_ASM)
8648 AC_SUBST(VPX_ARM_ASM)
8649 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8650 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8651 AC_SUBST(LIBJPEG_TURBO_AS)
8652 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8653 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8654 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8655 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8657 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8658 AC_SUBST(MOZ_FOLD_LIBS)
8660 AC_SUBST(MOZ_ENABLE_SZIP)
8661 AC_SUBST(MOZ_SZIP_FLAGS)
8663 AC_MSG_CHECKING([for posix_fallocate])
8664 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8665 #include <fcntl.h>],
8666 [posix_fallocate(0, 0, 0);],
8667 [ac_cv___posix_fallocate=true],
8668 [ac_cv___posix_fallocate=false])
8670 if test "$ac_cv___posix_fallocate" = true ; then
8671 AC_DEFINE(HAVE_POSIX_FALLOCATE)
8677 dnl Check for missing components
8678 if test "$COMPILE_ENVIRONMENT"; then
8679 if test "$MOZ_X11"; then
8680 if test "$WITHOUT_X11"; then
8681 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8683 dnl ====================================================
8684 dnl = Check if X headers exist
8685 dnl ====================================================
8686 _SAVE_CFLAGS=$CFLAGS
8687 CFLAGS="$CFLAGS $XCFLAGS"
8691 #include <X11/Xlib.h>
8692 #include <X11/Intrinsic.h>
8693 #include <X11/extensions/XShm.h>
8697 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8698 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8702 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8703 CFLAGS="$_SAVE_CFLAGS"
8705 if test -n "$MISSING_X"; then
8706 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8711 dnl Check for headers, etc. needed by WebGL.
8712 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8713 MOZ_CHECK_HEADER(GL/glx.h)
8714 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8715 AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa-devel (openSUSE))])
8717 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8718 fi # COMPILE_ENVIRONMENT
8720 dnl Set various defines and substitutions
8721 dnl ========================================================
8723 if test "$OS_ARCH" = "Darwin"; then
8725 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8729 if test "$MOZ_DEBUG"; then
8730 AC_DEFINE(MOZ_REFLOW_PERF)
8731 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8734 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
8735 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8736 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8737 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8738 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8739 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8740 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8741 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8742 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8745 AC_SUBST(MOZILLA_VERSION)
8747 AC_SUBST(ac_configure_args)
8749 dnl Spit out some output
8750 dnl ========================================================
8752 dnl The following defines are used by xpcom
8753 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8755 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8756 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8757 HAVE_CPP_PARTIAL_SPECIALIZATION
8758 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8759 NEED_CPP_UNUSED_IMPLEMENTATIONS
8762 HAVE_ICONV_WITH_CONST_INPUT
8775 # FUTURE? Consider moving all these to moz.build files.
8777 netwerk/necko-config.h
8778 xpcom/xpcom-config.h
8779 xpcom/xpcom-private.h
8782 AC_SUBST(STLPORT_LIBS)
8784 export WRITE_MOZINFO=1
8785 AC_OUTPUT([mozilla-config.h])
8788 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8789 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8790 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8791 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8792 # (apparently) only need this hack when egrep's "pattern" is particularly long
8793 # (as in the following code) and the first egrep on our $PATH is Apple's. See
8797 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8804 # Generate Makefiles for WebRTC directly from .gyp files
8805 if test "${OS_TARGET}" = "WINNT"; then
8806 if test "$HAVE_64BIT_OS"; then
8811 EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
8813 elif test "${OS_TARGET}" = "Android"; then
8814 if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
8815 EXTRA_GYP_DEFINES="-G os=linux "
8817 EXTRA_GYP_DEFINES="-D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
8821 if test -n "$ARM_ARCH"; then
8822 if test "$ARM_ARCH" -lt 7; then
8823 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
8825 if test "${OS_TARGET}" = "Android"; then
8826 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=1 "
8828 dnl CPU detection for ARM works on Android only. armv7 always uses CPU detection, so
8829 dnl we have to set armv7=0 for non-Android target
8830 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
8835 # Keep libcubeb and audio_device backends in sync
8836 if test -n "$MOZ_ALSA"; then
8837 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=1"
8839 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=0"
8841 if test -n "$MOZ_PULSEAUDIO"; then
8842 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=1"
8844 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=0"
8847 # Don't try to compile ssse3/sse4.1 code if toolchain doesn't support
8848 if test -n "$INTEL_ARCHITECTURE"; then
8849 if test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSSE3" -o -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
8850 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
8854 if test -n "$MOZ_WEBRTC"; then
8855 AC_MSG_RESULT("generating WebRTC Makefiles...")
8857 if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
8858 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D build_with_gonk=1"
8861 dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
8862 dnl so that regeneration via dependencies works correctly
8863 WEBRTC_CONFIG="-D build_with_mozilla=1 -D build_with_chromium=0 --include ${srcdir}/media/webrtc/webrtc_config.gypi -D FORCED_INCLUDE_FILE=${srcdir}/media/webrtc/webrtc_config.gypi"
8865 if test -n HAVE_CLOCK_MONOTONIC; then
8866 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=1"
8868 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=0"
8871 if test -n "$MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI"; then
8872 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_ethtool_cmd_speed_hi=1"
8874 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_ethtool_cmd_speed_hi=0"
8877 GYP_WEBRTC_OPTIONS="--format=mozmake ${WEBRTC_CONFIG} -D target_arch=${WEBRTC_TARGET_ARCH} ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
8879 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8880 $GYP_WEBRTC_OPTIONS \
8881 --generator-output=${_objdir}/media/webrtc/trunk \
8882 ${srcdir}/media/webrtc/trunk/peerconnection.gyp
8883 if test "$?" != 0; then
8884 AC_MSG_ERROR([failed to generate WebRTC Makefiles])
8887 # XXX disable until we land the tranche with signaling
8888 if test -n "$MOZ_WEBRTC_SIGNALING"; then
8889 AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
8890 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8891 $GYP_WEBRTC_OPTIONS \
8892 -D build_for_test=0 \
8893 --generator-output=${_objdir}/media/webrtc/signaling \
8894 ${srcdir}/media/webrtc/signaling/signaling.gyp
8895 if test "$?" != 0; then
8896 AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
8899 AC_MSG_RESULT("generating WebRTC/SignalingTest Makefiles...")
8900 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8901 $GYP_WEBRTC_OPTIONS \
8902 -D build_for_test=1 \
8903 --generator-output=${_objdir}/media/webrtc/signalingtest \
8904 ${srcdir}/media/webrtc/signaling/signaling.gyp
8905 if test "$?" != 0; then
8906 AC_MSG_ERROR([failed to generate WebRTC/SignalingTest Makefiles])
8910 AC_MSG_RESULT("generating gtest Makefiles...")
8911 # Ok to pass some extra -D's that are ignored here
8912 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8913 $GYP_WEBRTC_OPTIONS \
8914 --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
8915 ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
8916 if test "$?" != 0; then
8917 AC_MSG_ERROR([failed to generate gtest Makefiles])
8920 AC_MSG_RESULT("generating nrappkit Makefiles...")
8921 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8922 $GYP_WEBRTC_OPTIONS \
8923 --generator-output=${_objdir}/media/mtransport/third_party/nrappkit \
8924 ${srcdir}/media/mtransport/third_party/nrappkit/nrappkit.gyp
8925 if test "$?" != 0; then
8926 AC_MSG_ERROR([failed to generate nrappkit Makefiles])
8929 AC_MSG_RESULT("generating nICEr Makefiles...")
8930 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8931 $GYP_WEBRTC_OPTIONS \
8932 --generator-output=${_objdir}/media/mtransport/third_party/nICEr \
8933 ${srcdir}/media/mtransport/third_party/nICEr/nicer.gyp
8934 if test "$?" != 0; then
8935 AC_MSG_ERROR([failed to generate nICEr Makefiles])
8939 # Run jemalloc configure script
8941 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
8942 ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
8943 if test -n "$MOZ_REPLACE_MALLOC"; then
8944 # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
8945 ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
8946 ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
8948 if test -n "$MOZ_JEMALLOC3"; then
8949 case "${OS_ARCH}" in
8951 # We want jemalloc functions to be kept hidden on both Mac and Windows
8952 # See memory/build/mozmemory_wrap.h for details.
8953 ac_configure_args="$ac_configure_args --without-export"
8956 elif test "${OS_ARCH}" = Darwin; then
8957 # When building as a replace-malloc lib, disabling the zone allocator
8958 # forces to use pthread_atfork.
8959 ac_configure_args="$ac_configure_args --disable-zone-allocator"
8961 _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
8963 if test -z "$MOZ_REPLACE_MALLOC"; then
8965 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
8969 elif test -z "$MOZ_JEMALLOC3"; then
8971 JEMALLOC_WRAPPER=replace_
8973 if test -n "$MANGLE"; then
8975 if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
8976 JEMALLOC_WRAPPER=__wrap_
8978 for mangle in ${MANGLE}; do
8979 if test -n "$MANGLED"; then
8980 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
8982 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
8985 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
8988 if test -z "$MOZ_TLS"; then
8989 ac_configure_args="$ac_configure_args --disable-tls"
8991 EXTRA_CFLAGS="$CFLAGS"
8992 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
8993 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
8995 if test "$CROSS_COMPILE"; then
8996 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
8998 _save_cache_file="$cache_file"
8999 cache_file=$_objdir/memory/jemalloc/src/config.cache
9001 if ! test -e memory/jemalloc; then
9002 mkdir -p memory/jemalloc
9005 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9006 cache_file="$_save_cache_file"
9007 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9010 # Run freetype configure script
9012 if test "$MOZ_TREE_FREETYPE"; then
9013 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9014 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9015 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9016 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9017 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9018 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --without-png"
9020 if ! test -e modules; then
9024 AC_OUTPUT_SUBDIRS(modules/freetype2)
9027 if test -z "$direct_nspr_config"; then
9028 dnl ========================================================
9029 dnl = Setup a nice relatively clean build environment for
9030 dnl = sub-configures.
9031 dnl ========================================================
9034 CFLAGS="$_SUBDIR_CFLAGS"
9035 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9036 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9037 LDFLAGS="$_SUBDIR_LDFLAGS"
9038 HOST_CC="$_SUBDIR_HOST_CC"
9039 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9040 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9047 # Run all configure scripts specified by a subconfigure
9048 if test -n "$_subconfigure_subdir"; then
9049 _save_ac_configure_args="$ac_configure_args"
9050 ac_configure_args="$_subconfigure_config_args"
9051 AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
9052 ac_configure_args="$_save_ac_configure_args"
9055 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9056 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9060 if test -n "$_WRAP_MALLOC"; then
9061 # Avoid doubling wrap malloc arguments
9062 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9065 if test -z "$MOZ_NATIVE_NSPR"; then
9066 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9067 if test -z "$MOZ_DEBUG"; then
9068 ac_configure_args="$ac_configure_args --disable-debug"
9070 ac_configure_args="$ac_configure_args --enable-debug"
9072 if test "$MOZ_OPTIMIZE" = "1"; then
9073 ac_configure_args="$ac_configure_args --enable-optimize"
9074 elif test -z "$MOZ_OPTIMIZE"; then
9075 ac_configure_args="$ac_configure_args --disable-optimize"
9077 if test -n "$HAVE_64BIT_OS"; then
9078 ac_configure_args="$ac_configure_args --enable-64bit"
9080 if test -n "$USE_ARM_KUSER"; then
9081 ac_configure_args="$ac_configure_args --with-arm-kuser"
9083 ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9085 # Save these, so we can mess with them for the subconfigure ..
9086 _SAVE_CFLAGS="$CFLAGS"
9087 _SAVE_CPPFLAGS="$CPPFLAGS"
9088 _SAVE_LDFLAGS="$LDFLAGS"
9090 if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9091 # dladdr is supported by the new linker, even when the system linker doesn't
9092 # support it. Trick nspr into using dladdr when it's not supported.
9093 export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9095 export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9096 export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
9098 AC_OUTPUT_SUBDIRS(nsprpub)
9100 # .. and restore them
9104 CFLAGS="$_SAVE_CFLAGS"
9105 CPPFLAGS="$_SAVE_CPPFLAGS"
9106 LDFLAGS="$_SAVE_LDFLAGS"
9108 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9111 dnl ========================================================
9112 dnl = Setup a nice relatively clean build environment for
9113 dnl = sub-configures.
9114 dnl ========================================================
9117 CFLAGS="$_SUBDIR_CFLAGS"
9118 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9119 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9120 LDFLAGS="$_SUBDIR_LDFLAGS"
9121 HOST_CC="$_SUBDIR_HOST_CC"
9122 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9123 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9126 if test -n "$ENABLE_CLANG_PLUGIN"; then
9127 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9128 AC_OUTPUT_SUBDIRS(build/clang-plugin)
9132 # Run the SpiderMonkey 'configure' script.
9133 dist=$MOZ_BUILD_ROOT/dist
9134 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9135 ac_configure_args="$ac_configure_args --enable-threadsafe"
9137 MOZ_ARG_WITH_STRING(intl-api,
9138 [ --with-intl-api, --with-intl-api=build, --without-intl-api
9139 Determine the status of the ECMAScript Internationalization API. The first
9140 (or lack of any of these) builds and exposes the API. The second builds it
9141 but doesn't use ICU or expose the API to script. The third doesn't build
9143 WITH_INTL="--with-intl-api=$withval"
9145 if test -z "$WITH_INTL"; then
9146 if test "$MOZ_BUILD_APP" = "browser"; then
9147 WITH_INTL="--with-intl-api"
9149 # Internationalization isn't built or exposed by default in non-desktop
9150 # builds. Bugs to enable:
9152 # Android: bug 864843
9154 WITH_INTL="--without-intl-api"
9157 ac_configure_args="$ac_configure_args $WITH_INTL"
9159 if test "$BUILD_CTYPES"; then
9160 # Build js-ctypes on the platforms we can.
9161 ac_configure_args="$ac_configure_args --enable-ctypes"
9163 if test -z "$JS_SHARED_LIBRARY" ; then
9164 ac_configure_args="$ac_configure_args --disable-shared-js"
9165 if test -n "$MOZ_DISABLE_EXPORT_JS"; then
9166 ac_configure_args="$ac_configure_args --disable-export-js"
9169 if test -z "$MOZ_NATIVE_NSPR"; then
9170 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9171 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9173 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9174 ac_configure_args="$ac_configure_args --prefix=$dist"
9175 if test "$MOZ_MEMORY"; then
9176 ac_configure_args="$ac_configure_args --enable-jemalloc"
9178 if test -n "$MOZ_GLUE_LDFLAGS"; then
9179 export MOZ_GLUE_LDFLAGS
9181 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9182 export MOZ_GLUE_PROGRAM_LDFLAGS
9184 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9187 export MOZ_NATIVE_ZLIB
9188 export MOZ_ZLIB_CFLAGS
9189 export MOZ_ZLIB_LIBS
9191 export DONT_POPULATE_VIRTUALENV=1
9193 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9194 export STLPORT_CPPFLAGS
9195 export STLPORT_LDFLAGS
9197 export JS_STANDALONE=no
9200 if ! test -e js; then
9204 AC_OUTPUT_SUBDIRS(js/src)
9205 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9207 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR