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
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 a separate objdir build if a srcdir build exists.
90 dnl ==============================================================
91 _topsrcdir=`cd \`dirname $0\`; pwd`
94 if test "$_topsrcdir" != "$_objdir"
96 # Check for a couple representative files in the source tree
98 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
99 if test -f $file; then
100 _conflict_files="$_conflict_files $file"
103 if test "$_conflict_files"; then
105 echo "* Your source tree contains these files:"
106 for file in $_conflict_files; do
110 * This indicates that you previously built in the source tree.
111 * A source tree build can confuse the separate objdir build.
113 * To clean up the source tree:
128 COMPILE_ENVIRONMENT=1
129 MOZ_ARG_DISABLE_BOOL(compile-environment,
130 [ --disable-compile-environment
131 Disable compiler/library checks.],
132 COMPILE_ENVIRONMENT= )
133 AC_SUBST(COMPILE_ENVIRONMENT)
135 MOZ_ARG_WITH_STRING(l10n-base,
136 [ --with-l10n-base=DIR path to l10n repositories],
137 L10NBASEDIR=$withval)
138 if test -n "$L10NBASEDIR"; then
139 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
140 AC_MSG_ERROR([--with-l10n-base must specify a path])
141 elif test -d "$L10NBASEDIR"; then
142 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
144 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
147 AC_SUBST(L10NBASEDIR)
149 dnl Check for Perl first -- needed for win32 SDK checks
150 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
151 if test -z "$PERL" -o "$PERL" = ":"; then
152 AC_MSG_ERROR([perl not found in \$PATH])
156 if test -n "$GAIADIR" ; then
157 AC_DEFINE(PACKAGE_GAIA)
160 MOZ_ARG_WITH_STRING(gonk,
162 location of gonk dir],
165 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
166 [ --with-gonk-toolchain-prefix=DIR
167 prefix to gonk toolchain commands],
168 gonk_toolchain_prefix=$withval)
170 if test -n "$gonkdir" ; then
171 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
172 android_source="$gonkdir"
173 ANDROID_SOURCE="$android_source"
174 ANDROID_NDK="${ANDROID_SOURCE}/ndk"
177 if test -n "${PLATFORM_SDK_VERSION}"; then
178 ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
182 TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
183 AS="$gonk_toolchain_prefix"as
184 CC="$gonk_toolchain_prefix"gcc
185 CXX="$gonk_toolchain_prefix"g++
186 CPP="$gonk_toolchain_prefix"cpp
187 LD="$gonk_toolchain_prefix"ld
188 AR="$gonk_toolchain_prefix"ar
189 RANLIB="$gonk_toolchain_prefix"ranlib
190 STRIP="$gonk_toolchain_prefix"strip
191 OBJCOPY="$gonk_toolchain_prefix"objcopy
193 if ! test -e "$gonkdir/ndk/sources/cxx-stl/stlport/src/iostream.cpp"; then
194 AC_MSG_ERROR([Couldn't find path to stlport sources in the gonk tree])
196 STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include"
197 STLPORT_LIBS="$_objdir/build/stlport/libstlport_static.a"
199 case "$target_cpu" in
208 case "$ANDROID_VERSION" in
210 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"
214 AC_DEFINE(MOZ_OMX_DECODER)
215 AC_SUBST(MOZ_OMX_DECODER)
218 GONK_INCLUDES="-I$gonkdir/frameworks/native/include"
219 if test -d "$gonkdir/external/bluetooth/bluez"; then
220 GONK_INCLUDES+=" -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
225 AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
228 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"
229 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
230 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
231 dnl Add -llog by default, since we use it all over the place.
234 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"
236 dnl prevent cross compile section from using these flags as host flags
237 if test -z "$HOST_CPPFLAGS" ; then
240 if test -z "$HOST_CFLAGS" ; then
243 if test -z "$HOST_CXXFLAGS" ; then
246 if test -z "$HOST_LDFLAGS" ; then
251 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
252 AC_SUBST(ANDROID_VERSION)
253 AC_DEFINE(HAVE_SYS_UIO_H)
254 AC_DEFINE(HAVE_PTHREADS)
256 MOZ_CHROME_FILE_FORMAT=omni
262 *-android*|*-linuxandroid*)
263 if test -z "$ANDROID_PACKAGE_NAME" ; then
264 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
266 MOZ_CHROME_FILE_FORMAT=omni
270 AC_PATH_PROG(OBJCOPY,objcopy)
275 AC_SUBST(ANDROID_SOURCE)
276 AC_SUBST(ANDROID_PACKAGE_NAME)
279 dnl ========================================================
280 dnl Checks for compilers.
281 dnl ========================================================
282 dnl Set CROSS_COMPILE in the environment when running configure
283 dnl to use the cross-compile setup for now
284 dnl ========================================================
286 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
289 if test "$COMPILE_ENVIRONMENT"; then
291 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
297 # Work around the conftest.exe access problem on Windows
302 MOZ_PATH_PROGS(AS, $AS as, $CC)
303 AC_CHECK_PROGS(AR, ar, :)
304 AC_CHECK_PROGS(LD, ld, :)
305 AC_CHECK_PROGS(STRIP, strip, :)
306 AC_CHECK_PROGS(WINDRES, windres, :)
307 if test -z "$HOST_CC"; then
310 if test -z "$HOST_CFLAGS"; then
311 HOST_CFLAGS="$CFLAGS"
313 if test -z "$HOST_CXX"; then
316 if test -z "$HOST_CXXFLAGS"; then
317 HOST_CXXFLAGS="$CXXFLAGS"
319 if test -z "$HOST_LDFLAGS"; then
320 HOST_LDFLAGS="$LDFLAGS"
322 if test -z "$HOST_RANLIB"; then
323 HOST_RANLIB="$RANLIB"
325 if test -z "$HOST_AR"; then
328 if test -z "$HOST_AR_FLAGS"; then
329 HOST_AR_FLAGS="$AR_FLAGS"
333 if test -n "$MOZ_WINCONSOLE"; then
334 AC_DEFINE(MOZ_WINCONSOLE)
339 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
340 if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
341 test "$GCC_MAJOR_VERSION" -lt 4; then
342 AC_MSG_ERROR([Only GCC 4.4 or newer supported])
346 dnl ========================================================
347 dnl Special win32 checks
348 dnl ========================================================
350 MOZ_ARG_ENABLE_BOOL(metro,
351 [ --enable-metro Enable Windows Metro build targets],
354 if test -n "$MOZ_METRO"; then
356 # Target the Windows 8 Kit
359 # toolkit/library/makefile.in needs these, see nsDllMain.
361 CRTEXPDLLVERSION=1-1-0
363 # Target the Windows 7 SDK by default
368 AC_SUBST(CRTDLLVERSION)
369 AC_SUBST(CRTEXPDLLVERSION)
371 MOZ_ARG_WITH_STRING(windows-version,
372 [ --with-windows-version=WINSDK_TARGETVER
373 Windows SDK version to target. Lowest version
374 currently allowed is 601 (Win7), highest is 602 (Win8)],
375 WINSDK_TARGETVER=$withval)
377 # Currently only two sdk versions allowed, 601 and 602
378 case "$WINSDK_TARGETVER" in
380 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
384 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
390 if test "$GCC" != "yes" -a -z "$CLANG_CC"; then
391 # Check to see if we are really running in a msvc environemnt
393 AC_CHECK_PROGS(MIDL, midl)
395 # Make sure compilers are valid
396 CFLAGS="$CFLAGS -TC -nologo"
397 CXXFLAGS="$CXXFLAGS -TP -nologo"
400 AC_TRY_COMPILE([#include <stdio.h>],
401 [ printf("Hello World\n"); ],,
402 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
405 AC_TRY_COMPILE([#include <new.h>],
406 [ unsigned *test = new unsigned(42); ],,
407 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
411 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
414 # Determine compiler version
415 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
416 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
417 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
418 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
419 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
420 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
422 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
423 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
425 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
426 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
429 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
430 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
432 if test "$_CC_MAJOR_VERSION" = "16"; then
435 elif test "$_CC_MAJOR_VERSION" = "17"; then
438 elif test "$_CC_MAJOR_VERSION" = "18"; then
442 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
445 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
447 if test -n "$WIN32_REDIST_DIR"; then
448 if test ! -d "$WIN32_REDIST_DIR"; then
449 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
451 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
454 dnl Confirm we have the pri tools on win8 builds
455 if test -n "$MOZ_METRO"; then
456 AC_MSG_CHECKING([for makepri])
457 AC_CHECK_PROGS(MAKEPRI, makepri, "")
458 if test -z "MAKEPRI" ; then
459 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
464 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
465 dnl not something else like "magnetic tape manipulation utility".
466 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
467 if test -z "$MSMT_TOOL"; then
468 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
472 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
474 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
475 if test -z "$MSMANIFEST_TOOL_VERSION"; then
476 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
482 # Check linker version
483 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
484 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
485 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
486 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
492 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
493 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
494 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
495 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
496 # Add flags if necessary
497 AC_MSG_CHECKING([for midl flags])
500 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
501 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
502 # MIDL version 7.00.0500 or later has no problem.
503 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
504 AC_MSG_RESULT([need -env win32])
506 AC_MSG_RESULT([none needed])
510 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
513 AC_MSG_RESULT([none needed])
517 unset _MSVC_VER_FILTER
519 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
523 _SAVE_CXXFLAGS="$CXXFLAGS"
524 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
525 AC_TRY_COMPILE([#include <exception>],
526 [std::_Throw(std::exception()); return 0;],
527 ac_cv_have_std__Throw="yes",
528 ac_cv_have_std__Throw="no")
529 CXXFLAGS="$_SAVE_CXXFLAGS"
533 if test "$ac_cv_have_std__Throw" = "yes"; then
534 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
535 ac_cv_have_dllimport_exception_bug,
539 _SAVE_CXXFLAGS="$CXXFLAGS"
540 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
541 AC_TRY_LINK([#include <vector>],
542 [std::vector<int> v; return v.at(1);],
543 ac_cv_have_dllimport_exception_bug="no",
544 ac_cv_have_dllimport_exception_bug="yes")
545 CXXFLAGS="$_SAVE_CXXFLAGS"
548 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
550 MOZ_MSVC_STL_WRAP__Throw=1
551 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
554 AC_CACHE_CHECK(for overridable _RAISE,
559 _SAVE_CXXFLAGS="$CXXFLAGS"
560 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
561 AC_TRY_COMPILE([#include <xstddef>
563 #define _RAISE(x) externallyDefinedFunction((x).what())
566 [std::vector<int> v; return v.at(1);],
567 ac_cv_have__RAISE="no",
568 ac_cv_have__RAISE="yes")
569 CXXFLAGS="$_SAVE_CXXFLAGS"
572 if test "$ac_cv_have__RAISE" = "yes"; then
574 MOZ_MSVC_STL_WRAP__RAISE=1
575 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
577 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
581 if test "$WRAP_STL_INCLUDES" = "1"; then
582 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
584 elif test -z "$CLANG_CC"; then
585 # Check w32api version
586 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
587 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
588 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
589 AC_TRY_COMPILE([#include <w32api.h>],
590 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
591 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
592 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
593 #error "test failed."
595 , [ res=yes ], [ res=no ])
596 AC_MSG_RESULT([$res])
597 if test "$res" != "yes"; then
598 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
600 # Check windres version
601 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
602 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
603 AC_MSG_RESULT([$_WINDRES_VERSION])
604 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
605 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
606 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
607 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
608 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
609 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
610 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
611 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
612 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
613 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
614 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
615 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
617 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
620 AC_CHECK_PROGS(MIDL, $target-widl widl)
621 if test -n "$MIDL"; then
624 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
627 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
632 MOZ_WINSDK_MAXVER=0x06020000
636 if test "$GCC" != "yes" -o -n "$CLANG_CC" ; then
637 MOZ_FIND_WINSDK_VERSION
640 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
641 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
642 # Require OS features provided by IE 6.0 SP2 (XP SP2)
643 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
645 # If the maximum version supported by this SDK is lower than the target
647 AC_MSG_CHECKING([for Windows SDK being recent enough])
648 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
652 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.])
655 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
656 # Definitions matching sdkddkver.h
657 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
658 AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
659 AC_SUBST(MOZ_WINSDK_MAXVER)
666 if test -n "$_WIN32_MSVC"; then
668 SKIP_COMPILER_CHECKS=1
669 SKIP_LIBRARY_CHECKS=1
671 # Since we're skipping compiler and library checks, hard-code
674 AC_DEFINE(HAVE_SETBUF)
675 AC_DEFINE(HAVE_ISATTY)
678 fi # COMPILE_ENVIRONMENT
691 AC_SUBST(WRAP_STL_INCLUDES)
692 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
693 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
695 dnl ========================================================
696 dnl Checks for programs.
697 dnl ========================================================
701 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
702 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
703 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
705 AC_MSG_RESULT([$_perl_version])
707 if test "$_perl_res" != 0; then
708 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
712 AC_MSG_CHECKING([for full perl installation])
713 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
715 if test "$_perl_res" != 0; then
717 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
722 MOZ_ARG_WITH_BOOL(system-ply,
723 [ --with-system-ply Use system installed python ply library],
724 [if $PYTHON -c 'import ply' 2>&5; then
727 AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
730 AC_SUBST(MOZ_SYSTEM_PLY)
732 if test -z "$COMPILE_ENVIRONMENT"; then
733 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
735 AC_SUBST(NSINSTALL_BIN)
737 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
738 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
739 MOZ_PATH_PROGS(UNZIP, unzip)
740 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
741 AC_MSG_ERROR([unzip not found in \$PATH])
743 MOZ_PATH_PROGS(ZIP, zip)
744 if test -z "$ZIP" -o "$ZIP" = ":"; then
745 AC_MSG_ERROR([zip not found in \$PATH])
747 MOZ_PATH_PROG(XARGS, xargs)
748 if test -z "$XARGS" -o "$XARGS" = ":"; then
749 AC_MSG_ERROR([xargs not found in \$PATH .])
752 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
755 if test "$COMPILE_ENVIRONMENT"; then
757 dnl ========================================================
758 dnl = Mac OS X toolchain support
759 dnl ========================================================
761 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
762 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
763 dnl when we can run target binaries.
764 AC_SUBST(UNIVERSAL_BINARY)
765 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
767 MOZ_ARG_WITH_STRING(unify-dist,
768 [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
770 if test -n "$UNIVERSAL_BINARY"; then
771 if test -z "$UNIFY_DIST"; then
772 AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
774 case "$UNIFY_DIST" in
778 UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
784 dnl ========================================================
785 dnl Check for MacOS deployment target version
786 dnl ========================================================
788 MOZ_ARG_ENABLE_STRING(macos-target,
789 [ --enable-macos-target=VER (default=10.6)
790 Set the minimum MacOS version needed at runtime],
791 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
795 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
796 dnl Use the specified value
797 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
799 dnl No value specified on the command line or in the environment,
800 dnl use architecture minimum.
801 export MACOSX_DEPLOYMENT_TARGET=10.6
806 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
808 dnl ========================================================
809 dnl = Mac OS X SDK support
810 dnl ========================================================
813 MOZ_ARG_WITH_STRING(macos-sdk,
814 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
815 MACOS_SDK_DIR=$withval)
817 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
818 dnl NEXT_ROOT will be set and exported only if it's needed.
819 AC_SUBST(MACOS_SDK_DIR)
822 if test "$MACOS_SDK_DIR"; then
823 dnl Sync this section with the ones in NSPR and NSS.
824 dnl Changes to the cross environment here need to be accounted for in
825 dnl the libIDL checks (below) and xpidl build.
827 if test ! -d "$MACOS_SDK_DIR"; then
828 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
829 specify a valid SDK. SDKs are installed when the optional cross-development
830 tools are selected during the Xcode/Developer Tools installation.])
833 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
834 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
836 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
837 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
838 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
841 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
843 AC_TRY_COMPILE([#include <new>],[],
847 AC_MSG_RESULT($result)
849 if test "$result" = "no" ; then
850 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
854 fi # COMPILE_ENVIRONMENT
856 AC_MSG_CHECKING([compiler version])
857 # Just print it so it shows up in the logs.
858 cc_version=$($CC --version)
859 AC_MSG_RESULT([$cc_version])
861 if test -n "$MAKE"; then
862 if test `echo $MAKE | grep -c make.py` != 1; then
869 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
872 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
875 if test "$GMAKE" = ":"; then
876 AC_MSG_ERROR([GNU make not found])
880 if test -z "$MAKE"; then
884 if test "$COMPILE_ENVIRONMENT"; then
890 fi # COMPILE_ENVIRONMENT
892 dnl ========================================================
893 dnl set the defaults first
894 dnl ========================================================
910 MOZ_USER_DIR=".mozilla"
913 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
915 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
917 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
919 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
920 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
921 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxul -lxpcom_core -lmozalloc'
922 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
923 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxul -lmozalloc'
924 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)'
925 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
926 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
928 # These are specially defined on Windows only
931 XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
932 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
935 XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
936 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
942 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
946 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
948 if test -n "$CROSS_COMPILE"; then
949 OS_TARGET="${target_os}"
950 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
952 case "${target_os}" in
953 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
954 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
956 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
957 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
958 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
961 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
965 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
966 OS_RELEASE=`uname -r`
969 # Before this used `uname -m` when not cross compiling
970 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
971 OS_TEST="${target_cpu}"
973 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
975 #######################################################################
976 # Master "Core Components" macros for getting the OS target #
977 #######################################################################
980 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
985 # Define and override various archtecture-specific variables, including
994 case "$HOST_OS_ARCH" in
1008 if test -z "$GNU_CC"; then
1009 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1014 if test -z "$GNU_CXX"; then
1015 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1016 SOLARIS_SUNPRO_CXX=1
1019 AC_SUBST(SOLARIS_SUNPRO_CC)
1020 AC_SUBST(SOLARIS_SUNPRO_CXX)
1029 if test -z "$CROSS_COMPILE" ; then
1035 # If uname -s returns "Windows_NT", we assume that we are using
1036 # the uname.exe in MKS toolkit.
1038 # The -r option of MKS uname only returns the major version number.
1039 # So we need to use its -v option to get the minor version number.
1040 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1044 OS_MINOR_RELEASE=`uname -v`
1045 if test "$OS_MINOR_RELEASE" = "00"; then
1048 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1052 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1053 # the uname.exe in the MSYS tools.
1055 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1060 OS_RELEASE=`uname -v`.`uname -r`
1061 OS_TEST=${target_cpu}
1066 OS_RELEASE=`uname -v`
1069 case "${target_cpu}" in
1080 if test -z "$CROSS_COMPILE" ; then
1088 # Only set CPU_ARCH if we recognize the value of OS_TEST
1099 powerpc | ppc | rs6000)
1103 Alpha | alpha | ALPHA)
1136 if test -z "$OS_TARGET"; then
1139 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1141 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1142 dnl ===============================================================
1146 INTEL_ARCHITECTURE=1
1149 dnl Configure platform-specific CPU architecture compiler options.
1150 dnl ==============================================================
1153 dnl =================================================================
1154 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1155 dnl which is bad when cross compiling.
1156 dnl =================================================================
1157 if test "$COMPILE_ENVIRONMENT"; then
1158 configure_static_assert_macros='
1159 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1160 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1161 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1164 dnl test that the macros actually work:
1165 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1166 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1169 ac_cv_static_assertion_macros_work="yes"
1170 AC_TRY_COMPILE([$configure_static_assert_macros],
1171 [CONFIGURE_STATIC_ASSERT(1)],
1173 ac_cv_static_assertion_macros_work="no")
1174 AC_TRY_COMPILE([$configure_static_assert_macros],
1175 [CONFIGURE_STATIC_ASSERT(0)],
1176 ac_cv_static_assertion_macros_work="no",
1179 AC_TRY_COMPILE([$configure_static_assert_macros],
1180 [CONFIGURE_STATIC_ASSERT(1)],
1182 ac_cv_static_assertion_macros_work="no")
1183 AC_TRY_COMPILE([$configure_static_assert_macros],
1184 [CONFIGURE_STATIC_ASSERT(0)],
1185 ac_cv_static_assertion_macros_work="no",
1189 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1190 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1191 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1193 fi # COMPILE_ENVIRONMENT
1195 dnl ========================================================
1196 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1198 dnl ========================================================
1202 dnl ========================================================
1203 dnl Suppress Clang Argument Warnings
1204 dnl ========================================================
1205 if test -n "$CLANG_CC"; then
1206 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1207 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1209 if test -n "$CLANG_CXX"; then
1210 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1213 dnl ========================================================
1214 dnl = Use Address Sanitizer
1215 dnl ========================================================
1216 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1217 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1220 if test -n "$MOZ_ASAN"; then
1226 dnl ========================================================
1227 dnl = Enable hacks required for LLVM instrumentations
1228 dnl ========================================================
1229 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1230 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1233 if test -n "$MOZ_LLVM_HACKS"; then
1237 AC_SUBST(MOZ_NO_WLZDEFS)
1238 AC_SUBST(MOZ_CFLAGS_NSS)
1240 dnl ========================================================
1241 dnl GNU specific defaults
1242 dnl ========================================================
1243 if test "$GNU_CC"; then
1244 # Per bug 719659 comment 2, some of the headers on ancient build machines
1245 # may require gnu89 inline semantics. But otherwise, we use C99.
1246 CFLAGS="$CFLAGS -std=gnu99 -fgnu89-inline"
1247 # FIXME: Let us build with strict aliasing. bug 414641.
1248 CFLAGS="$CFLAGS -fno-strict-aliasing"
1249 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1250 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1251 DSO_LDOPTS='-shared'
1252 if test "$GCC_USE_GNU_LD"; then
1253 # Some tools like ASan use a runtime library that is only
1254 # linked against executables, so we must allow undefined
1255 # symbols for shared objects in some cases.
1256 if test -z "$MOZ_NO_WLZDEFS"; then
1257 # Don't allow undefined symbols in libraries
1258 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1261 WARNINGS_AS_ERRORS='-Werror'
1263 DSO_PIC_CFLAGS='-fPIC'
1264 ASFLAGS="$ASFLAGS -fPIC"
1265 AC_MSG_CHECKING([for --noexecstack option to as])
1266 _SAVE_CFLAGS=$CFLAGS
1267 CFLAGS="$CFLAGS -Wa,--noexecstack"
1268 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1269 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1270 AC_MSG_RESULT([no]))
1271 CFLAGS=$_SAVE_CFLAGS
1272 AC_MSG_CHECKING([for -z noexecstack option to ld])
1273 _SAVE_LDFLAGS=$LDFLAGS
1274 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1275 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1277 LDFLAGS=$_SAVE_LDFLAGS)
1279 AC_MSG_CHECKING([for -z text option to ld])
1280 _SAVE_LDFLAGS=$LDFLAGS
1281 LDFLAGS="$LDFLAGS -Wl,-z,text"
1282 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1283 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1285 LDFLAGS=$_SAVE_LDFLAGS)
1287 AC_MSG_CHECKING([for --build-id option to ld])
1288 _SAVE_LDFLAGS=$LDFLAGS
1289 LDFLAGS="$LDFLAGS -Wl,--build-id"
1290 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1291 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1293 LDFLAGS=$_SAVE_LDFLAGS)
1296 # Check for -mssse3 on $CC
1297 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1298 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1299 _SAVE_CFLAGS=$CFLAGS
1300 CFLAGS="$CFLAGS -mssse3"
1301 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1302 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1303 AC_MSG_RESULT([no]))
1304 CFLAGS=$_SAVE_CFLAGS
1306 # Check for -msse4.1 on $CC
1307 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1308 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1309 _SAVE_CFLAGS=$CFLAGS
1310 CFLAGS="$CFLAGS -msse4.1"
1311 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1312 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1313 AC_MSG_RESULT([no]))
1314 CFLAGS=$_SAVE_CFLAGS
1316 # Turn on GNU-specific warnings:
1317 # -Wall - turn on a lot of warnings
1318 # -Wpointer-arith - good to have
1319 # -Wdeclaration-after-statement - MSVC doesn't like these
1320 # -Werror=return-type - catches missing returns, zero false positives
1321 # -Wtype-limits - catches overflow bugs, few false positives
1322 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1323 # -Wsign-compare - catches comparison of signed and unsigned types
1325 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1326 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1327 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1328 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1329 MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1331 # Turn off the following warnings that -Wall turns on:
1332 # -Wno-unused - lots of violations in third-party code
1334 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1336 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1337 # Don't use -Wcast-align with ICC or clang
1339 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1340 hppa | ia64 | sparc | arm)
1343 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1348 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1349 _USE_CPP_INCLUDE_FLAG=1
1350 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1352 elif test "$SOLARIS_SUNPRO_CC"; then
1354 if test "$CPU_ARCH" = "sparc"; then
1355 # for Sun Studio on Solaris/SPARC
1356 DSO_PIC_CFLAGS='-xcode=pic32'
1358 DSO_PIC_CFLAGS='-KPIC'
1360 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1362 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1363 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1365 DSO_LDOPTS='-shared'
1366 if test "$GNU_LD"; then
1367 # Don't allow undefined symbols in libraries
1368 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1372 DSO_PIC_CFLAGS='-KPIC'
1373 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1376 if test "$GNU_CXX"; then
1377 # FIXME: Let us build with strict aliasing. bug 414641.
1378 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1380 # Turn on GNU-specific warnings:
1381 # -Wall - turn on a lot of warnings
1382 # -Wpointer-arith - good to have
1383 # -Woverloaded-virtual - ???
1384 # -Werror=return-type - catches missing returns, zero false positives
1385 # -Wtype-limits - catches overflow bugs, few false positives
1386 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1387 # -Wsign-compare - catches comparison of signed and unsigned types
1389 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1390 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1391 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1392 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1393 MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1395 # Turn off the following warnings that -Wall turns on:
1396 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1398 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1400 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1401 # Don't use -Wcast-align with ICC or clang
1403 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1404 hppa | ia64 | sparc | arm)
1407 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1412 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1413 _USE_CPP_INCLUDE_FLAG=1
1415 # Recent clang and gcc support C++11 deleted functions without warnings if
1416 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1417 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1418 # unused. But clang's warning can be disabled, so when compiling with clang
1419 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1420 # deleted function syntax.
1421 if test "$CLANG_CXX"; then
1422 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1423 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1427 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1430 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1431 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1432 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1433 dnl normal behavior.
1434 dnl ========================================================
1436 MKSHLIB_UNFORCE_ALL=
1438 if test "$COMPILE_ENVIRONMENT"; then
1439 if test "$GNU_CC"; then
1440 AC_MSG_CHECKING(whether ld has archive extraction flags)
1441 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1442 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1443 ac_cv_mkshlib_force_and_unforce="no"
1444 exec 3<&0 <<LOOP_INPUT
1445 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1446 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1447 force="-Wl,-all"; unforce="-Wl,-none"
1454 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1457 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1459 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1463 eval $ac_cv_mkshlib_force_and_unforce
1464 MKSHLIB_FORCE_ALL=$force
1465 MKSHLIB_UNFORCE_ALL=$unforce
1468 fi # COMPILE_ENVIRONMENT
1470 dnl ========================================================
1471 dnl Checking for 64-bit OS
1472 dnl ========================================================
1473 if test "$COMPILE_ENVIRONMENT"; then
1476 AC_MSG_CHECKING(for 64-bit OS)
1477 AC_TRY_COMPILE([$configure_static_assert_macros],
1478 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1479 result="yes", result="no")
1480 AC_MSG_RESULT("$result")
1481 if test "$result" = "yes"; then
1482 AC_DEFINE(HAVE_64BIT_OS)
1485 AC_SUBST(HAVE_64BIT_OS)
1487 fi # COMPILE_ENVIRONMENT
1489 dnl ========================================================
1490 dnl Enable high-memory support on OS/2 by default.
1491 dnl ========================================================
1492 MOZ_OS2_HIGH_MEMORY=1
1493 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1494 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1495 MOZ_OS2_HIGH_MEMORY=,
1496 MOZ_OS2_HIGH_MEMORY=1 )
1497 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1499 dnl ========================================================
1500 dnl = Use profiling compile flags
1501 dnl ========================================================
1502 MOZ_ARG_ENABLE_BOOL(profiling,
1503 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1507 # For profiling builds keep the symbol information
1508 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1509 case "$OS_TARGET" in
1510 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1511 STRIP_FLAGS="--strip-debug"
1516 dnl ========================================================
1517 dnl = Use incremental GC
1518 dnl ========================================================
1520 MOZ_ARG_DISABLE_BOOL(gcincremental,
1521 [ --disable-gcincremental Disable incremental GC],
1523 if test -n "$JSGC_INCREMENTAL"; then
1524 AC_DEFINE(JSGC_INCREMENTAL)
1527 dnl ========================================================
1528 dnl = Use generational GC
1529 dnl ========================================================
1530 MOZ_ARG_ENABLE_BOOL(gcgenerational,
1531 [ --enable-gcgenerational Enable generational GC],
1532 JSGC_GENERATIONAL=1,
1533 JSGC_GENERATIONAL= )
1534 if test -n "$JSGC_GENERATIONAL"; then
1535 AC_DEFINE(JSGC_GENERATIONAL)
1538 dnl ========================================================
1539 dnl = Perform moving GC stack rooting analysis
1540 dnl ========================================================
1541 MOZ_ARG_ENABLE_BOOL(root-analysis,
1542 [ --enable-root-analysis Enable moving GC stack root analysis],
1543 JSGC_ROOT_ANALYSIS=1,
1544 JSGC_ROOT_ANALYSIS= )
1545 if test -n "$JSGC_ROOT_ANALYSIS"; then
1546 AC_DEFINE(JSGC_ROOT_ANALYSIS)
1549 dnl ========================================================
1550 dnl = Use exact stack rooting for GC
1551 dnl ========================================================
1552 MOZ_ARG_ENABLE_BOOL(exact-rooting,
1553 [ --enable-exact-rooting Enable use of exact stack roots for GC],
1554 JSGC_USE_EXACT_ROOTING=1,
1555 JSGC_USE_EXACT_ROOTING= )
1556 if test -n "$JSGC_USE_EXACT_ROOTING"; then
1557 AC_DEFINE(JSGC_USE_EXACT_ROOTING)
1560 dnl ========================================================
1562 dnl ========================================================
1563 MOZ_ARG_ENABLE_BOOL(valgrind,
1564 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1567 if test -n "$MOZ_VALGRIND"; then
1568 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1570 [--enable-valgrind specified but Valgrind is not installed]))
1571 AC_DEFINE(MOZ_VALGRIND)
1573 AC_SUBST(MOZ_VALGRIND)
1575 dnl ========================================================
1577 dnl ========================================================
1578 MOZ_ARG_ENABLE_BOOL(jprof,
1579 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1582 if test -n "$MOZ_JPROF"; then
1584 AC_DEFINE(MOZ_JPROF)
1587 dnl ========================================================
1589 dnl ========================================================
1590 MOZ_ENABLE_PROFILER_SPS=1
1592 case "${OS_TARGET}" in
1594 case "${CPU_ARCH}" in
1597 MOZ_ENABLE_PROFILER_SPS=
1601 case "${CPU_ARCH}" in
1604 MOZ_ENABLE_PROFILER_SPS=
1609 MOZ_ENABLE_PROFILER_SPS=
1613 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1614 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1617 dnl ========================================================
1619 dnl ========================================================
1620 MOZ_ARG_ENABLE_BOOL(shark,
1621 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1624 if test -n "$MOZ_SHARK"; then
1626 AC_DEFINE(MOZ_SHARK)
1629 dnl ========================================================
1631 dnl ========================================================
1632 MOZ_ARG_ENABLE_BOOL(instruments,
1633 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
1636 if test -n "$MOZ_INSTRUMENTS"; then
1638 AC_DEFINE(MOZ_INSTRUMENTS)
1641 dnl ========================================================
1643 dnl ========================================================
1644 MOZ_ARG_ENABLE_BOOL(callgrind,
1645 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1648 if test -n "$MOZ_CALLGRIND"; then
1650 AC_DEFINE(MOZ_CALLGRIND)
1653 dnl ========================================================
1655 dnl ========================================================
1656 MOZ_ARG_ENABLE_BOOL(vtune,
1657 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1660 if test -n "$MOZ_VTUNE"; then
1662 AC_DEFINE(MOZ_VTUNE)
1665 dnl ========================================================
1667 dnl ========================================================
1668 if test -n "$MOZ_PROFILING"; then
1669 AC_DEFINE(MOZ_PROFILING)
1672 dnl ========================================================
1673 dnl System overrides of the defaults for host
1674 dnl ========================================================
1677 if test -n "$_WIN32_MSVC"; then
1679 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1680 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1681 HOST_RANLIB='echo ranlib'
1683 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1685 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1686 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1687 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1688 HOST_BIN_SUFFIX=.exe
1691 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1695 case "${host_cpu}" in
1697 if test -n "$_WIN32_MSVC"; then
1698 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1702 if test -n "$_WIN32_MSVC"; then
1703 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1705 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1711 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1712 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1713 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1716 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1717 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1718 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1719 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1723 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1724 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1725 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1726 HOST_BIN_SUFFIX=.exe
1731 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1732 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1736 dnl Check for using a custom <inttypes.h> implementation
1737 dnl ========================================================
1738 AC_MSG_CHECKING(for custom <inttypes.h> implementation)
1739 if test "$MOZ_CUSTOM_INTTYPES_H"; then
1740 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
1741 AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
1743 AC_MSG_RESULT(none specified)
1746 dnl Get mozilla version from central milestone file
1747 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1748 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1750 dnl Get version of various core apps from the version files.
1751 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1753 if test -z "$FIREFOX_VERSION"; then
1754 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1757 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1758 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1759 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1761 MOZ_DOING_LTO(lto_is_enabled)
1763 dnl ========================================================
1764 dnl System overrides of the defaults for target
1765 dnl ========================================================
1770 if test ! "$GNU_CC"; then
1771 if test ! "$HAVE_64BIT_OS"; then
1772 # Compiling with Visual Age C++ object model compat is the
1773 # default. To compile with object model ibm, add
1774 # AIX_OBJMODEL=ibm to .mozconfig.
1775 if test "$AIX_OBJMODEL" = "ibm"; then
1776 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1783 AC_SUBST(AIX_OBJMODEL)
1784 DSO_LDOPTS='-qmkshrobj=1'
1785 DSO_CFLAGS='-qflag=w:w'
1787 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1789 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1790 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1791 if test "$COMPILE_ENVIRONMENT"; then
1794 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1796 [#if (__IBMCPP__ < 900)
1797 #error "Bad compiler"
1799 _BAD_COMPILER=,_BAD_COMPILER=1)
1800 if test -n "$_BAD_COMPILER"; then
1802 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1804 AC_MSG_RESULT([yes])
1807 TARGET_COMPILER_ABI="ibmc"
1808 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1809 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1812 case "${target_os}" in
1817 if test "$COMPILE_ENVIRONMENT"; then
1818 MOZ_CHECK_HEADERS(sys/inttypes.h)
1820 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1824 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1825 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1826 MOZ_OPTIMIZE_FLAGS="-O3"
1827 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1828 if test "$HAVE_64BIT_OS"; then
1833 STRIP_FLAGS="$STRIP_FLAGS -x -S"
1834 # Check whether we're targeting OS X or iOS
1835 AC_CACHE_CHECK(for iOS target,
1837 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1838 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1842 ac_cv_ios_target="yes",
1843 ac_cv_ios_target="no")])
1844 if test "$ac_cv_ios_target" = "yes"; then
1846 AC_DEFINE(XP_DARWIN)
1847 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1849 AC_DEFINE(XP_MACOSX)
1850 AC_DEFINE(XP_DARWIN)
1851 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1852 # The ExceptionHandling framework is needed for Objective-C exception
1853 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1855 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1857 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1860 if test "x$lto_is_enabled" = "xyes"; then
1861 echo "Skipping -dead_strip because lto is enabled."
1862 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1863 dnl ===================================================================
1864 elif test "x$enable_dtrace" = "xyes"; then
1865 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1867 dnl check for the presence of the -dead_strip linker flag
1868 AC_MSG_CHECKING([for -dead_strip option to ld])
1869 _SAVE_LDFLAGS=$LDFLAGS
1870 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1871 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1872 if test -n "$_HAVE_DEAD_STRIP" ; then
1873 AC_MSG_RESULT([yes])
1874 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1879 LDFLAGS=$_SAVE_LDFLAGS
1882 dnl With newer linkers we need to pass -allow_heap_execute because of
1883 dnl Microsoft Silverlight (5.1.10411.0 at least).
1884 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1885 _SAVE_LDFLAGS=$LDFLAGS
1886 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1887 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1888 _HAVE_ALLOW_HEAP_EXECUTE=)
1889 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1890 AC_MSG_RESULT([yes])
1891 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1895 LDFLAGS=$_SAVE_LDFLAGS
1897 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1902 if test ! "$GNU_CC"; then
1906 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1907 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1908 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1911 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1912 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1915 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1916 AC_DEFINE(_LARGEFILE64_SOURCE)
1921 if test ! "$GNU_CC"; then
1922 DSO_LDOPTS='-b -Wl,+s'
1925 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1926 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1927 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1929 DSO_LDOPTS='-b -E +s'
1930 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1931 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1933 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1934 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1937 *-android*|*-linuxandroid*)
1938 AC_DEFINE(NO_PW_GECOS)
1940 if test -n "$gonkdir"; then
1941 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
1945 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
1948 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1950 MOZ_GFX_OPTIMIZE_MOBILE=1
1951 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
1955 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
1956 # Similarly for GNU_CXX and INTEL_CXX.
1957 if test "$INTEL_CC" -o "$INTEL_CXX"; then
1958 # -Os has been broken on Intel's C/C++ compilers for quite a
1959 # while; Intel recommends against using it.
1960 MOZ_OPTIMIZE_FLAGS="-O2"
1961 elif test "$GNU_CC" -o "$GNU_CXX"; then
1962 case $GCC_VERSION in
1964 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
1965 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1967 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
1968 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
1971 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1975 case "${target_cpu}" in
1977 CFLAGS="$CFLAGS -mieee"
1978 CXXFLAGS="$CXXFLAGS -mieee"
1985 if test -z "$MC"; then
1995 # certain versions of cygwin's makedepend barf on the
1996 # #include <string> vs -I./dist/include/string issue so don't use it
1997 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
1999 CXX="$CXX -mwindows"
2000 CPP="$CPP -mwindows"
2001 CFLAGS="$CFLAGS -mms-bitfields"
2002 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2003 DSO_LDOPTS='-shared'
2004 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2005 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2007 # Use static libgcc and libstdc++
2008 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
2009 NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
2010 # Use temp file for windres (bug 213281)
2011 RCFLAGS='-O coff --use-temp-file'
2012 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2013 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2015 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxul -lxpcom_core -lmozalloc'
2016 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxul -lmozalloc'
2018 IMPORT_LIB_SUFFIX=dll.a
2020 # We use mix of both POSIX and Win32 printf format across the tree, so format
2021 # warnings are useless on mingw.
2022 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2023 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2025 TARGET_COMPILER_ABI=msvc
2029 if test "$AS_BIN"; then
2030 AS="$(basename "$AS_BIN")"
2033 AR_FLAGS='-NOLOGO -OUT:"$@"'
2035 RANLIB='echo not_ranlib'
2036 STRIP='echo not_strip'
2047 IMPORT_LIB_SUFFIX=lib
2048 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2049 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2051 MKSHLIB_UNFORCE_ALL=
2052 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2053 _USE_CPP_INCLUDE_FLAG=1
2054 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2055 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2056 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2057 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2058 # khuey says we can safely ignore MSVC warning C4251
2059 # MSVC warning C4244 (implicit type conversion may lose data) warns
2060 # and requires workarounds for perfectly valid code. Also, GCC/clang
2061 # don't warn about it by default. So for consistency/sanity, we turn
2062 # it off on MSVC, too.
2063 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2064 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2065 # MSVC warning C4482 warns when an enum value is refered specifing the
2066 # name of the enum itself. This behavior is allowed in C++11, and the
2067 # warning has been removed in VS2012.
2068 # MSVC warning C4800 warns when a value is implicitly cast to bool,
2069 # because this also forces narrowing to a single byte, which can be a
2070 # perf hit. But this matters so little in practice (and often we want
2071 # that behavior) that it's better to turn it off.
2072 # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2073 # on non-Western system locales even if it is in a comment.
2074 CFLAGS="$CFLAGS -wd4244 -wd4819"
2075 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2076 # make 'foo == bar;' error out
2077 CFLAGS="$CFLAGS -we4553"
2078 CXXFLAGS="$CXXFLAGS -we4553"
2079 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2080 MOZ_DEBUG_FLAGS='-Zi'
2081 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2082 WARNINGS_AS_ERRORS='-WX'
2083 MOZ_OPTIMIZE_FLAGS='-O1'
2085 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2086 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2087 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2088 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2089 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2090 if test -z "$DEVELOPER_OPTIONS"; then
2091 LDFLAGS="$LDFLAGS -RELEASE"
2093 dnl For profile-guided optimization
2094 PROFILE_GEN_CFLAGS="-GL"
2095 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2096 dnl XXX: PGO builds can fail with warnings treated as errors,
2097 dnl specifically "no profile data available" appears to be
2098 dnl treated as an error sometimes. This might be a consequence
2099 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2100 dnl with the linker doing most of the work in the whole-program
2101 dnl optimization/PGO case. I think it's probably a compiler bug,
2102 dnl but we work around it here.
2103 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2104 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2105 dnl Probably also a compiler bug, but what can you do?
2106 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2107 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2108 dnl Minimum reqiurement of Gecko is VS2010 or later which supports
2109 dnl both SSSE3 and SSE4.1.
2110 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2111 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
2113 AC_DEFINE(HAVE_SNPRINTF)
2118 AC_DEFINE(HW_THREADS)
2119 AC_DEFINE(STDC_HEADERS)
2120 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2121 TARGET_MD_ARCH=win32
2122 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2124 MOZ_USER_DIR="Mozilla"
2126 dnl Hardcode to win95 for now - cls
2127 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2129 dnl set NO_X11 defines here as the general check is skipped on win32
2135 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2136 if test -n "$L10NBASEDIR"; then
2137 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2144 if test -z "$MOZ_TOOLS"; then
2145 AC_MSG_ERROR([MOZ_TOOLS is not set])
2147 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2148 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2149 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2151 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2152 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2153 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2160 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.])
2166 if test "$HAVE_64BIT_OS"; then
2167 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2170 if test -n "$GNU_CC"; then
2171 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2172 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2173 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2175 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2176 LDFLAGS="$LDFLAGS -SAFESEH"
2182 if test -n "$_WIN32_MSVC"; then
2183 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2188 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2195 CFLAGS="$CFLAGS -Dunix"
2196 CXXFLAGS="$CXXFLAGS -Dunix"
2197 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2199 DSO_PIC_CFLAGS='-fPIC -DPIC'
2200 DSO_LDOPTS='-shared'
2201 BIN_FLAGS='-Wl,--export-dynamic'
2203 DSO_PIC_CFLAGS='-fPIC -DPIC'
2204 DLL_SUFFIX=".so.1.0"
2205 DSO_LDOPTS='-shared'
2207 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2208 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2209 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2210 if test "$LIBRUNPATH"; then
2211 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2213 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
2214 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@)) -o $@'
2218 if test "$SO_VERSION"; then
2219 DLL_SUFFIX=".so.$SO_VERSION"
2221 DLL_SUFFIX=".so.1.0"
2223 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2225 DSO_PIC_CFLAGS='-fPIC'
2226 DSO_LDOPTS='-shared -fPIC'
2227 if test "$LIBRUNPATH"; then
2228 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2233 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2234 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2237 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2238 AC_DEFINE(TCPV40HDRS)
2244 IMPORT_LIB_SUFFIX=lib
2248 CFLAGS="$CFLAGS -Zomf"
2249 CXXFLAGS="$CXXFLAGS -Zomf"
2251 BIN_FLAGS='-Zlinker /ST:0x100000'
2255 WARNINGS_AS_ERRORS='-Werror'
2256 MOZ_DEBUG_FLAGS="-g -fno-inline"
2257 MOZ_OPTIMIZE_FLAGS="-O2"
2258 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2259 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2260 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2262 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2266 MOZ_USER_DIR="Mozilla"
2269 STRIP_FLAGS="/yua /ydd /yxd /ynl /anp /b- /cs+ /d /i- /ml1 /mr2 /mf2 /r+ /u+ /x- /zs:0 /zx /zd"
2271 if test "$MOZTOOLS"; then
2272 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2274 AC_MSG_ERROR([MOZTOOLS is not set])
2276 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2277 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2278 LDFLAGS="$LDFLAGS -Zhigh-mem"
2279 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2280 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2283 # GCC for OS/2 currently predefines these, but we don't want them
2284 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2285 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2287 AC_CACHE_CHECK(for __declspec(dllexport),
2289 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2291 ac_os2_declspec="yes",
2292 ac_os2_declspec="no")])
2293 if test "$ac_os2_declspec" != "yes"; then
2294 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2300 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2302 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2303 # libraries one level up (e.g. libnspr4.so)
2304 if test "$SOLARIS_SUNPRO_CC"; then
2305 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2306 LIBS="-lCrun -lCstd -lc $LIBS"
2307 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2308 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2309 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2310 LDFLAGS="-xildoff $LDFLAGS"
2311 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2312 _SAVE_LDFLAGS=$LDFLAGS
2313 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2314 AC_TRY_LINK([#include <stdio.h>],
2315 [printf("Hello World\n");],
2317 [LDFLAGS=$_SAVE_LDFLAGS])
2319 MOZ_OPTIMIZE_FLAGS="-xO4"
2320 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2321 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2322 MKSHLIB_FORCE_ALL='-z allextract'
2323 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2330 AS='/usr/ccs/bin/as'
2331 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2333 TARGET_COMPILER_ABI="sunc"
2334 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2335 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2336 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2340 [#if (__SUNPRO_CC < 0x590)
2343 _BAD_COMPILER=,_BAD_COMPILER=1)
2344 if test -n "$_BAD_COMPILER"; then
2346 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2351 [#if (__SUNPRO_CC >= 0x5100)
2352 #error "Sun C++ 5.10 or above"
2354 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2355 if test "$_ABOVE_SS12U1"; then
2357 CXXFLAGS="$CXXFLAGS -xannotate=no"
2359 AC_MSG_RESULT([$_res])
2362 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2364 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2365 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2366 ASFLAGS="$ASFLAGS -fPIC"
2367 DSO_LDOPTS='-shared'
2368 WARNINGS_AS_ERRORS='-Werror'
2370 _WARNINGS_CXXFLAGS=''
2371 if test "$OS_RELEASE" = "5.3"; then
2372 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2375 if test "$OS_RELEASE" = "5.5.1"; then
2376 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2381 DSO_LDOPTS='-Bdynamic'
2382 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2383 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2385 AC_DEFINE(SPRINTF_RETURNS_STRING)
2386 case "$(target_os)" in
2388 DLL_SUFFIX='.so.1.0'
2394 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2401 # Includes linux-android
2406 AC_SUBST(MOZ_LINKER)
2407 if test -n "$MOZ_LINKER"; then
2408 AC_DEFINE(MOZ_LINKER)
2411 dnl Only one oddball right now (QNX), but this gives us flexibility
2412 dnl if any other platforms need to override this in the future.
2413 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2415 dnl ========================================================
2416 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2417 dnl by now will not have any way to link most binaries (tests
2418 dnl as well as viewer, apprunner, etc.), because some symbols
2419 dnl will be left out of the "composite" .so's by ld as unneeded.
2420 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2421 dnl they can link in the static libs that provide the missing
2423 dnl ========================================================
2424 NO_LD_ARCHIVE_FLAGS=
2425 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2426 NO_LD_ARCHIVE_FLAGS=1
2430 NO_LD_ARCHIVE_FLAGS=
2433 NO_LD_ARCHIVE_FLAGS=
2436 if test -z "$GNU_CC"; then
2437 NO_LD_ARCHIVE_FLAGS=
2441 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2443 dnl ========================================================
2444 dnl = Flags to strip unused symbols from .so components and
2445 dnl = to export jemalloc symbols when linking a program
2446 dnl ========================================================
2448 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2449 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2452 if test -z "$GNU_CC"; then
2453 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2455 if test -z "$GCC_USE_GNU_LD"; then
2456 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2458 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2463 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2466 if test -n "$GNU_CC"; then
2467 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2472 if test -z "$COMPILE_ENVIRONMENT"; then
2473 SKIP_COMPILER_CHECKS=1
2474 SKIP_LIBRARY_CHECKS=1
2478 if test -z "$SKIP_COMPILER_CHECKS"; then
2479 dnl Checks for typedefs, structures, and compiler characteristics.
2480 dnl ========================================================
2489 AC_MSG_CHECKING(for ssize_t)
2490 AC_CACHE_VAL(ac_cv_type_ssize_t,
2491 [AC_TRY_COMPILE([#include <stdio.h>
2492 #include <sys/types.h>],
2494 [ac_cv_type_ssize_t=true],
2495 [ac_cv_type_ssize_t=false])])
2496 if test "$ac_cv_type_ssize_t" = true ; then
2497 AC_DEFINE(HAVE_SSIZE_T)
2502 AC_STRUCT_ST_BLKSIZE
2503 AC_MSG_CHECKING(for siginfo_t)
2504 AC_CACHE_VAL(ac_cv_siginfo_t,
2505 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2506 #include <signal.h>],
2508 [ac_cv_siginfo_t=true],
2509 [ac_cv_siginfo_t=false])])
2510 if test "$ac_cv_siginfo_t" = true ; then
2511 AC_DEFINE(HAVE_SIGINFO_T)
2517 dnl Check for int64, uint, and uint_t.
2518 dnl ========================================================
2519 AC_MSG_CHECKING(for int64)
2520 AC_CACHE_VAL(ac_cv_int64,
2521 [AC_TRY_COMPILE([#include <stdio.h>
2522 #include <sys/types.h>],
2525 [ac_cv_int64=false])])
2526 if test "$ac_cv_int64" = true ; then
2527 AC_DEFINE(HAVE_INT64)
2532 AC_MSG_CHECKING(for uint)
2533 AC_CACHE_VAL(ac_cv_uint,
2534 [AC_TRY_COMPILE([#include <stdio.h>
2535 #include <sys/types.h>],
2538 [ac_cv_uint=false])])
2539 if test "$ac_cv_uint" = true ; then
2540 AC_DEFINE(HAVE_UINT)
2545 AC_MSG_CHECKING(for uint_t)
2546 AC_CACHE_VAL(ac_cv_uint_t,
2547 [AC_TRY_COMPILE([#include <stdio.h>
2548 #include <sys/types.h>],
2550 [ac_cv_uint_t=true],
2551 [ac_cv_uint_t=false])])
2552 if test "$ac_cv_uint_t" = true ; then
2553 AC_DEFINE(HAVE_UINT_T)
2559 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2560 dnl are defined when compiling C++ but not C. Since the result of this
2561 dnl test is used only in C++, do it in C++.
2564 AC_MSG_CHECKING(for uname.domainname)
2565 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2566 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2567 [ struct utsname *res; char *domain;
2568 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2569 [ac_cv_have_uname_domainname_field=true],
2570 [ac_cv_have_uname_domainname_field=false])])
2572 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2573 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2579 AC_MSG_CHECKING(for uname.__domainname)
2580 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2581 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2582 [ struct utsname *res; char *domain;
2583 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2584 [ac_cv_have_uname_us_domainname_field=true],
2585 [ac_cv_have_uname_us_domainname_field=false])])
2587 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2588 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2598 dnl Check for usable char16_t (2 bytes, unsigned)
2599 dnl (we might not need the unsignedness check anymore)
2600 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2601 ac_cv_have_usable_char16_t,
2602 [AC_TRY_COMPILE([$configure_static_assert_macros],
2603 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2604 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2605 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2606 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2607 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2608 ac_cv_have_usable_char16_t="yes",
2609 ac_cv_have_usable_char16_t="no")])
2610 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2611 AC_DEFINE(HAVE_CPP_CHAR16_T)
2613 elif test "$GNU_CXX"; then
2614 CXXFLAGS="$_SAVE_CXXFLAGS"
2617 dnl Check for usable wchar_t (2 bytes, unsigned)
2618 dnl (we really don't need the unsignedness check anymore)
2619 dnl ========================================================
2621 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2622 ac_cv_have_usable_wchar_v2,
2623 [AC_TRY_COMPILE([#include <stddef.h>
2624 $configure_static_assert_macros],
2625 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2626 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2627 ac_cv_have_usable_wchar_v2="yes",
2628 ac_cv_have_usable_wchar_v2="no")])
2629 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2630 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2631 HAVE_CPP_2BYTE_WCHAR_T=1
2632 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2633 dnl This is really gcc-only
2634 dnl Do this test using CXX only since some versions of gcc
2635 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2636 dnl only have short-wchar support for c++.
2637 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2639 _SAVE_CXXFLAGS=$CXXFLAGS
2640 CXXFLAGS="$CXXFLAGS -fshort-wchar"
2642 AC_CACHE_CHECK(for compiler -fshort-wchar option,
2643 ac_cv_have_usable_wchar_option_v2,
2644 [AC_TRY_LINK([#include <stddef.h>
2645 $configure_static_assert_macros],
2646 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2647 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2648 ac_cv_have_usable_wchar_option_v2="yes",
2649 ac_cv_have_usable_wchar_option_v2="no")])
2651 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2652 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2653 HAVE_CPP_2BYTE_WCHAR_T=1
2654 if test "$OS_TARGET" = Android; then
2655 WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
2656 CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
2657 CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
2658 DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
2660 WCHAR_CFLAGS="-fshort-wchar"
2663 CXXFLAGS=$_SAVE_CXXFLAGS
2669 dnl Check for .hidden assembler directive and visibility attribute.
2670 dnl Borrowed from glibc configure.in
2671 dnl ===============================================================
2672 if test "$GNU_CC"; then
2673 AC_CACHE_CHECK(for visibility(hidden) attribute,
2674 ac_cv_visibility_hidden,
2675 [cat > conftest.c <<EOF
2676 int foo __attribute__ ((visibility ("hidden"))) = 1;
2678 ac_cv_visibility_hidden=no
2679 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2680 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2681 ac_cv_visibility_hidden=yes
2686 if test "$ac_cv_visibility_hidden" = "yes"; then
2687 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2689 AC_CACHE_CHECK(for visibility(default) attribute,
2690 ac_cv_visibility_default,
2691 [cat > conftest.c <<EOF
2692 int foo __attribute__ ((visibility ("default"))) = 1;
2694 ac_cv_visibility_default=no
2695 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2696 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2697 ac_cv_visibility_default=yes
2702 if test "$ac_cv_visibility_default" = "yes"; then
2703 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2705 AC_CACHE_CHECK(for visibility pragma support,
2706 ac_cv_visibility_pragma,
2707 [cat > conftest.c <<EOF
2708 #pragma GCC visibility push(hidden)
2710 #pragma GCC visibility push(default)
2711 int foo_default = 1;
2713 ac_cv_visibility_pragma=no
2714 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2715 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2716 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2717 ac_cv_visibility_pragma=yes
2723 if test "$ac_cv_visibility_pragma" = "yes"; then
2724 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2725 ac_cv_have_visibility_class_bug,
2726 [cat > conftest.c <<EOF
2727 #pragma GCC visibility push(hidden)
2728 struct __attribute__ ((visibility ("default"))) TestStruct {
2731 __attribute__ ((visibility ("default"))) void TestFunc() {
2735 ac_cv_have_visibility_class_bug=no
2736 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2737 ac_cv_have_visibility_class_bug=yes
2739 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2740 ac_cv_have_visibility_class_bug=yes
2743 rm -rf conftest.{c,S}
2746 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2747 ac_cv_have_visibility_builtin_bug,
2748 [cat > conftest.c <<EOF
2749 #pragma GCC visibility push(hidden)
2750 #pragma GCC visibility push(default)
2752 #pragma GCC visibility pop
2754 __attribute__ ((visibility ("default"))) void Func() {
2756 memset(c, 0, sizeof(c));
2759 ac_cv_have_visibility_builtin_bug=no
2760 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2761 ac_cv_have_visibility_builtin_bug=yes
2763 if test `grep -c "@PLT" conftest.S` = 0; then
2764 ac_cv_visibility_builtin_bug=yes
2767 rm -f conftest.{c,S}
2769 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2770 "$ac_cv_have_visibility_class_bug" = "no"; then
2771 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2772 WRAP_SYSTEM_INCLUDES=1
2773 STL_FLAGS='-I$(DIST)/stl_wrappers'
2776 VISIBILITY_FLAGS='-fvisibility=hidden'
2777 fi # have visibility pragma bug
2778 fi # have visibility pragma
2779 fi # have visibility(default) attribute
2780 fi # have visibility(hidden) attribute
2783 # visibility hidden flag for Sun Studio on Solaris
2784 if test "$SOLARIS_SUNPRO_CC"; then
2785 VISIBILITY_FLAGS='-xldscope=hidden'
2786 fi # Sun Studio on Solaris
2788 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2789 AC_SUBST(VISIBILITY_FLAGS)
2793 if test "$OS_TARGET" != WINNT; then
2794 # Only run this test with clang on non-Windows platforms, because clang
2795 # cannot do enough code gen for now to make this test work correctly.
2799 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2800 dnl ========================================================
2801 if test "$GNU_CC"; then
2802 CFLAGS_save="${CFLAGS}"
2803 CFLAGS="${CFLAGS} -Werror"
2804 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2805 ac_cv_force_align_arg_pointer,
2806 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2808 ac_cv_force_align_arg_pointer="yes",
2809 ac_cv_force_align_arg_pointer="no")])
2810 CFLAGS="${CFLAGS_save}"
2811 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2812 HAVE_GCC_ALIGN_ARG_POINTER=1
2814 HAVE_GCC_ALIGN_ARG_POINTER=
2817 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2819 dnl Checks for header files.
2820 dnl ========================================================
2822 case "$target_os" in
2824 # for stuff like -lXshm
2825 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2828 MOZ_CHECK_COMMON_HEADERS
2830 dnl These are all the places some variant of statfs can be hiding.
2831 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2834 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2835 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2837 dnl SCTP support - needs various network include headers
2838 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2840 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2842 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2843 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2844 ac_cv_sockaddr_in_sin_len,
2845 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2846 #include <sys/types.h>
2848 #include <netinet/in.h>
2849 struct sockaddr_in x;
2850 void *foo = (void*) &x.sin_len;],
2852 [ac_cv_sockaddr_in_sin_len=true],
2853 [ac_cv_sockaddr_in_sin_len=false])])
2854 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2855 AC_DEFINE(HAVE_SIN_LEN)
2856 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2857 AC_DEFINE(HAVE_SCONN_LEN)
2860 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2861 ac_cv_sockaddr_in6_sin6_len,
2862 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2863 #include <sys/types.h>
2865 #include <netinet/in.h>
2866 struct sockaddr_in6 x;
2867 void *foo = (void*) &x.sin6_len;],
2869 [ac_cv_sockaddr_in6_sin6_len=true],
2870 [ac_cv_sockaddr_in6_sin6_len=false])])
2871 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2872 AC_DEFINE(HAVE_SIN6_LEN)
2875 AC_CACHE_CHECK(for sockaddr.sa_len,
2876 ac_cv_sockaddr_sa_len,
2877 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2878 #include <sys/types.h>
2880 #include <sys/socket.h>
2882 void *foo = (void*) &x.sa_len;],
2884 [ac_cv_sockaddr_sa_len=true],
2885 [ac_cv_sockaddr_sa_len=false])])
2886 if test "$ac_cv_sockaddr_sa_len" = true ; then
2887 AC_DEFINE(HAVE_SA_LEN)
2890 AC_ARG_ENABLE(dtrace,
2891 [ --enable-dtrace build with dtrace support if available (default=no)],
2892 [enable_dtrace="yes"],)
2893 if test "x$enable_dtrace" = "xyes"; then
2894 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2895 if test -n "$HAVE_DTRACE"; then
2896 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2898 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2901 AC_SUBST(HAVE_DTRACE)
2907 MOZ_CHECK_HEADERS(sys/cdefs.h)
2911 MOZ_LINUX_PERF_EVENT
2913 dnl Checks for libraries.
2914 dnl ========================================================
2919 AC_CHECK_LIB(c_r, gethostbyname_r)
2923 dnl We don't want to link with libdl even if it's present on OS X, since
2924 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2926 dnl We don't want to link against libm or libpthread on Darwin since
2927 dnl they both are just symlinks to libSystem and explicitly linking
2928 dnl against libSystem causes issues when debugging (see bug 299601).
2935 AC_SEARCH_LIBS(dlopen, dl,
2936 MOZ_CHECK_HEADER(dlfcn.h,
2937 AC_DEFINE(HAVE_DLOPEN)))
2941 _SAVE_CFLAGS="$CFLAGS"
2942 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2943 AC_CHECK_FUNCS(dladdr memmem)
2944 CFLAGS="$_SAVE_CFLAGS"
2946 if test ! "$GNU_CXX"; then
2950 AC_CHECK_LIB(C_r, demangle)
2953 AC_CHECK_LIB(C, demangle)
2958 dnl OS/2 has socket in libc.
2963 AC_CHECK_LIB(socket, socket)
2967 XLIBS="$X_EXTRA_LIBS"
2969 dnl ========================================================
2970 dnl Checks for X libraries.
2971 dnl Ordering is important.
2972 dnl Xt is dependent upon SM as of X11R6
2973 dnl ========================================================
2974 if test "$no_x" = "yes"; then
2977 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2978 XLIBS="-lX11 $XLIBS"
2979 _SAVE_LDFLAGS="$LDFLAGS"
2980 LDFLAGS="$XLDFLAGS $LDFLAGS"
2981 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2982 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2983 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2984 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2986 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2987 unset ac_cv_lib_Xt_XtFree
2988 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2989 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
2990 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2991 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2994 # AIX needs the motif library linked before libXt to prevent
2995 # crashes in plugins linked against Motif - Bug #98892
2996 case "${target_os}" in
2998 XT_LIBS="-lXm $XT_LIBS"
3002 dnl ========================================================
3003 dnl = Check for XShm
3004 dnl ========================================================
3005 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3008 dnl ========================================================
3010 dnl ========================================================
3011 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3012 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3013 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3014 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3016 LDFLAGS="$_SAVE_LDFLAGS"
3026 dnl ========================================================
3027 dnl = pthread support
3028 dnl = Start by checking whether the system support pthreads
3029 dnl ========================================================
3030 case "$target_os" in
3035 MOZ_CHECK_PTHREADS(pthreads,
3036 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3037 MOZ_CHECK_PTHREADS(pthread,
3038 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3039 MOZ_CHECK_PTHREADS(c_r,
3040 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3041 MOZ_CHECK_PTHREADS(c,
3050 dnl ========================================================
3051 dnl Check the command line for --with-pthreads
3052 dnl ========================================================
3053 MOZ_ARG_WITH_BOOL(pthreads,
3054 [ --with-pthreads Force use of system pthread library with NSPR ],
3055 [ if test "$MOZ_USE_PTHREADS"x = x; then
3056 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3062 dnl ========================================================
3063 dnl Do the platform specific pthread hackery
3064 dnl ========================================================
3065 if test "$MOZ_USE_PTHREADS"x != x
3068 dnl See if -pthread is supported.
3071 ac_cv_have_dash_pthread=no
3072 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3073 echo 'int main() { return 0; }' | cat > conftest.c
3074 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3075 if test $? -eq 0; then
3076 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3077 ac_cv_have_dash_pthread=yes
3078 case "$target_os" in
3080 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3083 CFLAGS="$CFLAGS -pthread"
3084 CXXFLAGS="$CXXFLAGS -pthread"
3090 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3093 dnl See if -pthreads is supported.
3095 ac_cv_have_dash_pthreads=no
3096 if test "$ac_cv_have_dash_pthread" = "no"; then
3097 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3098 echo 'int main() { return 0; }' | cat > conftest.c
3099 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3100 if test $? -eq 0; then
3101 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3102 ac_cv_have_dash_pthreads=yes
3103 CFLAGS="$CFLAGS -pthreads"
3104 CXXFLAGS="$CXXFLAGS -pthreads"
3108 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3113 AC_DEFINE(_REENTRANT)
3114 AC_DEFINE(_THREAD_SAFE)
3115 dnl -pthread links in -lpthread, so don't specify it explicitly.
3116 if test "$ac_cv_have_dash_pthread" = "yes"; then
3117 _PTHREAD_LDFLAGS="-pthread"
3121 *-*-openbsd*|*-*-bsdi*)
3122 AC_DEFINE(_REENTRANT)
3123 AC_DEFINE(_THREAD_SAFE)
3124 dnl -pthread links in -lc_r, so don't specify it explicitly.
3125 if test "$ac_cv_have_dash_pthread" = "yes"; then
3126 _PTHREAD_LDFLAGS="-pthread"
3130 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3131 AC_DEFINE(_REENTRANT)
3135 AC_DEFINE(_REENTRANT)
3139 AC_DEFINE(_REENTRANT)
3143 AC_DEFINE(_REENTRANT)
3144 if test "$SOLARIS_SUNPRO_CC"; then
3145 CFLAGS="$CFLAGS -mt"
3146 CXXFLAGS="$CXXFLAGS -mt"
3150 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3151 AC_SUBST(MOZ_USE_PTHREADS)
3155 dnl Checks for library functions.
3156 dnl ========================================================
3157 AC_PROG_GCC_TRADITIONAL
3159 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf memmove rint stat64 lstat64 truncate64 setbuf isatty)
3160 AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
3161 AC_CHECK_FUNCS(flockfile getpagesize)
3162 AC_CHECK_FUNCS(localtime_r strtok_r)
3164 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3165 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3166 ac_cv_clock_monotonic,
3167 [for libs in "" -lrt; do
3170 AC_TRY_LINK([#include <time.h>],
3171 [ struct timespec ts;
3172 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3173 ac_cv_clock_monotonic=$libs
3176 ac_cv_clock_monotonic=no)
3179 if test "$ac_cv_clock_monotonic" != "no"; then
3180 HAVE_CLOCK_MONOTONIC=1
3181 REALTIME_LIBS=$ac_cv_clock_monotonic
3182 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3183 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3184 AC_SUBST(REALTIME_LIBS)
3187 dnl check for wcrtomb/mbrtowc
3188 dnl =======================================================================
3189 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3192 AC_CACHE_CHECK(for wcrtomb,
3194 [AC_TRY_LINK([#include <wchar.h>],
3195 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3196 ac_cv_have_wcrtomb="yes",
3197 ac_cv_have_wcrtomb="no")])
3198 if test "$ac_cv_have_wcrtomb" = "yes"; then
3199 AC_DEFINE(HAVE_WCRTOMB)
3201 AC_CACHE_CHECK(for mbrtowc,
3203 [AC_TRY_LINK([#include <wchar.h>],
3204 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3205 ac_cv_have_mbrtowc="yes",
3206 ac_cv_have_mbrtowc="no")])
3207 if test "$ac_cv_have_mbrtowc" = "yes"; then
3208 AC_DEFINE(HAVE_MBRTOWC)
3215 ac_cv_func_res_ninit,
3218 #define _BSD_SOURCE 1
3222 [int foo = res_ninit(&_res);],
3223 [ac_cv_func_res_ninit=yes],
3224 [ac_cv_func_res_ninit=no])
3227 if test "$ac_cv_func_res_ninit" = "yes"; then
3228 AC_DEFINE(HAVE_RES_NINIT)
3229 dnl must add the link line we do something as foolish as this... dougt
3231 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3232 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3237 [for gnu_get_libc_version()],
3238 ac_cv_func_gnu_get_libc_version,
3240 #ifdef HAVE_GNU_LIBC_VERSION_H
3241 #include <gnu/libc-version.h>
3244 [const char *glibc_version = gnu_get_libc_version();],
3245 [ac_cv_func_gnu_get_libc_version=yes],
3246 [ac_cv_func_gnu_get_libc_version=no]
3250 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3251 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3255 darwin*|mingw*|os2*)
3259 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3260 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3261 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3263 LIBS="$LIBS $_ICONV_LIBS"
3272 iconv_t h = iconv_open("", "");
3273 iconv(h, NULL, NULL, NULL, NULL);
3276 [ac_cv_func_iconv=yes],
3277 [ac_cv_func_iconv=no]
3280 if test "$ac_cv_func_iconv" = "yes"; then
3281 AC_DEFINE(HAVE_ICONV)
3282 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3283 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3284 LIBICONV="$_ICONV_LIBS"
3286 [for iconv() with const input],
3287 ac_cv_func_const_iconv,
3293 const char *input = "testing";
3294 iconv_t h = iconv_open("", "");
3295 iconv(h, &input, NULL, NULL, NULL);
3298 [ac_cv_func_const_iconv=yes],
3299 [ac_cv_func_const_iconv=no]
3302 if test "$ac_cv_func_const_iconv" = "yes"; then
3303 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3315 dnl **********************
3316 dnl *** va_copy checks ***
3317 dnl **********************
3318 dnl we currently check for all three va_copy possibilities, so we get
3319 dnl all results in config.log for bug reports.
3320 AC_MSG_CHECKING(for an implementation of va_copy())
3321 AC_CACHE_VAL(ac_cv_va_copy,[
3324 void f (int i, ...) {
3325 va_list args1, args2;
3326 va_start (args1, i);
3327 va_copy (args2, args1);
3328 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3330 va_end (args1); va_end (args2);
3332 int main() { f (0, 42); return 0; }],
3338 AC_MSG_RESULT($ac_cv_va_copy)
3339 AC_MSG_CHECKING(for an implementation of __va_copy())
3340 AC_CACHE_VAL(ac_cv___va_copy,[
3343 void f (int i, ...) {
3344 va_list args1, args2;
3345 va_start (args1, i);
3346 __va_copy (args2, args1);
3347 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3349 va_end (args1); va_end (args2);
3351 int main() { f (0, 42); return 0; }],
3352 ac_cv___va_copy=yes,
3357 AC_MSG_RESULT($ac_cv___va_copy)
3358 AC_MSG_CHECKING(whether va_lists can be copied by value)
3359 AC_CACHE_VAL(ac_cv_va_val_copy,[
3362 void f (int i, ...) {
3363 va_list args1, args2;
3364 va_start (args1, i);
3366 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3368 va_end (args1); va_end (args2);
3370 int main() { f (0, 42); return 0; }],
3371 ac_cv_va_val_copy=yes,
3372 ac_cv_va_val_copy=no,
3373 ac_cv_va_val_copy=yes
3376 if test "x$ac_cv_va_copy" = "xyes"; then
3377 AC_DEFINE(VA_COPY, va_copy)
3378 AC_DEFINE(HAVE_VA_COPY)
3379 elif test "x$ac_cv___va_copy" = "xyes"; then
3380 AC_DEFINE(VA_COPY, __va_copy)
3381 AC_DEFINE(HAVE_VA_COPY)
3384 if test "x$ac_cv_va_val_copy" = "xno"; then
3385 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3387 AC_MSG_RESULT($ac_cv_va_val_copy)
3389 dnl ===================================================================
3390 dnl ========================================================
3391 dnl Put your C++ language/feature checks below
3392 dnl ========================================================
3396 if test "$GNU_CC"; then
3397 if test "$CPU_ARCH" = "arm" ; then
3398 AC_CACHE_CHECK(for ARM EABI,
3402 #if defined(__ARM_EABI__)
3405 #error Not ARM EABI.
3408 ac_cv_gcc_arm_eabi="yes",
3409 ac_cv_gcc_arm_eabi="no")])
3410 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3412 ARM_ABI_PREFIX=eabi-
3414 ARM_ABI_PREFIX=oabi-
3418 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3421 dnl Check to see if we can resolve ambiguity with |using|.
3422 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3423 ac_cv_cpp_ambiguity_resolving_using,
3424 [AC_TRY_COMPILE(class X {
3425 public: int go(const X&) {return 3;}
3426 int jo(const X&) {return 3;}
3428 class Y : public X {
3429 public: int go(int) {return 2;}
3430 int jo(int) {return 2;}
3432 private: using X::go;
3435 ac_cv_cpp_ambiguity_resolving_using=yes,
3436 ac_cv_cpp_ambiguity_resolving_using=no)])
3437 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3438 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3441 dnl See if a dynamic_cast to void* gives the most derived object.
3442 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3443 ac_cv_cpp_dynamic_cast_void_ptr,
3444 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3445 class Y { int j; public: virtual ~Y() { } };
3446 class Z : public X, public Y { int k; };
3452 return !((((void*)&mdo != (void*)subx) &&
3453 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3454 (((void*)&mdo != (void*)suby) &&
3455 ((void*)&mdo == dynamic_cast<void*>(suby))));
3457 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3458 ac_cv_cpp_dynamic_cast_void_ptr=no,
3459 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3460 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3461 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3465 dnl note that this one is reversed - if the test fails, then
3466 dnl we require implementations of unused virtual methods. Which
3467 dnl really blows because it means we'll have useless vtable
3469 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3470 ac_cv_cpp_unused_required,
3471 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3473 ac_cv_cpp_unused_required=no,
3474 ac_cv_cpp_unused_required=yes)])
3475 if test "$ac_cv_cpp_unused_required" = yes ; then
3476 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3480 dnl Some compilers have trouble comparing a constant reference to a templatized
3481 dnl class to zero, and require an explicit operator==() to be defined that takes
3482 dnl an int. This test separates the strong from the weak.
3484 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3485 ac_cv_trouble_comparing_to_zero,
3486 [AC_TRY_COMPILE([#include <algorithm>
3487 template <class T> class Foo {};
3489 template <class T> int operator==(const T2*, const T&) { return 0; }
3490 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3491 [Foo<int> f; return (0 != f);],
3492 ac_cv_trouble_comparing_to_zero=no,
3493 ac_cv_trouble_comparing_to_zero=yes)])
3494 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3495 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3498 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3499 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3500 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3502 _SAVE_LDFLAGS=$LDFLAGS
3503 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3504 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3505 ac_cv_thread_keyword,
3506 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3507 [return tlsIsMainThread;],
3508 ac_cv_thread_keyword=yes,
3509 ac_cv_thread_keyword=no)])
3510 LDFLAGS=$_SAVE_LDFLAGS
3511 # The custom dynamic linker doesn't support TLS variables
3513 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3514 # mips builds fail with TLS variables because of a binutils bug.
3516 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3521 *-android*|*-linuxandroid*)
3528 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3534 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3535 if test -n "$MOZ_LINKER"; then
3536 if test "$CPU_ARCH" = arm; then
3537 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3538 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3539 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3540 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3545 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3546 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3547 dnl We however want to avoid these text relocations, and this can be done
3548 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3549 dnl doesn't contain anything at all, beside placeholders for some sections,
3550 dnl and crtbegin only contains a finalizer function that calls
3551 dnl __cxa_finalize. The custom linker actually takes care of calling
3552 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3553 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3554 dnl link crtbegin and crtend at all.
3555 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3556 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3557 ac_cv_crt_has_text_relocations,
3558 [echo 'int foo() { return 0; }' > conftest.cpp
3559 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3560 test -s conftest${DLL_SUFFIX}; then
3561 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3562 ac_cv_crt_has_text_relocations=yes
3564 ac_cv_crt_has_text_relocations=no
3567 AC_ERROR([couldn't compile a simple C file])
3570 if test "$ac_cv_crt_has_text_relocations" = yes; then
3571 dnl While we want libraries to skip the CRT files, we don't want
3572 dnl executables to be treated the same way. We thus set the flag
3573 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3574 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3575 dnl Using LDFLAGS in nspr is safe, since we only really build
3576 dnl libraries there.
3577 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3578 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3582 dnl Check for the existence of various allocation headers/functions
3584 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3587 for file in $MALLOC_HEADERS; do
3588 MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3589 if test "$MALLOC_H" != ""; then
3590 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3595 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3596 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3598 AC_CHECK_FUNCS(malloc_usable_size)
3600 dnl See if compiler supports some gcc-style attributes
3602 AC_CACHE_CHECK(for __attribute__((always_inline)),
3603 ac_cv_attribute_always_inline,
3604 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3606 ac_cv_attribute_always_inline=yes,
3607 ac_cv_attribute_always_inline=no)])
3609 AC_CACHE_CHECK(for __attribute__((malloc)),
3610 ac_cv_attribute_malloc,
3611 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3613 ac_cv_attribute_malloc=yes,
3614 ac_cv_attribute_malloc=no)])
3616 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3617 ac_cv_attribute_warn_unused,
3618 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3620 ac_cv_attribute_warn_unused=yes,
3621 ac_cv_attribute_warn_unused=no)])
3623 dnl End of C++ language/feature checks
3626 dnl ========================================================
3627 dnl = Internationalization checks
3628 dnl ========================================================
3630 dnl Internationalization and Locale support is different
3631 dnl on various UNIX platforms. Checks for specific i18n
3632 dnl features go here.
3634 dnl check for LC_MESSAGES
3635 AC_CACHE_CHECK(for LC_MESSAGES,
3636 ac_cv_i18n_lc_messages,
3637 [AC_TRY_COMPILE([#include <locale.h>],
3638 [int category = LC_MESSAGES;],
3639 ac_cv_i18n_lc_messages=yes,
3640 ac_cv_i18n_lc_messages=no)])
3641 if test "$ac_cv_i18n_lc_messages" = yes; then
3642 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3645 AC_HAVE_FUNCS(localeconv)
3646 fi # ! SKIP_COMPILER_CHECKS
3649 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3650 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3653 dnl Mozilla specific options
3654 dnl ========================================================
3655 dnl The macros used for command line options
3656 dnl are defined in build/autoconf/altoptions.m4.
3658 dnl If the compiler supports these attributes, define them as
3659 dnl convenience macros.
3660 if test "$ac_cv_attribute_malloc" = yes ; then
3661 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3663 AC_DEFINE(NS_ATTR_MALLOC,)
3666 if test "$ac_cv_attribute_warn_unused" = yes ; then
3667 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3669 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3672 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3673 dnl features that Windows actually does support.
3675 if test -n "$SKIP_COMPILER_CHECKS"; then
3676 dnl Windows has malloc.h
3677 AC_DEFINE(MALLOC_H, [<malloc.h>])
3678 AC_DEFINE(HAVE_FORCEINLINE)
3679 AC_DEFINE(HAVE_LOCALECONV)
3680 fi # SKIP_COMPILER_CHECKS
3682 dnl ========================================================
3684 dnl = Check for external package dependencies
3686 dnl ========================================================
3687 MOZ_ARG_HEADER(External Packages)
3689 MOZ_ARG_WITH_STRING(libxul-sdk,
3690 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3691 LIBXUL_SDK_DIR=$withval)
3693 if test "$LIBXUL_SDK_DIR" = "yes"; then
3694 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3695 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3696 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3698 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3699 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3703 AC_SUBST(LIBXUL_SDK)
3705 if test -n "$LIBXUL_SDK"; then
3706 LIBXUL_DIST="$LIBXUL_SDK"
3708 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3710 AC_SUBST(LIBXUL_DIST)
3714 MOZ_ARG_WITH_BOOL(system-libxul,
3715 [ --with-system-libxul Use system installed libxul SDK],
3718 dnl ========================================================
3719 dnl = If NSPR was not detected in the system,
3720 dnl = use the one in the source tree (mozilla/nsprpub)
3721 dnl ========================================================
3722 MOZ_ARG_WITH_BOOL(system-nspr,
3723 [ --with-system-nspr Use system installed NSPR],
3724 _USE_SYSTEM_NSPR=1 )
3726 if test -n "$_USE_SYSTEM_NSPR"; then
3727 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])])
3730 if test -n "$MOZ_NATIVE_NSPR"; then
3731 _SAVE_CFLAGS=$CFLAGS
3732 CFLAGS="$CFLAGS $NSPR_CFLAGS"
3733 AC_TRY_COMPILE([#include "prtypes.h"],
3734 [#ifndef PR_STATIC_ASSERT
3735 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3737 [MOZ_NATIVE_NSPR=1],
3738 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3739 AC_TRY_COMPILE([#include "prtypes.h"],
3741 #error PR_UINT64 not defined or requires including prtypes.h
3743 [MOZ_NATIVE_NSPR=1],
3744 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3745 CFLAGS=$_SAVE_CFLAGS
3747 if test -z "$LIBXUL_SDK"; then
3748 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3749 if test -n "$GNU_CC"; then
3750 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3752 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3755 NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3756 NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3760 dnl set GRE_MILESTONE
3761 dnl ========================================================
3762 if test -n "$LIBXUL_SDK"; then
3763 GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3765 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3767 AC_SUBST(GRE_MILESTONE)
3769 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3770 # The logic works like this:
3771 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3772 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3773 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3774 case "$GRE_MILESTONE" in
3777 AC_DEFINE(NIGHTLY_BUILD)
3783 AC_DEFINE(RELEASE_BUILD)
3786 AC_SUBST(NIGHTLY_BUILD)
3787 AC_SUBST(RELEASE_BUILD)
3789 dnl system libevent Support
3790 dnl ========================================================
3791 MOZ_ARG_WITH_STRING(system-libevent,
3792 [ --with-system-libevent[=PFX]
3793 Use system libevent [installed at prefix PFX]],
3794 LIBEVENT_DIR=$withval)
3796 _SAVE_CFLAGS=$CFLAGS
3797 _SAVE_LDFLAGS=$LDFLAGS
3799 if test "$LIBEVENT_DIR" = yes; then
3800 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3801 MOZ_NATIVE_LIBEVENT=1,
3804 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3805 MOZ_NATIVE_LIBEVENT=
3806 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3807 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3808 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3809 MOZ_CHECK_HEADER(event.h,
3810 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3811 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3813 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3814 AC_CHECK_LIB(event, event_init,
3815 [MOZ_NATIVE_LIBEVENT=1
3816 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3817 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3818 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3820 CFLAGS=$_SAVE_CFLAGS
3821 LDFLAGS=$_SAVE_LDFLAGS
3824 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3825 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
3826 AC_SUBST(MOZ_LIBEVENT_LIBS)
3828 dnl ========================================================
3829 dnl = If NSS was not detected in the system,
3830 dnl = use the one in the source tree (mozilla/security/nss)
3831 dnl ========================================================
3833 MOZ_ARG_WITH_BOOL(system-nss,
3834 [ --with-system-nss Use system installed NSS],
3837 if test -n "$_USE_SYSTEM_NSS"; then
3838 AM_PATH_NSS(3.15, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3841 if test -n "$MOZ_NATIVE_NSS"; then
3842 NSS_LIBS="$NSS_LIBS -lcrmf"
3844 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3846 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
3848 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3849 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3850 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3851 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3852 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3854 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3858 dnl ======================
3860 dnl ======================
3862 AC_MSG_CHECKING([for YASM assembler])
3863 AC_CHECK_PROGS(YASM, yasm, "")
3865 if test -n "$YASM"; then
3866 dnl Pull out yasm's version string
3867 YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3868 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3869 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3870 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3871 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3874 if test -z "$SKIP_LIBRARY_CHECKS"; then
3875 dnl system JPEG support
3876 dnl ========================================================
3877 MOZ_ARG_WITH_STRING(system-jpeg,
3878 [ --with-system-jpeg[=PFX]
3879 Use system libjpeg [installed at prefix PFX]],
3882 _SAVE_CFLAGS=$CFLAGS
3883 _SAVE_LDFLAGS=$LDFLAGS
3885 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3886 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3887 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3889 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3892 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3895 if test "$MOZ_NATIVE_JPEG" = 1; then
3896 AC_TRY_COMPILE([ #include <stdio.h>
3897 #include <sys/types.h>
3898 #include <jpeglib.h> ],
3899 [ #if JPEG_LIB_VERSION < $MOZJPEG
3900 #error "Insufficient JPEG library version ($MOZJPEG required)."
3902 #ifndef JCS_EXTENSIONS
3903 #error "libjpeg-turbo JCS_EXTENSIONS required"
3907 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3909 CFLAGS=$_SAVE_CFLAGS
3910 LDFLAGS=$_SAVE_LDFLAGS
3913 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3914 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3915 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3917 fi # SKIP_LIBRARY_CHECKS
3919 dnl system ZLIB support
3920 dnl ========================================================
3921 MOZ_ZLIB_CHECK([1.2.3])
3923 if test "$MOZ_NATIVE_ZLIB" != 1; then
3925 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
3928 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
3929 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
3932 if test -z "$SKIP_LIBRARY_CHECKS"; then
3933 dnl system BZIP2 Support
3934 dnl ========================================================
3935 MOZ_ARG_WITH_STRING(system-bz2,
3936 [ --with-system-bz2[=PFX]
3937 Use system libbz2 [installed at prefix PFX]],
3940 _SAVE_CFLAGS=$CFLAGS
3941 _SAVE_LDFLAGS=$LDFLAGS
3943 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
3944 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
3945 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
3947 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
3950 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
3951 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
3953 CFLAGS=$_SAVE_CFLAGS
3954 LDFLAGS=$_SAVE_LDFLAGS
3957 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
3958 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
3959 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
3962 dnl system PNG Support
3963 dnl ========================================================
3964 MOZ_ARG_WITH_STRING(system-png,
3965 [ --with-system-png[=PFX]
3966 Use system libpng [installed at prefix PFX]],
3969 _SAVE_CFLAGS=$CFLAGS
3970 _SAVE_LDFLAGS=$LDFLAGS
3972 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
3973 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
3974 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
3976 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
3979 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
3980 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3981 AC_CHECK_LIB(png, png_get_acTL, ,
3982 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
3984 if test "$MOZ_NATIVE_PNG" = 1; then
3985 AC_TRY_COMPILE([ #include <stdio.h>
3986 #include <sys/types.h>
3988 [ #if PNG_LIBPNG_VER < $MOZPNG
3989 #error "Insufficient libpng version ($MOZPNG required)."
3991 #ifndef PNG_UINT_31_MAX
3992 #error "Insufficient libpng version."
3995 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3997 CFLAGS=$_SAVE_CFLAGS
3998 LDFLAGS=$_SAVE_LDFLAGS
4001 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
4002 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
4003 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
4007 if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
4010 AC_SUBST(MOZ_PNG_ARM_NEON)
4012 fi # SKIP_LIBRARY_CHECKS
4014 dnl system HunSpell Support
4015 dnl ========================================================
4016 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4017 [ --enable-system-hunspell
4018 Use system hunspell (located with pkgconfig)],
4019 MOZ_NATIVE_HUNSPELL=1 )
4021 if test -n "$MOZ_NATIVE_HUNSPELL"; then
4022 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4025 AC_SUBST(MOZ_NATIVE_HUNSPELL)
4027 dnl ========================================================
4028 dnl system libffi Support
4029 dnl ========================================================
4030 MOZ_ARG_ENABLE_BOOL(system-ffi,
4031 [ --enable-system-ffi Use system libffi (located with pkgconfig)],
4034 if test -n "$MOZ_NATIVE_FFI"; then
4035 # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4036 # for non-GCC compilers.
4037 if test -z "$GNU_CC"; then
4038 PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4040 PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4042 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4045 dnl ========================================================
4046 dnl System ICU Support
4047 dnl ========================================================
4049 MOZ_ARG_WITH_BOOL(system-icu,
4051 Use system ICU (located with pkgconfig)],
4054 if test -n "$MOZ_NATIVE_ICU"; then
4055 PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1)
4056 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_ICU_LIBS"
4059 AC_SUBST(MOZ_NATIVE_ICU)
4061 dnl ========================================================
4062 dnl Java SDK support
4063 dnl ========================================================
4066 MOZ_ARG_WITH_STRING(java-bin-path,
4067 [ --with-java-bin-path=dir
4068 Location of Java binaries (java, javac, jar)],
4069 JAVA_BIN_PATH=$withval)
4071 dnl ========================================================
4075 dnl ========================================================
4077 MOZ_ARG_HEADER(Application)
4080 ENABLE_SYSTEM_EXTENSION_DIRS=1
4081 MOZ_BRANDING_DIRECTORY=
4082 MOZ_OFFICIAL_BRANDING=
4086 MOZ_AUTH_EXTENSION=1
4089 MOZ_SPEEX_RESAMPLER=1
4095 MOZ_SAMPLE_TYPE_FLOAT32=
4096 MOZ_SAMPLE_TYPE_S16=
4105 MOZ_WEBRTC_SIGNALING=
4106 MOZ_WEBRTC_IN_LIBXUL=
4107 MOZ_WEBRTC_ASSERT_ALWAYS=1
4110 MOZ_MEDIA_NAVIGATOR=
4113 MOZ_VP8_ERROR_CONCEALMENT=
4124 LIBJPEG_TURBO_ASFLAGS=
4125 LIBJPEG_TURBO_X86_ASM=
4126 LIBJPEG_TURBO_X64_ASM=
4127 LIBJPEG_TURBO_ARM_ASM=
4132 MOZ_PREF_EXTENSIONS=1
4133 MOZ_PROFILELOCKING=1
4139 MOZ_TOOLKIT_SEARCH=1
4141 MOZ_UNIVERSALCHARDET=1
4147 MOZ_DISABLE_CRYPTOLEGACY=
4150 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4153 MOZ_USE_NATIVE_POPUP_WINDOWS=
4154 MOZ_ANDROID_HISTORY=
4160 MOZ_AUDIO_CHANNEL_MANAGER=
4162 MOZ_CONTENT_SANDBOX=
4163 MOZ_CONTENT_SANDBOX_REPORTER=
4165 case "$target_os" in
4168 AC_DEFINE(NS_ENABLE_TSF)
4173 *-android*|*-linuxandroid*)
4174 if test "$CPU_ARCH" = "arm" ; then
4179 MOZ_THEME_FASTSTRIPE=1
4187 MOZ_ARG_WITH_STRING(external-source-dir,
4188 [ --with-external-source-dir=dir
4189 External directory containing additional build files.],
4190 [ EXTERNAL_SOURCE_DIR=$withval])
4191 AC_SUBST(EXTERNAL_SOURCE_DIR)
4193 MOZ_ARG_ENABLE_STRING(application,
4194 [ --enable-application=APP
4198 tools/update-packaging (AUS-related packaging tools)],
4199 [ MOZ_BUILD_APP=$enableval ] )
4201 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4202 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4203 XULRUNNER_STUB_NAME=$withval)
4205 if test -z "$XULRUNNER_STUB_NAME"; then
4206 case "$target_os" in
4208 XULRUNNER_STUB_NAME=xulrunner
4211 XULRUNNER_STUB_NAME=xulrunner-stub
4214 AC_SUBST(XULRUNNER_STUB_NAME)
4216 AC_MSG_CHECKING([for application to build])
4217 if test -z "$MOZ_BUILD_APP"; then
4218 AC_MSG_RESULT([browser])
4219 MOZ_BUILD_APP=browser
4221 # "mobile" no longer exists.
4222 if test "$MOZ_BUILD_APP" = "mobile" ; then
4223 AC_MSG_RESULT([none])
4224 AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
4226 # We have a valid application only if it has a build.mk file in its top
4228 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4229 AC_MSG_RESULT([none])
4230 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4232 AC_MSG_RESULT([$MOZ_BUILD_APP])
4236 # The app update channel is 'default' when not supplied. The value is used in
4237 # the application's confvars.sh so it must be set before confvars.sh is called.
4238 MOZ_ARG_ENABLE_STRING([update-channel],
4239 [ --enable-update-channel=CHANNEL
4240 Select application update channel (default=default)],
4241 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4243 if test -z "$MOZ_UPDATE_CHANNEL"; then
4244 MOZ_UPDATE_CHANNEL=default
4246 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4247 AC_SUBST(MOZ_UPDATE_CHANNEL)
4249 # Allow to specify a Google API key file that contains the secret key to be
4250 # used for various Google API requests.
4251 MOZ_ARG_WITH_STRING(google-api-keyfile,
4252 [ --with-google-api-keyfile=file Use the secret key contained in the given keyfile for Google API requests],
4253 MOZ_GOOGLE_API_KEY=`cat $withval`)
4254 if test -z "$MOZ_GOOGLE_API_KEY"; then
4255 MOZ_GOOGLE_API_KEY=no-google-api-key
4257 AC_SUBST(MOZ_GOOGLE_API_KEY)
4259 # Allow the application to influence configure with a confvars.sh script.
4260 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4261 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4262 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4263 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4268 # Allow influencing configure with a defines.sh script.
4269 . "${srcdir}/build/defines.sh"
4271 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
4273 if test "$BUILDING_RELEASE"; then
4274 # Override value in defines.sh, if any
4275 EARLY_BETA_OR_EARLIER=
4276 elif test "$EARLY_BETA_OR_EARLIER"; then
4277 AC_DEFINE(EARLY_BETA_OR_EARLIER)
4279 AC_SUBST(EARLY_BETA_OR_EARLIER)
4281 # Allow the application to provide a subconfigure script
4282 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4283 do_output_subdirs() {
4284 if test -n "$_subconfigure_subdirs"; then
4285 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4287 _subconfigure_subdir="$1"
4288 _subconfigure_config_args="$ac_configure_args"
4290 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4291 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4292 "${srcdir}/build/autoconf/altoptions.m4" \
4293 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4298 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4299 MOZ_ARG_WITH_STRING(app-name,
4300 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4301 WITH_APP_NAME=$withval,
4304 if test -n "$WITH_APP_NAME" ; then
4305 MOZ_APP_NAME="$WITH_APP_NAME"
4308 MOZ_ARG_WITH_STRING(app-basename,
4309 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4310 WITH_APP_BASENAME=$withval,
4313 if test -n "$WITH_APP_BASENAME" ; then
4314 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4317 # Now is a good time to test for logic errors, define mismatches, etc.
4318 case "$MOZ_BUILD_APP" in
4320 if test "$LIBXUL_SDK"; then
4321 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4326 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4327 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4329 case "$MOZ_BUILD_APP" in
4331 AC_DEFINE(MOZ_PHOENIX)
4335 AC_DEFINE(MOZ_XULRUNNER)
4342 AC_SUBST(MOZ_BUILD_APP)
4343 AC_SUBST(MOZ_PHOENIX)
4344 AC_SUBST(MOZ_XULRUNNER)
4347 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4349 dnl ========================================================
4350 dnl Check android sdk version depending on mobile target
4351 dnl ========================================================
4353 if test -z "$gonkdir" ; then
4354 # Minimum Android SDK API Level we require.
4355 case "$MOZ_BUILD_APP" in
4357 android_min_api_level=16
4359 *-android*|*-linuxandroid*)
4363 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])
4369 MOZ_ANDROID_SDK($android_min_api_level)
4372 dnl ========================================================
4374 dnl = Toolkit Options
4376 dnl ========================================================
4377 MOZ_ARG_HEADER(Toolkit Options)
4379 dnl ========================================================
4380 dnl = Select the default toolkit
4381 dnl ========================================================
4382 MOZ_ARG_ENABLE_STRING(default-toolkit,
4383 [ --enable-default-toolkit=TK
4384 Select default toolkit
4385 Platform specific defaults:
4386 Mac OS X - cairo-cocoa
4388 Win32 - cairo-windows
4392 [ _DEFAULT_TOOLKIT=$enableval ],
4393 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4395 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4396 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4397 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4398 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4399 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4400 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4401 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4402 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4403 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4404 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4406 dnl nglayout only supports building with one toolkit,
4407 dnl so ignore everything after the first comma (",").
4408 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4410 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4413 MOZ_ARG_WITHOUT_BOOL(x,
4414 [ --without-x Build without X11],
4417 dnl ========================================================
4418 dnl = Enable the toolkit as needed =
4419 dnl ========================================================
4423 case "$MOZ_WIDGET_TOOLKIT" in
4426 MOZ_WIDGET_TOOLKIT=windows
4429 MOZ_INSTRUMENT_EVENT_LOOP=1
4430 if test -n "$GNU_CC"; then
4436 MOZ_WIDGET_TOOLKIT=gtk3
4439 MOZ_ENABLE_XREMOTE=1
4441 MOZ_GL_DEFAULT_PROVIDER=GLX
4447 TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4448 TK_LIBS='$(MOZ_GTK3_LIBS)'
4450 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4452 MOZ_INSTRUMENT_EVENT_LOOP=1
4455 cairo-gtk2|cairo-gtk2-x11)
4456 MOZ_WIDGET_TOOLKIT=gtk2
4459 MOZ_ENABLE_XREMOTE=1
4461 MOZ_GL_DEFAULT_PROVIDER=GLX
4467 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4468 TK_LIBS='$(MOZ_GTK2_LIBS)'
4469 AC_DEFINE(MOZ_WIDGET_GTK2)
4471 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4473 MOZ_INSTRUMENT_EVENT_LOOP=1
4477 MOZ_WIDGET_TOOLKIT=qt
4479 if test -z "$WITHOUT_X11"; then
4480 MOZ_ENABLE_XREMOTE=1
4481 MOZ_GL_DEFAULT_PROVIDER=GLX
4490 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4491 TK_LIBS='$(MOZ_QT_LIBS)'
4492 AC_DEFINE(MOZ_WIDGET_QT)
4494 AC_DEFINE(QT_NO_KEYWORDS)
4498 MOZ_WIDGET_TOOLKIT=os2
4500 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4501 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4506 MOZ_WIDGET_TOOLKIT=cocoa
4507 AC_DEFINE(MOZ_WIDGET_COCOA)
4508 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4509 TK_LIBS='-framework CoreLocation -framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4510 TK_CFLAGS="-DNO_X11"
4511 CFLAGS="$CFLAGS $TK_CFLAGS"
4512 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4513 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc'
4514 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc'
4515 MOZ_USER_DIR="Mozilla"
4516 MOZ_FS_LAYOUT=bundle
4518 MOZ_INSTRUMENT_EVENT_LOOP=1
4522 MOZ_WIDGET_TOOLKIT=uikit
4523 AC_DEFINE(MOZ_WIDGET_UIKIT)
4524 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4525 TK_CFLAGS="-DNO_X11"
4526 TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4527 CFLAGS="$CFLAGS $TK_CFLAGS"
4528 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4529 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc'
4530 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc'
4531 MOZ_USER_DIR="Mozilla"
4532 MOZ_FS_LAYOUT=bundle
4536 AC_DEFINE(MOZ_WIDGET_ANDROID)
4537 MOZ_WIDGET_TOOLKIT=android
4538 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4539 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4542 MOZ_INSTRUMENT_EVENT_LOOP=1
4546 AC_DEFINE(MOZ_WIDGET_GONK)
4547 AC_DEFINE(MOZ_TOUCH)
4548 MOZ_WIDGET_TOOLKIT=gonk
4549 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4550 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4558 AC_SUBST(MOZ_PDF_PRINTING)
4559 if test "$MOZ_PDF_PRINTING"; then
4560 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4561 AC_DEFINE(MOZ_PDF_PRINTING)
4564 if test "$MOZ_ENABLE_XREMOTE"; then
4565 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4568 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4569 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4572 if test "$COMPILE_ENVIRONMENT"; then
4573 if test "$MOZ_ENABLE_GTK3"; then
4574 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4576 if test "$MOZ_ENABLE_GTK2"; then
4577 if test "$MOZ_X11"; then
4578 GDK_PACKAGES=gdk-x11-2.0
4581 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4584 fi # COMPILE_ENVIRONMENT
4586 AC_SUBST(MOZ_FS_LAYOUT)
4588 dnl ========================================================
4589 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4590 dnl their usage and use them in spidermonkey.
4591 dnl ========================================================
4592 MOZ_ARG_WITH_BOOL(arm-kuser,
4593 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4595 if test -n "$USE_ARM_KUSER"; then
4596 AC_DEFINE(USE_ARM_KUSER)
4599 dnl ========================================================
4600 dnl = startup-notification support module
4601 dnl ========================================================
4603 if test "$MOZ_ENABLE_GTK"
4605 MOZ_ENABLE_STARTUP_NOTIFICATION=
4607 MOZ_ARG_ENABLE_BOOL(startup-notification,
4608 [ --enable-startup-notification
4609 Enable startup-notification support (default: disabled) ],
4610 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4611 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4612 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4614 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4615 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4616 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4617 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4619 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4621 MOZ_ENABLE_STARTUP_NOTIFICATION=
4625 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4626 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4629 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4631 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4632 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4633 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4635 dnl ========================================================
4637 dnl ========================================================
4638 if test "$MOZ_ENABLE_QT"
4640 MOZ_ARG_WITH_STRING(qtdir,
4641 [ --with-qtdir=\$dir Specify Qt directory ],
4644 if test -z "$QTDIR"; then
4645 AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4647 HOST_QMAKE="$QTDIR/bin/qmake"
4649 QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4651 if test -z "$QTDIR"; then
4654 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4655 PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5OpenGL Qt5Widgets Qt5PrintSupport, ,
4657 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4659 QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4660 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4663 AC_MSG_RESULT("Using qt4: $QT_VERSION")
4664 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL, ,
4666 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qt4 development package, (On Ubuntu, you might try installing the packages libqt4-dev libqt4-opengl-dev.)])
4670 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4674 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4675 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4677 MOZ_QT_CFLAGS="-DQT_SHARED"
4678 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4679 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4680 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4681 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4682 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4683 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4687 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4688 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml -lQt5OpenGL"
4689 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4690 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4691 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4692 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4695 AC_MSG_RESULT("Using qt4: $QT_VERSION")
4696 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4697 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4700 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4704 HOST_MOC="$QTDIR/bin/moc"
4705 HOST_RCC="$QTDIR/bin/rcc"
4707 if test -z "$HOST_MOC"; then
4708 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4711 if test -z "$HOST_RCC"; then
4712 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4719 MOZ_ENABLE_QMSYSTEM2=
4720 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4721 MOZ_ENABLE_QMSYSTEM2=1,
4722 MOZ_ENABLE_QMSYSTEM2=)
4724 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4725 MOZ_ENABLE_QMSYSTEM2=1
4726 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4727 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4728 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4731 MOZ_ENABLE_QTNETWORK=
4732 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4733 MOZ_ENABLE_QTNETWORK=1,
4734 MOZ_ENABLE_QTNETWORK=)
4736 if test "$MOZ_ENABLE_QTNETWORK"; then
4737 MOZ_ENABLE_QTNETWORK=1
4738 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4741 MOZ_ENABLE_QTMOBILITY=
4742 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4743 MOZ_ENABLE_QTMOBILITY=1,
4744 MOZ_ENABLE_QTMOBILITY=)
4745 if test "$MOZ_ENABLE_QTMOBILITY"; then
4746 MOZ_ENABLE_QTMOBILITY=1
4747 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4748 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4749 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4750 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4752 AC_CHECK_LIB(QtSensors, main, [
4753 MOZ_ENABLE_QTMOBILITY=1
4754 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4755 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4756 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4757 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4758 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4762 if test "$MOZ_ENABLE_CONTENTACTION"; then
4763 MOZ_ENABLE_CONTENTACTION=1
4764 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4767 MOZ_ENABLE_CONTENTACTION=
4768 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
4769 if test "$MOZ_ENABLE_CONTENTACTION"; then
4770 MOZ_ENABLE_CONTENTACTION=1
4771 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
4772 MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
4773 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4774 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
4778 AC_SUBST(GTK_CONFIG)
4782 AC_SUBST(MOZ_ENABLE_GTK2)
4783 AC_SUBST(MOZ_ENABLE_GTK3)
4784 AC_SUBST(MOZ_ENABLE_GTK)
4785 AC_SUBST(MOZ_ENABLE_QT)
4786 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4787 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4788 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4789 AC_SUBST(MOZ_ENABLE_XREMOTE)
4790 AC_SUBST(MOZ_GTK2_CFLAGS)
4791 AC_SUBST(MOZ_GTK2_LIBS)
4792 AC_SUBST(MOZ_GTK3_CFLAGS)
4793 AC_SUBST(MOZ_GTK3_LIBS)
4794 AC_SUBST(MOZ_WIDGET_GTK)
4795 AC_SUBST(MOZ_QT_CFLAGS)
4796 AC_SUBST(MOZ_QT_LIBS)
4803 dnl ========================================================
4805 dnl = Components & Features
4807 dnl ========================================================
4808 MOZ_ARG_HEADER(Components and Features)
4810 dnl ========================================================
4812 dnl ========================================================
4813 MOZ_ARG_ENABLE_STRING(ui-locale,
4814 [ --enable-ui-locale=ab-CD
4815 Select the user interface locale (default: en-US)],
4816 MOZ_UI_LOCALE=$enableval )
4817 AC_SUBST(MOZ_UI_LOCALE)
4819 dnl ========================================================
4820 dnl = Trademarked Branding
4821 dnl ========================================================
4822 MOZ_ARG_ENABLE_BOOL(official-branding,
4823 [ --enable-official-branding
4824 Enable Official mozilla.org Branding
4825 Do not distribute builds with
4826 --enable-official-branding unless you have
4827 permission to use trademarks per
4828 http://www.mozilla.org/foundation/trademarks/ .],
4830 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4831 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4833 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4834 MOZ_OFFICIAL_BRANDING=1
4836 ], MOZ_OFFICIAL_BRANDING=)
4838 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4839 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4840 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4843 MOZ_ARG_WITH_STRING(branding,
4844 [ --with-branding=dir Use branding from the specified directory.],
4845 MOZ_BRANDING_DIRECTORY=$withval)
4847 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4848 if test -z "$REAL_BRANDING_DIRECTORY"; then
4849 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4852 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4853 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4856 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4858 dnl ========================================================
4859 dnl = Distribution ID
4860 dnl ========================================================
4861 MOZ_ARG_WITH_STRING(distribution-id,
4862 [ --with-distribution-id=ID
4863 Set distribution-specific id (default=org.mozilla)],
4864 [ val=`echo $withval`
4865 MOZ_DISTRIBUTION_ID="$val"])
4867 if test -z "$MOZ_DISTRIBUTION_ID"; then
4868 MOZ_DISTRIBUTION_ID="org.mozilla"
4871 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4872 AC_SUBST(MOZ_DISTRIBUTION_ID)
4875 dnl ========================================================
4876 dnl complex text support off by default
4877 dnl ========================================================
4878 MOZ_ARG_DISABLE_BOOL(pango,
4879 [ --disable-pango Disable usage of Pango ],
4883 dnl ========================================================
4885 dnl ========================================================
4886 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4890 if test "$MOZ_PANGO"
4892 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4894 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4895 AC_SUBST(MOZ_PANGO_CFLAGS)
4896 AC_SUBST(MOZ_PANGO_LIBS)
4897 AC_DEFINE(MOZ_PANGO)
4899 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
4900 AC_SUBST(FT2_CFLAGS)
4905 dnl ========================================================
4906 dnl = GnomeVFS, GIO and GConf support module
4907 dnl ========================================================
4911 dnl build the GIO extension by default only when the
4912 dnl GTK2 toolkit is in use.
4913 if test "$MOZ_ENABLE_GTK"
4919 dnl ========================================================
4920 dnl = GnomeVFS support module
4921 dnl ========================================================
4922 MOZ_ARG_ENABLE_BOOL(gnomevfs,
4923 [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
4924 MOZ_ENABLE_GNOMEVFS=force,
4925 MOZ_ENABLE_GNOMEVFS=)
4927 if test "$MOZ_ENABLE_GNOMEVFS"
4929 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4930 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4931 MOZ_ENABLE_GNOMEVFS=1
4932 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4934 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4936 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4938 MOZ_ENABLE_GNOMEVFS=
4942 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4943 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4944 AC_SUBST(MOZ_GNOMEVFS_LIBS)
4946 dnl ========================================================
4947 dnl = GIO support module
4948 dnl ========================================================
4949 MOZ_ARG_DISABLE_BOOL(gio,
4950 [ --disable-gio Disable GIO support],
4952 MOZ_ENABLE_GIO=force)
4954 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
4956 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4957 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4958 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4959 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4961 AC_DEFINE(MOZ_ENABLE_GIO)
4963 if test "$MOZ_ENABLE_GIO" = "force"
4965 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4971 AC_SUBST(MOZ_ENABLE_GIO)
4972 AC_SUBST(MOZ_GIO_CFLAGS)
4973 AC_SUBST(MOZ_GIO_LIBS)
4975 dnl ========================================================
4976 dnl = GConf support module
4977 dnl ========================================================
4978 MOZ_ARG_DISABLE_BOOL(gconf,
4979 [ --disable-gconf Disable Gconf support ],
4981 MOZ_ENABLE_GCONF=force)
4983 if test "$MOZ_ENABLE_GCONF"
4985 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4986 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4989 if test "$MOZ_ENABLE_GCONF" = "force"
4991 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4997 if test "$MOZ_ENABLE_GCONF"; then
4998 AC_DEFINE(MOZ_ENABLE_GCONF)
5001 AC_SUBST(MOZ_ENABLE_GCONF)
5002 AC_SUBST(MOZ_GCONF_CFLAGS)
5003 AC_SUBST(MOZ_GCONF_LIBS)
5006 dnl ========================================================
5007 dnl = libproxy support
5008 dnl ========================================================
5010 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
5012 MOZ_ENABLE_LIBPROXY=
5014 MOZ_ARG_ENABLE_BOOL(libproxy,
5015 [ --enable-libproxy Enable libproxy support ],
5016 MOZ_ENABLE_LIBPROXY=1,
5017 MOZ_ENABLE_LIBPROXY=)
5019 if test "$MOZ_ENABLE_LIBPROXY"
5021 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5022 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5025 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5026 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5027 AC_SUBST(MOZ_LIBPROXY_LIBS)
5029 dnl ========================================================
5030 dnl = GNOME component (mozgnome)
5031 dnl ========================================================
5033 if test "$MOZ_ENABLE_GTK2"
5035 MOZ_ENABLE_GNOME_COMPONENT=1
5037 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5039 dnl ========================================================
5040 dnl = libgnomeui support module
5041 dnl ========================================================
5043 if test "$MOZ_ENABLE_GTK"
5045 MOZ_ARG_ENABLE_BOOL(gnomeui,
5046 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
5047 MOZ_ENABLE_GNOMEUI=force,
5048 MOZ_ENABLE_GNOMEUI=)
5050 if test "$MOZ_ENABLE_GNOMEUI"
5052 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5054 MOZ_ENABLE_GNOMEUI=1
5056 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5058 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5064 if test "$MOZ_ENABLE_GNOMEUI"; then
5065 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5069 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5070 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5072 dnl ========================================================
5074 dnl ========================================================
5076 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
5080 MOZ_ARG_DISABLE_BOOL(dbus,
5081 [ --disable-dbus Disable dbus support ],
5085 if test "$MOZ_ENABLE_DBUS"
5087 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5088 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5089 AC_DEFINE(MOZ_ENABLE_DBUS)
5092 AC_SUBST(MOZ_ENABLE_DBUS)
5093 AC_SUBST(MOZ_DBUS_CFLAGS)
5094 AC_SUBST(MOZ_DBUS_LIBS)
5095 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5096 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5098 dnl ========================================================
5099 dnl = Enable Android History instead of Places
5100 dnl ========================================================
5101 if test -n "$MOZ_ANDROID_HISTORY"; then
5102 if test -z "$MOZ_PLACES"; then
5103 AC_DEFINE(MOZ_ANDROID_HISTORY)
5105 AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
5109 dnl ========================================================
5110 dnl = Build with the Android compositor
5111 dnl ========================================================
5112 if test -n "$MOZ_ANDROID_OMTC"; then
5113 dnl Do this if defined in confvars.sh
5114 AC_DEFINE(MOZ_ANDROID_OMTC)
5117 dnl ========================================================
5118 dnl = Disable WebSMS backend
5119 dnl ========================================================
5120 MOZ_ARG_DISABLE_BOOL(websms-backend,
5121 [ --disable-websms-backend
5122 Disable WebSMS backend],
5123 MOZ_WEBSMS_BACKEND=,
5124 MOZ_WEBSMS_BACKEND=1)
5126 if test -n "$MOZ_WEBSMS_BACKEND"; then
5127 AC_DEFINE(MOZ_WEBSMS_BACKEND)
5130 dnl ========================================================
5131 dnl = Enable NFC permission on Android
5132 dnl ========================================================
5133 if test -n "$MOZ_ANDROID_BEAM"; then
5134 AC_DEFINE(MOZ_ANDROID_BEAM)
5137 dnl ========================================================
5138 dnl = JS Debugger XPCOM component (js/jsd)
5139 dnl ========================================================
5140 MOZ_ARG_DISABLE_BOOL(jsd,
5141 [ --disable-jsd Disable JavaScript debug library],
5146 dnl ========================================================
5147 dnl = Enable IPDL's "expensive" unit tests
5148 dnl ========================================================
5151 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5152 [ --enable-ipdl-tests Enable expensive IPDL tests],
5156 if test -n "$MOZ_IPDL_TESTS"; then
5157 AC_DEFINE(MOZ_IPDL_TESTS)
5160 AC_SUBST(MOZ_IPDL_TESTS)
5162 dnl ========================================================
5163 dnl = Disable building dbm
5164 dnl ========================================================
5165 MOZ_ARG_DISABLE_BOOL(dbm,
5166 [ --disable-dbm Disable building dbm],
5170 dnl bi-directional support always on
5174 dnl ========================================================
5175 dnl accessibility support on by default on all platforms
5176 dnl ========================================================
5177 MOZ_ARG_DISABLE_BOOL(accessibility,
5178 [ --disable-accessibility Disable accessibility support],
5181 if test "$ACCESSIBILITY"; then
5184 if test -z "$MIDL"; then
5185 if test "$GCC" != "yes"; then
5186 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5188 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.])
5192 AC_DEFINE(ACCESSIBILITY)
5195 dnl ========================================================
5196 dnl Accessibility is required for the linuxgl widget
5198 dnl ========================================================
5199 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5200 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5203 dnl ========================================================
5204 dnl Disable printing
5205 dnl ========================================================
5206 MOZ_ARG_DISABLE_BOOL(printing,
5207 [ --disable-printing Disable printing support],
5211 if test "$NS_PRINTING"; then
5212 AC_DEFINE(NS_PRINTING)
5213 AC_DEFINE(NS_PRINT_PREVIEW)
5216 dnl Turn off webrtc for OS's we don't handle yet, but allow
5217 dnl --enable-webrtc to override. Can disable for everything in
5218 dnl the master list above.
5219 if test -n "$MOZ_WEBRTC"; then
5221 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
5225 dnl default to disabled for all others
5231 AC_TRY_COMPILE([#include <linux/ethtool.h>],
5232 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
5233 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
5235 # target_arch is from {ia32|x64|arm|ppc}
5238 WEBRTC_TARGET_ARCH=x64
5242 WEBRTC_TARGET_ARCH=arm
5246 WEBRTC_TARGET_ARCH=ia32
5250 WEBRTC_TARGET_ARCH=ppc
5253 WEBRTC_TARGET_ARCH=ia64
5256 # unsupported arch for webrtc
5257 WEBRTC_TARGET_ARCH=unknown
5263 dnl ========================================================
5264 dnl = Disable WebRTC code
5265 dnl ========================================================
5266 MOZ_ARG_DISABLE_BOOL(webrtc,
5267 [ --disable-webrtc Disable support for WebRTC],
5271 if test -n "$MOZ_WEBRTC"; then
5272 AC_DEFINE(MOZ_WEBRTC)
5273 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
5274 dnl opt/production builds (via MOZ_CRASH())
5275 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
5279 MOZ_VP8_ERROR_CONCEALMENT=1
5281 dnl enable once Signaling lands
5282 MOZ_WEBRTC_SIGNALING=1
5283 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5284 if test "${OS_TARGET}" = "WINNT"; then
5285 MOZ_WEBRTC_IN_LIBXUL=1
5287 dnl enable once PeerConnection lands
5288 MOZ_PEERCONNECTION=1
5289 AC_DEFINE(MOZ_PEERCONNECTION)
5296 AC_SUBST(MOZ_WEBRTC)
5297 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5298 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5299 AC_SUBST(MOZ_PEERCONNECTION)
5300 AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
5301 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5305 dnl Use integers over floats for audio on B2G and Android, because audio
5306 dnl backends for those platforms don't support floats.
5307 if test "$OS_TARGET" = "Android"; then
5308 MOZ_SAMPLE_TYPE_S16=1
5309 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5310 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5312 MOZ_SAMPLE_TYPE_FLOAT32=1
5313 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5314 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5317 dnl ========================================================
5318 dnl = Disable Speech API code
5319 dnl ========================================================
5320 MOZ_ARG_DISABLE_BOOL(webspeech,
5321 [ --disable-webspeech Disable support for HTML Speech API],
5325 if test -n "$MOZ_WEBSPEECH"; then
5326 AC_DEFINE(MOZ_WEBSPEECH)
5329 AC_SUBST(MOZ_WEBSPEECH)
5331 dnl ========================================================
5332 dnl = Enable Raw Codecs
5333 dnl ========================================================
5334 MOZ_ARG_ENABLE_BOOL(raw,
5335 [ --enable-raw Enable support for RAW media],
5339 if test -n "$MOZ_RAW"; then
5345 dnl ========================================================
5346 dnl = Disable Ogg Codecs
5347 dnl ========================================================
5348 MOZ_ARG_DISABLE_BOOL(ogg,
5349 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5353 if test -n "$MOZ_OGG"; then
5357 dnl Checks for __attribute__(aligned()) directive
5358 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5359 [ac_cv_c_attribute_aligned],
5360 [ac_cv_c_attribute_aligned=0
5361 CFLAGS_save="${CFLAGS}"
5362 CFLAGS="${CFLAGS} -Werror"
5363 for ac_cv_c_attr_align_try in 64 32 16 8; do
5364 echo "trying $ac_cv_c_attr_align_try"
5366 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5367 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5368 if test "$ac_cv_c_attribute_aligned" != 0; then
5372 CFLAGS="${CFLAGS_save}"])
5373 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5374 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5375 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5379 dnl ========================================================
5380 dnl = Disable Opus audio codec support
5381 dnl ========================================================
5382 MOZ_ARG_DISABLE_BOOL(opus,
5383 [ --disable-opus Disable support for Opus audio],
5387 dnl ========================================================
5388 dnl = Disable VP8 decoder support
5389 dnl ========================================================
5390 MOZ_ARG_DISABLE_BOOL(webm,
5391 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5395 if test -n "$MOZ_WEBM"; then
5400 dnl ========================================================
5401 dnl = DirectShow support
5402 dnl ========================================================
5403 if test "$OS_ARCH" = "WINNT"; then
5404 dnl Enable DirectShow support by default.
5408 MOZ_ARG_DISABLE_BOOL(directshow,
5409 [ --disable-directshow Disable support for DirectShow],
5413 if test -n "$MOZ_DIRECTSHOW"; then
5414 AC_DEFINE(MOZ_DIRECTSHOW)
5418 dnl ========================================================
5419 dnl = Windows Media Foundation support
5420 dnl ========================================================
5421 if test "$OS_ARCH" = "WINNT"; then
5422 dnl Enable Windows Media Foundation support by default.
5423 dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5424 dnl guaranteed to have a recent-enough SDK to build WMF.
5428 MOZ_ARG_DISABLE_BOOL(wmf,
5429 [ --disable-wmf Disable support for Windows Media Foundation],
5433 if test -n "$MOZ_WMF"; then
5438 dnl ========================================================
5439 dnl = Enable media plugin support
5440 dnl ========================================================
5441 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5442 dnl Enable support on android by default
5446 MOZ_ARG_ENABLE_BOOL(media-plugins,
5447 [ --enable-media-plugins Enable support for media plugins],
5448 MOZ_MEDIA_PLUGINS=1,
5451 if test -n "$MOZ_MEDIA_PLUGINS"; then
5452 AC_DEFINE(MOZ_MEDIA_PLUGINS)
5455 dnl ========================================================
5456 dnl = Enable getUserMedia support
5457 dnl ========================================================
5458 MOZ_ARG_ENABLE_BOOL(media-navigator,
5459 [ --enable-media-navigator Enable support for getUserMedia],
5460 MOZ_MEDIA_NAVIGATOR=1,
5461 MOZ_MEDIA_NAVIGATOR=)
5463 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5464 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5467 dnl ========================================================
5468 dnl = Enable building OMX media plugin (B2G or Android)
5469 dnl ========================================================
5470 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5471 dnl Enable support on android by default
5475 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5476 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5480 if test -n "$MOZ_OMX_PLUGIN"; then
5481 if test "$OS_TARGET" = "Android"; then
5482 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5483 AC_DEFINE(MOZ_OMX_PLUGIN)
5485 dnl fail if we're not building on Gonk or Android
5486 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5490 dnl system libvpx Support
5491 dnl ========================================================
5492 MOZ_ARG_WITH_BOOL(system-libvpx,
5493 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5494 MOZ_NATIVE_LIBVPX=1)
5499 if test -n "$MOZ_VP8"; then
5501 if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5502 AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5504 if test -n "$MOZ_VP8_ENCODER" ; then
5505 AC_DEFINE(MOZ_VP8_ENCODER)
5508 if test -n "$MOZ_NATIVE_LIBVPX"; then
5509 dnl ============================
5510 dnl === libvpx Version check ===
5511 dnl ============================
5512 dnl Check to see if we have a system libvpx package.
5513 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5515 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5516 [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.])])
5519 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5520 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5525 AC_SUBST(MOZ_NATIVE_LIBVPX)
5526 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5527 AC_SUBST(MOZ_LIBVPX_LIBS)
5529 if test "$MOZ_WEBM"; then
5531 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5538 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5540 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5541 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5542 dnl We currently require gcc on all arm platforms.
5545 VPX_NEED_OBJ_INT_EXTRACT=
5547 dnl See if we have assembly on this platform.
5548 case "$OS_ARCH:$CPU_ARCH" in
5550 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5554 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5558 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5562 dnl Check for yasm 1.1 or greater.
5563 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5564 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.])
5565 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5566 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.])
5568 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5570 dnl The encoder needs obj_int_extract to get asm offsets.
5574 if test -n "$GNU_AS" ; then
5576 dnl These flags are a lie; they're just used to enable the requisite
5577 dnl opcodes; actual arch detection is done at runtime.
5578 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5579 VPX_DASH_C_FLAG="-c"
5580 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5581 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5586 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5587 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5592 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5593 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5599 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5600 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.])
5603 if test -n "$MOZ_VP8_ENCODER" -a \
5604 -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5605 dnl We prefer to get asm offsets using inline assembler, which the above
5606 dnl compilers can do. When we're not using one of those, we have to fall
5607 dnl back to obj_int_extract, which reads them from a compiled object
5608 dnl file. Unfortunately, that only works if we're compiling on a system
5609 dnl with the header files for the appropriate object file format.
5610 VPX_NEED_OBJ_INT_EXTRACT=1
5613 if test -n "$VPX_X86_ASM"; then
5614 AC_DEFINE(VPX_X86_ASM)
5615 elif test -n "$VPX_ARM_ASM"; then
5616 AC_DEFINE(VPX_ARM_ASM)
5618 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5622 dnl ========================================================
5623 dnl = Disable Wave decoder support
5624 dnl ========================================================
5625 MOZ_ARG_DISABLE_BOOL(wave,
5626 [ --disable-wave Disable Wave decoder support],
5630 if test -n "$MOZ_WAVE"; then
5635 dnl ========================================================
5636 dnl = Handle dependent CUBEB and MEDIA defines
5637 dnl ========================================================
5639 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5640 AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5643 if test -n "$MOZ_SOUNDTOUCH"; then
5644 AC_DEFINE(MOZ_SOUNDTOUCH)
5647 if test -n "$MOZ_CUBEB"; then
5648 AC_DEFINE(MOZ_CUBEB)
5651 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5652 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/])
5655 if test -n "$MOZ_VORBIS"; then
5656 AC_DEFINE(MOZ_VORBIS)
5659 if test -n "$MOZ_TREMOR"; then
5660 AC_DEFINE(MOZ_TREMOR)
5663 if test -n "$MOZ_OPUS"; then
5667 dnl ========================================================
5668 dnl = Check alsa availability on Linux if using sydneyaudio
5669 dnl ========================================================
5671 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5672 if test -n "$MOZ_CUBEB" -a "$OS_TARGET" = "Linux"; then
5676 MOZ_ARG_ENABLE_BOOL(alsa,
5677 [ --enable-alsa Enable Alsa support (default on Linux)],
5681 if test -n "$MOZ_ALSA"; then
5682 AC_DEFINE(MOZ_CUBEB)
5683 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5684 [echo "$MOZ_ALSA_PKG_ERRORS"
5685 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.)])])
5689 AC_SUBST(MOZ_ALSA_CFLAGS)
5690 AC_SUBST(MOZ_ALSA_LIBS)
5692 dnl ========================================================
5693 dnl = Enable PulseAudio
5694 dnl ========================================================
5696 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5697 [ --enable-pulseaudio Enable PulseAudio support (experimental)],
5701 if test -n "$MOZ_PULSEAUDIO"; then
5702 AC_DEFINE(MOZ_CUBEB)
5703 if test -z "$gonkdir"; then
5704 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5705 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5706 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
5708 MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
5709 MOZ_PULSEAUDIO_LIBS="-lpulse"
5713 AC_SUBST(MOZ_PULSEAUDIO)
5714 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5715 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5717 dnl ========================================================
5718 dnl = Enable GStreamer
5719 dnl ========================================================
5720 if test "$OS_TARGET" = "Linux"; then
5724 MOZ_ARG_ENABLE_BOOL(gstreamer,
5725 [ --enable-gstreamer Enable GStreamer support],
5729 if test "$MOZ_GSTREAMER"; then
5730 # API version, eg 0.10, 1.0 etc
5731 GST_API_VERSION=0.10
5732 # core/base release number
5734 PKG_CHECK_MODULES(GSTREAMER,
5735 gstreamer-$GST_API_VERSION >= $GST_VERSION
5736 gstreamer-app-$GST_API_VERSION
5737 gstreamer-plugins-base-$GST_API_VERSION, ,
5738 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]))
5739 if test -n "$GSTREAMER_LIBS"; then
5740 _SAVE_LDFLAGS=$LDFLAGS
5741 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5742 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5743 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5744 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5746 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.])
5748 LDFLAGS=$_SAVE_LDFLAGS
5750 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])
5753 AC_SUBST(GSTREAMER_CFLAGS)
5754 AC_SUBST(GSTREAMER_LIBS)
5755 AC_SUBST(MOZ_GSTREAMER)
5757 if test -n "$MOZ_GSTREAMER"; then
5758 AC_DEFINE(MOZ_GSTREAMER)
5762 dnl ========================================================
5763 dnl Permissions System
5764 dnl ========================================================
5765 MOZ_ARG_DISABLE_BOOL(permissions,
5766 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5771 dnl ========================================================
5772 dnl Child permissions, currently only used for b2g
5773 dnl ========================================================
5774 if test -n "$MOZ_B2G"; then
5775 if test -n "$MOZ_PERMISSIONS"; then
5776 MOZ_CHILD_PERMISSIONS=1
5778 AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
5781 AC_SUBST(MOZ_CHILD_PERMISSIONS)
5783 dnl ========================================================
5785 dnl ========================================================
5786 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5787 [ --disable-negotiateauth Disable GSS-API negotiation ],
5788 MOZ_AUTH_EXTENSION=,
5789 MOZ_AUTH_EXTENSION=1 )
5791 dnl ========================================================
5792 dnl Pref extensions (autoconfig)
5793 dnl ========================================================
5794 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5795 [ --disable-pref-extensions
5796 Disable pref extensions such as autoconfig],
5797 MOZ_PREF_EXTENSIONS=,
5798 MOZ_PREF_EXTENSIONS=1 )
5800 dnl ========================================================
5801 dnl Searching of system directories for extensions.
5802 dnl Note: this switch is meant to be used for test builds
5803 dnl whose behavior should not depend on what happens to be
5804 dnl installed on the local machine.
5805 dnl ========================================================
5806 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5807 [ --disable-system-extension-dirs
5808 Disable searching system- and account-global
5809 directories for extensions of any kind; use
5810 only profile-specific extension directories],
5811 ENABLE_SYSTEM_EXTENSION_DIRS=,
5812 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5813 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5814 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5817 dnl ========================================================
5818 dnl = Universalchardet
5819 dnl ========================================================
5820 MOZ_ARG_DISABLE_BOOL(universalchardet,
5821 [ --disable-universalchardet
5822 Disable universal encoding detection],
5823 MOZ_UNIVERSALCHARDET=,
5824 MOZ_UNIVERSALCHARDET=1 )
5826 if test -n "${JAVA_BIN_PATH}"; then
5827 dnl Look for javac and jar in the specified path.
5828 JAVA_PATH="$JAVA_BIN_PATH"
5830 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5831 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5834 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5835 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5836 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5837 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5838 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5839 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5841 if test -n "${JAVA_BIN_PATH}" -o \
5842 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5843 if test -z "$JAVA" -o "$JAVA" = ":"; then
5844 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}])
5846 if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5847 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}])
5849 if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5850 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}])
5852 if test -z "$JAR" -o "$JAR" = ":"; then
5853 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}])
5855 if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5856 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}])
5858 if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5859 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}])
5863 dnl ========================================================
5864 dnl = ANGLE OpenGL->D3D translator for WebGL
5865 dnl = * only applies to win32
5866 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5867 dnl ========================================================
5869 MOZ_DIRECTX_SDK_PATH=
5870 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5871 MOZ_D3DCOMPILER_CAB=
5872 MOZ_D3DCOMPILER_DLL=
5873 case "$target_os" in
5875 MOZ_ANGLE_RENDERER=1
5879 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5880 case "${target_cpu}" in
5882 MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5885 MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5889 MOZ_ARG_DISABLE_BOOL(webgl,
5890 [ --disable-webgl Disable building of the WebGL implementation],
5891 MOZ_WEBGL_DISABLED=1,
5892 MOZ_WEBGL_DISABLED=)
5894 if test -n "$MOZ_WEBGL_DISABLED"; then
5899 if test -n "$MOZ_WEBGL"; then
5900 AC_DEFINE(MOZ_WEBGL)
5903 if test -n "$MOZ_WEBGL_CONFORMANT"; then
5904 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
5907 # Locate a DirectX SDK here so we can use it for both ANGLE and
5909 if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
5910 # Get the SDK path from the registry.
5911 # First try to get the June 2010 SDK
5912 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5913 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5914 # Otherwise just take whatever comes first
5915 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5917 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'`
5920 if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
5921 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5922 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.])
5925 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5926 test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5927 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5928 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5930 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.])
5933 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5934 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'`
5936 if test -z "$MOZ_D3DX9_VERSION" ; then
5937 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.])
5940 MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5942 if test -z "$MOZ_D3DCOMPILER_CAB"; then
5943 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.])
5946 MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5949 dnl ========================================================
5951 dnl ========================================================
5953 MOZ_GAMEPAD_BACKEND=stub
5955 # Gamepad DOM is built on supported platforms by default.
5956 case "$OS_TARGET" in
5964 MOZ_ARG_DISABLE_BOOL(gamepad,
5965 [ --disable-gamepad Disable gamepad support],
5969 if test "$MOZ_GAMEPAD"; then
5970 case "$OS_TARGET" in
5972 MOZ_GAMEPAD_BACKEND=cocoa
5975 if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
5976 if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5979 elif test "$GCC" != "yes"; then
5982 if test -z "$MOZ_GAMEPAD"; then
5983 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.])
5985 MOZ_GAMEPAD_BACKEND=windows
5988 MOZ_CHECK_HEADER([linux/joystick.h])
5989 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5990 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.])
5992 MOZ_GAMEPAD_BACKEND=linux
5998 AC_DEFINE(MOZ_GAMEPAD)
6000 AC_SUBST(MOZ_GAMEPAD)
6001 AC_SUBST(MOZ_GAMEPAD_BACKEND)
6003 dnl ========================================================
6004 dnl = Breakpad crash reporting (on by default on supported platforms)
6005 dnl ========================================================
6008 i?86-*-mingw*|x86_64-*-mingw*)
6011 i?86-apple-darwin*|x86_64-apple-darwin*)
6014 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6015 if test "$MOZ_ENABLE_GTK"; then
6019 *-android*|*-linuxandroid*)
6027 MOZ_ARG_DISABLE_BOOL(crashreporter,
6028 [ --disable-crashreporter Disable breakpad crash reporting],
6029 [MOZ_CRASHREPORTER=],
6030 [MOZ_CRASHREPORTER=F # Force enable breakpad])
6032 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
6033 if test "$MOZ_CRASHREPORTER" = F; then
6034 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
6039 if test -n "$MOZ_CRASHREPORTER"; then
6040 AC_DEFINE(MOZ_CRASHREPORTER)
6042 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
6043 test -z "$SKIP_LIBRARY_CHECKS"; then
6044 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6045 AC_SUBST(MOZ_GTHREAD_CFLAGS)
6046 AC_SUBST(MOZ_GTHREAD_LIBS)
6049 if test "$OS_ARCH" = "WINNT"; then
6050 if test -z "$HAVE_64BIT_OS"; then
6051 MOZ_CRASHREPORTER_INJECTOR=1
6052 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
6057 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6058 [ --with-crashreporter-enable-percent=NN
6059 Enable sending crash reports by default on NN% of users. (default=100)],
6060 [ val=`echo $withval | sed 's/[^0-9]//g'`
6061 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6063 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6064 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6066 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6068 dnl ========================================================
6069 dnl = libjpeg-turbo configuration
6070 dnl ========================================================
6072 if test -z "$MOZ_NATIVE_JPEG"; then
6076 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6077 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
6079 MOZ_LIBJPEG_TURBO=1)
6081 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6082 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6085 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6088 if test -n "$MOZ_LIBJPEG_TURBO"; then
6090 dnl Do we support libjpeg-turbo on this platform?
6091 case "$OS_ARCH:$OS_TEST" in
6093 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6094 LIBJPEG_TURBO_X86_ASM=1
6097 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6098 LIBJPEG_TURBO_X64_ASM=1
6100 WINNT:x86|WINNT:i?86)
6101 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6102 LIBJPEG_TURBO_X86_ASM=1
6105 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6106 LIBJPEG_TURBO_X64_ASM=1
6109 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6110 LIBJPEG_TURBO_ARM_ASM=1
6113 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6114 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6115 LIBJPEG_TURBO_X86_ASM=1
6119 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6120 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6121 LIBJPEG_TURBO_X64_ASM=1
6128 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6129 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6130 dnl it doesn't exist or we have too old of a version.
6131 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6132 LIBJPEG_TURBO_AS=$YASM
6134 if test -z "$LIBJPEG_TURBO_AS" ; then
6135 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.])
6138 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6139 dnl on Linux and 1.1 or newer everywhere else.
6140 if test "$OS_ARCH" = "Linux" ; then
6141 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
6142 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.])
6145 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6146 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.])
6151 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6152 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6153 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6154 echo "Using $AS as the assembler for ARM code."
6155 LIBJPEG_TURBO_AS=$AS
6158 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6159 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6160 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6161 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6162 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6163 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6164 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6165 dnl Warn if we're not building the optimized routines, even though the user
6166 dnl didn't specify --disable-libjpeg-turbo.
6167 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6170 dnl ========================================================
6171 dnl = Enable compilation of specific extension modules
6172 dnl ========================================================
6174 MOZ_ARG_ENABLE_STRING(extensions,
6175 [ --enable-extensions Enable extensions],
6176 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6177 if test "$option" = "yes" -o "$option" = "all"; then
6178 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6179 elif test "$option" = "no" -o "$option" = "none"; then
6181 elif test "$option" = "default"; then
6182 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6183 elif test `echo "$option" | grep -c \^-` != 0; then
6184 option=`echo $option | sed 's/^-//'`
6185 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6187 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6190 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6192 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6193 # Suppress warning on non-X11 platforms
6194 if test -n "$MOZ_X11"; then
6195 AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6197 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6200 dnl Do not build gnomevfs with libxul based apps
6201 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6202 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6205 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6206 # Suppress warning on non-X11 platforms
6207 if test -n "$MOZ_X11"; then
6208 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6210 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6213 dnl Do not build gio with libxul based apps
6214 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6215 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6218 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6220 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6222 AC_SUBST(MOZ_GIO_COMPONENT)
6224 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6225 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6226 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6230 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6232 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6233 dnl when trying to build a nonexistent extension.
6234 for extension in $MOZ_EXTENSIONS; do
6235 if test ! -d "${srcdir}/extensions/${extension}"; then
6236 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6240 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6241 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6244 dnl ========================================================
6245 dnl Build Freetype in the tree
6246 dnl ========================================================
6247 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6248 [ --enable-tree-freetype Enable Tree FreeType],
6249 MOZ_TREE_FREETYPE=1,
6250 MOZ_TREE_FREETYPE= )
6251 if test -n "$MOZ_TREE_FREETYPE"; then
6252 if test -n "$_WIN32_MSVC"; then
6253 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6255 AC_DEFINE(MOZ_TREE_FREETYPE)
6256 AC_SUBST(MOZ_TREE_FREETYPE)
6257 MOZ_ENABLE_CAIRO_FT=1
6258 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6259 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6260 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6261 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6263 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6264 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6265 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6266 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6267 AC_SUBST(CAIRO_FT_CFLAGS)
6270 dnl ========================================================
6272 dnl ========================================================
6273 dnl Abort Windows build if the required major version and
6274 dnl minimum minor version of Unicode NSIS isn't in the path
6275 dnl (unless in case of cross compiling, for which Unicode
6276 dnl is not yet sufficient).
6277 if test "$OS_ARCH" = "WINNT"; then
6278 REQ_NSIS_MAJOR_VER=2
6279 MIN_NSIS_MINOR_VER=46
6280 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensis)
6281 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6282 AC_MSG_RESULT([yes])
6284 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6286 if test ! "$MAKENSISU_VER" = ""; then
6287 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6288 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6290 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6291 if test "$MAKENSISU_VER" = "" || \
6292 test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6293 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6295 if test -z "$CROSS_COMPILE"; then
6296 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.])
6301 elif test -z "$CROSS_COMPILE"; then
6302 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.])
6308 dnl ========================================================
6310 dnl ========================================================
6311 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6312 [ --disable-webapp-runtime Disable Web App Runtime],
6313 MOZ_WEBAPP_RUNTIME=,
6314 MOZ_WEBAPP_RUNTIME=1)
6315 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6318 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6321 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6322 if test "$MOZ_WEBAPP_RUNTIME"; then
6323 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6326 AC_MSG_CHECKING([for tar archiver])
6327 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6328 if test -z "$TAR"; then
6329 AC_MSG_ERROR([no tar archiver found in \$PATH])
6331 AC_MSG_RESULT([$TAR])
6334 AC_MSG_CHECKING([for wget])
6335 AC_CHECK_PROGS(WGET, wget, "")
6336 AC_MSG_RESULT([$WGET])
6339 dnl ========================================================
6341 dnl ========================================================
6343 if test -n "$MOZ_SIGN_CMD"; then
6344 AC_DEFINE(MOZ_SIGNING)
6347 dnl ========================================================
6348 dnl Maintenance Service
6349 dnl ========================================================
6351 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6352 [ --enable-maintenance-service Enable building of maintenanceservice],
6353 MOZ_MAINTENANCE_SERVICE=1,
6354 MOZ_MAINTENANCE_SERVICE= )
6356 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6357 if test "$OS_ARCH" = "WINNT"; then
6358 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6360 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6364 dnl ========================================================
6365 dnl Verify MAR signatures
6366 dnl ========================================================
6368 MOZ_ARG_ENABLE_BOOL(verify-mar,
6369 [ --enable-verify-mar Enable verifying MAR signatures],
6370 MOZ_VERIFY_MAR_SIGNATURE=1,
6371 MOZ_VERIFY_MAR_SIGNATURE= )
6373 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6374 if test "$OS_ARCH" = "WINNT"; then
6375 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6377 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6381 dnl ========================================================
6382 dnl Enable building the signmar program.
6383 dnl This option is much different than the --enable-verify-mar option.
6384 dnl --enable-verify-mar is for enabling the verification check on MAR
6385 dnl files in the updater. The --enable-signmar option is for building
6386 dnl the signmar program.
6387 dnl ========================================================
6389 MOZ_ARG_ENABLE_BOOL(signmar,
6390 [ --enable-signmar Enable building the signmar program],
6391 MOZ_ENABLE_SIGNMAR=1,
6392 MOZ_ENABLE_SIGNMAR= )
6394 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6395 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6398 dnl ========================================================
6400 dnl ========================================================
6402 MOZ_ARG_DISABLE_BOOL(updater,
6403 [ --disable-updater Disable building of updater],
6407 if test -n "$MOZ_UPDATER"; then
6408 AC_DEFINE(MOZ_UPDATER)
6411 # tools/update-packaging is not checked out by default.
6412 MOZ_ARG_ENABLE_BOOL(update-packaging,
6413 [ --enable-update-packaging
6414 Enable tools/update-packaging],
6415 MOZ_UPDATE_PACKAGING=1,
6416 MOZ_UPDATE_PACKAGING= )
6417 AC_SUBST(MOZ_UPDATE_PACKAGING)
6419 dnl ========================================================
6420 dnl build the tests by default
6421 dnl ========================================================
6422 MOZ_ARG_DISABLE_BOOL(tests,
6423 [ --disable-tests Do not build test libraries & programs],
6427 if test -n "$ENABLE_TESTS"; then
6430 AC_DEFINE(MOZ_ENABLE_GTEST)
6431 AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6432 AC_SUBST(MOZ_ENABLE_GTEST)
6433 AC_SUBST(GTEST_HAS_RTTI)
6434 if test -n "$_WIN32_MSVC"; then
6435 AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6437 if test "${OS_TARGET}" = "Android"; then
6438 AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6439 AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6440 AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6441 AC_SUBST(GTEST_OS_LINUX_ANDROID)
6442 AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6443 AC_SUBST(GTEST_HAS_CLONE)
6447 dnl ========================================================
6448 dnl parental controls (for Windows Vista)
6449 dnl ========================================================
6450 MOZ_ARG_DISABLE_BOOL(parental-controls,
6451 [ --disable-parental-controls
6452 Do not build parental controls],
6453 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6454 MOZ_DISABLE_PARENTAL_CONTROLS=)
6455 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6456 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6459 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6461 dnl ========================================================
6462 dnl = Disable DOMCrypto
6463 dnl ========================================================
6464 if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
6465 AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
6467 AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
6469 dnl ========================================================
6470 dnl = Disable libpkix
6471 dnl ========================================================
6472 if test -n "$NSS_NO_LIBPKIX"; then
6473 AC_DEFINE(NSS_NO_LIBPKIX)
6475 AC_SUBST(NSS_NO_LIBPKIX)
6477 dnl ========================================================
6478 dnl = Content process sandboxing
6479 dnl ========================================================
6480 if test -n "$gonkdir"; then
6481 MOZ_CONTENT_SANDBOX=1
6484 MOZ_ARG_ENABLE_BOOL(content-sandbox,
6485 [ --enable-content-sandbox Enable sandboxing support for content-processes],
6486 MOZ_CONTENT_SANDBOX=1,
6487 MOZ_CONTENT_SANDBOX=)
6489 if test -n "$MOZ_CONTENT_SANDBOX"; then
6490 AC_DEFINE(MOZ_CONTENT_SANDBOX)
6493 AC_SUBST(MOZ_CONTENT_SANDBOX)
6495 MOZ_ARG_ENABLE_BOOL(content-sandbox-reporter,
6496 [ --enable-content-sandbox-reporter Enable syscall reporter to troubleshoot syscalls denied by the content-processes sandbox],
6497 MOZ_CONTENT_SANDBOX_REPORTER=1,
6498 MOZ_CONTENT_SANDBOX_REPORTER=)
6500 if test -n "$MOZ_CONTENT_SANDBOX_REPORTER"; then
6501 AC_DEFINE(MOZ_CONTENT_SANDBOX_REPORTER)
6504 AC_SUBST(MOZ_CONTENT_SANDBOX_REPORTER)
6506 dnl ========================================================
6508 dnl = Module specific options
6510 dnl ========================================================
6511 MOZ_ARG_HEADER(Individual module options)
6513 dnl ========================================================
6514 dnl = Disable feed handling components
6515 dnl ========================================================
6516 MOZ_ARG_DISABLE_BOOL(feeds,
6517 [ --disable-feeds Disable feed handling and processing components],
6520 if test -n "$MOZ_FEEDS"; then
6521 AC_DEFINE(MOZ_FEEDS)
6523 if test "$MOZ_BUILD_APP" = "browser"; then
6524 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6528 dnl ========================================================
6529 dnl Check for sqlite
6530 dnl ========================================================
6533 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6534 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6535 MOZ_NATIVE_SQLITE=1,
6536 MOZ_NATIVE_SQLITE= )
6538 if test -z "$MOZ_NATIVE_SQLITE"
6541 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6543 dnl ============================
6544 dnl === SQLite Version check ===
6545 dnl ============================
6546 dnl Check to see if the system SQLite package is new enough.
6547 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6549 dnl ==================================
6550 dnl === SQLITE_SECURE_DELETE check ===
6551 dnl ==================================
6552 dnl Check to see if the system SQLite package is compiled with
6553 dnl SQLITE_SECURE_DELETE enabled.
6554 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6555 _SAVE_CFLAGS="$CFLAGS"
6556 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6558 LIBS="$LIBS $SQLITE_LIBS"
6559 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6561 #include "sqlite3.h"
6563 int main(int argc, char **argv){
6564 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6566 ac_cv_sqlite_secure_delete=yes,
6567 ac_cv_sqlite_secure_delete=no,
6568 ac_cv_sqlite_secure_delete=no
6571 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6572 CFLAGS="$_SAVE_CFLAGS"
6574 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6575 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6578 dnl ===============================
6579 dnl === SQLITE_THREADSAFE check ===
6580 dnl ===============================
6581 dnl Check to see if the system SQLite package is compiled with
6582 dnl SQLITE_THREADSAFE enabled.
6583 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6584 _SAVE_CFLAGS="$CFLAGS"
6585 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6587 LIBS="$LIBS $SQLITE_LIBS"
6588 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6590 #include "sqlite3.h"
6592 int main(int argc, char **argv){
6593 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6595 ac_cv_sqlite_threadsafe=yes,
6596 ac_cv_sqlite_threadsafe=no,
6597 ac_cv_sqlite_threadsafe=no
6600 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6601 CFLAGS="$_SAVE_CFLAGS"
6603 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6604 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6607 dnl ================================
6608 dnl === SQLITE_ENABLE_FTS3 check ===
6609 dnl ================================
6610 dnl check to see if the system SQLite package is compiled with
6611 dnl SQLITE_ENABLE_FTS3 enabled.
6612 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6613 _SAVE_CFLAGS="$CFLAGS"
6614 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6616 LIBS="$LIBS $SQLITE_LIBS"
6617 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6619 #include "sqlite3.h"
6621 int main(int argc, char **argv){
6622 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6624 ac_cv_sqlite_enable_fts3=yes,
6625 ac_cv_sqlite_enable_fts3=no,
6626 ac_cv_sqlite_enable_fts3=no
6629 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6630 CFLAGS="$_SAVE_CFLAGS"
6632 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6633 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6636 dnl =========================================
6637 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6638 dnl =========================================
6639 dnl check to see if the system SQLite package is compiled with
6640 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6641 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6642 _SAVE_CFLAGS="$CFLAGS"
6643 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6645 LIBS="$LIBS $SQLITE_LIBS"
6646 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6648 #include "sqlite3.h"
6650 int main(int argc, char **argv){
6651 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6653 ac_cv_sqlite_enable_unlock_notify=yes,
6654 ac_cv_sqlite_enable_unlock_notify=no,
6655 ac_cv_sqlite_enable_unlock_notify=no
6658 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6659 CFLAGS="$_SAVE_CFLAGS"
6661 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6662 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6666 if test -n "$MOZ_NATIVE_SQLITE"; then
6667 AC_DEFINE(MOZ_NATIVE_SQLITE)
6669 AC_SUBST(MOZ_NATIVE_SQLITE)
6671 dnl ========================================================
6672 dnl = Enable help viewer (off by default)
6673 dnl ========================================================
6674 if test -n "$MOZ_HELP_VIEWER"; then
6675 dnl Do this if defined in confvars.sh
6676 AC_DEFINE(MOZ_HELP_VIEWER)
6679 dnl ========================================================
6680 dnl = Enable safe browsing (anti-phishing)
6681 dnl ========================================================
6682 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6683 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6684 MOZ_SAFE_BROWSING=1,
6685 MOZ_SAFE_BROWSING= )
6686 if test -n "$MOZ_SAFE_BROWSING"; then
6687 AC_DEFINE(MOZ_SAFE_BROWSING)
6689 AC_SUBST(MOZ_SAFE_BROWSING)
6691 dnl ========================================================
6692 dnl = Enable url-classifier
6693 dnl ========================================================
6694 dnl Implicitly enabled by default if building with safe-browsing
6695 if test -n "$MOZ_SAFE_BROWSING"; then
6696 MOZ_URL_CLASSIFIER=1
6698 MOZ_ARG_ENABLE_BOOL(url-classifier,
6699 [ --enable-url-classifier Enable url classifier module],
6700 MOZ_URL_CLASSIFIER=1,
6701 MOZ_URL_CLASSIFIER= )
6702 if test -n "$MOZ_URL_CLASSIFIER"; then
6703 AC_DEFINE(MOZ_URL_CLASSIFIER)
6705 AC_SUBST(MOZ_URL_CLASSIFIER)
6707 dnl ========================================================
6708 dnl = Disable zipwriter
6709 dnl ========================================================
6710 MOZ_ARG_DISABLE_BOOL(zipwriter,
6711 [ --disable-zipwriter Disable zipwriter component],
6714 AC_SUBST(MOZ_ZIPWRITER)
6716 dnl ========================================================
6718 dnl ========================================================
6720 MOZ_ARG_WITH_STRING(gl-provider,
6721 [ --with-gl-provider=ID
6722 Set GL provider backend type],
6723 [ val=`echo $withval`
6724 MOZ_GL_PROVIDER="$val"])
6726 if test -n "$MOZ_GL_PROVIDER"; then
6727 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6728 AC_SUBST(MOZ_GL_PROVIDER)
6729 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6731 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6732 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6734 dnl ========================================================
6735 dnl = faststripe theme
6736 dnl ========================================================
6737 MOZ_ARG_ENABLE_BOOL(faststripe,
6738 [ --enable-faststripe Use faststripe theme],
6739 MOZ_THEME_FASTSTRIPE=1,
6740 MOZ_THEME_FASTSTRIPE= )
6741 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6743 dnl ========================================================
6745 dnl = Feature options that require extra sources to be pulled
6747 dnl ========================================================
6748 dnl MOZ_ARG_HEADER(Features that require extra sources)
6750 dnl ========================================================
6752 dnl = Runtime debugging and Optimization Options
6754 dnl ========================================================
6755 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
6757 dnl ========================================================
6758 dnl enable mobile optimizations
6759 dnl ========================================================
6760 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6761 [ --enable-mobile-optimize
6762 Enable mobile optimizations],
6763 MOZ_GFX_OPTIMIZE_MOBILE=1)
6765 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6767 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6768 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6771 dnl ========================================================
6772 dnl = Enable code optimization. ON by default.
6773 dnl ========================================================
6774 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6775 MOZ_OPTIMIZE_FLAGS="-O"
6778 MOZ_ARG_ENABLE_STRING(optimize,
6779 [ --disable-optimize Disable compiler optimization
6780 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6781 [ if test "$enableval" != "no"; then
6783 if test -n "$enableval" -a "$enableval" != "yes"; then
6784 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6789 fi ], MOZ_OPTIMIZE=1)
6791 MOZ_SET_FRAMEPTR_FLAGS
6793 if test "$COMPILE_ENVIRONMENT"; then
6794 if test -n "$MOZ_OPTIMIZE"; then
6795 AC_MSG_CHECKING([for valid optimization flags])
6796 _SAVE_CFLAGS=$CFLAGS
6797 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6798 AC_TRY_COMPILE([#include <stdio.h>],
6799 [printf("Hello World\n");],
6802 AC_MSG_RESULT([$_results])
6803 if test "$_results" = "no"; then
6804 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6806 CFLAGS=$_SAVE_CFLAGS
6808 fi # COMPILE_ENVIRONMENT
6810 AC_SUBST(MOZ_OPTIMIZE)
6811 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6812 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6813 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6814 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6815 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6816 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6818 dnl ========================================================
6819 dnl = Enable any treating of compile warnings as errors
6820 dnl ========================================================
6821 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6822 [ --enable-warnings-as-errors
6823 Enable treating of warnings as errors],
6824 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6825 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6826 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6827 WARNINGS_AS_ERRORS=''
6828 elif test "$GNU_CC"; then
6829 # Prevent the following GCC warnings from being treated as errors:
6830 # -Wuninitialized - too many false positives
6831 # -Wmaybe-uninitialized - too many false positives
6832 # -Wdeprecated-declarations - we don't want our builds held hostage when a
6833 # platform-specific API becomes deprecated.
6834 MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
6835 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
6836 MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
6837 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
6838 MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
6839 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
6842 dnl ========================================================
6843 dnl = Disable runtime logging checks
6844 dnl ========================================================
6845 MOZ_ARG_DISABLE_BOOL(logging,
6846 [ --disable-logging Disable logging facilities],
6847 NS_DISABLE_LOGGING=1,
6848 NS_DISABLE_LOGGING= )
6849 if test "$NS_DISABLE_LOGGING"; then
6850 AC_DEFINE(NS_DISABLE_LOGGING)
6852 AC_DEFINE(MOZ_LOGGING)
6855 dnl ========================================================
6856 dnl = This will enable logging of addref, release, ctor, dtor.
6857 dnl ========================================================
6858 _ENABLE_LOGREFCNT=42
6859 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6860 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6861 _ENABLE_LOGREFCNT=1,
6862 _ENABLE_LOGREFCNT= )
6863 if test "$_ENABLE_LOGREFCNT" = "1"; then
6864 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6865 elif test -z "$_ENABLE_LOGREFCNT"; then
6866 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6869 dnl ========================================================
6870 dnl moz_dump_painting
6871 dnl ========================================================
6872 MOZ_ARG_ENABLE_BOOL(dump-painting,
6873 [ --enable-dump-painting Enable paint debugging.],
6874 MOZ_DUMP_PAINTING=1,
6875 MOZ_DUMP_PAINTING= )
6876 if test -n "$MOZ_DUMP_PAINTING"; then
6877 AC_DEFINE(MOZ_DUMP_PAINTING)
6878 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6880 if test -n "$MOZ_DEBUG"; then
6881 AC_DEFINE(MOZ_DUMP_PAINTING)
6884 dnl ========================================================
6885 dnl = Enable trace malloc
6886 dnl ========================================================
6887 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6888 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6889 [ --enable-trace-malloc Enable malloc tracing; also disables DMD and jemalloc],
6892 if test "$NS_TRACE_MALLOC"; then
6893 # Please, Mr. Linker Man, don't take away our symbol names
6894 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6896 AC_DEFINE(NS_TRACE_MALLOC)
6898 AC_SUBST(NS_TRACE_MALLOC)
6900 dnl ========================================================
6902 dnl ========================================================
6904 MOZ_ARG_ENABLE_BOOL(dmd,
6905 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
6909 if test "$NS_TRACE_MALLOC"; then # trace-malloc disables DMD
6912 if test "$MOZ_DMD"; then
6916 if test "${CPU_ARCH}" = "arm"; then
6917 CFLAGS="$CFLAGS -funwind-tables"
6918 CXXFLAGS="$CXXFLAGS -funwind-tables"
6921 MOZ_MEMORY=1 # DMD enables jemalloc
6922 MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
6926 dnl ========================================================
6927 dnl = Enable jemalloc
6928 dnl ========================================================
6929 MOZ_ARG_ENABLE_BOOL(jemalloc,
6930 [ --enable-jemalloc Replace memory allocator with jemalloc],
6934 if test "$NS_TRACE_MALLOC"; then
6938 if test "${OS_TARGET}" = "Android"; then
6939 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6941 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
6942 dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
6943 if test -z "$GNU_CC"; then
6944 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6946 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6949 dnl On other Unix systems, we only want to link executables against mozglue
6950 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6951 dnl On other Unix systems, where mozglue is a static library, jemalloc is
6952 dnl separated for the SDK, so we need to add it here.
6953 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6954 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6956 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6957 if test -n "$GNU_CC"; then
6958 dnl And we need mozglue symbols to be exported.
6959 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6961 if test "$MOZ_LINKER" = 1; then
6962 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
6966 dnl ========================================================
6967 dnl = Enable dynamic replacement of malloc implementation
6968 dnl ========================================================
6969 MOZ_ARG_ENABLE_BOOL(replace-malloc,
6970 [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
6971 MOZ_REPLACE_MALLOC=1,
6972 MOZ_REPLACE_MALLOC= )
6974 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
6975 dnl We don't want to enable jemalloc unconditionally because it may be a
6976 dnl deliberate choice not to enable it (bug 702250, for instance)
6977 AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
6978 elif test -n "$MOZ_REPLACE_MALLOC"; then
6979 MOZ_NATIVE_JEMALLOC=
6981 dnl Replace-malloc Mac linkage quirks
6982 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
6983 AC_CACHE_CHECK([how to do weak dynamic linking],
6984 ac_cv_weak_dynamic_linking,
6985 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
6986 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
6987 test -s conftest${DLL_SUFFIX}; then
6988 dnl There are several ways the linker can put link edit rules in a binary:
6989 dnl - classic info only (for OSX < 10.6)
6990 dnl - dyld info only
6992 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
6997 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
7002 dnl With classic info, we need to build with -flat_namespace.
7003 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
7004 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
7005 dnl forgets to set the weak flag in the dyld info.
7006 dnl See http://glandium.org/blog/?p=2764 for more details.
7008 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
7009 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
7010 dnl - "flat namespace" when -flat_namespace alone is needed
7011 dnl - "dummy library" when a dummy library and -flat_namespace are needed
7012 dnl - "compiler support" when nothing is needed
7013 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
7014 if test -n "$_CLASSIC_INFO"; then
7015 ac_cv_weak_dynamic_linking="flat namespace"
7017 ac_cv_weak_dynamic_linking="compiler support"
7020 if test -n "$_DYLD_INFO"; then
7021 ac_cv_weak_dynamic_linking="dummy library"
7023 ac_cv_weak_dynamic_linking="flat namespace"
7027 AC_ERROR([couldn't compile a simple C file])
7030 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
7033 AC_SUBST(MOZ_REPLACE_MALLOC)
7034 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
7036 dnl ========================================================
7037 dnl = Jemalloc build setup
7038 dnl ========================================================
7039 if test -z "$MOZ_MEMORY"; then
7040 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
7041 MOZ_NATIVE_JEMALLOC=1
7042 AC_CHECK_FUNCS(mallctl nallocm,,
7043 [MOZ_NATIVE_JEMALLOC=
7045 if test -n "$MOZ_NATIVE_JEMALLOC"; then
7047 AC_DEFINE(MOZ_MEMORY)
7048 AC_DEFINE(MOZ_JEMALLOC3)
7049 AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7054 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7055 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.])
7060 dnl Don't try to run compiler tests on Windows
7061 if test "$OS_ARCH" = "WINNT"; then
7062 if test -z "$HAVE_64BIT_OS"; then
7063 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7065 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7068 AC_CHECK_SIZEOF([int *], [4])
7069 case "${ac_cv_sizeof_int_p}" in
7071 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7074 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7077 AC_MSG_ERROR([Unexpected pointer size])
7082 AC_DEFINE(MOZ_MEMORY)
7083 if test -n "$MOZ_JEMALLOC3"; then
7084 AC_DEFINE(MOZ_JEMALLOC3)
7086 if test "x$MOZ_DEBUG" = "x1"; then
7087 AC_DEFINE(MOZ_MEMORY_DEBUG)
7089 dnl The generic feature tests that determine how to compute ncpus are long and
7090 dnl complicated. Therefore, simply define special cpp variables for the
7091 dnl platforms we have special knowledge of.
7094 AC_DEFINE(MOZ_MEMORY_DARWIN)
7097 AC_DEFINE(MOZ_MEMORY_BSD)
7099 *-android*|*-linuxandroid*)
7100 AC_DEFINE(MOZ_MEMORY_LINUX)
7101 AC_DEFINE(MOZ_MEMORY_ANDROID)
7102 if test -z "$gonkdir"; then
7105 AC_DEFINE(MOZ_MEMORY_GONK)
7110 AC_DEFINE(MOZ_MEMORY_LINUX)
7113 AC_DEFINE(MOZ_MEMORY_BSD)
7116 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7119 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7120 if test -z "$MOZ_DEBUG"; then
7121 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7123 WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7125 dnl Look for a broken crtdll.obj
7126 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7127 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7128 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7129 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7130 dnl Also pass this to NSPR/NSS
7131 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7133 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7140 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7144 AC_SUBST(MOZ_MEMORY)
7145 AC_SUBST(MOZ_JEMALLOC3)
7146 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7147 AC_SUBST(MOZ_GLUE_LDFLAGS)
7148 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7149 AC_SUBST(WIN32_CRT_LIBS)
7150 dnl Need to set this for make because NSS doesn't have configure
7153 dnl We need to wrap dlopen and related functions on Android because we use
7155 if test "$OS_TARGET" = Android; then
7156 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7157 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7158 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7159 if test -z "$gonkdir"; then
7160 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7161 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"
7165 dnl ========================================================
7166 dnl = Use malloc wrapper lib
7167 dnl ========================================================
7168 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7169 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7173 if test -n "$_WRAP_MALLOC"; then
7174 if test -n "$GNU_CC"; then
7175 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7176 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7177 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7178 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7179 dnl Wrap operator new and operator delete on Android.
7180 if test "$OS_TARGET" = "Android"; then
7181 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7182 dnl Wrap the nothrow variants too.
7183 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7186 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7190 dnl ========================================================
7191 dnl = Location of malloc wrapper lib
7192 dnl ========================================================
7193 MOZ_ARG_WITH_STRING(wrap-malloc,
7194 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7195 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7197 dnl ========================================================
7198 dnl = Use JS Call tracing
7199 dnl ========================================================
7200 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7201 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7202 MOZ_TRACE_JSCALLS=1,
7203 MOZ_TRACE_JSCALLS= )
7204 if test -n "$MOZ_TRACE_JSCALLS"; then
7205 AC_DEFINE(MOZ_TRACE_JSCALLS)
7208 dnl ========================================================
7209 dnl = Use incremental GC
7210 dnl ========================================================
7212 MOZ_ARG_DISABLE_BOOL(gcincremental,
7213 [ --disable-gcincremental Disable incremental GC],
7215 if test -n "$JSGC_INCREMENTAL"; then
7216 AC_DEFINE(JSGC_INCREMENTAL)
7219 dnl ========================================================
7220 dnl Zealous JavaScript GC
7221 dnl ========================================================
7222 MOZ_ARG_ENABLE_BOOL(gczeal,
7223 [ --enable-gczeal Enable zealous JavaScript GCing],
7226 if test -n "$JS_GC_ZEAL"; then
7227 AC_DEFINE(JS_GC_ZEAL)
7230 dnl ========================================================
7231 dnl JS opt-mode assertions and minidump instrumentation
7232 dnl ========================================================
7233 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7234 [ --enable-js-diagnostics
7235 Enable JS diagnostic assertions and breakpad data],
7236 JS_CRASH_DIAGNOSTICS=1,
7237 JS_CRASH_DIAGNOSTICS= )
7238 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7239 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7243 MOZ_CHECK_COMPILER_WRAPPER
7245 dnl ========================================================
7246 dnl = Enable static checking using gcc-dehydra
7247 dnl ========================================================
7249 MOZ_ARG_WITH_STRING(static-checking,
7250 [ --with-static-checking=path/to/gcc_dehydra.so
7251 Enable static checking of code using GCC-dehydra],
7252 DEHYDRA_PATH=$withval,
7255 if test -n "$DEHYDRA_PATH"; then
7256 if test ! -f "$DEHYDRA_PATH"; then
7257 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7259 AC_DEFINE(NS_STATIC_CHECKING)
7261 AC_SUBST(DEHYDRA_PATH)
7263 dnl ========================================================
7264 dnl = Enable using the clang plugin to build
7265 dnl ========================================================
7267 MOZ_ARG_ENABLE_BOOL(clang-plugin,
7268 [ --enable-clang-plugin Enable building with the mozilla clang plugin ],
7269 ENABLE_CLANG_PLUGIN=1,
7270 ENABLE_CLANG_PLUGIN= )
7271 if test -n "$ENABLE_CLANG_PLUGIN"; then
7272 if test -z "$CLANG_CC"; then
7273 AC_MSG_ERROR([Can't use clang plugin without clang.])
7275 AC_DEFINE(MOZ_CLANG_PLUGIN)
7278 AC_SUBST(ENABLE_CLANG_PLUGIN)
7280 dnl ========================================================
7281 dnl = Enable stripping of libs & executables
7282 dnl ========================================================
7283 MOZ_ARG_ENABLE_BOOL(strip,
7284 [ --enable-strip Enable stripping of libs & executables ],
7288 dnl ========================================================
7289 dnl = Enable stripping of libs & executables when packaging
7290 dnl ========================================================
7291 MOZ_ARG_ENABLE_BOOL(install-strip,
7292 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7296 dnl ========================================================
7297 dnl = --enable-elf-dynstr-gc
7298 dnl ========================================================
7299 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7300 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7301 USE_ELF_DYNSTR_GC=1,
7302 USE_ELF_DYNSTR_GC= )
7304 dnl ========================================================
7305 dnl = --disable-elf-hack
7306 dnl ========================================================
7309 MOZ_ARG_DISABLE_BOOL(elf-hack,
7310 [ --disable-elf-hack Disable elf hacks],
7312 [USE_ELF_HACK=F # Force enable elf-hack])
7314 # Disable elf hack for profiling because the built in profiler
7315 # doesn't read the segments properly with elf hack. This is
7316 # temporary and should be fixed soon in the profiler.
7317 if test "$MOZ_PROFILING" = 1; then
7318 if test "$USE_ELF_HACK" = F; then
7319 AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
7324 # Only enable elfhack where supported
7325 if test "$USE_ELF_HACK" = 1; then
7326 case "${HOST_OS_ARCH},${OS_ARCH}" in
7328 case "${CPU_ARCH}" in
7343 if test -n "$USE_ELF_HACK"; then
7344 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7345 dnl memory addresses it maps to. The result is that by the time elfhack
7346 dnl kicks in, it is not possible to apply relocations because of that,
7347 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7348 dnl segment. It makes elfhack mostly useless, so considering the problems
7349 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7350 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7351 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
7352 dnl elfhack enabled, disable PT_GNU_RELRO instead.
7353 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7354 LINK_WITH_PT_GNU_RELRO,
7355 [echo "int main() {return 0;}" > conftest.${ac_ext}
7356 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7357 test -s conftest${ac_exeext}; then
7358 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7359 LINK_WITH_PT_GNU_RELRO=yes
7361 LINK_WITH_PT_GNU_RELRO=no
7364 dnl We really don't expect to get here, but just in case
7365 AC_ERROR([couldn't compile a simple C file])
7368 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7369 if test "$USE_ELF_HACK" = F; then
7370 AC_MSG_CHECKING([for -z norelro option to ld])
7371 _SAVE_LDFLAGS=$LDFLAGS
7372 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
7373 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
7374 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
7375 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.]))
7378 AC_MSG_WARN([Disabling elfhack])
7384 dnl ========================================================
7385 dnl = libstdc++ compatibility hacks
7386 dnl ========================================================
7389 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7390 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7393 if test -n "$STDCXX_COMPAT"; then
7394 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7395 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7396 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7399 dnl ========================================================
7401 dnl = Profiling and Instrumenting
7403 dnl ========================================================
7404 MOZ_ARG_HEADER(Profiling and Instrumenting)
7406 dnl ========================================================
7407 dnl = Enable runtime visual profiling logger
7408 dnl ========================================================
7409 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7410 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7411 MOZ_VISUAL_EVENT_TRACER=1,
7412 MOZ_VISUAL_EVENT_TRACER=)
7413 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7414 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7417 dnl ========================================================
7418 dnl Turn on reflow counting
7419 dnl ========================================================
7420 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7421 [ --enable-reflow-perf Enable reflow performance tracing],
7424 if test -n "$MOZ_REFLOW_PERF"; then
7425 AC_DEFINE(MOZ_REFLOW_PERF)
7428 dnl ========================================================
7429 dnl = Enable Radio Interface for B2G (Gonk usually)
7430 dnl ========================================================
7431 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7432 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7435 if test -n "$MOZ_B2G_RIL"; then
7436 AC_DEFINE(MOZ_B2G_RIL)
7438 AC_SUBST(MOZ_B2G_RIL)
7440 dnl ========================================================
7441 dnl = Enable Radio FM for B2G (Gonk usually)
7442 dnl ========================================================
7443 if test -n "$MOZ_B2G_FM"; then
7444 AC_DEFINE(MOZ_B2G_FM)
7446 AC_SUBST(MOZ_B2G_FM)
7448 dnl ========================================================
7449 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7450 dnl ========================================================
7451 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7452 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7455 if test -n "$MOZ_B2G_BT"; then
7456 AC_DEFINE(MOZ_B2G_BT)
7458 AC_SUBST(MOZ_B2G_BT)
7460 dnl ========================================================
7461 dnl = Enable Support for Time Manager API
7462 dnl ========================================================
7463 if test -n "$MOZ_TIME_MANAGER"; then
7464 AC_DEFINE(MOZ_TIME_MANAGER)
7466 AC_SUBST(MOZ_TIME_MANAGER)
7468 dnl ========================================================
7469 dnl = Enable Camera Interface for B2G (Gonk usually)
7470 dnl ========================================================
7471 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7472 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7475 if test -n "$MOZ_B2G_CAMERA"; then
7476 AC_DEFINE(MOZ_B2G_CAMERA)
7478 AC_SUBST(MOZ_B2G_CAMERA)
7480 dnl ========================================================
7481 dnl = Enable Support B2G-specific changes to the NSS
7482 dnl = certificate trust database.
7483 dnl ========================================================
7484 if test -n "$MOZ_B2G_CERTDATA"; then
7485 AC_DEFINE(MOZ_B2G_CERTDATA)
7487 AC_SUBST(MOZ_B2G_CERTDATA)
7489 dnl ========================================================
7490 dnl = Enable Support for Payment API
7491 dnl ========================================================
7492 if test -n "$MOZ_PAY"; then
7497 dnl ========================================================
7498 dnl = Enable Support for AudioChannelManager API
7499 dnl ========================================================
7500 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7501 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7503 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7505 dnl ========================================================
7506 dnl = Support for demangling undefined symbols
7507 dnl ========================================================
7508 if test -z "$SKIP_LIBRARY_CHECKS"; then
7511 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7515 # Demangle only for debug or trace-malloc or DMD builds
7516 MOZ_DEMANGLE_SYMBOLS=
7517 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7518 MOZ_DEMANGLE_SYMBOLS=1
7519 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7521 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7523 dnl ========================================================
7524 dnl = Support for gcc stack unwinding (from gcc 3.3)
7525 dnl ========================================================
7526 if test -z "$SKIP_LIBRARY_CHECKS"; then
7527 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7530 dnl ========================================================
7532 dnl ========================================================
7534 MOZ_ARG_WITH_STRING(jitreport-granularity,
7535 [ --jitreport-granularity=N
7536 Default granularity at which to report JIT code
7539 1 - code ranges for whole functions only
7540 2 - per-line information
7541 3 - per-op information],
7542 JITREPORT_GRANULARITY=$withval,
7543 JITREPORT_GRANULARITY=3)
7545 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7547 dnl ========================================================
7551 dnl ========================================================
7552 MOZ_ARG_HEADER(Misc. Options)
7554 dnl ========================================================
7555 dnl update xterm title
7556 dnl ========================================================
7557 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7558 [ --enable-xterm-updates Update XTERM titles with current command.],
7562 dnl =========================================================
7564 dnl =========================================================
7565 MOZ_ARG_ENABLE_STRING([chrome-format],
7566 [ --enable-chrome-format=jar|flat|omni
7567 Select FORMAT of chrome files during packaging],
7568 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7570 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7571 MOZ_CHROME_FILE_FORMAT=jar
7574 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7575 AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7578 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7579 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7580 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7581 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7584 dnl =========================================================
7585 dnl Omnijar packaging (bug 552121)
7586 dnl =========================================================
7587 dnl Omnijar packaging is compatible with flat packaging.
7588 dnl In unpackaged builds, omnijar looks for files as if
7589 dnl things were flat packaged. After packaging, all files
7590 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7591 dnl is set to flat since putting files into jars is only
7592 dnl done during packaging with omnijar.
7593 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7595 AC_DEFINE(MOZ_OMNIJAR)
7597 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7598 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7599 MOZ_CHROME_FILE_FORMAT=flat
7601 MOZ_CHROME_FILE_FORMAT=symlink
7604 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7605 dnl Fennec's static resources live in the assets/ folder of the
7606 dnl APK. Adding a path to the name here works because we only
7607 dnl have one omnijar file in the final package (which is not the
7608 dnl case on desktop), and necessitates some contortions during
7609 dnl packaging so that the resources in the omnijar are considered
7610 dnl as rooted at / and not as rooted at assets/ (which again is
7611 dnl not the case on desktop: there are omnijars rooted at webrtc/,
7612 dnl etc). packager.mk handles changing the rooting of the single
7614 OMNIJAR_NAME=assets/omni.ja
7616 OMNIJAR_NAME=omni.ja
7619 AC_SUBST(OMNIJAR_NAME)
7620 AC_SUBST(MOZ_OMNIJAR)
7621 AC_SUBST(MOZ_PACKAGER_FORMAT)
7623 dnl ========================================================
7624 dnl = Define default location for MOZILLA_FIVE_HOME
7625 dnl ========================================================
7626 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7627 [ --with-default-mozilla-five-home
7628 Set the default value for MOZILLA_FIVE_HOME],
7629 [ val=`echo $withval`
7630 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7632 dnl ========================================================
7633 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7634 dnl ========================================================
7635 MOZ_ARG_WITH_STRING(user-appdir,
7636 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7637 [ val=`echo $withval`
7638 if echo "$val" | grep "\/" >/dev/null; then
7639 AC_MSG_ERROR("Homedir must be single relative path.")
7644 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7646 dnl ========================================================
7647 dnl = Doxygen configuration
7648 dnl ========================================================
7649 dnl Use commas to specify multiple dirs to this arg
7650 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7651 MOZ_ARG_WITH_STRING(doc-input-dirs,
7652 [ --with-doc-input-dirs=DIRS
7653 Header/idl dirs to create docs from],
7654 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7655 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7657 dnl Use commas to specify multiple dirs to this arg
7658 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7659 MOZ_ARG_WITH_STRING(doc-include-dirs,
7660 [ --with-doc-include-dirs=DIRS
7661 Include dirs to preprocess doc headers],
7662 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7663 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7665 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7666 MOZ_ARG_WITH_STRING(doc-output-dir,
7667 [ --with-doc-output-dir=DIR
7668 Dir to generate docs into],
7669 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7670 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7672 if test -z "$SKIP_COMPILER_CHECKS"; then
7673 dnl ========================================================
7675 dnl = Compiler Options
7677 dnl ========================================================
7678 MOZ_ARG_HEADER(Compiler Options)
7680 dnl ========================================================
7681 dnl Check for gcc -pipe support
7682 dnl ========================================================
7683 AC_MSG_CHECKING([for -pipe support])
7684 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7685 dnl Any gcc that supports firefox supports -pipe.
7686 CFLAGS="$CFLAGS -pipe"
7687 CXXFLAGS="$CXXFLAGS -pipe"
7688 AC_MSG_RESULT([yes])
7693 dnl ========================================================
7694 dnl Profile guided optimization (gcc checks)
7695 dnl ========================================================
7696 dnl Test for profiling options
7697 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7699 _SAVE_CFLAGS="$CFLAGS"
7700 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7702 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7703 AC_TRY_COMPILE([], [return 0;],
7704 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7705 result="yes" ], result="no")
7706 AC_MSG_RESULT([$result])
7708 if test $result = "yes"; then
7709 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7710 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7711 PROFILE_USE_LDFLAGS="-fprofile-use"
7714 CFLAGS="$_SAVE_CFLAGS"
7716 if test -n "$INTEL_CC"; then
7717 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7718 PROFILE_GEN_LDFLAGS=
7719 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7720 PROFILE_USE_LDFLAGS=
7723 dnl Sun Studio on Solaris
7724 if test "$SOLARIS_SUNPRO_CC"; then
7725 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7726 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7727 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7728 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7731 AC_SUBST(PROFILE_GEN_CFLAGS)
7732 AC_SUBST(PROFILE_GEN_LDFLAGS)
7733 AC_SUBST(PROFILE_USE_CFLAGS)
7734 AC_SUBST(PROFILE_USE_LDFLAGS)
7738 dnl ========================================================
7739 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7740 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7741 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7742 dnl ========================================================
7743 _SAVE_CXXFLAGS=$CXXFLAGS
7744 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7745 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7746 ac_nscap_nonconst_opeq_bug,
7755 template <class T, class U>
7756 int operator==(const Pointer<T>& rhs, U* lhs)
7758 return rhs.myPtr == lhs;
7761 template <class T, class U>
7762 int operator==(const Pointer<T>& rhs, const U* lhs)
7764 return rhs.myPtr == lhs;
7772 ac_nscap_nonconst_opeq_bug="no",
7773 ac_nscap_nonconst_opeq_bug="yes")])
7774 CXXFLAGS="$_SAVE_CXXFLAGS"
7776 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7777 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7779 fi # ! SKIP_COMPILER_CHECKS
7781 AC_DEFINE(CPP_THROW_NEW, [throw()])
7784 if test "$COMPILE_ENVIRONMENT"; then
7786 fi # COMPILE_ENVIRONMENT
7788 dnl ========================================================
7790 dnl = Build depencency options
7792 dnl ========================================================
7793 MOZ_ARG_HEADER(Build dependencies)
7795 if test "$GNU_CC" -a "$GNU_CXX"; then
7796 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7797 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7798 elif test "$SOLARIS_SUNPRO_CC"; then
7801 dnl Don't override this for MSVC
7802 if test -z "$_WIN32_MSVC"; then
7803 _USE_CPP_INCLUDE_FLAG=
7804 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7805 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7807 echo '#include <stdio.h>' > dummy-hello.c
7809 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7811 if test -z "$CL_INCLUDES_PREFIX"; then
7812 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7814 AC_SUBST(CL_INCLUDES_PREFIX)
7819 dnl ========================================================
7821 dnl = Static Build Options
7823 dnl ========================================================
7824 MOZ_ARG_HEADER(Static build options)
7826 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7827 if test "$OS_ARCH" = "WINNT"; then
7831 MOZ_ARG_ENABLE_BOOL(shared-js,
7832 [ --enable-shared-js
7833 Create a shared JavaScript library.],
7837 if test -n "$ENABLE_SHARED_JS"; then
7839 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7841 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7842 AC_DEFINE(MOZ_STATIC_JS)
7844 AC_SUBST(JS_SHARED_LIBRARY)
7846 AC_SUBST(LIBXUL_LIBS)
7847 XPCOM_LIBS="$LIBXUL_LIBS"
7849 dnl ========================================================
7851 dnl = Standalone module options
7853 dnl ========================================================
7854 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7857 dnl ========================================================
7859 if test -z "$SKIP_PATH_CHECKS"; then
7860 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7861 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7862 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7867 if test -z "${GLIB_GMODULE_LIBS}" \
7868 -a -n "${GLIB_CONFIG}"\
7869 -a "${GLIB_CONFIG}" != no\
7871 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7874 AC_SUBST(GLIB_CFLAGS)
7876 AC_SUBST(GLIB_GMODULE_LIBS)
7878 dnl ========================================================
7879 dnl Graphics checks.
7880 dnl ========================================================
7882 if test "${OS_TARGET}" = "WINNT"; then
7883 if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then
7884 MOZ_ENABLE_DIRECT2D1_1=1
7885 AC_SUBST(MOZ_ENABLE_DIRECT2D1_1)
7889 if test "${OS_TARGET}" = "WINNT" -o \
7890 "${OS_ARCH}" = "Darwin" -o \
7891 "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
7892 "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
7893 "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
7894 "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
7895 case "${target_cpu}" in
7907 MOZ_ARG_ENABLE_BOOL(skia,
7908 [ --enable-skia Enable use of Skia],
7912 if test "$USE_FC_FREETYPE"; then
7913 if test "$COMPILE_ENVIRONMENT"; then
7914 dnl ========================================================
7915 dnl = Check for freetype2 and its functionality
7916 dnl ========================================================
7917 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7919 if test "$_HAVE_FREETYPE2"; then
7921 _SAVE_CFLAGS="$CFLAGS"
7922 LIBS="$LIBS $FT2_LIBS"
7923 CFLAGS="$CFLAGS $FT2_CFLAGS"
7925 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7926 ac_cv_member_FT_Bitmap_Size_y_ppem,
7927 [AC_TRY_COMPILE([#include <ft2build.h>
7928 #include FT_FREETYPE_H],
7930 if (sizeof s.y_ppem) return 0;
7932 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7933 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7934 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7935 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7937 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7939 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7940 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7941 [FT_Bitmap_Size structure includes y_ppem field])
7943 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
7946 CFLAGS="$_SAVE_CFLAGS"
7949 _SAVE_CPPFLAGS="$CPPFLAGS"
7950 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7951 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7952 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7953 CPPFLAGS="$_SAVE_CPPFLAGS"
7955 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7958 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
7960 if test "$MOZ_PANGO"; then
7961 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
7962 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
7964 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
7965 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
7970 dnl ========================================================
7971 dnl Check for pixman and cairo
7972 dnl ========================================================
7975 MOZ_ARG_ENABLE_BOOL(system-cairo,
7976 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7981 MOZ_ARG_ENABLE_BOOL(system-pixman,
7982 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7984 MOZ_TREE_PIXMAN=force,
7987 # System cairo depends on system pixman
7988 if test "$MOZ_TREE_PIXMAN" = "force"; then
7989 if test -z "$MOZ_TREE_CAIRO"; then
7990 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7994 elif test -z "$MOZ_TREE_CAIRO"; then
7998 if test "$MOZ_TREE_PIXMAN"; then
7999 AC_DEFINE(MOZ_TREE_PIXMAN)
8000 MOZ_PIXMAN_CFLAGS=""
8001 MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8003 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8004 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8005 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8007 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8008 AC_SUBST(MOZ_PIXMAN_LIBS)
8010 # Check for headers defining standard int types.
8011 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8013 if test "$MOZ_TREE_CAIRO"; then
8014 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8015 AC_DEFINE(MOZ_TREE_CAIRO)
8017 # For now we assume that we will have a uint64_t available through
8018 # one of the above headers or mozstdint.h.
8019 AC_DEFINE(HAVE_UINT64_T)
8021 # Define macros for cairo-features.h
8022 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8023 if test "$MOZ_X11"; then
8024 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8025 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8026 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8027 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8028 MOZ_ENABLE_CAIRO_FT=1
8029 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8031 case "$MOZ_WIDGET_TOOLKIT" in
8033 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8036 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8037 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8038 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8041 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8042 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8043 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8044 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8045 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8046 MOZ_ENABLE_D2D_SURFACE=1
8047 MOZ_ENABLE_DWRITE_FONT=1
8049 WIN32_DWRITE_FONT_FEATURE=
8050 WIN32_D2D_SURFACE_FEATURE=
8053 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8055 dnl D3D10 Layers depend on D2D Surfaces.
8056 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8057 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8061 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8062 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8063 MOZ_ENABLE_CAIRO_FT=1
8064 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8065 CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8069 if test "$USE_FC_FREETYPE"; then
8070 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8072 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8073 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8074 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8075 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8076 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8077 AC_SUBST(CAIRO_FT_CFLAGS)
8079 AC_SUBST(PS_SURFACE_FEATURE)
8080 AC_SUBST(PDF_SURFACE_FEATURE)
8081 AC_SUBST(SVG_SURFACE_FEATURE)
8082 AC_SUBST(XLIB_SURFACE_FEATURE)
8083 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8084 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8085 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8086 AC_SUBST(WIN32_SURFACE_FEATURE)
8087 AC_SUBST(OS2_SURFACE_FEATURE)
8088 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8089 AC_SUBST(FT_FONT_FEATURE)
8090 AC_SUBST(FC_FONT_FEATURE)
8091 AC_SUBST(WIN32_FONT_FEATURE)
8092 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8093 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8094 AC_SUBST(QUARTZ_FONT_FEATURE)
8095 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8096 AC_SUBST(QT_SURFACE_FEATURE)
8097 AC_SUBST(TEE_SURFACE_FEATURE)
8099 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8100 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8102 if test "$MOZ_X11"; then
8103 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8106 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8108 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8109 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8110 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8111 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8112 if test "$MOZ_X11"; then
8113 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8114 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8115 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8116 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8120 AC_SUBST(MOZ_TREE_CAIRO)
8121 AC_SUBST(MOZ_CAIRO_CFLAGS)
8122 AC_SUBST(MOZ_CAIRO_LIBS)
8123 AC_SUBST(MOZ_CAIRO_OSLIBS)
8124 AC_SUBST(MOZ_TREE_PIXMAN)
8126 dnl ========================================================
8128 dnl ========================================================
8130 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8133 dnl ========================================================
8135 dnl ========================================================
8136 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8137 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8139 dnl ========================================================
8141 dnl ========================================================
8142 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8143 AC_SUBST(MOZ_GRAPHITE_LIBS)
8145 dnl ========================================================
8147 dnl ========================================================
8148 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8149 AC_SUBST(MOZ_OTS_LIBS)
8151 dnl ========================================================
8153 dnl ========================================================
8154 if test "$MOZ_ENABLE_SKIA"; then
8155 MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8156 AC_DEFINE(MOZ_ENABLE_SKIA)
8158 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8159 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8160 elif test "$OS_ARCH" = "WINNT"; then
8165 if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64"; then
8166 MOZ_ENABLE_SKIA_GPU=1
8167 AC_DEFINE(USE_SKIA_GPU)
8168 AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8173 AC_SUBST(MOZ_ENABLE_SKIA)
8174 AC_SUBST(MOZ_SKIA_LIBS)
8176 dnl ========================================================
8178 dnl ========================================================
8179 MOZ_ARG_DISABLE_BOOL(xul,
8180 [ --disable-xul Disable XUL],
8182 if test "$MOZ_XUL"; then
8185 dnl remove extensions that require XUL
8186 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8191 dnl ========================================================
8192 dnl disable profile locking
8193 dnl do no use this in applications that can have more than
8194 dnl one process accessing the profile directory.
8195 dnl ========================================================
8196 MOZ_ARG_DISABLE_BOOL(profilelocking,
8197 [ --disable-profilelocking
8198 Disable profile locking],
8199 MOZ_PROFILELOCKING=,
8200 MOZ_PROFILELOCKING=1 )
8201 if test "$MOZ_PROFILELOCKING"; then
8202 AC_DEFINE(MOZ_PROFILELOCKING)
8205 dnl ========================================================
8206 dnl necko configuration options
8207 dnl ========================================================
8210 dnl option to disable various necko protocols
8212 MOZ_ARG_ENABLE_STRING(necko-protocols,
8213 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8214 Enable/disable specific protocol handlers],
8215 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8216 if test "$option" = "yes" -o "$option" = "all"; then
8217 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8218 elif test "$option" = "no" -o "$option" = "none"; then
8220 elif test "$option" = "default"; then
8221 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8222 elif test `echo "$option" | grep -c \^-` != 0; then
8223 option=`echo $option | sed 's/^-//'`
8224 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8226 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8229 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8231 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8232 AC_SUBST(NECKO_PROTOCOLS)
8233 for p in $NECKO_PROTOCOLS; do
8234 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8235 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8239 dnl option to disable necko's wifi scanner
8242 case "$OS_TARGET" in
8244 if test -n "$gonkdir"; then
8257 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8258 [ --disable-necko-wifi Disable necko wifi scanner],
8262 if test "$NECKO_WIFI"; then
8263 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
8264 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
8266 AC_DEFINE(NECKO_WIFI)
8267 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8269 AC_SUBST(NECKO_WIFI)
8270 AC_SUBST(NECKO_WIFI_DBUS)
8273 dnl option to disable cookies
8275 MOZ_ARG_DISABLE_BOOL(cookies,
8276 [ --disable-cookies Disable cookie support],
8279 AC_SUBST(NECKO_COOKIES)
8280 if test "$NECKO_COOKIES"; then
8281 AC_DEFINE(NECKO_COOKIES)
8282 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8286 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8288 MOZ_ARG_DISABLE_BOOL(ctypes,
8289 [ --disable-ctypes Disable js-ctypes],
8292 AC_SUBST(BUILD_CTYPES)
8293 if test "$BUILD_CTYPES"; then
8294 AC_DEFINE(BUILD_CTYPES)
8297 dnl Build Places if required
8298 if test "$MOZ_PLACES"; then
8299 AC_DEFINE(MOZ_PLACES)
8302 dnl Build SocialAPI if required
8303 if test "$MOZ_SOCIAL"; then
8304 AC_DEFINE(MOZ_SOCIAL)
8307 dnl Build Common JS modules provided by services.
8308 AC_SUBST(MOZ_SERVICES_COMMON)
8309 if test -n "$MOZ_SERVICES_COMMON"; then
8310 AC_DEFINE(MOZ_SERVICES_COMMON)
8313 dnl Build Services crypto component (used by Sync)
8314 AC_SUBST(MOZ_SERVICES_CRYPTO)
8315 if test -n "$MOZ_SERVICES_CRYPTO"; then
8316 AC_DEFINE(MOZ_SERVICES_CRYPTO)
8319 dnl Build Firefox Health Reporter Service
8320 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8321 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8322 AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8325 dnl Build Services metrics component
8326 AC_SUBST(MOZ_SERVICES_METRICS)
8327 if test -n "$MOZ_SERVICES_METRICS"; then
8328 AC_DEFINE(MOZ_SERVICES_METRICS)
8331 dnl Build Notifications if required
8332 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8333 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8334 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8337 dnl Build Sync Services if required
8338 AC_SUBST(MOZ_SERVICES_SYNC)
8339 if test -n "$MOZ_SERVICES_SYNC"; then
8340 AC_DEFINE(MOZ_SERVICES_SYNC)
8343 dnl Build Captive Portal Detector if required
8344 AC_SUBST(MOZ_CAPTIVEDETECT)
8345 if test -n "$MOZ_CAPTIVEDETECT"; then
8346 AC_DEFINE(MOZ_CAPTIVEDETECT)
8349 dnl ========================================================
8350 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8351 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8354 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8355 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8358 if test "$MOZ_APP_COMPONENT_MODULES"; then
8359 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8362 dnl ========================================================
8364 dnl = Maintainer debug option (no --enable equivalent)
8366 dnl ========================================================
8371 AC_SUBST(AR_EXTRACT)
8375 AC_SUBST(AS_DASH_C_FLAG)
8384 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8385 AC_SUBST(MOZ_UPDATE_XTERM)
8386 AC_SUBST(MOZ_AUTH_EXTENSION)
8387 AC_SUBST(MOZ_PERMISSIONS)
8388 AC_SUBST(MOZ_PREF_EXTENSIONS)
8389 AC_SUBST(MOZ_JS_LIBS)
8391 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8392 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8393 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8394 AC_SUBST(MOZ_DEBUG_FLAGS)
8395 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8396 AC_SUBST(WARNINGS_AS_ERRORS)
8397 AC_SUBST(MOZ_EXTENSIONS)
8398 AC_SUBST(MOZ_JSDEBUGGER)
8399 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8402 AC_SUBST(MOZ_INSTRUMENTS)
8403 AC_SUBST(MOZ_CALLGRIND)
8405 AC_SUBST(MOZ_PROFILING)
8407 AC_SUBST(MOZ_PLACES)
8408 AC_SUBST(MOZ_SOCIAL)
8409 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8411 AC_SUBST(NS_PRINTING)
8413 AC_SUBST(MOZ_HELP_VIEWER)
8414 AC_SUBST(TOOLCHAIN_PREFIX)
8423 AC_SUBST(MOZ_PROFILELOCKING)
8425 AC_SUBST(ENABLE_TESTS)
8426 AC_SUBST(ENABLE_MARIONETTE)
8428 AC_SUBST(MOZ_UNIVERSALCHARDET)
8429 AC_SUBST(ACCESSIBILITY)
8430 AC_SUBST(MOZ_SPELLCHECK)
8431 AC_SUBST(MOZ_ANDROID_OMTC)
8432 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8433 AC_SUBST(MOZ_CRASHREPORTER)
8434 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8435 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8436 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8437 AC_SUBST(MOZ_STUB_INSTALLER)
8438 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8439 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8440 AC_SUBST(MOZ_UPDATER)
8441 AC_SUBST(MOZ_ANGLE_RENDERER)
8442 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8443 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8444 AC_SUBST(MOZ_D3DX9_VERSION)
8445 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8446 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8449 AC_SUBST(MOZ_ANDROID_HISTORY)
8450 AC_SUBST(MOZ_WEBSMS_BACKEND)
8451 AC_SUBST(MOZ_ANDROID_BEAM)
8452 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
8453 AC_SUBST(ENABLE_STRIP)
8454 AC_SUBST(PKG_SKIP_STRIP)
8455 AC_SUBST(STRIP_FLAGS)
8456 AC_SUBST(USE_ELF_DYNSTR_GC)
8457 AC_SUBST(USE_ELF_HACK)
8458 AC_SUBST(INCREMENTAL_LINKER)
8459 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8460 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8462 AC_SUBST(MOZ_FIX_LINK_PATHS)
8463 AC_SUBST(XPCOM_LIBS)
8464 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8465 AC_SUBST(XPCOM_GLUE_LDOPTS)
8466 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8467 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8468 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8470 AC_SUBST(USE_DEPENDENT_LIBS)
8472 AC_SUBST(MOZ_BUILD_ROOT)
8473 AC_SUBST(MOZ_OS2_TOOLS)
8475 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8476 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8477 AC_SUBST(MOZ_LINKER_EXTRACT)
8479 dnl ========================================================
8480 dnl = Mac bundle name prefix
8481 dnl ========================================================
8482 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8483 [ --with-macbundlename-prefix=prefix
8484 Prefix for MOZ_MACBUNDLE_NAME],
8485 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8487 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8488 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8489 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8492 if test "$MOZ_DEBUG"; then
8493 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8495 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8497 AC_SUBST(MOZ_MACBUNDLE_NAME)
8499 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8500 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8501 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8502 if test "$MOZ_DEBUG"; then
8503 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8506 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8507 AC_SUBST(MOZ_MACBUNDLE_ID)
8509 dnl ========================================================
8510 dnl = Child Process Name for IPC
8511 dnl ========================================================
8512 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8513 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8515 # We want to let Android unpack the file at install time, but it only does
8516 # so if the file is named libsomething.so. The lib/ path is also required
8517 # because the unpacked file will be under the lib/ subdirectory and will
8518 # need to be executed from that path.
8519 MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8521 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8523 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8524 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8526 # The following variables are available to branding and application
8527 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8528 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8529 # impacts profile location and user-visible fields.
8530 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8531 # versions of a given application (e.g. Aurora and Firefox both use
8532 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8533 # for application.ini's "Name" field, which controls profile location in
8534 # the absence of a "Profile" field (see below), and various system
8535 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8536 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8537 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8538 # builds (e.g. Aurora for Firefox).
8539 # - MOZ_APP_VERSION: Defines the application version number.
8540 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8541 # defaults to a lowercase form of MOZ_APP_BASENAME.
8542 # - MOZ_APP_PROFILE: When set, used for application.ini's
8543 # "Profile" field, which controls profile location.
8544 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8545 # crash reporter server url.
8546 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8547 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8549 if test -z "$MOZ_APP_NAME"; then
8550 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8553 # For extensions and langpacks, we require a max version that is compatible
8554 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8555 # 10.0a1 and 10.0a2 aren't affected
8556 # 10.0 becomes 10.0.*
8557 # 10.0.1 becomes 10.0.*
8558 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8559 if test -z "$IS_ALPHA"; then
8561 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8564 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8567 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8568 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8569 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8571 AC_SUBST(MOZ_APP_NAME)
8572 AC_SUBST(MOZ_APP_DISPLAYNAME)
8573 AC_SUBST(MOZ_APP_BASENAME)
8574 AC_SUBST(MOZ_APP_VENDOR)
8575 AC_SUBST(MOZ_APP_PROFILE)
8576 AC_SUBST(MOZ_APP_ID)
8577 AC_SUBST(MAR_CHANNEL_ID)
8578 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8579 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8580 AC_SUBST(MOZ_EXTENSION_MANAGER)
8581 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8582 AC_SUBST(MOZ_APP_UA_NAME)
8583 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8584 AC_SUBST(MOZ_APP_VERSION)
8585 AC_SUBST(MOZ_APP_MAXVERSION)
8586 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8587 AC_SUBST(FIREFOX_VERSION)
8588 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8589 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8590 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8593 AC_SUBST(MOZ_APP_STATIC_INI)
8595 AC_SUBST(MOZ_PKG_SPECIAL)
8597 AC_SUBST(MOZILLA_OFFICIAL)
8599 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8600 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8602 if test "$MOZ_TELEMETRY_REPORTING"; then
8603 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8605 # Enable Telemetry by default for nightly and aurora channels
8606 if test -z "$RELEASE_BUILD"; then
8607 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8611 dnl If we have any service that uploads data (and requires data submission
8612 dnl policy alert), set MOZ_DATA_REPORTING.
8613 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8614 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8615 MOZ_DATA_REPORTING=1
8616 AC_DEFINE(MOZ_DATA_REPORTING)
8617 AC_SUBST(MOZ_DATA_REPORTING)
8621 AC_SUBST(MOZ_BROWSE_INFO)
8622 AC_SUBST(MOZ_TOOLS_DIR)
8623 AC_SUBST(WIN32_REDIST_DIR)
8626 dnl Echo the CFLAGS to remove extra whitespace.
8632 $_WARNINGS_CXXFLAGS \
8635 COMPILE_CFLAGS=`echo \
8640 COMPILE_CXXFLAGS=`echo \
8641 $_DEFINES_CXXFLAGS \
8645 AC_SUBST(SYSTEM_LIBXUL)
8646 AC_SUBST(MOZ_NATIVE_JPEG)
8647 AC_SUBST(MOZ_NATIVE_PNG)
8648 AC_SUBST(MOZ_NATIVE_BZ2)
8650 AC_SUBST(MOZ_JPEG_CFLAGS)
8651 AC_SUBST(MOZ_JPEG_LIBS)
8652 AC_SUBST(MOZ_BZ2_CFLAGS)
8653 AC_SUBST(MOZ_BZ2_LIBS)
8654 AC_SUBST(MOZ_PNG_CFLAGS)
8655 AC_SUBST(MOZ_PNG_LIBS)
8657 AC_SUBST(NSPR_CFLAGS)
8659 AC_SUBST(MOZ_NATIVE_NSPR)
8661 AC_SUBST(NSS_CFLAGS)
8663 AC_SUBST(MOZ_NATIVE_NSS)
8664 AC_SUBST(NSS_DISABLE_DBM)
8667 OS_CXXFLAGS="$CXXFLAGS"
8668 OS_CPPFLAGS="$CPPFLAGS"
8669 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8670 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8671 OS_LDFLAGS="$LDFLAGS"
8674 AC_SUBST(OS_CXXFLAGS)
8675 AC_SUBST(OS_CPPFLAGS)
8676 AC_SUBST(OS_COMPILE_CFLAGS)
8677 AC_SUBST(OS_COMPILE_CXXFLAGS)
8678 AC_SUBST(OS_LDFLAGS)
8680 AC_SUBST(CROSS_COMPILE)
8681 AC_SUBST(WCHAR_CFLAGS)
8685 AC_SUBST(HOST_CFLAGS)
8686 AC_SUBST(HOST_CXXFLAGS)
8687 AC_SUBST(HOST_LDFLAGS)
8688 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8690 AC_SUBST(HOST_AR_FLAGS)
8692 AC_SUBST(HOST_RANLIB)
8693 AC_SUBST(HOST_NSPR_MDCPUCFG)
8694 AC_SUBST(HOST_BIN_SUFFIX)
8695 AC_SUBST(HOST_OS_ARCH)
8697 AC_SUBST(TARGET_CPU)
8698 AC_SUBST(TARGET_VENDOR)
8700 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8701 AC_SUBST(TARGET_MD_ARCH)
8702 AC_SUBST(TARGET_XPCOM_ABI)
8705 AC_SUBST(OS_RELEASE)
8708 AC_SUBST(INTEL_ARCHITECTURE)
8709 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
8710 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
8712 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8714 AC_SUBST(WRAP_LDFLAGS)
8717 AC_SUBST(MKSHLIB_FORCE_ALL)
8718 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8719 AC_SUBST(DSO_CFLAGS)
8720 AC_SUBST(DSO_PIC_CFLAGS)
8721 AC_SUBST(DSO_LDOPTS)
8722 AC_SUBST(LIB_PREFIX)
8723 AC_SUBST(DLL_PREFIX)
8724 AC_SUBST(DLL_SUFFIX)
8725 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8726 AC_SUBST(LIB_SUFFIX)
8727 AC_SUBST(OBJ_SUFFIX)
8728 AC_SUBST(BIN_SUFFIX)
8729 AC_SUBST(ASM_SUFFIX)
8730 AC_SUBST(IMPORT_LIB_SUFFIX)
8732 AC_SUBST(CC_VERSION)
8733 AC_SUBST(CXX_VERSION)
8734 AC_SUBST(MSMANIFEST_TOOL)
8735 AC_SUBST(NS_ENABLE_TSF)
8736 AC_SUBST(MOZ_NSS_PATCH)
8737 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8738 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8740 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8741 AC_SUBST(MOZ_SOUNDTOUCH)
8744 AC_SUBST(MOZ_VORBIS)
8745 AC_SUBST(MOZ_TREMOR)
8750 AC_SUBST(MOZ_DIRECTSHOW)
8751 AC_SUBST(MOZ_MEDIA_PLUGINS)
8752 AC_SUBST(MOZ_OMX_PLUGIN)
8753 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8754 AC_SUBST(MOZ_VP8_ENCODER)
8758 AC_SUBST(VPX_ASFLAGS)
8759 AC_SUBST(VPX_DASH_C_FLAG)
8760 AC_SUBST(VPX_AS_CONVERSION)
8761 AC_SUBST(VPX_ASM_SUFFIX)
8762 AC_SUBST(VPX_X86_ASM)
8763 AC_SUBST(VPX_ARM_ASM)
8764 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8765 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8766 AC_SUBST(LIBJPEG_TURBO_AS)
8767 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8768 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8769 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8770 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8772 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8773 AC_SUBST(MOZ_FOLD_LIBS)
8775 AC_SUBST(MOZ_ENABLE_SZIP)
8776 AC_SUBST(MOZ_SZIP_FLAGS)
8778 AC_MSG_CHECKING([for posix_fallocate])
8779 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8780 #include <fcntl.h>],
8781 [posix_fallocate(0, 0, 0);],
8782 [ac_cv___posix_fallocate=true],
8783 [ac_cv___posix_fallocate=false])
8785 if test "$ac_cv___posix_fallocate" = true ; then
8786 AC_DEFINE(HAVE_POSIX_FALLOCATE)
8792 dnl Check for missing components
8793 if test "$COMPILE_ENVIRONMENT"; then
8794 if test "$MOZ_X11"; then
8795 if test "$WITHOUT_X11"; then
8796 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8798 dnl ====================================================
8799 dnl = Check if X headers exist
8800 dnl ====================================================
8801 _SAVE_CFLAGS=$CFLAGS
8802 CFLAGS="$CFLAGS $XCFLAGS"
8806 #include <X11/Xlib.h>
8807 #include <X11/Intrinsic.h>
8808 #include <X11/extensions/XShm.h>
8812 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8813 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8817 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8818 CFLAGS="$_SAVE_CFLAGS"
8820 if test -n "$MISSING_X"; then
8821 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8826 dnl Check for headers, etc. needed by WebGL.
8827 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8828 MOZ_CHECK_HEADER(GL/glx.h)
8829 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8830 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))])
8832 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8833 fi # COMPILE_ENVIRONMENT
8835 dnl Set various defines and substitutions
8836 dnl ========================================================
8838 if test "$OS_ARCH" = "Darwin"; then
8840 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8844 if test "$MOZ_DEBUG"; then
8845 AC_DEFINE(MOZ_REFLOW_PERF)
8846 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8849 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
8850 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8851 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8852 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8853 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8854 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8855 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8856 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8857 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8860 AC_SUBST(MOZILLA_VERSION)
8862 AC_SUBST(ac_configure_args)
8864 dnl Spit out some output
8865 dnl ========================================================
8867 dnl The following defines are used by xpcom
8868 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8870 HAVE_CPP_2BYTE_WCHAR_T
8871 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8873 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8874 HAVE_CPP_PARTIAL_SPECIALIZATION
8875 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8876 NEED_CPP_UNUSED_IMPLEMENTATIONS
8879 HAVE_ICONV_WITH_CONST_INPUT
8892 # FUTURE? Consider moving all these to moz.build files.
8894 netwerk/necko-config.h
8895 xpcom/xpcom-config.h
8896 xpcom/xpcom-private.h
8899 AC_SUBST(STLPORT_LIBS)
8901 export WRITE_MOZINFO=1
8902 AC_OUTPUT([mozilla-config.h])
8905 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8906 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8907 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8908 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8909 # (apparently) only need this hack when egrep's "pattern" is particularly long
8910 # (as in the following code) and the first egrep on our $PATH is Apple's. See
8914 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8921 # Generate Makefiles for WebRTC directly from .gyp files
8922 if test "${OS_TARGET}" = "WINNT"; then
8923 if test "$HAVE_64BIT_OS"; then
8928 EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
8930 elif test "${OS_TARGET}" = "Android"; then
8931 if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
8932 EXTRA_GYP_DEFINES="-G os=linux "
8934 EXTRA_GYP_DEFINES="-D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
8938 if test -n "$ARM_ARCH"; then
8939 if test "$ARM_ARCH" -lt 7; then
8940 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
8942 if test "${OS_TARGET}" = "Android"; then
8943 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=1 "
8945 dnl CPU detection for ARM works on Android only. armv7 always uses CPU detection, so
8946 dnl we have to set armv7=0 for non-Android target
8947 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
8952 # Keep libcubeb and audio_device backends in sync
8953 if test -n "$MOZ_ALSA"; then
8954 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=1"
8956 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=0"
8958 if test -n "$MOZ_PULSEAUDIO"; then
8959 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=1"
8961 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=0"
8964 # Don't try to compile ssse3/sse4.1 code if toolchain doesn't support
8965 if test -n "$INTEL_ARCHITECTURE"; then
8966 if test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSSE3" -o -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
8967 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
8971 if test -n "$MOZ_WEBRTC"; then
8972 AC_MSG_RESULT("generating WebRTC Makefiles...")
8974 if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
8975 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D build_with_gonk=1"
8978 dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
8979 dnl so that regeneration via dependencies works correctly
8980 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"
8982 if test -n HAVE_CLOCK_MONOTONIC; then
8983 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=1"
8985 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=0"
8988 if test -n "$MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI"; then
8989 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_ethtool_cmd_speed_hi=1"
8991 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_ethtool_cmd_speed_hi=0"
8994 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}"
8996 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8997 $GYP_WEBRTC_OPTIONS \
8998 --generator-output=${_objdir}/media/webrtc/trunk \
8999 ${srcdir}/media/webrtc/trunk/peerconnection.gyp
9000 if test "$?" != 0; then
9001 AC_MSG_ERROR([failed to generate WebRTC Makefiles])
9004 # XXX disable until we land the tranche with signaling
9005 if test -n "$MOZ_WEBRTC_SIGNALING"; then
9006 AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
9007 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9008 $GYP_WEBRTC_OPTIONS \
9009 -D build_for_test=0 \
9010 --generator-output=${_objdir}/media/webrtc/signaling \
9011 ${srcdir}/media/webrtc/signaling/signaling.gyp
9012 if test "$?" != 0; then
9013 AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
9016 AC_MSG_RESULT("generating WebRTC/SignalingTest Makefiles...")
9017 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9018 $GYP_WEBRTC_OPTIONS \
9019 -D build_for_test=1 \
9020 --generator-output=${_objdir}/media/webrtc/signalingtest \
9021 ${srcdir}/media/webrtc/signaling/signaling.gyp
9022 if test "$?" != 0; then
9023 AC_MSG_ERROR([failed to generate WebRTC/SignalingTest Makefiles])
9027 AC_MSG_RESULT("generating gtest Makefiles...")
9028 # Ok to pass some extra -D's that are ignored here
9029 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9030 $GYP_WEBRTC_OPTIONS \
9031 --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
9032 ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
9033 if test "$?" != 0; then
9034 AC_MSG_ERROR([failed to generate gtest Makefiles])
9037 AC_MSG_RESULT("generating nrappkit Makefiles...")
9038 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9039 $GYP_WEBRTC_OPTIONS \
9040 --generator-output=${_objdir}/media/mtransport/third_party/nrappkit \
9041 ${srcdir}/media/mtransport/third_party/nrappkit/nrappkit.gyp
9042 if test "$?" != 0; then
9043 AC_MSG_ERROR([failed to generate nrappkit Makefiles])
9046 AC_MSG_RESULT("generating nICEr Makefiles...")
9047 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9048 $GYP_WEBRTC_OPTIONS \
9049 --generator-output=${_objdir}/media/mtransport/third_party/nICEr \
9050 ${srcdir}/media/mtransport/third_party/nICEr/nicer.gyp
9051 if test "$?" != 0; then
9052 AC_MSG_ERROR([failed to generate nICEr Makefiles])
9056 # Run jemalloc configure script
9058 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
9059 ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
9060 if test -n "$MOZ_REPLACE_MALLOC"; then
9061 # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9062 ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9063 ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9065 if test -n "$MOZ_JEMALLOC3"; then
9066 case "${OS_ARCH}" in
9068 # We want jemalloc functions to be kept hidden on both Mac and Windows
9069 # See memory/build/mozmemory_wrap.h for details.
9070 ac_configure_args="$ac_configure_args --without-export"
9073 elif test "${OS_ARCH}" = Darwin; then
9074 # When building as a replace-malloc lib, disabling the zone allocator
9075 # forces to use pthread_atfork.
9076 ac_configure_args="$ac_configure_args --disable-zone-allocator"
9078 _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9080 if test -z "$MOZ_REPLACE_MALLOC"; then
9082 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9086 elif test -z "$MOZ_JEMALLOC3"; then
9088 JEMALLOC_WRAPPER=replace_
9090 if test -n "$MANGLE"; then
9092 if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
9093 JEMALLOC_WRAPPER=__wrap_
9095 for mangle in ${MANGLE}; do
9096 if test -n "$MANGLED"; then
9097 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9099 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9102 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9105 if test -z "$MOZ_TLS"; then
9106 ac_configure_args="$ac_configure_args --disable-tls"
9108 EXTRA_CFLAGS="$CFLAGS"
9109 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9110 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9112 if test "$CROSS_COMPILE"; then
9113 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9115 _save_cache_file="$cache_file"
9116 cache_file=$_objdir/memory/jemalloc/src/config.cache
9118 if ! test -e memory/jemalloc; then
9119 mkdir -p memory/jemalloc
9122 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9123 cache_file="$_save_cache_file"
9124 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9127 # Run freetype configure script
9129 if test "$MOZ_TREE_FREETYPE"; then
9130 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9131 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9132 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9133 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9134 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9135 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --without-png"
9137 if ! test -e modules; then
9141 AC_OUTPUT_SUBDIRS(modules/freetype2)
9144 if test -z "$direct_nspr_config"; then
9145 dnl ========================================================
9146 dnl = Setup a nice relatively clean build environment for
9147 dnl = sub-configures.
9148 dnl ========================================================
9151 CFLAGS="$_SUBDIR_CFLAGS"
9152 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9153 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9154 LDFLAGS="$_SUBDIR_LDFLAGS"
9155 HOST_CC="$_SUBDIR_HOST_CC"
9156 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9157 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9164 # Run all configure scripts specified by a subconfigure
9165 if test -n "$_subconfigure_subdir"; then
9166 _save_ac_configure_args="$ac_configure_args"
9167 ac_configure_args="$_subconfigure_config_args"
9168 AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
9169 ac_configure_args="$_save_ac_configure_args"
9172 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9173 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9177 if test -n "$_WRAP_MALLOC"; then
9178 # Avoid doubling wrap malloc arguments
9179 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9182 if test -z "$MOZ_NATIVE_NSPR"; then
9183 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9184 if test -z "$MOZ_DEBUG"; then
9185 ac_configure_args="$ac_configure_args --disable-debug"
9187 ac_configure_args="$ac_configure_args --enable-debug"
9189 if test "$MOZ_OPTIMIZE" = "1"; then
9190 ac_configure_args="$ac_configure_args --enable-optimize"
9191 elif test -z "$MOZ_OPTIMIZE"; then
9192 ac_configure_args="$ac_configure_args --disable-optimize"
9194 if test -n "$HAVE_64BIT_OS"; then
9195 ac_configure_args="$ac_configure_args --enable-64bit"
9197 if test -n "$USE_ARM_KUSER"; then
9198 ac_configure_args="$ac_configure_args --with-arm-kuser"
9200 ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9202 # Save these, so we can mess with them for the subconfigure ..
9203 _SAVE_CFLAGS="$CFLAGS"
9204 _SAVE_CPPFLAGS="$CPPFLAGS"
9205 _SAVE_LDFLAGS="$LDFLAGS"
9207 if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9208 # dladdr is supported by the new linker, even when the system linker doesn't
9209 # support it. Trick nspr into using dladdr when it's not supported.
9210 export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9212 export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9213 export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
9215 AC_OUTPUT_SUBDIRS(nsprpub)
9217 # .. and restore them
9221 CFLAGS="$_SAVE_CFLAGS"
9222 CPPFLAGS="$_SAVE_CPPFLAGS"
9223 LDFLAGS="$_SAVE_LDFLAGS"
9225 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9228 dnl ========================================================
9229 dnl = Setup a nice relatively clean build environment for
9230 dnl = sub-configures.
9231 dnl ========================================================
9234 CFLAGS="$_SUBDIR_CFLAGS"
9235 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9236 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9237 LDFLAGS="$_SUBDIR_LDFLAGS"
9238 HOST_CC="$_SUBDIR_HOST_CC"
9239 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9240 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9243 if test -n "$ENABLE_CLANG_PLUGIN"; then
9244 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9245 AC_OUTPUT_SUBDIRS(build/clang-plugin)
9249 # Run the SpiderMonkey 'configure' script.
9250 dist=$MOZ_BUILD_ROOT/dist
9251 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9252 ac_configure_args="$ac_configure_args --enable-threadsafe"
9254 MOZ_ARG_WITH_STRING(intl-api,
9255 [ --with-intl-api, --with-intl-api=build, --without-intl-api
9256 Determine the status of the ECMAScript Internationalization API. The first
9257 (or lack of any of these) builds and exposes the API. The second builds it
9258 but doesn't use ICU or expose the API to script. The third doesn't build
9260 WITH_INTL="--with-intl-api=$withval"
9262 if test -z "$WITH_INTL"; then
9263 if test "$NIGHTLY_BUILD" = "1" -a "$MOZ_BUILD_APP" = "browser"; then
9264 # In desktop nightlies the Internationalization API is disabled, but all
9265 # code for it is still built. Bug 853301 will remove this so that it's
9266 # built and the API is enabled.
9267 WITH_INTL="--with-intl-api=build"
9269 # Internationalization isn't built or exposed by default in non-desktop and
9270 # non-nightly builds. Bugs to enable:
9272 # Android: bug 864843
9274 WITH_INTL="--without-intl-api"
9277 ac_configure_args="$ac_configure_args $WITH_INTL"
9279 if test "$BUILD_CTYPES"; then
9280 # Build js-ctypes on the platforms we can.
9281 ac_configure_args="$ac_configure_args --enable-ctypes"
9283 if test -z "$JS_SHARED_LIBRARY" ; then
9284 ac_configure_args="$ac_configure_args --disable-shared-js"
9286 if test -z "$MOZ_NATIVE_NSPR"; then
9287 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9288 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9290 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9291 ac_configure_args="$ac_configure_args --prefix=$dist"
9292 if test "$MOZ_MEMORY"; then
9293 ac_configure_args="$ac_configure_args --enable-jemalloc"
9295 if test -n "$MOZ_GLUE_LDFLAGS"; then
9296 export MOZ_GLUE_LDFLAGS
9298 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9299 export MOZ_GLUE_PROGRAM_LDFLAGS
9301 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9304 export MOZ_NATIVE_ZLIB
9305 export MOZ_ZLIB_CFLAGS
9306 export MOZ_ZLIB_LIBS
9308 export DONT_POPULATE_VIRTUALENV=1
9310 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9311 export STLPORT_CPPFLAGS
9312 export STLPORT_LDFLAGS
9314 export JS_STANDALONE=no
9316 if ! test -e js; then
9320 AC_OUTPUT_SUBDIRS(js/src)
9321 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9323 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR