2 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
3 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
4 dnl This Source Code Form is subject to the terms of the Mozilla Public
5 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
6 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 dnl Process this file with autoconf to produce a configure script.
9 dnl ========================================================
12 AC_INIT(config/config.mk)
13 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
15 TARGET_CPU="${target_cpu}"
16 TARGET_VENDOR="${target_vendor}"
17 TARGET_OS="${target_os}"
19 dnl ========================================================
21 dnl = Don't change the following two lines. Doing so breaks:
23 dnl = CFLAGS="-foo" ./configure
25 dnl ========================================================
27 CPPFLAGS="${CPPFLAGS=}"
28 CXXFLAGS="${CXXFLAGS=}"
30 HOST_CFLAGS="${HOST_CFLAGS=}"
31 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
32 HOST_LDFLAGS="${HOST_LDFLAGS=}"
34 dnl ========================================================
35 dnl = Preserve certain environment flags passed to configure
36 dnl = We want sub projects to receive the same flags
37 dnl = untainted by this configure script
38 dnl ========================================================
41 _SUBDIR_CFLAGS="$CFLAGS"
42 _SUBDIR_CPPFLAGS="$CPPFLAGS"
43 _SUBDIR_CXXFLAGS="$CXXFLAGS"
44 _SUBDIR_LDFLAGS="$LDFLAGS"
45 _SUBDIR_HOST_CC="$HOST_CC"
46 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
47 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
48 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
49 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
51 dnl Set the version number of the libs included with mozilla
52 dnl ========================================================
58 dnl Set the minimum version of toolkit libs used by mozilla
59 dnl ========================================================
66 WINDRES_VERSION=2.14.90
72 STARTUP_NOTIFICATION_VERSION=0.8
78 dnl Set various checks
79 dnl ========================================================
83 dnl Initialize the Pthread test variables early so they can be
84 dnl overridden by each platform.
85 dnl ========================================================
89 dnl Do not allow a separate objdir build if a srcdir build exists.
90 dnl ==============================================================
91 _topsrcdir=`cd \`dirname $0\`; pwd`
94 if test "$_topsrcdir" != "$_objdir"
96 # Check for a couple representative files in the source tree
98 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
99 if test -f $file; then
100 _conflict_files="$_conflict_files $file"
103 if test "$_conflict_files"; then
105 echo "* Your source tree contains these files:"
106 for file in $_conflict_files; do
110 * This indicates that you previously built in the source tree.
111 * A source tree build can confuse the separate objdir build.
113 * To clean up the source tree:
128 COMPILE_ENVIRONMENT=1
129 MOZ_ARG_DISABLE_BOOL(compile-environment,
130 [ --disable-compile-environment
131 Disable compiler/library checks.],
132 COMPILE_ENVIRONMENT= )
133 AC_SUBST(COMPILE_ENVIRONMENT)
135 MOZ_ARG_WITH_STRING(l10n-base,
136 [ --with-l10n-base=DIR path to l10n repositories],
137 L10NBASEDIR=$withval)
138 if test -n "$L10NBASEDIR"; then
139 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
140 AC_MSG_ERROR([--with-l10n-base must specify a path])
141 elif test -d "$L10NBASEDIR"; then
142 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
144 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
147 AC_SUBST(L10NBASEDIR)
149 dnl Check for Perl first -- needed for win32 SDK checks
150 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
151 if test -z "$PERL" -o "$PERL" = ":"; then
152 AC_MSG_ERROR([perl not found in \$PATH])
156 if test -n "$GAIADIR" ; then
157 AC_DEFINE(PACKAGE_GAIA)
160 MOZ_ARG_WITH_STRING(gonk,
162 location of gonk dir],
165 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
166 [ --with-gonk-toolchain-prefix=DIR
167 prefix to gonk toolchain commands],
168 gonk_toolchain_prefix=$withval)
170 if test -n "$gonkdir" ; then
171 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
172 android_source="$gonkdir"
173 ANDROID_SOURCE="$android_source"
174 ANDROID_NDK="${ANDROID_SOURCE}/ndk"
177 if test -n "${PLATFORM_SDK_VERSION}"; then
178 ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
182 TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
183 AS="$gonk_toolchain_prefix"as
184 CC="$gonk_toolchain_prefix"gcc
185 CXX="$gonk_toolchain_prefix"g++
186 CPP="$gonk_toolchain_prefix"cpp
187 LD="$gonk_toolchain_prefix"ld
188 AR="$gonk_toolchain_prefix"ar
189 RANLIB="$gonk_toolchain_prefix"ranlib
190 STRIP="$gonk_toolchain_prefix"strip
191 OBJCOPY="$gonk_toolchain_prefix"objcopy
193 if ! test -e "$gonkdir/ndk/sources/cxx-stl/stlport/src/iostream.cpp"; then
194 AC_MSG_ERROR([Couldn't find path to stlport sources in the gonk tree])
196 STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include"
197 STLPORT_LIBS="$_objdir/build/stlport/libstlport_static.a -static-libstdc++"
199 case "$target_cpu" in
208 case "$ANDROID_VERSION" in
210 GONK_INCLUDES="-I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/frameworks/base/include -I$gonkdir/frameworks/base/services/camera -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib -I$gonkdir/dalvik/libnativehelper/include/nativehelper"
214 AC_DEFINE(MOZ_OMX_DECODER)
215 AC_SUBST(MOZ_OMX_DECODER)
218 GONK_INCLUDES="-I$gonkdir/frameworks/native/include"
221 AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
224 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"
225 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
226 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
227 dnl Add -llog by default, since we use it all over the place.
230 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"
232 dnl prevent cross compile section from using these flags as host flags
233 if test -z "$HOST_CPPFLAGS" ; then
236 if test -z "$HOST_CFLAGS" ; then
239 if test -z "$HOST_CXXFLAGS" ; then
242 if test -z "$HOST_LDFLAGS" ; then
247 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
248 AC_SUBST(ANDROID_VERSION)
249 AC_DEFINE(HAVE_SYS_UIO_H)
250 AC_DEFINE(HAVE_PTHREADS)
252 MOZ_CHROME_FILE_FORMAT=omni
258 *-android*|*-linuxandroid*)
259 if test -z "$ANDROID_PACKAGE_NAME" ; then
260 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
262 MOZ_CHROME_FILE_FORMAT=omni
266 AC_PATH_PROG(OBJCOPY,objcopy)
271 AC_SUBST(ANDROID_SOURCE)
272 AC_SUBST(ANDROID_PACKAGE_NAME)
275 dnl ========================================================
276 dnl Checks for compilers.
277 dnl ========================================================
278 dnl Set CROSS_COMPILE in the environment when running configure
279 dnl to use the cross-compile setup for now
280 dnl ========================================================
282 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
285 if test "$COMPILE_ENVIRONMENT"; then
287 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
288 echo "cross compiling from $host to $target"
292 _SAVE_CFLAGS="$CFLAGS"
293 _SAVE_LDFLAGS="$LDFLAGS"
295 AC_MSG_CHECKING([for host c compiler])
296 AC_CHECK_PROGS(HOST_CC, $HOST_CC cc gcc /usr/ucb/cc cl icc, "")
297 if test -z "$HOST_CC"; then
298 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
300 AC_MSG_RESULT([$HOST_CC])
301 AC_MSG_CHECKING([for host c++ compiler])
302 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
303 if test -z "$HOST_CXX"; then
304 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
306 AC_MSG_RESULT([$HOST_CXX])
308 if test -z "$HOST_CFLAGS"; then
309 HOST_CFLAGS="$CFLAGS"
311 if test -z "$HOST_CXXFLAGS"; then
312 HOST_CXXFLAGS="$CXXFLAGS"
314 if test -z "$HOST_LDFLAGS"; then
315 HOST_LDFLAGS="$LDFLAGS"
317 if test -z "$HOST_AR_FLAGS"; then
318 HOST_AR_FLAGS="$AR_FLAGS"
320 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
321 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
323 CFLAGS="$HOST_CFLAGS"
324 LDFLAGS="$HOST_LDFLAGS"
326 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
327 AC_TRY_COMPILE([], [return(0);],
328 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
329 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
332 CFLAGS="$HOST_CXXFLAGS"
334 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
335 AC_TRY_COMPILE([], [return(0);],
336 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
337 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
341 LDFLAGS=$_SAVE_LDFLAGS
343 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
346 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
350 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
351 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
352 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
353 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
354 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
355 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
356 AC_DEFINE(CROSS_COMPILE)
361 # Work around the conftest.exe access problem on Windows
366 MOZ_PATH_PROGS(AS, $AS as, $CC)
367 AC_CHECK_PROGS(AR, ar, :)
368 AC_CHECK_PROGS(LD, ld, :)
369 AC_CHECK_PROGS(STRIP, strip, :)
370 AC_CHECK_PROGS(WINDRES, windres, :)
371 if test -z "$HOST_CC"; then
374 if test -z "$HOST_CFLAGS"; then
375 HOST_CFLAGS="$CFLAGS"
377 if test -z "$HOST_CXX"; then
380 if test -z "$HOST_CXXFLAGS"; then
381 HOST_CXXFLAGS="$CXXFLAGS"
383 if test -z "$HOST_LDFLAGS"; then
384 HOST_LDFLAGS="$LDFLAGS"
386 if test -z "$HOST_RANLIB"; then
387 HOST_RANLIB="$RANLIB"
389 if test -z "$HOST_AR"; then
392 if test -z "$HOST_AR_FLAGS"; then
393 HOST_AR_FLAGS="$AR_FLAGS"
397 if test -n "$MOZ_WINCONSOLE"; then
398 AC_DEFINE(MOZ_WINCONSOLE)
403 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
404 if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
405 test "$GCC_MAJOR_VERSION" -lt 4; then
406 AC_MSG_ERROR([Only GCC 4.4 or newer supported])
410 dnl ========================================================
411 dnl Special win32 checks
412 dnl ========================================================
414 MOZ_ARG_ENABLE_BOOL(metro,
415 [ --enable-metro Enable Windows Metro build targets],
418 if test -n "$MOZ_METRO"; then
420 # Target the Windows 8 Kit
423 # toolkit/library/makefile.in needs these, see nsDllMain.
425 CRTEXPDLLVERSION=1-1-0
427 # Target the Windows 7 SDK by default
432 AC_SUBST(CRTDLLVERSION)
433 AC_SUBST(CRTEXPDLLVERSION)
435 MOZ_ARG_WITH_STRING(windows-version,
436 [ --with-windows-version=WINSDK_TARGETVER
437 Windows SDK version to target. Lowest version
438 currently allowed is 601 (Win7), highest is 602 (Win8)],
439 WINSDK_TARGETVER=$withval)
441 # Currently only two sdk versions allowed, 601 and 602
442 case "$WINSDK_TARGETVER" in
444 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
448 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
454 if test "$GCC" != "yes" -a -z "$CLANG_CC"; then
455 # Check to see if we are really running in a msvc environemnt
457 AC_CHECK_PROGS(MIDL, midl)
459 # Make sure compilers are valid
460 CFLAGS="$CFLAGS -TC -nologo"
461 CXXFLAGS="$CXXFLAGS -TP -nologo"
464 AC_TRY_COMPILE([#include <stdio.h>],
465 [ printf("Hello World\n"); ],,
466 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
469 AC_TRY_COMPILE([#include <new.h>],
470 [ unsigned *test = new unsigned(42); ],,
471 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
475 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
478 # Determine compiler version
479 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
480 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
481 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
482 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
483 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
484 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
486 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
487 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
489 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
490 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
493 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
494 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
496 if test "$_CC_MAJOR_VERSION" = "16"; then
499 elif test "$_CC_MAJOR_VERSION" = "17"; then
502 elif test "$_CC_MAJOR_VERSION" = "18"; then
506 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
509 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
511 if test -n "$WIN32_REDIST_DIR"; then
512 if test ! -d "$WIN32_REDIST_DIR"; then
513 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
515 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
518 dnl Confirm we have the pri tools on win8 builds
519 if test -n "$MOZ_METRO"; then
520 AC_MSG_CHECKING([for makepri])
521 AC_CHECK_PROGS(MAKEPRI, makepri, "")
522 if test -z "MAKEPRI" ; then
523 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
528 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
529 dnl not something else like "magnetic tape manipulation utility".
530 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
531 if test -z "$MSMT_TOOL"; then
532 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
536 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
538 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
539 if test -z "$MSMANIFEST_TOOL_VERSION"; then
540 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
546 # Check linker version
547 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
548 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
549 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
550 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
556 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
557 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
558 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
559 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
560 # Add flags if necessary
561 AC_MSG_CHECKING([for midl flags])
564 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
565 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
566 # MIDL version 7.00.0500 or later has no problem.
567 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
568 AC_MSG_RESULT([need -env win32])
570 AC_MSG_RESULT([none needed])
574 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
577 AC_MSG_RESULT([none needed])
581 unset _MSVC_VER_FILTER
583 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
587 _SAVE_CXXFLAGS="$CXXFLAGS"
588 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
589 AC_TRY_COMPILE([#include <exception>],
590 [std::_Throw(std::exception()); return 0;],
591 ac_cv_have_std__Throw="yes",
592 ac_cv_have_std__Throw="no")
593 CXXFLAGS="$_SAVE_CXXFLAGS"
597 if test "$ac_cv_have_std__Throw" = "yes"; then
598 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
599 ac_cv_have_dllimport_exception_bug,
603 _SAVE_CXXFLAGS="$CXXFLAGS"
604 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
605 AC_TRY_LINK([#include <vector>],
606 [std::vector<int> v; return v.at(1);],
607 ac_cv_have_dllimport_exception_bug="no",
608 ac_cv_have_dllimport_exception_bug="yes")
609 CXXFLAGS="$_SAVE_CXXFLAGS"
612 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
614 MOZ_MSVC_STL_WRAP__Throw=1
615 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
618 AC_CACHE_CHECK(for overridable _RAISE,
623 _SAVE_CXXFLAGS="$CXXFLAGS"
624 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
625 AC_TRY_COMPILE([#include <xstddef>
627 #define _RAISE(x) externallyDefinedFunction((x).what())
630 [std::vector<int> v; return v.at(1);],
631 ac_cv_have__RAISE="no",
632 ac_cv_have__RAISE="yes")
633 CXXFLAGS="$_SAVE_CXXFLAGS"
636 if test "$ac_cv_have__RAISE" = "yes"; then
638 MOZ_MSVC_STL_WRAP__RAISE=1
639 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
641 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
645 if test "$WRAP_STL_INCLUDES" = "1"; then
646 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
648 elif test -z "$CLANG_CC"; then
649 # Check w32api version
650 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
651 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
652 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
653 AC_TRY_COMPILE([#include <w32api.h>],
654 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
655 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
656 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
657 #error "test failed."
659 , [ res=yes ], [ res=no ])
660 AC_MSG_RESULT([$res])
661 if test "$res" != "yes"; then
662 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
664 # Check windres version
665 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
666 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
667 AC_MSG_RESULT([$_WINDRES_VERSION])
668 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
669 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
670 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
671 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
672 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
673 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
674 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
675 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
676 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
677 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
678 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
679 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
681 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
684 AC_CHECK_PROGS(MIDL, $target-widl widl)
685 if test -n "$MIDL"; then
688 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
691 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
696 MOZ_WINSDK_MAXVER=0x06020000
700 if test "$GCC" != "yes" -o -n "$CLANG_CC" ; then
701 MOZ_FIND_WINSDK_VERSION
704 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
705 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
706 # Require OS features provided by IE 6.0 SP2 (XP SP2)
707 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
709 # If the maximum version supported by this SDK is lower than the target
711 AC_MSG_CHECKING([for Windows SDK being recent enough])
712 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
716 AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
719 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
720 # Definitions matching sdkddkver.h
721 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
722 AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
723 AC_SUBST(MOZ_WINSDK_MAXVER)
730 if test -n "$_WIN32_MSVC"; then
732 SKIP_COMPILER_CHECKS=1
733 SKIP_LIBRARY_CHECKS=1
735 # Since we're skipping compiler and library checks, hard-code
738 AC_DEFINE(HAVE_SETBUF)
739 AC_DEFINE(HAVE_ISATTY)
742 fi # COMPILE_ENVIRONMENT
755 AC_SUBST(WRAP_STL_INCLUDES)
756 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
757 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
759 dnl ========================================================
760 dnl Checks for programs.
761 dnl ========================================================
765 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
766 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
767 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
769 AC_MSG_RESULT([$_perl_version])
771 if test "$_perl_res" != 0; then
772 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
776 AC_MSG_CHECKING([for full perl installation])
777 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
779 if test "$_perl_res" != 0; then
781 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
786 MOZ_ARG_WITH_BOOL(system-ply,
787 [ --with-system-ply Use system installed python ply library],
788 [if $PYTHON -c 'import ply' 2>&5; then
791 AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
794 AC_SUBST(MOZ_SYSTEM_PLY)
796 if test -z "$COMPILE_ENVIRONMENT"; then
797 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
799 AC_SUBST(NSINSTALL_BIN)
801 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
802 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
803 MOZ_PATH_PROGS(UNZIP, unzip)
804 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
805 AC_MSG_ERROR([unzip not found in \$PATH])
807 MOZ_PATH_PROGS(ZIP, zip)
808 if test -z "$ZIP" -o "$ZIP" = ":"; then
809 AC_MSG_ERROR([zip not found in \$PATH])
811 MOZ_PATH_PROG(XARGS, xargs)
812 if test -z "$XARGS" -o "$XARGS" = ":"; then
813 AC_MSG_ERROR([xargs not found in \$PATH .])
816 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
819 if test "$COMPILE_ENVIRONMENT"; then
821 dnl ========================================================
822 dnl = Mac OS X toolchain support
823 dnl ========================================================
825 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
826 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
827 dnl when we can run target binaries.
828 AC_SUBST(UNIVERSAL_BINARY)
829 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
831 MOZ_ARG_WITH_STRING(unify-dist,
832 [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
834 if test -n "$UNIVERSAL_BINARY"; then
835 if test -z "$UNIFY_DIST"; then
836 AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
838 case "$UNIFY_DIST" in
842 UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
848 dnl ========================================================
849 dnl Check for MacOS deployment target version
850 dnl ========================================================
852 MOZ_ARG_ENABLE_STRING(macos-target,
853 [ --enable-macos-target=VER (default=10.6)
854 Set the minimum MacOS version needed at runtime],
855 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
859 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
860 dnl Use the specified value
861 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
863 dnl No value specified on the command line or in the environment,
864 dnl use architecture minimum.
865 export MACOSX_DEPLOYMENT_TARGET=10.6
870 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
872 dnl ========================================================
873 dnl = Mac OS X SDK support
874 dnl ========================================================
877 MOZ_ARG_WITH_STRING(macos-sdk,
878 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
879 MACOS_SDK_DIR=$withval)
881 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
882 dnl NEXT_ROOT will be set and exported only if it's needed.
883 AC_SUBST(MACOS_SDK_DIR)
886 if test "$MACOS_SDK_DIR"; then
887 dnl Sync this section with the ones in NSPR and NSS.
888 dnl Changes to the cross environment here need to be accounted for in
889 dnl the libIDL checks (below) and xpidl build.
891 if test ! -d "$MACOS_SDK_DIR"; then
892 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
893 specify a valid SDK. SDKs are installed when the optional cross-development
894 tools are selected during the Xcode/Developer Tools installation.])
897 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
898 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
900 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
901 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
902 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
905 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
907 AC_TRY_COMPILE([#include <new>],[],
911 AC_MSG_RESULT($result)
913 if test "$result" = "no" ; then
914 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
918 fi # COMPILE_ENVIRONMENT
920 AC_MSG_CHECKING([compiler version])
921 # Just print it so it shows up in the logs.
922 cc_version=$($CC --version)
923 AC_MSG_RESULT([$cc_version])
925 if test -n "$MAKE"; then
926 if test `echo $MAKE | grep -c make.py` != 1; then
933 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
936 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
939 if test "$GMAKE" = ":"; then
940 AC_MSG_ERROR([GNU make not found])
944 if test -z "$MAKE"; then
948 if test "$COMPILE_ENVIRONMENT"; then
954 fi # COMPILE_ENVIRONMENT
956 dnl ========================================================
957 dnl set the defaults first
958 dnl ========================================================
974 MOZ_USER_DIR=".mozilla"
977 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
979 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
981 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
983 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
984 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
985 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxul -lxpcom_core -lmozalloc'
986 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
987 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxul -lmozalloc'
988 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)'
989 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
990 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
992 # These are specially defined on Windows only
995 XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
996 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
999 XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
1000 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
1006 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1008 USE_DEPENDENT_LIBS=1
1010 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1012 if test -n "$CROSS_COMPILE"; then
1013 OS_TARGET="${target_os}"
1014 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1016 case "${target_os}" in
1017 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1018 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1019 gnu*) OS_ARCH=GNU ;;
1020 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1021 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
1022 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1025 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1028 OS_TARGET=`uname -s`
1029 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1030 OS_RELEASE=`uname -r`
1033 # Before this used `uname -m` when not cross compiling
1034 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1035 OS_TEST="${target_cpu}"
1037 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1039 #######################################################################
1040 # Master "Core Components" macros for getting the OS target #
1041 #######################################################################
1044 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1045 # cross-compilation.
1049 # Define and override various archtecture-specific variables, including
1058 case "$HOST_OS_ARCH" in
1072 if test -z "$GNU_CC"; then
1073 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1078 if test -z "$GNU_CXX"; then
1079 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1080 SOLARIS_SUNPRO_CXX=1
1083 AC_SUBST(SOLARIS_SUNPRO_CC)
1084 AC_SUBST(SOLARIS_SUNPRO_CXX)
1093 if test -z "$CROSS_COMPILE" ; then
1099 # If uname -s returns "Windows_NT", we assume that we are using
1100 # the uname.exe in MKS toolkit.
1102 # The -r option of MKS uname only returns the major version number.
1103 # So we need to use its -v option to get the minor version number.
1104 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1108 OS_MINOR_RELEASE=`uname -v`
1109 if test "$OS_MINOR_RELEASE" = "00"; then
1112 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1116 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1117 # the uname.exe in the MSYS tools.
1119 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1124 OS_RELEASE=`uname -v`.`uname -r`
1125 OS_TEST=${target_cpu}
1130 OS_RELEASE=`uname -v`
1133 case "${target_cpu}" in
1144 if test -z "$CROSS_COMPILE" ; then
1152 # Only set CPU_ARCH if we recognize the value of OS_TEST
1163 powerpc | ppc | rs6000)
1167 Alpha | alpha | ALPHA)
1200 if test -z "$OS_TARGET"; then
1203 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1205 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1206 dnl ===============================================================
1210 INTEL_ARCHITECTURE=1
1213 dnl Configure platform-specific CPU architecture compiler options.
1214 dnl ==============================================================
1217 dnl =================================================================
1218 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1219 dnl which is bad when cross compiling.
1220 dnl =================================================================
1221 if test "$COMPILE_ENVIRONMENT"; then
1222 configure_static_assert_macros='
1223 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1224 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1225 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1228 dnl test that the macros actually work:
1229 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1230 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1233 ac_cv_static_assertion_macros_work="yes"
1234 AC_TRY_COMPILE([$configure_static_assert_macros],
1235 [CONFIGURE_STATIC_ASSERT(1)],
1237 ac_cv_static_assertion_macros_work="no")
1238 AC_TRY_COMPILE([$configure_static_assert_macros],
1239 [CONFIGURE_STATIC_ASSERT(0)],
1240 ac_cv_static_assertion_macros_work="no",
1243 AC_TRY_COMPILE([$configure_static_assert_macros],
1244 [CONFIGURE_STATIC_ASSERT(1)],
1246 ac_cv_static_assertion_macros_work="no")
1247 AC_TRY_COMPILE([$configure_static_assert_macros],
1248 [CONFIGURE_STATIC_ASSERT(0)],
1249 ac_cv_static_assertion_macros_work="no",
1253 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1254 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1255 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1257 fi # COMPILE_ENVIRONMENT
1259 dnl ========================================================
1260 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1262 dnl ========================================================
1266 dnl ========================================================
1267 dnl Suppress Clang Argument Warnings
1268 dnl ========================================================
1269 if test -n "$CLANG_CC"; then
1270 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1271 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1273 if test -n "$CLANG_CXX"; then
1274 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1277 dnl ========================================================
1278 dnl = Use Address Sanitizer
1279 dnl ========================================================
1280 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1281 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1284 if test -n "$MOZ_ASAN"; then
1290 dnl ========================================================
1291 dnl = Enable hacks required for LLVM instrumentations
1292 dnl ========================================================
1293 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1294 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1297 if test -n "$MOZ_LLVM_HACKS"; then
1301 AC_SUBST(MOZ_NO_WLZDEFS)
1302 AC_SUBST(MOZ_CFLAGS_NSS)
1304 dnl ========================================================
1305 dnl GNU specific defaults
1306 dnl ========================================================
1307 if test "$GNU_CC"; then
1308 # Per bug 719659 comment 2, some of the headers on ancient build machines
1309 # may require gnu89 inline semantics. But otherwise, we use C99.
1310 CFLAGS="$CFLAGS -std=gnu99 -fgnu89-inline"
1311 # FIXME: Let us build with strict aliasing. bug 414641.
1312 CFLAGS="$CFLAGS -fno-strict-aliasing"
1313 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1314 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1315 DSO_LDOPTS='-shared'
1316 if test "$GCC_USE_GNU_LD"; then
1317 # Some tools like ASan use a runtime library that is only
1318 # linked against executables, so we must allow undefined
1319 # symbols for shared objects in some cases.
1320 if test -z "$MOZ_NO_WLZDEFS"; then
1321 # Don't allow undefined symbols in libraries
1322 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1325 WARNINGS_AS_ERRORS='-Werror'
1326 # Don't treat -Wuninitialized as error b/c it has lots of false positives.
1327 WARNINGS_AS_ERRORS="$WARNINGS_AS_ERRORS -Wno-error=uninitialized"
1328 # Don't treat -Wdeprecated-declarations as error b/c we don't want our
1329 # builds held hostage when a platform-specific API is suddenly deprecated.
1330 WARNINGS_AS_ERRORS="$WARNINGS_AS_ERRORS -Wno-error=deprecated-declarations"
1332 DSO_PIC_CFLAGS='-fPIC'
1333 ASFLAGS="$ASFLAGS -fPIC"
1334 AC_MSG_CHECKING([for --noexecstack option to as])
1335 _SAVE_CFLAGS=$CFLAGS
1336 CFLAGS="$CFLAGS -Wa,--noexecstack"
1337 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1338 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1339 AC_MSG_RESULT([no]))
1340 CFLAGS=$_SAVE_CFLAGS
1341 AC_MSG_CHECKING([for -z noexecstack option to ld])
1342 _SAVE_LDFLAGS=$LDFLAGS
1343 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1344 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1346 LDFLAGS=$_SAVE_LDFLAGS)
1348 AC_MSG_CHECKING([for -z text option to ld])
1349 _SAVE_LDFLAGS=$LDFLAGS
1350 LDFLAGS="$LDFLAGS -Wl,-z,text"
1351 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1352 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1354 LDFLAGS=$_SAVE_LDFLAGS)
1356 AC_MSG_CHECKING([for --build-id option to ld])
1357 _SAVE_LDFLAGS=$LDFLAGS
1358 LDFLAGS="$LDFLAGS -Wl,--build-id"
1359 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1360 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1362 LDFLAGS=$_SAVE_LDFLAGS)
1365 # Check for -mssse3 on $CC
1366 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1367 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1368 _SAVE_CFLAGS=$CFLAGS
1369 CFLAGS="$CFLAGS -mssse3"
1370 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1371 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1372 AC_MSG_RESULT([no]))
1373 CFLAGS=$_SAVE_CFLAGS
1374 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
1376 # Check for -msse4.1 on $CC
1377 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1378 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1379 _SAVE_CFLAGS=$CFLAGS
1380 CFLAGS="$CFLAGS -msse4.1"
1381 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1382 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1383 AC_MSG_RESULT([no]))
1384 CFLAGS=$_SAVE_CFLAGS
1385 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
1387 # Turn on GNU-specific warnings:
1388 # -Wall - turn on a lot of warnings
1389 # -Wpointer-arith - good to have
1390 # -Wdeclaration-after-statement - MSVC doesn't like these
1391 # -Werror=return-type - catches missing returns, zero false positives
1392 # -Wtype-limits - catches overflow bugs, few false positives
1393 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1394 # -Wsign-compare - catches comparison of signed and unsigned types
1396 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1397 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1398 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1399 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1400 MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1402 # Turn off the following warnings that -Wall turns on:
1403 # -Wno-unused - lots of violations in third-party code
1405 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1407 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1408 # Don't use -Wcast-align with ICC or clang
1410 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1411 hppa | ia64 | sparc | arm)
1414 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1419 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1420 _USE_CPP_INCLUDE_FLAG=1
1421 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1423 elif test "$SOLARIS_SUNPRO_CC"; then
1425 if test "$CPU_ARCH" = "sparc"; then
1426 # for Sun Studio on Solaris/SPARC
1427 DSO_PIC_CFLAGS='-xcode=pic32'
1429 DSO_PIC_CFLAGS='-KPIC'
1431 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1433 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1434 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1436 DSO_LDOPTS='-shared'
1437 if test "$GNU_LD"; then
1438 # Don't allow undefined symbols in libraries
1439 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1443 DSO_PIC_CFLAGS='-KPIC'
1444 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1447 if test "$GNU_CXX"; then
1448 # FIXME: Let us build with strict aliasing. bug 414641.
1449 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1451 # Turn on GNU-specific warnings:
1452 # -Wall - turn on a lot of warnings
1453 # -Wpointer-arith - good to have
1454 # -Woverloaded-virtual - ???
1455 # -Werror=return-type - catches missing returns, zero false positives
1456 # -Wtype-limits - catches overflow bugs, few false positives
1457 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1458 # -Wsign-compare - catches comparison of signed and unsigned types
1460 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1461 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1462 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1463 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1464 MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1466 # Turn off the following warnings that -Wall turns on:
1467 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1469 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1471 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1472 # Don't use -Wcast-align with ICC or clang
1474 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1475 hppa | ia64 | sparc | arm)
1478 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1483 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1484 _USE_CPP_INCLUDE_FLAG=1
1486 # Recent clang and gcc support C++11 deleted functions without warnings if
1487 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1488 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1489 # unused. But clang's warning can be disabled, so when compiling with clang
1490 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1491 # deleted function syntax.
1492 if test "$CLANG_CXX"; then
1493 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1494 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1498 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1501 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1502 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1503 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1504 dnl normal behavior.
1505 dnl ========================================================
1507 MKSHLIB_UNFORCE_ALL=
1509 if test "$COMPILE_ENVIRONMENT"; then
1510 if test "$GNU_CC"; then
1511 AC_MSG_CHECKING(whether ld has archive extraction flags)
1512 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1513 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1514 ac_cv_mkshlib_force_and_unforce="no"
1515 exec 3<&0 <<LOOP_INPUT
1516 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1517 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1518 force="-Wl,-all"; unforce="-Wl,-none"
1525 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1528 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1530 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1534 eval $ac_cv_mkshlib_force_and_unforce
1535 MKSHLIB_FORCE_ALL=$force
1536 MKSHLIB_UNFORCE_ALL=$unforce
1539 fi # COMPILE_ENVIRONMENT
1541 dnl ========================================================
1542 dnl Checking for 64-bit OS
1543 dnl ========================================================
1544 if test "$COMPILE_ENVIRONMENT"; then
1547 AC_MSG_CHECKING(for 64-bit OS)
1548 AC_TRY_COMPILE([$configure_static_assert_macros],
1549 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1550 result="yes", result="no")
1551 AC_MSG_RESULT("$result")
1552 if test "$result" = "yes"; then
1553 AC_DEFINE(HAVE_64BIT_OS)
1556 AC_SUBST(HAVE_64BIT_OS)
1558 fi # COMPILE_ENVIRONMENT
1560 dnl ========================================================
1561 dnl Enable high-memory support on OS/2 by default.
1562 dnl ========================================================
1563 MOZ_OS2_HIGH_MEMORY=1
1564 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1565 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1566 MOZ_OS2_HIGH_MEMORY=,
1567 MOZ_OS2_HIGH_MEMORY=1 )
1568 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1570 dnl ========================================================
1571 dnl = Use profiling compile flags
1572 dnl ========================================================
1573 MOZ_ARG_ENABLE_BOOL(profiling,
1574 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1578 # For profiling builds keep the symbol information
1579 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1580 case "$OS_TARGET" in
1581 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1582 STRIP_FLAGS="--strip-debug"
1587 dnl ========================================================
1588 dnl = Use incremental GC
1589 dnl ========================================================
1591 MOZ_ARG_DISABLE_BOOL(gcincremental,
1592 [ --disable-gcincremental Disable incremental GC],
1594 if test -n "$JSGC_INCREMENTAL"; then
1595 AC_DEFINE(JSGC_INCREMENTAL)
1598 dnl ========================================================
1599 dnl = Use generational GC
1600 dnl ========================================================
1601 MOZ_ARG_ENABLE_BOOL(gcgenerational,
1602 [ --enable-gcgenerational Enable generational GC],
1603 JSGC_GENERATIONAL=1,
1604 JSGC_GENERATIONAL= )
1605 if test -n "$JSGC_GENERATIONAL"; then
1606 AC_DEFINE(JSGC_GENERATIONAL)
1609 dnl ========================================================
1610 dnl = Perform moving GC stack rooting analysis
1611 dnl ========================================================
1612 MOZ_ARG_ENABLE_BOOL(root-analysis,
1613 [ --enable-root-analysis Enable moving GC stack root analysis],
1614 JSGC_ROOT_ANALYSIS=1,
1615 JSGC_ROOT_ANALYSIS= )
1616 if test -n "$JSGC_ROOT_ANALYSIS"; then
1617 AC_DEFINE(JSGC_ROOT_ANALYSIS)
1620 dnl ========================================================
1621 dnl = Use exact stack rooting for GC
1622 dnl ========================================================
1623 MOZ_ARG_ENABLE_BOOL(exact-rooting,
1624 [ --enable-exact-rooting Enable use of exact stack roots for GC],
1625 JSGC_USE_EXACT_ROOTING=1,
1626 JSGC_USE_EXACT_ROOTING= )
1627 if test -n "$JSGC_USE_EXACT_ROOTING"; then
1628 AC_DEFINE(JSGC_USE_EXACT_ROOTING)
1631 dnl ========================================================
1633 dnl ========================================================
1634 MOZ_ARG_ENABLE_BOOL(valgrind,
1635 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1638 if test -n "$MOZ_VALGRIND"; then
1639 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1641 [--enable-valgrind specified but Valgrind is not installed]))
1642 AC_DEFINE(MOZ_VALGRIND)
1644 AC_SUBST(MOZ_VALGRIND)
1646 dnl ========================================================
1648 dnl ========================================================
1649 MOZ_ARG_ENABLE_BOOL(jprof,
1650 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1653 if test -n "$MOZ_JPROF"; then
1655 AC_DEFINE(MOZ_JPROF)
1658 dnl ========================================================
1660 dnl ========================================================
1661 MOZ_ENABLE_PROFILER_SPS=1
1663 case "${OS_TARGET}" in
1665 case "${CPU_ARCH}" in
1668 MOZ_ENABLE_PROFILER_SPS=
1672 case "${CPU_ARCH}" in
1675 MOZ_ENABLE_PROFILER_SPS=
1680 MOZ_ENABLE_PROFILER_SPS=
1684 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1685 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1688 dnl ========================================================
1690 dnl ========================================================
1691 MOZ_ARG_ENABLE_BOOL(shark,
1692 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1695 if test -n "$MOZ_SHARK"; then
1697 AC_DEFINE(MOZ_SHARK)
1700 dnl ========================================================
1702 dnl ========================================================
1703 MOZ_ARG_ENABLE_BOOL(instruments,
1704 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
1707 if test -n "$MOZ_INSTRUMENTS"; then
1709 AC_DEFINE(MOZ_INSTRUMENTS)
1712 dnl ========================================================
1714 dnl ========================================================
1715 MOZ_ARG_ENABLE_BOOL(callgrind,
1716 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1719 if test -n "$MOZ_CALLGRIND"; then
1721 AC_DEFINE(MOZ_CALLGRIND)
1724 dnl ========================================================
1726 dnl ========================================================
1727 MOZ_ARG_ENABLE_BOOL(vtune,
1728 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1731 if test -n "$MOZ_VTUNE"; then
1733 AC_DEFINE(MOZ_VTUNE)
1736 dnl ========================================================
1738 dnl ========================================================
1739 if test -n "$MOZ_PROFILING"; then
1740 AC_DEFINE(MOZ_PROFILING)
1743 dnl ========================================================
1744 dnl System overrides of the defaults for host
1745 dnl ========================================================
1748 if test -n "$_WIN32_MSVC"; then
1750 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1751 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1752 HOST_RANLIB='echo ranlib'
1754 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1756 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1757 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1758 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1759 HOST_BIN_SUFFIX=.exe
1762 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1766 case "${host_cpu}" in
1768 if test -n "$_WIN32_MSVC"; then
1769 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1773 if test -n "$_WIN32_MSVC"; then
1774 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1776 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1782 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1783 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1784 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1787 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1788 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1789 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1790 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1794 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1795 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1796 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1797 HOST_BIN_SUFFIX=.exe
1802 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1803 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1807 dnl Check for using a custom <stdint.h> implementation
1808 dnl ========================================================
1809 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1810 if test "$MOZ_CUSTOM_STDINT_H"; then
1811 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1812 AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1814 AC_MSG_RESULT(none specified)
1817 dnl Get mozilla version from central milestone file
1818 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1819 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1821 dnl Get version of various core apps from the version files.
1822 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1824 if test -z "$FIREFOX_VERSION"; then
1825 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1828 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1829 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1830 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1832 MOZ_DOING_LTO(lto_is_enabled)
1834 dnl ========================================================
1835 dnl System overrides of the defaults for target
1836 dnl ========================================================
1841 if test ! "$GNU_CC"; then
1842 if test ! "$HAVE_64BIT_OS"; then
1843 # Compiling with Visual Age C++ object model compat is the
1844 # default. To compile with object model ibm, add
1845 # AIX_OBJMODEL=ibm to .mozconfig.
1846 if test "$AIX_OBJMODEL" = "ibm"; then
1847 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1854 AC_SUBST(AIX_OBJMODEL)
1855 DSO_LDOPTS='-qmkshrobj=1'
1856 DSO_CFLAGS='-qflag=w:w'
1858 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1860 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1861 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1862 if test "$COMPILE_ENVIRONMENT"; then
1865 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1867 [#if (__IBMCPP__ < 900)
1868 #error "Bad compiler"
1870 _BAD_COMPILER=,_BAD_COMPILER=1)
1871 if test -n "$_BAD_COMPILER"; then
1873 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1875 AC_MSG_RESULT([yes])
1878 TARGET_COMPILER_ABI="ibmc"
1879 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1880 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1883 case "${target_os}" in
1888 if test "$COMPILE_ENVIRONMENT"; then
1889 MOZ_CHECK_HEADERS(sys/inttypes.h)
1891 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1895 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1896 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1897 MOZ_OPTIMIZE_FLAGS="-O3"
1898 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1899 if test "$HAVE_64BIT_OS"; then
1904 STRIP_FLAGS="$STRIP_FLAGS -x -S"
1905 # Check whether we're targeting OS X or iOS
1906 AC_CACHE_CHECK(for iOS target,
1908 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1909 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1913 ac_cv_ios_target="yes",
1914 ac_cv_ios_target="no")])
1915 if test "$ac_cv_ios_target" = "yes"; then
1917 AC_DEFINE(XP_DARWIN)
1918 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1920 AC_DEFINE(XP_MACOSX)
1921 AC_DEFINE(XP_DARWIN)
1922 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1923 # The ExceptionHandling framework is needed for Objective-C exception
1924 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1926 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1928 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1931 if test "x$lto_is_enabled" = "xyes"; then
1932 echo "Skipping -dead_strip because lto is enabled."
1933 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1934 dnl ===================================================================
1935 elif test "x$enable_dtrace" = "xyes"; then
1936 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1938 dnl check for the presence of the -dead_strip linker flag
1939 AC_MSG_CHECKING([for -dead_strip option to ld])
1940 _SAVE_LDFLAGS=$LDFLAGS
1941 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1942 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1943 if test -n "$_HAVE_DEAD_STRIP" ; then
1944 AC_MSG_RESULT([yes])
1945 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1950 LDFLAGS=$_SAVE_LDFLAGS
1953 dnl With newer linkers we need to pass -allow_heap_execute because of
1954 dnl Microsoft Silverlight (5.1.10411.0 at least).
1955 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1956 _SAVE_LDFLAGS=$LDFLAGS
1957 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1958 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1959 _HAVE_ALLOW_HEAP_EXECUTE=)
1960 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1961 AC_MSG_RESULT([yes])
1962 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1966 LDFLAGS=$_SAVE_LDFLAGS
1968 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1973 if test ! "$GNU_CC"; then
1977 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1978 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1979 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1982 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1983 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1986 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1987 AC_DEFINE(_LARGEFILE64_SOURCE)
1992 if test ! "$GNU_CC"; then
1993 DSO_LDOPTS='-b -Wl,+s'
1996 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1997 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1998 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2000 DSO_LDOPTS='-b -E +s'
2001 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2002 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2004 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2005 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2008 *-android*|*-linuxandroid*)
2009 AC_DEFINE(NO_PW_GECOS)
2011 if test -n "$gonkdir"; then
2012 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2016 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2019 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2021 MOZ_GFX_OPTIMIZE_MOBILE=1
2022 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2026 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2027 # Similarly for GNU_CXX and INTEL_CXX.
2028 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2029 # -Os has been broken on Intel's C/C++ compilers for quite a
2030 # while; Intel recommends against using it.
2031 MOZ_OPTIMIZE_FLAGS="-O2"
2032 elif test "$GNU_CC" -o "$GNU_CXX"; then
2033 case $GCC_VERSION in
2035 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
2036 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2038 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2039 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2042 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2046 case "${target_cpu}" in
2048 CFLAGS="$CFLAGS -mieee"
2049 CXXFLAGS="$CXXFLAGS -mieee"
2056 if test -z "$MC"; then
2066 # certain versions of cygwin's makedepend barf on the
2067 # #include <string> vs -I./dist/include/string issue so don't use it
2068 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
2070 CXX="$CXX -mwindows"
2071 CPP="$CPP -mwindows"
2072 CFLAGS="$CFLAGS -mms-bitfields"
2073 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2074 DSO_LDOPTS='-shared'
2075 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2076 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2078 # Use static libgcc and libstdc++
2079 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
2080 NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
2081 # Use temp file for windres (bug 213281)
2082 RCFLAGS='-O coff --use-temp-file'
2083 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2084 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2086 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxul -lxpcom_core -lmozalloc'
2087 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxul -lmozalloc'
2089 IMPORT_LIB_SUFFIX=dll.a
2091 # We use mix of both POSIX and Win32 printf format across the tree, so format
2092 # warnings are useless on mingw.
2093 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2094 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2096 TARGET_COMPILER_ABI=msvc
2100 if test "$AS_BIN"; then
2101 AS="$(basename "$AS_BIN")"
2104 AR_FLAGS='-NOLOGO -OUT:"$@"'
2106 RANLIB='echo not_ranlib'
2107 STRIP='echo not_strip'
2118 IMPORT_LIB_SUFFIX=lib
2119 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2120 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2122 MKSHLIB_UNFORCE_ALL=
2123 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2124 _USE_CPP_INCLUDE_FLAG=1
2125 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2126 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2127 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2128 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2129 # khuey says we can safely ignore MSVC warning C4251
2130 # MSVC warning C4244 (implicit type conversion may lose data) warns
2131 # and requires workarounds for perfectly valid code. Also, GCC/clang
2132 # don't warn about it by default. So for consistency/sanity, we turn
2133 # it off on MSVC, too.
2134 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2135 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2136 # MSVC warning C4482 warns when an enum value is refered specifing the
2137 # name of the enum itself. This behavior is allowed in C++11, and the
2138 # warning has been removed in VS2012.
2139 # MSVC warning C4800 warns when a value is implicitly cast to bool,
2140 # because this also forces narrowing to a single byte, which can be a
2141 # perf hit. But this matters so little in practice (and often we want
2142 # that behavior) that it's better to turn it off.
2143 # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2144 # on non-Western system locales even if it is in a comment.
2145 CFLAGS="$CFLAGS -wd4244 -wd4819"
2146 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2147 # make 'foo == bar;' error out
2148 CFLAGS="$CFLAGS -we4553"
2149 CXXFLAGS="$CXXFLAGS -we4553"
2150 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2151 MOZ_DEBUG_FLAGS='-Zi'
2152 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2153 WARNINGS_AS_ERRORS='-WX'
2154 MOZ_OPTIMIZE_FLAGS='-O1'
2156 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2157 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2158 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2159 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2160 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT -RELEASE"
2161 dnl For profile-guided optimization
2162 PROFILE_GEN_CFLAGS="-GL"
2163 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2164 dnl XXX: PGO builds can fail with warnings treated as errors,
2165 dnl specifically "no profile data available" appears to be
2166 dnl treated as an error sometimes. This might be a consequence
2167 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2168 dnl with the linker doing most of the work in the whole-program
2169 dnl optimization/PGO case. I think it's probably a compiler bug,
2170 dnl but we work around it here.
2171 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2172 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2173 dnl Probably also a compiler bug, but what can you do?
2174 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2175 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2176 if test "$_MSC_VER" -ge 1500; then
2177 dnl VS2008 or later supports SSSE3
2178 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2179 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
2182 AC_DEFINE(HAVE_SNPRINTF)
2187 AC_DEFINE(HW_THREADS)
2188 AC_DEFINE(STDC_HEADERS)
2189 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2190 TARGET_MD_ARCH=win32
2191 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2193 MOZ_USER_DIR="Mozilla"
2195 dnl Hardcode to win95 for now - cls
2196 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2198 dnl set NO_X11 defines here as the general check is skipped on win32
2204 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2205 if test -n "$L10NBASEDIR"; then
2206 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2213 if test -z "$MOZ_TOOLS"; then
2214 AC_MSG_ERROR([MOZ_TOOLS is not set])
2216 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2217 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2218 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2220 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2221 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2222 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2229 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.])
2235 if test "$HAVE_64BIT_OS"; then
2236 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2239 if test -n "$GNU_CC"; then
2240 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2241 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2242 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2244 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2245 LDFLAGS="$LDFLAGS -SAFESEH"
2251 if test -n "$_WIN32_MSVC"; then
2252 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2257 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2264 CFLAGS="$CFLAGS -Dunix"
2265 CXXFLAGS="$CXXFLAGS -Dunix"
2266 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2268 DSO_PIC_CFLAGS='-fPIC -DPIC'
2269 DSO_LDOPTS='-shared'
2270 BIN_FLAGS='-Wl,--export-dynamic'
2272 DSO_PIC_CFLAGS='-fPIC -DPIC'
2273 DLL_SUFFIX=".so.1.0"
2274 DSO_LDOPTS='-shared'
2276 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2277 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2278 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2279 if test "$LIBRUNPATH"; then
2280 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2282 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
2283 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@)) -o $@'
2287 if test "$SO_VERSION"; then
2288 DLL_SUFFIX=".so.$SO_VERSION"
2290 DLL_SUFFIX=".so.1.0"
2292 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2294 DSO_PIC_CFLAGS='-fPIC'
2295 DSO_LDOPTS='-shared -fPIC'
2296 if test "$LIBRUNPATH"; then
2297 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2302 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2303 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2306 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2307 AC_DEFINE(TCPV40HDRS)
2313 IMPORT_LIB_SUFFIX=lib
2317 CFLAGS="$CFLAGS -Zomf"
2318 CXXFLAGS="$CXXFLAGS -Zomf"
2320 BIN_FLAGS='-Zlinker /ST:0x100000'
2324 WARNINGS_AS_ERRORS='-Werror'
2325 MOZ_DEBUG_FLAGS="-g -fno-inline"
2326 MOZ_OPTIMIZE_FLAGS="-O2"
2327 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2328 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2329 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2331 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2335 MOZ_USER_DIR="Mozilla"
2338 STRIP_FLAGS="/yua /ydd /yxd /ynl /anp /b- /cs+ /d /i- /ml1 /mr2 /mf2 /r+ /u+ /x- /zs:0 /zx /zd"
2340 if test "$MOZTOOLS"; then
2341 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2343 AC_MSG_ERROR([MOZTOOLS is not set])
2345 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2346 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2347 LDFLAGS="$LDFLAGS -Zhigh-mem"
2348 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2349 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2352 # GCC for OS/2 currently predefines these, but we don't want them
2353 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2354 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2356 AC_CACHE_CHECK(for __declspec(dllexport),
2358 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2360 ac_os2_declspec="yes",
2361 ac_os2_declspec="no")])
2362 if test "$ac_os2_declspec" != "yes"; then
2363 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2369 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2371 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2372 # libraries one level up (e.g. libnspr4.so)
2373 if test "$SOLARIS_SUNPRO_CC"; then
2374 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2375 LIBS="-lCrun -lCstd -lc $LIBS"
2376 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2377 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2378 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2379 LDFLAGS="-xildoff $LDFLAGS"
2380 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2381 _SAVE_LDFLAGS=$LDFLAGS
2382 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2383 AC_TRY_LINK([#include <stdio.h>],
2384 [printf("Hello World\n");],
2386 [LDFLAGS=$_SAVE_LDFLAGS])
2388 MOZ_OPTIMIZE_FLAGS="-xO4"
2389 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2390 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2391 MKSHLIB_FORCE_ALL='-z allextract'
2392 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2399 AS='/usr/ccs/bin/as'
2400 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2402 TARGET_COMPILER_ABI="sunc"
2403 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2404 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2405 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2409 [#if (__SUNPRO_CC < 0x590)
2412 _BAD_COMPILER=,_BAD_COMPILER=1)
2413 if test -n "$_BAD_COMPILER"; then
2415 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2420 [#if (__SUNPRO_CC >= 0x5100)
2421 #error "Sun C++ 5.10 or above"
2423 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2424 if test "$_ABOVE_SS12U1"; then
2426 CXXFLAGS="$CXXFLAGS -xannotate=no"
2428 AC_MSG_RESULT([$_res])
2431 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2433 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2434 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2435 ASFLAGS="$ASFLAGS -fPIC"
2436 DSO_LDOPTS='-shared'
2437 WARNINGS_AS_ERRORS='-Werror'
2439 _WARNINGS_CXXFLAGS=''
2440 if test "$OS_RELEASE" = "5.3"; then
2441 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2444 if test "$OS_RELEASE" = "5.5.1"; then
2445 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2450 DSO_LDOPTS='-Bdynamic'
2451 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2452 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2454 AC_DEFINE(SPRINTF_RETURNS_STRING)
2455 case "$(target_os)" in
2457 DLL_SUFFIX='.so.1.0'
2463 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2470 # Includes linux-android
2475 AC_SUBST(MOZ_LINKER)
2476 if test -n "$MOZ_LINKER"; then
2477 AC_DEFINE(MOZ_LINKER)
2480 dnl Only one oddball right now (QNX), but this gives us flexibility
2481 dnl if any other platforms need to override this in the future.
2482 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2484 dnl ========================================================
2485 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2486 dnl by now will not have any way to link most binaries (tests
2487 dnl as well as viewer, apprunner, etc.), because some symbols
2488 dnl will be left out of the "composite" .so's by ld as unneeded.
2489 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2490 dnl they can link in the static libs that provide the missing
2492 dnl ========================================================
2493 NO_LD_ARCHIVE_FLAGS=
2494 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2495 NO_LD_ARCHIVE_FLAGS=1
2499 NO_LD_ARCHIVE_FLAGS=
2502 NO_LD_ARCHIVE_FLAGS=
2505 if test -z "$GNU_CC"; then
2506 NO_LD_ARCHIVE_FLAGS=
2510 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2512 dnl ========================================================
2513 dnl = Flags to strip unused symbols from .so components and
2514 dnl = to export jemalloc symbols when linking a program
2515 dnl ========================================================
2517 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2518 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2521 if test -z "$GNU_CC"; then
2522 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2524 if test -z "$GCC_USE_GNU_LD"; then
2525 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2527 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2532 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2535 if test -n "$GNU_CC"; then
2536 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2541 if test -z "$COMPILE_ENVIRONMENT"; then
2542 SKIP_COMPILER_CHECKS=1
2543 SKIP_LIBRARY_CHECKS=1
2546 dnl ========================================================
2548 dnl = Debugging Options
2550 dnl = These must come before MOZ_COMPILER_OPTS so that MOZ_COMPILER_OPTS
2551 dnl = sees any debug flags set by the user.
2553 dnl ========================================================
2554 MOZ_ARG_HEADER(Debugging)
2556 dnl ========================================================
2557 dnl = Debug info is ON by default.
2558 dnl ========================================================
2559 if test -z "$MOZ_DEBUG_FLAGS"; then
2560 MOZ_DEBUG_FLAGS="-g"
2563 MOZ_ARG_ENABLE_STRING(debug,
2564 [ --enable-debug[=DBG] Enable building with developer debug info
2565 (using compiler flags DBG)],
2566 [ if test "$enableval" != "no"; then
2568 if test -n "$enableval" -a "$enableval" != "yes"; then
2569 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
2570 _MOZ_DEBUG_FLAGS_SET=1
2577 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
2578 MOZ_ARG_WITH_STRING(debug-label,
2579 [ --with-debug-label=LABELS
2580 Define DEBUG_<value> for each comma-separated
2582 [ for option in `echo $withval | sed 's/,/ /g'`; do
2583 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
2586 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
2588 if test -n "$MOZ_DEBUG"; then
2589 AC_MSG_CHECKING([for valid debug flags])
2590 _SAVE_CFLAGS=$CFLAGS
2591 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
2592 AC_TRY_COMPILE([#include <stdio.h>],
2593 [printf("Hello World\n");],
2596 AC_MSG_RESULT([$_results])
2597 if test "$_results" = "no"; then
2598 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
2600 CFLAGS=$_SAVE_CFLAGS
2603 dnl ========================================================
2604 dnl = Enable generation of debug symbols
2605 dnl ========================================================
2606 MOZ_ARG_ENABLE_STRING(debug-symbols,
2607 [ --enable-debug-symbols[=DBG]
2608 Enable debugging symbols (using compiler flags DBG)],
2609 [ if test "$enableval" != "no"; then
2611 if test -n "$enableval" -a "$enableval" != "yes"; then
2612 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
2613 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
2615 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
2621 MOZ_DEBUG_SYMBOLS=1)
2623 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
2624 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
2625 export MOZ_DEBUG_SYMBOLS
2629 if test -z "$SKIP_COMPILER_CHECKS"; then
2630 dnl Checks for typedefs, structures, and compiler characteristics.
2631 dnl ========================================================
2640 AC_MSG_CHECKING(for ssize_t)
2641 AC_CACHE_VAL(ac_cv_type_ssize_t,
2642 [AC_TRY_COMPILE([#include <stdio.h>
2643 #include <sys/types.h>],
2645 [ac_cv_type_ssize_t=true],
2646 [ac_cv_type_ssize_t=false])])
2647 if test "$ac_cv_type_ssize_t" = true ; then
2648 AC_DEFINE(HAVE_SSIZE_T)
2653 AC_STRUCT_ST_BLKSIZE
2654 AC_MSG_CHECKING(for siginfo_t)
2655 AC_CACHE_VAL(ac_cv_siginfo_t,
2656 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2657 #include <signal.h>],
2659 [ac_cv_siginfo_t=true],
2660 [ac_cv_siginfo_t=false])])
2661 if test "$ac_cv_siginfo_t" = true ; then
2662 AC_DEFINE(HAVE_SIGINFO_T)
2668 dnl Check for int64, uint, and uint_t.
2669 dnl ========================================================
2670 AC_MSG_CHECKING(for int64)
2671 AC_CACHE_VAL(ac_cv_int64,
2672 [AC_TRY_COMPILE([#include <stdio.h>
2673 #include <sys/types.h>],
2676 [ac_cv_int64=false])])
2677 if test "$ac_cv_int64" = true ; then
2678 AC_DEFINE(HAVE_INT64)
2683 AC_MSG_CHECKING(for uint)
2684 AC_CACHE_VAL(ac_cv_uint,
2685 [AC_TRY_COMPILE([#include <stdio.h>
2686 #include <sys/types.h>],
2689 [ac_cv_uint=false])])
2690 if test "$ac_cv_uint" = true ; then
2691 AC_DEFINE(HAVE_UINT)
2696 AC_MSG_CHECKING(for uint_t)
2697 AC_CACHE_VAL(ac_cv_uint_t,
2698 [AC_TRY_COMPILE([#include <stdio.h>
2699 #include <sys/types.h>],
2701 [ac_cv_uint_t=true],
2702 [ac_cv_uint_t=false])])
2703 if test "$ac_cv_uint_t" = true ; then
2704 AC_DEFINE(HAVE_UINT_T)
2710 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2711 dnl are defined when compiling C++ but not C. Since the result of this
2712 dnl test is used only in C++, do it in C++.
2715 AC_MSG_CHECKING(for uname.domainname)
2716 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2717 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2718 [ struct utsname *res; char *domain;
2719 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2720 [ac_cv_have_uname_domainname_field=true],
2721 [ac_cv_have_uname_domainname_field=false])])
2723 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2724 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2730 AC_MSG_CHECKING(for uname.__domainname)
2731 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2732 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2733 [ struct utsname *res; char *domain;
2734 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2735 [ac_cv_have_uname_us_domainname_field=true],
2736 [ac_cv_have_uname_us_domainname_field=false])])
2738 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2739 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2745 dnl Check whether gcc's c++0x mode works
2748 if test "$GNU_CXX"; then
2749 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2751 AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2752 ac_cv_cxx0x_headers_bug,
2753 [AC_TRY_COMPILE([#include <memory>], [],
2754 ac_cv_cxx0x_headers_bug="no",
2755 ac_cv_cxx0x_headers_bug="yes")])
2757 if test "$CLANG_CXX" -a "$ac_cv_cxx0x_headers_bug" = "yes"; then
2758 CXXFLAGS="$CXXFLAGS -I$_topsrcdir/build/unix/headers"
2759 AC_CACHE_CHECK(whether workaround for gcc c++0x headers conflict with clang works,
2760 ac_cv_cxx0x_clang_workaround,
2761 [AC_TRY_COMPILE([#include <memory>], [],
2762 ac_cv_cxx0x_clang_workaround="yes",
2763 ac_cv_cxx0x_clang_workaround="no")])
2765 if test "ac_cv_cxx0x_clang_workaround" = "no"; then
2766 AC_MSG_ERROR([Your toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain])
2768 elif test "$ac_cv_cxx0x_headers_bug" = "yes"; then
2769 AC_MSG_ERROR([Your toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain])
2773 dnl Check for usable char16_t (2 bytes, unsigned)
2774 dnl (we might not need the unsignedness check anymore)
2775 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2776 ac_cv_have_usable_char16_t,
2777 [AC_TRY_COMPILE([$configure_static_assert_macros],
2778 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2779 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2780 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2781 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2782 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2783 ac_cv_have_usable_char16_t="yes",
2784 ac_cv_have_usable_char16_t="no")])
2785 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2786 AC_DEFINE(HAVE_CPP_CHAR16_T)
2788 elif test "$GNU_CXX"; then
2789 CXXFLAGS="$_SAVE_CXXFLAGS"
2792 dnl Check for usable wchar_t (2 bytes, unsigned)
2793 dnl (we really don't need the unsignedness check anymore)
2794 dnl ========================================================
2796 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2797 ac_cv_have_usable_wchar_v2,
2798 [AC_TRY_COMPILE([#include <stddef.h>
2799 $configure_static_assert_macros],
2800 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2801 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2802 ac_cv_have_usable_wchar_v2="yes",
2803 ac_cv_have_usable_wchar_v2="no")])
2804 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2805 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2806 HAVE_CPP_2BYTE_WCHAR_T=1
2807 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2808 dnl This is really gcc-only
2809 dnl Do this test using CXX only since some versions of gcc
2810 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2811 dnl only have short-wchar support for c++.
2812 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2814 _SAVE_CXXFLAGS=$CXXFLAGS
2815 CXXFLAGS="$CXXFLAGS -fshort-wchar"
2817 AC_CACHE_CHECK(for compiler -fshort-wchar option,
2818 ac_cv_have_usable_wchar_option_v2,
2819 [AC_TRY_LINK([#include <stddef.h>
2820 $configure_static_assert_macros],
2821 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2822 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2823 ac_cv_have_usable_wchar_option_v2="yes",
2824 ac_cv_have_usable_wchar_option_v2="no")])
2826 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2827 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2828 HAVE_CPP_2BYTE_WCHAR_T=1
2829 if test "$OS_TARGET" = Android; then
2830 WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
2831 CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
2832 CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
2833 DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
2835 WCHAR_CFLAGS="-fshort-wchar"
2838 CXXFLAGS=$_SAVE_CXXFLAGS
2844 dnl Check for .hidden assembler directive and visibility attribute.
2845 dnl Borrowed from glibc configure.in
2846 dnl ===============================================================
2847 if test "$GNU_CC"; then
2848 AC_CACHE_CHECK(for visibility(hidden) attribute,
2849 ac_cv_visibility_hidden,
2850 [cat > conftest.c <<EOF
2851 int foo __attribute__ ((visibility ("hidden"))) = 1;
2853 ac_cv_visibility_hidden=no
2854 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2855 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2856 ac_cv_visibility_hidden=yes
2861 if test "$ac_cv_visibility_hidden" = "yes"; then
2862 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2864 AC_CACHE_CHECK(for visibility(default) attribute,
2865 ac_cv_visibility_default,
2866 [cat > conftest.c <<EOF
2867 int foo __attribute__ ((visibility ("default"))) = 1;
2869 ac_cv_visibility_default=no
2870 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2871 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2872 ac_cv_visibility_default=yes
2877 if test "$ac_cv_visibility_default" = "yes"; then
2878 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2880 AC_CACHE_CHECK(for visibility pragma support,
2881 ac_cv_visibility_pragma,
2882 [cat > conftest.c <<EOF
2883 #pragma GCC visibility push(hidden)
2885 #pragma GCC visibility push(default)
2886 int foo_default = 1;
2888 ac_cv_visibility_pragma=no
2889 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2890 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2891 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2892 ac_cv_visibility_pragma=yes
2898 if test "$ac_cv_visibility_pragma" = "yes"; then
2899 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2900 ac_cv_have_visibility_class_bug,
2901 [cat > conftest.c <<EOF
2902 #pragma GCC visibility push(hidden)
2903 struct __attribute__ ((visibility ("default"))) TestStruct {
2906 __attribute__ ((visibility ("default"))) void TestFunc() {
2910 ac_cv_have_visibility_class_bug=no
2911 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2912 ac_cv_have_visibility_class_bug=yes
2914 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2915 ac_cv_have_visibility_class_bug=yes
2918 rm -rf conftest.{c,S}
2921 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2922 ac_cv_have_visibility_builtin_bug,
2923 [cat > conftest.c <<EOF
2924 #pragma GCC visibility push(hidden)
2925 #pragma GCC visibility push(default)
2927 #pragma GCC visibility pop
2929 __attribute__ ((visibility ("default"))) void Func() {
2931 memset(c, 0, sizeof(c));
2934 ac_cv_have_visibility_builtin_bug=no
2935 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2936 ac_cv_have_visibility_builtin_bug=yes
2938 if test `grep -c "@PLT" conftest.S` = 0; then
2939 ac_cv_visibility_builtin_bug=yes
2942 rm -f conftest.{c,S}
2944 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2945 "$ac_cv_have_visibility_class_bug" = "no"; then
2946 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2947 WRAP_SYSTEM_INCLUDES=1
2948 STL_FLAGS='-I$(DIST)/stl_wrappers'
2951 VISIBILITY_FLAGS='-fvisibility=hidden'
2952 fi # have visibility pragma bug
2953 fi # have visibility pragma
2954 fi # have visibility(default) attribute
2955 fi # have visibility(hidden) attribute
2958 # visibility hidden flag for Sun Studio on Solaris
2959 if test "$SOLARIS_SUNPRO_CC"; then
2960 VISIBILITY_FLAGS='-xldscope=hidden'
2961 fi # Sun Studio on Solaris
2963 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2964 AC_SUBST(VISIBILITY_FLAGS)
2968 if test "$OS_TARGET" != WINNT; then
2969 # Only run this test with clang on non-Windows platforms, because clang
2970 # cannot do enough code gen for now to make this test work correctly.
2974 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2975 dnl ========================================================
2976 if test "$GNU_CC"; then
2977 CFLAGS_save="${CFLAGS}"
2978 CFLAGS="${CFLAGS} -Werror"
2979 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2980 ac_cv_force_align_arg_pointer,
2981 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2983 ac_cv_force_align_arg_pointer="yes",
2984 ac_cv_force_align_arg_pointer="no")])
2985 CFLAGS="${CFLAGS_save}"
2986 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2987 HAVE_GCC_ALIGN_ARG_POINTER=1
2989 HAVE_GCC_ALIGN_ARG_POINTER=
2992 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2994 dnl Checks for header files.
2995 dnl ========================================================
2997 case "$target_os" in
2999 # for stuff like -lXshm
3000 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3003 MOZ_CHECK_COMMON_HEADERS
3005 dnl These are all the places some variant of statfs can be hiding.
3006 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3009 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
3010 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
3012 dnl SCTP support - needs various network include headers
3013 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
3015 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
3017 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
3018 AC_CACHE_CHECK(for sockaddr_in.sin_len,
3019 ac_cv_sockaddr_in_sin_len,
3020 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
3021 #include <sys/types.h>
3023 #include <netinet/in.h>
3024 struct sockaddr_in x;
3025 void *foo = (void*) &x.sin_len;],
3027 [ac_cv_sockaddr_in_sin_len=true],
3028 [ac_cv_sockaddr_in_sin_len=false])])
3029 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
3030 AC_DEFINE(HAVE_SIN_LEN)
3031 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
3032 AC_DEFINE(HAVE_SCONN_LEN)
3035 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
3036 ac_cv_sockaddr_in6_sin6_len,
3037 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
3038 #include <sys/types.h>
3040 #include <netinet/in.h>
3041 struct sockaddr_in6 x;
3042 void *foo = (void*) &x.sin6_len;],
3044 [ac_cv_sockaddr_in6_sin6_len=true],
3045 [ac_cv_sockaddr_in6_sin6_len=false])])
3046 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
3047 AC_DEFINE(HAVE_SIN6_LEN)
3050 AC_CACHE_CHECK(for sockaddr.sa_len,
3051 ac_cv_sockaddr_sa_len,
3052 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
3053 #include <sys/types.h>
3055 #include <sys/socket.h>
3057 void *foo = (void*) &x.sa_len;],
3059 [ac_cv_sockaddr_sa_len=true],
3060 [ac_cv_sockaddr_sa_len=false])])
3061 if test "$ac_cv_sockaddr_sa_len" = true ; then
3062 AC_DEFINE(HAVE_SA_LEN)
3065 AC_ARG_ENABLE(dtrace,
3066 [ --enable-dtrace build with dtrace support if available (default=no)],
3067 [enable_dtrace="yes"],)
3068 if test "x$enable_dtrace" = "xyes"; then
3069 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3070 if test -n "$HAVE_DTRACE"; then
3071 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3073 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3076 AC_SUBST(HAVE_DTRACE)
3082 MOZ_CHECK_HEADERS(sys/cdefs.h)
3086 MOZ_LINUX_PERF_EVENT
3088 dnl Checks for libraries.
3089 dnl ========================================================
3094 AC_CHECK_LIB(c_r, gethostbyname_r)
3098 dnl We don't want to link with libdl even if it's present on OS X, since
3099 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3101 dnl We don't want to link against libm or libpthread on Darwin since
3102 dnl they both are just symlinks to libSystem and explicitly linking
3103 dnl against libSystem causes issues when debugging (see bug 299601).
3110 AC_SEARCH_LIBS(dlopen, dl,
3111 MOZ_CHECK_HEADER(dlfcn.h,
3112 AC_DEFINE(HAVE_DLOPEN)))
3116 _SAVE_CFLAGS="$CFLAGS"
3117 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3118 AC_CHECK_FUNCS(dladdr memmem)
3119 CFLAGS="$_SAVE_CFLAGS"
3121 if test ! "$GNU_CXX"; then
3125 AC_CHECK_LIB(C_r, demangle)
3128 AC_CHECK_LIB(C, demangle)
3133 dnl OS/2 has socket in libc.
3138 AC_CHECK_LIB(socket, socket)
3142 XLIBS="$X_EXTRA_LIBS"
3144 dnl ========================================================
3145 dnl Checks for X libraries.
3146 dnl Ordering is important.
3147 dnl Xt is dependent upon SM as of X11R6
3148 dnl ========================================================
3149 if test "$no_x" = "yes"; then
3152 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3153 XLIBS="-lX11 $XLIBS"
3154 _SAVE_LDFLAGS="$LDFLAGS"
3155 LDFLAGS="$XLDFLAGS $LDFLAGS"
3156 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3157 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3158 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3159 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3161 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3162 unset ac_cv_lib_Xt_XtFree
3163 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3164 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3165 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3166 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3169 # AIX needs the motif library linked before libXt to prevent
3170 # crashes in plugins linked against Motif - Bug #98892
3171 case "${target_os}" in
3173 XT_LIBS="-lXm $XT_LIBS"
3177 dnl ========================================================
3178 dnl = Check for XShm
3179 dnl ========================================================
3180 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3183 dnl ========================================================
3185 dnl ========================================================
3186 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3187 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3188 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3189 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3191 LDFLAGS="$_SAVE_LDFLAGS"
3201 dnl ========================================================
3202 dnl = pthread support
3203 dnl = Start by checking whether the system support pthreads
3204 dnl ========================================================
3205 case "$target_os" in
3210 MOZ_CHECK_PTHREADS(pthreads,
3211 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3212 MOZ_CHECK_PTHREADS(pthread,
3213 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3214 MOZ_CHECK_PTHREADS(c_r,
3215 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3216 MOZ_CHECK_PTHREADS(c,
3225 dnl ========================================================
3226 dnl Check the command line for --with-pthreads
3227 dnl ========================================================
3228 MOZ_ARG_WITH_BOOL(pthreads,
3229 [ --with-pthreads Force use of system pthread library with NSPR ],
3230 [ if test "$MOZ_USE_PTHREADS"x = x; then
3231 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3237 dnl ========================================================
3238 dnl Do the platform specific pthread hackery
3239 dnl ========================================================
3240 if test "$MOZ_USE_PTHREADS"x != x
3243 dnl See if -pthread is supported.
3246 ac_cv_have_dash_pthread=no
3247 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3248 echo 'int main() { return 0; }' | cat > conftest.c
3249 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3250 if test $? -eq 0; then
3251 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3252 ac_cv_have_dash_pthread=yes
3253 case "$target_os" in
3255 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3258 CFLAGS="$CFLAGS -pthread"
3259 CXXFLAGS="$CXXFLAGS -pthread"
3265 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3268 dnl See if -pthreads is supported.
3270 ac_cv_have_dash_pthreads=no
3271 if test "$ac_cv_have_dash_pthread" = "no"; then
3272 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3273 echo 'int main() { return 0; }' | cat > conftest.c
3274 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3275 if test $? -eq 0; then
3276 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3277 ac_cv_have_dash_pthreads=yes
3278 CFLAGS="$CFLAGS -pthreads"
3279 CXXFLAGS="$CXXFLAGS -pthreads"
3283 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3288 AC_DEFINE(_REENTRANT)
3289 AC_DEFINE(_THREAD_SAFE)
3290 dnl -pthread links in -lpthread, so don't specify it explicitly.
3291 if test "$ac_cv_have_dash_pthread" = "yes"; then
3292 _PTHREAD_LDFLAGS="-pthread"
3296 *-*-openbsd*|*-*-bsdi*)
3297 AC_DEFINE(_REENTRANT)
3298 AC_DEFINE(_THREAD_SAFE)
3299 dnl -pthread links in -lc_r, so don't specify it explicitly.
3300 if test "$ac_cv_have_dash_pthread" = "yes"; then
3301 _PTHREAD_LDFLAGS="-pthread"
3305 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3306 AC_DEFINE(_REENTRANT)
3310 AC_DEFINE(_REENTRANT)
3314 AC_DEFINE(_REENTRANT)
3318 AC_DEFINE(_REENTRANT)
3319 if test "$SOLARIS_SUNPRO_CC"; then
3320 CFLAGS="$CFLAGS -mt"
3321 CXXFLAGS="$CXXFLAGS -mt"
3325 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3326 AC_SUBST(MOZ_USE_PTHREADS)
3330 dnl Checks for library functions.
3331 dnl ========================================================
3332 AC_PROG_GCC_TRADITIONAL
3334 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf memmove rint stat64 lstat64 truncate64 setbuf isatty)
3335 AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
3336 AC_CHECK_FUNCS(flockfile getpagesize)
3337 AC_CHECK_FUNCS(localtime_r strtok_r)
3339 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3340 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3341 ac_cv_clock_monotonic,
3342 [for libs in "" -lrt; do
3345 AC_TRY_LINK([#include <time.h>],
3346 [ struct timespec ts;
3347 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3348 ac_cv_clock_monotonic=$libs
3351 ac_cv_clock_monotonic=no)
3354 if test "$ac_cv_clock_monotonic" != "no"; then
3355 HAVE_CLOCK_MONOTONIC=1
3356 REALTIME_LIBS=$ac_cv_clock_monotonic
3357 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3358 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3359 AC_SUBST(REALTIME_LIBS)
3362 dnl check for wcrtomb/mbrtowc
3363 dnl =======================================================================
3364 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3367 AC_CACHE_CHECK(for wcrtomb,
3369 [AC_TRY_LINK([#include <wchar.h>],
3370 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3371 ac_cv_have_wcrtomb="yes",
3372 ac_cv_have_wcrtomb="no")])
3373 if test "$ac_cv_have_wcrtomb" = "yes"; then
3374 AC_DEFINE(HAVE_WCRTOMB)
3376 AC_CACHE_CHECK(for mbrtowc,
3378 [AC_TRY_LINK([#include <wchar.h>],
3379 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3380 ac_cv_have_mbrtowc="yes",
3381 ac_cv_have_mbrtowc="no")])
3382 if test "$ac_cv_have_mbrtowc" = "yes"; then
3383 AC_DEFINE(HAVE_MBRTOWC)
3390 ac_cv_func_res_ninit,
3393 #define _BSD_SOURCE 1
3397 [int foo = res_ninit(&_res);],
3398 [ac_cv_func_res_ninit=yes],
3399 [ac_cv_func_res_ninit=no])
3402 if test "$ac_cv_func_res_ninit" = "yes"; then
3403 AC_DEFINE(HAVE_RES_NINIT)
3404 dnl must add the link line we do something as foolish as this... dougt
3406 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3407 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3412 [for gnu_get_libc_version()],
3413 ac_cv_func_gnu_get_libc_version,
3415 #ifdef HAVE_GNU_LIBC_VERSION_H
3416 #include <gnu/libc-version.h>
3419 [const char *glibc_version = gnu_get_libc_version();],
3420 [ac_cv_func_gnu_get_libc_version=yes],
3421 [ac_cv_func_gnu_get_libc_version=no]
3425 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3426 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3430 darwin*|mingw*|os2*)
3434 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3435 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3436 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3438 LIBS="$LIBS $_ICONV_LIBS"
3447 iconv_t h = iconv_open("", "");
3448 iconv(h, NULL, NULL, NULL, NULL);
3451 [ac_cv_func_iconv=yes],
3452 [ac_cv_func_iconv=no]
3455 if test "$ac_cv_func_iconv" = "yes"; then
3456 AC_DEFINE(HAVE_ICONV)
3457 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3458 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3459 LIBICONV="$_ICONV_LIBS"
3461 [for iconv() with const input],
3462 ac_cv_func_const_iconv,
3468 const char *input = "testing";
3469 iconv_t h = iconv_open("", "");
3470 iconv(h, &input, NULL, NULL, NULL);
3473 [ac_cv_func_const_iconv=yes],
3474 [ac_cv_func_const_iconv=no]
3477 if test "$ac_cv_func_const_iconv" = "yes"; then
3478 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3490 dnl **********************
3491 dnl *** va_copy checks ***
3492 dnl **********************
3493 dnl we currently check for all three va_copy possibilities, so we get
3494 dnl all results in config.log for bug reports.
3495 AC_MSG_CHECKING(for an implementation of va_copy())
3496 AC_CACHE_VAL(ac_cv_va_copy,[
3499 void f (int i, ...) {
3500 va_list args1, args2;
3501 va_start (args1, i);
3502 va_copy (args2, args1);
3503 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3505 va_end (args1); va_end (args2);
3507 int main() { f (0, 42); return 0; }],
3513 AC_MSG_RESULT($ac_cv_va_copy)
3514 AC_MSG_CHECKING(for an implementation of __va_copy())
3515 AC_CACHE_VAL(ac_cv___va_copy,[
3518 void f (int i, ...) {
3519 va_list args1, args2;
3520 va_start (args1, i);
3521 __va_copy (args2, args1);
3522 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3524 va_end (args1); va_end (args2);
3526 int main() { f (0, 42); return 0; }],
3527 ac_cv___va_copy=yes,
3532 AC_MSG_RESULT($ac_cv___va_copy)
3533 AC_MSG_CHECKING(whether va_lists can be copied by value)
3534 AC_CACHE_VAL(ac_cv_va_val_copy,[
3537 void f (int i, ...) {
3538 va_list args1, args2;
3539 va_start (args1, i);
3541 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3543 va_end (args1); va_end (args2);
3545 int main() { f (0, 42); return 0; }],
3546 ac_cv_va_val_copy=yes,
3547 ac_cv_va_val_copy=no,
3548 ac_cv_va_val_copy=yes
3551 if test "x$ac_cv_va_copy" = "xyes"; then
3552 AC_DEFINE(VA_COPY, va_copy)
3553 AC_DEFINE(HAVE_VA_COPY)
3554 elif test "x$ac_cv___va_copy" = "xyes"; then
3555 AC_DEFINE(VA_COPY, __va_copy)
3556 AC_DEFINE(HAVE_VA_COPY)
3559 if test "x$ac_cv_va_val_copy" = "xno"; then
3560 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3562 AC_MSG_RESULT($ac_cv_va_val_copy)
3564 dnl ===================================================================
3565 dnl ========================================================
3566 dnl Put your C++ language/feature checks below
3567 dnl ========================================================
3571 if test "$GNU_CC"; then
3572 if test "$CPU_ARCH" = "arm" ; then
3573 AC_CACHE_CHECK(for ARM EABI,
3577 #if defined(__ARM_EABI__)
3580 #error Not ARM EABI.
3583 ac_cv_gcc_arm_eabi="yes",
3584 ac_cv_gcc_arm_eabi="no")])
3585 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3587 ARM_ABI_PREFIX=eabi-
3589 ARM_ABI_PREFIX=oabi-
3593 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3596 dnl Check to see if we can resolve ambiguity with |using|.
3597 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3598 ac_cv_cpp_ambiguity_resolving_using,
3599 [AC_TRY_COMPILE(class X {
3600 public: int go(const X&) {return 3;}
3601 int jo(const X&) {return 3;}
3603 class Y : public X {
3604 public: int go(int) {return 2;}
3605 int jo(int) {return 2;}
3607 private: using X::go;
3610 ac_cv_cpp_ambiguity_resolving_using=yes,
3611 ac_cv_cpp_ambiguity_resolving_using=no)])
3612 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3613 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3616 dnl See if a dynamic_cast to void* gives the most derived object.
3617 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3618 ac_cv_cpp_dynamic_cast_void_ptr,
3619 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3620 class Y { int j; public: virtual ~Y() { } };
3621 class Z : public X, public Y { int k; };
3627 return !((((void*)&mdo != (void*)subx) &&
3628 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3629 (((void*)&mdo != (void*)suby) &&
3630 ((void*)&mdo == dynamic_cast<void*>(suby))));
3632 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3633 ac_cv_cpp_dynamic_cast_void_ptr=no,
3634 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3635 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3636 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3640 dnl note that this one is reversed - if the test fails, then
3641 dnl we require implementations of unused virtual methods. Which
3642 dnl really blows because it means we'll have useless vtable
3644 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3645 ac_cv_cpp_unused_required,
3646 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3648 ac_cv_cpp_unused_required=no,
3649 ac_cv_cpp_unused_required=yes)])
3650 if test "$ac_cv_cpp_unused_required" = yes ; then
3651 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3655 dnl Some compilers have trouble comparing a constant reference to a templatized
3656 dnl class to zero, and require an explicit operator==() to be defined that takes
3657 dnl an int. This test separates the strong from the weak.
3659 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3660 ac_cv_trouble_comparing_to_zero,
3661 [AC_TRY_COMPILE([#include <algorithm>
3662 template <class T> class Foo {};
3664 template <class T> int operator==(const T2*, const T&) { return 0; }
3665 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3666 [Foo<int> f; return (0 != f);],
3667 ac_cv_trouble_comparing_to_zero=no,
3668 ac_cv_trouble_comparing_to_zero=yes)])
3669 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3670 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3673 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3674 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3675 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3677 _SAVE_LDFLAGS=$LDFLAGS
3678 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3679 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3680 ac_cv_thread_keyword,
3681 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3682 [return tlsIsMainThread;],
3683 ac_cv_thread_keyword=yes,
3684 ac_cv_thread_keyword=no)])
3685 LDFLAGS=$_SAVE_LDFLAGS
3686 # The custom dynamic linker doesn't support TLS variables
3688 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3689 # mips builds fail with TLS variables because of a binutils bug.
3691 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3696 *-android*|*-linuxandroid*)
3703 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3709 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3710 if test -n "$MOZ_LINKER"; then
3711 if test "$CPU_ARCH" = arm; then
3712 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3713 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3714 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3715 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3720 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3721 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3722 dnl We however want to avoid these text relocations, and this can be done
3723 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3724 dnl doesn't contain anything at all, beside placeholders for some sections,
3725 dnl and crtbegin only contains a finalizer function that calls
3726 dnl __cxa_finalize. The custom linker actually takes care of calling
3727 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3728 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3729 dnl link crtbegin and crtend at all.
3730 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3731 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3732 ac_cv_crt_has_text_relocations,
3733 [echo 'int foo() { return 0; }' > conftest.cpp
3734 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3735 test -s conftest${DLL_SUFFIX}; then
3736 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3737 ac_cv_crt_has_text_relocations=yes
3739 ac_cv_crt_has_text_relocations=no
3742 AC_ERROR([couldn't compile a simple C file])
3745 if test "$ac_cv_crt_has_text_relocations" = yes; then
3746 dnl While we want libraries to skip the CRT files, we don't want
3747 dnl executables to be treated the same way. We thus set the flag
3748 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3749 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3750 dnl Using LDFLAGS in nspr is safe, since we only really build
3751 dnl libraries there.
3752 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3753 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3757 dnl Check for the existence of various allocation headers/functions
3759 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3762 for file in $MALLOC_HEADERS; do
3763 MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3764 if test "$MALLOC_H" != ""; then
3765 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3770 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3771 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3773 AC_CHECK_FUNCS(malloc_usable_size)
3775 dnl See if compiler supports some gcc-style attributes
3777 AC_CACHE_CHECK(for __attribute__((always_inline)),
3778 ac_cv_attribute_always_inline,
3779 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3781 ac_cv_attribute_always_inline=yes,
3782 ac_cv_attribute_always_inline=no)])
3784 AC_CACHE_CHECK(for __attribute__((malloc)),
3785 ac_cv_attribute_malloc,
3786 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3788 ac_cv_attribute_malloc=yes,
3789 ac_cv_attribute_malloc=no)])
3791 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3792 ac_cv_attribute_warn_unused,
3793 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3795 ac_cv_attribute_warn_unused=yes,
3796 ac_cv_attribute_warn_unused=no)])
3798 dnl End of C++ language/feature checks
3801 dnl ========================================================
3802 dnl = Internationalization checks
3803 dnl ========================================================
3805 dnl Internationalization and Locale support is different
3806 dnl on various UNIX platforms. Checks for specific i18n
3807 dnl features go here.
3809 dnl check for LC_MESSAGES
3810 AC_CACHE_CHECK(for LC_MESSAGES,
3811 ac_cv_i18n_lc_messages,
3812 [AC_TRY_COMPILE([#include <locale.h>],
3813 [int category = LC_MESSAGES;],
3814 ac_cv_i18n_lc_messages=yes,
3815 ac_cv_i18n_lc_messages=no)])
3816 if test "$ac_cv_i18n_lc_messages" = yes; then
3817 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3820 AC_HAVE_FUNCS(localeconv)
3821 fi # ! SKIP_COMPILER_CHECKS
3824 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3825 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3828 dnl Mozilla specific options
3829 dnl ========================================================
3830 dnl The macros used for command line options
3831 dnl are defined in build/autoconf/altoptions.m4.
3833 dnl If the compiler supports these attributes, define them as
3834 dnl convenience macros.
3835 if test "$ac_cv_attribute_malloc" = yes ; then
3836 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3838 AC_DEFINE(NS_ATTR_MALLOC,)
3841 if test "$ac_cv_attribute_warn_unused" = yes ; then
3842 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3844 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3847 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3848 dnl features that Windows actually does support.
3850 if test -n "$SKIP_COMPILER_CHECKS"; then
3851 dnl Windows has malloc.h
3852 AC_DEFINE(MALLOC_H, [<malloc.h>])
3853 AC_DEFINE(HAVE_FORCEINLINE)
3854 AC_DEFINE(HAVE_LOCALECONV)
3855 fi # SKIP_COMPILER_CHECKS
3857 dnl ========================================================
3859 dnl = Check for external package dependencies
3861 dnl ========================================================
3862 MOZ_ARG_HEADER(External Packages)
3864 MOZ_ARG_WITH_STRING(libxul-sdk,
3865 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3866 LIBXUL_SDK_DIR=$withval)
3868 if test "$LIBXUL_SDK_DIR" = "yes"; then
3869 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3870 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3871 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3873 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3874 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3878 AC_SUBST(LIBXUL_SDK)
3880 if test -n "$LIBXUL_SDK"; then
3881 LIBXUL_DIST="$LIBXUL_SDK"
3883 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3885 AC_SUBST(LIBXUL_DIST)
3889 MOZ_ARG_WITH_BOOL(system-libxul,
3890 [ --with-system-libxul Use system installed libxul SDK],
3893 dnl ========================================================
3894 dnl = If NSPR was not detected in the system,
3895 dnl = use the one in the source tree (mozilla/nsprpub)
3896 dnl ========================================================
3897 MOZ_ARG_WITH_BOOL(system-nspr,
3898 [ --with-system-nspr Use system installed NSPR],
3899 _USE_SYSTEM_NSPR=1 )
3901 if test -n "$_USE_SYSTEM_NSPR"; then
3902 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])])
3905 if test -n "$MOZ_NATIVE_NSPR"; then
3906 _SAVE_CFLAGS=$CFLAGS
3907 CFLAGS="$CFLAGS $NSPR_CFLAGS"
3908 AC_TRY_COMPILE([#include "prtypes.h"],
3909 [#ifndef PR_STATIC_ASSERT
3910 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3912 [MOZ_NATIVE_NSPR=1],
3913 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3914 AC_TRY_COMPILE([#include "prtypes.h"],
3916 #error PR_UINT64 not defined or requires including prtypes.h
3918 [MOZ_NATIVE_NSPR=1],
3919 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3920 CFLAGS=$_SAVE_CFLAGS
3922 if test -z "$LIBXUL_SDK"; then
3923 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3924 if test -n "$GNU_CC"; then
3925 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3927 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3930 NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3931 NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3935 dnl set GRE_MILESTONE
3936 dnl ========================================================
3937 if test -n "$LIBXUL_SDK"; then
3938 GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3940 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3942 AC_SUBST(GRE_MILESTONE)
3944 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3945 # The logic works like this:
3946 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3947 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3948 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3949 case "$GRE_MILESTONE" in
3952 AC_DEFINE(NIGHTLY_BUILD)
3958 AC_DEFINE(RELEASE_BUILD)
3961 AC_SUBST(NIGHTLY_BUILD)
3962 AC_SUBST(RELEASE_BUILD)
3964 dnl system libevent Support
3965 dnl ========================================================
3966 MOZ_ARG_WITH_STRING(system-libevent,
3967 [ --with-system-libevent[=PFX]
3968 Use system libevent [installed at prefix PFX]],
3969 LIBEVENT_DIR=$withval)
3971 _SAVE_CFLAGS=$CFLAGS
3972 _SAVE_LDFLAGS=$LDFLAGS
3974 if test "$LIBEVENT_DIR" = yes; then
3975 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3976 MOZ_NATIVE_LIBEVENT=1,
3979 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3980 MOZ_NATIVE_LIBEVENT=
3981 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3982 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3983 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3984 MOZ_CHECK_HEADER(event.h,
3985 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3986 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3988 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3989 AC_CHECK_LIB(event, event_init,
3990 [MOZ_NATIVE_LIBEVENT=1
3991 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3992 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3993 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3995 CFLAGS=$_SAVE_CFLAGS
3996 LDFLAGS=$_SAVE_LDFLAGS
3999 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4000 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
4001 AC_SUBST(MOZ_LIBEVENT_LIBS)
4003 dnl ========================================================
4004 dnl = If NSS was not detected in the system,
4005 dnl = use the one in the source tree (mozilla/security/nss)
4006 dnl ========================================================
4008 MOZ_ARG_WITH_BOOL(system-nss,
4009 [ --with-system-nss Use system installed NSS],
4012 if test -n "$_USE_SYSTEM_NSS"; then
4013 AM_PATH_NSS(3.15, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
4016 if test -n "$MOZ_NATIVE_NSS"; then
4017 NSS_LIBS="$NSS_LIBS -lcrmf"
4019 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4021 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
4023 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4024 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4025 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4026 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4027 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4029 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4033 dnl ======================
4035 dnl ======================
4037 AC_MSG_CHECKING([for YASM assembler])
4038 AC_CHECK_PROGS(YASM, yasm, "")
4040 if test -n "$YASM"; then
4041 dnl Pull out yasm's version string
4042 YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
4043 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4044 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4045 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4046 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4049 if test -z "$SKIP_LIBRARY_CHECKS"; then
4050 dnl system JPEG support
4051 dnl ========================================================
4052 MOZ_ARG_WITH_STRING(system-jpeg,
4053 [ --with-system-jpeg[=PFX]
4054 Use system libjpeg [installed at prefix PFX]],
4057 _SAVE_CFLAGS=$CFLAGS
4058 _SAVE_LDFLAGS=$LDFLAGS
4060 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4061 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4062 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4064 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4067 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
4070 if test "$MOZ_NATIVE_JPEG" = 1; then
4071 AC_TRY_COMPILE([ #include <stdio.h>
4072 #include <sys/types.h>
4073 #include <jpeglib.h> ],
4074 [ #if JPEG_LIB_VERSION < $MOZJPEG
4075 #error "Insufficient JPEG library version ($MOZJPEG required)."
4077 #ifndef JCS_EXTENSIONS
4078 #error "libjpeg-turbo JCS_EXTENSIONS required"
4082 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
4084 CFLAGS=$_SAVE_CFLAGS
4085 LDFLAGS=$_SAVE_LDFLAGS
4088 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
4089 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
4090 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
4092 fi # SKIP_LIBRARY_CHECKS
4094 dnl system ZLIB support
4095 dnl ========================================================
4096 MOZ_ZLIB_CHECK([1.2.3])
4098 if test "$MOZ_NATIVE_ZLIB" != 1; then
4100 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
4103 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
4104 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4107 if test -z "$SKIP_LIBRARY_CHECKS"; then
4108 dnl system BZIP2 Support
4109 dnl ========================================================
4110 MOZ_ARG_WITH_STRING(system-bz2,
4111 [ --with-system-bz2[=PFX]
4112 Use system libbz2 [installed at prefix PFX]],
4115 _SAVE_CFLAGS=$CFLAGS
4116 _SAVE_LDFLAGS=$LDFLAGS
4118 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4119 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4120 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4122 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4125 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
4126 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
4128 CFLAGS=$_SAVE_CFLAGS
4129 LDFLAGS=$_SAVE_LDFLAGS
4132 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
4133 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
4134 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4137 dnl system PNG Support
4138 dnl ========================================================
4139 MOZ_ARG_WITH_STRING(system-png,
4140 [ --with-system-png[=PFX]
4141 Use system libpng [installed at prefix PFX]],
4144 _SAVE_CFLAGS=$CFLAGS
4145 _SAVE_LDFLAGS=$LDFLAGS
4147 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4148 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4149 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4151 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4154 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
4155 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4156 AC_CHECK_LIB(png, png_get_acTL, ,
4157 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
4159 if test "$MOZ_NATIVE_PNG" = 1; then
4160 AC_TRY_COMPILE([ #include <stdio.h>
4161 #include <sys/types.h>
4163 [ #if PNG_LIBPNG_VER < $MOZPNG
4164 #error "Insufficient libpng version ($MOZPNG required)."
4166 #ifndef PNG_UINT_31_MAX
4167 #error "Insufficient libpng version."
4170 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4172 CFLAGS=$_SAVE_CFLAGS
4173 LDFLAGS=$_SAVE_LDFLAGS
4176 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
4177 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
4178 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
4182 if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
4185 AC_SUBST(MOZ_PNG_ARM_NEON)
4187 fi # SKIP_LIBRARY_CHECKS
4189 dnl system HunSpell Support
4190 dnl ========================================================
4191 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4192 [ --enable-system-hunspell
4193 Use system hunspell (located with pkgconfig)],
4194 MOZ_NATIVE_HUNSPELL=1 )
4196 if test -n "$MOZ_NATIVE_HUNSPELL"; then
4197 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4200 AC_SUBST(MOZ_NATIVE_HUNSPELL)
4202 dnl ========================================================
4203 dnl system libffi Support
4204 dnl ========================================================
4205 MOZ_ARG_ENABLE_BOOL(system-ffi,
4206 [ --enable-system-ffi Use system libffi (located with pkgconfig)],
4209 if test -n "$MOZ_NATIVE_FFI"; then
4210 # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4211 # for non-GCC compilers.
4212 if test -z "$GNU_CC"; then
4213 PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4215 PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4217 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4220 dnl ========================================================
4221 dnl Java SDK support
4222 dnl ========================================================
4225 MOZ_ARG_WITH_STRING(java-bin-path,
4226 [ --with-java-bin-path=dir
4227 Location of Java binaries (java, javac, jar)],
4228 JAVA_BIN_PATH=$withval)
4230 dnl ========================================================
4234 dnl ========================================================
4236 MOZ_ARG_HEADER(Application)
4239 ENABLE_SYSTEM_EXTENSION_DIRS=1
4240 MOZ_BRANDING_DIRECTORY=
4241 MOZ_OFFICIAL_BRANDING=
4245 MOZ_AUTH_EXTENSION=1
4248 MOZ_SPEEX_RESAMPLER=1
4254 MOZ_SAMPLE_TYPE_FLOAT32=
4255 MOZ_SAMPLE_TYPE_S16=
4263 MOZ_WEBRTC_SIGNALING=
4264 MOZ_WEBRTC_IN_LIBXUL=
4265 MOZ_WEBRTC_ASSERT_ALWAYS=1
4268 MOZ_MEDIA_NAVIGATOR=
4271 MOZ_VP8_ERROR_CONCEALMENT=
4282 LIBJPEG_TURBO_ASFLAGS=
4283 LIBJPEG_TURBO_X86_ASM=
4284 LIBJPEG_TURBO_X64_ASM=
4285 LIBJPEG_TURBO_ARM_ASM=
4290 MOZ_PREF_EXTENSIONS=1
4291 MOZ_PROFILELOCKING=1
4297 MOZ_ONLY_TOUCH_EVENTS=
4298 MOZ_TOOLKIT_SEARCH=1
4300 MOZ_UNIVERSALCHARDET=1
4306 MOZ_DISABLE_CRYPTOLEGACY=
4309 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4312 MOZ_USE_NATIVE_POPUP_WINDOWS=
4313 MOZ_ANDROID_HISTORY=
4315 MOZ_ANDROID_WALLPAPER=
4320 MOZ_AUDIO_CHANNEL_MANAGER=
4323 case "$target_os" in
4326 AC_DEFINE(NS_ENABLE_TSF)
4331 *-android*|*-linuxandroid*)
4332 if test "$CPU_ARCH" = "arm" ; then
4337 MOZ_THEME_FASTSTRIPE=1
4345 MOZ_ARG_WITH_STRING(external-source-dir,
4346 [ --with-external-source-dir=dir
4347 External directory containing additional build files.],
4348 [ EXTERNAL_SOURCE_DIR=$withval])
4349 AC_SUBST(EXTERNAL_SOURCE_DIR)
4351 MOZ_ARG_ENABLE_STRING(application,
4352 [ --enable-application=APP
4356 tools/update-packaging (AUS-related packaging tools)],
4357 [ MOZ_BUILD_APP=$enableval ] )
4359 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4360 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4361 XULRUNNER_STUB_NAME=$withval)
4363 if test -z "$XULRUNNER_STUB_NAME"; then
4364 case "$target_os" in
4366 XULRUNNER_STUB_NAME=xulrunner
4369 XULRUNNER_STUB_NAME=xulrunner-stub
4372 AC_SUBST(XULRUNNER_STUB_NAME)
4374 AC_MSG_CHECKING([for application to build])
4375 if test -z "$MOZ_BUILD_APP"; then
4376 AC_MSG_RESULT([browser])
4377 MOZ_BUILD_APP=browser
4379 # "mobile" no longer exists.
4380 if test "$MOZ_BUILD_APP" = "mobile" ; then
4381 AC_MSG_RESULT([none])
4382 AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
4384 # We have a valid application only if it has a build.mk file in its top
4386 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4387 AC_MSG_RESULT([none])
4388 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4390 AC_MSG_RESULT([$MOZ_BUILD_APP])
4394 # The app update channel is 'default' when not supplied. The value is used in
4395 # the application's confvars.sh so it must be set before confvars.sh is called.
4396 MOZ_ARG_ENABLE_STRING([update-channel],
4397 [ --enable-update-channel=CHANNEL
4398 Select application update channel (default=default)],
4399 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4401 if test -z "$MOZ_UPDATE_CHANNEL"; then
4402 MOZ_UPDATE_CHANNEL=default
4404 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4405 AC_SUBST(MOZ_UPDATE_CHANNEL)
4407 # Allow to specify a Google API key file that contains the secret key to be
4408 # used for various Google API requests.
4409 MOZ_ARG_WITH_STRING(google-api-keyfile,
4410 [ --with-google-api-keyfile=file Use the secret key contained in the given keyfile for Google API requests],
4411 MOZ_GOOGLE_API_KEY=`cat $withval`)
4412 if test -z "$MOZ_GOOGLE_API_KEY"; then
4413 MOZ_GOOGLE_API_KEY=no-google-api-key
4415 AC_SUBST(MOZ_GOOGLE_API_KEY)
4417 # Allow the application to influence configure with a confvars.sh script.
4418 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4419 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4420 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4421 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4426 # Allow influencing configure with a defines.sh script.
4427 . "${srcdir}/build/defines.sh"
4429 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
4431 if test "$BUILDING_RELEASE"; then
4432 # Override value in defines.sh, if any
4433 EARLY_BETA_OR_EARLIER=
4434 elif test "$EARLY_BETA_OR_EARLIER"; then
4435 AC_DEFINE(EARLY_BETA_OR_EARLIER)
4437 AC_SUBST(EARLY_BETA_OR_EARLIER)
4439 # Allow the application to provide a subconfigure script
4440 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4441 do_output_subdirs() {
4442 if test -n "$_subconfigure_subdirs"; then
4443 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4445 _subconfigure_subdir="$1"
4446 _subconfigure_config_args="$ac_configure_args"
4448 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4449 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4450 "${srcdir}/build/autoconf/altoptions.m4" \
4451 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4456 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4457 MOZ_ARG_WITH_STRING(app-name,
4458 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4459 WITH_APP_NAME=$withval,
4462 if test -n "$WITH_APP_NAME" ; then
4463 MOZ_APP_NAME="$WITH_APP_NAME"
4466 MOZ_ARG_WITH_STRING(app-basename,
4467 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4468 WITH_APP_BASENAME=$withval,
4471 if test -n "$WITH_APP_BASENAME" ; then
4472 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4475 # Now is a good time to test for logic errors, define mismatches, etc.
4476 case "$MOZ_BUILD_APP" in
4478 if test "$LIBXUL_SDK"; then
4479 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4484 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4485 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4487 case "$MOZ_BUILD_APP" in
4489 AC_DEFINE(MOZ_PHOENIX)
4493 AC_DEFINE(MOZ_XULRUNNER)
4500 AC_SUBST(MOZ_BUILD_APP)
4501 AC_SUBST(MOZ_PHOENIX)
4502 AC_SUBST(MOZ_XULRUNNER)
4505 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4507 dnl ========================================================
4508 dnl Check android sdk version depending on mobile target
4509 dnl ========================================================
4511 if test -z "$gonkdir" ; then
4512 # Minimum Android SDK API Level we require.
4513 case "$MOZ_BUILD_APP" in
4515 android_min_api_level=16
4517 *-android*|*-linuxandroid*)
4521 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])
4527 MOZ_ANDROID_SDK($android_min_api_level)
4530 dnl ========================================================
4532 dnl = Toolkit Options
4534 dnl ========================================================
4535 MOZ_ARG_HEADER(Toolkit Options)
4537 dnl ========================================================
4538 dnl = Select the default toolkit
4539 dnl ========================================================
4540 MOZ_ARG_ENABLE_STRING(default-toolkit,
4541 [ --enable-default-toolkit=TK
4542 Select default toolkit
4543 Platform specific defaults:
4544 Mac OS X - cairo-cocoa
4546 Win32 - cairo-windows
4550 [ _DEFAULT_TOOLKIT=$enableval ],
4551 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4553 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4554 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4555 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4556 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4557 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4558 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4559 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4560 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4561 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4562 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4564 dnl nglayout only supports building with one toolkit,
4565 dnl so ignore everything after the first comma (",").
4566 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4568 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4571 MOZ_ARG_WITHOUT_BOOL(x,
4572 [ --without-x Build without X11],
4575 dnl ========================================================
4576 dnl = Enable the toolkit as needed =
4577 dnl ========================================================
4581 case "$MOZ_WIDGET_TOOLKIT" in
4584 MOZ_WIDGET_TOOLKIT=windows
4587 MOZ_INSTRUMENT_EVENT_LOOP=1
4588 if test -n "$GNU_CC"; then
4594 MOZ_WIDGET_TOOLKIT=gtk3
4597 MOZ_ENABLE_XREMOTE=1
4599 MOZ_GL_DEFAULT_PROVIDER=GLX
4605 TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4606 TK_LIBS='$(MOZ_GTK3_LIBS)'
4608 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4610 MOZ_INSTRUMENT_EVENT_LOOP=1
4613 cairo-gtk2|cairo-gtk2-x11)
4614 MOZ_WIDGET_TOOLKIT=gtk2
4617 MOZ_ENABLE_XREMOTE=1
4619 MOZ_GL_DEFAULT_PROVIDER=GLX
4625 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4626 TK_LIBS='$(MOZ_GTK2_LIBS)'
4627 AC_DEFINE(MOZ_WIDGET_GTK2)
4629 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4631 MOZ_INSTRUMENT_EVENT_LOOP=1
4635 MOZ_WIDGET_TOOLKIT=qt
4637 if test -z "$WITHOUT_X11"; then
4638 MOZ_ENABLE_XREMOTE=1
4639 MOZ_GL_DEFAULT_PROVIDER=GLX
4648 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4649 TK_LIBS='$(MOZ_QT_LIBS)'
4650 AC_DEFINE(MOZ_WIDGET_QT)
4652 AC_DEFINE(QT_NO_KEYWORDS)
4656 MOZ_WIDGET_TOOLKIT=os2
4658 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4659 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4664 MOZ_WIDGET_TOOLKIT=cocoa
4665 AC_DEFINE(MOZ_WIDGET_COCOA)
4666 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4667 TK_LIBS='-framework CoreLocation -framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4668 TK_CFLAGS="-DNO_X11"
4669 CFLAGS="$CFLAGS $TK_CFLAGS"
4670 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4671 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc'
4672 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc'
4673 MOZ_USER_DIR="Mozilla"
4674 MOZ_FS_LAYOUT=bundle
4676 MOZ_INSTRUMENT_EVENT_LOOP=1
4680 MOZ_WIDGET_TOOLKIT=uikit
4681 AC_DEFINE(MOZ_WIDGET_UIKIT)
4682 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4683 TK_CFLAGS="-DNO_X11"
4684 TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4685 CFLAGS="$CFLAGS $TK_CFLAGS"
4686 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4687 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc'
4688 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc'
4689 MOZ_USER_DIR="Mozilla"
4690 MOZ_FS_LAYOUT=bundle
4694 AC_DEFINE(MOZ_WIDGET_ANDROID)
4695 MOZ_WIDGET_TOOLKIT=android
4696 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4697 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4700 MOZ_INSTRUMENT_EVENT_LOOP=1
4704 AC_DEFINE(MOZ_WIDGET_GONK)
4705 AC_DEFINE(MOZ_TOUCH)
4706 MOZ_WIDGET_TOOLKIT=gonk
4707 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4708 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4716 AC_SUBST(MOZ_PDF_PRINTING)
4717 if test "$MOZ_PDF_PRINTING"; then
4718 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4719 AC_DEFINE(MOZ_PDF_PRINTING)
4722 if test "$MOZ_ENABLE_XREMOTE"; then
4723 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4726 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4727 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4730 if test "$COMPILE_ENVIRONMENT"; then
4731 if test "$MOZ_ENABLE_GTK3"; then
4732 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4734 if test "$MOZ_ENABLE_GTK2"; then
4735 if test "$MOZ_X11"; then
4736 GDK_PACKAGES=gdk-x11-2.0
4739 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4742 fi # COMPILE_ENVIRONMENT
4744 AC_SUBST(MOZ_FS_LAYOUT)
4746 dnl ========================================================
4747 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4748 dnl their usage and use them in spidermonkey.
4749 dnl ========================================================
4750 MOZ_ARG_WITH_BOOL(arm-kuser,
4751 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4753 if test -n "$USE_ARM_KUSER"; then
4754 AC_DEFINE(USE_ARM_KUSER)
4757 dnl ========================================================
4758 dnl = startup-notification support module
4759 dnl ========================================================
4761 if test "$MOZ_ENABLE_GTK"
4763 MOZ_ENABLE_STARTUP_NOTIFICATION=
4765 MOZ_ARG_ENABLE_BOOL(startup-notification,
4766 [ --enable-startup-notification
4767 Enable startup-notification support (default: disabled) ],
4768 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4769 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4770 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4772 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4773 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4774 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4775 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4777 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4779 MOZ_ENABLE_STARTUP_NOTIFICATION=
4783 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4784 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4787 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4789 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4790 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4791 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4793 dnl ========================================================
4795 dnl ========================================================
4796 if test "$MOZ_ENABLE_QT"
4798 MOZ_ARG_WITH_STRING(qtdir,
4799 [ --with-qtdir=\$dir Specify Qt directory ],
4802 if test -z "$QTDIR"; then
4803 AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4805 HOST_QMAKE="$QTDIR/bin/qmake"
4807 QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4809 if test -z "$QTDIR"; then
4812 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4813 PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5OpenGL Qt5Widgets Qt5PrintSupport, ,
4815 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4817 QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4818 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4821 AC_MSG_RESULT("Using qt4: $QT_VERSION")
4822 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL, ,
4824 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qt4 development package, (On Ubuntu, you might try installing the packages libqt4-dev libqt4-opengl-dev.)])
4828 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4832 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4833 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4835 MOZ_QT_CFLAGS="-DQT_SHARED"
4836 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4837 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4838 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4839 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4840 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4841 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4845 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4846 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml -lQt5OpenGL"
4847 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4848 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4849 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4850 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4853 AC_MSG_RESULT("Using qt4: $QT_VERSION")
4854 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4855 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4858 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4862 HOST_MOC="$QTDIR/bin/moc"
4863 HOST_RCC="$QTDIR/bin/rcc"
4865 if test -z "$HOST_MOC"; then
4866 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4869 if test -z "$HOST_RCC"; then
4870 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4877 MOZ_ENABLE_QMSYSTEM2=
4878 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4879 MOZ_ENABLE_QMSYSTEM2=1,
4880 MOZ_ENABLE_QMSYSTEM2=)
4882 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4883 MOZ_ENABLE_QMSYSTEM2=1
4884 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4885 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4886 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4889 MOZ_ENABLE_QTNETWORK=
4890 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4891 MOZ_ENABLE_QTNETWORK=1,
4892 MOZ_ENABLE_QTNETWORK=)
4894 if test "$MOZ_ENABLE_QTNETWORK"; then
4895 MOZ_ENABLE_QTNETWORK=1
4896 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4899 MOZ_ENABLE_QTMOBILITY=
4900 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4901 MOZ_ENABLE_QTMOBILITY=1,
4902 MOZ_ENABLE_QTMOBILITY=)
4903 if test "$MOZ_ENABLE_QTMOBILITY"; then
4904 MOZ_ENABLE_QTMOBILITY=1
4905 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4906 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4908 AC_CHECK_LIB(QtSensors, main, [
4909 MOZ_ENABLE_QTMOBILITY=1
4910 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4911 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4912 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4913 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4914 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4917 if test "$MOZ_ENABLE_QTMOBILITY"; then
4918 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4922 AC_SUBST(GTK_CONFIG)
4926 AC_SUBST(MOZ_ENABLE_GTK2)
4927 AC_SUBST(MOZ_ENABLE_GTK3)
4928 AC_SUBST(MOZ_ENABLE_GTK)
4929 AC_SUBST(MOZ_ENABLE_QT)
4930 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4931 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4932 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4933 AC_SUBST(MOZ_ENABLE_XREMOTE)
4934 AC_SUBST(MOZ_GTK2_CFLAGS)
4935 AC_SUBST(MOZ_GTK2_LIBS)
4936 AC_SUBST(MOZ_GTK3_CFLAGS)
4937 AC_SUBST(MOZ_GTK3_LIBS)
4938 AC_SUBST(MOZ_WIDGET_GTK)
4939 AC_SUBST(MOZ_QT_CFLAGS)
4940 AC_SUBST(MOZ_QT_LIBS)
4947 dnl ========================================================
4949 dnl = Components & Features
4951 dnl ========================================================
4952 MOZ_ARG_HEADER(Components and Features)
4954 dnl ========================================================
4956 dnl ========================================================
4957 MOZ_ARG_ENABLE_STRING(ui-locale,
4958 [ --enable-ui-locale=ab-CD
4959 Select the user interface locale (default: en-US)],
4960 MOZ_UI_LOCALE=$enableval )
4961 AC_SUBST(MOZ_UI_LOCALE)
4963 dnl ========================================================
4964 dnl = Trademarked Branding
4965 dnl ========================================================
4966 MOZ_ARG_ENABLE_BOOL(official-branding,
4967 [ --enable-official-branding
4968 Enable Official mozilla.org Branding
4969 Do not distribute builds with
4970 --enable-official-branding unless you have
4971 permission to use trademarks per
4972 http://www.mozilla.org/foundation/trademarks/ .],
4974 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4975 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4977 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4978 MOZ_OFFICIAL_BRANDING=1
4980 ], MOZ_OFFICIAL_BRANDING=)
4982 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4983 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4984 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4987 MOZ_ARG_WITH_STRING(branding,
4988 [ --with-branding=dir Use branding from the specified directory.],
4989 MOZ_BRANDING_DIRECTORY=$withval)
4991 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4992 if test -z "$REAL_BRANDING_DIRECTORY"; then
4993 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4996 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4997 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5000 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5002 dnl ========================================================
5003 dnl = Distribution ID
5004 dnl ========================================================
5005 MOZ_ARG_WITH_STRING(distribution-id,
5006 [ --with-distribution-id=ID
5007 Set distribution-specific id (default=org.mozilla)],
5008 [ val=`echo $withval`
5009 MOZ_DISTRIBUTION_ID="$val"])
5011 if test -z "$MOZ_DISTRIBUTION_ID"; then
5012 MOZ_DISTRIBUTION_ID="org.mozilla"
5015 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5016 AC_SUBST(MOZ_DISTRIBUTION_ID)
5019 dnl ========================================================
5020 dnl complex text support off by default
5021 dnl ========================================================
5022 MOZ_ARG_DISABLE_BOOL(pango,
5023 [ --disable-pango Disable usage of Pango ],
5027 dnl ========================================================
5029 dnl ========================================================
5030 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
5034 if test "$MOZ_PANGO"
5036 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5038 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
5039 AC_SUBST(MOZ_PANGO_CFLAGS)
5040 AC_SUBST(MOZ_PANGO_LIBS)
5041 AC_DEFINE(MOZ_PANGO)
5043 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
5044 AC_SUBST(FT2_CFLAGS)
5049 dnl ========================================================
5050 dnl = GnomeVFS, GIO and GConf support module
5051 dnl ========================================================
5055 dnl build the GIO extension by default only when the
5056 dnl GTK2 toolkit is in use.
5057 if test "$MOZ_ENABLE_GTK"
5063 dnl ========================================================
5064 dnl = GnomeVFS support module
5065 dnl ========================================================
5066 MOZ_ARG_ENABLE_BOOL(gnomevfs,
5067 [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
5068 MOZ_ENABLE_GNOMEVFS=force,
5069 MOZ_ENABLE_GNOMEVFS=)
5071 if test "$MOZ_ENABLE_GNOMEVFS"
5073 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5074 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5075 MOZ_ENABLE_GNOMEVFS=1
5076 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5078 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5080 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5082 MOZ_ENABLE_GNOMEVFS=
5086 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5087 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5088 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5090 dnl ========================================================
5091 dnl = GIO support module
5092 dnl ========================================================
5093 MOZ_ARG_DISABLE_BOOL(gio,
5094 [ --disable-gio Disable GIO support],
5096 MOZ_ENABLE_GIO=force)
5098 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
5100 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
5101 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
5102 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5103 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5105 AC_DEFINE(MOZ_ENABLE_GIO)
5107 if test "$MOZ_ENABLE_GIO" = "force"
5109 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5115 AC_SUBST(MOZ_ENABLE_GIO)
5116 AC_SUBST(MOZ_GIO_CFLAGS)
5117 AC_SUBST(MOZ_GIO_LIBS)
5119 dnl ========================================================
5120 dnl = GConf support module
5121 dnl ========================================================
5122 MOZ_ARG_DISABLE_BOOL(gconf,
5123 [ --disable-gconf Disable Gconf support ],
5125 MOZ_ENABLE_GCONF=force)
5127 if test "$MOZ_ENABLE_GCONF"
5129 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5130 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
5133 if test "$MOZ_ENABLE_GCONF" = "force"
5135 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5141 if test "$MOZ_ENABLE_GCONF"; then
5142 AC_DEFINE(MOZ_ENABLE_GCONF)
5145 AC_SUBST(MOZ_ENABLE_GCONF)
5146 AC_SUBST(MOZ_GCONF_CFLAGS)
5147 AC_SUBST(MOZ_GCONF_LIBS)
5150 dnl ========================================================
5151 dnl = libproxy support
5152 dnl ========================================================
5154 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
5156 MOZ_ENABLE_LIBPROXY=
5158 MOZ_ARG_ENABLE_BOOL(libproxy,
5159 [ --enable-libproxy Enable libproxy support ],
5160 MOZ_ENABLE_LIBPROXY=1,
5161 MOZ_ENABLE_LIBPROXY=)
5163 if test "$MOZ_ENABLE_LIBPROXY"
5165 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5166 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5169 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5170 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5171 AC_SUBST(MOZ_LIBPROXY_LIBS)
5173 dnl ========================================================
5174 dnl = GNOME component (mozgnome)
5175 dnl ========================================================
5177 if test "$MOZ_ENABLE_GTK2"
5179 MOZ_ENABLE_GNOME_COMPONENT=1
5181 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5183 dnl ========================================================
5184 dnl = libgnomeui support module
5185 dnl ========================================================
5187 if test "$MOZ_ENABLE_GTK"
5189 MOZ_ARG_ENABLE_BOOL(gnomeui,
5190 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
5191 MOZ_ENABLE_GNOMEUI=force,
5192 MOZ_ENABLE_GNOMEUI=)
5194 if test "$MOZ_ENABLE_GNOMEUI"
5196 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5198 MOZ_ENABLE_GNOMEUI=1
5200 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5202 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5208 if test "$MOZ_ENABLE_GNOMEUI"; then
5209 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5213 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5214 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5216 dnl ========================================================
5218 dnl ========================================================
5220 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
5224 MOZ_ARG_DISABLE_BOOL(dbus,
5225 [ --disable-dbus Disable dbus support ],
5229 if test "$MOZ_ENABLE_DBUS"
5231 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5232 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5233 AC_DEFINE(MOZ_ENABLE_DBUS)
5236 AC_SUBST(MOZ_ENABLE_DBUS)
5237 AC_SUBST(MOZ_DBUS_CFLAGS)
5238 AC_SUBST(MOZ_DBUS_LIBS)
5239 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5240 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5242 dnl ========================================================
5243 dnl = Enable Android History instead of Places
5244 dnl ========================================================
5245 if test -n "$MOZ_ANDROID_HISTORY"; then
5246 if test -z "$MOZ_PLACES"; then
5247 AC_DEFINE(MOZ_ANDROID_HISTORY)
5249 AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
5253 dnl ========================================================
5254 dnl = Build with the Android compositor
5255 dnl ========================================================
5256 if test -n "$MOZ_ANDROID_OMTC"; then
5257 dnl Do this if defined in confvars.sh
5258 AC_DEFINE(MOZ_ANDROID_OMTC)
5261 dnl ========================================================
5262 dnl = Disable WebSMS backend
5263 dnl ========================================================
5264 MOZ_ARG_DISABLE_BOOL(websms-backend,
5265 [ --disable-websms-backend
5266 Disable WebSMS backend],
5267 MOZ_WEBSMS_BACKEND=,
5268 MOZ_WEBSMS_BACKEND=1)
5270 if test -n "$MOZ_WEBSMS_BACKEND"; then
5271 AC_DEFINE(MOZ_WEBSMS_BACKEND)
5274 dnl ========================================================
5275 dnl = Enable SET_WALLPAPER permission on Android
5276 dnl ========================================================
5277 if test -n "$MOZ_ANDROID_WALLPAPER"; then
5278 AC_DEFINE(MOZ_ANDROID_WALLPAPER)
5281 dnl ========================================================
5282 dnl = Enable NFC permission on Android
5283 dnl ========================================================
5284 if test -n "$MOZ_ANDROID_BEAM"; then
5285 AC_DEFINE(MOZ_ANDROID_BEAM)
5288 dnl ========================================================
5289 dnl = JS Debugger XPCOM component (js/jsd)
5290 dnl ========================================================
5291 MOZ_ARG_DISABLE_BOOL(jsd,
5292 [ --disable-jsd Disable JavaScript debug library],
5297 dnl ========================================================
5298 dnl = Enable IPDL's "expensive" unit tests
5299 dnl ========================================================
5302 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5303 [ --enable-ipdl-tests Enable expensive IPDL tests],
5307 if test -n "$MOZ_IPDL_TESTS"; then
5308 AC_DEFINE(MOZ_IPDL_TESTS)
5311 AC_SUBST(MOZ_IPDL_TESTS)
5313 dnl ========================================================
5314 dnl = Disable building dbm
5315 dnl ========================================================
5316 MOZ_ARG_DISABLE_BOOL(dbm,
5317 [ --disable-dbm Disable building dbm],
5321 dnl bi-directional support always on
5325 dnl ========================================================
5326 dnl accessibility support on by default on all platforms
5327 dnl ========================================================
5328 MOZ_ARG_DISABLE_BOOL(accessibility,
5329 [ --disable-accessibility Disable accessibility support],
5332 if test "$ACCESSIBILITY"; then
5335 if test -z "$MIDL"; then
5336 if test "$GCC" != "yes"; then
5337 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5339 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.])
5343 AC_DEFINE(ACCESSIBILITY)
5346 dnl ========================================================
5347 dnl Accessibility is required for the linuxgl widget
5349 dnl ========================================================
5350 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5351 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5354 dnl ========================================================
5355 dnl Disable printing
5356 dnl ========================================================
5357 MOZ_ARG_DISABLE_BOOL(printing,
5358 [ --disable-printing Disable printing support],
5362 if test "$NS_PRINTING"; then
5363 AC_DEFINE(NS_PRINTING)
5364 AC_DEFINE(NS_PRINT_PREVIEW)
5367 dnl Turn off webrtc for OS's we don't handle yet, but allow
5368 dnl --enable-webrtc to override. Can disable for everything in
5369 dnl the master list above.
5370 if test -n "$MOZ_WEBRTC"; then
5372 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*)
5376 dnl default to disabled for all others
5382 # target_arch is from {ia32|x64|arm|ppc}
5385 WEBRTC_TARGET_ARCH=x64
5389 WEBRTC_TARGET_ARCH=arm
5393 WEBRTC_TARGET_ARCH=ia32
5397 WEBRTC_TARGET_ARCH=ppc
5400 # unsupported arch for webrtc
5401 WEBRTC_TARGET_ARCH=unknown
5407 dnl ========================================================
5408 dnl = Disable WebRTC code
5409 dnl ========================================================
5410 MOZ_ARG_DISABLE_BOOL(webrtc,
5411 [ --disable-webrtc Disable support for WebRTC],
5415 if test -n "$MOZ_WEBRTC"; then
5416 AC_DEFINE(MOZ_WEBRTC)
5417 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
5418 dnl opt/production builds (via MOZ_CRASH())
5419 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
5423 MOZ_VP8_ERROR_CONCEALMENT=1
5425 dnl enable once Signaling lands
5426 MOZ_WEBRTC_SIGNALING=1
5427 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5428 if test "${OS_TARGET}" = "WINNT"; then
5429 MOZ_WEBRTC_IN_LIBXUL=1
5431 dnl enable once PeerConnection lands
5432 MOZ_PEERCONNECTION=1
5433 AC_DEFINE(MOZ_PEERCONNECTION)
5440 AC_SUBST(MOZ_WEBRTC)
5441 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5442 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5443 AC_SUBST(MOZ_PEERCONNECTION)
5444 AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
5445 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5449 dnl Use integers over floats for audio on B2G and Android, because audio
5450 dnl backends for those platforms don't support floats.
5451 if test "$OS_TARGET" = "Android"; then
5452 MOZ_SAMPLE_TYPE_S16=1
5453 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5454 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5456 MOZ_SAMPLE_TYPE_FLOAT32=1
5457 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5458 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5461 dnl ========================================================
5462 dnl = Disable Speech API code
5463 dnl ========================================================
5464 MOZ_ARG_DISABLE_BOOL(webspeech,
5465 [ --disable-webspeech Disable support for HTML Speech API],
5469 if test -n "$MOZ_WEBSPEECH"; then
5470 AC_DEFINE(MOZ_WEBSPEECH)
5473 AC_SUBST(MOZ_WEBSPEECH)
5475 dnl ========================================================
5476 dnl = Enable Raw Codecs
5477 dnl ========================================================
5478 MOZ_ARG_ENABLE_BOOL(raw,
5479 [ --enable-raw Enable support for RAW media],
5483 if test -n "$MOZ_RAW"; then
5489 dnl ========================================================
5490 dnl = Disable Ogg Codecs
5491 dnl ========================================================
5492 MOZ_ARG_DISABLE_BOOL(ogg,
5493 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5497 if test -n "$MOZ_OGG"; then
5501 dnl Checks for __attribute__(aligned()) directive
5502 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5503 [ac_cv_c_attribute_aligned],
5504 [ac_cv_c_attribute_aligned=0
5505 CFLAGS_save="${CFLAGS}"
5506 CFLAGS="${CFLAGS} -Werror"
5507 for ac_cv_c_attr_align_try in 64 32 16 8; do
5508 echo "trying $ac_cv_c_attr_align_try"
5510 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5511 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5512 if test "$ac_cv_c_attribute_aligned" != 0; then
5516 CFLAGS="${CFLAGS_save}"])
5517 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5518 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5519 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5523 dnl ========================================================
5524 dnl = Disable Opus audio codec support
5525 dnl ========================================================
5526 MOZ_ARG_DISABLE_BOOL(opus,
5527 [ --disable-opus Disable support for Opus audio],
5531 dnl ========================================================
5532 dnl = Disable VP8 decoder support
5533 dnl ========================================================
5534 MOZ_ARG_DISABLE_BOOL(webm,
5535 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5539 if test -n "$MOZ_WEBM"; then
5544 dnl ========================================================
5545 dnl = Windows Media Foundation support
5546 dnl ========================================================
5547 if test "$OS_ARCH" = "WINNT"; then
5548 dnl Enable Windows Media Foundation support by default.
5549 dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5550 dnl guaranteed to have a recent-enough SDK to build WMF.
5554 MOZ_ARG_DISABLE_BOOL(wmf,
5555 [ --disable-wmf Disable support for Windows Media Foundation],
5559 if test -n "$MOZ_WMF"; then
5564 dnl ========================================================
5565 dnl = Enable media plugin support
5566 dnl ========================================================
5567 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5568 dnl Enable support on android by default
5572 MOZ_ARG_ENABLE_BOOL(media-plugins,
5573 [ --enable-media-plugins Enable support for media plugins],
5574 MOZ_MEDIA_PLUGINS=1,
5577 if test -n "$MOZ_MEDIA_PLUGINS"; then
5578 AC_DEFINE(MOZ_MEDIA_PLUGINS)
5581 dnl ========================================================
5582 dnl = Enable getUserMedia support
5583 dnl ========================================================
5584 MOZ_ARG_ENABLE_BOOL(media-navigator,
5585 [ --enable-media-navigator Enable support for getUserMedia],
5586 MOZ_MEDIA_NAVIGATOR=1,
5587 MOZ_MEDIA_NAVIGATOR=)
5589 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5590 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5593 dnl ========================================================
5594 dnl = Enable building OMX media plugin (B2G or Android)
5595 dnl ========================================================
5596 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5597 dnl Enable support on android by default
5601 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5602 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5606 if test -n "$MOZ_OMX_PLUGIN"; then
5607 if test "$OS_TARGET" = "Android"; then
5608 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5609 AC_DEFINE(MOZ_OMX_PLUGIN)
5611 dnl fail if we're not building on Gonk or Android
5612 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5616 dnl system libvpx Support
5617 dnl ========================================================
5618 MOZ_ARG_WITH_BOOL(system-libvpx,
5619 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5620 MOZ_NATIVE_LIBVPX=1)
5625 if test -n "$MOZ_VP8"; then
5627 if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5628 AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5630 if test -n "$MOZ_VP8_ENCODER" ; then
5631 AC_DEFINE(MOZ_VP8_ENCODER)
5634 if test -n "$MOZ_NATIVE_LIBVPX"; then
5635 dnl ============================
5636 dnl === libvpx Version check ===
5637 dnl ============================
5638 dnl Check to see if we have a system libvpx package.
5639 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5641 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5642 [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.])])
5645 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5646 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5651 AC_SUBST(MOZ_NATIVE_LIBVPX)
5652 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5653 AC_SUBST(MOZ_LIBVPX_LIBS)
5655 if test "$MOZ_WEBM"; then
5657 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5664 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5666 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5667 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5668 dnl We currently require gcc on all arm platforms.
5671 VPX_NEED_OBJ_INT_EXTRACT=
5673 dnl See if we have assembly on this platform.
5674 case "$OS_ARCH:$CPU_ARCH" in
5676 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5680 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5684 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5688 dnl Check for yasm 1.1 or greater.
5689 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5690 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.])
5691 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5692 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.])
5694 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5696 dnl The encoder needs obj_int_extract to get asm offsets.
5700 if test -n "$GNU_AS" ; then
5702 dnl These flags are a lie; they're just used to enable the requisite
5703 dnl opcodes; actual arch detection is done at runtime.
5704 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5705 VPX_DASH_C_FLAG="-c"
5706 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5707 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5712 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5713 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5718 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5719 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5725 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5726 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.])
5729 if test -n "$MOZ_VP8_ENCODER" -a \
5730 -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5731 dnl We prefer to get asm offsets using inline assembler, which the above
5732 dnl compilers can do. When we're not using one of those, we have to fall
5733 dnl back to obj_int_extract, which reads them from a compiled object
5734 dnl file. Unfortunately, that only works if we're compiling on a system
5735 dnl with the header files for the appropriate object file format.
5736 VPX_NEED_OBJ_INT_EXTRACT=1
5739 if test -n "$VPX_X86_ASM"; then
5740 AC_DEFINE(VPX_X86_ASM)
5741 elif test -n "$VPX_ARM_ASM"; then
5742 AC_DEFINE(VPX_ARM_ASM)
5744 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5748 dnl ========================================================
5749 dnl = Disable Wave decoder support
5750 dnl ========================================================
5751 MOZ_ARG_DISABLE_BOOL(wave,
5752 [ --disable-wave Disable Wave decoder support],
5756 if test -n "$MOZ_WAVE"; then
5761 dnl ========================================================
5762 dnl = Handle dependent CUBEB and MEDIA defines
5763 dnl ========================================================
5765 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5766 AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5769 if test -n "$MOZ_SOUNDTOUCH"; then
5770 AC_DEFINE(MOZ_SOUNDTOUCH)
5773 if test -n "$MOZ_CUBEB"; then
5774 AC_DEFINE(MOZ_CUBEB)
5777 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5778 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/])
5781 if test -n "$MOZ_VORBIS"; then
5782 AC_DEFINE(MOZ_VORBIS)
5785 if test -n "$MOZ_TREMOR"; then
5786 AC_DEFINE(MOZ_TREMOR)
5789 if test -n "$MOZ_OPUS"; then
5793 dnl ========================================================
5794 dnl = Check alsa availability on Linux if using sydneyaudio
5795 dnl ========================================================
5797 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5798 if test -n "$MOZ_CUBEB" -a "$OS_TARGET" = "Linux"; then
5802 MOZ_ARG_ENABLE_BOOL(alsa,
5803 [ --enable-alsa Enable Alsa support (default on Linux)],
5807 if test -n "$MOZ_ALSA"; then
5808 AC_DEFINE(MOZ_CUBEB)
5809 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5810 [echo "$MOZ_ALSA_PKG_ERRORS"
5811 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.)])])
5815 AC_SUBST(MOZ_ALSA_CFLAGS)
5816 AC_SUBST(MOZ_ALSA_LIBS)
5818 dnl ========================================================
5819 dnl = Enable PulseAudio
5820 dnl ========================================================
5822 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5823 [ --enable-pulseaudio Enable PulseAudio support (experimental)],
5827 if test -n "$MOZ_PULSEAUDIO"; then
5828 AC_DEFINE(MOZ_CUBEB)
5829 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5830 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5831 AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
5834 AC_SUBST(MOZ_PULSEAUDIO)
5835 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5836 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5838 dnl ========================================================
5839 dnl = Enable GStreamer
5840 dnl ========================================================
5841 if test "$OS_TARGET" = "Linux"; then
5845 MOZ_ARG_ENABLE_BOOL(gstreamer,
5846 [ --enable-gstreamer Enable GStreamer support],
5850 if test "$MOZ_GSTREAMER"; then
5851 # API version, eg 0.10, 1.0 etc
5852 GST_API_VERSION=0.10
5853 # core/base release number
5855 PKG_CHECK_MODULES(GSTREAMER,
5856 gstreamer-$GST_API_VERSION >= $GST_VERSION
5857 gstreamer-app-$GST_API_VERSION
5858 gstreamer-plugins-base-$GST_API_VERSION, ,
5859 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]))
5860 if test -n "$GSTREAMER_LIBS"; then
5861 _SAVE_LDFLAGS=$LDFLAGS
5862 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5863 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5864 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5865 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5867 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.])
5869 LDFLAGS=$_SAVE_LDFLAGS
5871 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])
5874 AC_SUBST(GSTREAMER_CFLAGS)
5875 AC_SUBST(GSTREAMER_LIBS)
5876 AC_SUBST(MOZ_GSTREAMER)
5878 if test -n "$MOZ_GSTREAMER"; then
5879 AC_DEFINE(MOZ_GSTREAMER)
5883 dnl ========================================================
5884 dnl Permissions System
5885 dnl ========================================================
5886 MOZ_ARG_DISABLE_BOOL(permissions,
5887 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5892 dnl ========================================================
5894 dnl ========================================================
5895 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5896 [ --disable-negotiateauth Disable GSS-API negotiation ],
5897 MOZ_AUTH_EXTENSION=,
5898 MOZ_AUTH_EXTENSION=1 )
5900 dnl ========================================================
5901 dnl Pref extensions (autoconfig)
5902 dnl ========================================================
5903 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5904 [ --disable-pref-extensions
5905 Disable pref extensions such as autoconfig],
5906 MOZ_PREF_EXTENSIONS=,
5907 MOZ_PREF_EXTENSIONS=1 )
5909 dnl ========================================================
5910 dnl Searching of system directories for extensions.
5911 dnl Note: this switch is meant to be used for test builds
5912 dnl whose behavior should not depend on what happens to be
5913 dnl installed on the local machine.
5914 dnl ========================================================
5915 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5916 [ --disable-system-extension-dirs
5917 Disable searching system- and account-global
5918 directories for extensions of any kind; use
5919 only profile-specific extension directories],
5920 ENABLE_SYSTEM_EXTENSION_DIRS=,
5921 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5922 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5923 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5926 dnl ========================================================
5927 dnl = Universalchardet
5928 dnl ========================================================
5929 MOZ_ARG_DISABLE_BOOL(universalchardet,
5930 [ --disable-universalchardet
5931 Disable universal encoding detection],
5932 MOZ_UNIVERSALCHARDET=,
5933 MOZ_UNIVERSALCHARDET=1 )
5935 if test -n "${JAVA_BIN_PATH}"; then
5936 dnl Look for javac and jar in the specified path.
5937 JAVA_PATH="$JAVA_BIN_PATH"
5939 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5940 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5943 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5944 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5945 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5946 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5947 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5948 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5950 if test -n "${JAVA_BIN_PATH}" -o \
5951 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5952 if test -z "$JAVA" -o "$JAVA" = ":"; then
5953 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}])
5955 if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5956 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}])
5958 if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5959 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}])
5961 if test -z "$JAR" -o "$JAR" = ":"; then
5962 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}])
5964 if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5965 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}])
5967 if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5968 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}])
5972 dnl ========================================================
5973 dnl = ANGLE OpenGL->D3D translator for WebGL
5974 dnl = * only applies to win32
5975 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5976 dnl ========================================================
5978 MOZ_DIRECTX_SDK_PATH=
5979 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5980 MOZ_D3DCOMPILER_CAB=
5981 MOZ_D3DCOMPILER_DLL=
5982 case "$target_os" in
5984 MOZ_ANGLE_RENDERER=1
5988 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5989 case "${target_cpu}" in
5991 MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5994 MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5998 MOZ_ARG_DISABLE_BOOL(webgl,
5999 [ --disable-webgl Disable building of the WebGL implementation],
6000 MOZ_WEBGL_DISABLED=1,
6001 MOZ_WEBGL_DISABLED=)
6003 if test -n "$MOZ_WEBGL_DISABLED"; then
6008 if test -n "$MOZ_WEBGL_CONFORMANT"; then
6009 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
6012 # Locate a DirectX SDK here so we can use it for both ANGLE and
6014 if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
6015 # Get the SDK path from the registry.
6016 # First try to get the June 2010 SDK
6017 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
6018 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
6019 # Otherwise just take whatever comes first
6020 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
6022 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'`
6025 if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
6026 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
6027 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.])
6030 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
6031 test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
6032 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
6033 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
6035 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.])
6038 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
6039 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'`
6041 if test -z "$MOZ_D3DX9_VERSION" ; then
6042 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.])
6045 MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6047 if test -z "$MOZ_D3DCOMPILER_CAB"; then
6048 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.])
6051 MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
6054 dnl ========================================================
6056 dnl ========================================================
6058 MOZ_GAMEPAD_BACKEND=stub
6060 # Gamepad DOM is built on supported platforms by default.
6061 case "$OS_TARGET" in
6069 MOZ_ARG_DISABLE_BOOL(gamepad,
6070 [ --disable-gamepad Disable gamepad support],
6074 if test "$MOZ_GAMEPAD"; then
6075 case "$OS_TARGET" in
6077 MOZ_GAMEPAD_BACKEND=cocoa
6080 if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
6081 if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
6084 elif test "$GCC" != "yes"; then
6087 if test -z "$MOZ_GAMEPAD"; then
6088 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.])
6090 MOZ_GAMEPAD_BACKEND=windows
6093 MOZ_CHECK_HEADER([linux/joystick.h])
6094 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
6095 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.])
6097 MOZ_GAMEPAD_BACKEND=linux
6103 AC_DEFINE(MOZ_GAMEPAD)
6105 AC_SUBST(MOZ_GAMEPAD)
6106 AC_SUBST(MOZ_GAMEPAD_BACKEND)
6108 dnl ========================================================
6109 dnl = Breakpad crash reporting (on by default on supported platforms)
6110 dnl ========================================================
6113 i?86-*-mingw*|x86_64-*-mingw*)
6116 i?86-apple-darwin*|x86_64-apple-darwin*)
6119 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6120 if test "$MOZ_ENABLE_GTK"; then
6124 *-android*|*-linuxandroid*)
6132 MOZ_ARG_DISABLE_BOOL(crashreporter,
6133 [ --disable-crashreporter Disable breakpad crash reporting],
6135 MOZ_CRASHREPORTER=1)
6137 if test -n "$MOZ_CRASHREPORTER"; then
6138 AC_DEFINE(MOZ_CRASHREPORTER)
6140 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
6141 test -z "$SKIP_LIBRARY_CHECKS"; then
6142 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6143 AC_SUBST(MOZ_GTHREAD_CFLAGS)
6144 AC_SUBST(MOZ_GTHREAD_LIBS)
6147 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
6148 AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH. Use --disable-crashreporter.])
6151 if test "$OS_ARCH" = "WINNT"; then
6152 if test -z "$HAVE_64BIT_OS"; then
6153 MOZ_CRASHREPORTER_INJECTOR=1
6154 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
6158 AC_DEFINE_UNQUOTED(BREAKPAD_CUSTOM_STDINT_H, "mozilla/StandardInteger.h")
6160 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6161 [ --with-crashreporter-enable-percent=NN
6162 Enable sending crash reports by default on NN% of users. (default=100)],
6163 [ val=`echo $withval | sed 's/[^0-9]//g'`
6164 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6166 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6167 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6169 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6171 dnl ========================================================
6172 dnl = libjpeg-turbo configuration
6173 dnl ========================================================
6175 if test -z "$MOZ_NATIVE_JPEG"; then
6179 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6180 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
6182 MOZ_LIBJPEG_TURBO=1)
6184 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6185 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6188 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6191 if test -n "$MOZ_LIBJPEG_TURBO"; then
6193 dnl Do we support libjpeg-turbo on this platform?
6194 case "$OS_ARCH:$OS_TEST" in
6196 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6197 LIBJPEG_TURBO_X86_ASM=1
6200 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6201 LIBJPEG_TURBO_X64_ASM=1
6203 WINNT:x86|WINNT:i?86)
6204 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6205 LIBJPEG_TURBO_X86_ASM=1
6208 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6209 LIBJPEG_TURBO_X64_ASM=1
6212 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6213 LIBJPEG_TURBO_ARM_ASM=1
6216 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6217 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6218 LIBJPEG_TURBO_X86_ASM=1
6222 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6223 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6224 LIBJPEG_TURBO_X64_ASM=1
6231 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6232 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6233 dnl it doesn't exist or we have too old of a version.
6234 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6235 LIBJPEG_TURBO_AS=$YASM
6237 if test -z "$LIBJPEG_TURBO_AS" ; then
6238 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.])
6241 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6242 dnl on Linux and 1.1 or newer everywhere else.
6243 if test "$OS_ARCH" = "Linux" ; then
6244 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
6245 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.])
6248 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6249 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.])
6254 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6255 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6256 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6257 echo "Using $AS as the assembler for ARM code."
6258 LIBJPEG_TURBO_AS=$AS
6261 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6262 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6263 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6264 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6265 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6266 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6267 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6268 dnl Warn if we're not building the optimized routines, even though the user
6269 dnl didn't specify --disable-libjpeg-turbo.
6270 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6273 dnl ========================================================
6274 dnl = Enable compilation of specific extension modules
6275 dnl ========================================================
6277 MOZ_ARG_ENABLE_STRING(extensions,
6278 [ --enable-extensions Enable extensions],
6279 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6280 if test "$option" = "yes" -o "$option" = "all"; then
6281 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6282 elif test "$option" = "no" -o "$option" = "none"; then
6284 elif test "$option" = "default"; then
6285 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6286 elif test `echo "$option" | grep -c \^-` != 0; then
6287 option=`echo $option | sed 's/^-//'`
6288 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6290 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6293 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6295 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6296 # Suppress warning on non-X11 platforms
6297 if test -n "$MOZ_X11"; then
6298 AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6300 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6303 dnl Do not build gnomevfs with libxul based apps
6304 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6305 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6308 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6309 # Suppress warning on non-X11 platforms
6310 if test -n "$MOZ_X11"; then
6311 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6313 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6316 dnl Do not build gio with libxul based apps
6317 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6318 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6321 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6323 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6325 AC_SUBST(MOZ_GIO_COMPONENT)
6327 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6328 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6329 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6333 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6335 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6336 dnl when trying to build a nonexistent extension.
6337 for extension in $MOZ_EXTENSIONS; do
6338 if test ! -d "${srcdir}/extensions/${extension}"; then
6339 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6343 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6344 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6347 dnl ========================================================
6348 dnl Build Freetype in the tree
6349 dnl ========================================================
6350 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6351 [ --enable-tree-freetype Enable Tree FreeType],
6352 MOZ_TREE_FREETYPE=1,
6353 MOZ_TREE_FREETYPE= )
6354 if test -n "$MOZ_TREE_FREETYPE"; then
6355 if test -n "$_WIN32_MSVC"; then
6356 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6358 AC_DEFINE(MOZ_TREE_FREETYPE)
6359 AC_SUBST(MOZ_TREE_FREETYPE)
6360 MOZ_ENABLE_CAIRO_FT=1
6361 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6362 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6363 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6364 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6366 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6367 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6368 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6369 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6370 AC_SUBST(CAIRO_FT_CFLAGS)
6373 dnl ========================================================
6375 dnl ========================================================
6376 dnl Abort Windows build if the required major version and
6377 dnl minimum minor version of Unicode NSIS isn't in the path
6378 dnl (unless in case of cross compiling, for which Unicode
6379 dnl is not yet sufficient).
6380 if test "$OS_ARCH" = "WINNT"; then
6381 REQ_NSIS_MAJOR_VER=2
6382 MIN_NSIS_MINOR_VER=46
6383 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensis)
6384 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6385 AC_MSG_RESULT([yes])
6387 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6389 if test ! "$MAKENSISU_VER" = ""; then
6390 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6391 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6393 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6394 if test "$MAKENSISU_VER" = "" || \
6395 test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6396 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6398 if test -z "$CROSS_COMPILE"; then
6399 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.])
6404 elif test -z "$CROSS_COMPILE"; then
6405 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.])
6411 dnl ========================================================
6413 dnl ========================================================
6414 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6415 [ --disable-webapp-runtime Disable Web App Runtime],
6416 MOZ_WEBAPP_RUNTIME=,
6417 MOZ_WEBAPP_RUNTIME=1)
6418 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6421 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6424 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6425 if test "$MOZ_WEBAPP_RUNTIME"; then
6426 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6429 AC_MSG_CHECKING([for tar archiver])
6430 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6431 if test -z "$TAR"; then
6432 AC_MSG_ERROR([no tar archiver found in \$PATH])
6434 AC_MSG_RESULT([$TAR])
6437 AC_MSG_CHECKING([for wget])
6438 AC_CHECK_PROGS(WGET, wget, "")
6439 AC_MSG_RESULT([$WGET])
6442 dnl ========================================================
6444 dnl ========================================================
6446 if test -n "$MOZ_SIGN_CMD"; then
6447 AC_DEFINE(MOZ_SIGNING)
6450 dnl ========================================================
6451 dnl Maintenance Service
6452 dnl ========================================================
6454 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6455 [ --enable-maintenance-service Enable building of maintenanceservice],
6456 MOZ_MAINTENANCE_SERVICE=1,
6457 MOZ_MAINTENANCE_SERVICE= )
6459 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6460 if test "$OS_ARCH" = "WINNT"; then
6461 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6463 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6467 dnl ========================================================
6468 dnl Verify MAR signatures
6469 dnl ========================================================
6471 MOZ_ARG_ENABLE_BOOL(verify-mar,
6472 [ --enable-verify-mar Enable verifying MAR signatures],
6473 MOZ_VERIFY_MAR_SIGNATURE=1,
6474 MOZ_VERIFY_MAR_SIGNATURE= )
6476 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6477 if test "$OS_ARCH" = "WINNT"; then
6478 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6480 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6484 dnl ========================================================
6485 dnl Enable building the signmar program.
6486 dnl This option is much different than the --enable-verify-mar option.
6487 dnl --enable-verify-mar is for enabling the verification check on MAR
6488 dnl files in the updater. The --enable-signmar option is for building
6489 dnl the signmar program.
6490 dnl ========================================================
6492 MOZ_ARG_ENABLE_BOOL(signmar,
6493 [ --enable-signmar Enable building the signmar program],
6494 MOZ_ENABLE_SIGNMAR=1,
6495 MOZ_ENABLE_SIGNMAR= )
6497 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6498 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6501 dnl ========================================================
6503 dnl ========================================================
6505 MOZ_ARG_DISABLE_BOOL(updater,
6506 [ --disable-updater Disable building of updater],
6510 if test -n "$MOZ_UPDATER"; then
6511 AC_DEFINE(MOZ_UPDATER)
6514 # tools/update-packaging is not checked out by default.
6515 MOZ_ARG_ENABLE_BOOL(update-packaging,
6516 [ --enable-update-packaging
6517 Enable tools/update-packaging],
6518 MOZ_UPDATE_PACKAGING=1,
6519 MOZ_UPDATE_PACKAGING= )
6520 AC_SUBST(MOZ_UPDATE_PACKAGING)
6522 dnl ========================================================
6523 dnl build the tests by default
6524 dnl ========================================================
6525 MOZ_ARG_DISABLE_BOOL(tests,
6526 [ --disable-tests Do not build test libraries & programs],
6530 if test -n "$ENABLE_TESTS"; then
6533 AC_DEFINE(MOZ_ENABLE_GTEST)
6534 AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6535 AC_SUBST(MOZ_ENABLE_GTEST)
6536 AC_SUBST(GTEST_HAS_RTTI)
6537 if test -n "$_WIN32_MSVC"; then
6538 AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6540 if test "${OS_TARGET}" = "Android"; then
6541 AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6542 AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6543 AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6544 AC_SUBST(GTEST_OS_LINUX_ANDROID)
6545 AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6546 AC_SUBST(GTEST_HAS_CLONE)
6550 dnl ========================================================
6551 dnl parental controls (for Windows Vista)
6552 dnl ========================================================
6553 MOZ_ARG_DISABLE_BOOL(parental-controls,
6554 [ --disable-parental-controls
6555 Do not build parental controls],
6556 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6557 MOZ_DISABLE_PARENTAL_CONTROLS=)
6558 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6559 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6562 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6564 dnl ========================================================
6565 dnl = Disable DOMCrypto
6566 dnl ========================================================
6567 if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
6568 AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
6570 AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
6572 dnl ========================================================
6573 dnl = Disable libpkix
6574 dnl ========================================================
6575 if test -n "$NSS_NO_LIBPKIX"; then
6576 AC_DEFINE(NSS_NO_LIBPKIX)
6578 AC_SUBST(NSS_NO_LIBPKIX)
6581 dnl ========================================================
6583 dnl = Module specific options
6585 dnl ========================================================
6586 MOZ_ARG_HEADER(Individual module options)
6588 dnl ========================================================
6589 dnl = Disable feed handling components
6590 dnl ========================================================
6591 MOZ_ARG_DISABLE_BOOL(feeds,
6592 [ --disable-feeds Disable feed handling and processing components],
6595 if test -n "$MOZ_FEEDS"; then
6596 AC_DEFINE(MOZ_FEEDS)
6598 if test "$MOZ_BUILD_APP" = "browser"; then
6599 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6603 dnl ========================================================
6604 dnl Check for sqlite
6605 dnl ========================================================
6608 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6609 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6610 MOZ_NATIVE_SQLITE=1,
6611 MOZ_NATIVE_SQLITE= )
6613 if test -z "$MOZ_NATIVE_SQLITE"
6616 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6618 dnl ============================
6619 dnl === SQLite Version check ===
6620 dnl ============================
6621 dnl Check to see if the system SQLite package is new enough.
6622 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6624 dnl ==================================
6625 dnl === SQLITE_SECURE_DELETE check ===
6626 dnl ==================================
6627 dnl Check to see if the system SQLite package is compiled with
6628 dnl SQLITE_SECURE_DELETE enabled.
6629 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6630 _SAVE_CFLAGS="$CFLAGS"
6631 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6633 LIBS="$LIBS $SQLITE_LIBS"
6634 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6636 #include "sqlite3.h"
6638 int main(int argc, char **argv){
6639 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6641 ac_cv_sqlite_secure_delete=yes,
6642 ac_cv_sqlite_secure_delete=no,
6643 ac_cv_sqlite_secure_delete=no
6646 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6647 CFLAGS="$_SAVE_CFLAGS"
6649 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6650 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6653 dnl ===============================
6654 dnl === SQLITE_THREADSAFE check ===
6655 dnl ===============================
6656 dnl Check to see if the system SQLite package is compiled with
6657 dnl SQLITE_THREADSAFE enabled.
6658 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6659 _SAVE_CFLAGS="$CFLAGS"
6660 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6662 LIBS="$LIBS $SQLITE_LIBS"
6663 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6665 #include "sqlite3.h"
6667 int main(int argc, char **argv){
6668 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6670 ac_cv_sqlite_threadsafe=yes,
6671 ac_cv_sqlite_threadsafe=no,
6672 ac_cv_sqlite_threadsafe=no
6675 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6676 CFLAGS="$_SAVE_CFLAGS"
6678 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6679 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6682 dnl ================================
6683 dnl === SQLITE_ENABLE_FTS3 check ===
6684 dnl ================================
6685 dnl check to see if the system SQLite package is compiled with
6686 dnl SQLITE_ENABLE_FTS3 enabled.
6687 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6688 _SAVE_CFLAGS="$CFLAGS"
6689 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6691 LIBS="$LIBS $SQLITE_LIBS"
6692 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6694 #include "sqlite3.h"
6696 int main(int argc, char **argv){
6697 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6699 ac_cv_sqlite_enable_fts3=yes,
6700 ac_cv_sqlite_enable_fts3=no,
6701 ac_cv_sqlite_enable_fts3=no
6704 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6705 CFLAGS="$_SAVE_CFLAGS"
6707 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6708 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6711 dnl =========================================
6712 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6713 dnl =========================================
6714 dnl check to see if the system SQLite package is compiled with
6715 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6716 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6717 _SAVE_CFLAGS="$CFLAGS"
6718 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6720 LIBS="$LIBS $SQLITE_LIBS"
6721 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6723 #include "sqlite3.h"
6725 int main(int argc, char **argv){
6726 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6728 ac_cv_sqlite_enable_unlock_notify=yes,
6729 ac_cv_sqlite_enable_unlock_notify=no,
6730 ac_cv_sqlite_enable_unlock_notify=no
6733 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6734 CFLAGS="$_SAVE_CFLAGS"
6736 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6737 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6741 if test -n "$MOZ_NATIVE_SQLITE"; then
6742 AC_DEFINE(MOZ_NATIVE_SQLITE)
6744 AC_SUBST(MOZ_NATIVE_SQLITE)
6746 dnl ========================================================
6747 dnl = Enable help viewer (off by default)
6748 dnl ========================================================
6749 if test -n "$MOZ_HELP_VIEWER"; then
6750 dnl Do this if defined in confvars.sh
6751 AC_DEFINE(MOZ_HELP_VIEWER)
6754 dnl ========================================================
6755 dnl = Enable safe browsing (anti-phishing)
6756 dnl ========================================================
6757 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6758 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6759 MOZ_SAFE_BROWSING=1,
6760 MOZ_SAFE_BROWSING= )
6761 if test -n "$MOZ_SAFE_BROWSING"; then
6762 AC_DEFINE(MOZ_SAFE_BROWSING)
6764 AC_SUBST(MOZ_SAFE_BROWSING)
6766 dnl ========================================================
6767 dnl = Enable url-classifier
6768 dnl ========================================================
6769 dnl Implicitly enabled by default if building with safe-browsing
6770 if test -n "$MOZ_SAFE_BROWSING"; then
6771 MOZ_URL_CLASSIFIER=1
6773 MOZ_ARG_ENABLE_BOOL(url-classifier,
6774 [ --enable-url-classifier Enable url classifier module],
6775 MOZ_URL_CLASSIFIER=1,
6776 MOZ_URL_CLASSIFIER= )
6777 if test -n "$MOZ_URL_CLASSIFIER"; then
6778 AC_DEFINE(MOZ_URL_CLASSIFIER)
6780 AC_SUBST(MOZ_URL_CLASSIFIER)
6782 dnl ========================================================
6783 dnl = Disable zipwriter
6784 dnl ========================================================
6785 MOZ_ARG_DISABLE_BOOL(zipwriter,
6786 [ --disable-zipwriter Disable zipwriter component],
6789 AC_SUBST(MOZ_ZIPWRITER)
6791 dnl ========================================================
6793 dnl ========================================================
6794 dnl superseded by QtNetwork starting from 4.7
6795 MOZ_ENABLE_LIBCONIC=1
6797 if test -n "$MOZ_ENABLE_QT"; then
6798 if test "$MOZ_ENABLE_QTNETWORK"; then
6799 MOZ_ENABLE_LIBCONIC=
6803 MOZ_ARG_DISABLE_BOOL(libconic,
6804 [ --disable-libconic Disable libconic],
6805 MOZ_ENABLE_LIBCONIC=,
6806 MOZ_ENABLE_LIBCONIC=1 )
6808 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6809 PKG_CHECK_MODULES(LIBCONIC, conic,
6810 MOZ_ENABLE_LIBCONIC=1,
6811 MOZ_ENABLE_LIBCONIC=)
6813 if test "$MOZ_ENABLE_LIBCONIC"; then
6814 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6817 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6818 AC_SUBST(LIBCONIC_CFLAGS)
6819 AC_SUBST(LIBCONIC_LIBS)
6821 dnl ========================================================
6823 dnl ========================================================
6825 MAEMO_SDK_TARGET_VER=-1
6827 MOZ_ARG_WITH_STRING(maemo-version,
6828 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6830 MAEMO_SDK_TARGET_VER=$withval)
6832 case "$MAEMO_SDK_TARGET_VER" in
6834 MOZ_PLATFORM_MAEMO=5
6838 MOZ_PLATFORM_MAEMO=6
6842 dnl We aren't compiling for Maemo, move on.
6845 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6849 if test $MOZ_PLATFORM_MAEMO; then
6850 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6852 if test -z "$MOZ_ENABLE_DBUS"; then
6853 AC_MSG_ERROR([DBus is required when building for Maemo])
6856 MOZ_GFX_OPTIMIZE_MOBILE=1
6857 MOZ_GL_DEFAULT_PROVIDER=EGL
6858 MOZ_MAEMO_LIBLOCATION=
6860 if test $MOZ_PLATFORM_MAEMO = 5; then
6861 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6862 MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6863 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6864 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6865 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6867 AC_SUBST(XCOMPOSITE_LIBS)
6869 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6870 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6871 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6872 if test -z "$_LIB_FOUND"; then
6873 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6877 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6878 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6879 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6880 if test -z "$_LIB_FOUND"; then
6881 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6884 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6885 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6886 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6887 if test -z "$_LIB_FOUND"; then
6888 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6892 if test $MOZ_PLATFORM_MAEMO = 6; then
6894 PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6897 if test "$_LIB_FOUND"; then
6898 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6899 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6900 MOZ_ENABLE_CONTENTMANAGER=1
6901 AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6903 AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6905 AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6907 dnl ========================================================
6908 dnl = Enable meego libcontentaction
6909 dnl ========================================================
6910 MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6911 [ --enable-meegocontentaction Enable meegocontentaction support],
6912 MOZ_MEEGOCONTENTACTION=1,
6913 MOZ_MEEGOCONTENTACTION=)
6915 if test -n "$MOZ_MEEGOCONTENTACTION"; then
6917 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6918 if test "$_LIB_FOUND"; then
6919 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6920 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6921 MOZ_ENABLE_CONTENTACTION=1
6922 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6923 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6927 MOZ_ARG_ENABLE_BOOL(meegotouch,
6928 [ --enable-meegotouch Enable meegotouch support],
6929 MOZ_MEEGOTOUCHENABLED=1,
6930 MOZ_MEEGOTOUCHENABLED=)
6932 if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6933 PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6934 if test "$_LIB_FOUND"; then
6935 MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6936 MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6937 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6939 AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6944 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6945 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6946 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6947 if test "$_LIB_FOUND"; then
6948 MOZ_MAEMO_LIBLOCATION=1
6949 AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6951 AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6953 AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6955 PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6956 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6957 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6958 if test "$_LIB_FOUND"; then
6959 MOZ_ENABLE_MEEGOTOUCHSHARE=1
6960 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6962 AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6964 AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6966 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6967 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6970 dnl ========================================================
6972 dnl ========================================================
6974 MOZ_ARG_WITH_STRING(gl-provider,
6975 [ --with-gl-provider=ID
6976 Set GL provider backend type],
6977 [ val=`echo $withval`
6978 MOZ_GL_PROVIDER="$val"])
6980 if test -n "$MOZ_GL_PROVIDER"; then
6981 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6982 AC_SUBST(MOZ_GL_PROVIDER)
6983 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6985 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6986 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6988 dnl ========================================================
6989 dnl = faststripe theme
6990 dnl ========================================================
6991 MOZ_ARG_ENABLE_BOOL(faststripe,
6992 [ --enable-faststripe Use faststripe theme],
6993 MOZ_THEME_FASTSTRIPE=1,
6994 MOZ_THEME_FASTSTRIPE= )
6995 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6997 dnl ========================================================
6999 dnl = Feature options that require extra sources to be pulled
7001 dnl ========================================================
7002 dnl MOZ_ARG_HEADER(Features that require extra sources)
7004 dnl ========================================================
7006 dnl = Runtime debugging and Optimization Options
7008 dnl ========================================================
7009 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
7011 dnl ========================================================
7012 dnl enable mobile optimizations
7013 dnl ========================================================
7014 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7015 [ --enable-mobile-optimize
7016 Enable mobile optimizations],
7017 MOZ_GFX_OPTIMIZE_MOBILE=1)
7019 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7021 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7022 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7025 dnl ========================================================
7026 dnl = Enable code optimization. ON by default.
7027 dnl ========================================================
7028 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7029 MOZ_OPTIMIZE_FLAGS="-O"
7032 MOZ_ARG_ENABLE_STRING(optimize,
7033 [ --disable-optimize Disable compiler optimization
7034 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7035 [ if test "$enableval" != "no"; then
7037 if test -n "$enableval" -a "$enableval" != "yes"; then
7038 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7043 fi ], MOZ_OPTIMIZE=1)
7045 MOZ_SET_FRAMEPTR_FLAGS
7047 if test "$COMPILE_ENVIRONMENT"; then
7048 if test -n "$MOZ_OPTIMIZE"; then
7049 AC_MSG_CHECKING([for valid optimization flags])
7050 _SAVE_CFLAGS=$CFLAGS
7051 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7052 AC_TRY_COMPILE([#include <stdio.h>],
7053 [printf("Hello World\n");],
7056 AC_MSG_RESULT([$_results])
7057 if test "$_results" = "no"; then
7058 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7060 CFLAGS=$_SAVE_CFLAGS
7062 fi # COMPILE_ENVIRONMENT
7064 AC_SUBST(MOZ_OPTIMIZE)
7065 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
7066 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7067 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7068 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
7069 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7070 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
7072 dnl ========================================================
7073 dnl = Enable any treating of compile warnings as errors
7074 dnl ========================================================
7075 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
7076 [ --enable-warnings-as-errors
7077 Enable treating of warnings as errors],
7078 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
7079 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
7080 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
7081 WARNINGS_AS_ERRORS=''
7084 dnl ========================================================
7085 dnl = Disable runtime logging checks
7086 dnl ========================================================
7087 MOZ_ARG_DISABLE_BOOL(logging,
7088 [ --disable-logging Disable logging facilities],
7089 NS_DISABLE_LOGGING=1,
7090 NS_DISABLE_LOGGING= )
7091 if test "$NS_DISABLE_LOGGING"; then
7092 AC_DEFINE(NS_DISABLE_LOGGING)
7094 AC_DEFINE(MOZ_LOGGING)
7097 dnl ========================================================
7098 dnl = This will enable logging of addref, release, ctor, dtor.
7099 dnl ========================================================
7100 _ENABLE_LOGREFCNT=42
7101 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7102 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
7103 _ENABLE_LOGREFCNT=1,
7104 _ENABLE_LOGREFCNT= )
7105 if test "$_ENABLE_LOGREFCNT" = "1"; then
7106 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7107 elif test -z "$_ENABLE_LOGREFCNT"; then
7108 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7111 dnl ========================================================
7112 dnl moz_dump_painting
7113 dnl ========================================================
7114 MOZ_ARG_ENABLE_BOOL(dump-painting,
7115 [ --enable-dump-painting Enable paint debugging.],
7116 MOZ_DUMP_PAINTING=1,
7117 MOZ_DUMP_PAINTING= )
7118 if test -n "$MOZ_DUMP_PAINTING"; then
7119 AC_DEFINE(MOZ_DUMP_PAINTING)
7120 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
7122 if test -n "$MOZ_DEBUG"; then
7123 AC_DEFINE(MOZ_DUMP_PAINTING)
7126 dnl ========================================================
7127 dnl = Enable trace malloc
7128 dnl ========================================================
7129 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7130 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7131 [ --enable-trace-malloc Enable malloc tracing; also disables DMD and jemalloc],
7134 if test "$NS_TRACE_MALLOC"; then
7135 # Please, Mr. Linker Man, don't take away our symbol names
7136 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7138 AC_DEFINE(NS_TRACE_MALLOC)
7140 AC_SUBST(NS_TRACE_MALLOC)
7142 dnl ========================================================
7144 dnl ========================================================
7146 MOZ_ARG_ENABLE_BOOL(dmd,
7147 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
7151 if test "$NS_TRACE_MALLOC"; then # trace-malloc disables DMD
7154 if test "$MOZ_DMD"; then
7158 if test "${CPU_ARCH}" = "arm"; then
7159 CFLAGS="$CFLAGS -funwind-tables"
7160 CXXFLAGS="$CXXFLAGS -funwind-tables"
7163 MOZ_MEMORY=1 # DMD enables jemalloc
7164 MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
7168 dnl ========================================================
7169 dnl = Enable jemalloc
7170 dnl ========================================================
7171 MOZ_ARG_ENABLE_BOOL(jemalloc,
7172 [ --enable-jemalloc Replace memory allocator with jemalloc],
7176 if test "$NS_TRACE_MALLOC"; then
7180 if test "${OS_TARGET}" = "Android"; then
7181 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
7183 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
7184 dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
7185 if test -z "$GNU_CC"; then
7186 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7188 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
7191 dnl On other Unix systems, we only want to link executables against mozglue
7192 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7193 dnl On other Unix systems, where mozglue is a static library, jemalloc is
7194 dnl separated for the SDK, so we need to add it here.
7195 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
7196 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
7198 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
7199 if test -n "$GNU_CC"; then
7200 dnl And we need mozglue symbols to be exported.
7201 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
7203 if test "$MOZ_LINKER" = 1; then
7204 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
7208 dnl ========================================================
7209 dnl = Enable dynamic replacement of malloc implementation
7210 dnl ========================================================
7211 MOZ_ARG_ENABLE_BOOL(replace-malloc,
7212 [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
7213 MOZ_REPLACE_MALLOC=1,
7214 MOZ_REPLACE_MALLOC= )
7216 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
7217 dnl We don't want to enable jemalloc unconditionally because it may be a
7218 dnl deliberate choice not to enable it (bug 702250, for instance)
7219 AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
7220 elif test -n "$MOZ_REPLACE_MALLOC"; then
7221 MOZ_NATIVE_JEMALLOC=
7223 dnl Replace-malloc Mac linkage quirks
7224 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
7225 AC_CACHE_CHECK([how to do weak dynamic linking],
7226 ac_cv_weak_dynamic_linking,
7227 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
7228 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
7229 test -s conftest${DLL_SUFFIX}; then
7230 dnl There are several ways the linker can put link edit rules in a binary:
7231 dnl - classic info only (for OSX < 10.6)
7232 dnl - dyld info only
7234 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
7239 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
7244 dnl With classic info, we need to build with -flat_namespace.
7245 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
7246 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
7247 dnl forgets to set the weak flag in the dyld info.
7248 dnl See http://glandium.org/blog/?p=2764 for more details.
7250 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
7251 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
7252 dnl - "flat namespace" when -flat_namespace alone is needed
7253 dnl - "dummy library" when a dummy library and -flat_namespace are needed
7254 dnl - "compiler support" when nothing is needed
7255 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
7256 if test -n "$_CLASSIC_INFO"; then
7257 ac_cv_weak_dynamic_linking="flat namespace"
7259 ac_cv_weak_dynamic_linking="compiler support"
7262 if test -n "$_DYLD_INFO"; then
7263 ac_cv_weak_dynamic_linking="dummy library"
7265 ac_cv_weak_dynamic_linking="flat namespace"
7269 AC_ERROR([couldn't compile a simple C file])
7272 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
7275 AC_SUBST(MOZ_REPLACE_MALLOC)
7276 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
7278 dnl ========================================================
7279 dnl = Jemalloc build setup
7280 dnl ========================================================
7281 if test -z "$MOZ_MEMORY"; then
7282 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
7283 MOZ_NATIVE_JEMALLOC=1
7284 AC_CHECK_FUNCS(mallctl nallocm,,
7285 [MOZ_NATIVE_JEMALLOC=
7287 if test -n "$MOZ_NATIVE_JEMALLOC"; then
7289 AC_DEFINE(MOZ_MEMORY)
7290 AC_DEFINE(MOZ_JEMALLOC3)
7291 AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7296 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7297 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.])
7302 dnl Don't try to run compiler tests on Windows
7303 if test "$OS_ARCH" = "WINNT"; then
7304 if test -z "$HAVE_64BIT_OS"; then
7305 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7307 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7310 AC_CHECK_SIZEOF([int *], [4])
7311 case "${ac_cv_sizeof_int_p}" in
7313 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7316 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7319 AC_MSG_ERROR([Unexpected pointer size])
7324 AC_DEFINE(MOZ_MEMORY)
7325 if test -n "$MOZ_JEMALLOC3"; then
7326 AC_DEFINE(MOZ_JEMALLOC3)
7328 if test "x$MOZ_DEBUG" = "x1"; then
7329 AC_DEFINE(MOZ_MEMORY_DEBUG)
7331 dnl The generic feature tests that determine how to compute ncpus are long and
7332 dnl complicated. Therefore, simply define special cpp variables for the
7333 dnl platforms we have special knowledge of.
7336 AC_DEFINE(MOZ_MEMORY_DARWIN)
7339 AC_DEFINE(MOZ_MEMORY_BSD)
7341 *-android*|*-linuxandroid*)
7342 AC_DEFINE(MOZ_MEMORY_LINUX)
7343 AC_DEFINE(MOZ_MEMORY_ANDROID)
7344 if test -z "$gonkdir"; then
7347 AC_DEFINE(MOZ_MEMORY_GONK)
7352 AC_DEFINE(MOZ_MEMORY_LINUX)
7355 AC_DEFINE(MOZ_MEMORY_BSD)
7358 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7361 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7362 if test -z "$MOZ_DEBUG"; then
7363 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7365 WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7367 dnl Look for a broken crtdll.obj
7368 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7369 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7370 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7371 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7372 dnl Also pass this to NSPR/NSS
7373 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7375 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7382 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7386 AC_SUBST(MOZ_MEMORY)
7387 AC_SUBST(MOZ_JEMALLOC3)
7388 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7389 AC_SUBST(MOZ_GLUE_LDFLAGS)
7390 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7391 AC_SUBST(WIN32_CRT_LIBS)
7392 dnl Need to set this for make because NSS doesn't have configure
7395 dnl We need to wrap dlopen and related functions on Android because we use
7397 if test "$OS_TARGET" = Android; then
7398 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7399 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7400 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7401 if test -z "$gonkdir"; then
7402 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7403 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"
7407 dnl ========================================================
7408 dnl = Use malloc wrapper lib
7409 dnl ========================================================
7410 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7411 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7415 if test -n "$_WRAP_MALLOC"; then
7416 if test -n "$GNU_CC"; then
7417 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7418 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7419 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7420 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7421 dnl Wrap operator new and operator delete on Android.
7422 if test "$OS_TARGET" = "Android"; then
7423 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7424 dnl Wrap the nothrow variants too.
7425 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7428 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7432 dnl ========================================================
7433 dnl = Location of malloc wrapper lib
7434 dnl ========================================================
7435 MOZ_ARG_WITH_STRING(wrap-malloc,
7436 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7437 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7439 dnl ========================================================
7440 dnl = Use JS Call tracing
7441 dnl ========================================================
7442 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7443 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7444 MOZ_TRACE_JSCALLS=1,
7445 MOZ_TRACE_JSCALLS= )
7446 if test -n "$MOZ_TRACE_JSCALLS"; then
7447 AC_DEFINE(MOZ_TRACE_JSCALLS)
7450 dnl ========================================================
7451 dnl = Use incremental GC
7452 dnl ========================================================
7454 MOZ_ARG_DISABLE_BOOL(gcincremental,
7455 [ --disable-gcincremental Disable incremental GC],
7457 if test -n "$JSGC_INCREMENTAL"; then
7458 AC_DEFINE(JSGC_INCREMENTAL)
7461 dnl ========================================================
7462 dnl Zealous JavaScript GC
7463 dnl ========================================================
7464 MOZ_ARG_ENABLE_BOOL(gczeal,
7465 [ --enable-gczeal Enable zealous JavaScript GCing],
7468 if test -n "$JS_GC_ZEAL"; then
7469 AC_DEFINE(JS_GC_ZEAL)
7472 dnl ========================================================
7473 dnl JS opt-mode assertions and minidump instrumentation
7474 dnl ========================================================
7475 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7476 [ --enable-js-diagnostics
7477 Enable JS diagnostic assertions and breakpad data],
7478 JS_CRASH_DIAGNOSTICS=1,
7479 JS_CRASH_DIAGNOSTICS= )
7480 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7481 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7485 MOZ_CHECK_COMPILER_WRAPPER
7487 dnl ========================================================
7488 dnl = Enable static checking using gcc-dehydra
7489 dnl ========================================================
7491 MOZ_ARG_WITH_STRING(static-checking,
7492 [ --with-static-checking=path/to/gcc_dehydra.so
7493 Enable static checking of code using GCC-dehydra],
7494 DEHYDRA_PATH=$withval,
7497 if test -n "$DEHYDRA_PATH"; then
7498 if test ! -f "$DEHYDRA_PATH"; then
7499 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7501 AC_DEFINE(NS_STATIC_CHECKING)
7503 AC_SUBST(DEHYDRA_PATH)
7505 dnl ========================================================
7506 dnl = Enable using the clang plugin to build
7507 dnl ========================================================
7509 MOZ_ARG_ENABLE_BOOL(clang-plugin,
7510 [ --enable-clang-plugin Enable building with the mozilla clang plugin ],
7511 ENABLE_CLANG_PLUGIN=1,
7512 ENABLE_CLANG_PLUGIN= )
7513 if test -n "$ENABLE_CLANG_PLUGIN"; then
7514 if test -z "$CLANG_CC"; then
7515 AC_MSG_ERROR([Can't use clang plugin without clang.])
7517 AC_DEFINE(MOZ_CLANG_PLUGIN)
7520 AC_SUBST(ENABLE_CLANG_PLUGIN)
7522 dnl ========================================================
7523 dnl = Enable stripping of libs & executables
7524 dnl ========================================================
7525 MOZ_ARG_ENABLE_BOOL(strip,
7526 [ --enable-strip Enable stripping of libs & executables ],
7530 dnl ========================================================
7531 dnl = Enable stripping of libs & executables when packaging
7532 dnl ========================================================
7533 MOZ_ARG_ENABLE_BOOL(install-strip,
7534 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7538 dnl ========================================================
7539 dnl = --enable-elf-dynstr-gc
7540 dnl ========================================================
7541 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7542 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7543 USE_ELF_DYNSTR_GC=1,
7544 USE_ELF_DYNSTR_GC= )
7546 dnl ========================================================
7547 dnl = --disable-elf-hack
7548 dnl ========================================================
7551 MOZ_ARG_DISABLE_BOOL(elf-hack,
7552 [ --disable-elf-hack Disable elf hacks],
7554 [USE_ELF_HACK=F # Force enable elf-hack])
7556 # Disable elf hack for profiling because the built in profiler
7557 # doesn't read the segments properly with elf hack. This is
7558 # temporary and should be fixed soon in the profiler.
7559 if test "$MOZ_PROFILING" = 1; then
7560 if test "$USE_ELF_HACK" = F; then
7561 AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
7566 # Only enable elfhack where supported
7567 if test "$USE_ELF_HACK" = 1; then
7568 case "${HOST_OS_ARCH},${OS_ARCH}" in
7570 case "${CPU_ARCH}" in
7585 if test -n "$USE_ELF_HACK"; then
7586 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7587 dnl memory addresses it maps to. The result is that by the time elfhack
7588 dnl kicks in, it is not possible to apply relocations because of that,
7589 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7590 dnl segment. It makes elfhack mostly useless, so considering the problems
7591 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7592 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7593 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
7594 dnl elfhack enabled, disable PT_GNU_RELRO instead.
7595 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7596 LINK_WITH_PT_GNU_RELRO,
7597 [echo "int main() {return 0;}" > conftest.${ac_ext}
7598 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7599 test -s conftest${ac_exeext}; then
7600 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7601 LINK_WITH_PT_GNU_RELRO=yes
7603 LINK_WITH_PT_GNU_RELRO=no
7606 dnl We really don't expect to get here, but just in case
7607 AC_ERROR([couldn't compile a simple C file])
7610 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7611 if test "$USE_ELF_HACK" = F; then
7612 AC_MSG_CHECKING([for -z norelro option to ld])
7613 _SAVE_LDFLAGS=$LDFLAGS
7614 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
7615 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
7616 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
7617 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.]))
7620 AC_MSG_WARN([Disabling elfhack])
7626 dnl ========================================================
7627 dnl = libstdc++ compatibility hacks
7628 dnl ========================================================
7631 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7632 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7635 AC_SUBST(STDCXX_COMPAT)
7637 if test -n "$STDCXX_COMPAT"; then
7638 eval $(CXX="$CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7639 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7640 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7643 dnl ========================================================
7645 dnl = Profiling and Instrumenting
7647 dnl ========================================================
7648 MOZ_ARG_HEADER(Profiling and Instrumenting)
7650 dnl ========================================================
7651 dnl = Enable runtime visual profiling logger
7652 dnl ========================================================
7653 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7654 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7655 MOZ_VISUAL_EVENT_TRACER=1,
7656 MOZ_VISUAL_EVENT_TRACER=)
7657 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7658 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7661 dnl ========================================================
7662 dnl Turn on reflow counting
7663 dnl ========================================================
7664 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7665 [ --enable-reflow-perf Enable reflow performance tracing],
7668 if test -n "$MOZ_REFLOW_PERF"; then
7669 AC_DEFINE(MOZ_REFLOW_PERF)
7672 dnl ========================================================
7673 dnl Enable code size metrics.
7674 dnl ========================================================
7675 MOZ_ARG_ENABLE_BOOL(codesighs,
7676 [ --enable-codesighs Enable code size analysis tools],
7677 _ENABLE_CODESIGHS=1,
7678 _ENABLE_CODESIGHS= )
7679 if test -n "$_ENABLE_CODESIGHS"; then
7680 if test -d $srcdir/tools/codesighs; then
7683 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7687 dnl ========================================================
7688 dnl = Enable Radio Interface for B2G (Gonk usually)
7689 dnl ========================================================
7690 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7691 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7694 if test -n "$MOZ_B2G_RIL"; then
7695 AC_DEFINE(MOZ_B2G_RIL)
7697 AC_SUBST(MOZ_B2G_RIL)
7699 dnl ========================================================
7700 dnl = Enable Radio FM for B2G (Gonk usually)
7701 dnl ========================================================
7702 if test -n "$MOZ_B2G_FM"; then
7703 AC_DEFINE(MOZ_B2G_FM)
7705 AC_SUBST(MOZ_B2G_FM)
7707 dnl ========================================================
7708 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7709 dnl ========================================================
7710 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7711 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7714 if test -n "$MOZ_B2G_BT"; then
7715 AC_DEFINE(MOZ_B2G_BT)
7717 AC_SUBST(MOZ_B2G_BT)
7719 dnl ========================================================
7720 dnl = Enable Support for Time Manager API
7721 dnl ========================================================
7722 if test -n "$MOZ_TIME_MANAGER"; then
7723 AC_DEFINE(MOZ_TIME_MANAGER)
7725 AC_SUBST(MOZ_TIME_MANAGER)
7727 dnl ========================================================
7728 dnl = Enable Camera Interface for B2G (Gonk usually)
7729 dnl ========================================================
7730 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7731 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7734 if test -n "$MOZ_B2G_CAMERA"; then
7735 AC_DEFINE(MOZ_B2G_CAMERA)
7737 AC_SUBST(MOZ_B2G_CAMERA)
7739 dnl ========================================================
7740 dnl = Enable Support B2G-specific changes to the NSS
7741 dnl = certificate trust database.
7742 dnl ========================================================
7743 if test -n "$MOZ_B2G_CERTDATA"; then
7744 AC_DEFINE(MOZ_B2G_CERTDATA)
7746 AC_SUBST(MOZ_B2G_CERTDATA)
7748 dnl ========================================================
7749 dnl = Enable Support for Payment API
7750 dnl ========================================================
7751 if test -n "$MOZ_PAY"; then
7756 dnl ========================================================
7757 dnl = Enable Support for AudioChannelManager API
7758 dnl ========================================================
7759 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7760 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7762 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7764 dnl ========================================================
7765 dnl = Support for demangling undefined symbols
7766 dnl ========================================================
7767 if test -z "$SKIP_LIBRARY_CHECKS"; then
7770 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7774 # Demangle only for debug or trace-malloc or DMD builds
7775 MOZ_DEMANGLE_SYMBOLS=
7776 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7777 MOZ_DEMANGLE_SYMBOLS=1
7778 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7780 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7782 dnl ========================================================
7783 dnl = Support for gcc stack unwinding (from gcc 3.3)
7784 dnl ========================================================
7785 if test -z "$SKIP_LIBRARY_CHECKS"; then
7786 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7789 dnl ========================================================
7791 dnl ========================================================
7793 MOZ_ARG_WITH_STRING(jitreport-granularity,
7794 [ --jitreport-granularity=N
7795 Default granularity at which to report JIT code
7798 1 - code ranges for whole functions only
7799 2 - per-line information
7800 3 - per-op information],
7801 JITREPORT_GRANULARITY=$withval,
7802 JITREPORT_GRANULARITY=3)
7804 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7806 dnl ========================================================
7810 dnl ========================================================
7811 MOZ_ARG_HEADER(Misc. Options)
7813 dnl ========================================================
7814 dnl update xterm title
7815 dnl ========================================================
7816 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7817 [ --enable-xterm-updates Update XTERM titles with current command.],
7821 dnl =========================================================
7823 dnl =========================================================
7824 MOZ_ARG_ENABLE_STRING([chrome-format],
7825 [ --enable-chrome-format=jar|flat|omni
7826 Select FORMAT of chrome files during packaging],
7827 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7829 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7830 MOZ_CHROME_FILE_FORMAT=jar
7833 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7834 AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7837 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7838 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7839 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7840 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7843 dnl =========================================================
7844 dnl Omnijar packaging (bug 552121)
7845 dnl =========================================================
7846 dnl Omnijar packaging is compatible with flat packaging.
7847 dnl In unpackaged builds, omnijar looks for files as if
7848 dnl things were flat packaged. After packaging, all files
7849 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7850 dnl is set to flat since putting files into jars is only
7851 dnl done during packaging with omnijar.
7852 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7854 AC_DEFINE(MOZ_OMNIJAR)
7856 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7857 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7858 MOZ_CHROME_FILE_FORMAT=flat
7860 MOZ_CHROME_FILE_FORMAT=symlink
7863 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7864 dnl Fennec's static resources live in the assets/ folder of the
7865 dnl APK. Adding a path to the name here works because we only
7866 dnl have one omnijar file in the final package (which is not the
7867 dnl case on desktop), and necessitates some contortions during
7868 dnl packaging so that the resources in the omnijar are considered
7869 dnl as rooted at / and not as rooted at assets/ (which again is
7870 dnl not the case on desktop: there are omnijars rooted at webrtc/,
7871 dnl etc). packager.mk handles changing the rooting of the single
7873 OMNIJAR_NAME=assets/omni.ja
7875 OMNIJAR_NAME=omni.ja
7878 AC_SUBST(OMNIJAR_NAME)
7879 AC_SUBST(MOZ_OMNIJAR)
7880 AC_SUBST(MOZ_PACKAGER_FORMAT)
7882 dnl ========================================================
7883 dnl = Define default location for MOZILLA_FIVE_HOME
7884 dnl ========================================================
7885 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7886 [ --with-default-mozilla-five-home
7887 Set the default value for MOZILLA_FIVE_HOME],
7888 [ val=`echo $withval`
7889 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7891 dnl ========================================================
7892 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7893 dnl ========================================================
7894 MOZ_ARG_WITH_STRING(user-appdir,
7895 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7896 [ val=`echo $withval`
7897 if echo "$val" | grep "\/" >/dev/null; then
7898 AC_MSG_ERROR("Homedir must be single relative path.")
7903 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7905 dnl ========================================================
7906 dnl = Doxygen configuration
7907 dnl ========================================================
7908 dnl Use commas to specify multiple dirs to this arg
7909 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7910 MOZ_ARG_WITH_STRING(doc-input-dirs,
7911 [ --with-doc-input-dirs=DIRS
7912 Header/idl dirs to create docs from],
7913 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7914 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7916 dnl Use commas to specify multiple dirs to this arg
7917 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7918 MOZ_ARG_WITH_STRING(doc-include-dirs,
7919 [ --with-doc-include-dirs=DIRS
7920 Include dirs to preprocess doc headers],
7921 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7922 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7924 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7925 MOZ_ARG_WITH_STRING(doc-output-dir,
7926 [ --with-doc-output-dir=DIR
7927 Dir to generate docs into],
7928 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7929 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7931 if test -z "$SKIP_COMPILER_CHECKS"; then
7932 dnl ========================================================
7934 dnl = Compiler Options
7936 dnl ========================================================
7937 MOZ_ARG_HEADER(Compiler Options)
7939 dnl ========================================================
7940 dnl Check for gcc -pipe support
7941 dnl ========================================================
7942 AC_MSG_CHECKING([for -pipe support])
7943 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7944 dnl Any gcc that supports firefox supports -pipe.
7945 CFLAGS="$CFLAGS -pipe"
7946 CXXFLAGS="$CXXFLAGS -pipe"
7947 AC_MSG_RESULT([yes])
7952 dnl ========================================================
7953 dnl Profile guided optimization (gcc checks)
7954 dnl ========================================================
7955 dnl Test for profiling options
7956 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7958 _SAVE_CFLAGS="$CFLAGS"
7959 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7961 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7962 AC_TRY_COMPILE([], [return 0;],
7963 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7964 result="yes" ], result="no")
7965 AC_MSG_RESULT([$result])
7967 if test $result = "yes"; then
7968 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7969 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7970 PROFILE_USE_LDFLAGS="-fprofile-use"
7973 CFLAGS="$_SAVE_CFLAGS"
7975 if test -n "$INTEL_CC"; then
7976 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7977 PROFILE_GEN_LDFLAGS=
7978 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7979 PROFILE_USE_LDFLAGS=
7982 dnl Sun Studio on Solaris
7983 if test "$SOLARIS_SUNPRO_CC"; then
7984 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7985 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7986 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7987 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7990 AC_SUBST(PROFILE_GEN_CFLAGS)
7991 AC_SUBST(PROFILE_GEN_LDFLAGS)
7992 AC_SUBST(PROFILE_USE_CFLAGS)
7993 AC_SUBST(PROFILE_USE_LDFLAGS)
7997 dnl ========================================================
7998 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7999 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
8000 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
8001 dnl ========================================================
8002 _SAVE_CXXFLAGS=$CXXFLAGS
8003 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
8004 AC_CACHE_CHECK(for correct overload resolution with const and templates,
8005 ac_nscap_nonconst_opeq_bug,
8014 template <class T, class U>
8015 int operator==(const Pointer<T>& rhs, U* lhs)
8017 return rhs.myPtr == lhs;
8020 template <class T, class U>
8021 int operator==(const Pointer<T>& rhs, const U* lhs)
8023 return rhs.myPtr == lhs;
8031 ac_nscap_nonconst_opeq_bug="no",
8032 ac_nscap_nonconst_opeq_bug="yes")])
8033 CXXFLAGS="$_SAVE_CXXFLAGS"
8035 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
8036 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
8038 fi # ! SKIP_COMPILER_CHECKS
8040 AC_DEFINE(CPP_THROW_NEW, [throw()])
8043 if test "$COMPILE_ENVIRONMENT"; then
8045 fi # COMPILE_ENVIRONMENT
8047 dnl ========================================================
8049 dnl = Build depencency options
8051 dnl ========================================================
8052 MOZ_ARG_HEADER(Build dependencies)
8054 if test "$GNU_CC" -a "$GNU_CXX"; then
8055 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
8056 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
8057 elif test "$SOLARIS_SUNPRO_CC"; then
8060 dnl Don't override this for MSVC
8061 if test -z "$_WIN32_MSVC"; then
8062 _USE_CPP_INCLUDE_FLAG=
8063 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8064 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8066 echo '#include <stdio.h>' > dummy-hello.c
8068 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8070 if test -z "$CL_INCLUDES_PREFIX"; then
8071 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8073 AC_SUBST(CL_INCLUDES_PREFIX)
8078 dnl ========================================================
8080 dnl = Static Build Options
8082 dnl ========================================================
8083 MOZ_ARG_HEADER(Static build options)
8085 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8086 if test "$OS_ARCH" = "WINNT"; then
8090 MOZ_ARG_ENABLE_BOOL(shared-js,
8091 [ --enable-shared-js
8092 Create a shared JavaScript library.],
8096 if test -n "$ENABLE_SHARED_JS"; then
8098 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
8100 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
8101 AC_DEFINE(MOZ_STATIC_JS)
8103 AC_SUBST(JS_SHARED_LIBRARY)
8105 AC_SUBST(LIBXUL_LIBS)
8106 XPCOM_LIBS="$LIBXUL_LIBS"
8108 dnl ========================================================
8110 dnl = Standalone module options
8112 dnl ========================================================
8113 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8116 dnl ========================================================
8118 if test -z "$SKIP_PATH_CHECKS"; then
8119 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8120 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8121 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8126 if test -z "${GLIB_GMODULE_LIBS}" \
8127 -a -n "${GLIB_CONFIG}"\
8128 -a "${GLIB_CONFIG}" != no\
8130 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8133 AC_SUBST(GLIB_CFLAGS)
8135 AC_SUBST(GLIB_GMODULE_LIBS)
8137 dnl ========================================================
8138 dnl Graphics checks.
8139 dnl ========================================================
8141 if test "${OS_TARGET}" = "WINNT"; then
8142 if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then
8143 MOZ_ENABLE_DIRECT2D1_1=1
8144 AC_SUBST(MOZ_ENABLE_DIRECT2D1_1)
8148 if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
8149 case "${target_cpu}" in
8161 MOZ_ARG_ENABLE_BOOL(skia,
8162 [ --enable-skia Enable use of Skia],
8166 if test "$USE_FC_FREETYPE"; then
8167 if test "$COMPILE_ENVIRONMENT"; then
8168 dnl ========================================================
8169 dnl = Check for freetype2 and its functionality
8170 dnl ========================================================
8171 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
8173 if test "$_HAVE_FREETYPE2"; then
8175 _SAVE_CFLAGS="$CFLAGS"
8176 LIBS="$LIBS $FT2_LIBS"
8177 CFLAGS="$CFLAGS $FT2_CFLAGS"
8179 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
8180 ac_cv_member_FT_Bitmap_Size_y_ppem,
8181 [AC_TRY_COMPILE([#include <ft2build.h>
8182 #include FT_FREETYPE_H],
8184 if (sizeof s.y_ppem) return 0;
8186 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
8187 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
8188 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
8189 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
8191 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
8193 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
8194 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
8195 [FT_Bitmap_Size structure includes y_ppem field])
8197 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
8200 CFLAGS="$_SAVE_CFLAGS"
8203 _SAVE_CPPFLAGS="$CPPFLAGS"
8204 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8205 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8206 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8207 CPPFLAGS="$_SAVE_CPPFLAGS"
8209 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8212 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
8214 if test "$MOZ_PANGO"; then
8215 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
8216 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
8218 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
8219 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
8224 dnl ========================================================
8225 dnl Check for pixman and cairo
8226 dnl ========================================================
8229 MOZ_ARG_ENABLE_BOOL(system-cairo,
8230 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8235 MOZ_ARG_ENABLE_BOOL(system-pixman,
8236 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8238 MOZ_TREE_PIXMAN=force,
8241 # System cairo depends on system pixman
8242 if test "$MOZ_TREE_PIXMAN" = "force"; then
8243 if test -z "$MOZ_TREE_CAIRO"; then
8244 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
8248 elif test -z "$MOZ_TREE_CAIRO"; then
8252 if test "$MOZ_TREE_PIXMAN"; then
8253 AC_DEFINE(MOZ_TREE_PIXMAN)
8254 MOZ_PIXMAN_CFLAGS=""
8255 MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8257 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8258 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8259 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8261 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8262 AC_SUBST(MOZ_PIXMAN_LIBS)
8264 # Check for headers defining standard int types.
8265 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8267 if test "$MOZ_TREE_CAIRO"; then
8268 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8269 AC_DEFINE(MOZ_TREE_CAIRO)
8271 # For now we assume that we will have a uint64_t available through
8272 # one of the above headers or mozstdint.h.
8273 AC_DEFINE(HAVE_UINT64_T)
8275 # Define macros for cairo-features.h
8276 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8277 if test "$MOZ_X11"; then
8278 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8279 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8280 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8281 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8282 MOZ_ENABLE_CAIRO_FT=1
8283 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8285 case "$MOZ_WIDGET_TOOLKIT" in
8287 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8290 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8291 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8292 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8295 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8296 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8297 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8298 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8299 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8300 MOZ_ENABLE_D2D_SURFACE=1
8301 MOZ_ENABLE_DWRITE_FONT=1
8303 WIN32_DWRITE_FONT_FEATURE=
8304 WIN32_D2D_SURFACE_FEATURE=
8307 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8309 dnl D3D10 Layers depend on D2D Surfaces.
8310 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8311 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8315 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8316 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8317 MOZ_ENABLE_CAIRO_FT=1
8318 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8319 CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8323 if test "$USE_FC_FREETYPE"; then
8324 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8326 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8327 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8328 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8329 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8330 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8331 AC_SUBST(CAIRO_FT_CFLAGS)
8333 AC_SUBST(PS_SURFACE_FEATURE)
8334 AC_SUBST(PDF_SURFACE_FEATURE)
8335 AC_SUBST(SVG_SURFACE_FEATURE)
8336 AC_SUBST(XLIB_SURFACE_FEATURE)
8337 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8338 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8339 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8340 AC_SUBST(WIN32_SURFACE_FEATURE)
8341 AC_SUBST(OS2_SURFACE_FEATURE)
8342 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8343 AC_SUBST(FT_FONT_FEATURE)
8344 AC_SUBST(FC_FONT_FEATURE)
8345 AC_SUBST(WIN32_FONT_FEATURE)
8346 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8347 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8348 AC_SUBST(QUARTZ_FONT_FEATURE)
8349 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8350 AC_SUBST(QT_SURFACE_FEATURE)
8351 AC_SUBST(TEE_SURFACE_FEATURE)
8353 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8354 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8356 if test "$MOZ_X11"; then
8357 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8360 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8362 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8363 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8364 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8365 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8366 if test "$MOZ_X11"; then
8367 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8368 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8369 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8370 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8374 AC_SUBST(MOZ_TREE_CAIRO)
8375 AC_SUBST(MOZ_CAIRO_CFLAGS)
8376 AC_SUBST(MOZ_CAIRO_LIBS)
8377 AC_SUBST(MOZ_CAIRO_OSLIBS)
8378 AC_SUBST(MOZ_TREE_PIXMAN)
8380 dnl ========================================================
8382 dnl ========================================================
8384 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8387 dnl ========================================================
8389 dnl ========================================================
8390 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8391 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8393 dnl ========================================================
8395 dnl ========================================================
8396 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8397 AC_SUBST(MOZ_GRAPHITE_LIBS)
8399 dnl ========================================================
8401 dnl ========================================================
8402 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8403 AC_SUBST(MOZ_OTS_LIBS)
8405 dnl ========================================================
8407 dnl ========================================================
8408 if test "$MOZ_ENABLE_SKIA"; then
8409 MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8410 AC_DEFINE(MOZ_ENABLE_SKIA)
8412 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8413 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8414 elif test "$OS_ARCH" = "WINNT"; then
8419 if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64"; then
8420 MOZ_ENABLE_SKIA_GPU=1
8421 AC_DEFINE(USE_SKIA_GPU)
8422 AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8427 AC_SUBST(MOZ_ENABLE_SKIA)
8428 AC_SUBST(MOZ_SKIA_LIBS)
8430 dnl ========================================================
8432 dnl ========================================================
8433 MOZ_ARG_DISABLE_BOOL(xul,
8434 [ --disable-xul Disable XUL],
8436 if test "$MOZ_XUL"; then
8439 dnl remove extensions that require XUL
8440 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8445 dnl ========================================================
8446 dnl disable profile locking
8447 dnl do no use this in applications that can have more than
8448 dnl one process accessing the profile directory.
8449 dnl ========================================================
8450 MOZ_ARG_DISABLE_BOOL(profilelocking,
8451 [ --disable-profilelocking
8452 Disable profile locking],
8453 MOZ_PROFILELOCKING=,
8454 MOZ_PROFILELOCKING=1 )
8455 if test "$MOZ_PROFILELOCKING"; then
8456 AC_DEFINE(MOZ_PROFILELOCKING)
8459 dnl ========================================================
8460 dnl necko configuration options
8461 dnl ========================================================
8464 dnl option to disable various necko protocols
8466 MOZ_ARG_ENABLE_STRING(necko-protocols,
8467 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8468 Enable/disable specific protocol handlers],
8469 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8470 if test "$option" = "yes" -o "$option" = "all"; then
8471 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8472 elif test "$option" = "no" -o "$option" = "none"; then
8474 elif test "$option" = "default"; then
8475 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8476 elif test `echo "$option" | grep -c \^-` != 0; then
8477 option=`echo $option | sed 's/^-//'`
8478 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8480 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8483 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8485 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8486 AC_SUBST(NECKO_PROTOCOLS)
8487 for p in $NECKO_PROTOCOLS; do
8488 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8489 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8493 dnl option to disable necko's wifi scanner
8496 case "$OS_TARGET" in
8498 if test -n "$gonkdir"; then
8506 if test -z "$MOZ_ENABLE_DBUS"; then
8507 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
8514 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8515 [ --disable-necko-wifi Disable necko wifi scanner],
8519 if test "$NECKO_WIFI"; then
8520 AC_DEFINE(NECKO_WIFI)
8521 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8523 AC_SUBST(NECKO_WIFI)
8524 AC_SUBST(NECKO_WIFI_DBUS)
8527 dnl option to disable cookies
8529 MOZ_ARG_DISABLE_BOOL(cookies,
8530 [ --disable-cookies Disable cookie support],
8533 AC_SUBST(NECKO_COOKIES)
8534 if test "$NECKO_COOKIES"; then
8535 AC_DEFINE(NECKO_COOKIES)
8536 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8540 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8542 MOZ_ARG_DISABLE_BOOL(ctypes,
8543 [ --disable-ctypes Disable js-ctypes],
8546 AC_SUBST(BUILD_CTYPES)
8547 if test "$BUILD_CTYPES"; then
8548 AC_DEFINE(BUILD_CTYPES)
8551 dnl Build Places if required
8552 if test "$MOZ_PLACES"; then
8553 AC_DEFINE(MOZ_PLACES)
8556 dnl Build SocialAPI if required
8557 if test "$MOZ_SOCIAL"; then
8558 AC_DEFINE(MOZ_SOCIAL)
8561 dnl Build Common JS modules provided by services.
8562 AC_SUBST(MOZ_SERVICES_COMMON)
8563 if test -n "$MOZ_SERVICES_COMMON"; then
8564 AC_DEFINE(MOZ_SERVICES_COMMON)
8567 dnl Build Services crypto component (used by Sync)
8568 AC_SUBST(MOZ_SERVICES_CRYPTO)
8569 if test -n "$MOZ_SERVICES_CRYPTO"; then
8570 AC_DEFINE(MOZ_SERVICES_CRYPTO)
8573 dnl Build Firefox Health Reporter Service
8574 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8575 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8576 AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8579 dnl Build Services metrics component
8580 AC_SUBST(MOZ_SERVICES_METRICS)
8581 if test -n "$MOZ_SERVICES_METRICS"; then
8582 AC_DEFINE(MOZ_SERVICES_METRICS)
8585 dnl Build Notifications if required
8586 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8587 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8588 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8591 dnl Build Sync Services if required
8592 AC_SUBST(MOZ_SERVICES_SYNC)
8593 if test -n "$MOZ_SERVICES_SYNC"; then
8594 AC_DEFINE(MOZ_SERVICES_SYNC)
8597 dnl Build Captive Portal Detector if required
8598 AC_SUBST(MOZ_CAPTIVEDETECT)
8599 if test -n "$MOZ_CAPTIVEDETECT"; then
8600 AC_DEFINE(MOZ_CAPTIVEDETECT)
8603 dnl Build WBMP decoder if required
8605 if test -n "$MOZ_WBMP"; then
8609 dnl ========================================================
8610 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8611 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8614 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8615 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8618 if test "$MOZ_APP_COMPONENT_MODULES"; then
8619 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8622 dnl ========================================================
8624 dnl = Maintainer debug option (no --enable equivalent)
8626 dnl ========================================================
8631 AC_SUBST(AR_EXTRACT)
8635 AC_SUBST(AS_DASH_C_FLAG)
8644 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8645 AC_SUBST(MOZ_UPDATE_XTERM)
8646 AC_SUBST(MOZ_PLATFORM_MAEMO)
8647 AC_SUBST(MOZ_AUTH_EXTENSION)
8648 AC_SUBST(MOZ_PERMISSIONS)
8649 AC_SUBST(MOZ_PREF_EXTENSIONS)
8650 AC_SUBST(MOZ_JS_LIBS)
8652 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8653 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8654 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8655 AC_SUBST(MOZ_DEBUG_FLAGS)
8656 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8657 AC_SUBST(WARNINGS_AS_ERRORS)
8658 AC_SUBST(MOZ_EXTENSIONS)
8659 AC_SUBST(MOZ_JSDEBUGGER)
8660 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8663 AC_SUBST(MOZ_INSTRUMENTS)
8664 AC_SUBST(MOZ_CALLGRIND)
8666 AC_SUBST(MOZ_PROFILING)
8668 AC_SUBST(MOZ_PLACES)
8669 AC_SUBST(MOZ_SOCIAL)
8670 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8672 AC_SUBST(NS_PRINTING)
8674 AC_SUBST(MOZ_HELP_VIEWER)
8675 AC_SUBST(TOOLCHAIN_PREFIX)
8684 AC_SUBST(MOZ_PROFILELOCKING)
8686 AC_SUBST(ENABLE_TESTS)
8687 AC_SUBST(ENABLE_MARIONETTE)
8689 AC_SUBST(MOZ_UNIVERSALCHARDET)
8690 AC_SUBST(ACCESSIBILITY)
8691 AC_SUBST(MOZ_SPELLCHECK)
8692 AC_SUBST(MOZ_ANDROID_OMTC)
8693 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8694 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8695 AC_SUBST(MOZ_CRASHREPORTER)
8696 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8697 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8698 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8699 AC_SUBST(MOZ_STUB_INSTALLER)
8700 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8701 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8702 AC_SUBST(MOZ_UPDATER)
8703 AC_SUBST(MOZ_ANGLE_RENDERER)
8704 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8705 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8706 AC_SUBST(MOZ_D3DX9_VERSION)
8707 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8708 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8711 AC_SUBST(MOZ_ANDROID_HISTORY)
8712 AC_SUBST(MOZ_WEBSMS_BACKEND)
8713 AC_SUBST(MOZ_ANDROID_WALLPAPER)
8714 AC_SUBST(MOZ_ANDROID_BEAM)
8715 AC_SUBST(ENABLE_STRIP)
8716 AC_SUBST(PKG_SKIP_STRIP)
8717 AC_SUBST(STRIP_FLAGS)
8718 AC_SUBST(USE_ELF_DYNSTR_GC)
8719 AC_SUBST(USE_ELF_HACK)
8720 AC_SUBST(INCREMENTAL_LINKER)
8721 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8722 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8724 AC_SUBST(MOZ_FIX_LINK_PATHS)
8725 AC_SUBST(XPCOM_LIBS)
8726 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8727 AC_SUBST(XPCOM_GLUE_LDOPTS)
8728 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8729 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8730 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8732 AC_SUBST(USE_DEPENDENT_LIBS)
8734 AC_SUBST(MOZ_BUILD_ROOT)
8735 AC_SUBST(MOZ_OS2_TOOLS)
8737 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8738 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8739 AC_SUBST(MOZ_LINKER_EXTRACT)
8741 dnl ========================================================
8742 dnl = Mac bundle name prefix
8743 dnl ========================================================
8744 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8745 [ --with-macbundlename-prefix=prefix
8746 Prefix for MOZ_MACBUNDLE_NAME],
8747 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8749 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8750 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8751 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8754 if test "$MOZ_DEBUG"; then
8755 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8757 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8759 AC_SUBST(MOZ_MACBUNDLE_NAME)
8761 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8762 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8763 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8764 if test "$MOZ_DEBUG"; then
8765 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8768 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8769 AC_SUBST(MOZ_MACBUNDLE_ID)
8771 dnl ========================================================
8772 dnl = Child Process Name for IPC
8773 dnl ========================================================
8774 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8775 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8777 # We want to let Android unpack the file at install time, but it only does
8778 # so if the file is named libsomething.so. The lib/ path is also required
8779 # because the unpacked file will be under the lib/ subdirectory and will
8780 # need to be executed from that path.
8781 MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8783 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8785 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8786 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8788 # The following variables are available to branding and application
8789 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8790 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8791 # impacts profile location and user-visible fields.
8792 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8793 # versions of a given application (e.g. Aurora and Firefox both use
8794 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8795 # for application.ini's "Name" field, which controls profile location in
8796 # the absence of a "Profile" field (see below), and various system
8797 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8798 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8799 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8800 # builds (e.g. Aurora for Firefox).
8801 # - MOZ_APP_VERSION: Defines the application version number.
8802 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8803 # defaults to a lowercase form of MOZ_APP_BASENAME.
8804 # - MOZ_APP_PROFILE: When set, used for application.ini's
8805 # "Profile" field, which controls profile location.
8806 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8807 # crash reporter server url.
8808 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8809 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8811 if test -z "$MOZ_APP_NAME"; then
8812 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8815 # For extensions and langpacks, we require a max version that is compatible
8816 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8817 # 10.0a1 and 10.0a2 aren't affected
8818 # 10.0 becomes 10.0.*
8819 # 10.0.1 becomes 10.0.*
8820 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8821 if test -z "$IS_ALPHA"; then
8823 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8826 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8829 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8830 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8831 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8833 AC_SUBST(MOZ_APP_NAME)
8834 AC_SUBST(MOZ_APP_DISPLAYNAME)
8835 AC_SUBST(MOZ_APP_BASENAME)
8836 AC_SUBST(MOZ_APP_VENDOR)
8837 AC_SUBST(MOZ_APP_PROFILE)
8838 AC_SUBST(MOZ_APP_ID)
8839 AC_SUBST(MAR_CHANNEL_ID)
8840 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8841 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8842 AC_SUBST(MOZ_EXTENSION_MANAGER)
8843 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8844 AC_SUBST(MOZ_APP_UA_NAME)
8845 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8846 AC_SUBST(MOZ_APP_VERSION)
8847 AC_SUBST(MOZ_APP_MAXVERSION)
8848 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8849 AC_SUBST(FIREFOX_VERSION)
8850 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8851 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8852 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8854 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8855 AC_SUBST(MOZ_UA_BUILDID)
8857 AC_SUBST(MOZ_APP_STATIC_INI)
8859 AC_SUBST(MOZ_PKG_SPECIAL)
8861 AC_SUBST(MOZILLA_OFFICIAL)
8863 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8864 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8866 if test "$MOZ_TELEMETRY_REPORTING"; then
8867 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8869 # Enable Telemetry by default for nightly and aurora channels
8870 if test -z "$RELEASE_BUILD"; then
8871 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8875 dnl If we have any service that uploads data (and requires data submission
8876 dnl policy alert), set MOZ_DATA_REPORTING.
8877 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8878 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8879 MOZ_DATA_REPORTING=1
8880 AC_DEFINE(MOZ_DATA_REPORTING)
8881 AC_SUBST(MOZ_DATA_REPORTING)
8885 AC_SUBST(MOZ_MAPINFO)
8886 AC_SUBST(MOZ_BROWSE_INFO)
8887 AC_SUBST(MOZ_TOOLS_DIR)
8888 AC_SUBST(WIN32_REDIST_DIR)
8891 dnl Echo the CFLAGS to remove extra whitespace.
8897 $_WARNINGS_CXXFLAGS \
8900 COMPILE_CFLAGS=`echo \
8905 COMPILE_CXXFLAGS=`echo \
8906 $_DEFINES_CXXFLAGS \
8910 AC_SUBST(SYSTEM_LIBXUL)
8911 AC_SUBST(MOZ_NATIVE_JPEG)
8912 AC_SUBST(MOZ_NATIVE_PNG)
8913 AC_SUBST(MOZ_NATIVE_BZ2)
8915 AC_SUBST(MOZ_JPEG_CFLAGS)
8916 AC_SUBST(MOZ_JPEG_LIBS)
8917 AC_SUBST(MOZ_BZ2_CFLAGS)
8918 AC_SUBST(MOZ_BZ2_LIBS)
8919 AC_SUBST(MOZ_PNG_CFLAGS)
8920 AC_SUBST(MOZ_PNG_LIBS)
8922 AC_SUBST(NSPR_CFLAGS)
8924 AC_SUBST(MOZ_NATIVE_NSPR)
8926 AC_SUBST(NSS_CFLAGS)
8928 AC_SUBST(MOZ_NATIVE_NSS)
8929 AC_SUBST(NSS_DISABLE_DBM)
8932 OS_CXXFLAGS="$CXXFLAGS"
8933 OS_CPPFLAGS="$CPPFLAGS"
8934 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8935 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8936 OS_LDFLAGS="$LDFLAGS"
8939 AC_SUBST(OS_CXXFLAGS)
8940 AC_SUBST(OS_CPPFLAGS)
8941 AC_SUBST(OS_COMPILE_CFLAGS)
8942 AC_SUBST(OS_COMPILE_CXXFLAGS)
8943 AC_SUBST(OS_LDFLAGS)
8945 AC_SUBST(CROSS_COMPILE)
8946 AC_SUBST(WCHAR_CFLAGS)
8950 AC_SUBST(HOST_CFLAGS)
8951 AC_SUBST(HOST_CXXFLAGS)
8952 AC_SUBST(HOST_LDFLAGS)
8953 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8955 AC_SUBST(HOST_AR_FLAGS)
8957 AC_SUBST(HOST_RANLIB)
8958 AC_SUBST(HOST_NSPR_MDCPUCFG)
8959 AC_SUBST(HOST_BIN_SUFFIX)
8960 AC_SUBST(HOST_OS_ARCH)
8962 AC_SUBST(TARGET_CPU)
8963 AC_SUBST(TARGET_VENDOR)
8965 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8966 AC_SUBST(TARGET_MD_ARCH)
8967 AC_SUBST(TARGET_XPCOM_ABI)
8970 AC_SUBST(OS_RELEASE)
8973 AC_SUBST(INTEL_ARCHITECTURE)
8975 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8977 AC_SUBST(WRAP_LDFLAGS)
8980 AC_SUBST(MKSHLIB_FORCE_ALL)
8981 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8982 AC_SUBST(DSO_CFLAGS)
8983 AC_SUBST(DSO_PIC_CFLAGS)
8984 AC_SUBST(DSO_LDOPTS)
8985 AC_SUBST(LIB_PREFIX)
8986 AC_SUBST(DLL_PREFIX)
8987 AC_SUBST(DLL_SUFFIX)
8988 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8989 AC_SUBST(LIB_SUFFIX)
8990 AC_SUBST(OBJ_SUFFIX)
8991 AC_SUBST(BIN_SUFFIX)
8992 AC_SUBST(ASM_SUFFIX)
8993 AC_SUBST(IMPORT_LIB_SUFFIX)
8995 AC_SUBST(CC_VERSION)
8996 AC_SUBST(CXX_VERSION)
8997 AC_SUBST(MSMANIFEST_TOOL)
8998 AC_SUBST(NS_ENABLE_TSF)
8999 AC_SUBST(MOZ_NSS_PATCH)
9000 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
9001 AC_SUBST(MOZ_APP_EXTRA_LIBS)
9003 AC_SUBST(MOZ_SPEEX_RESAMPLER)
9004 AC_SUBST(MOZ_SOUNDTOUCH)
9007 AC_SUBST(MOZ_VORBIS)
9008 AC_SUBST(MOZ_TREMOR)
9013 AC_SUBST(MOZ_MEDIA_PLUGINS)
9014 AC_SUBST(MOZ_OMX_PLUGIN)
9015 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
9016 AC_SUBST(MOZ_VP8_ENCODER)
9020 AC_SUBST(VPX_ASFLAGS)
9021 AC_SUBST(VPX_DASH_C_FLAG)
9022 AC_SUBST(VPX_AS_CONVERSION)
9023 AC_SUBST(VPX_ASM_SUFFIX)
9024 AC_SUBST(VPX_X86_ASM)
9025 AC_SUBST(VPX_ARM_ASM)
9026 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
9027 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
9028 AC_SUBST(LIBJPEG_TURBO_AS)
9029 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
9030 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
9031 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
9032 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
9034 AC_SUBST(MOZ_PACKAGE_JSSHELL)
9035 AC_SUBST(MOZ_FOLD_LIBS)
9037 AC_SUBST(MOZ_ENABLE_SZIP)
9038 AC_SUBST(MOZ_SZIP_FLAGS)
9040 AC_MSG_CHECKING([for posix_fallocate])
9041 AC_TRY_LINK([#define _XOPEN_SOURCE 600
9042 #include <fcntl.h>],
9043 [posix_fallocate(0, 0, 0);],
9044 [ac_cv___posix_fallocate=true],
9045 [ac_cv___posix_fallocate=false])
9047 if test "$ac_cv___posix_fallocate" = true ; then
9048 AC_DEFINE(HAVE_POSIX_FALLOCATE)
9054 dnl Check for missing components
9055 if test "$COMPILE_ENVIRONMENT"; then
9056 if test "$MOZ_X11"; then
9057 if test "$WITHOUT_X11"; then
9058 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
9060 dnl ====================================================
9061 dnl = Check if X headers exist
9062 dnl ====================================================
9063 _SAVE_CFLAGS=$CFLAGS
9064 CFLAGS="$CFLAGS $XCFLAGS"
9068 #include <X11/Xlib.h>
9069 #include <X11/Intrinsic.h>
9070 #include <X11/extensions/XShm.h>
9074 if ((dpy = XOpenDisplay(NULL)) == NULL) {
9075 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
9079 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
9080 CFLAGS="$_SAVE_CFLAGS"
9082 if test -n "$MISSING_X"; then
9083 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
9088 dnl Check for headers, etc. needed by WebGL.
9089 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
9090 MOZ_CHECK_HEADER(GL/glx.h)
9091 if test "$ac_cv_header_GL_glx_h" != "yes"; then
9092 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))])
9094 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
9095 fi # COMPILE_ENVIRONMENT
9097 dnl Set various defines and substitutions
9098 dnl ========================================================
9100 if test "$OS_ARCH" = "Darwin"; then
9102 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
9106 if test "$MOZ_DEBUG"; then
9107 AC_DEFINE(MOZ_REFLOW_PERF)
9108 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9111 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
9112 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9113 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9114 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9115 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9116 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9117 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9118 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9119 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9122 AC_SUBST(MOZILLA_VERSION)
9124 AC_SUBST(ac_configure_args)
9126 dnl Spit out some output
9127 dnl ========================================================
9129 dnl The following defines are used by xpcom
9130 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9132 HAVE_CPP_2BYTE_WCHAR_T
9133 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9135 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9136 HAVE_CPP_PARTIAL_SPECIALIZATION
9137 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9138 NEED_CPP_UNUSED_IMPLEMENTATIONS
9141 HAVE_ICONV_WITH_CONST_INPUT
9154 # FUTURE? Consider moving all these to moz.build files.
9156 netwerk/necko-config.h
9157 xpcom/xpcom-config.h
9158 xpcom/xpcom-private.h
9161 AC_SUBST(STLPORT_LIBS)
9163 AC_OUTPUT([mozilla-config.h])
9165 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
9166 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
9167 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
9168 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
9169 # (apparently) only need this hack when egrep's "pattern" is particularly long
9170 # (as in the following code) and the first egrep on our $PATH is Apple's. See
9174 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
9181 # Generate Makefiles for WebRTC directly from .gyp files
9182 if test "${OS_TARGET}" = "WINNT"; then
9183 if test "$HAVE_64BIT_OS"; then
9188 EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
9190 elif test "${OS_TARGET}" = "Android"; then
9191 if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
9192 EXTRA_GYP_DEFINES="-G os=linux "
9194 EXTRA_GYP_DEFINES="-D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
9198 if test -n "$ARM_ARCH"; then
9199 if test "$ARM_ARCH" -lt 7; then
9200 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
9202 if test "${OS_TARGET}" = "Android"; then
9203 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=1 "
9205 dnl CPU detection for ARM works on Android only. armv7 always uses CPU detection, so
9206 dnl we have to set armv7=0 for non-Android target
9207 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
9212 # Keep libcubeb and audio_device backends in sync
9213 if test -n "$MOZ_ALSA"; then
9214 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=1"
9216 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=0"
9218 if test -n "$MOZ_PULSEAUDIO"; then
9219 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=1"
9221 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=0"
9224 # Don't try to compile ssse3/sse4.1 code if toolchain doesn't support
9225 if test -n "$INTEL_ARCHITECTURE"; then
9226 if test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSSE3" -o -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
9227 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
9231 if test -n "$MOZ_WEBRTC"; then
9232 AC_MSG_RESULT("generating WebRTC Makefiles...")
9234 if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
9235 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D build_with_gonk=1 -D include_internal_audio_device=0"
9238 dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
9239 dnl so that regeneration via dependencies works correctly
9240 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"
9242 if test -n HAVE_CLOCK_MONOTONIC; then
9243 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=1"
9245 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=0"
9248 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}"
9250 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9251 $GYP_WEBRTC_OPTIONS \
9252 --generator-output=${_objdir}/media/webrtc/trunk \
9253 ${srcdir}/media/webrtc/trunk/peerconnection.gyp
9254 if test "$?" != 0; then
9255 AC_MSG_ERROR([failed to generate WebRTC Makefiles])
9258 # XXX disable until we land the tranche with signaling
9259 if test -n "$MOZ_WEBRTC_SIGNALING"; then
9260 AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
9261 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9262 $GYP_WEBRTC_OPTIONS \
9263 -D build_for_test=0 \
9264 --generator-output=${_objdir}/media/webrtc/signaling \
9265 ${srcdir}/media/webrtc/signaling/signaling.gyp
9266 if test "$?" != 0; then
9267 AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
9270 AC_MSG_RESULT("generating WebRTC/SignalingTest Makefiles...")
9271 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9272 $GYP_WEBRTC_OPTIONS \
9273 -D build_for_test=1 \
9274 --generator-output=${_objdir}/media/webrtc/signalingtest \
9275 ${srcdir}/media/webrtc/signaling/signaling.gyp
9276 if test "$?" != 0; then
9277 AC_MSG_ERROR([failed to generate WebRTC/SignalingTest Makefiles])
9281 AC_MSG_RESULT("generating gtest Makefiles...")
9282 # Ok to pass some extra -D's that are ignored here
9283 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9284 $GYP_WEBRTC_OPTIONS \
9285 --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
9286 ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
9287 if test "$?" != 0; then
9288 AC_MSG_ERROR([failed to generate gtest Makefiles])
9291 AC_MSG_RESULT("generating nrappkit Makefiles...")
9292 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9293 $GYP_WEBRTC_OPTIONS \
9294 --generator-output=${_objdir}/media/mtransport/third_party/nrappkit \
9295 ${srcdir}/media/mtransport/third_party/nrappkit/nrappkit.gyp
9296 if test "$?" != 0; then
9297 AC_MSG_ERROR([failed to generate nrappkit Makefiles])
9300 AC_MSG_RESULT("generating nICEr Makefiles...")
9301 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9302 $GYP_WEBRTC_OPTIONS \
9303 --generator-output=${_objdir}/media/mtransport/third_party/nICEr \
9304 ${srcdir}/media/mtransport/third_party/nICEr/nicer.gyp
9305 if test "$?" != 0; then
9306 AC_MSG_ERROR([failed to generate nICEr Makefiles])
9310 # Generate a JSON config file for unittest harnesses etc to read
9311 # build configuration details from in a standardized way.
9312 OS_TARGET=${OS_TARGET} \
9313 TARGET_CPU=${TARGET_CPU} \
9314 MOZ_DEBUG=${MOZ_DEBUG} \
9315 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} \
9316 UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
9317 MOZ_CRASHREPORTER=${MOZ_CRASHREPORTER} \
9318 MOZ_APP_NAME=${MOZ_APP_NAME} \
9319 TOPSRCDIR=${_topsrcdir} \
9320 MOZ_ASAN=${MOZ_ASAN} \
9321 $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
9322 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
9323 rm ./mozinfo.json.tmp
9325 mv -f ./mozinfo.json.tmp ./mozinfo.json
9328 # Run jemalloc configure script
9330 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
9331 ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
9332 if test -n "$MOZ_REPLACE_MALLOC"; then
9333 # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9334 ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9335 ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9337 if test -n "$MOZ_JEMALLOC3"; then
9338 case "${OS_ARCH}" in
9340 # We want jemalloc functions to be kept hidden on both Mac and Windows
9341 # See memory/build/mozmemory_wrap.h for details.
9342 ac_configure_args="$ac_configure_args --without-export"
9345 elif test "${OS_ARCH}" = Darwin; then
9346 # When building as a replace-malloc lib, disabling the zone allocator
9347 # forces to use pthread_atfork.
9348 ac_configure_args="$ac_configure_args --disable-zone-allocator"
9350 _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9352 if test -z "$MOZ_REPLACE_MALLOC"; then
9354 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9358 elif test -z "$MOZ_JEMALLOC3"; then
9360 JEMALLOC_WRAPPER=replace_
9362 if test -n "$MANGLE"; then
9364 if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
9365 JEMALLOC_WRAPPER=__wrap_
9367 for mangle in ${MANGLE}; do
9368 if test -n "$MANGLED"; then
9369 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9371 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9374 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9377 if test -z "$MOZ_TLS"; then
9378 ac_configure_args="$ac_configure_args --disable-tls"
9380 EXTRA_CFLAGS="$CFLAGS"
9381 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9382 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9384 if test "$CROSS_COMPILE"; then
9385 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9387 _save_cache_file="$cache_file"
9388 cache_file=$_objdir/memory/jemalloc/src/config.cache
9390 if ! test -e memory/jemalloc; then
9391 mkdir -p memory/jemalloc
9394 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9395 cache_file="$_save_cache_file"
9396 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9399 # Run freetype configure script
9401 if test "$MOZ_TREE_FREETYPE"; then
9402 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9403 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9404 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9405 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9406 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9407 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --without-png"
9409 if ! test -e modules; then
9413 AC_OUTPUT_SUBDIRS(modules/freetype2)
9416 if test -z "$direct_nspr_config"; then
9417 dnl ========================================================
9418 dnl = Setup a nice relatively clean build environment for
9419 dnl = sub-configures.
9420 dnl ========================================================
9423 CFLAGS="$_SUBDIR_CFLAGS"
9424 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9425 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9426 LDFLAGS="$_SUBDIR_LDFLAGS"
9427 HOST_CC="$_SUBDIR_HOST_CC"
9428 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9429 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9436 # Run all configure scripts specified by a subconfigure
9437 if test -n "$_subconfigure_subdir"; then
9438 _save_ac_configure_args="$ac_configure_args"
9439 ac_configure_args="$_subconfigure_config_args"
9440 AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
9441 ac_configure_args="$_save_ac_configure_args"
9444 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9445 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9449 if test -n "$_WRAP_MALLOC"; then
9450 # Avoid doubling wrap malloc arguments
9451 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9454 if test -z "$MOZ_NATIVE_NSPR"; then
9455 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9456 if test -z "$MOZ_DEBUG"; then
9457 ac_configure_args="$ac_configure_args --disable-debug"
9459 ac_configure_args="$ac_configure_args --enable-debug"
9461 if test "$MOZ_OPTIMIZE" = "1"; then
9462 ac_configure_args="$ac_configure_args --enable-optimize"
9463 elif test -z "$MOZ_OPTIMIZE"; then
9464 ac_configure_args="$ac_configure_args --disable-optimize"
9466 if test -n "$HAVE_64BIT_OS"; then
9467 ac_configure_args="$ac_configure_args --enable-64bit"
9469 if test -n "$USE_ARM_KUSER"; then
9470 ac_configure_args="$ac_configure_args --with-arm-kuser"
9472 ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9474 # Save these, so we can mess with them for the subconfigure ..
9475 _SAVE_CFLAGS="$CFLAGS"
9476 _SAVE_CPPFLAGS="$CPPFLAGS"
9477 _SAVE_LDFLAGS="$LDFLAGS"
9479 if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9480 # dladdr is supported by the new linker, even when the system linker doesn't
9481 # support it. Trick nspr into using dladdr when it's not supported.
9482 export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9484 export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9485 export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
9487 AC_OUTPUT_SUBDIRS(nsprpub)
9489 # .. and restore them
9493 CFLAGS="$_SAVE_CFLAGS"
9494 CPPFLAGS="$_SAVE_CPPFLAGS"
9495 LDFLAGS="$_SAVE_LDFLAGS"
9497 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9500 dnl ========================================================
9501 dnl = Setup a nice relatively clean build environment for
9502 dnl = sub-configures.
9503 dnl ========================================================
9506 CFLAGS="$_SUBDIR_CFLAGS"
9507 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9508 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9509 LDFLAGS="$_SUBDIR_LDFLAGS"
9510 HOST_CC="$_SUBDIR_HOST_CC"
9511 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9512 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9515 if test -n "$ENABLE_CLANG_PLUGIN"; then
9516 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9517 AC_OUTPUT_SUBDIRS(build/clang-plugin)
9521 # Run the SpiderMonkey 'configure' script.
9522 dist=$MOZ_BUILD_ROOT/dist
9523 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9524 ac_configure_args="$ac_configure_args --enable-threadsafe"
9525 if test "A" = "A"; then # "$MOZ_BUILDAPP" != "browser", when desktop builds this
9526 # The Internationalization API is currently disabled in all non-standalone
9527 # SpiderMonkey builds, but it should be turned on for desktop builds soon.
9528 ac_configure_args="$ac_configure_args --disable-intl-api"
9530 if test "$BUILD_CTYPES"; then
9531 # Build js-ctypes on the platforms we can.
9532 ac_configure_args="$ac_configure_args --enable-ctypes"
9534 if test -z "$JS_SHARED_LIBRARY" ; then
9535 ac_configure_args="$ac_configure_args --disable-shared-js"
9537 if test -z "$MOZ_NATIVE_NSPR"; then
9538 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9539 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9541 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9542 ac_configure_args="$ac_configure_args --prefix=$dist"
9543 if test "$MOZ_MEMORY"; then
9544 ac_configure_args="$ac_configure_args --enable-jemalloc"
9546 if test -n "$MOZ_GLUE_LDFLAGS"; then
9547 export MOZ_GLUE_LDFLAGS
9549 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9550 export MOZ_GLUE_PROGRAM_LDFLAGS
9552 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9555 export MOZ_NATIVE_ZLIB
9556 export MOZ_ZLIB_CFLAGS
9557 export MOZ_ZLIB_LIBS
9559 export DONT_POPULATE_VIRTUALENV=1
9561 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9562 export STLPORT_CPPFLAGS
9563 export STLPORT_LDFLAGS
9565 export JS_STANDALONE=no
9567 if ! test -e js; then
9571 AC_OUTPUT_SUBDIRS(js/src)
9572 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9574 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR