2 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
3 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
4 dnl This Source Code Form is subject to the terms of the Mozilla Public
5 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
6 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 dnl Process this file with autoconf to produce a configure script.
9 dnl ========================================================
12 AC_INIT(config/config.mk)
13 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
15 TARGET_CPU="${target_cpu}"
16 TARGET_VENDOR="${target_vendor}"
17 TARGET_OS="${target_os}"
19 dnl ========================================================
21 dnl = Don't change the following two lines. Doing so breaks:
23 dnl = CFLAGS="-foo" ./configure
25 dnl ========================================================
27 CPPFLAGS="${CPPFLAGS=}"
28 CXXFLAGS="${CXXFLAGS=}"
30 HOST_CFLAGS="${HOST_CFLAGS=}"
31 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
32 HOST_LDFLAGS="${HOST_LDFLAGS=}"
34 dnl ========================================================
35 dnl = Preserve certain environment flags passed to configure
36 dnl = We want sub projects to receive the same flags
37 dnl = untainted by this configure script
38 dnl ========================================================
41 _SUBDIR_CFLAGS="$CFLAGS"
42 _SUBDIR_CPPFLAGS="$CPPFLAGS"
43 _SUBDIR_CXXFLAGS="$CXXFLAGS"
44 _SUBDIR_LDFLAGS="$LDFLAGS"
45 _SUBDIR_HOST_CC="$HOST_CC"
46 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
47 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
48 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
49 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
51 dnl Set the version number of the libs included with mozilla
52 dnl ========================================================
58 dnl Set the minimum version of toolkit libs used by mozilla
59 dnl ========================================================
66 WINDRES_VERSION=2.14.90
72 STARTUP_NOTIFICATION_VERSION=0.8
74 SQLITE_VERSION=3.8.0.2
78 dnl Set various checks
79 dnl ========================================================
83 dnl Initialize the Pthread test variables early so they can be
84 dnl overridden by each platform.
85 dnl ========================================================
89 dnl Do not allow 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_SUBST(MOZ_OMX_DECODER)
217 GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include"
218 if test -d "$gonkdir/external/bluetooth/bluez"; then
219 GONK_INCLUDES+=" -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
224 AC_SUBST(MOZ_OMX_DECODER)
227 AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
230 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"
231 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
232 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
233 dnl Add -llog by default, since we use it all over the place.
236 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"
238 dnl prevent cross compile section from using these flags as host flags
239 if test -z "$HOST_CPPFLAGS" ; then
242 if test -z "$HOST_CFLAGS" ; then
245 if test -z "$HOST_CXXFLAGS" ; then
248 if test -z "$HOST_LDFLAGS" ; then
253 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
254 AC_SUBST(ANDROID_VERSION)
255 AC_DEFINE(HAVE_SYS_UIO_H)
256 AC_DEFINE(HAVE_PTHREADS)
258 MOZ_CHROME_FILE_FORMAT=omni
264 *-android*|*-linuxandroid*)
265 if test -z "$ANDROID_PACKAGE_NAME" ; then
266 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
268 MOZ_CHROME_FILE_FORMAT=omni
272 AC_PATH_PROG(OBJCOPY,objcopy)
277 AC_SUBST(ANDROID_SOURCE)
278 AC_SUBST(ANDROID_PACKAGE_NAME)
281 dnl ========================================================
282 dnl Checks for compilers.
283 dnl ========================================================
284 dnl Set CROSS_COMPILE in the environment when running configure
285 dnl to use the cross-compile setup for now
286 dnl ========================================================
288 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
291 if test "$COMPILE_ENVIRONMENT"; then
293 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
299 # Work around the conftest.exe access problem on Windows
304 MOZ_PATH_PROGS(AS, $AS as, $CC)
305 AC_CHECK_PROGS(AR, ar, :)
306 AC_CHECK_PROGS(LD, ld, :)
307 AC_CHECK_PROGS(STRIP, strip, :)
308 AC_CHECK_PROGS(WINDRES, windres, :)
309 if test -z "$HOST_CC"; then
312 if test -z "$HOST_CFLAGS"; then
313 HOST_CFLAGS="$CFLAGS"
315 if test -z "$HOST_CXX"; then
318 if test -z "$HOST_CXXFLAGS"; then
319 HOST_CXXFLAGS="$CXXFLAGS"
321 if test -z "$HOST_LDFLAGS"; then
322 HOST_LDFLAGS="$LDFLAGS"
324 if test -z "$HOST_RANLIB"; then
325 HOST_RANLIB="$RANLIB"
327 if test -z "$HOST_AR"; then
330 if test -z "$HOST_AR_FLAGS"; then
331 HOST_AR_FLAGS="$AR_FLAGS"
335 if test -n "$MOZ_WINCONSOLE"; then
336 AC_DEFINE(MOZ_WINCONSOLE)
341 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
342 if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
343 test "$GCC_MAJOR_VERSION" -lt 4; then
344 AC_MSG_ERROR([Only GCC 4.4 or newer supported])
348 dnl ========================================================
349 dnl Special win32 checks
350 dnl ========================================================
352 MOZ_ARG_ENABLE_BOOL(metro,
353 [ --enable-metro Enable Windows Metro build targets],
356 if test -n "$MOZ_METRO"; then
358 # Target the Windows 8 Kit
361 # toolkit/library/makefile.in needs these, see nsDllMain.
363 CRTEXPDLLVERSION=1-1-0
365 # Target the Windows 7 SDK by default
370 AC_SUBST(CRTDLLVERSION)
371 AC_SUBST(CRTEXPDLLVERSION)
373 MOZ_ARG_WITH_STRING(windows-version,
374 [ --with-windows-version=WINSDK_TARGETVER
375 Windows SDK version to target. Lowest version
376 currently allowed is 601 (Win7), highest is 602 (Win8)],
377 WINSDK_TARGETVER=$withval)
379 # Currently only two sdk versions allowed, 601 and 602
380 case "$WINSDK_TARGETVER" in
382 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
386 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
392 if test "$GCC" != "yes" -a -z "$CLANG_CC"; then
393 # Check to see if we are really running in a msvc environemnt
395 AC_CHECK_PROGS(MIDL, midl)
397 # Make sure compilers are valid
398 CFLAGS="$CFLAGS -TC -nologo"
399 CXXFLAGS="$CXXFLAGS -TP -nologo"
402 AC_TRY_COMPILE([#include <stdio.h>],
403 [ printf("Hello World\n"); ],,
404 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
407 AC_TRY_COMPILE([#include <new.h>],
408 [ unsigned *test = new unsigned(42); ],,
409 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
413 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
416 # Determine compiler version
417 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
418 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
419 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
420 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
421 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
422 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
424 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
425 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
427 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
428 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
431 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
432 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
434 if test "$_CC_MAJOR_VERSION" = "16"; then
437 elif test "$_CC_MAJOR_VERSION" = "17"; then
440 elif test "$_CC_MAJOR_VERSION" = "18"; then
444 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
447 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
449 if test -n "$WIN32_REDIST_DIR"; then
450 if test ! -d "$WIN32_REDIST_DIR"; then
451 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
453 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
456 dnl Confirm we have the pri tools on win8 builds
457 if test -n "$MOZ_METRO"; then
458 AC_MSG_CHECKING([for makepri])
459 AC_CHECK_PROGS(MAKEPRI, makepri, "")
460 if test -z "MAKEPRI" ; then
461 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
466 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
467 dnl not something else like "magnetic tape manipulation utility".
468 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
469 if test -z "$MSMT_TOOL"; then
470 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
474 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
476 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
477 if test -z "$MSMANIFEST_TOOL_VERSION"; then
478 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
484 # Check linker version
485 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
486 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
487 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
488 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
493 # Set midl environment
496 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
499 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
503 unset _MSVC_VER_FILTER
505 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
509 _SAVE_CXXFLAGS="$CXXFLAGS"
510 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
511 AC_TRY_COMPILE([#include <exception>],
512 [std::_Throw(std::exception()); return 0;],
513 ac_cv_have_std__Throw="yes",
514 ac_cv_have_std__Throw="no")
515 CXXFLAGS="$_SAVE_CXXFLAGS"
519 if test "$ac_cv_have_std__Throw" = "yes"; then
520 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
521 ac_cv_have_dllimport_exception_bug,
525 _SAVE_CXXFLAGS="$CXXFLAGS"
526 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
527 AC_TRY_LINK([#include <vector>],
528 [std::vector<int> v; return v.at(1);],
529 ac_cv_have_dllimport_exception_bug="no",
530 ac_cv_have_dllimport_exception_bug="yes")
531 CXXFLAGS="$_SAVE_CXXFLAGS"
534 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
536 MOZ_MSVC_STL_WRAP__Throw=1
537 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
540 AC_CACHE_CHECK(for overridable _RAISE,
545 _SAVE_CXXFLAGS="$CXXFLAGS"
546 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
547 AC_TRY_COMPILE([#include <xstddef>
549 #define _RAISE(x) externallyDefinedFunction((x).what())
552 [std::vector<int> v; return v.at(1);],
553 ac_cv_have__RAISE="no",
554 ac_cv_have__RAISE="yes")
555 CXXFLAGS="$_SAVE_CXXFLAGS"
558 if test "$ac_cv_have__RAISE" = "yes"; then
560 MOZ_MSVC_STL_WRAP__RAISE=1
561 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
563 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
567 if test "$WRAP_STL_INCLUDES" = "1"; then
568 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
570 elif test -z "$CLANG_CC"; then
571 # Check w32api version
572 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
573 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
574 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
575 AC_TRY_COMPILE([#include <w32api.h>],
576 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
577 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
578 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
579 #error "test failed."
581 , [ res=yes ], [ res=no ])
582 AC_MSG_RESULT([$res])
583 if test "$res" != "yes"; then
584 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
586 # Check windres version
587 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
588 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
589 AC_MSG_RESULT([$_WINDRES_VERSION])
590 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
591 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
592 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
593 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
594 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
595 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
596 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
597 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
598 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
599 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
600 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
601 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
603 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
606 AC_CHECK_PROGS(MIDL, $target-widl widl)
607 if test -n "$MIDL"; then
610 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
613 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
618 MOZ_WINSDK_MAXVER=0x06020000
622 if test "$GCC" != "yes" -o -n "$CLANG_CC" ; then
623 MOZ_FIND_WINSDK_VERSION
626 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
627 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
628 # Require OS features provided by IE 6.0 SP2 (XP SP2)
629 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
631 # If the maximum version supported by this SDK is lower than the target
633 AC_MSG_CHECKING([for Windows SDK being recent enough])
634 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
638 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.])
641 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
642 # Definitions matching sdkddkver.h
643 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
644 AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
645 AC_SUBST(MOZ_WINSDK_MAXVER)
652 if test -n "$_WIN32_MSVC"; then
654 SKIP_COMPILER_CHECKS=1
655 SKIP_LIBRARY_CHECKS=1
657 # Since we're skipping compiler and library checks, hard-code
660 AC_DEFINE(HAVE_SETBUF)
661 AC_DEFINE(HAVE_ISATTY)
664 fi # COMPILE_ENVIRONMENT
677 AC_SUBST(WRAP_STL_INCLUDES)
678 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
679 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
681 dnl ========================================================
682 dnl Checks for programs.
683 dnl ========================================================
687 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
688 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
689 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
691 AC_MSG_RESULT([$_perl_version])
693 if test "$_perl_res" != 0; then
694 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
698 AC_MSG_CHECKING([for full perl installation])
699 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
701 if test "$_perl_res" != 0; then
703 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
708 if test -z "$COMPILE_ENVIRONMENT"; then
709 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
711 AC_SUBST(NSINSTALL_BIN)
713 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
714 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
715 MOZ_PATH_PROGS(UNZIP, unzip)
716 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
717 AC_MSG_ERROR([unzip not found in \$PATH])
719 MOZ_PATH_PROGS(ZIP, zip)
720 if test -z "$ZIP" -o "$ZIP" = ":"; then
721 AC_MSG_ERROR([zip not found in \$PATH])
723 MOZ_PATH_PROG(XARGS, xargs)
724 if test -z "$XARGS" -o "$XARGS" = ":"; then
725 AC_MSG_ERROR([xargs not found in \$PATH .])
728 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
731 if test "$COMPILE_ENVIRONMENT"; then
733 dnl ========================================================
734 dnl = Mac OS X toolchain support
735 dnl ========================================================
737 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
738 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
739 dnl when we can run target binaries.
740 AC_SUBST(UNIVERSAL_BINARY)
741 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
743 MOZ_ARG_WITH_STRING(unify-dist,
744 [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
746 if test -n "$UNIVERSAL_BINARY"; then
747 if test -z "$UNIFY_DIST"; then
748 AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
750 case "$UNIFY_DIST" in
754 UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
760 dnl ========================================================
761 dnl Check for MacOS deployment target version
762 dnl ========================================================
764 MOZ_ARG_ENABLE_STRING(macos-target,
765 [ --enable-macos-target=VER (default=10.6)
766 Set the minimum MacOS version needed at runtime],
767 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
771 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
772 dnl Use the specified value
773 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
775 dnl No value specified on the command line or in the environment,
776 dnl use architecture minimum.
777 export MACOSX_DEPLOYMENT_TARGET=10.6
782 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
784 dnl ========================================================
785 dnl = Mac OS X SDK support
786 dnl ========================================================
789 MOZ_ARG_WITH_STRING(macos-sdk,
790 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
791 MACOS_SDK_DIR=$withval)
793 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
794 dnl NEXT_ROOT will be set and exported only if it's needed.
795 AC_SUBST(MACOS_SDK_DIR)
798 if test "$MACOS_SDK_DIR"; then
799 dnl Sync this section with the ones in NSPR and NSS.
800 dnl Changes to the cross environment here need to be accounted for in
801 dnl the libIDL checks (below) and xpidl build.
803 if test ! -d "$MACOS_SDK_DIR"; then
804 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
805 specify a valid SDK. SDKs are installed when the optional cross-development
806 tools are selected during the Xcode/Developer Tools installation.])
809 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
810 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
812 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
813 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
814 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
817 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
819 AC_TRY_COMPILE([#include <new>],[],
823 AC_MSG_RESULT($result)
825 if test "$result" = "no" ; then
826 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
830 fi # COMPILE_ENVIRONMENT
832 AC_MSG_CHECKING([compiler version])
833 # Just print it so it shows up in the logs.
834 cc_version=$($CC --version)
835 AC_MSG_RESULT([$cc_version])
837 if test -n "$MAKE"; then
838 if test `echo $MAKE | grep -c make.py` != 1; then
845 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
848 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
851 if test "$GMAKE" = ":"; then
852 AC_MSG_ERROR([GNU make not found])
856 if test -z "$MAKE"; then
860 if test "$COMPILE_ENVIRONMENT"; then
866 fi # COMPILE_ENVIRONMENT
868 dnl ========================================================
869 dnl set the defaults first
870 dnl ========================================================
886 MOZ_USER_DIR=".mozilla"
889 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
891 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
893 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
895 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
896 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
897 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
898 XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/bin)'
899 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)'
900 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
901 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
903 # These are specially defined on Windows only
906 XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
907 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
910 XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
911 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
917 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
921 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
923 if test -n "$CROSS_COMPILE"; then
924 OS_TARGET="${target_os}"
925 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
927 case "${target_os}" in
928 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
929 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
931 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
932 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
933 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
936 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
940 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
941 OS_RELEASE=`uname -r`
944 # Before this used `uname -m` when not cross compiling
945 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
946 OS_TEST="${target_cpu}"
948 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
950 #######################################################################
951 # Master "Core Components" macros for getting the OS target #
952 #######################################################################
955 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
960 # Define and override various archtecture-specific variables, including
969 case "$HOST_OS_ARCH" in
983 if test -z "$GNU_CC"; then
984 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
989 if test -z "$GNU_CXX"; then
990 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
994 AC_SUBST(SOLARIS_SUNPRO_CC)
995 AC_SUBST(SOLARIS_SUNPRO_CXX)
1004 if test -z "$CROSS_COMPILE" ; then
1010 # If uname -s returns "Windows_NT", we assume that we are using
1011 # the uname.exe in MKS toolkit.
1013 # The -r option of MKS uname only returns the major version number.
1014 # So we need to use its -v option to get the minor version number.
1015 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1019 OS_MINOR_RELEASE=`uname -v`
1020 if test "$OS_MINOR_RELEASE" = "00"; then
1023 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1027 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1028 # the uname.exe in the MSYS tools.
1030 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1035 OS_RELEASE=`uname -v`.`uname -r`
1036 OS_TEST=${target_cpu}
1041 OS_RELEASE=`uname -v`
1044 case "${target_cpu}" in
1055 if test -z "$CROSS_COMPILE" ; then
1063 # Only set CPU_ARCH if we recognize the value of OS_TEST
1074 powerpc | ppc | rs6000)
1078 Alpha | alpha | ALPHA)
1111 if test -z "$OS_TARGET"; then
1114 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1116 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1117 dnl ===============================================================
1121 INTEL_ARCHITECTURE=1
1124 dnl Configure platform-specific CPU architecture compiler options.
1125 dnl ==============================================================
1128 dnl =================================================================
1129 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1130 dnl which is bad when cross compiling.
1131 dnl =================================================================
1132 if test "$COMPILE_ENVIRONMENT"; then
1133 configure_static_assert_macros='
1134 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1135 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1136 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1139 dnl test that the macros actually work:
1140 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1141 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1144 ac_cv_static_assertion_macros_work="yes"
1145 AC_TRY_COMPILE([$configure_static_assert_macros],
1146 [CONFIGURE_STATIC_ASSERT(1)],
1148 ac_cv_static_assertion_macros_work="no")
1149 AC_TRY_COMPILE([$configure_static_assert_macros],
1150 [CONFIGURE_STATIC_ASSERT(0)],
1151 ac_cv_static_assertion_macros_work="no",
1154 AC_TRY_COMPILE([$configure_static_assert_macros],
1155 [CONFIGURE_STATIC_ASSERT(1)],
1157 ac_cv_static_assertion_macros_work="no")
1158 AC_TRY_COMPILE([$configure_static_assert_macros],
1159 [CONFIGURE_STATIC_ASSERT(0)],
1160 ac_cv_static_assertion_macros_work="no",
1164 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1165 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1166 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1168 fi # COMPILE_ENVIRONMENT
1170 dnl ========================================================
1171 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1173 dnl ========================================================
1177 dnl ========================================================
1178 dnl Suppress Clang Argument Warnings
1179 dnl ========================================================
1180 if test -n "$CLANG_CC"; then
1181 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1182 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1184 if test -n "$CLANG_CXX"; then
1185 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1188 dnl ========================================================
1189 dnl = Use Address Sanitizer
1190 dnl ========================================================
1191 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1192 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1195 if test -n "$MOZ_ASAN"; then
1198 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1201 AC_SUBST(LLVM_SYMBOLIZER)
1203 dnl ========================================================
1204 dnl = Enable hacks required for LLVM instrumentations
1205 dnl ========================================================
1206 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1207 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1210 if test -n "$MOZ_LLVM_HACKS"; then
1214 AC_SUBST(MOZ_NO_WLZDEFS)
1215 AC_SUBST(MOZ_CFLAGS_NSS)
1217 dnl ========================================================
1218 dnl GNU specific defaults
1219 dnl ========================================================
1220 if test "$GNU_CC"; then
1221 # Per bug 719659 comment 2, some of the headers on ancient build machines
1222 # may require gnu89 inline semantics. But otherwise, we use C99.
1223 # But on OS X we just use C99 plus GNU extensions, in order to fix
1225 CFLAGS="$CFLAGS -std=gnu99"
1226 if test "${OS_ARCH}" != Darwin; then
1227 CFLAGS="$CFLAGS -fgnu89-inline"
1229 # FIXME: Let us build with strict aliasing. bug 414641.
1230 CFLAGS="$CFLAGS -fno-strict-aliasing"
1231 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1232 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1233 DSO_LDOPTS='-shared'
1234 if test "$GCC_USE_GNU_LD"; then
1235 # Some tools like ASan use a runtime library that is only
1236 # linked against executables, so we must allow undefined
1237 # symbols for shared objects in some cases.
1238 if test -z "$MOZ_NO_WLZDEFS"; then
1239 # Don't allow undefined symbols in libraries
1240 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1243 WARNINGS_AS_ERRORS='-Werror'
1245 DSO_PIC_CFLAGS='-fPIC'
1246 ASFLAGS="$ASFLAGS -fPIC"
1247 AC_MSG_CHECKING([for --noexecstack option to as])
1248 _SAVE_CFLAGS=$CFLAGS
1249 CFLAGS="$CFLAGS -Wa,--noexecstack"
1250 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1251 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1252 AC_MSG_RESULT([no]))
1253 CFLAGS=$_SAVE_CFLAGS
1254 AC_MSG_CHECKING([for -z noexecstack option to ld])
1255 _SAVE_LDFLAGS=$LDFLAGS
1256 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1257 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1259 LDFLAGS=$_SAVE_LDFLAGS)
1261 AC_MSG_CHECKING([for -z text option to ld])
1262 _SAVE_LDFLAGS=$LDFLAGS
1263 LDFLAGS="$LDFLAGS -Wl,-z,text"
1264 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1265 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1267 LDFLAGS=$_SAVE_LDFLAGS)
1269 AC_MSG_CHECKING([for --build-id option to ld])
1270 _SAVE_LDFLAGS=$LDFLAGS
1271 LDFLAGS="$LDFLAGS -Wl,--build-id"
1272 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1273 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1275 LDFLAGS=$_SAVE_LDFLAGS)
1278 # Check for -mssse3 on $CC
1279 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1280 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1281 _SAVE_CFLAGS=$CFLAGS
1282 CFLAGS="$CFLAGS -mssse3"
1283 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1284 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1285 AC_MSG_RESULT([no]))
1286 CFLAGS=$_SAVE_CFLAGS
1288 # Check for -msse4.1 on $CC
1289 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1290 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1291 _SAVE_CFLAGS=$CFLAGS
1292 CFLAGS="$CFLAGS -msse4.1"
1293 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1294 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1295 AC_MSG_RESULT([no]))
1296 CFLAGS=$_SAVE_CFLAGS
1298 # Turn on GNU-specific warnings:
1299 # -Wall - turn on a lot of warnings
1300 # -Wpointer-arith - good to have
1301 # -Wdeclaration-after-statement - MSVC doesn't like these
1302 # -Werror=return-type - catches missing returns, zero false positives
1303 # -Wtype-limits - catches overflow bugs, few false positives
1304 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1305 # -Wsign-compare - catches comparison of signed and unsigned types
1307 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1308 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1309 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1310 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1311 MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1313 # Turn off the following warnings that -Wall turns on:
1314 # -Wno-unused - lots of violations in third-party code
1316 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1318 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1319 # Don't use -Wcast-align with ICC or clang
1321 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1322 hppa | ia64 | sparc | arm)
1325 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1330 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1331 _USE_CPP_INCLUDE_FLAG=1
1332 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1334 elif test "$SOLARIS_SUNPRO_CC"; then
1336 if test "$CPU_ARCH" = "sparc"; then
1337 # for Sun Studio on Solaris/SPARC
1338 DSO_PIC_CFLAGS='-xcode=pic32'
1340 DSO_PIC_CFLAGS='-KPIC'
1342 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1344 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1345 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1347 DSO_LDOPTS='-shared'
1348 if test "$GNU_LD"; then
1349 # Don't allow undefined symbols in libraries
1350 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1354 DSO_PIC_CFLAGS='-KPIC'
1355 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1358 if test "$GNU_CXX"; then
1359 # FIXME: Let us build with strict aliasing. bug 414641.
1360 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1362 # Turn on GNU-specific warnings:
1363 # -Wall - turn on a lot of warnings
1364 # -Wpointer-arith - good to have
1365 # -Woverloaded-virtual - ???
1366 # -Werror=return-type - catches missing returns, zero false positives
1367 # -Wtype-limits - catches overflow bugs, few false positives
1368 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1369 # -Wsign-compare - catches comparison of signed and unsigned types
1371 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1372 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1373 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1374 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1375 MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1377 # Turn off the following warnings that -Wall turns on:
1378 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1380 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1382 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1383 # Don't use -Wcast-align with ICC or clang
1385 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1386 hppa | ia64 | sparc | arm)
1389 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1394 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1395 _USE_CPP_INCLUDE_FLAG=1
1397 # Recent clang and gcc support C++11 deleted functions without warnings if
1398 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1399 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1400 # unused. But clang's warning can be disabled, so when compiling with clang
1401 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1402 # deleted function syntax.
1403 if test "$CLANG_CXX"; then
1404 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1405 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1409 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1412 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1413 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1414 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1415 dnl normal behavior.
1416 dnl ========================================================
1418 MKSHLIB_UNFORCE_ALL=
1420 if test "$COMPILE_ENVIRONMENT"; then
1421 if test "$GNU_CC"; then
1422 AC_MSG_CHECKING(whether ld has archive extraction flags)
1423 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1424 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1425 ac_cv_mkshlib_force_and_unforce="no"
1426 exec 3<&0 <<LOOP_INPUT
1427 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1428 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1429 force="-Wl,-all"; unforce="-Wl,-none"
1436 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1439 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1441 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1445 eval $ac_cv_mkshlib_force_and_unforce
1446 MKSHLIB_FORCE_ALL=$force
1447 MKSHLIB_UNFORCE_ALL=$unforce
1450 fi # COMPILE_ENVIRONMENT
1452 dnl ========================================================
1453 dnl Checking for 64-bit OS
1454 dnl ========================================================
1455 if test "$COMPILE_ENVIRONMENT"; then
1458 AC_MSG_CHECKING(for 64-bit OS)
1459 AC_TRY_COMPILE([$configure_static_assert_macros],
1460 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1461 result="yes", result="no")
1462 AC_MSG_RESULT("$result")
1463 if test "$result" = "yes"; then
1464 AC_DEFINE(HAVE_64BIT_OS)
1467 AC_SUBST(HAVE_64BIT_OS)
1469 fi # COMPILE_ENVIRONMENT
1471 dnl ========================================================
1472 dnl Enable high-memory support on OS/2 by default.
1473 dnl ========================================================
1474 MOZ_OS2_HIGH_MEMORY=1
1475 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1476 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1477 MOZ_OS2_HIGH_MEMORY=,
1478 MOZ_OS2_HIGH_MEMORY=1 )
1479 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1481 dnl ========================================================
1482 dnl = Use profiling compile flags
1483 dnl ========================================================
1484 MOZ_ARG_ENABLE_BOOL(profiling,
1485 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1489 # For profiling builds keep the symbol information
1490 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1491 case "$OS_TARGET" in
1492 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1493 STRIP_FLAGS="--strip-debug"
1498 dnl ========================================================
1499 dnl = Use incremental GC
1500 dnl ========================================================
1502 MOZ_ARG_DISABLE_BOOL(gcincremental,
1503 [ --disable-gcincremental Disable incremental GC],
1505 if test -n "$JSGC_INCREMENTAL"; then
1506 AC_DEFINE(JSGC_INCREMENTAL)
1509 dnl ========================================================
1510 dnl = Use generational GC
1511 dnl ========================================================
1512 MOZ_ARG_ENABLE_BOOL(gcgenerational,
1513 [ --enable-gcgenerational Enable generational GC],
1514 JSGC_GENERATIONAL=1,
1515 JSGC_GENERATIONAL= )
1516 if test -n "$JSGC_GENERATIONAL"; then
1517 AC_DEFINE(JSGC_GENERATIONAL)
1520 dnl ========================================================
1521 dnl = Perform moving GC stack rooting analysis
1522 dnl ========================================================
1523 MOZ_ARG_ENABLE_BOOL(root-analysis,
1524 [ --enable-root-analysis Enable moving GC stack root analysis],
1525 JSGC_ROOT_ANALYSIS=1,
1526 JSGC_ROOT_ANALYSIS= )
1527 if test -n "$JSGC_ROOT_ANALYSIS"; then
1528 AC_DEFINE(JSGC_ROOT_ANALYSIS)
1531 dnl ========================================================
1532 dnl = Use exact stack rooting for GC
1533 dnl ========================================================
1534 MOZ_ARG_ENABLE_BOOL(exact-rooting,
1535 [ --enable-exact-rooting Enable use of exact stack roots for GC],
1536 JSGC_USE_EXACT_ROOTING=1,
1537 JSGC_USE_EXACT_ROOTING= )
1538 if test -n "$JSGC_USE_EXACT_ROOTING"; then
1539 AC_DEFINE(JSGC_USE_EXACT_ROOTING)
1542 dnl ========================================================
1544 dnl ========================================================
1545 MOZ_ARG_ENABLE_BOOL(valgrind,
1546 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1549 if test -n "$MOZ_VALGRIND"; then
1550 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1552 [--enable-valgrind specified but Valgrind is not installed]))
1553 AC_DEFINE(MOZ_VALGRIND)
1555 AC_SUBST(MOZ_VALGRIND)
1557 dnl ========================================================
1559 dnl ========================================================
1560 MOZ_ARG_ENABLE_BOOL(jprof,
1561 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1564 if test -n "$MOZ_JPROF"; then
1566 AC_DEFINE(MOZ_JPROF)
1569 dnl ========================================================
1571 dnl ========================================================
1572 MOZ_ENABLE_PROFILER_SPS=1
1574 case "${OS_TARGET}" in
1576 case "${CPU_ARCH}" in
1579 MOZ_ENABLE_PROFILER_SPS=
1583 case "${CPU_ARCH}" in
1586 MOZ_ENABLE_PROFILER_SPS=
1591 MOZ_ENABLE_PROFILER_SPS=
1595 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1596 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1599 dnl ========================================================
1601 dnl ========================================================
1602 MOZ_ARG_ENABLE_BOOL(shark,
1603 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1606 if test -n "$MOZ_SHARK"; then
1608 AC_DEFINE(MOZ_SHARK)
1611 dnl ========================================================
1613 dnl ========================================================
1614 MOZ_ARG_ENABLE_BOOL(instruments,
1615 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
1618 if test -n "$MOZ_INSTRUMENTS"; then
1620 AC_DEFINE(MOZ_INSTRUMENTS)
1623 dnl ========================================================
1625 dnl ========================================================
1626 MOZ_ARG_ENABLE_BOOL(callgrind,
1627 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1630 if test -n "$MOZ_CALLGRIND"; then
1632 AC_DEFINE(MOZ_CALLGRIND)
1635 dnl ========================================================
1637 dnl ========================================================
1638 MOZ_ARG_ENABLE_BOOL(vtune,
1639 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1642 if test -n "$MOZ_VTUNE"; then
1644 AC_DEFINE(MOZ_VTUNE)
1647 dnl ========================================================
1649 dnl ========================================================
1650 if test -n "$MOZ_PROFILING"; then
1651 AC_DEFINE(MOZ_PROFILING)
1654 dnl ========================================================
1655 dnl System overrides of the defaults for host
1656 dnl ========================================================
1659 if test -n "$_WIN32_MSVC"; then
1661 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1662 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1663 HOST_RANLIB='echo ranlib'
1665 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1667 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1668 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1669 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1670 HOST_BIN_SUFFIX=.exe
1673 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1677 case "${host_cpu}" in
1679 if test -n "$_WIN32_MSVC"; then
1680 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1684 if test -n "$_WIN32_MSVC"; then
1685 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1687 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1693 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1694 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1695 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1698 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1699 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1700 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1701 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1705 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1706 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1707 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1708 HOST_BIN_SUFFIX=.exe
1713 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1714 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1718 dnl Check for using a custom <inttypes.h> implementation
1719 dnl ========================================================
1720 AC_MSG_CHECKING(for custom <inttypes.h> implementation)
1721 if test "$MOZ_CUSTOM_INTTYPES_H"; then
1722 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
1723 AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
1725 AC_MSG_RESULT(none specified)
1728 dnl Get mozilla version from central milestone file
1729 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1730 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1732 dnl Get version of various core apps from the version files.
1733 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1735 if test -z "$FIREFOX_VERSION"; then
1736 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1739 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1740 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1741 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1743 MOZ_DOING_LTO(lto_is_enabled)
1745 dnl ========================================================
1746 dnl System overrides of the defaults for target
1747 dnl ========================================================
1752 if test ! "$GNU_CC"; then
1753 if test ! "$HAVE_64BIT_OS"; then
1754 # Compiling with Visual Age C++ object model compat is the
1755 # default. To compile with object model ibm, add
1756 # AIX_OBJMODEL=ibm to .mozconfig.
1757 if test "$AIX_OBJMODEL" = "ibm"; then
1758 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1765 AC_SUBST(AIX_OBJMODEL)
1766 DSO_LDOPTS='-qmkshrobj=1'
1767 DSO_CFLAGS='-qflag=w:w'
1769 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1771 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1772 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1773 if test "$COMPILE_ENVIRONMENT"; then
1776 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1778 [#if (__IBMCPP__ < 900)
1779 #error "Bad compiler"
1781 _BAD_COMPILER=,_BAD_COMPILER=1)
1782 if test -n "$_BAD_COMPILER"; then
1784 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1786 AC_MSG_RESULT([yes])
1789 TARGET_COMPILER_ABI="ibmc"
1790 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1791 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1794 case "${target_os}" in
1799 if test "$COMPILE_ENVIRONMENT"; then
1800 MOZ_CHECK_HEADERS(sys/inttypes.h)
1802 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1806 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1807 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1808 MOZ_OPTIMIZE_FLAGS="-O3"
1809 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1810 if test "$HAVE_64BIT_OS"; then
1815 STRIP_FLAGS="$STRIP_FLAGS -x -S"
1816 # Check whether we're targeting OS X or iOS
1817 AC_CACHE_CHECK(for iOS target,
1819 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1820 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1824 ac_cv_ios_target="yes",
1825 ac_cv_ios_target="no")])
1826 if test "$ac_cv_ios_target" = "yes"; then
1828 AC_DEFINE(XP_DARWIN)
1829 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1831 AC_DEFINE(XP_MACOSX)
1832 AC_DEFINE(XP_DARWIN)
1833 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1834 # The ExceptionHandling framework is needed for Objective-C exception
1835 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1837 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1839 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1842 if test "x$lto_is_enabled" = "xyes"; then
1843 echo "Skipping -dead_strip because lto is enabled."
1844 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1845 dnl ===================================================================
1846 elif test "x$enable_dtrace" = "xyes"; then
1847 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1849 dnl check for the presence of the -dead_strip linker flag
1850 AC_MSG_CHECKING([for -dead_strip option to ld])
1851 _SAVE_LDFLAGS=$LDFLAGS
1852 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1853 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1854 if test -n "$_HAVE_DEAD_STRIP" ; then
1855 AC_MSG_RESULT([yes])
1856 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1861 LDFLAGS=$_SAVE_LDFLAGS
1864 dnl With newer linkers we need to pass -allow_heap_execute because of
1865 dnl Microsoft Silverlight (5.1.10411.0 at least).
1866 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1867 _SAVE_LDFLAGS=$LDFLAGS
1868 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1869 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1870 _HAVE_ALLOW_HEAP_EXECUTE=)
1871 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1872 AC_MSG_RESULT([yes])
1873 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1877 LDFLAGS=$_SAVE_LDFLAGS
1879 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1884 if test ! "$GNU_CC"; then
1888 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1889 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1890 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1893 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1894 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1897 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1898 AC_DEFINE(_LARGEFILE64_SOURCE)
1903 if test ! "$GNU_CC"; then
1904 DSO_LDOPTS='-b -Wl,+s'
1907 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1908 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1909 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1911 DSO_LDOPTS='-b -E +s'
1912 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1913 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1915 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1916 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1919 *-android*|*-linuxandroid*)
1920 AC_DEFINE(NO_PW_GECOS)
1922 if test -n "$gonkdir"; then
1923 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
1928 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
1931 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1933 MOZ_GFX_OPTIMIZE_MOBILE=1
1934 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
1938 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
1939 # Similarly for GNU_CXX and INTEL_CXX.
1940 if test "$INTEL_CC" -o "$INTEL_CXX"; then
1941 # -Os has been broken on Intel's C/C++ compilers for quite a
1942 # while; Intel recommends against using it.
1943 MOZ_OPTIMIZE_FLAGS="-O2"
1944 elif test "$GNU_CC" -o "$GNU_CXX"; then
1945 case $GCC_VERSION in
1947 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
1948 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1950 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
1951 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
1954 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1958 case "${target_cpu}" in
1960 CFLAGS="$CFLAGS -mieee"
1961 CXXFLAGS="$CXXFLAGS -mieee"
1968 if test -z "$MC"; then
1978 # certain versions of cygwin's makedepend barf on the
1979 # #include <string> vs -I./dist/include/string issue so don't use it
1980 XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)'
1981 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
1983 CXX="$CXX -mwindows"
1984 CPP="$CPP -mwindows"
1985 CFLAGS="$CFLAGS -mms-bitfields"
1986 CXXFLAGS="$CXXFLAGS -mms-bitfields"
1987 DSO_LDOPTS='-shared'
1988 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1989 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1991 # Use static libgcc and libstdc++
1992 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
1993 NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
1994 # Use temp file for windres (bug 213281)
1995 RCFLAGS='-O coff --use-temp-file'
1996 # mingw doesn't require kernel32, user32, and advapi32 explicitly
1997 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2000 IMPORT_LIB_SUFFIX=dll.a
2002 # We use mix of both POSIX and Win32 printf format across the tree, so format
2003 # warnings are useless on mingw.
2004 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2005 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2007 TARGET_COMPILER_ABI=msvc
2011 if test "$AS_BIN"; then
2012 AS="$(basename "$AS_BIN")"
2015 AR_FLAGS='-NOLOGO -OUT:"$@"'
2017 RANLIB='echo not_ranlib'
2018 STRIP='echo not_strip'
2029 IMPORT_LIB_SUFFIX=lib
2030 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2031 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2033 MKSHLIB_UNFORCE_ALL=
2034 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2035 _USE_CPP_INCLUDE_FLAG=1
2036 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2037 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2038 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2039 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2040 if test "$_CC_SUITE" -ge "12"; then
2041 dnl VS2013+ requires -FS when parallel building by make -jN.
2042 dnl If nothing, compiler sometimes causes C1041 error.
2043 CFLAGS="$CFLAGS -FS"
2044 CXXFLAGS="$CXXFLAGS -FS"
2046 # khuey says we can safely ignore MSVC warning C4251
2047 # MSVC warning C4244 (implicit type conversion may lose data) warns
2048 # and requires workarounds for perfectly valid code. Also, GCC/clang
2049 # don't warn about it by default. So for consistency/sanity, we turn
2050 # it off on MSVC, too.
2051 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2052 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2053 # MSVC warning C4482 warns when an enum value is refered specifing the
2054 # name of the enum itself. This behavior is allowed in C++11, and the
2055 # warning has been removed in VS2012.
2056 # MSVC warning C4800 warns when a value is implicitly cast to bool,
2057 # because this also forces narrowing to a single byte, which can be a
2058 # perf hit. But this matters so little in practice (and often we want
2059 # that behavior) that it's better to turn it off.
2060 # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2061 # on non-Western system locales even if it is in a comment.
2062 CFLAGS="$CFLAGS -wd4244 -wd4819"
2063 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2064 # make 'foo == bar;' error out
2065 CFLAGS="$CFLAGS -we4553"
2066 CXXFLAGS="$CXXFLAGS -we4553"
2067 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2068 MOZ_DEBUG_FLAGS='-Zi'
2069 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2070 WARNINGS_AS_ERRORS='-WX'
2071 MOZ_OPTIMIZE_FLAGS='-O1'
2073 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2074 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2075 if test -z "$DEVELOPER_OPTIONS"; then
2076 LDFLAGS="$LDFLAGS -RELEASE"
2078 dnl For profile-guided optimization
2079 PROFILE_GEN_CFLAGS="-GL"
2080 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2081 dnl XXX: PGO builds can fail with warnings treated as errors,
2082 dnl specifically "no profile data available" appears to be
2083 dnl treated as an error sometimes. This might be a consequence
2084 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2085 dnl with the linker doing most of the work in the whole-program
2086 dnl optimization/PGO case. I think it's probably a compiler bug,
2087 dnl but we work around it here.
2088 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2089 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2090 dnl Probably also a compiler bug, but what can you do?
2091 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2092 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2093 dnl Minimum reqiurement of Gecko is VS2010 or later which supports
2094 dnl both SSSE3 and SSE4.1.
2095 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2096 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
2098 AC_DEFINE(HAVE_SNPRINTF)
2103 AC_DEFINE(HW_THREADS)
2104 AC_DEFINE(STDC_HEADERS)
2105 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2106 TARGET_MD_ARCH=win32
2107 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2109 MOZ_USER_DIR="Mozilla"
2111 dnl Hardcode to win95 for now - cls
2112 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2114 dnl set NO_X11 defines here as the general check is skipped on win32
2120 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2121 if test -n "$L10NBASEDIR"; then
2122 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2129 if test -z "$MOZ_TOOLS"; then
2130 AC_MSG_ERROR([MOZ_TOOLS is not set])
2132 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2133 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2134 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2136 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2137 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2138 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2145 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.])
2151 if test "$HAVE_64BIT_OS"; then
2152 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2155 if test -n "$GNU_CC"; then
2156 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2157 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2158 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2160 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2161 LDFLAGS="$LDFLAGS -SAFESEH"
2167 if test -n "$_WIN32_MSVC"; then
2168 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2173 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2180 CFLAGS="$CFLAGS -Dunix"
2181 CXXFLAGS="$CXXFLAGS -Dunix"
2182 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2184 DSO_PIC_CFLAGS='-fPIC -DPIC'
2185 DSO_LDOPTS='-shared'
2186 BIN_FLAGS='-Wl,--export-dynamic'
2188 DSO_PIC_CFLAGS='-fPIC -DPIC'
2189 DLL_SUFFIX=".so.1.0"
2190 DSO_LDOPTS='-shared'
2192 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2193 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2194 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2195 if test "$LIBRUNPATH"; then
2196 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2198 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
2199 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@)) -o $@'
2203 if test "$SO_VERSION"; then
2204 DLL_SUFFIX=".so.$SO_VERSION"
2206 DLL_SUFFIX=".so.1.0"
2208 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2210 DSO_PIC_CFLAGS='-fPIC'
2211 DSO_LDOPTS='-shared -fPIC'
2212 if test "$LIBRUNPATH"; then
2213 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2218 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2219 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2222 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2223 AC_DEFINE(TCPV40HDRS)
2229 IMPORT_LIB_SUFFIX=lib
2233 CFLAGS="$CFLAGS -Zomf"
2234 CXXFLAGS="$CXXFLAGS -Zomf"
2236 BIN_FLAGS='-Zlinker /ST:0x100000'
2240 WARNINGS_AS_ERRORS='-Werror'
2241 MOZ_DEBUG_FLAGS="-g -fno-inline"
2242 MOZ_OPTIMIZE_FLAGS="-O2"
2243 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2244 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2246 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2250 MOZ_USER_DIR="Mozilla"
2253 STRIP_FLAGS="/yua /ydd /yxd /ynl /anp /b- /cs+ /d /i- /ml1 /mr2 /mf2 /r+ /u+ /x- /zs:0 /zx /zd"
2255 if test "$MOZTOOLS"; then
2256 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2258 AC_MSG_ERROR([MOZTOOLS is not set])
2260 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2261 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2262 LDFLAGS="$LDFLAGS -Zhigh-mem"
2263 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2264 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2267 # GCC for OS/2 currently predefines these, but we don't want them
2268 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2269 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2271 AC_CACHE_CHECK(for __declspec(dllexport),
2273 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2275 ac_os2_declspec="yes",
2276 ac_os2_declspec="no")])
2277 if test "$ac_os2_declspec" != "yes"; then
2278 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2284 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2286 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2287 # libraries one level up (e.g. libnspr4.so)
2288 if test "$SOLARIS_SUNPRO_CC"; then
2289 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2290 LIBS="-lCrun -lCstd -lc $LIBS"
2291 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2292 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2293 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2294 LDFLAGS="-xildoff $LDFLAGS"
2295 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2296 _SAVE_LDFLAGS=$LDFLAGS
2297 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2298 AC_TRY_LINK([#include <stdio.h>],
2299 [printf("Hello World\n");],
2301 [LDFLAGS=$_SAVE_LDFLAGS])
2303 MOZ_OPTIMIZE_FLAGS="-xO4"
2304 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2305 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2306 MKSHLIB_FORCE_ALL='-z allextract'
2307 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2314 AS='/usr/ccs/bin/as'
2315 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2317 TARGET_COMPILER_ABI="sunc"
2318 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2319 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2320 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2324 [#if (__SUNPRO_CC < 0x590)
2327 _BAD_COMPILER=,_BAD_COMPILER=1)
2328 if test -n "$_BAD_COMPILER"; then
2330 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2335 [#if (__SUNPRO_CC >= 0x5100)
2336 #error "Sun C++ 5.10 or above"
2338 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2339 if test "$_ABOVE_SS12U1"; then
2341 CXXFLAGS="$CXXFLAGS -xannotate=no"
2343 AC_MSG_RESULT([$_res])
2346 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2348 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2349 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2350 ASFLAGS="$ASFLAGS -fPIC"
2351 DSO_LDOPTS='-shared'
2352 WARNINGS_AS_ERRORS='-Werror'
2354 _WARNINGS_CXXFLAGS=''
2355 if test "$OS_RELEASE" = "5.3"; then
2356 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2359 if test "$OS_RELEASE" = "5.5.1"; then
2360 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2365 DSO_LDOPTS='-Bdynamic'
2366 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2367 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2369 AC_DEFINE(SPRINTF_RETURNS_STRING)
2370 case "$(target_os)" in
2372 DLL_SUFFIX='.so.1.0'
2378 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2385 # Includes linux-android
2390 AC_SUBST(MOZ_LINKER)
2391 if test -n "$MOZ_LINKER"; then
2392 AC_DEFINE(MOZ_LINKER)
2395 dnl Only one oddball right now (QNX), but this gives us flexibility
2396 dnl if any other platforms need to override this in the future.
2397 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2399 dnl ========================================================
2400 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2401 dnl by now will not have any way to link most binaries (tests
2402 dnl as well as viewer, apprunner, etc.), because some symbols
2403 dnl will be left out of the "composite" .so's by ld as unneeded.
2404 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2405 dnl they can link in the static libs that provide the missing
2407 dnl ========================================================
2408 NO_LD_ARCHIVE_FLAGS=
2409 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2410 NO_LD_ARCHIVE_FLAGS=1
2414 NO_LD_ARCHIVE_FLAGS=
2417 NO_LD_ARCHIVE_FLAGS=
2420 if test -z "$GNU_CC"; then
2421 NO_LD_ARCHIVE_FLAGS=
2425 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2427 dnl ========================================================
2428 dnl = Flags to strip unused symbols from .so components and
2429 dnl = to export jemalloc symbols when linking a program
2430 dnl ========================================================
2432 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2433 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2436 if test -z "$GNU_CC"; then
2437 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2439 if test -z "$GCC_USE_GNU_LD"; then
2440 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2442 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2447 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2450 if test -n "$GNU_CC"; then
2451 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2456 if test -z "$COMPILE_ENVIRONMENT"; then
2457 SKIP_COMPILER_CHECKS=1
2458 SKIP_LIBRARY_CHECKS=1
2462 if test -z "$SKIP_COMPILER_CHECKS"; then
2463 dnl Checks for typedefs, structures, and compiler characteristics.
2464 dnl ========================================================
2473 AC_MSG_CHECKING(for ssize_t)
2474 AC_CACHE_VAL(ac_cv_type_ssize_t,
2475 [AC_TRY_COMPILE([#include <stdio.h>
2476 #include <sys/types.h>],
2478 [ac_cv_type_ssize_t=true],
2479 [ac_cv_type_ssize_t=false])])
2480 if test "$ac_cv_type_ssize_t" = true ; then
2481 AC_DEFINE(HAVE_SSIZE_T)
2486 AC_STRUCT_ST_BLKSIZE
2487 AC_MSG_CHECKING(for siginfo_t)
2488 AC_CACHE_VAL(ac_cv_siginfo_t,
2489 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2490 #include <signal.h>],
2492 [ac_cv_siginfo_t=true],
2493 [ac_cv_siginfo_t=false])])
2494 if test "$ac_cv_siginfo_t" = true ; then
2495 AC_DEFINE(HAVE_SIGINFO_T)
2501 dnl Check for int64, uint, and uint_t.
2502 dnl ========================================================
2503 AC_MSG_CHECKING(for int64)
2504 AC_CACHE_VAL(ac_cv_int64,
2505 [AC_TRY_COMPILE([#include <stdio.h>
2506 #include <sys/types.h>],
2509 [ac_cv_int64=false])])
2510 if test "$ac_cv_int64" = true ; then
2511 AC_DEFINE(HAVE_INT64)
2516 AC_MSG_CHECKING(for uint)
2517 AC_CACHE_VAL(ac_cv_uint,
2518 [AC_TRY_COMPILE([#include <stdio.h>
2519 #include <sys/types.h>],
2522 [ac_cv_uint=false])])
2523 if test "$ac_cv_uint" = true ; then
2524 AC_DEFINE(HAVE_UINT)
2529 AC_MSG_CHECKING(for uint_t)
2530 AC_CACHE_VAL(ac_cv_uint_t,
2531 [AC_TRY_COMPILE([#include <stdio.h>
2532 #include <sys/types.h>],
2534 [ac_cv_uint_t=true],
2535 [ac_cv_uint_t=false])])
2536 if test "$ac_cv_uint_t" = true ; then
2537 AC_DEFINE(HAVE_UINT_T)
2543 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2544 dnl are defined when compiling C++ but not C. Since the result of this
2545 dnl test is used only in C++, do it in C++.
2548 AC_MSG_CHECKING(for uname.domainname)
2549 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2550 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2551 [ struct utsname *res; char *domain;
2552 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2553 [ac_cv_have_uname_domainname_field=true],
2554 [ac_cv_have_uname_domainname_field=false])])
2556 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2557 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2563 AC_MSG_CHECKING(for uname.__domainname)
2564 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2565 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2566 [ struct utsname *res; char *domain;
2567 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2568 [ac_cv_have_uname_us_domainname_field=true],
2569 [ac_cv_have_uname_us_domainname_field=false])])
2571 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2572 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2582 dnl Check for .hidden assembler directive and visibility attribute.
2583 dnl Borrowed from glibc configure.in
2584 dnl ===============================================================
2585 if test "$GNU_CC"; then
2586 AC_CACHE_CHECK(for visibility(hidden) attribute,
2587 ac_cv_visibility_hidden,
2588 [cat > conftest.c <<EOF
2589 int foo __attribute__ ((visibility ("hidden"))) = 1;
2591 ac_cv_visibility_hidden=no
2592 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2593 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2594 ac_cv_visibility_hidden=yes
2599 if test "$ac_cv_visibility_hidden" = "yes"; then
2600 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2602 AC_CACHE_CHECK(for visibility(default) attribute,
2603 ac_cv_visibility_default,
2604 [cat > conftest.c <<EOF
2605 int foo __attribute__ ((visibility ("default"))) = 1;
2607 ac_cv_visibility_default=no
2608 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2609 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2610 ac_cv_visibility_default=yes
2615 if test "$ac_cv_visibility_default" = "yes"; then
2616 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2618 AC_CACHE_CHECK(for visibility pragma support,
2619 ac_cv_visibility_pragma,
2620 [cat > conftest.c <<EOF
2621 #pragma GCC visibility push(hidden)
2623 #pragma GCC visibility push(default)
2624 int foo_default = 1;
2626 ac_cv_visibility_pragma=no
2627 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2628 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2629 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2630 ac_cv_visibility_pragma=yes
2636 if test "$ac_cv_visibility_pragma" = "yes"; then
2637 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2638 ac_cv_have_visibility_class_bug,
2639 [cat > conftest.c <<EOF
2640 #pragma GCC visibility push(hidden)
2641 struct __attribute__ ((visibility ("default"))) TestStruct {
2644 __attribute__ ((visibility ("default"))) void TestFunc() {
2648 ac_cv_have_visibility_class_bug=no
2649 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2650 ac_cv_have_visibility_class_bug=yes
2652 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2653 ac_cv_have_visibility_class_bug=yes
2656 rm -rf conftest.{c,S}
2659 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2660 ac_cv_have_visibility_builtin_bug,
2661 [cat > conftest.c <<EOF
2662 #pragma GCC visibility push(hidden)
2663 #pragma GCC visibility push(default)
2665 #pragma GCC visibility pop
2667 __attribute__ ((visibility ("default"))) void Func() {
2669 memset(c, 0, sizeof(c));
2672 ac_cv_have_visibility_builtin_bug=no
2673 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2674 ac_cv_have_visibility_builtin_bug=yes
2676 if test `grep -c "@PLT" conftest.S` = 0; then
2677 ac_cv_visibility_builtin_bug=yes
2680 rm -f conftest.{c,S}
2682 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2683 "$ac_cv_have_visibility_class_bug" = "no"; then
2684 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2685 WRAP_SYSTEM_INCLUDES=1
2686 STL_FLAGS='-I$(DIST)/stl_wrappers'
2689 VISIBILITY_FLAGS='-fvisibility=hidden'
2690 fi # have visibility pragma bug
2691 fi # have visibility pragma
2692 fi # have visibility(default) attribute
2693 fi # have visibility(hidden) attribute
2696 # visibility hidden flag for Sun Studio on Solaris
2697 if test "$SOLARIS_SUNPRO_CC"; then
2698 VISIBILITY_FLAGS='-xldscope=hidden'
2699 fi # Sun Studio on Solaris
2701 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2702 AC_SUBST(VISIBILITY_FLAGS)
2706 if test "$OS_TARGET" != WINNT; then
2707 # Only run this test with clang on non-Windows platforms, because clang
2708 # cannot do enough code gen for now to make this test work correctly.
2712 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2713 dnl ========================================================
2714 if test "$GNU_CC"; then
2715 CFLAGS_save="${CFLAGS}"
2716 CFLAGS="${CFLAGS} -Werror"
2717 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2718 ac_cv_force_align_arg_pointer,
2719 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2721 ac_cv_force_align_arg_pointer="yes",
2722 ac_cv_force_align_arg_pointer="no")])
2723 CFLAGS="${CFLAGS_save}"
2724 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2725 HAVE_GCC_ALIGN_ARG_POINTER=1
2727 HAVE_GCC_ALIGN_ARG_POINTER=
2730 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2732 dnl Checks for header files.
2733 dnl ========================================================
2735 case "$target_os" in
2737 # for stuff like -lXshm
2738 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2741 MOZ_CHECK_COMMON_HEADERS
2743 dnl These are all the places some variant of statfs can be hiding.
2744 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2747 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2748 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2750 dnl SCTP support - needs various network include headers
2751 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2753 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2755 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2756 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2757 ac_cv_sockaddr_in_sin_len,
2758 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2759 #include <sys/types.h>
2761 #include <netinet/in.h>
2762 struct sockaddr_in x;
2763 void *foo = (void*) &x.sin_len;],
2765 [ac_cv_sockaddr_in_sin_len=true],
2766 [ac_cv_sockaddr_in_sin_len=false])])
2767 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2768 AC_DEFINE(HAVE_SIN_LEN)
2769 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2770 AC_DEFINE(HAVE_SCONN_LEN)
2773 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2774 ac_cv_sockaddr_in6_sin6_len,
2775 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2776 #include <sys/types.h>
2778 #include <netinet/in.h>
2779 struct sockaddr_in6 x;
2780 void *foo = (void*) &x.sin6_len;],
2782 [ac_cv_sockaddr_in6_sin6_len=true],
2783 [ac_cv_sockaddr_in6_sin6_len=false])])
2784 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2785 AC_DEFINE(HAVE_SIN6_LEN)
2788 AC_CACHE_CHECK(for sockaddr.sa_len,
2789 ac_cv_sockaddr_sa_len,
2790 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2791 #include <sys/types.h>
2793 #include <sys/socket.h>
2795 void *foo = (void*) &x.sa_len;],
2797 [ac_cv_sockaddr_sa_len=true],
2798 [ac_cv_sockaddr_sa_len=false])])
2799 if test "$ac_cv_sockaddr_sa_len" = true ; then
2800 AC_DEFINE(HAVE_SA_LEN)
2803 AC_ARG_ENABLE(dtrace,
2804 [ --enable-dtrace build with dtrace support if available (default=no)],
2805 [enable_dtrace="yes"],)
2806 if test "x$enable_dtrace" = "xyes"; then
2807 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2808 if test -n "$HAVE_DTRACE"; then
2809 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2811 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2814 AC_SUBST(HAVE_DTRACE)
2820 MOZ_CHECK_HEADERS(sys/cdefs.h)
2824 MOZ_LINUX_PERF_EVENT
2826 dnl Checks for libraries.
2827 dnl ========================================================
2832 AC_CHECK_LIB(c_r, gethostbyname_r)
2836 dnl We don't want to link with libdl even if it's present on OS X, since
2837 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2839 dnl We don't want to link against libm or libpthread on Darwin since
2840 dnl they both are just symlinks to libSystem and explicitly linking
2841 dnl against libSystem causes issues when debugging (see bug 299601).
2848 AC_SEARCH_LIBS(dlopen, dl,
2849 MOZ_CHECK_HEADER(dlfcn.h,
2850 AC_DEFINE(HAVE_DLOPEN)))
2854 _SAVE_CFLAGS="$CFLAGS"
2855 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2856 AC_CHECK_FUNCS(dladdr memmem)
2857 CFLAGS="$_SAVE_CFLAGS"
2859 if test ! "$GNU_CXX"; then
2863 AC_CHECK_LIB(C_r, demangle)
2866 AC_CHECK_LIB(C, demangle)
2871 dnl OS/2 has socket in libc.
2876 AC_CHECK_LIB(socket, socket)
2880 XLIBS="$X_EXTRA_LIBS"
2882 dnl ========================================================
2883 dnl Checks for X libraries.
2884 dnl Ordering is important.
2885 dnl Xt is dependent upon SM as of X11R6
2886 dnl ========================================================
2887 if test "$no_x" = "yes"; then
2890 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2891 XLIBS="-lX11 $XLIBS"
2892 _SAVE_LDFLAGS="$LDFLAGS"
2893 LDFLAGS="$XLDFLAGS $LDFLAGS"
2894 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2895 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2896 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2897 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2899 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2900 unset ac_cv_lib_Xt_XtFree
2901 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2902 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
2903 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2904 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2907 # AIX needs the motif library linked before libXt to prevent
2908 # crashes in plugins linked against Motif - Bug #98892
2909 case "${target_os}" in
2911 XT_LIBS="-lXm $XT_LIBS"
2915 dnl ========================================================
2916 dnl = Check for XShm
2917 dnl ========================================================
2918 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
2921 dnl ========================================================
2923 dnl ========================================================
2924 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
2925 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
2926 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
2927 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
2929 LDFLAGS="$_SAVE_LDFLAGS"
2939 dnl ========================================================
2940 dnl = pthread support
2941 dnl = Start by checking whether the system support pthreads
2942 dnl ========================================================
2943 case "$target_os" in
2948 MOZ_CHECK_PTHREADS(pthreads,
2949 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2950 MOZ_CHECK_PTHREADS(pthread,
2951 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2952 MOZ_CHECK_PTHREADS(c_r,
2953 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2954 MOZ_CHECK_PTHREADS(c,
2963 dnl ========================================================
2964 dnl Check the command line for --with-pthreads
2965 dnl ========================================================
2966 MOZ_ARG_WITH_BOOL(pthreads,
2967 [ --with-pthreads Force use of system pthread library with NSPR ],
2968 [ if test "$MOZ_USE_PTHREADS"x = x; then
2969 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2975 dnl ========================================================
2976 dnl Do the platform specific pthread hackery
2977 dnl ========================================================
2978 if test "$MOZ_USE_PTHREADS"x != x
2981 dnl See if -pthread is supported.
2984 ac_cv_have_dash_pthread=no
2985 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2986 echo 'int main() { return 0; }' | cat > conftest.c
2987 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2988 if test $? -eq 0; then
2989 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2990 ac_cv_have_dash_pthread=yes
2991 case "$target_os" in
2993 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2996 CFLAGS="$CFLAGS -pthread"
2997 CXXFLAGS="$CXXFLAGS -pthread"
3003 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3006 dnl See if -pthreads is supported.
3008 ac_cv_have_dash_pthreads=no
3009 if test "$ac_cv_have_dash_pthread" = "no"; then
3010 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3011 echo 'int main() { return 0; }' | cat > conftest.c
3012 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3013 if test $? -eq 0; then
3014 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3015 ac_cv_have_dash_pthreads=yes
3016 CFLAGS="$CFLAGS -pthreads"
3017 CXXFLAGS="$CXXFLAGS -pthreads"
3021 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3026 AC_DEFINE(_REENTRANT)
3027 AC_DEFINE(_THREAD_SAFE)
3028 dnl -pthread links in -lpthread, so don't specify it explicitly.
3029 if test "$ac_cv_have_dash_pthread" = "yes"; then
3030 _PTHREAD_LDFLAGS="-pthread"
3034 *-*-openbsd*|*-*-bsdi*)
3035 AC_DEFINE(_REENTRANT)
3036 AC_DEFINE(_THREAD_SAFE)
3037 dnl -pthread links in -lc_r, so don't specify it explicitly.
3038 if test "$ac_cv_have_dash_pthread" = "yes"; then
3039 _PTHREAD_LDFLAGS="-pthread"
3043 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3044 AC_DEFINE(_REENTRANT)
3048 AC_DEFINE(_REENTRANT)
3052 AC_DEFINE(_REENTRANT)
3056 AC_DEFINE(_REENTRANT)
3057 if test "$SOLARIS_SUNPRO_CC"; then
3058 CFLAGS="$CFLAGS -mt"
3059 CXXFLAGS="$CXXFLAGS -mt"
3063 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3064 AC_SUBST(MOZ_USE_PTHREADS)
3068 dnl Checks for library functions.
3069 dnl ========================================================
3070 AC_PROG_GCC_TRADITIONAL
3072 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf memmove stat64 lstat64 truncate64 setbuf isatty)
3073 AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
3074 AC_CHECK_FUNCS(flockfile getpagesize)
3075 AC_CHECK_FUNCS(localtime_r strtok_r)
3077 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3078 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3079 ac_cv_clock_monotonic,
3080 [for libs in "" -lrt; do
3083 AC_TRY_LINK([#include <time.h>],
3084 [ struct timespec ts;
3085 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3086 ac_cv_clock_monotonic=$libs
3089 ac_cv_clock_monotonic=no)
3092 if test "$ac_cv_clock_monotonic" != "no"; then
3093 HAVE_CLOCK_MONOTONIC=1
3094 REALTIME_LIBS=$ac_cv_clock_monotonic
3095 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3096 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3097 AC_SUBST(REALTIME_LIBS)
3100 dnl check for wcrtomb/mbrtowc
3101 dnl =======================================================================
3102 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3105 AC_CACHE_CHECK(for wcrtomb,
3107 [AC_TRY_LINK([#include <wchar.h>],
3108 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3109 ac_cv_have_wcrtomb="yes",
3110 ac_cv_have_wcrtomb="no")])
3111 if test "$ac_cv_have_wcrtomb" = "yes"; then
3112 AC_DEFINE(HAVE_WCRTOMB)
3114 AC_CACHE_CHECK(for mbrtowc,
3116 [AC_TRY_LINK([#include <wchar.h>],
3117 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3118 ac_cv_have_mbrtowc="yes",
3119 ac_cv_have_mbrtowc="no")])
3120 if test "$ac_cv_have_mbrtowc" = "yes"; then
3121 AC_DEFINE(HAVE_MBRTOWC)
3128 ac_cv_func_res_ninit,
3131 #define _BSD_SOURCE 1
3135 [int foo = res_ninit(&_res);],
3136 [ac_cv_func_res_ninit=yes],
3137 [ac_cv_func_res_ninit=no])
3140 if test "$ac_cv_func_res_ninit" = "yes"; then
3141 AC_DEFINE(HAVE_RES_NINIT)
3142 dnl must add the link line we do something as foolish as this... dougt
3144 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3145 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3150 [for gnu_get_libc_version()],
3151 ac_cv_func_gnu_get_libc_version,
3153 #ifdef HAVE_GNU_LIBC_VERSION_H
3154 #include <gnu/libc-version.h>
3157 [const char *glibc_version = gnu_get_libc_version();],
3158 [ac_cv_func_gnu_get_libc_version=yes],
3159 [ac_cv_func_gnu_get_libc_version=no]
3163 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3164 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3168 darwin*|mingw*|os2*)
3172 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3173 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3174 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3176 LIBS="$LIBS $_ICONV_LIBS"
3185 iconv_t h = iconv_open("", "");
3186 iconv(h, NULL, NULL, NULL, NULL);
3189 [ac_cv_func_iconv=yes],
3190 [ac_cv_func_iconv=no]
3193 if test "$ac_cv_func_iconv" = "yes"; then
3194 AC_DEFINE(HAVE_ICONV)
3195 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3196 LIBICONV="$_ICONV_LIBS"
3198 [for iconv() with const input],
3199 ac_cv_func_const_iconv,
3205 const char *input = "testing";
3206 iconv_t h = iconv_open("", "");
3207 iconv(h, &input, NULL, NULL, NULL);
3210 [ac_cv_func_const_iconv=yes],
3211 [ac_cv_func_const_iconv=no]
3214 if test "$ac_cv_func_const_iconv" = "yes"; then
3215 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3227 dnl **********************
3228 dnl *** va_copy checks ***
3229 dnl **********************
3230 dnl we currently check for all three va_copy possibilities, so we get
3231 dnl all results in config.log for bug reports.
3232 AC_MSG_CHECKING(for an implementation of va_copy())
3233 AC_CACHE_VAL(ac_cv_va_copy,[
3236 void f (int i, ...) {
3237 va_list args1, args2;
3238 va_start (args1, i);
3239 va_copy (args2, args1);
3240 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3242 va_end (args1); va_end (args2);
3244 int main() { f (0, 42); return 0; }],
3250 AC_MSG_RESULT($ac_cv_va_copy)
3251 AC_MSG_CHECKING(for an implementation of __va_copy())
3252 AC_CACHE_VAL(ac_cv___va_copy,[
3255 void f (int i, ...) {
3256 va_list args1, args2;
3257 va_start (args1, i);
3258 __va_copy (args2, args1);
3259 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3261 va_end (args1); va_end (args2);
3263 int main() { f (0, 42); return 0; }],
3264 ac_cv___va_copy=yes,
3269 AC_MSG_RESULT($ac_cv___va_copy)
3270 AC_MSG_CHECKING(whether va_lists can be copied by value)
3271 AC_CACHE_VAL(ac_cv_va_val_copy,[
3274 void f (int i, ...) {
3275 va_list args1, args2;
3276 va_start (args1, i);
3278 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3280 va_end (args1); va_end (args2);
3282 int main() { f (0, 42); return 0; }],
3283 ac_cv_va_val_copy=yes,
3284 ac_cv_va_val_copy=no,
3285 ac_cv_va_val_copy=yes
3288 if test "x$ac_cv_va_copy" = "xyes"; then
3289 AC_DEFINE(VA_COPY, va_copy)
3290 AC_DEFINE(HAVE_VA_COPY)
3291 elif test "x$ac_cv___va_copy" = "xyes"; then
3292 AC_DEFINE(VA_COPY, __va_copy)
3293 AC_DEFINE(HAVE_VA_COPY)
3296 if test "x$ac_cv_va_val_copy" = "xno"; then
3297 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3299 AC_MSG_RESULT($ac_cv_va_val_copy)
3301 dnl ===================================================================
3302 dnl ========================================================
3303 dnl Put your C++ language/feature checks below
3304 dnl ========================================================
3308 if test "$GNU_CC"; then
3309 if test "$CPU_ARCH" = "arm" ; then
3310 AC_CACHE_CHECK(for ARM EABI,
3314 #if defined(__ARM_EABI__)
3317 #error Not ARM EABI.
3320 ac_cv_gcc_arm_eabi="yes",
3321 ac_cv_gcc_arm_eabi="no")])
3322 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3324 ARM_ABI_PREFIX=eabi-
3326 ARM_ABI_PREFIX=oabi-
3330 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3333 dnl Check to see if we can resolve ambiguity with |using|.
3334 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3335 ac_cv_cpp_ambiguity_resolving_using,
3336 [AC_TRY_COMPILE(class X {
3337 public: int go(const X&) {return 3;}
3338 int jo(const X&) {return 3;}
3340 class Y : public X {
3341 public: int go(int) {return 2;}
3342 int jo(int) {return 2;}
3344 private: using X::go;
3347 ac_cv_cpp_ambiguity_resolving_using=yes,
3348 ac_cv_cpp_ambiguity_resolving_using=no)])
3349 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3350 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3353 dnl See if a dynamic_cast to void* gives the most derived object.
3354 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3355 ac_cv_cpp_dynamic_cast_void_ptr,
3356 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3357 class Y { int j; public: virtual ~Y() { } };
3358 class Z : public X, public Y { int k; };
3364 return !((((void*)&mdo != (void*)subx) &&
3365 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3366 (((void*)&mdo != (void*)suby) &&
3367 ((void*)&mdo == dynamic_cast<void*>(suby))));
3369 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3370 ac_cv_cpp_dynamic_cast_void_ptr=no,
3371 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3372 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3373 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3377 dnl note that this one is reversed - if the test fails, then
3378 dnl we require implementations of unused virtual methods. Which
3379 dnl really blows because it means we'll have useless vtable
3381 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3382 ac_cv_cpp_unused_required,
3383 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3385 ac_cv_cpp_unused_required=no,
3386 ac_cv_cpp_unused_required=yes)])
3387 if test "$ac_cv_cpp_unused_required" = yes ; then
3388 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3392 dnl Some compilers have trouble comparing a constant reference to a templatized
3393 dnl class to zero, and require an explicit operator==() to be defined that takes
3394 dnl an int. This test separates the strong from the weak.
3396 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3397 ac_cv_trouble_comparing_to_zero,
3398 [AC_TRY_COMPILE([#include <algorithm>
3399 template <class T> class Foo {};
3401 template <class T> int operator==(const T2*, const T&) { return 0; }
3402 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3403 [Foo<int> f; return (0 != f);],
3404 ac_cv_trouble_comparing_to_zero=no,
3405 ac_cv_trouble_comparing_to_zero=yes)])
3406 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3407 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3410 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3411 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3412 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3414 _SAVE_LDFLAGS=$LDFLAGS
3415 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3416 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3417 ac_cv_thread_keyword,
3418 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3419 [return tlsIsMainThread;],
3420 ac_cv_thread_keyword=yes,
3421 ac_cv_thread_keyword=no)])
3422 LDFLAGS=$_SAVE_LDFLAGS
3423 # The custom dynamic linker doesn't support TLS variables
3425 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3426 # mips builds fail with TLS variables because of a binutils bug.
3428 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3433 *-android*|*-linuxandroid*)
3440 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3446 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3447 if test -n "$MOZ_LINKER"; then
3448 if test "$CPU_ARCH" = arm; then
3449 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3450 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3451 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3452 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3457 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3458 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3459 dnl We however want to avoid these text relocations, and this can be done
3460 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3461 dnl doesn't contain anything at all, beside placeholders for some sections,
3462 dnl and crtbegin only contains a finalizer function that calls
3463 dnl __cxa_finalize. The custom linker actually takes care of calling
3464 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3465 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3466 dnl link crtbegin and crtend at all.
3467 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3468 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3469 ac_cv_crt_has_text_relocations,
3470 [echo 'int foo() { return 0; }' > conftest.cpp
3471 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3472 test -s conftest${DLL_SUFFIX}; then
3473 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3474 ac_cv_crt_has_text_relocations=yes
3476 ac_cv_crt_has_text_relocations=no
3479 AC_ERROR([couldn't compile a simple C file])
3482 if test "$ac_cv_crt_has_text_relocations" = yes; then
3483 dnl While we want libraries to skip the CRT files, we don't want
3484 dnl executables to be treated the same way. We thus set the flag
3485 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3486 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3487 dnl Using LDFLAGS in nspr is safe, since we only really build
3488 dnl libraries there.
3489 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3490 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3494 dnl Check for the existence of various allocation headers/functions
3496 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3499 for file in $MALLOC_HEADERS; do
3500 MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3501 if test "$MALLOC_H" != ""; then
3502 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3507 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3508 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3510 AC_CHECK_FUNCS(malloc_usable_size)
3512 dnl See if compiler supports some gcc-style attributes
3514 AC_CACHE_CHECK(for __attribute__((always_inline)),
3515 ac_cv_attribute_always_inline,
3516 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3518 ac_cv_attribute_always_inline=yes,
3519 ac_cv_attribute_always_inline=no)])
3521 AC_CACHE_CHECK(for __attribute__((malloc)),
3522 ac_cv_attribute_malloc,
3523 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3525 ac_cv_attribute_malloc=yes,
3526 ac_cv_attribute_malloc=no)])
3528 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3529 ac_cv_attribute_warn_unused,
3530 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3532 ac_cv_attribute_warn_unused=yes,
3533 ac_cv_attribute_warn_unused=no)])
3535 dnl End of C++ language/feature checks
3538 dnl ========================================================
3539 dnl = Internationalization checks
3540 dnl ========================================================
3542 dnl Internationalization and Locale support is different
3543 dnl on various UNIX platforms. Checks for specific i18n
3544 dnl features go here.
3546 dnl check for LC_MESSAGES
3547 AC_CACHE_CHECK(for LC_MESSAGES,
3548 ac_cv_i18n_lc_messages,
3549 [AC_TRY_COMPILE([#include <locale.h>],
3550 [int category = LC_MESSAGES;],
3551 ac_cv_i18n_lc_messages=yes,
3552 ac_cv_i18n_lc_messages=no)])
3553 if test "$ac_cv_i18n_lc_messages" = yes; then
3554 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3557 AC_HAVE_FUNCS(localeconv)
3558 fi # ! SKIP_COMPILER_CHECKS
3561 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3562 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3565 dnl Mozilla specific options
3566 dnl ========================================================
3567 dnl The macros used for command line options
3568 dnl are defined in build/autoconf/altoptions.m4.
3570 dnl If the compiler supports these attributes, define them as
3571 dnl convenience macros.
3572 if test "$ac_cv_attribute_malloc" = yes ; then
3573 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3575 AC_DEFINE(NS_ATTR_MALLOC,)
3578 if test "$ac_cv_attribute_warn_unused" = yes ; then
3579 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3581 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3584 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3585 dnl features that Windows actually does support.
3587 if test -n "$SKIP_COMPILER_CHECKS"; then
3588 dnl Windows has malloc.h
3589 AC_DEFINE(MALLOC_H, [<malloc.h>])
3590 AC_DEFINE(HAVE_FORCEINLINE)
3591 AC_DEFINE(HAVE_LOCALECONV)
3592 fi # SKIP_COMPILER_CHECKS
3594 dnl ========================================================
3596 dnl = Check for external package dependencies
3598 dnl ========================================================
3599 MOZ_ARG_HEADER(External Packages)
3601 MOZ_ARG_WITH_STRING(libxul-sdk,
3602 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3603 LIBXUL_SDK_DIR=$withval)
3605 if test "$LIBXUL_SDK_DIR" = "yes"; then
3606 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3607 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3608 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3610 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3611 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3615 AC_SUBST(LIBXUL_SDK)
3617 if test -n "$LIBXUL_SDK"; then
3618 LIBXUL_DIST="$LIBXUL_SDK"
3620 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3622 AC_SUBST(LIBXUL_DIST)
3626 MOZ_ARG_WITH_BOOL(system-libxul,
3627 [ --with-system-libxul Use system installed libxul SDK],
3630 dnl ========================================================
3631 dnl = If NSPR was not detected in the system,
3632 dnl = use the one in the source tree (mozilla/nsprpub)
3633 dnl ========================================================
3634 MOZ_ARG_WITH_BOOL(system-nspr,
3635 [ --with-system-nspr Use system installed NSPR],
3636 _USE_SYSTEM_NSPR=1 )
3638 if test -n "$_USE_SYSTEM_NSPR"; then
3639 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])])
3642 if test -n "$MOZ_NATIVE_NSPR"; then
3643 _SAVE_CFLAGS=$CFLAGS
3644 CFLAGS="$CFLAGS $NSPR_CFLAGS"
3645 AC_TRY_COMPILE([#include "prtypes.h"],
3646 [#ifndef PR_STATIC_ASSERT
3647 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3649 [MOZ_NATIVE_NSPR=1],
3650 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3651 AC_TRY_COMPILE([#include "prtypes.h"],
3653 #error PR_UINT64 not defined or requires including prtypes.h
3655 [MOZ_NATIVE_NSPR=1],
3656 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3657 CFLAGS=$_SAVE_CFLAGS
3659 if test -z "$LIBXUL_SDK"; then
3660 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3661 if test -n "$GNU_CC"; then
3662 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3664 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3667 NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3668 NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3672 dnl set GRE_MILESTONE
3673 dnl ========================================================
3674 if test -n "$LIBXUL_SDK"; then
3675 GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3677 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3679 AC_SUBST(GRE_MILESTONE)
3681 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3682 # The logic works like this:
3683 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3684 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3685 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3686 case "$GRE_MILESTONE" in
3689 AC_DEFINE(NIGHTLY_BUILD)
3695 AC_DEFINE(RELEASE_BUILD)
3698 AC_SUBST(NIGHTLY_BUILD)
3699 AC_SUBST(RELEASE_BUILD)
3701 dnl system libevent Support
3702 dnl ========================================================
3703 MOZ_ARG_WITH_STRING(system-libevent,
3704 [ --with-system-libevent[=PFX]
3705 Use system libevent [installed at prefix PFX]],
3706 LIBEVENT_DIR=$withval)
3708 _SAVE_CFLAGS=$CFLAGS
3709 _SAVE_LDFLAGS=$LDFLAGS
3711 if test "$LIBEVENT_DIR" = yes; then
3712 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3713 MOZ_NATIVE_LIBEVENT=1,
3716 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3717 MOZ_NATIVE_LIBEVENT=
3718 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3719 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3720 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3721 MOZ_CHECK_HEADER(event.h,
3722 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3723 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3725 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3726 AC_CHECK_LIB(event, event_init,
3727 [MOZ_NATIVE_LIBEVENT=1
3728 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3729 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3730 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3732 CFLAGS=$_SAVE_CFLAGS
3733 LDFLAGS=$_SAVE_LDFLAGS
3736 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3737 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
3738 AC_SUBST(MOZ_LIBEVENT_LIBS)
3740 dnl ========================================================
3741 dnl = If NSS was not detected in the system,
3742 dnl = use the one in the source tree (mozilla/security/nss)
3743 dnl ========================================================
3745 MOZ_ARG_WITH_BOOL(system-nss,
3746 [ --with-system-nss Use system installed NSS],
3749 if test -n "$_USE_SYSTEM_NSS"; then
3750 AM_PATH_NSS(3.15, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3753 if test -n "$MOZ_NATIVE_NSS"; then
3754 NSS_LIBS="$NSS_LIBS -lcrmf"
3756 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3758 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
3760 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3761 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3762 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3763 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3764 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3766 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3770 dnl ======================
3772 dnl ======================
3774 AC_MSG_CHECKING([for YASM assembler])
3775 AC_CHECK_PROGS(YASM, yasm, "")
3777 if test -n "$YASM"; then
3778 dnl Pull out yasm's version string
3779 YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3780 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3781 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3782 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3783 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3786 if test -z "$SKIP_LIBRARY_CHECKS"; then
3787 dnl system JPEG support
3788 dnl ========================================================
3789 MOZ_ARG_WITH_STRING(system-jpeg,
3790 [ --with-system-jpeg[=PFX]
3791 Use system libjpeg [installed at prefix PFX]],
3794 _SAVE_CFLAGS=$CFLAGS
3795 _SAVE_LDFLAGS=$LDFLAGS
3797 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3798 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3799 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3801 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3804 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3807 if test "$MOZ_NATIVE_JPEG" = 1; then
3808 AC_TRY_COMPILE([ #include <stdio.h>
3809 #include <sys/types.h>
3810 #include <jpeglib.h> ],
3811 [ #if JPEG_LIB_VERSION < $MOZJPEG
3812 #error "Insufficient JPEG library version ($MOZJPEG required)."
3814 #ifndef JCS_EXTENSIONS
3815 #error "libjpeg-turbo JCS_EXTENSIONS required"
3819 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3821 CFLAGS=$_SAVE_CFLAGS
3822 LDFLAGS=$_SAVE_LDFLAGS
3825 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3826 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3827 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3829 fi # SKIP_LIBRARY_CHECKS
3831 dnl system ZLIB support
3832 dnl ========================================================
3833 MOZ_ZLIB_CHECK([1.2.3])
3835 if test "$MOZ_NATIVE_ZLIB" != 1; then
3837 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
3840 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
3841 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
3844 if test -z "$SKIP_LIBRARY_CHECKS"; then
3845 dnl system BZIP2 Support
3846 dnl ========================================================
3847 MOZ_ARG_WITH_STRING(system-bz2,
3848 [ --with-system-bz2[=PFX]
3849 Use system libbz2 [installed at prefix PFX]],
3852 _SAVE_CFLAGS=$CFLAGS
3853 _SAVE_LDFLAGS=$LDFLAGS
3855 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
3856 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
3857 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
3859 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
3862 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
3863 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
3865 CFLAGS=$_SAVE_CFLAGS
3866 LDFLAGS=$_SAVE_LDFLAGS
3869 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
3870 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
3871 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
3874 dnl system PNG Support
3875 dnl ========================================================
3876 MOZ_ARG_WITH_STRING(system-png,
3877 [ --with-system-png[=PFX]
3878 Use system libpng [installed at prefix PFX]],
3881 _SAVE_CFLAGS=$CFLAGS
3882 _SAVE_LDFLAGS=$LDFLAGS
3884 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
3885 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
3886 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
3888 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
3891 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
3892 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3893 AC_CHECK_LIB(png, png_get_acTL, ,
3894 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
3896 if test "$MOZ_NATIVE_PNG" = 1; then
3897 AC_TRY_COMPILE([ #include <stdio.h>
3898 #include <sys/types.h>
3900 [ #if PNG_LIBPNG_VER < $MOZPNG
3901 #error "Insufficient libpng version ($MOZPNG required)."
3903 #ifndef PNG_UINT_31_MAX
3904 #error "Insufficient libpng version."
3907 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3909 CFLAGS=$_SAVE_CFLAGS
3910 LDFLAGS=$_SAVE_LDFLAGS
3913 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
3914 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
3915 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
3919 if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
3922 AC_SUBST(MOZ_PNG_ARM_NEON)
3924 fi # SKIP_LIBRARY_CHECKS
3926 dnl system HunSpell Support
3927 dnl ========================================================
3928 MOZ_ARG_ENABLE_BOOL(system-hunspell,
3929 [ --enable-system-hunspell
3930 Use system hunspell (located with pkgconfig)],
3931 MOZ_NATIVE_HUNSPELL=1 )
3933 if test -n "$MOZ_NATIVE_HUNSPELL"; then
3934 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
3937 AC_SUBST(MOZ_NATIVE_HUNSPELL)
3939 dnl ========================================================
3940 dnl system libffi Support
3941 dnl ========================================================
3942 MOZ_ARG_ENABLE_BOOL(system-ffi,
3943 [ --enable-system-ffi Use system libffi (located with pkgconfig)],
3946 if test -n "$MOZ_NATIVE_FFI"; then
3947 # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
3948 # for non-GCC compilers.
3949 if test -z "$GNU_CC"; then
3950 PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
3952 PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
3954 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
3957 dnl ========================================================
3958 dnl System ICU Support
3959 dnl ========================================================
3961 MOZ_ARG_WITH_BOOL(system-icu,
3963 Use system ICU (located with pkgconfig)],
3966 if test -n "$MOZ_NATIVE_ICU"; then
3967 PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1)
3968 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_ICU_LIBS"
3971 AC_SUBST(MOZ_NATIVE_ICU)
3973 dnl ========================================================
3974 dnl Java SDK support
3975 dnl ========================================================
3978 MOZ_ARG_WITH_STRING(java-bin-path,
3979 [ --with-java-bin-path=dir
3980 Location of Java binaries (java, javac, jar)],
3981 JAVA_BIN_PATH=$withval)
3983 dnl ========================================================
3987 dnl ========================================================
3989 MOZ_ARG_HEADER(Application)
3992 ENABLE_SYSTEM_EXTENSION_DIRS=1
3993 MOZ_BRANDING_DIRECTORY=
3994 MOZ_OFFICIAL_BRANDING=
3998 MOZ_AUTH_EXTENSION=1
4001 MOZ_SPEEX_RESAMPLER=1
4007 MOZ_SAMPLE_TYPE_FLOAT32=
4008 MOZ_SAMPLE_TYPE_S16=
4017 MOZ_WEBRTC_SIGNALING=
4018 MOZ_WEBRTC_IN_LIBXUL=
4019 MOZ_WEBRTC_ASSERT_ALWAYS=1
4022 MOZ_MEDIA_NAVIGATOR=
4025 MOZ_VP8_ERROR_CONCEALMENT=
4036 LIBJPEG_TURBO_ASFLAGS=
4037 LIBJPEG_TURBO_X86_ASM=
4038 LIBJPEG_TURBO_X64_ASM=
4039 LIBJPEG_TURBO_ARM_ASM=
4044 MOZ_PREF_EXTENSIONS=1
4045 MOZ_PROFILELOCKING=1
4051 MOZ_TOOLKIT_SEARCH=1
4053 MOZ_UNIVERSALCHARDET=1
4059 MOZ_DISABLE_CRYPTOLEGACY=
4062 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4065 MOZ_USE_NATIVE_POPUP_WINDOWS=
4066 MOZ_ANDROID_HISTORY=
4072 MOZ_AUDIO_CHANNEL_MANAGER=
4074 MOZ_CONTENT_SANDBOX=
4075 MOZ_CONTENT_SANDBOX_REPORTER=
4077 case "$target_os" in
4080 AC_DEFINE(NS_ENABLE_TSF)
4085 *-android*|*-linuxandroid*)
4086 if test "$CPU_ARCH" = "arm" ; then
4091 MOZ_THEME_FASTSTRIPE=1
4099 MOZ_ARG_WITH_STRING(external-source-dir,
4100 [ --with-external-source-dir=dir
4101 External directory containing additional build files.],
4102 [ EXTERNAL_SOURCE_DIR=$withval])
4103 AC_SUBST(EXTERNAL_SOURCE_DIR)
4105 MOZ_ARG_ENABLE_STRING(application,
4106 [ --enable-application=APP
4110 tools/update-packaging (AUS-related packaging tools)],
4111 [ MOZ_BUILD_APP=$enableval ] )
4113 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4114 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4115 XULRUNNER_STUB_NAME=$withval)
4117 if test -z "$XULRUNNER_STUB_NAME"; then
4118 case "$target_os" in
4120 XULRUNNER_STUB_NAME=xulrunner
4123 XULRUNNER_STUB_NAME=xulrunner-stub
4126 AC_SUBST(XULRUNNER_STUB_NAME)
4128 AC_MSG_CHECKING([for application to build])
4129 if test -z "$MOZ_BUILD_APP"; then
4130 AC_MSG_RESULT([browser])
4131 MOZ_BUILD_APP=browser
4133 # "mobile" no longer exists.
4134 if test "$MOZ_BUILD_APP" = "mobile" ; then
4135 AC_MSG_RESULT([none])
4136 AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
4138 # We have a valid application only if it has a build.mk file in its top
4140 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4141 AC_MSG_RESULT([none])
4142 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4144 AC_MSG_RESULT([$MOZ_BUILD_APP])
4148 # The app update channel is 'default' when not supplied. The value is used in
4149 # the application's confvars.sh so it must be set before confvars.sh is called.
4150 MOZ_ARG_ENABLE_STRING([update-channel],
4151 [ --enable-update-channel=CHANNEL
4152 Select application update channel (default=default)],
4153 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4155 if test -z "$MOZ_UPDATE_CHANNEL"; then
4156 MOZ_UPDATE_CHANNEL=default
4158 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4159 AC_SUBST(MOZ_UPDATE_CHANNEL)
4161 # Allow to specify a Google API key file that contains the secret key to be
4162 # used for various Google API requests.
4163 MOZ_ARG_WITH_STRING(google-api-keyfile,
4164 [ --with-google-api-keyfile=file Use the secret key contained in the given keyfile for Google API requests],
4165 MOZ_GOOGLE_API_KEY=`cat $withval`)
4166 if test -z "$MOZ_GOOGLE_API_KEY"; then
4167 MOZ_GOOGLE_API_KEY=no-google-api-key
4169 AC_SUBST(MOZ_GOOGLE_API_KEY)
4171 # Allow the application to influence configure with a confvars.sh script.
4172 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4173 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4174 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4175 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4180 # Allow influencing configure with a defines.sh script.
4181 . "${srcdir}/build/defines.sh"
4183 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
4185 if test "$BUILDING_RELEASE"; then
4186 # Override value in defines.sh, if any
4187 EARLY_BETA_OR_EARLIER=
4188 elif test "$EARLY_BETA_OR_EARLIER"; then
4189 AC_DEFINE(EARLY_BETA_OR_EARLIER)
4191 AC_SUBST(EARLY_BETA_OR_EARLIER)
4193 # Allow the application to provide a subconfigure script
4194 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4195 do_output_subdirs() {
4196 if test -n "$_subconfigure_subdirs"; then
4197 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4199 _subconfigure_subdir="$1"
4200 _subconfigure_config_args="$ac_configure_args"
4202 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4203 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4204 "${srcdir}/build/autoconf/altoptions.m4" \
4205 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4210 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4211 MOZ_ARG_WITH_STRING(app-name,
4212 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4213 WITH_APP_NAME=$withval,
4216 if test -n "$WITH_APP_NAME" ; then
4217 MOZ_APP_NAME="$WITH_APP_NAME"
4220 MOZ_ARG_WITH_STRING(app-basename,
4221 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4222 WITH_APP_BASENAME=$withval,
4225 if test -n "$WITH_APP_BASENAME" ; then
4226 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4229 # Now is a good time to test for logic errors, define mismatches, etc.
4230 case "$MOZ_BUILD_APP" in
4232 if test "$LIBXUL_SDK"; then
4233 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4238 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4239 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4241 case "$MOZ_BUILD_APP" in
4243 AC_DEFINE(MOZ_PHOENIX)
4247 AC_DEFINE(MOZ_XULRUNNER)
4254 AC_SUBST(MOZ_BUILD_APP)
4255 AC_SUBST(MOZ_PHOENIX)
4256 AC_SUBST(MOZ_XULRUNNER)
4259 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4261 dnl ========================================================
4262 dnl Check android sdk version depending on mobile target
4263 dnl ========================================================
4265 if test -z "$gonkdir" ; then
4266 # Minimum Android SDK API Level we require.
4267 case "$MOZ_BUILD_APP" in
4269 android_min_api_level=16
4271 *-android*|*-linuxandroid*)
4275 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])
4281 MOZ_ANDROID_SDK($android_min_api_level)
4284 dnl ========================================================
4286 dnl = Toolkit Options
4288 dnl ========================================================
4289 MOZ_ARG_HEADER(Toolkit Options)
4291 dnl ========================================================
4292 dnl = Select the default toolkit
4293 dnl ========================================================
4294 MOZ_ARG_ENABLE_STRING(default-toolkit,
4295 [ --enable-default-toolkit=TK
4296 Select default toolkit
4297 Platform specific defaults:
4298 Mac OS X - cairo-cocoa
4300 Win32 - cairo-windows
4304 [ _DEFAULT_TOOLKIT=$enableval ],
4305 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4307 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4308 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4309 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4310 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4311 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4312 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4313 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4314 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4315 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4316 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4318 dnl nglayout only supports building with one toolkit,
4319 dnl so ignore everything after the first comma (",").
4320 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4322 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4325 MOZ_ARG_WITHOUT_BOOL(x,
4326 [ --without-x Build without X11],
4329 dnl ========================================================
4330 dnl = Enable the toolkit as needed =
4331 dnl ========================================================
4335 case "$MOZ_WIDGET_TOOLKIT" in
4338 MOZ_WIDGET_TOOLKIT=windows
4341 MOZ_INSTRUMENT_EVENT_LOOP=1
4342 if test -n "$GNU_CC"; then
4348 MOZ_WIDGET_TOOLKIT=gtk3
4351 MOZ_ENABLE_XREMOTE=1
4353 MOZ_GL_DEFAULT_PROVIDER=GLX
4359 TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4360 TK_LIBS='$(MOZ_GTK3_LIBS)'
4362 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4364 MOZ_INSTRUMENT_EVENT_LOOP=1
4367 cairo-gtk2|cairo-gtk2-x11)
4368 MOZ_WIDGET_TOOLKIT=gtk2
4371 MOZ_ENABLE_XREMOTE=1
4373 MOZ_GL_DEFAULT_PROVIDER=GLX
4379 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4380 TK_LIBS='$(MOZ_GTK2_LIBS)'
4381 AC_DEFINE(MOZ_WIDGET_GTK2)
4383 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4385 MOZ_INSTRUMENT_EVENT_LOOP=1
4389 MOZ_WIDGET_TOOLKIT=qt
4391 if test -z "$WITHOUT_X11"; then
4392 MOZ_ENABLE_XREMOTE=1
4393 MOZ_GL_DEFAULT_PROVIDER=GLX
4402 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4403 TK_LIBS='$(MOZ_QT_LIBS)'
4404 AC_DEFINE(MOZ_WIDGET_QT)
4406 AC_DEFINE(QT_NO_KEYWORDS)
4410 MOZ_WIDGET_TOOLKIT=os2
4412 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4413 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4418 MOZ_WIDGET_TOOLKIT=cocoa
4419 AC_DEFINE(MOZ_WIDGET_COCOA)
4420 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4421 TK_LIBS='-framework CoreLocation -framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4422 TK_CFLAGS="-DNO_X11"
4423 CFLAGS="$CFLAGS $TK_CFLAGS"
4424 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4425 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)'
4426 MOZ_USER_DIR="Mozilla"
4427 MOZ_FS_LAYOUT=bundle
4429 MOZ_INSTRUMENT_EVENT_LOOP=1
4433 MOZ_WIDGET_TOOLKIT=uikit
4434 AC_DEFINE(MOZ_WIDGET_UIKIT)
4435 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4436 TK_CFLAGS="-DNO_X11"
4437 TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4438 CFLAGS="$CFLAGS $TK_CFLAGS"
4439 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4440 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)'
4441 MOZ_USER_DIR="Mozilla"
4442 MOZ_FS_LAYOUT=bundle
4446 AC_DEFINE(MOZ_WIDGET_ANDROID)
4447 MOZ_WIDGET_TOOLKIT=android
4448 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4449 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4452 MOZ_INSTRUMENT_EVENT_LOOP=1
4456 XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)'
4457 AC_DEFINE(MOZ_WIDGET_GONK)
4458 AC_DEFINE(MOZ_TOUCH)
4459 MOZ_WIDGET_TOOLKIT=gonk
4460 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4461 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4469 AC_SUBST(MOZ_PDF_PRINTING)
4470 if test "$MOZ_PDF_PRINTING"; then
4471 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4472 AC_DEFINE(MOZ_PDF_PRINTING)
4475 if test "$MOZ_ENABLE_XREMOTE"; then
4476 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4479 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4480 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4483 if test "$COMPILE_ENVIRONMENT"; then
4484 if test "$MOZ_ENABLE_GTK3"; then
4485 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4487 if test "$MOZ_ENABLE_GTK2"; then
4488 if test "$MOZ_X11"; then
4489 GDK_PACKAGES=gdk-x11-2.0
4492 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4495 fi # COMPILE_ENVIRONMENT
4497 AC_SUBST(MOZ_FS_LAYOUT)
4499 dnl ========================================================
4500 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4501 dnl their usage and use them in spidermonkey.
4502 dnl ========================================================
4503 MOZ_ARG_WITH_BOOL(arm-kuser,
4504 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4506 if test -n "$USE_ARM_KUSER"; then
4507 AC_DEFINE(USE_ARM_KUSER)
4510 dnl ========================================================
4511 dnl = startup-notification support module
4512 dnl ========================================================
4514 if test "$MOZ_ENABLE_GTK"
4516 MOZ_ENABLE_STARTUP_NOTIFICATION=
4518 MOZ_ARG_ENABLE_BOOL(startup-notification,
4519 [ --enable-startup-notification
4520 Enable startup-notification support (default: disabled) ],
4521 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4522 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4523 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4525 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4526 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4527 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4528 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4530 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4532 MOZ_ENABLE_STARTUP_NOTIFICATION=
4536 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4537 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4540 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4542 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4543 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4544 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4546 dnl ========================================================
4548 dnl ========================================================
4549 if test "$MOZ_ENABLE_QT"
4551 MOZ_ARG_WITH_STRING(qtdir,
4552 [ --with-qtdir=\$dir Specify Qt directory ],
4555 if test -z "$QTDIR"; then
4556 AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4558 HOST_QMAKE="$QTDIR/bin/qmake"
4560 QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4562 if test -z "$QTDIR"; then
4565 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4566 PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5OpenGL Qt5Widgets Qt5PrintSupport, ,
4568 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4570 QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4571 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4574 AC_MSG_RESULT("Using qt4: $QT_VERSION")
4575 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL, ,
4577 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qt4 development package, (On Ubuntu, you might try installing the packages libqt4-dev libqt4-opengl-dev.)])
4581 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4585 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4586 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4588 MOZ_QT_CFLAGS="-DQT_SHARED"
4589 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4590 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4591 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4592 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4593 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4594 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4598 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4599 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml -lQt5OpenGL"
4600 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4601 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4602 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4603 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4606 AC_MSG_RESULT("Using qt4: $QT_VERSION")
4607 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4608 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4611 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4615 HOST_MOC="$QTDIR/bin/moc"
4616 HOST_RCC="$QTDIR/bin/rcc"
4618 if test -z "$HOST_MOC"; then
4619 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4622 if test -z "$HOST_RCC"; then
4623 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4630 MOZ_ENABLE_QMSYSTEM2=
4631 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4632 MOZ_ENABLE_QMSYSTEM2=1,
4633 MOZ_ENABLE_QMSYSTEM2=)
4635 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4636 MOZ_ENABLE_QMSYSTEM2=1
4637 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4638 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4639 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4642 MOZ_ENABLE_QTNETWORK=
4643 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4644 MOZ_ENABLE_QTNETWORK=1,
4645 MOZ_ENABLE_QTNETWORK=)
4647 if test "$MOZ_ENABLE_QTNETWORK"; then
4648 MOZ_ENABLE_QTNETWORK=1
4649 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4652 MOZ_ENABLE_QTMOBILITY=
4653 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4654 MOZ_ENABLE_QTMOBILITY=1,
4655 MOZ_ENABLE_QTMOBILITY=)
4656 if test "$MOZ_ENABLE_QTMOBILITY"; then
4657 MOZ_ENABLE_QTMOBILITY=1
4658 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4659 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4660 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4661 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4663 AC_CHECK_LIB(QtSensors, main, [
4664 MOZ_ENABLE_QTMOBILITY=1
4665 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4666 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4667 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4668 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4669 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4673 if test "$MOZ_ENABLE_CONTENTACTION"; then
4674 MOZ_ENABLE_CONTENTACTION=1
4675 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4678 MOZ_ENABLE_CONTENTACTION=
4679 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
4680 if test "$MOZ_ENABLE_CONTENTACTION"; then
4681 MOZ_ENABLE_CONTENTACTION=1
4682 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
4683 MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
4684 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4685 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
4689 AC_SUBST(GTK_CONFIG)
4693 AC_SUBST(MOZ_ENABLE_GTK2)
4694 AC_SUBST(MOZ_ENABLE_GTK3)
4695 AC_SUBST(MOZ_ENABLE_GTK)
4696 AC_SUBST(MOZ_ENABLE_QT)
4697 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4698 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4699 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4700 AC_SUBST(MOZ_ENABLE_XREMOTE)
4701 AC_SUBST(MOZ_GTK2_CFLAGS)
4702 AC_SUBST(MOZ_GTK2_LIBS)
4703 AC_SUBST(MOZ_GTK3_CFLAGS)
4704 AC_SUBST(MOZ_GTK3_LIBS)
4705 AC_SUBST(MOZ_WIDGET_GTK)
4706 AC_SUBST(MOZ_QT_CFLAGS)
4707 AC_SUBST(MOZ_QT_LIBS)
4714 dnl ========================================================
4716 dnl = Components & Features
4718 dnl ========================================================
4719 MOZ_ARG_HEADER(Components and Features)
4721 dnl ========================================================
4723 dnl ========================================================
4724 MOZ_ARG_ENABLE_STRING(ui-locale,
4725 [ --enable-ui-locale=ab-CD
4726 Select the user interface locale (default: en-US)],
4727 MOZ_UI_LOCALE=$enableval )
4728 AC_SUBST(MOZ_UI_LOCALE)
4730 dnl ========================================================
4731 dnl = Trademarked Branding
4732 dnl ========================================================
4733 MOZ_ARG_ENABLE_BOOL(official-branding,
4734 [ --enable-official-branding
4735 Enable Official mozilla.org Branding
4736 Do not distribute builds with
4737 --enable-official-branding unless you have
4738 permission to use trademarks per
4739 http://www.mozilla.org/foundation/trademarks/ .],
4741 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4742 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4744 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4745 MOZ_OFFICIAL_BRANDING=1
4747 ], MOZ_OFFICIAL_BRANDING=)
4749 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4750 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4751 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4754 MOZ_ARG_WITH_STRING(branding,
4755 [ --with-branding=dir Use branding from the specified directory.],
4756 MOZ_BRANDING_DIRECTORY=$withval)
4758 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4759 if test -z "$REAL_BRANDING_DIRECTORY"; then
4760 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4763 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4764 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4767 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4769 dnl ========================================================
4770 dnl = Distribution ID
4771 dnl ========================================================
4772 MOZ_ARG_WITH_STRING(distribution-id,
4773 [ --with-distribution-id=ID
4774 Set distribution-specific id (default=org.mozilla)],
4775 [ val=`echo $withval`
4776 MOZ_DISTRIBUTION_ID="$val"])
4778 if test -z "$MOZ_DISTRIBUTION_ID"; then
4779 MOZ_DISTRIBUTION_ID="org.mozilla"
4782 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4783 AC_SUBST(MOZ_DISTRIBUTION_ID)
4786 dnl ========================================================
4787 dnl complex text support off by default
4788 dnl ========================================================
4789 MOZ_ARG_DISABLE_BOOL(pango,
4790 [ --disable-pango Disable usage of Pango ],
4794 dnl ========================================================
4796 dnl ========================================================
4797 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4801 if test "$MOZ_PANGO"
4803 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4805 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4806 AC_SUBST(MOZ_PANGO_CFLAGS)
4807 AC_SUBST(MOZ_PANGO_LIBS)
4808 AC_DEFINE(MOZ_PANGO)
4810 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
4811 AC_SUBST(FT2_CFLAGS)
4816 dnl ========================================================
4817 dnl = GnomeVFS, GIO and GConf support module
4818 dnl ========================================================
4822 dnl build the GIO extension by default only when the
4823 dnl GTK2 toolkit is in use.
4824 if test "$MOZ_ENABLE_GTK"
4830 dnl ========================================================
4831 dnl = GnomeVFS support module
4832 dnl ========================================================
4833 MOZ_ARG_ENABLE_BOOL(gnomevfs,
4834 [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
4835 MOZ_ENABLE_GNOMEVFS=force,
4836 MOZ_ENABLE_GNOMEVFS=)
4838 if test "$MOZ_ENABLE_GNOMEVFS"
4840 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4841 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4842 MOZ_ENABLE_GNOMEVFS=1
4843 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4845 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4847 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4849 MOZ_ENABLE_GNOMEVFS=
4853 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4854 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4855 AC_SUBST(MOZ_GNOMEVFS_LIBS)
4857 dnl ========================================================
4858 dnl = GIO support module
4859 dnl ========================================================
4860 MOZ_ARG_DISABLE_BOOL(gio,
4861 [ --disable-gio Disable GIO support],
4863 MOZ_ENABLE_GIO=force)
4865 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
4867 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4868 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4869 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4870 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4872 AC_DEFINE(MOZ_ENABLE_GIO)
4874 if test "$MOZ_ENABLE_GIO" = "force"
4876 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4882 AC_SUBST(MOZ_ENABLE_GIO)
4883 AC_SUBST(MOZ_GIO_CFLAGS)
4884 AC_SUBST(MOZ_GIO_LIBS)
4886 dnl ========================================================
4887 dnl = GConf support module
4888 dnl ========================================================
4889 MOZ_ARG_DISABLE_BOOL(gconf,
4890 [ --disable-gconf Disable Gconf support ],
4892 MOZ_ENABLE_GCONF=force)
4894 if test "$MOZ_ENABLE_GCONF"
4896 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4897 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4900 if test "$MOZ_ENABLE_GCONF" = "force"
4902 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4908 if test "$MOZ_ENABLE_GCONF"; then
4909 AC_DEFINE(MOZ_ENABLE_GCONF)
4912 AC_SUBST(MOZ_ENABLE_GCONF)
4913 AC_SUBST(MOZ_GCONF_CFLAGS)
4914 AC_SUBST(MOZ_GCONF_LIBS)
4917 dnl ========================================================
4918 dnl = libproxy support
4919 dnl ========================================================
4921 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4923 MOZ_ENABLE_LIBPROXY=
4925 MOZ_ARG_ENABLE_BOOL(libproxy,
4926 [ --enable-libproxy Enable libproxy support ],
4927 MOZ_ENABLE_LIBPROXY=1,
4928 MOZ_ENABLE_LIBPROXY=)
4930 if test "$MOZ_ENABLE_LIBPROXY"
4932 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4933 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4936 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4937 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
4938 AC_SUBST(MOZ_LIBPROXY_LIBS)
4940 dnl ========================================================
4941 dnl = GNOME component (mozgnome)
4942 dnl ========================================================
4944 if test "$MOZ_ENABLE_GTK2"
4946 MOZ_ENABLE_GNOME_COMPONENT=1
4948 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4950 dnl ========================================================
4951 dnl = libgnomeui support module
4952 dnl ========================================================
4954 if test "$MOZ_ENABLE_GTK"
4956 MOZ_ARG_ENABLE_BOOL(gnomeui,
4957 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
4958 MOZ_ENABLE_GNOMEUI=force,
4959 MOZ_ENABLE_GNOMEUI=)
4961 if test "$MOZ_ENABLE_GNOMEUI"
4963 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4965 MOZ_ENABLE_GNOMEUI=1
4967 if test "$MOZ_ENABLE_GNOMEUI" = "force"
4969 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4975 if test "$MOZ_ENABLE_GNOMEUI"; then
4976 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4980 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4981 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
4983 dnl ========================================================
4985 dnl ========================================================
4987 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4991 MOZ_ARG_DISABLE_BOOL(dbus,
4992 [ --disable-dbus Disable dbus support ],
4996 if test "$MOZ_ENABLE_DBUS"
4998 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
4999 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5000 AC_DEFINE(MOZ_ENABLE_DBUS)
5003 AC_SUBST(MOZ_ENABLE_DBUS)
5004 AC_SUBST(MOZ_DBUS_CFLAGS)
5005 AC_SUBST(MOZ_DBUS_LIBS)
5006 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5007 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5009 dnl ========================================================
5010 dnl = Enable Android History instead of Places
5011 dnl ========================================================
5012 if test -n "$MOZ_ANDROID_HISTORY"; then
5013 if test -z "$MOZ_PLACES"; then
5014 AC_DEFINE(MOZ_ANDROID_HISTORY)
5016 AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
5020 dnl ========================================================
5021 dnl = Build with the Android compositor
5022 dnl ========================================================
5023 if test -n "$MOZ_ANDROID_OMTC"; then
5024 dnl Do this if defined in confvars.sh
5025 AC_DEFINE(MOZ_ANDROID_OMTC)
5028 dnl ========================================================
5029 dnl = Disable WebSMS backend
5030 dnl ========================================================
5031 MOZ_ARG_DISABLE_BOOL(websms-backend,
5032 [ --disable-websms-backend
5033 Disable WebSMS backend],
5034 MOZ_WEBSMS_BACKEND=,
5035 MOZ_WEBSMS_BACKEND=1)
5037 if test -n "$MOZ_WEBSMS_BACKEND"; then
5038 AC_DEFINE(MOZ_WEBSMS_BACKEND)
5041 dnl ========================================================
5042 dnl = Enable NFC permission on Android
5043 dnl ========================================================
5044 if test -n "$MOZ_ANDROID_BEAM"; then
5045 AC_DEFINE(MOZ_ANDROID_BEAM)
5048 dnl ========================================================
5049 dnl = JS Debugger XPCOM component (js/jsd)
5050 dnl ========================================================
5051 MOZ_ARG_DISABLE_BOOL(jsd,
5052 [ --disable-jsd Disable JavaScript debug library],
5057 dnl ========================================================
5058 dnl = Enable IPDL's "expensive" unit tests
5059 dnl ========================================================
5062 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5063 [ --enable-ipdl-tests Enable expensive IPDL tests],
5067 if test -n "$MOZ_IPDL_TESTS"; then
5068 AC_DEFINE(MOZ_IPDL_TESTS)
5071 AC_SUBST(MOZ_IPDL_TESTS)
5073 dnl ========================================================
5074 dnl = Disable building dbm
5075 dnl ========================================================
5076 MOZ_ARG_DISABLE_BOOL(dbm,
5077 [ --disable-dbm Disable building dbm],
5081 dnl bi-directional support always on
5085 dnl ========================================================
5086 dnl accessibility support on by default on all platforms
5087 dnl ========================================================
5088 MOZ_ARG_DISABLE_BOOL(accessibility,
5089 [ --disable-accessibility Disable accessibility support],
5092 if test "$ACCESSIBILITY"; then
5095 if test -z "$MIDL"; then
5096 if test "$GCC" != "yes"; then
5097 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5099 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.])
5103 AC_DEFINE(ACCESSIBILITY)
5106 dnl ========================================================
5107 dnl Accessibility is required for the linuxgl widget
5109 dnl ========================================================
5110 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5111 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5114 dnl ========================================================
5115 dnl Disable printing
5116 dnl ========================================================
5117 MOZ_ARG_DISABLE_BOOL(printing,
5118 [ --disable-printing Disable printing support],
5122 if test "$NS_PRINTING"; then
5123 AC_DEFINE(NS_PRINTING)
5124 AC_DEFINE(NS_PRINT_PREVIEW)
5127 dnl Turn off webrtc for OS's we don't handle yet, but allow
5128 dnl --enable-webrtc to override. Can disable for everything in
5129 dnl the master list above.
5130 if test -n "$MOZ_WEBRTC"; then
5132 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
5136 dnl default to disabled for all others
5142 AC_TRY_COMPILE([#include <linux/ethtool.h>],
5143 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
5144 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
5146 # target_arch is from {ia32|x64|arm|ppc}
5149 WEBRTC_TARGET_ARCH=x64
5153 WEBRTC_TARGET_ARCH=arm
5157 WEBRTC_TARGET_ARCH=ia32
5161 WEBRTC_TARGET_ARCH=ppc
5164 WEBRTC_TARGET_ARCH=ia64
5167 # unsupported arch for webrtc
5168 WEBRTC_TARGET_ARCH=unknown
5174 dnl ========================================================
5175 dnl = Disable WebRTC code
5176 dnl ========================================================
5177 MOZ_ARG_DISABLE_BOOL(webrtc,
5178 [ --disable-webrtc Disable support for WebRTC],
5182 if test -n "$MOZ_WEBRTC"; then
5183 AC_DEFINE(MOZ_WEBRTC)
5184 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
5185 dnl opt/production builds (via MOZ_CRASH())
5186 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
5190 MOZ_VP8_ERROR_CONCEALMENT=1
5192 dnl enable once Signaling lands
5193 MOZ_WEBRTC_SIGNALING=1
5194 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5195 if test "${OS_TARGET}" = "WINNT"; then
5196 MOZ_WEBRTC_IN_LIBXUL=1
5198 dnl enable once PeerConnection lands
5199 MOZ_PEERCONNECTION=1
5200 AC_DEFINE(MOZ_PEERCONNECTION)
5207 AC_SUBST(MOZ_WEBRTC)
5208 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5209 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5210 AC_SUBST(MOZ_PEERCONNECTION)
5211 AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
5212 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5216 dnl Use integers over floats for audio on B2G and Android, because audio
5217 dnl backends for those platforms don't support floats.
5218 if test "$OS_TARGET" = "Android"; then
5219 MOZ_SAMPLE_TYPE_S16=1
5220 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5221 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5223 MOZ_SAMPLE_TYPE_FLOAT32=1
5224 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5225 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5228 dnl ========================================================
5229 dnl = Disable Speech API code
5230 dnl ========================================================
5231 MOZ_ARG_DISABLE_BOOL(webspeech,
5232 [ --disable-webspeech Disable support for HTML Speech API],
5236 if test -n "$MOZ_WEBSPEECH"; then
5237 AC_DEFINE(MOZ_WEBSPEECH)
5240 AC_SUBST(MOZ_WEBSPEECH)
5242 dnl ========================================================
5243 dnl = Enable Raw Codecs
5244 dnl ========================================================
5245 MOZ_ARG_ENABLE_BOOL(raw,
5246 [ --enable-raw Enable support for RAW media],
5250 if test -n "$MOZ_RAW"; then
5256 dnl ========================================================
5257 dnl = Disable Ogg Codecs
5258 dnl ========================================================
5259 MOZ_ARG_DISABLE_BOOL(ogg,
5260 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5264 if test -n "$MOZ_OGG"; then
5268 dnl Checks for __attribute__(aligned()) directive
5269 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5270 [ac_cv_c_attribute_aligned],
5271 [ac_cv_c_attribute_aligned=0
5272 CFLAGS_save="${CFLAGS}"
5273 CFLAGS="${CFLAGS} -Werror"
5274 for ac_cv_c_attr_align_try in 64 32 16 8; do
5275 echo "trying $ac_cv_c_attr_align_try"
5277 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5278 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5279 if test "$ac_cv_c_attribute_aligned" != 0; then
5283 CFLAGS="${CFLAGS_save}"])
5284 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5285 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5286 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5290 dnl ========================================================
5291 dnl = Disable Opus audio codec support
5292 dnl ========================================================
5293 MOZ_ARG_DISABLE_BOOL(opus,
5294 [ --disable-opus Disable support for Opus audio],
5298 dnl ========================================================
5299 dnl = Disable VP8 decoder support
5300 dnl ========================================================
5301 MOZ_ARG_DISABLE_BOOL(webm,
5302 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5306 if test -n "$MOZ_WEBM"; then
5311 dnl ========================================================
5312 dnl = DirectShow support
5313 dnl ========================================================
5314 if test "$OS_ARCH" = "WINNT"; then
5315 dnl Enable DirectShow support by default.
5319 MOZ_ARG_DISABLE_BOOL(directshow,
5320 [ --disable-directshow Disable support for DirectShow],
5324 if test -n "$MOZ_DIRECTSHOW"; then
5325 AC_DEFINE(MOZ_DIRECTSHOW)
5329 dnl ========================================================
5330 dnl = Windows Media Foundation support
5331 dnl ========================================================
5332 if test "$OS_ARCH" = "WINNT"; then
5333 dnl Enable Windows Media Foundation support by default.
5334 dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5335 dnl guaranteed to have a recent-enough SDK to build WMF.
5339 MOZ_ARG_DISABLE_BOOL(wmf,
5340 [ --disable-wmf Disable support for Windows Media Foundation],
5344 if test -n "$MOZ_WMF"; then
5349 dnl ========================================================
5350 dnl = Enable media plugin support
5351 dnl ========================================================
5352 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5353 dnl Enable support on android by default
5357 MOZ_ARG_ENABLE_BOOL(media-plugins,
5358 [ --enable-media-plugins Enable support for media plugins],
5359 MOZ_MEDIA_PLUGINS=1,
5362 if test -n "$MOZ_MEDIA_PLUGINS"; then
5363 AC_DEFINE(MOZ_MEDIA_PLUGINS)
5366 dnl ========================================================
5367 dnl = Disable platform MP3 decoder on OSX
5368 dnl ========================================================
5369 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5373 MOZ_ARG_DISABLE_BOOL(apple-media,
5374 [ --disable-apple-media Disable support for Apple AudioToolbox/VideoToolbox],
5378 if test -n "$MOZ_APPLEMEDIA"; then
5379 AC_DEFINE(MOZ_APPLEMEDIA)
5382 dnl ========================================================
5383 dnl = Enable getUserMedia support
5384 dnl ========================================================
5385 MOZ_ARG_ENABLE_BOOL(media-navigator,
5386 [ --enable-media-navigator Enable support for getUserMedia],
5387 MOZ_MEDIA_NAVIGATOR=1,
5388 MOZ_MEDIA_NAVIGATOR=)
5390 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5391 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5394 dnl ========================================================
5395 dnl = Enable building OMX media plugin (B2G or Android)
5396 dnl ========================================================
5397 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5398 dnl Enable support on android by default
5402 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5403 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5407 if test -n "$MOZ_OMX_PLUGIN"; then
5408 if test "$OS_TARGET" = "Android"; then
5409 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5410 AC_DEFINE(MOZ_OMX_PLUGIN)
5412 dnl fail if we're not building on Gonk or Android
5413 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5417 dnl system libvpx Support
5418 dnl ========================================================
5419 MOZ_ARG_WITH_BOOL(system-libvpx,
5420 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5421 MOZ_NATIVE_LIBVPX=1)
5426 if test -n "$MOZ_VP8"; then
5428 if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5429 AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5431 if test -n "$MOZ_VP8_ENCODER" ; then
5432 AC_DEFINE(MOZ_VP8_ENCODER)
5435 if test -n "$MOZ_NATIVE_LIBVPX"; then
5436 dnl ============================
5437 dnl === libvpx Version check ===
5438 dnl ============================
5439 dnl Check to see if we have a system libvpx package.
5440 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5442 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5443 [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.])])
5446 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5447 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5452 AC_SUBST(MOZ_NATIVE_LIBVPX)
5453 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5454 AC_SUBST(MOZ_LIBVPX_LIBS)
5456 if test "$MOZ_WEBM"; then
5458 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5465 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5467 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5468 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5469 dnl We currently require gcc on all arm platforms.
5472 VPX_NEED_OBJ_INT_EXTRACT=
5474 dnl See if we have assembly on this platform.
5475 case "$OS_ARCH:$CPU_ARCH" in
5477 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5481 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5485 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5489 dnl Check for yasm 1.1 or greater.
5490 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5491 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.])
5492 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5493 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.])
5495 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5497 dnl The encoder needs obj_int_extract to get asm offsets.
5501 if test -n "$GNU_AS" ; then
5503 dnl These flags are a lie; they're just used to enable the requisite
5504 dnl opcodes; actual arch detection is done at runtime.
5505 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5506 VPX_DASH_C_FLAG="-c"
5507 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5508 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5513 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5514 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5519 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5520 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5526 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5527 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.])
5530 if test -n "$MOZ_VP8_ENCODER" -a \
5531 -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5532 dnl We prefer to get asm offsets using inline assembler, which the above
5533 dnl compilers can do. When we're not using one of those, we have to fall
5534 dnl back to obj_int_extract, which reads them from a compiled object
5535 dnl file. Unfortunately, that only works if we're compiling on a system
5536 dnl with the header files for the appropriate object file format.
5537 VPX_NEED_OBJ_INT_EXTRACT=1
5540 if test -n "$VPX_X86_ASM"; then
5541 AC_DEFINE(VPX_X86_ASM)
5542 elif test -n "$VPX_ARM_ASM"; then
5543 AC_DEFINE(VPX_ARM_ASM)
5545 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5549 dnl ========================================================
5550 dnl = Disable Wave decoder support
5551 dnl ========================================================
5552 MOZ_ARG_DISABLE_BOOL(wave,
5553 [ --disable-wave Disable Wave decoder support],
5557 if test -n "$MOZ_WAVE"; then
5562 dnl ========================================================
5563 dnl = Handle dependent CUBEB and MEDIA defines
5564 dnl ========================================================
5566 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5567 AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5570 if test -n "$MOZ_SOUNDTOUCH"; then
5571 AC_DEFINE(MOZ_SOUNDTOUCH)
5574 if test -n "$MOZ_CUBEB"; then
5575 AC_DEFINE(MOZ_CUBEB)
5578 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5579 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/])
5582 if test -n "$MOZ_VORBIS"; then
5583 AC_DEFINE(MOZ_VORBIS)
5586 if test -n "$MOZ_TREMOR"; then
5587 AC_DEFINE(MOZ_TREMOR)
5590 if test -n "$MOZ_OPUS"; then
5594 dnl ========================================================
5595 dnl = Check alsa availability on Linux if using sydneyaudio
5596 dnl ========================================================
5598 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5599 if test -n "$MOZ_CUBEB" -a "$OS_TARGET" = "Linux"; then
5603 MOZ_ARG_ENABLE_BOOL(alsa,
5604 [ --enable-alsa Enable Alsa support (default on Linux)],
5608 if test -n "$MOZ_ALSA"; then
5609 AC_DEFINE(MOZ_CUBEB)
5610 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5611 [echo "$MOZ_ALSA_PKG_ERRORS"
5612 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.)])])
5616 AC_SUBST(MOZ_ALSA_CFLAGS)
5617 AC_SUBST(MOZ_ALSA_LIBS)
5619 dnl ========================================================
5620 dnl = Enable PulseAudio
5621 dnl ========================================================
5623 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5624 [ --enable-pulseaudio Enable PulseAudio support (experimental)],
5628 if test -n "$MOZ_PULSEAUDIO"; then
5629 AC_DEFINE(MOZ_CUBEB)
5630 if test -z "$gonkdir"; then
5631 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5632 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5633 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
5635 MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
5636 MOZ_PULSEAUDIO_LIBS="-lpulse"
5640 AC_SUBST(MOZ_PULSEAUDIO)
5641 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5642 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5644 dnl ========================================================
5645 dnl = Enable GStreamer
5646 dnl ========================================================
5647 if test "$OS_TARGET" = "Linux"; then
5651 MOZ_ARG_ENABLE_BOOL(gstreamer,
5652 [ --enable-gstreamer Enable GStreamer support],
5656 if test "$MOZ_GSTREAMER"; then
5657 # API version, eg 0.10, 1.0 etc
5658 GST_API_VERSION=0.10
5659 # core/base release number
5661 PKG_CHECK_MODULES(GSTREAMER,
5662 gstreamer-$GST_API_VERSION >= $GST_VERSION
5663 gstreamer-app-$GST_API_VERSION
5664 gstreamer-plugins-base-$GST_API_VERSION, ,
5665 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]))
5666 if test -n "$GSTREAMER_LIBS"; then
5667 _SAVE_LDFLAGS=$LDFLAGS
5668 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5669 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5670 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5671 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5673 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.])
5675 LDFLAGS=$_SAVE_LDFLAGS
5677 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])
5680 AC_SUBST(GSTREAMER_CFLAGS)
5681 AC_SUBST(GSTREAMER_LIBS)
5682 AC_SUBST(MOZ_GSTREAMER)
5684 if test -n "$MOZ_GSTREAMER"; then
5685 AC_DEFINE(MOZ_GSTREAMER)
5689 dnl ========================================================
5690 dnl Permissions System
5691 dnl ========================================================
5692 MOZ_ARG_DISABLE_BOOL(permissions,
5693 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5698 dnl ========================================================
5699 dnl Child permissions, currently only used for b2g
5700 dnl ========================================================
5701 if test -n "$MOZ_B2G"; then
5702 if test -n "$MOZ_PERMISSIONS"; then
5703 MOZ_CHILD_PERMISSIONS=1
5705 AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
5708 AC_SUBST(MOZ_CHILD_PERMISSIONS)
5710 dnl ========================================================
5712 dnl ========================================================
5713 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5714 [ --disable-negotiateauth Disable GSS-API negotiation ],
5715 MOZ_AUTH_EXTENSION=,
5716 MOZ_AUTH_EXTENSION=1 )
5718 dnl ========================================================
5719 dnl Pref extensions (autoconfig)
5720 dnl ========================================================
5721 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5722 [ --disable-pref-extensions
5723 Disable pref extensions such as autoconfig],
5724 MOZ_PREF_EXTENSIONS=,
5725 MOZ_PREF_EXTENSIONS=1 )
5727 dnl ========================================================
5728 dnl Searching of system directories for extensions.
5729 dnl Note: this switch is meant to be used for test builds
5730 dnl whose behavior should not depend on what happens to be
5731 dnl installed on the local machine.
5732 dnl ========================================================
5733 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5734 [ --disable-system-extension-dirs
5735 Disable searching system- and account-global
5736 directories for extensions of any kind; use
5737 only profile-specific extension directories],
5738 ENABLE_SYSTEM_EXTENSION_DIRS=,
5739 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5740 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5741 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5744 dnl ========================================================
5745 dnl = Universalchardet
5746 dnl ========================================================
5747 MOZ_ARG_DISABLE_BOOL(universalchardet,
5748 [ --disable-universalchardet
5749 Disable universal encoding detection],
5750 MOZ_UNIVERSALCHARDET=,
5751 MOZ_UNIVERSALCHARDET=1 )
5753 if test -n "${JAVA_BIN_PATH}"; then
5754 dnl Look for javac and jar in the specified path.
5755 JAVA_PATH="$JAVA_BIN_PATH"
5757 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5758 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5761 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5762 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5763 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5764 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5765 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5766 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5768 if test -n "${JAVA_BIN_PATH}" -o \
5769 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5770 if test -z "$JAVA" -o "$JAVA" = ":"; then
5771 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}])
5773 if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5774 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}])
5776 if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5777 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}])
5779 if test -z "$JAR" -o "$JAR" = ":"; then
5780 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}])
5782 if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5783 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}])
5785 if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5786 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}])
5790 dnl ========================================================
5791 dnl = ANGLE OpenGL->D3D translator for WebGL
5792 dnl = * only applies to win32
5793 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5794 dnl ========================================================
5796 MOZ_DIRECTX_SDK_PATH=
5797 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5798 MOZ_D3DCOMPILER_CAB=
5799 MOZ_D3DCOMPILER_DLL=
5800 case "$target_os" in
5802 MOZ_ANGLE_RENDERER=1
5806 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5807 case "${target_cpu}" in
5809 MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5812 MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5816 MOZ_ARG_DISABLE_BOOL(webgl,
5817 [ --disable-webgl Disable building of the WebGL implementation],
5818 MOZ_WEBGL_DISABLED=1,
5819 MOZ_WEBGL_DISABLED=)
5821 if test -n "$MOZ_WEBGL_DISABLED"; then
5826 if test -n "$MOZ_WEBGL"; then
5827 AC_DEFINE(MOZ_WEBGL)
5830 if test -n "$MOZ_WEBGL_CONFORMANT"; then
5831 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
5834 # Locate a DirectX SDK here so we can use it for both ANGLE and
5836 if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
5837 # Get the SDK path from the registry.
5838 # First try to get the June 2010 SDK
5839 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5840 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5841 # Otherwise just take whatever comes first
5842 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5844 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'`
5847 if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
5848 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5849 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.])
5852 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5853 test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5854 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5855 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5857 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.])
5860 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5861 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'`
5863 if test -z "$MOZ_D3DX9_VERSION" ; then
5864 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.])
5867 MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5869 if test -z "$MOZ_D3DCOMPILER_CAB"; then
5870 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.])
5873 MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5876 dnl ========================================================
5878 dnl ========================================================
5880 MOZ_GAMEPAD_BACKEND=stub
5882 # Gamepad DOM is built on supported platforms by default.
5883 case "$OS_TARGET" in
5891 MOZ_ARG_DISABLE_BOOL(gamepad,
5892 [ --disable-gamepad Disable gamepad support],
5896 if test "$MOZ_GAMEPAD"; then
5897 case "$OS_TARGET" in
5899 MOZ_GAMEPAD_BACKEND=cocoa
5902 if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
5903 if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5906 elif test "$GCC" != "yes"; then
5909 if test -z "$MOZ_GAMEPAD"; then
5910 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.])
5912 MOZ_GAMEPAD_BACKEND=windows
5915 MOZ_CHECK_HEADER([linux/joystick.h])
5916 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5917 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.])
5919 MOZ_GAMEPAD_BACKEND=linux
5925 AC_DEFINE(MOZ_GAMEPAD)
5927 AC_SUBST(MOZ_GAMEPAD)
5928 AC_SUBST(MOZ_GAMEPAD_BACKEND)
5930 dnl ========================================================
5931 dnl = Breakpad crash reporting (on by default on supported platforms)
5932 dnl ========================================================
5935 i?86-*-mingw*|x86_64-*-mingw*)
5938 i?86-apple-darwin*|x86_64-apple-darwin*)
5941 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5942 if test "$MOZ_ENABLE_GTK"; then
5946 *-android*|*-linuxandroid*)
5954 MOZ_ARG_DISABLE_BOOL(crashreporter,
5955 [ --disable-crashreporter Disable breakpad crash reporting],
5956 [MOZ_CRASHREPORTER=],
5957 [MOZ_CRASHREPORTER=F # Force enable breakpad])
5959 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
5960 if test "$MOZ_CRASHREPORTER" = F; then
5961 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
5966 if test -n "$MOZ_CRASHREPORTER"; then
5967 AC_DEFINE(MOZ_CRASHREPORTER)
5969 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5970 test -z "$SKIP_LIBRARY_CHECKS"; then
5971 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5972 AC_SUBST(MOZ_GTHREAD_CFLAGS)
5973 AC_SUBST(MOZ_GTHREAD_LIBS)
5976 if test "$OS_ARCH" = "WINNT"; then
5977 if test -z "$HAVE_64BIT_OS"; then
5978 MOZ_CRASHREPORTER_INJECTOR=1
5979 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5984 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5985 [ --with-crashreporter-enable-percent=NN
5986 Enable sending crash reports by default on NN% of users. (default=100)],
5987 [ val=`echo $withval | sed 's/[^0-9]//g'`
5988 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5990 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5991 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5993 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5995 dnl ========================================================
5996 dnl = libjpeg-turbo configuration
5997 dnl ========================================================
5999 if test -z "$MOZ_NATIVE_JPEG"; then
6003 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6004 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
6006 MOZ_LIBJPEG_TURBO=1)
6008 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6009 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6012 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6015 if test -n "$MOZ_LIBJPEG_TURBO"; then
6017 dnl Do we support libjpeg-turbo on this platform?
6018 case "$OS_ARCH:$OS_TEST" in
6020 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6021 LIBJPEG_TURBO_X86_ASM=1
6024 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6025 LIBJPEG_TURBO_X64_ASM=1
6027 WINNT:x86|WINNT:i?86)
6028 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6029 LIBJPEG_TURBO_X86_ASM=1
6032 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6033 LIBJPEG_TURBO_X64_ASM=1
6036 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6037 LIBJPEG_TURBO_ARM_ASM=1
6040 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6041 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6042 LIBJPEG_TURBO_X86_ASM=1
6046 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6047 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6048 LIBJPEG_TURBO_X64_ASM=1
6055 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6056 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6057 dnl it doesn't exist or we have too old of a version.
6058 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6059 LIBJPEG_TURBO_AS=$YASM
6061 if test -z "$LIBJPEG_TURBO_AS" ; then
6062 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.])
6065 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6066 dnl on Linux and 1.1 or newer everywhere else.
6067 if test "$OS_ARCH" = "Linux" ; then
6068 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
6069 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.])
6072 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6073 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.])
6078 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6079 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6080 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6081 echo "Using $AS as the assembler for ARM code."
6082 LIBJPEG_TURBO_AS=$AS
6085 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6086 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6087 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6088 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6089 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6090 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6091 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6092 dnl Warn if we're not building the optimized routines, even though the user
6093 dnl didn't specify --disable-libjpeg-turbo.
6094 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6097 dnl ========================================================
6098 dnl = Enable compilation of specific extension modules
6099 dnl ========================================================
6101 MOZ_ARG_ENABLE_STRING(extensions,
6102 [ --enable-extensions Enable extensions],
6103 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6104 if test "$option" = "yes" -o "$option" = "all"; then
6105 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6106 elif test "$option" = "no" -o "$option" = "none"; then
6108 elif test "$option" = "default"; then
6109 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6110 elif test `echo "$option" | grep -c \^-` != 0; then
6111 option=`echo $option | sed 's/^-//'`
6112 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6114 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6117 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6119 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6120 # Suppress warning on non-X11 platforms
6121 if test -n "$MOZ_X11"; then
6122 AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6124 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6127 dnl Do not build gnomevfs with libxul based apps
6128 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6129 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6132 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6133 # Suppress warning on non-X11 platforms
6134 if test -n "$MOZ_X11"; then
6135 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6137 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6140 dnl Do not build gio with libxul based apps
6141 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6142 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6145 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6147 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6149 AC_SUBST(MOZ_GIO_COMPONENT)
6151 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6152 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6153 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6157 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6159 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6160 dnl when trying to build a nonexistent extension.
6161 for extension in $MOZ_EXTENSIONS; do
6162 if test ! -d "${srcdir}/extensions/${extension}"; then
6163 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6167 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6168 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6171 dnl ========================================================
6172 dnl Build Freetype in the tree
6173 dnl ========================================================
6174 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6175 [ --enable-tree-freetype Enable Tree FreeType],
6176 MOZ_TREE_FREETYPE=1,
6177 MOZ_TREE_FREETYPE= )
6178 if test -n "$MOZ_TREE_FREETYPE"; then
6179 if test -n "$_WIN32_MSVC"; then
6180 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6182 AC_DEFINE(MOZ_TREE_FREETYPE)
6183 AC_SUBST(MOZ_TREE_FREETYPE)
6184 MOZ_ENABLE_CAIRO_FT=1
6185 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6186 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6187 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6188 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6190 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6191 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6192 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6193 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6194 AC_SUBST(CAIRO_FT_CFLAGS)
6197 dnl ========================================================
6199 dnl ========================================================
6200 dnl Abort Windows build if the required major version and
6201 dnl minimum minor version of Unicode NSIS isn't in the path
6202 dnl (unless in case of cross compiling, for which Unicode
6203 dnl is not yet sufficient).
6204 if test "$OS_ARCH" = "WINNT"; then
6205 REQ_NSIS_MAJOR_VER=2
6206 MIN_NSIS_MINOR_VER=46
6207 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensis)
6208 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6209 AC_MSG_RESULT([yes])
6211 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6213 if test ! "$MAKENSISU_VER" = ""; then
6214 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6215 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6217 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6218 if test "$MAKENSISU_VER" = "" || \
6219 test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6220 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6222 if test -z "$CROSS_COMPILE"; then
6223 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.])
6228 elif test -z "$CROSS_COMPILE"; then
6229 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.])
6235 dnl ========================================================
6237 dnl ========================================================
6238 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6239 [ --disable-webapp-runtime Disable Web App Runtime],
6240 MOZ_WEBAPP_RUNTIME=,
6241 MOZ_WEBAPP_RUNTIME=1)
6242 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6245 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6248 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6249 if test "$MOZ_WEBAPP_RUNTIME"; then
6250 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6253 AC_MSG_CHECKING([for tar archiver])
6254 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6255 if test -z "$TAR"; then
6256 AC_MSG_ERROR([no tar archiver found in \$PATH])
6258 AC_MSG_RESULT([$TAR])
6261 AC_MSG_CHECKING([for wget])
6262 AC_CHECK_PROGS(WGET, wget, "")
6263 AC_MSG_RESULT([$WGET])
6266 dnl ========================================================
6268 dnl ========================================================
6270 if test -n "$MOZ_SIGN_CMD"; then
6271 AC_DEFINE(MOZ_SIGNING)
6274 dnl ========================================================
6275 dnl Maintenance Service
6276 dnl ========================================================
6278 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6279 [ --enable-maintenance-service Enable building of maintenanceservice],
6280 MOZ_MAINTENANCE_SERVICE=1,
6281 MOZ_MAINTENANCE_SERVICE= )
6283 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6284 if test "$OS_ARCH" = "WINNT"; then
6285 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6287 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6291 dnl ========================================================
6292 dnl Verify MAR signatures
6293 dnl ========================================================
6295 MOZ_ARG_ENABLE_BOOL(verify-mar,
6296 [ --enable-verify-mar Enable verifying MAR signatures],
6297 MOZ_VERIFY_MAR_SIGNATURE=1,
6298 MOZ_VERIFY_MAR_SIGNATURE= )
6300 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6301 if test "$OS_ARCH" = "WINNT"; then
6302 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6304 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6308 dnl ========================================================
6309 dnl Enable building the signmar program.
6310 dnl This option is much different than the --enable-verify-mar option.
6311 dnl --enable-verify-mar is for enabling the verification check on MAR
6312 dnl files in the updater. The --enable-signmar option is for building
6313 dnl the signmar program.
6314 dnl ========================================================
6316 MOZ_ARG_ENABLE_BOOL(signmar,
6317 [ --enable-signmar Enable building the signmar program],
6318 MOZ_ENABLE_SIGNMAR=1,
6319 MOZ_ENABLE_SIGNMAR= )
6321 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6322 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6325 dnl ========================================================
6327 dnl ========================================================
6329 MOZ_ARG_DISABLE_BOOL(updater,
6330 [ --disable-updater Disable building of updater],
6334 if test -n "$MOZ_UPDATER"; then
6335 AC_DEFINE(MOZ_UPDATER)
6338 # tools/update-packaging is not checked out by default.
6339 MOZ_ARG_ENABLE_BOOL(update-packaging,
6340 [ --enable-update-packaging
6341 Enable tools/update-packaging],
6342 MOZ_UPDATE_PACKAGING=1,
6343 MOZ_UPDATE_PACKAGING= )
6344 AC_SUBST(MOZ_UPDATE_PACKAGING)
6346 dnl ========================================================
6347 dnl build the tests by default
6348 dnl ========================================================
6349 MOZ_ARG_DISABLE_BOOL(tests,
6350 [ --disable-tests Do not build test libraries & programs],
6354 if test -n "$ENABLE_TESTS"; then
6357 AC_DEFINE(MOZ_ENABLE_GTEST)
6358 AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6359 AC_SUBST(MOZ_ENABLE_GTEST)
6360 AC_SUBST(GTEST_HAS_RTTI)
6361 if test -n "$_WIN32_MSVC"; then
6362 AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6364 if test "${OS_TARGET}" = "Android"; then
6365 AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6366 AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6367 AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6368 AC_SUBST(GTEST_OS_LINUX_ANDROID)
6369 AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6370 AC_SUBST(GTEST_HAS_CLONE)
6374 dnl ========================================================
6375 dnl parental controls (for Windows Vista)
6376 dnl ========================================================
6377 MOZ_ARG_DISABLE_BOOL(parental-controls,
6378 [ --disable-parental-controls
6379 Do not build parental controls],
6380 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6381 MOZ_DISABLE_PARENTAL_CONTROLS=)
6382 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6383 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6386 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6388 dnl ========================================================
6389 dnl = Disable DOMCrypto
6390 dnl ========================================================
6391 if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
6392 AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
6394 AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
6396 dnl ========================================================
6397 dnl = Disable libpkix
6398 dnl ========================================================
6399 if test -n "$NSS_NO_LIBPKIX"; then
6400 AC_DEFINE(NSS_NO_LIBPKIX)
6402 AC_SUBST(NSS_NO_LIBPKIX)
6404 dnl ========================================================
6405 dnl = Content process sandboxing
6406 dnl ========================================================
6407 if test -n "$gonkdir"; then
6408 MOZ_CONTENT_SANDBOX=1
6411 MOZ_ARG_ENABLE_BOOL(content-sandbox,
6412 [ --enable-content-sandbox Enable sandboxing support for content-processes],
6413 MOZ_CONTENT_SANDBOX=1,
6414 MOZ_CONTENT_SANDBOX=)
6416 if test -n "$MOZ_CONTENT_SANDBOX"; then
6417 AC_DEFINE(MOZ_CONTENT_SANDBOX)
6420 AC_SUBST(MOZ_CONTENT_SANDBOX)
6422 MOZ_ARG_ENABLE_BOOL(content-sandbox-reporter,
6423 [ --enable-content-sandbox-reporter Enable syscall reporter to troubleshoot syscalls denied by the content-processes sandbox],
6424 MOZ_CONTENT_SANDBOX_REPORTER=1,
6425 MOZ_CONTENT_SANDBOX_REPORTER=)
6427 if test -n "$MOZ_CONTENT_SANDBOX_REPORTER"; then
6428 AC_DEFINE(MOZ_CONTENT_SANDBOX_REPORTER)
6431 AC_SUBST(MOZ_CONTENT_SANDBOX_REPORTER)
6433 dnl ========================================================
6435 dnl = Module specific options
6437 dnl ========================================================
6438 MOZ_ARG_HEADER(Individual module options)
6440 dnl ========================================================
6441 dnl = Disable feed handling components
6442 dnl ========================================================
6443 MOZ_ARG_DISABLE_BOOL(feeds,
6444 [ --disable-feeds Disable feed handling and processing components],
6447 if test -n "$MOZ_FEEDS"; then
6448 AC_DEFINE(MOZ_FEEDS)
6450 if test "$MOZ_BUILD_APP" = "browser"; then
6451 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6455 dnl ========================================================
6456 dnl Check for sqlite
6457 dnl ========================================================
6460 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6461 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6462 MOZ_NATIVE_SQLITE=1,
6463 MOZ_NATIVE_SQLITE= )
6465 if test -z "$MOZ_NATIVE_SQLITE"
6468 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6470 dnl ============================
6471 dnl === SQLite Version check ===
6472 dnl ============================
6473 dnl Check to see if the system SQLite package is new enough.
6474 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6476 dnl ==================================
6477 dnl === SQLITE_SECURE_DELETE check ===
6478 dnl ==================================
6479 dnl Check to see if the system SQLite package is compiled with
6480 dnl SQLITE_SECURE_DELETE enabled.
6481 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6482 _SAVE_CFLAGS="$CFLAGS"
6483 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6485 LIBS="$LIBS $SQLITE_LIBS"
6486 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6488 #include "sqlite3.h"
6490 int main(int argc, char **argv){
6491 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6493 ac_cv_sqlite_secure_delete=yes,
6494 ac_cv_sqlite_secure_delete=no,
6495 ac_cv_sqlite_secure_delete=no
6498 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6499 CFLAGS="$_SAVE_CFLAGS"
6501 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6502 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6505 dnl ===============================
6506 dnl === SQLITE_THREADSAFE check ===
6507 dnl ===============================
6508 dnl Check to see if the system SQLite package is compiled with
6509 dnl SQLITE_THREADSAFE enabled.
6510 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6511 _SAVE_CFLAGS="$CFLAGS"
6512 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6514 LIBS="$LIBS $SQLITE_LIBS"
6515 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6517 #include "sqlite3.h"
6519 int main(int argc, char **argv){
6520 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6522 ac_cv_sqlite_threadsafe=yes,
6523 ac_cv_sqlite_threadsafe=no,
6524 ac_cv_sqlite_threadsafe=no
6527 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6528 CFLAGS="$_SAVE_CFLAGS"
6530 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6531 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6534 dnl ================================
6535 dnl === SQLITE_ENABLE_FTS3 check ===
6536 dnl ================================
6537 dnl check to see if the system SQLite package is compiled with
6538 dnl SQLITE_ENABLE_FTS3 enabled.
6539 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6540 _SAVE_CFLAGS="$CFLAGS"
6541 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6543 LIBS="$LIBS $SQLITE_LIBS"
6544 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6546 #include "sqlite3.h"
6548 int main(int argc, char **argv){
6549 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6551 ac_cv_sqlite_enable_fts3=yes,
6552 ac_cv_sqlite_enable_fts3=no,
6553 ac_cv_sqlite_enable_fts3=no
6556 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6557 CFLAGS="$_SAVE_CFLAGS"
6559 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6560 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6563 dnl =========================================
6564 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6565 dnl =========================================
6566 dnl check to see if the system SQLite package is compiled with
6567 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6568 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6569 _SAVE_CFLAGS="$CFLAGS"
6570 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6572 LIBS="$LIBS $SQLITE_LIBS"
6573 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6575 #include "sqlite3.h"
6577 int main(int argc, char **argv){
6578 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6580 ac_cv_sqlite_enable_unlock_notify=yes,
6581 ac_cv_sqlite_enable_unlock_notify=no,
6582 ac_cv_sqlite_enable_unlock_notify=no
6585 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6586 CFLAGS="$_SAVE_CFLAGS"
6588 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6589 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6593 if test -n "$MOZ_NATIVE_SQLITE"; then
6594 AC_DEFINE(MOZ_NATIVE_SQLITE)
6596 AC_SUBST(MOZ_NATIVE_SQLITE)
6598 dnl ========================================================
6599 dnl = Enable help viewer (off by default)
6600 dnl ========================================================
6601 if test -n "$MOZ_HELP_VIEWER"; then
6602 dnl Do this if defined in confvars.sh
6603 AC_DEFINE(MOZ_HELP_VIEWER)
6606 dnl ========================================================
6607 dnl = Enable safe browsing (anti-phishing)
6608 dnl ========================================================
6609 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6610 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6611 MOZ_SAFE_BROWSING=1,
6612 MOZ_SAFE_BROWSING= )
6613 if test -n "$MOZ_SAFE_BROWSING"; then
6614 AC_DEFINE(MOZ_SAFE_BROWSING)
6616 AC_SUBST(MOZ_SAFE_BROWSING)
6618 dnl ========================================================
6619 dnl = Enable url-classifier
6620 dnl ========================================================
6621 dnl Implicitly enabled by default if building with safe-browsing
6622 if test -n "$MOZ_SAFE_BROWSING"; then
6623 MOZ_URL_CLASSIFIER=1
6625 MOZ_ARG_ENABLE_BOOL(url-classifier,
6626 [ --enable-url-classifier Enable url classifier module],
6627 MOZ_URL_CLASSIFIER=1,
6628 MOZ_URL_CLASSIFIER= )
6629 if test -n "$MOZ_URL_CLASSIFIER"; then
6630 AC_DEFINE(MOZ_URL_CLASSIFIER)
6632 AC_SUBST(MOZ_URL_CLASSIFIER)
6634 dnl ========================================================
6635 dnl = Disable zipwriter
6636 dnl ========================================================
6637 MOZ_ARG_DISABLE_BOOL(zipwriter,
6638 [ --disable-zipwriter Disable zipwriter component],
6641 AC_SUBST(MOZ_ZIPWRITER)
6643 dnl ========================================================
6645 dnl ========================================================
6647 MOZ_ARG_WITH_STRING(gl-provider,
6648 [ --with-gl-provider=ID
6649 Set GL provider backend type],
6650 [ val=`echo $withval`
6651 MOZ_GL_PROVIDER="$val"])
6653 if test -n "$MOZ_GL_PROVIDER"; then
6654 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6655 AC_SUBST(MOZ_GL_PROVIDER)
6656 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6658 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6659 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6661 dnl ========================================================
6662 dnl = faststripe theme
6663 dnl ========================================================
6664 MOZ_ARG_ENABLE_BOOL(faststripe,
6665 [ --enable-faststripe Use faststripe theme],
6666 MOZ_THEME_FASTSTRIPE=1,
6667 MOZ_THEME_FASTSTRIPE= )
6668 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6670 dnl ========================================================
6672 dnl = Feature options that require extra sources to be pulled
6674 dnl ========================================================
6675 dnl MOZ_ARG_HEADER(Features that require extra sources)
6677 dnl ========================================================
6679 dnl = Runtime debugging and Optimization Options
6681 dnl ========================================================
6682 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
6684 dnl ========================================================
6685 dnl enable mobile optimizations
6686 dnl ========================================================
6687 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6688 [ --enable-mobile-optimize
6689 Enable mobile optimizations],
6690 MOZ_GFX_OPTIMIZE_MOBILE=1)
6692 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6694 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6695 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6698 dnl ========================================================
6699 dnl = Enable code optimization. ON by default.
6700 dnl ========================================================
6701 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6702 MOZ_OPTIMIZE_FLAGS="-O"
6705 MOZ_ARG_ENABLE_STRING(optimize,
6706 [ --disable-optimize Disable compiler optimization
6707 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6708 [ if test "$enableval" != "no"; then
6710 if test -n "$enableval" -a "$enableval" != "yes"; then
6711 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6716 fi ], MOZ_OPTIMIZE=1)
6718 MOZ_SET_FRAMEPTR_FLAGS
6720 if test "$COMPILE_ENVIRONMENT"; then
6721 if test -n "$MOZ_OPTIMIZE"; then
6722 AC_MSG_CHECKING([for valid optimization flags])
6723 _SAVE_CFLAGS=$CFLAGS
6724 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6725 AC_TRY_COMPILE([#include <stdio.h>],
6726 [printf("Hello World\n");],
6729 AC_MSG_RESULT([$_results])
6730 if test "$_results" = "no"; then
6731 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6733 CFLAGS=$_SAVE_CFLAGS
6735 fi # COMPILE_ENVIRONMENT
6737 AC_SUBST(MOZ_OPTIMIZE)
6738 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6739 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6740 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6741 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6742 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6743 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6745 dnl ========================================================
6746 dnl = Enable any treating of compile warnings as errors
6747 dnl ========================================================
6748 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6749 [ --enable-warnings-as-errors
6750 Enable treating of warnings as errors],
6751 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6752 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6753 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6754 WARNINGS_AS_ERRORS=''
6755 elif test "$GNU_CC"; then
6756 # Prevent the following GCC warnings from being treated as errors:
6757 # -Wuninitialized - too many false positives
6758 # -Wmaybe-uninitialized - too many false positives
6759 # -Wdeprecated-declarations - we don't want our builds held hostage when a
6760 # platform-specific API becomes deprecated.
6761 MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
6762 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
6763 MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
6764 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
6765 MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
6766 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
6769 dnl ========================================================
6770 dnl = Disable runtime logging checks
6771 dnl ========================================================
6772 MOZ_ARG_DISABLE_BOOL(logging,
6773 [ --disable-logging Disable logging facilities],
6774 NS_DISABLE_LOGGING=1,
6775 NS_DISABLE_LOGGING= )
6776 if test "$NS_DISABLE_LOGGING"; then
6777 AC_DEFINE(NS_DISABLE_LOGGING)
6779 AC_DEFINE(MOZ_LOGGING)
6782 dnl ========================================================
6783 dnl = This will enable logging of addref, release, ctor, dtor.
6784 dnl ========================================================
6785 _ENABLE_LOGREFCNT=42
6786 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6787 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6788 _ENABLE_LOGREFCNT=1,
6789 _ENABLE_LOGREFCNT= )
6790 if test "$_ENABLE_LOGREFCNT" = "1"; then
6791 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6792 elif test -z "$_ENABLE_LOGREFCNT"; then
6793 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6796 dnl ========================================================
6797 dnl moz_dump_painting
6798 dnl ========================================================
6799 MOZ_ARG_ENABLE_BOOL(dump-painting,
6800 [ --enable-dump-painting Enable paint debugging.],
6801 MOZ_DUMP_PAINTING=1,
6802 MOZ_DUMP_PAINTING= )
6803 if test -n "$MOZ_DUMP_PAINTING"; then
6804 AC_DEFINE(MOZ_DUMP_PAINTING)
6805 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6807 if test -n "$MOZ_DEBUG"; then
6808 AC_DEFINE(MOZ_DUMP_PAINTING)
6811 dnl ========================================================
6812 dnl = Enable trace malloc
6813 dnl ========================================================
6814 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6815 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6816 [ --enable-trace-malloc Enable malloc tracing; also disables DMD and jemalloc],
6819 if test "$NS_TRACE_MALLOC"; then
6820 # Please, Mr. Linker Man, don't take away our symbol names
6821 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6823 AC_DEFINE(NS_TRACE_MALLOC)
6825 AC_SUBST(NS_TRACE_MALLOC)
6827 dnl ========================================================
6829 dnl ========================================================
6831 MOZ_ARG_ENABLE_BOOL(dmd,
6832 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
6836 if test "$NS_TRACE_MALLOC"; then # trace-malloc disables DMD
6839 if test "$MOZ_DMD"; then
6843 if test "${CPU_ARCH}" = "arm"; then
6844 CFLAGS="$CFLAGS -funwind-tables"
6845 CXXFLAGS="$CXXFLAGS -funwind-tables"
6848 MOZ_MEMORY=1 # DMD enables jemalloc
6849 MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
6853 dnl ========================================================
6854 dnl = Enable jemalloc
6855 dnl ========================================================
6856 MOZ_ARG_ENABLE_BOOL(jemalloc,
6857 [ --enable-jemalloc Replace memory allocator with jemalloc],
6861 if test "$NS_TRACE_MALLOC"; then
6865 if test "${OS_TARGET}" = "Android"; then
6866 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6868 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
6869 dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
6870 if test -z "$GNU_CC"; then
6871 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6873 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6876 dnl On other Unix systems, we only want to link executables against mozglue
6877 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6878 dnl On other Unix systems, where mozglue is a static library, jemalloc is
6879 dnl separated for the SDK, so we need to add it here.
6880 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6881 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6883 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6884 if test -n "$GNU_CC"; then
6885 dnl And we need mozglue symbols to be exported.
6886 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6888 if test "$MOZ_LINKER" = 1; then
6889 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
6893 dnl ========================================================
6894 dnl = Enable dynamic replacement of malloc implementation
6895 dnl ========================================================
6896 MOZ_ARG_ENABLE_BOOL(replace-malloc,
6897 [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
6898 MOZ_REPLACE_MALLOC=1,
6899 MOZ_REPLACE_MALLOC= )
6901 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
6902 dnl We don't want to enable jemalloc unconditionally because it may be a
6903 dnl deliberate choice not to enable it (bug 702250, for instance)
6904 AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
6905 elif test -n "$MOZ_REPLACE_MALLOC"; then
6906 MOZ_NATIVE_JEMALLOC=
6908 dnl Replace-malloc Mac linkage quirks
6909 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
6910 AC_CACHE_CHECK([how to do weak dynamic linking],
6911 ac_cv_weak_dynamic_linking,
6912 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
6913 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
6914 test -s conftest${DLL_SUFFIX}; then
6915 dnl There are several ways the linker can put link edit rules in a binary:
6916 dnl - classic info only (for OSX < 10.6)
6917 dnl - dyld info only
6919 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
6924 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
6929 dnl With classic info, we need to build with -flat_namespace.
6930 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
6931 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
6932 dnl forgets to set the weak flag in the dyld info.
6933 dnl See http://glandium.org/blog/?p=2764 for more details.
6935 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
6936 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
6937 dnl - "flat namespace" when -flat_namespace alone is needed
6938 dnl - "dummy library" when a dummy library and -flat_namespace are needed
6939 dnl - "compiler support" when nothing is needed
6940 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
6941 if test -n "$_CLASSIC_INFO"; then
6942 ac_cv_weak_dynamic_linking="flat namespace"
6944 ac_cv_weak_dynamic_linking="compiler support"
6947 if test -n "$_DYLD_INFO"; then
6948 ac_cv_weak_dynamic_linking="dummy library"
6950 ac_cv_weak_dynamic_linking="flat namespace"
6954 AC_ERROR([couldn't compile a simple C file])
6957 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
6960 AC_SUBST(MOZ_REPLACE_MALLOC)
6961 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
6963 dnl ========================================================
6964 dnl = Jemalloc build setup
6965 dnl ========================================================
6966 if test -z "$MOZ_MEMORY"; then
6967 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
6968 MOZ_NATIVE_JEMALLOC=1
6969 AC_CHECK_FUNCS(mallctl nallocm,,
6970 [MOZ_NATIVE_JEMALLOC=
6972 if test -n "$MOZ_NATIVE_JEMALLOC"; then
6974 AC_DEFINE(MOZ_MEMORY)
6975 AC_DEFINE(MOZ_JEMALLOC3)
6976 AC_DEFINE(MOZ_NATIVE_JEMALLOC)
6981 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
6982 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.])
6987 dnl Don't try to run compiler tests on Windows
6988 if test "$OS_ARCH" = "WINNT"; then
6989 if test -z "$HAVE_64BIT_OS"; then
6990 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6992 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6995 AC_CHECK_SIZEOF([int *], [4])
6996 case "${ac_cv_sizeof_int_p}" in
6998 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7001 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7004 AC_MSG_ERROR([Unexpected pointer size])
7009 AC_DEFINE(MOZ_MEMORY)
7010 if test -n "$MOZ_JEMALLOC3"; then
7011 AC_DEFINE(MOZ_JEMALLOC3)
7013 if test "x$MOZ_DEBUG" = "x1"; then
7014 AC_DEFINE(MOZ_MEMORY_DEBUG)
7016 dnl The generic feature tests that determine how to compute ncpus are long and
7017 dnl complicated. Therefore, simply define special cpp variables for the
7018 dnl platforms we have special knowledge of.
7021 AC_DEFINE(MOZ_MEMORY_DARWIN)
7024 AC_DEFINE(MOZ_MEMORY_BSD)
7026 *-android*|*-linuxandroid*)
7027 AC_DEFINE(MOZ_MEMORY_LINUX)
7028 AC_DEFINE(MOZ_MEMORY_ANDROID)
7029 if test -z "$gonkdir"; then
7032 AC_DEFINE(MOZ_MEMORY_GONK)
7037 AC_DEFINE(MOZ_MEMORY_LINUX)
7040 AC_DEFINE(MOZ_MEMORY_BSD)
7043 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7046 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7047 if test -z "$MOZ_DEBUG"; then
7048 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7050 WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7052 dnl Look for a broken crtdll.obj
7053 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7054 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7055 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7056 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7057 dnl Also pass this to NSPR/NSS
7058 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7060 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7067 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7071 AC_SUBST(MOZ_MEMORY)
7072 AC_SUBST(MOZ_JEMALLOC3)
7073 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7074 AC_SUBST(MOZ_GLUE_LDFLAGS)
7075 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7076 AC_SUBST(WIN32_CRT_LIBS)
7077 dnl Need to set this for make because NSS doesn't have configure
7080 dnl We need to wrap dlopen and related functions on Android because we use
7082 if test "$OS_TARGET" = Android; then
7083 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7084 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7085 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7086 if test -z "$gonkdir"; then
7087 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7088 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"
7090 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
7091 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=pthread_create,--wrap=epoll_wait,--wrap=poll,--wrap=pthread_cond_timedwait,--wrap=__pthread_cond_timedwait,--wrap=pthread_cond_wait,--wrap=epoll_create,--wrap=epoll_ctl,--wrap=close,--wrap=pthread_key_create,--wrap=pthread_key_delete,--wrap=socketpair,--wrap=pthread_self,--wrap=pthread_mutex_lock,--wrap=pthread_join,--wrap=pipe,--wrap=pipe2"
7095 dnl ========================================================
7096 dnl = Use malloc wrapper lib
7097 dnl ========================================================
7098 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7099 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7103 if test -n "$_WRAP_MALLOC"; then
7104 if test -n "$GNU_CC"; then
7105 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7106 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7107 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7108 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7109 dnl Wrap operator new and operator delete on Android.
7110 if test "$OS_TARGET" = "Android"; then
7111 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7112 dnl Wrap the nothrow variants too.
7113 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7116 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7120 dnl ========================================================
7121 dnl = Location of malloc wrapper lib
7122 dnl ========================================================
7123 MOZ_ARG_WITH_STRING(wrap-malloc,
7124 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7125 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7127 dnl ========================================================
7128 dnl = Use JS Call tracing
7129 dnl ========================================================
7130 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7131 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7132 MOZ_TRACE_JSCALLS=1,
7133 MOZ_TRACE_JSCALLS= )
7134 if test -n "$MOZ_TRACE_JSCALLS"; then
7135 AC_DEFINE(MOZ_TRACE_JSCALLS)
7138 dnl ========================================================
7139 dnl = Use incremental GC
7140 dnl ========================================================
7142 MOZ_ARG_DISABLE_BOOL(gcincremental,
7143 [ --disable-gcincremental Disable incremental GC],
7145 if test -n "$JSGC_INCREMENTAL"; then
7146 AC_DEFINE(JSGC_INCREMENTAL)
7149 dnl ========================================================
7150 dnl Zealous JavaScript GC
7151 dnl ========================================================
7152 MOZ_ARG_ENABLE_BOOL(gczeal,
7153 [ --enable-gczeal Enable zealous JavaScript GCing],
7156 if test -n "$JS_GC_ZEAL"; then
7157 AC_DEFINE(JS_GC_ZEAL)
7160 dnl ========================================================
7161 dnl JS opt-mode assertions and minidump instrumentation
7162 dnl ========================================================
7163 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7164 [ --enable-js-diagnostics
7165 Enable JS diagnostic assertions and breakpad data],
7166 JS_CRASH_DIAGNOSTICS=1,
7167 JS_CRASH_DIAGNOSTICS= )
7168 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7169 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7173 MOZ_CHECK_COMPILER_WRAPPER
7175 dnl ========================================================
7176 dnl = Enable static checking using gcc-dehydra
7177 dnl ========================================================
7179 MOZ_ARG_WITH_STRING(static-checking,
7180 [ --with-static-checking=path/to/gcc_dehydra.so
7181 Enable static checking of code using GCC-dehydra],
7182 DEHYDRA_PATH=$withval,
7185 if test -n "$DEHYDRA_PATH"; then
7186 if test ! -f "$DEHYDRA_PATH"; then
7187 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7189 AC_DEFINE(NS_STATIC_CHECKING)
7191 AC_SUBST(DEHYDRA_PATH)
7193 dnl ========================================================
7194 dnl = Enable using the clang plugin to build
7195 dnl ========================================================
7197 MOZ_ARG_ENABLE_BOOL(clang-plugin,
7198 [ --enable-clang-plugin Enable building with the mozilla clang plugin ],
7199 ENABLE_CLANG_PLUGIN=1,
7200 ENABLE_CLANG_PLUGIN= )
7201 if test -n "$ENABLE_CLANG_PLUGIN"; then
7202 if test -z "$CLANG_CC"; then
7203 AC_MSG_ERROR([Can't use clang plugin without clang.])
7205 AC_DEFINE(MOZ_CLANG_PLUGIN)
7208 AC_SUBST(ENABLE_CLANG_PLUGIN)
7210 dnl ========================================================
7211 dnl = Enable stripping of libs & executables
7212 dnl ========================================================
7213 MOZ_ARG_ENABLE_BOOL(strip,
7214 [ --enable-strip Enable stripping of libs & executables ],
7218 dnl ========================================================
7219 dnl = Enable stripping of libs & executables when packaging
7220 dnl ========================================================
7221 MOZ_ARG_ENABLE_BOOL(install-strip,
7222 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7226 dnl ========================================================
7227 dnl = --enable-elf-dynstr-gc
7228 dnl ========================================================
7229 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7230 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7231 USE_ELF_DYNSTR_GC=1,
7232 USE_ELF_DYNSTR_GC= )
7234 dnl ========================================================
7235 dnl = --disable-elf-hack
7236 dnl ========================================================
7239 MOZ_ARG_DISABLE_BOOL(elf-hack,
7240 [ --disable-elf-hack Disable elf hacks],
7242 [USE_ELF_HACK=F # Force enable elf-hack])
7244 # Disable elf hack for profiling because the built in profiler
7245 # doesn't read the segments properly with elf hack. This is
7246 # temporary and should be fixed soon in the profiler.
7247 if test "$MOZ_PROFILING" = 1; then
7248 if test "$USE_ELF_HACK" = F; then
7249 AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
7254 # Only enable elfhack where supported
7255 if test "$USE_ELF_HACK" = 1; then
7256 case "${HOST_OS_ARCH},${OS_ARCH}" in
7258 case "${CPU_ARCH}" in
7273 if test -n "$USE_ELF_HACK"; then
7274 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7275 dnl memory addresses it maps to. The result is that by the time elfhack
7276 dnl kicks in, it is not possible to apply relocations because of that,
7277 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7278 dnl segment. It makes elfhack mostly useless, so considering the problems
7279 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7280 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7281 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
7282 dnl elfhack enabled, disable PT_GNU_RELRO instead.
7283 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7284 LINK_WITH_PT_GNU_RELRO,
7285 [echo "int main() {return 0;}" > conftest.${ac_ext}
7286 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7287 test -s conftest${ac_exeext}; then
7288 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7289 LINK_WITH_PT_GNU_RELRO=yes
7291 LINK_WITH_PT_GNU_RELRO=no
7294 dnl We really don't expect to get here, but just in case
7295 AC_ERROR([couldn't compile a simple C file])
7298 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7299 if test "$USE_ELF_HACK" = F; then
7300 AC_MSG_CHECKING([for -z norelro option to ld])
7301 _SAVE_LDFLAGS=$LDFLAGS
7302 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
7303 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
7304 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
7305 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.]))
7308 AC_MSG_WARN([Disabling elfhack])
7314 dnl ========================================================
7315 dnl = libstdc++ compatibility hacks
7316 dnl ========================================================
7319 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7320 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7323 if test -n "$STDCXX_COMPAT"; then
7324 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7325 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7326 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7329 dnl ========================================================
7331 dnl = Profiling and Instrumenting
7333 dnl ========================================================
7334 MOZ_ARG_HEADER(Profiling and Instrumenting)
7336 dnl ========================================================
7337 dnl = Enable runtime visual profiling logger
7338 dnl ========================================================
7339 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7340 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7341 MOZ_VISUAL_EVENT_TRACER=1,
7342 MOZ_VISUAL_EVENT_TRACER=)
7343 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7344 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7347 dnl ========================================================
7348 dnl Turn on reflow counting
7349 dnl ========================================================
7350 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7351 [ --enable-reflow-perf Enable reflow performance tracing],
7354 if test -n "$MOZ_REFLOW_PERF"; then
7355 AC_DEFINE(MOZ_REFLOW_PERF)
7358 dnl ========================================================
7359 dnl = Enable Radio Interface for B2G (Gonk usually)
7360 dnl ========================================================
7361 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7362 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7365 if test -n "$MOZ_B2G_RIL"; then
7366 AC_DEFINE(MOZ_B2G_RIL)
7368 AC_SUBST(MOZ_B2G_RIL)
7370 dnl ========================================================
7371 dnl = Enable Radio FM for B2G (Gonk usually)
7372 dnl ========================================================
7373 if test -n "$MOZ_B2G_FM"; then
7374 AC_DEFINE(MOZ_B2G_FM)
7376 AC_SUBST(MOZ_B2G_FM)
7378 dnl ========================================================
7379 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7380 dnl ========================================================
7381 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7382 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7385 if test -n "$MOZ_B2G_BT"; then
7386 AC_DEFINE(MOZ_B2G_BT)
7388 AC_SUBST(MOZ_B2G_BT)
7390 dnl ========================================================
7391 dnl = Enable Pico Speech Synthesis (Gonk usually)
7392 dnl ========================================================
7393 MOZ_ARG_ENABLE_BOOL(synth-pico,
7394 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
7397 if test -n "$MOZ_SYNTH_PICO"; then
7398 AC_DEFINE(MOZ_SYNTH_PICO)
7400 AC_SUBST(MOZ_SYNTH_PICO)
7402 dnl ========================================================
7403 dnl = Enable Support for Time Manager API
7404 dnl ========================================================
7405 if test -n "$MOZ_TIME_MANAGER"; then
7406 AC_DEFINE(MOZ_TIME_MANAGER)
7408 AC_SUBST(MOZ_TIME_MANAGER)
7410 dnl ========================================================
7411 dnl = Enable Camera Interface for B2G (Gonk usually)
7412 dnl ========================================================
7413 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7414 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7417 if test -n "$MOZ_B2G_CAMERA"; then
7418 AC_DEFINE(MOZ_B2G_CAMERA)
7420 AC_SUBST(MOZ_B2G_CAMERA)
7422 dnl ========================================================
7423 dnl = Enable Support B2G-specific changes to the NSS
7424 dnl = certificate trust database.
7425 dnl ========================================================
7426 if test -n "$MOZ_B2G_CERTDATA"; then
7427 AC_DEFINE(MOZ_B2G_CERTDATA)
7429 AC_SUBST(MOZ_B2G_CERTDATA)
7431 dnl ========================================================
7432 dnl = Enable Support for Payment API
7433 dnl ========================================================
7434 if test -n "$MOZ_PAY"; then
7439 dnl ========================================================
7440 dnl = Enable Support for AudioChannelManager API
7441 dnl ========================================================
7442 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7443 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7445 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7447 dnl ========================================================
7448 dnl = Support for demangling undefined symbols
7449 dnl ========================================================
7450 if test -z "$SKIP_LIBRARY_CHECKS"; then
7453 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7457 # Demangle only for debug or trace-malloc or DMD builds
7458 MOZ_DEMANGLE_SYMBOLS=
7459 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7460 MOZ_DEMANGLE_SYMBOLS=1
7461 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7463 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7465 dnl ========================================================
7466 dnl = Support for gcc stack unwinding (from gcc 3.3)
7467 dnl ========================================================
7468 if test -z "$SKIP_LIBRARY_CHECKS"; then
7469 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7472 dnl ========================================================
7474 dnl ========================================================
7476 MOZ_ARG_WITH_STRING(jitreport-granularity,
7477 [ --jitreport-granularity=N
7478 Default granularity at which to report JIT code
7481 1 - code ranges for whole functions only
7482 2 - per-line information
7483 3 - per-op information],
7484 JITREPORT_GRANULARITY=$withval,
7485 JITREPORT_GRANULARITY=3)
7487 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7489 dnl ========================================================
7493 dnl ========================================================
7494 MOZ_ARG_HEADER(Misc. Options)
7496 dnl ========================================================
7497 dnl update xterm title
7498 dnl ========================================================
7499 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7500 [ --enable-xterm-updates Update XTERM titles with current command.],
7504 dnl =========================================================
7506 dnl =========================================================
7507 MOZ_ARG_ENABLE_STRING([chrome-format],
7508 [ --enable-chrome-format=jar|flat|omni
7509 Select FORMAT of chrome files during packaging],
7510 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7512 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7513 MOZ_CHROME_FILE_FORMAT=jar
7516 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7517 AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7520 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7521 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7522 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7523 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7526 dnl =========================================================
7527 dnl Omnijar packaging (bug 552121)
7528 dnl =========================================================
7529 dnl Omnijar packaging is compatible with flat packaging.
7530 dnl In unpackaged builds, omnijar looks for files as if
7531 dnl things were flat packaged. After packaging, all files
7532 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7533 dnl is set to flat since putting files into jars is only
7534 dnl done during packaging with omnijar.
7535 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7537 AC_DEFINE(MOZ_OMNIJAR)
7539 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7540 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7541 MOZ_CHROME_FILE_FORMAT=flat
7543 MOZ_CHROME_FILE_FORMAT=symlink
7546 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7547 dnl Fennec's static resources live in the assets/ folder of the
7548 dnl APK. Adding a path to the name here works because we only
7549 dnl have one omnijar file in the final package (which is not the
7550 dnl case on desktop), and necessitates some contortions during
7551 dnl packaging so that the resources in the omnijar are considered
7552 dnl as rooted at / and not as rooted at assets/ (which again is
7553 dnl not the case on desktop: there are omnijars rooted at webrtc/,
7554 dnl etc). packager.mk handles changing the rooting of the single
7556 OMNIJAR_NAME=assets/omni.ja
7558 OMNIJAR_NAME=omni.ja
7561 AC_SUBST(OMNIJAR_NAME)
7562 AC_SUBST(MOZ_OMNIJAR)
7563 AC_SUBST(MOZ_PACKAGER_FORMAT)
7565 dnl ========================================================
7566 dnl = Define default location for MOZILLA_FIVE_HOME
7567 dnl ========================================================
7568 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7569 [ --with-default-mozilla-five-home
7570 Set the default value for MOZILLA_FIVE_HOME],
7571 [ val=`echo $withval`
7572 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7574 dnl ========================================================
7575 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7576 dnl ========================================================
7577 MOZ_ARG_WITH_STRING(user-appdir,
7578 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7579 [ val=`echo $withval`
7580 if echo "$val" | grep "\/" >/dev/null; then
7581 AC_MSG_ERROR("Homedir must be single relative path.")
7586 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7588 dnl ========================================================
7589 dnl = Doxygen configuration
7590 dnl ========================================================
7591 dnl Use commas to specify multiple dirs to this arg
7592 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7593 MOZ_ARG_WITH_STRING(doc-input-dirs,
7594 [ --with-doc-input-dirs=DIRS
7595 Header/idl dirs to create docs from],
7596 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7597 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7599 dnl Use commas to specify multiple dirs to this arg
7600 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7601 MOZ_ARG_WITH_STRING(doc-include-dirs,
7602 [ --with-doc-include-dirs=DIRS
7603 Include dirs to preprocess doc headers],
7604 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7605 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7607 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7608 MOZ_ARG_WITH_STRING(doc-output-dir,
7609 [ --with-doc-output-dir=DIR
7610 Dir to generate docs into],
7611 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7612 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7614 if test -z "$SKIP_COMPILER_CHECKS"; then
7615 dnl ========================================================
7617 dnl = Compiler Options
7619 dnl ========================================================
7620 MOZ_ARG_HEADER(Compiler Options)
7622 dnl ========================================================
7623 dnl Check for gcc -pipe support
7624 dnl ========================================================
7625 AC_MSG_CHECKING([for -pipe support])
7626 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7627 dnl Any gcc that supports firefox supports -pipe.
7628 CFLAGS="$CFLAGS -pipe"
7629 CXXFLAGS="$CXXFLAGS -pipe"
7630 AC_MSG_RESULT([yes])
7635 dnl ========================================================
7636 dnl Profile guided optimization (gcc checks)
7637 dnl ========================================================
7638 dnl Test for profiling options
7639 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7641 _SAVE_CFLAGS="$CFLAGS"
7642 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7644 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7645 AC_TRY_COMPILE([], [return 0;],
7646 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7647 result="yes" ], result="no")
7648 AC_MSG_RESULT([$result])
7650 if test $result = "yes"; then
7651 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7652 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7653 PROFILE_USE_LDFLAGS="-fprofile-use"
7656 CFLAGS="$_SAVE_CFLAGS"
7658 if test -n "$INTEL_CC"; then
7659 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7660 PROFILE_GEN_LDFLAGS=
7661 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7662 PROFILE_USE_LDFLAGS=
7665 dnl Sun Studio on Solaris
7666 if test "$SOLARIS_SUNPRO_CC"; then
7667 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7668 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7669 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7670 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7673 AC_SUBST(PROFILE_GEN_CFLAGS)
7674 AC_SUBST(PROFILE_GEN_LDFLAGS)
7675 AC_SUBST(PROFILE_USE_CFLAGS)
7676 AC_SUBST(PROFILE_USE_LDFLAGS)
7680 dnl ========================================================
7681 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7682 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7683 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7684 dnl ========================================================
7685 _SAVE_CXXFLAGS=$CXXFLAGS
7686 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7687 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7688 ac_nscap_nonconst_opeq_bug,
7697 template <class T, class U>
7698 int operator==(const Pointer<T>& rhs, U* lhs)
7700 return rhs.myPtr == lhs;
7703 template <class T, class U>
7704 int operator==(const Pointer<T>& rhs, const U* lhs)
7706 return rhs.myPtr == lhs;
7714 ac_nscap_nonconst_opeq_bug="no",
7715 ac_nscap_nonconst_opeq_bug="yes")])
7716 CXXFLAGS="$_SAVE_CXXFLAGS"
7718 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7719 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7721 fi # ! SKIP_COMPILER_CHECKS
7723 AC_DEFINE(CPP_THROW_NEW, [throw()])
7726 if test "$COMPILE_ENVIRONMENT"; then
7728 fi # COMPILE_ENVIRONMENT
7730 dnl ========================================================
7732 dnl = Build depencency options
7734 dnl ========================================================
7735 MOZ_ARG_HEADER(Build dependencies)
7737 if test "$GNU_CC" -a "$GNU_CXX"; then
7738 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7739 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7740 elif test "$SOLARIS_SUNPRO_CC"; then
7743 dnl Don't override this for MSVC
7744 if test -z "$_WIN32_MSVC"; then
7745 _USE_CPP_INCLUDE_FLAG=
7746 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7747 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7749 echo '#include <stdio.h>' > dummy-hello.c
7751 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7753 if test -z "$CL_INCLUDES_PREFIX"; then
7754 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7756 AC_SUBST(CL_INCLUDES_PREFIX)
7761 dnl ========================================================
7763 dnl = Static Build Options
7765 dnl ========================================================
7766 MOZ_ARG_HEADER(Static build options)
7768 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7769 if test "$OS_ARCH" = "WINNT"; then
7773 MOZ_ARG_ENABLE_BOOL(shared-js,
7774 [ --enable-shared-js
7775 Create a shared JavaScript library.],
7779 if test -n "$ENABLE_SHARED_JS"; then
7781 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7783 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7784 AC_DEFINE(MOZ_STATIC_JS)
7786 AC_SUBST(JS_SHARED_LIBRARY)
7788 AC_SUBST(LIBXUL_LIBS)
7789 XPCOM_LIBS="$LIBXUL_LIBS"
7791 dnl ========================================================
7793 dnl = Standalone module options
7795 dnl ========================================================
7796 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7799 dnl ========================================================
7801 if test -z "$SKIP_PATH_CHECKS"; then
7802 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7803 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7804 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7809 if test -z "${GLIB_GMODULE_LIBS}" \
7810 -a -n "${GLIB_CONFIG}"\
7811 -a "${GLIB_CONFIG}" != no\
7813 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7816 AC_SUBST(GLIB_CFLAGS)
7818 AC_SUBST(GLIB_GMODULE_LIBS)
7820 dnl ========================================================
7821 dnl Graphics checks.
7822 dnl ========================================================
7824 if test "${OS_TARGET}" = "WINNT"; then
7825 if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then
7826 MOZ_ENABLE_DIRECT2D1_1=1
7827 AC_SUBST(MOZ_ENABLE_DIRECT2D1_1)
7831 if test "${OS_TARGET}" = "WINNT" -o \
7832 "${OS_ARCH}" = "Darwin" -o \
7833 "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
7834 "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
7835 "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
7836 "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
7837 case "${target_cpu}" in
7849 MOZ_ARG_ENABLE_BOOL(skia,
7850 [ --enable-skia Enable use of Skia],
7854 if test "$USE_FC_FREETYPE"; then
7855 if test "$COMPILE_ENVIRONMENT"; then
7856 dnl ========================================================
7857 dnl = Check for freetype2 and its functionality
7858 dnl ========================================================
7859 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7861 if test "$_HAVE_FREETYPE2"; then
7863 _SAVE_CFLAGS="$CFLAGS"
7864 LIBS="$LIBS $FT2_LIBS"
7865 CFLAGS="$CFLAGS $FT2_CFLAGS"
7867 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7868 ac_cv_member_FT_Bitmap_Size_y_ppem,
7869 [AC_TRY_COMPILE([#include <ft2build.h>
7870 #include FT_FREETYPE_H],
7872 if (sizeof s.y_ppem) return 0;
7874 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7875 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7876 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7877 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7879 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7881 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7882 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7883 [FT_Bitmap_Size structure includes y_ppem field])
7885 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
7888 CFLAGS="$_SAVE_CFLAGS"
7891 _SAVE_CPPFLAGS="$CPPFLAGS"
7892 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7893 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7894 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7895 CPPFLAGS="$_SAVE_CPPFLAGS"
7897 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7900 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
7902 if test "$MOZ_PANGO"; then
7903 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
7904 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
7906 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
7907 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
7912 dnl ========================================================
7913 dnl Check for pixman and cairo
7914 dnl ========================================================
7917 MOZ_ARG_ENABLE_BOOL(system-cairo,
7918 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7923 MOZ_ARG_ENABLE_BOOL(system-pixman,
7924 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7926 MOZ_TREE_PIXMAN=force,
7929 # System cairo depends on system pixman
7930 if test "$MOZ_TREE_PIXMAN" = "force"; then
7931 if test -z "$MOZ_TREE_CAIRO"; then
7932 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7936 elif test -z "$MOZ_TREE_CAIRO"; then
7940 if test "$MOZ_TREE_PIXMAN"; then
7941 AC_DEFINE(MOZ_TREE_PIXMAN)
7942 MOZ_PIXMAN_CFLAGS=""
7943 MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
7945 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
7946 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
7947 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
7949 AC_SUBST(MOZ_PIXMAN_CFLAGS)
7950 AC_SUBST(MOZ_PIXMAN_LIBS)
7952 # Check for headers defining standard int types.
7953 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7955 if test "$MOZ_TREE_CAIRO"; then
7956 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7957 AC_DEFINE(MOZ_TREE_CAIRO)
7959 # For now we assume that we will have a uint64_t available through
7960 # one of the above headers or mozstdint.h.
7961 AC_DEFINE(HAVE_UINT64_T)
7963 # Define macros for cairo-features.h
7964 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
7965 if test "$MOZ_X11"; then
7966 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7967 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7968 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7969 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7970 MOZ_ENABLE_CAIRO_FT=1
7971 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7973 case "$MOZ_WIDGET_TOOLKIT" in
7975 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7978 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7979 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7980 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7983 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7984 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7985 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7986 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7987 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7988 MOZ_ENABLE_D2D_SURFACE=1
7989 MOZ_ENABLE_DWRITE_FONT=1
7991 WIN32_DWRITE_FONT_FEATURE=
7992 WIN32_D2D_SURFACE_FEATURE=
7995 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
7997 dnl D3D10 Layers depend on D2D Surfaces.
7998 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
7999 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8003 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8004 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8005 MOZ_ENABLE_CAIRO_FT=1
8006 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8007 CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8011 if test "$USE_FC_FREETYPE"; then
8012 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8014 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8015 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8016 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8017 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8018 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8019 AC_SUBST(CAIRO_FT_CFLAGS)
8021 AC_SUBST(PS_SURFACE_FEATURE)
8022 AC_SUBST(PDF_SURFACE_FEATURE)
8023 AC_SUBST(SVG_SURFACE_FEATURE)
8024 AC_SUBST(XLIB_SURFACE_FEATURE)
8025 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8026 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8027 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8028 AC_SUBST(WIN32_SURFACE_FEATURE)
8029 AC_SUBST(OS2_SURFACE_FEATURE)
8030 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8031 AC_SUBST(FT_FONT_FEATURE)
8032 AC_SUBST(FC_FONT_FEATURE)
8033 AC_SUBST(WIN32_FONT_FEATURE)
8034 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8035 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8036 AC_SUBST(QUARTZ_FONT_FEATURE)
8037 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8038 AC_SUBST(QT_SURFACE_FEATURE)
8039 AC_SUBST(TEE_SURFACE_FEATURE)
8041 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8042 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8044 if test "$MOZ_X11"; then
8045 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8048 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8050 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8051 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8052 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8053 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8054 if test "$MOZ_X11"; then
8055 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8056 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8057 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8058 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8062 AC_SUBST(MOZ_TREE_CAIRO)
8063 AC_SUBST(MOZ_CAIRO_CFLAGS)
8064 AC_SUBST(MOZ_CAIRO_LIBS)
8065 AC_SUBST(MOZ_CAIRO_OSLIBS)
8066 AC_SUBST(MOZ_TREE_PIXMAN)
8068 dnl ========================================================
8070 dnl ========================================================
8072 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8075 dnl ========================================================
8077 dnl ========================================================
8078 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8079 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8081 dnl ========================================================
8083 dnl ========================================================
8084 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8085 AC_SUBST(MOZ_GRAPHITE_LIBS)
8087 dnl ========================================================
8089 dnl ========================================================
8090 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8091 AC_SUBST(MOZ_OTS_LIBS)
8093 dnl ========================================================
8095 dnl ========================================================
8096 if test "$MOZ_ENABLE_SKIA"; then
8097 MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8098 AC_DEFINE(MOZ_ENABLE_SKIA)
8100 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8101 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8102 elif test "$OS_ARCH" = "WINNT"; then
8107 if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64"; then
8108 MOZ_ENABLE_SKIA_GPU=1
8109 AC_DEFINE(USE_SKIA_GPU)
8110 AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8115 AC_SUBST(MOZ_ENABLE_SKIA)
8116 AC_SUBST(MOZ_SKIA_LIBS)
8118 dnl ========================================================
8120 dnl ========================================================
8121 MOZ_ARG_DISABLE_BOOL(xul,
8122 [ --disable-xul Disable XUL],
8124 if test "$MOZ_XUL"; then
8127 dnl remove extensions that require XUL
8128 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8133 dnl ========================================================
8134 dnl disable profile locking
8135 dnl do no use this in applications that can have more than
8136 dnl one process accessing the profile directory.
8137 dnl ========================================================
8138 MOZ_ARG_DISABLE_BOOL(profilelocking,
8139 [ --disable-profilelocking
8140 Disable profile locking],
8141 MOZ_PROFILELOCKING=,
8142 MOZ_PROFILELOCKING=1 )
8143 if test "$MOZ_PROFILELOCKING"; then
8144 AC_DEFINE(MOZ_PROFILELOCKING)
8147 dnl ========================================================
8148 dnl necko configuration options
8149 dnl ========================================================
8152 dnl option to disable various necko protocols
8154 MOZ_ARG_ENABLE_STRING(necko-protocols,
8155 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8156 Enable/disable specific protocol handlers],
8157 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8158 if test "$option" = "yes" -o "$option" = "all"; then
8159 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8160 elif test "$option" = "no" -o "$option" = "none"; then
8162 elif test "$option" = "default"; then
8163 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8164 elif test `echo "$option" | grep -c \^-` != 0; then
8165 option=`echo $option | sed 's/^-//'`
8166 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8168 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8171 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8173 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8174 AC_SUBST(NECKO_PROTOCOLS)
8175 for p in $NECKO_PROTOCOLS; do
8176 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8177 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8181 dnl option to disable necko's wifi scanner
8184 case "$OS_TARGET" in
8186 if test -n "$gonkdir"; then
8199 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8200 [ --disable-necko-wifi Disable necko wifi scanner],
8204 if test "$NECKO_WIFI"; then
8205 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
8206 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
8208 AC_DEFINE(NECKO_WIFI)
8209 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8211 AC_SUBST(NECKO_WIFI)
8212 AC_SUBST(NECKO_WIFI_DBUS)
8215 dnl option to disable cookies
8217 MOZ_ARG_DISABLE_BOOL(cookies,
8218 [ --disable-cookies Disable cookie support],
8221 AC_SUBST(NECKO_COOKIES)
8222 if test "$NECKO_COOKIES"; then
8223 AC_DEFINE(NECKO_COOKIES)
8224 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8228 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8230 MOZ_ARG_DISABLE_BOOL(ctypes,
8231 [ --disable-ctypes Disable js-ctypes],
8234 AC_SUBST(BUILD_CTYPES)
8235 if test "$BUILD_CTYPES"; then
8236 AC_DEFINE(BUILD_CTYPES)
8239 dnl Build Places if required
8240 if test "$MOZ_PLACES"; then
8241 AC_DEFINE(MOZ_PLACES)
8244 dnl Build SocialAPI if required
8245 if test "$MOZ_SOCIAL"; then
8246 AC_DEFINE(MOZ_SOCIAL)
8249 dnl Build Common JS modules provided by services.
8250 AC_SUBST(MOZ_SERVICES_COMMON)
8251 if test -n "$MOZ_SERVICES_COMMON"; then
8252 AC_DEFINE(MOZ_SERVICES_COMMON)
8255 dnl Build Services crypto component (used by Sync)
8256 AC_SUBST(MOZ_SERVICES_CRYPTO)
8257 if test -n "$MOZ_SERVICES_CRYPTO"; then
8258 AC_DEFINE(MOZ_SERVICES_CRYPTO)
8261 dnl Build Firefox Health Reporter Service
8262 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8263 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8264 AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8267 dnl Build Services metrics component
8268 AC_SUBST(MOZ_SERVICES_METRICS)
8269 if test -n "$MOZ_SERVICES_METRICS"; then
8270 AC_DEFINE(MOZ_SERVICES_METRICS)
8273 dnl Build Notifications if required
8274 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8275 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8276 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8279 dnl Build Sync Services if required
8280 AC_SUBST(MOZ_SERVICES_SYNC)
8281 if test -n "$MOZ_SERVICES_SYNC"; then
8282 AC_DEFINE(MOZ_SERVICES_SYNC)
8285 dnl Build Captive Portal Detector if required
8286 AC_SUBST(MOZ_CAPTIVEDETECT)
8287 if test -n "$MOZ_CAPTIVEDETECT"; then
8288 AC_DEFINE(MOZ_CAPTIVEDETECT)
8291 dnl ========================================================
8292 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8293 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8296 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8297 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8300 if test "$MOZ_APP_COMPONENT_MODULES"; then
8301 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8304 dnl ========================================================
8306 dnl = Maintainer debug option (no --enable equivalent)
8308 dnl ========================================================
8313 AC_SUBST(AR_EXTRACT)
8317 AC_SUBST(AS_DASH_C_FLAG)
8326 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8327 AC_SUBST(MOZ_UPDATE_XTERM)
8328 AC_SUBST(MOZ_AUTH_EXTENSION)
8329 AC_SUBST(MOZ_PERMISSIONS)
8330 AC_SUBST(MOZ_PREF_EXTENSIONS)
8331 AC_SUBST(MOZ_JS_LIBS)
8333 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8334 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8335 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8336 AC_SUBST(MOZ_DEBUG_FLAGS)
8337 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8338 AC_SUBST(WARNINGS_AS_ERRORS)
8339 AC_SUBST(MOZ_EXTENSIONS)
8340 AC_SUBST(MOZ_JSDEBUGGER)
8341 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8344 AC_SUBST(MOZ_INSTRUMENTS)
8345 AC_SUBST(MOZ_CALLGRIND)
8347 AC_SUBST(MOZ_PROFILING)
8349 AC_SUBST(MOZ_PLACES)
8350 AC_SUBST(MOZ_SOCIAL)
8351 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8353 AC_SUBST(NS_PRINTING)
8355 AC_SUBST(MOZ_HELP_VIEWER)
8356 AC_SUBST(TOOLCHAIN_PREFIX)
8365 AC_SUBST(MOZ_PROFILELOCKING)
8367 AC_SUBST(ENABLE_TESTS)
8368 AC_SUBST(ENABLE_MARIONETTE)
8370 AC_SUBST(MOZ_UNIVERSALCHARDET)
8371 AC_SUBST(ACCESSIBILITY)
8372 AC_SUBST(MOZ_SPELLCHECK)
8373 AC_SUBST(MOZ_ANDROID_OMTC)
8374 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8375 AC_SUBST(MOZ_CRASHREPORTER)
8376 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8377 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8378 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8379 AC_SUBST(MOZ_STUB_INSTALLER)
8380 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8381 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8382 AC_SUBST(MOZ_UPDATER)
8383 AC_SUBST(MOZ_ANGLE_RENDERER)
8384 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8385 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8386 AC_SUBST(MOZ_D3DX9_VERSION)
8387 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8388 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8391 AC_SUBST(MOZ_ANDROID_HISTORY)
8392 AC_SUBST(MOZ_WEBSMS_BACKEND)
8393 AC_SUBST(MOZ_ANDROID_BEAM)
8394 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
8395 AC_SUBST(ENABLE_STRIP)
8396 AC_SUBST(PKG_SKIP_STRIP)
8397 AC_SUBST(STRIP_FLAGS)
8398 AC_SUBST(USE_ELF_DYNSTR_GC)
8399 AC_SUBST(USE_ELF_HACK)
8400 AC_SUBST(INCREMENTAL_LINKER)
8401 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8402 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8404 AC_SUBST(MOZ_FIX_LINK_PATHS)
8405 AC_SUBST(XPCOM_LIBS)
8406 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8407 AC_SUBST(XPCOM_GLUE_LDOPTS)
8408 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8409 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8410 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8412 AC_SUBST(USE_DEPENDENT_LIBS)
8414 AC_SUBST(MOZ_BUILD_ROOT)
8415 AC_SUBST(MOZ_OS2_TOOLS)
8417 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8418 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8419 AC_SUBST(MOZ_LINKER_EXTRACT)
8421 dnl ========================================================
8422 dnl = Mac bundle name prefix
8423 dnl ========================================================
8424 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8425 [ --with-macbundlename-prefix=prefix
8426 Prefix for MOZ_MACBUNDLE_NAME],
8427 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8429 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8430 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8431 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8434 if test "$MOZ_DEBUG"; then
8435 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8437 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8439 AC_SUBST(MOZ_MACBUNDLE_NAME)
8441 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8442 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8443 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8444 if test "$MOZ_DEBUG"; then
8445 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8448 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8449 AC_SUBST(MOZ_MACBUNDLE_ID)
8451 dnl ========================================================
8452 dnl = Child Process Name for IPC
8453 dnl ========================================================
8454 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8455 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8457 # We want to let Android unpack the file at install time, but it only does
8458 # so if the file is named libsomething.so. The lib/ path is also required
8459 # because the unpacked file will be under the lib/ subdirectory and will
8460 # need to be executed from that path.
8461 MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8463 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8465 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8466 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8468 # The following variables are available to branding and application
8469 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8470 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8471 # impacts profile location and user-visible fields.
8472 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8473 # versions of a given application (e.g. Aurora and Firefox both use
8474 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8475 # for application.ini's "Name" field, which controls profile location in
8476 # the absence of a "Profile" field (see below), and various system
8477 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8478 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8479 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8480 # builds (e.g. Aurora for Firefox).
8481 # - MOZ_APP_VERSION: Defines the application version number.
8482 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8483 # defaults to a lowercase form of MOZ_APP_BASENAME.
8484 # - MOZ_APP_PROFILE: When set, used for application.ini's
8485 # "Profile" field, which controls profile location.
8486 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8487 # crash reporter server url.
8488 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8489 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8491 if test -z "$MOZ_APP_NAME"; then
8492 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8495 # For extensions and langpacks, we require a max version that is compatible
8496 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8497 # 10.0a1 and 10.0a2 aren't affected
8498 # 10.0 becomes 10.0.*
8499 # 10.0.1 becomes 10.0.*
8500 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8501 if test -z "$IS_ALPHA"; then
8503 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8506 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8509 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8510 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8511 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8513 AC_SUBST(MOZ_APP_NAME)
8514 AC_SUBST(MOZ_APP_DISPLAYNAME)
8515 AC_SUBST(MOZ_APP_BASENAME)
8516 AC_SUBST(MOZ_APP_VENDOR)
8517 AC_SUBST(MOZ_APP_PROFILE)
8518 AC_SUBST(MOZ_APP_ID)
8519 AC_SUBST(MAR_CHANNEL_ID)
8520 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8521 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8522 AC_SUBST(MOZ_EXTENSION_MANAGER)
8523 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8524 AC_SUBST(MOZ_APP_UA_NAME)
8525 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8526 AC_SUBST(MOZ_APP_VERSION)
8527 AC_SUBST(MOZ_APP_MAXVERSION)
8528 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8529 AC_SUBST(FIREFOX_VERSION)
8530 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8531 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8532 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8535 AC_SUBST(MOZ_APP_STATIC_INI)
8537 AC_SUBST(MOZ_PKG_SPECIAL)
8539 AC_SUBST(MOZILLA_OFFICIAL)
8541 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8542 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8544 if test "$MOZ_TELEMETRY_REPORTING"; then
8545 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8547 # Enable Telemetry by default for nightly and aurora channels
8548 if test -z "$RELEASE_BUILD"; then
8549 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8553 dnl If we have any service that uploads data (and requires data submission
8554 dnl policy alert), set MOZ_DATA_REPORTING.
8555 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8556 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8557 MOZ_DATA_REPORTING=1
8558 AC_DEFINE(MOZ_DATA_REPORTING)
8559 AC_SUBST(MOZ_DATA_REPORTING)
8563 AC_SUBST(MOZ_BROWSE_INFO)
8564 AC_SUBST(MOZ_TOOLS_DIR)
8565 AC_SUBST(WIN32_REDIST_DIR)
8568 dnl Echo the CFLAGS to remove extra whitespace.
8574 $_WARNINGS_CXXFLAGS \
8577 COMPILE_CFLAGS=`echo \
8582 COMPILE_CXXFLAGS=`echo \
8583 $_DEFINES_CXXFLAGS \
8587 AC_SUBST(SYSTEM_LIBXUL)
8588 AC_SUBST(MOZ_NATIVE_JPEG)
8589 AC_SUBST(MOZ_NATIVE_PNG)
8590 AC_SUBST(MOZ_NATIVE_BZ2)
8592 AC_SUBST(MOZ_JPEG_CFLAGS)
8593 AC_SUBST(MOZ_JPEG_LIBS)
8594 AC_SUBST(MOZ_BZ2_CFLAGS)
8595 AC_SUBST(MOZ_BZ2_LIBS)
8596 AC_SUBST(MOZ_PNG_CFLAGS)
8597 AC_SUBST(MOZ_PNG_LIBS)
8599 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
8600 export MOZ_NUWA_PROCESS
8601 AC_DEFINE(MOZ_NUWA_PROCESS)
8603 AC_SUBST(MOZ_NUWA_PROCESS)
8605 AC_SUBST(NSPR_CFLAGS)
8607 AC_SUBST(MOZ_NATIVE_NSPR)
8609 AC_SUBST(NSS_CFLAGS)
8611 AC_SUBST(MOZ_NATIVE_NSS)
8612 AC_SUBST(NSS_DISABLE_DBM)
8615 OS_CXXFLAGS="$CXXFLAGS"
8616 OS_CPPFLAGS="$CPPFLAGS"
8617 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8618 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8619 OS_LDFLAGS="$LDFLAGS"
8622 AC_SUBST(OS_CXXFLAGS)
8623 AC_SUBST(OS_CPPFLAGS)
8624 AC_SUBST(OS_COMPILE_CFLAGS)
8625 AC_SUBST(OS_COMPILE_CXXFLAGS)
8626 AC_SUBST(OS_LDFLAGS)
8628 AC_SUBST(CROSS_COMPILE)
8629 AC_SUBST(WCHAR_CFLAGS)
8633 AC_SUBST(HOST_CFLAGS)
8634 AC_SUBST(HOST_CXXFLAGS)
8635 AC_SUBST(HOST_LDFLAGS)
8636 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8638 AC_SUBST(HOST_AR_FLAGS)
8640 AC_SUBST(HOST_RANLIB)
8641 AC_SUBST(HOST_NSPR_MDCPUCFG)
8642 AC_SUBST(HOST_BIN_SUFFIX)
8643 AC_SUBST(HOST_OS_ARCH)
8645 AC_SUBST(TARGET_CPU)
8646 AC_SUBST(TARGET_VENDOR)
8648 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8649 AC_SUBST(TARGET_MD_ARCH)
8650 AC_SUBST(TARGET_XPCOM_ABI)
8653 AC_SUBST(OS_RELEASE)
8656 AC_SUBST(INTEL_ARCHITECTURE)
8657 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
8658 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
8660 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8662 AC_SUBST(WRAP_LDFLAGS)
8665 AC_SUBST(MKSHLIB_FORCE_ALL)
8666 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8667 AC_SUBST(DSO_CFLAGS)
8668 AC_SUBST(DSO_PIC_CFLAGS)
8669 AC_SUBST(DSO_LDOPTS)
8670 AC_SUBST(LIB_PREFIX)
8671 AC_SUBST(DLL_PREFIX)
8672 AC_SUBST(DLL_SUFFIX)
8673 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8674 AC_SUBST(LIB_SUFFIX)
8675 AC_SUBST(OBJ_SUFFIX)
8676 AC_SUBST(BIN_SUFFIX)
8677 AC_SUBST(ASM_SUFFIX)
8678 AC_SUBST(IMPORT_LIB_SUFFIX)
8680 AC_SUBST(CC_VERSION)
8681 AC_SUBST(CXX_VERSION)
8682 AC_SUBST(MSMANIFEST_TOOL)
8683 AC_SUBST(NS_ENABLE_TSF)
8684 AC_SUBST(MOZ_NSS_PATCH)
8685 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8686 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8688 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8689 AC_SUBST(MOZ_SOUNDTOUCH)
8692 AC_SUBST(MOZ_VORBIS)
8693 AC_SUBST(MOZ_TREMOR)
8698 AC_SUBST(MOZ_DIRECTSHOW)
8699 AC_SUBST(MOZ_MEDIA_PLUGINS)
8700 AC_SUBST(MOZ_APPLEMEDIA)
8701 AC_SUBST(MOZ_OMX_PLUGIN)
8702 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8703 AC_SUBST(MOZ_VP8_ENCODER)
8707 AC_SUBST(VPX_ASFLAGS)
8708 AC_SUBST(VPX_DASH_C_FLAG)
8709 AC_SUBST(VPX_AS_CONVERSION)
8710 AC_SUBST(VPX_ASM_SUFFIX)
8711 AC_SUBST(VPX_X86_ASM)
8712 AC_SUBST(VPX_ARM_ASM)
8713 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8714 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8715 AC_SUBST(LIBJPEG_TURBO_AS)
8716 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8717 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8718 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8719 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8721 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8722 AC_SUBST(MOZ_FOLD_LIBS)
8724 AC_SUBST(MOZ_ENABLE_SZIP)
8725 AC_SUBST(MOZ_SZIP_FLAGS)
8727 AC_MSG_CHECKING([for posix_fallocate])
8728 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8729 #include <fcntl.h>],
8730 [posix_fallocate(0, 0, 0);],
8731 [ac_cv___posix_fallocate=true],
8732 [ac_cv___posix_fallocate=false])
8734 if test "$ac_cv___posix_fallocate" = true ; then
8735 AC_DEFINE(HAVE_POSIX_FALLOCATE)
8741 dnl Check for missing components
8742 if test "$COMPILE_ENVIRONMENT"; then
8743 if test "$MOZ_X11"; then
8744 if test "$WITHOUT_X11"; then
8745 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8747 dnl ====================================================
8748 dnl = Check if X headers exist
8749 dnl ====================================================
8750 _SAVE_CFLAGS=$CFLAGS
8751 CFLAGS="$CFLAGS $XCFLAGS"
8755 #include <X11/Xlib.h>
8756 #include <X11/Intrinsic.h>
8757 #include <X11/extensions/XShm.h>
8761 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8762 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8766 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8767 CFLAGS="$_SAVE_CFLAGS"
8769 if test -n "$MISSING_X"; then
8770 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8775 dnl Check for headers, etc. needed by WebGL.
8776 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8777 MOZ_CHECK_HEADER(GL/glx.h)
8778 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8779 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))])
8781 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8782 fi # COMPILE_ENVIRONMENT
8784 dnl Set various defines and substitutions
8785 dnl ========================================================
8787 if test "$OS_ARCH" = "Darwin"; then
8789 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8793 if test "$MOZ_DEBUG"; then
8794 AC_DEFINE(MOZ_REFLOW_PERF)
8795 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8798 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
8799 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8800 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8801 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8802 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8803 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8804 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8805 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8806 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8809 AC_SUBST(MOZILLA_VERSION)
8811 AC_SUBST(ac_configure_args)
8813 dnl Spit out some output
8814 dnl ========================================================
8816 dnl The following defines are used by xpcom
8817 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8819 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8820 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8821 HAVE_CPP_PARTIAL_SPECIALIZATION
8822 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8823 NEED_CPP_UNUSED_IMPLEMENTATIONS
8826 HAVE_ICONV_WITH_CONST_INPUT
8839 # FUTURE? Consider moving all these to moz.build files.
8841 netwerk/necko-config.h
8842 xpcom/xpcom-config.h
8843 xpcom/xpcom-private.h
8846 AC_SUBST(STLPORT_LIBS)
8848 export WRITE_MOZINFO=1
8849 AC_OUTPUT([mozilla-config.h])
8852 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8853 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8854 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8855 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8856 # (apparently) only need this hack when egrep's "pattern" is particularly long
8857 # (as in the following code) and the first egrep on our $PATH is Apple's. See
8861 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8868 # Generate Makefiles for WebRTC directly from .gyp files
8869 if test "${OS_TARGET}" = "WINNT"; then
8870 if test "$HAVE_64BIT_OS"; then
8875 EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
8877 elif test "${OS_TARGET}" = "Android"; then
8878 if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
8879 EXTRA_GYP_DEFINES="-G os=linux "
8881 EXTRA_GYP_DEFINES="-D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
8885 if test -n "$ARM_ARCH"; then
8886 if test "$ARM_ARCH" -lt 7; then
8887 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
8889 if test "${OS_TARGET}" = "Android"; then
8890 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=1 "
8892 dnl CPU detection for ARM works on Android only. armv7 always uses CPU detection, so
8893 dnl we have to set armv7=0 for non-Android target
8894 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
8899 # Keep libcubeb and audio_device backends in sync
8900 if test -n "$MOZ_ALSA"; then
8901 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=1"
8903 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=0"
8905 if test -n "$MOZ_PULSEAUDIO"; then
8906 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=1"
8908 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=0"
8911 # Don't try to compile ssse3/sse4.1 code if toolchain doesn't support
8912 if test -n "$INTEL_ARCHITECTURE"; then
8913 if test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSSE3" -o -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
8914 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
8918 if test -n "$MOZ_WEBRTC"; then
8919 AC_MSG_RESULT("generating WebRTC Makefiles...")
8921 if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
8922 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D build_with_gonk=1"
8925 dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
8926 dnl so that regeneration via dependencies works correctly
8927 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"
8929 if test -n HAVE_CLOCK_MONOTONIC; then
8930 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=1"
8932 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=0"
8935 if test -n "$MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI"; then
8936 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_ethtool_cmd_speed_hi=1"
8938 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_ethtool_cmd_speed_hi=0"
8941 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}"
8943 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8944 $GYP_WEBRTC_OPTIONS \
8945 --generator-output=${_objdir}/media/webrtc/trunk \
8946 ${srcdir}/media/webrtc/trunk/peerconnection.gyp
8947 if test "$?" != 0; then
8948 AC_MSG_ERROR([failed to generate WebRTC Makefiles])
8951 # XXX disable until we land the tranche with signaling
8952 if test -n "$MOZ_WEBRTC_SIGNALING"; then
8953 AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
8954 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8955 $GYP_WEBRTC_OPTIONS \
8956 -D build_for_test=0 \
8957 --generator-output=${_objdir}/media/webrtc/signaling \
8958 ${srcdir}/media/webrtc/signaling/signaling.gyp
8959 if test "$?" != 0; then
8960 AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
8963 AC_MSG_RESULT("generating WebRTC/SignalingTest Makefiles...")
8964 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8965 $GYP_WEBRTC_OPTIONS \
8966 -D build_for_test=1 \
8967 --generator-output=${_objdir}/media/webrtc/signalingtest \
8968 ${srcdir}/media/webrtc/signaling/signaling.gyp
8969 if test "$?" != 0; then
8970 AC_MSG_ERROR([failed to generate WebRTC/SignalingTest Makefiles])
8974 AC_MSG_RESULT("generating gtest Makefiles...")
8975 # Ok to pass some extra -D's that are ignored here
8976 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8977 $GYP_WEBRTC_OPTIONS \
8978 --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
8979 ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
8980 if test "$?" != 0; then
8981 AC_MSG_ERROR([failed to generate gtest Makefiles])
8984 AC_MSG_RESULT("generating nrappkit Makefiles...")
8985 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8986 $GYP_WEBRTC_OPTIONS \
8987 --generator-output=${_objdir}/media/mtransport/third_party/nrappkit \
8988 ${srcdir}/media/mtransport/third_party/nrappkit/nrappkit.gyp
8989 if test "$?" != 0; then
8990 AC_MSG_ERROR([failed to generate nrappkit Makefiles])
8993 AC_MSG_RESULT("generating nICEr Makefiles...")
8994 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8995 $GYP_WEBRTC_OPTIONS \
8996 --generator-output=${_objdir}/media/mtransport/third_party/nICEr \
8997 ${srcdir}/media/mtransport/third_party/nICEr/nicer.gyp
8998 if test "$?" != 0; then
8999 AC_MSG_ERROR([failed to generate nICEr Makefiles])
9003 # Run jemalloc configure script
9005 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
9006 ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
9007 if test -n "$MOZ_REPLACE_MALLOC"; then
9008 # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9009 ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9010 ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9012 if test -n "$MOZ_JEMALLOC3"; then
9013 case "${OS_ARCH}" in
9015 # We want jemalloc functions to be kept hidden on both Mac and Windows
9016 # See memory/build/mozmemory_wrap.h for details.
9017 ac_configure_args="$ac_configure_args --without-export"
9020 elif test "${OS_ARCH}" = Darwin; then
9021 # When building as a replace-malloc lib, disabling the zone allocator
9022 # forces to use pthread_atfork.
9023 ac_configure_args="$ac_configure_args --disable-zone-allocator"
9025 _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9027 if test -z "$MOZ_REPLACE_MALLOC"; then
9029 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9033 elif test -z "$MOZ_JEMALLOC3"; then
9035 JEMALLOC_WRAPPER=replace_
9037 if test -n "$MANGLE"; then
9039 if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
9040 JEMALLOC_WRAPPER=__wrap_
9042 for mangle in ${MANGLE}; do
9043 if test -n "$MANGLED"; then
9044 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9046 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9049 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9052 if test -z "$MOZ_TLS"; then
9053 ac_configure_args="$ac_configure_args --disable-tls"
9055 EXTRA_CFLAGS="$CFLAGS"
9056 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9057 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9059 if test "$CROSS_COMPILE"; then
9060 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9062 _save_cache_file="$cache_file"
9063 cache_file=$_objdir/memory/jemalloc/src/config.cache
9065 if ! test -e memory/jemalloc; then
9066 mkdir -p memory/jemalloc
9069 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9070 cache_file="$_save_cache_file"
9071 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9074 # Run freetype configure script
9076 if test "$MOZ_TREE_FREETYPE"; then
9077 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9078 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9079 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9080 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9081 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9082 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --without-png"
9084 if ! test -e modules; then
9088 AC_OUTPUT_SUBDIRS(modules/freetype2)
9091 if test -z "$direct_nspr_config"; then
9092 dnl ========================================================
9093 dnl = Setup a nice relatively clean build environment for
9094 dnl = sub-configures.
9095 dnl ========================================================
9098 CFLAGS="$_SUBDIR_CFLAGS"
9099 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9100 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9101 LDFLAGS="$_SUBDIR_LDFLAGS"
9102 HOST_CC="$_SUBDIR_HOST_CC"
9103 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9104 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9111 # Run all configure scripts specified by a subconfigure
9112 if test -n "$_subconfigure_subdir"; then
9113 _save_ac_configure_args="$ac_configure_args"
9114 ac_configure_args="$_subconfigure_config_args"
9115 AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
9116 ac_configure_args="$_save_ac_configure_args"
9119 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9120 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9124 if test -n "$_WRAP_MALLOC"; then
9125 # Avoid doubling wrap malloc arguments
9126 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9129 if test -z "$MOZ_NATIVE_NSPR"; then
9130 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9131 if test -z "$MOZ_DEBUG"; then
9132 ac_configure_args="$ac_configure_args --disable-debug"
9134 ac_configure_args="$ac_configure_args --enable-debug"
9136 if test "$MOZ_OPTIMIZE" = "1"; then
9137 ac_configure_args="$ac_configure_args --enable-optimize"
9138 elif test -z "$MOZ_OPTIMIZE"; then
9139 ac_configure_args="$ac_configure_args --disable-optimize"
9141 if test -n "$HAVE_64BIT_OS"; then
9142 ac_configure_args="$ac_configure_args --enable-64bit"
9144 if test -n "$USE_ARM_KUSER"; then
9145 ac_configure_args="$ac_configure_args --with-arm-kuser"
9147 ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9149 # Save these, so we can mess with them for the subconfigure ..
9150 _SAVE_CFLAGS="$CFLAGS"
9151 _SAVE_CPPFLAGS="$CPPFLAGS"
9152 _SAVE_LDFLAGS="$LDFLAGS"
9154 if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9155 # dladdr is supported by the new linker, even when the system linker doesn't
9156 # support it. Trick nspr into using dladdr when it's not supported.
9157 export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9159 export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9160 export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
9162 AC_OUTPUT_SUBDIRS(nsprpub)
9164 # .. and restore them
9168 CFLAGS="$_SAVE_CFLAGS"
9169 CPPFLAGS="$_SAVE_CPPFLAGS"
9170 LDFLAGS="$_SAVE_LDFLAGS"
9172 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9175 dnl ========================================================
9176 dnl = Setup a nice relatively clean build environment for
9177 dnl = sub-configures.
9178 dnl ========================================================
9181 CFLAGS="$_SUBDIR_CFLAGS"
9182 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9183 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9184 LDFLAGS="$_SUBDIR_LDFLAGS"
9185 HOST_CC="$_SUBDIR_HOST_CC"
9186 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9187 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9190 if test -n "$ENABLE_CLANG_PLUGIN"; then
9191 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9192 AC_OUTPUT_SUBDIRS(build/clang-plugin)
9196 # Run the SpiderMonkey 'configure' script.
9197 dist=$MOZ_BUILD_ROOT/dist
9198 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9199 ac_configure_args="$ac_configure_args --enable-threadsafe"
9201 MOZ_ARG_WITH_STRING(intl-api,
9202 [ --with-intl-api, --with-intl-api=build, --without-intl-api
9203 Determine the status of the ECMAScript Internationalization API. The first
9204 (or lack of any of these) builds and exposes the API. The second builds it
9205 but doesn't use ICU or expose the API to script. The third doesn't build
9207 WITH_INTL="--with-intl-api=$withval"
9209 if test -z "$WITH_INTL"; then
9210 if test "$MOZ_BUILD_APP" = "browser"; then
9211 WITH_INTL="--with-intl-api"
9213 # Internationalization isn't built or exposed by default in non-desktop
9214 # builds. Bugs to enable:
9216 # Android: bug 864843
9218 WITH_INTL="--without-intl-api"
9221 ac_configure_args="$ac_configure_args $WITH_INTL"
9223 if test "$BUILD_CTYPES"; then
9224 # Build js-ctypes on the platforms we can.
9225 ac_configure_args="$ac_configure_args --enable-ctypes"
9227 if test -z "$JS_SHARED_LIBRARY" ; then
9228 ac_configure_args="$ac_configure_args --disable-shared-js"
9229 if test -n "$MOZ_DISABLE_EXPORT_JS"; then
9230 ac_configure_args="$ac_configure_args --disable-export-js"
9233 if test -z "$MOZ_NATIVE_NSPR"; then
9234 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9235 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9237 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9238 ac_configure_args="$ac_configure_args --prefix=$dist"
9239 if test "$MOZ_MEMORY"; then
9240 ac_configure_args="$ac_configure_args --enable-jemalloc"
9242 if test -n "$MOZ_GLUE_LDFLAGS"; then
9243 export MOZ_GLUE_LDFLAGS
9245 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9246 export MOZ_GLUE_PROGRAM_LDFLAGS
9248 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9251 export MOZ_NATIVE_ZLIB
9252 export MOZ_ZLIB_CFLAGS
9253 export MOZ_ZLIB_LIBS
9255 export DONT_POPULATE_VIRTUALENV=1
9257 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9258 export STLPORT_CPPFLAGS
9259 export STLPORT_LDFLAGS
9261 export JS_STANDALONE=no
9264 if ! test -e js; then
9268 AC_OUTPUT_SUBDIRS(js/src)
9269 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9271 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR