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 STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/ -I$gonkdir/external/stlport/stlport/"
194 STLPORT_LIBS="-lstlport"
196 case "$target_cpu" in
205 case "$ANDROID_VERSION" in
207 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"
211 AC_DEFINE(MOZ_OMX_DECODER)
212 AC_SUBST(MOZ_OMX_DECODER)
215 GONK_INCLUDES="-I$gonkdir/frameworks/native/include"
218 AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
221 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"
222 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
223 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
224 dnl Add -llog by default, since we use it all over the place.
225 LIBS="$LIBS -llog $STLPORT_LIBS"
227 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"
229 dnl prevent cross compile section from using these flags as host flags
230 if test -z "$HOST_CPPFLAGS" ; then
233 if test -z "$HOST_CFLAGS" ; then
236 if test -z "$HOST_CXXFLAGS" ; then
239 if test -z "$HOST_LDFLAGS" ; then
244 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
245 AC_SUBST(ANDROID_VERSION)
246 AC_DEFINE(HAVE_SYS_UIO_H)
247 AC_DEFINE(HAVE_PTHREADS)
249 MOZ_CHROME_FILE_FORMAT=omni
255 *-android*|*-linuxandroid*)
256 if test -z "$ANDROID_PACKAGE_NAME" ; then
257 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
259 MOZ_CHROME_FILE_FORMAT=omni
263 AC_PATH_PROG(OBJCOPY,objcopy)
268 AC_SUBST(ANDROID_SOURCE)
269 AC_SUBST(ANDROID_PACKAGE_NAME)
272 dnl ========================================================
273 dnl Checks for compilers.
274 dnl ========================================================
275 dnl Set CROSS_COMPILE in the environment when running configure
276 dnl to use the cross-compile setup for now
277 dnl ========================================================
279 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
282 if test "$COMPILE_ENVIRONMENT"; then
284 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
285 echo "cross compiling from $host to $target"
289 _SAVE_CFLAGS="$CFLAGS"
290 _SAVE_LDFLAGS="$LDFLAGS"
292 AC_MSG_CHECKING([for host c compiler])
293 AC_CHECK_PROGS(HOST_CC, $HOST_CC cc gcc /usr/ucb/cc cl icc, "")
294 if test -z "$HOST_CC"; then
295 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
297 AC_MSG_RESULT([$HOST_CC])
298 AC_MSG_CHECKING([for host c++ compiler])
299 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
300 if test -z "$HOST_CXX"; then
301 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
303 AC_MSG_RESULT([$HOST_CXX])
305 if test -z "$HOST_CFLAGS"; then
306 HOST_CFLAGS="$CFLAGS"
308 if test -z "$HOST_CXXFLAGS"; then
309 HOST_CXXFLAGS="$CXXFLAGS"
311 if test -z "$HOST_LDFLAGS"; then
312 HOST_LDFLAGS="$LDFLAGS"
314 if test -z "$HOST_AR_FLAGS"; then
315 HOST_AR_FLAGS="$AR_FLAGS"
317 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
318 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
320 CFLAGS="$HOST_CFLAGS"
321 LDFLAGS="$HOST_LDFLAGS"
323 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
324 AC_TRY_COMPILE([], [return(0);],
325 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
326 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
329 CFLAGS="$HOST_CXXFLAGS"
331 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
332 AC_TRY_COMPILE([], [return(0);],
333 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
334 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
338 LDFLAGS=$_SAVE_LDFLAGS
340 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
343 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
347 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
348 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
349 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
350 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
351 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
352 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
353 AC_DEFINE(CROSS_COMPILE)
358 # Work around the conftest.exe access problem on Windows
363 MOZ_PATH_PROGS(AS, $AS as, $CC)
364 AC_CHECK_PROGS(AR, ar, :)
365 AC_CHECK_PROGS(LD, ld, :)
366 AC_CHECK_PROGS(STRIP, strip, :)
367 AC_CHECK_PROGS(WINDRES, windres, :)
368 if test -z "$HOST_CC"; then
371 if test -z "$HOST_CFLAGS"; then
372 HOST_CFLAGS="$CFLAGS"
374 if test -z "$HOST_CXX"; then
377 if test -z "$HOST_CXXFLAGS"; then
378 HOST_CXXFLAGS="$CXXFLAGS"
380 if test -z "$HOST_LDFLAGS"; then
381 HOST_LDFLAGS="$LDFLAGS"
383 if test -z "$HOST_RANLIB"; then
384 HOST_RANLIB="$RANLIB"
386 if test -z "$HOST_AR"; then
389 if test -z "$HOST_AR_FLAGS"; then
390 HOST_AR_FLAGS="$AR_FLAGS"
394 if test -n "$MOZ_WINCONSOLE"; then
395 AC_DEFINE(MOZ_WINCONSOLE)
400 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
401 if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
402 test "$GCC_MAJOR_VERSION" -lt 4; then
403 AC_MSG_ERROR([Only GCC 4.4 or newer supported])
407 dnl ========================================================
408 dnl Special win32 checks
409 dnl ========================================================
411 MOZ_ARG_ENABLE_BOOL(metro,
412 [ --enable-metro Enable Windows Metro build targets],
415 if test -n "$MOZ_METRO"; then
417 # Target the Windows 8 Kit
420 # toolkit/library/makefile.in needs these, see nsDllMain.
422 CRTEXPDLLVERSION=1-1-0
424 # Target the Windows 7 SDK by default
429 AC_SUBST(CRTDLLVERSION)
430 AC_SUBST(CRTEXPDLLVERSION)
432 MOZ_ARG_WITH_STRING(windows-version,
433 [ --with-windows-version=WINSDK_TARGETVER
434 Windows SDK version to target. Lowest version
435 currently allowed is 601 (Win7), highest is 602 (Win8)],
436 WINSDK_TARGETVER=$withval)
438 # Currently only two sdk versions allowed, 601 and 602
439 case "$WINSDK_TARGETVER" in
441 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
445 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
451 if test "$GCC" != "yes" -a -z "$CLANG_CC"; then
452 # Check to see if we are really running in a msvc environemnt
454 AC_CHECK_PROGS(MIDL, midl)
456 # Make sure compilers are valid
457 CFLAGS="$CFLAGS -TC -nologo"
458 CXXFLAGS="$CXXFLAGS -TP -nologo"
461 AC_TRY_COMPILE([#include <stdio.h>],
462 [ printf("Hello World\n"); ],,
463 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
466 AC_TRY_COMPILE([#include <new.h>],
467 [ unsigned *test = new unsigned(42); ],,
468 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
472 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
475 # Determine compiler version
476 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
477 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
478 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
479 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
480 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
481 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
483 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
484 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
486 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
487 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
490 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
491 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
493 if test "$_CC_MAJOR_VERSION" = "16"; then
496 elif test "$_CC_MAJOR_VERSION" = "17"; then
499 elif test "$_CC_MAJOR_VERSION" = "18"; then
503 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
506 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
508 if test -n "$WIN32_REDIST_DIR"; then
509 if test ! -d "$WIN32_REDIST_DIR"; then
510 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
512 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
515 dnl Confirm we have the pri tools on win8 builds
516 if test -n "$MOZ_METRO"; then
517 AC_MSG_CHECKING([for makepri])
518 AC_CHECK_PROGS(MAKEPRI, makepri, "")
519 if test -z "MAKEPRI" ; then
520 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
525 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
526 dnl not something else like "magnetic tape manipulation utility".
527 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
528 if test -z "$MSMT_TOOL"; then
529 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
533 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
535 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
536 if test -z "$MSMANIFEST_TOOL_VERSION"; then
537 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
543 # Check linker version
544 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
545 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
546 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
547 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
553 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
554 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
555 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
556 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
557 # Add flags if necessary
558 AC_MSG_CHECKING([for midl flags])
561 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
562 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
563 # MIDL version 7.00.0500 or later has no problem.
564 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
565 AC_MSG_RESULT([need -env win32])
567 AC_MSG_RESULT([none needed])
571 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
574 AC_MSG_RESULT([none needed])
578 unset _MSVC_VER_FILTER
580 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
584 _SAVE_CXXFLAGS="$CXXFLAGS"
585 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
586 AC_TRY_COMPILE([#include <exception>],
587 [std::_Throw(std::exception()); return 0;],
588 ac_cv_have_std__Throw="yes",
589 ac_cv_have_std__Throw="no")
590 CXXFLAGS="$_SAVE_CXXFLAGS"
594 if test "$ac_cv_have_std__Throw" = "yes"; then
595 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
596 ac_cv_have_dllimport_exception_bug,
600 _SAVE_CXXFLAGS="$CXXFLAGS"
601 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
602 AC_TRY_LINK([#include <vector>],
603 [std::vector<int> v; return v.at(1);],
604 ac_cv_have_dllimport_exception_bug="no",
605 ac_cv_have_dllimport_exception_bug="yes")
606 CXXFLAGS="$_SAVE_CXXFLAGS"
609 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
611 MOZ_MSVC_STL_WRAP__Throw=1
612 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
615 AC_CACHE_CHECK(for overridable _RAISE,
620 _SAVE_CXXFLAGS="$CXXFLAGS"
621 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
622 AC_TRY_COMPILE([#include <xstddef>
624 #define _RAISE(x) externallyDefinedFunction((x).what())
627 [std::vector<int> v; return v.at(1);],
628 ac_cv_have__RAISE="no",
629 ac_cv_have__RAISE="yes")
630 CXXFLAGS="$_SAVE_CXXFLAGS"
633 if test "$ac_cv_have__RAISE" = "yes"; then
635 MOZ_MSVC_STL_WRAP__RAISE=1
636 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
638 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
642 if test "$WRAP_STL_INCLUDES" = "1"; then
643 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
645 elif test -z "$CLANG_CC"; then
646 # Check w32api version
647 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
648 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
649 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
650 AC_TRY_COMPILE([#include <w32api.h>],
651 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
652 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
653 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
654 #error "test failed."
656 , [ res=yes ], [ res=no ])
657 AC_MSG_RESULT([$res])
658 if test "$res" != "yes"; then
659 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
661 # Check windres version
662 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
663 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
664 AC_MSG_RESULT([$_WINDRES_VERSION])
665 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
666 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
667 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
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 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
672 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
673 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
674 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
675 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
676 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
678 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
681 AC_CHECK_PROGS(MIDL, $target-widl widl)
682 if test -n "$MIDL"; then
685 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
688 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
693 MOZ_WINSDK_MAXVER=0x06020000
697 if test "$GCC" != "yes" -o -n "$CLANG_CC" ; then
698 MOZ_FIND_WINSDK_VERSION
701 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
702 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
703 # Require OS features provided by IE 6.0 SP2 (XP SP2)
704 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
706 # If the maximum version supported by this SDK is lower than the target
708 AC_MSG_CHECKING([for Windows SDK being recent enough])
709 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
713 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.])
716 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
717 # Definitions matching sdkddkver.h
718 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
719 AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
720 AC_SUBST(MOZ_WINSDK_MAXVER)
727 if test -n "$_WIN32_MSVC"; then
729 SKIP_COMPILER_CHECKS=1
730 SKIP_LIBRARY_CHECKS=1
732 # Since we're skipping compiler and library checks, hard-code
735 AC_DEFINE(HAVE_SETBUF)
736 AC_DEFINE(HAVE_ISATTY)
739 fi # COMPILE_ENVIRONMENT
752 AC_SUBST(WRAP_STL_INCLUDES)
753 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
754 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
756 dnl ========================================================
757 dnl Checks for programs.
758 dnl ========================================================
762 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
763 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
764 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
766 AC_MSG_RESULT([$_perl_version])
768 if test "$_perl_res" != 0; then
769 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
773 AC_MSG_CHECKING([for full perl installation])
774 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
776 if test "$_perl_res" != 0; then
778 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
783 MOZ_ARG_WITH_BOOL(system-ply,
784 [ --with-system-ply Use system installed python ply library],
785 [if $PYTHON -c 'import ply' 2>&5; then
788 AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
791 AC_SUBST(MOZ_SYSTEM_PLY)
793 if test -z "$COMPILE_ENVIRONMENT"; then
794 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
796 AC_SUBST(NSINSTALL_BIN)
798 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
799 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
800 MOZ_PATH_PROGS(UNZIP, unzip)
801 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
802 AC_MSG_ERROR([unzip not found in \$PATH])
804 MOZ_PATH_PROGS(ZIP, zip)
805 if test -z "$ZIP" -o "$ZIP" = ":"; then
806 AC_MSG_ERROR([zip not found in \$PATH])
808 MOZ_PATH_PROG(XARGS, xargs)
809 if test -z "$XARGS" -o "$XARGS" = ":"; then
810 AC_MSG_ERROR([xargs not found in \$PATH .])
813 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
816 if test "$COMPILE_ENVIRONMENT"; then
818 dnl ========================================================
819 dnl = Mac OS X toolchain support
820 dnl ========================================================
822 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
823 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
824 dnl when we can run target binaries.
825 AC_SUBST(UNIVERSAL_BINARY)
826 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
828 MOZ_ARG_WITH_STRING(unify-dist,
829 [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
831 if test -n "$UNIVERSAL_BINARY"; then
832 if test -z "$UNIFY_DIST"; then
833 AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
835 case "$UNIFY_DIST" in
839 UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
845 dnl ========================================================
846 dnl Check for MacOS deployment target version
847 dnl ========================================================
849 MOZ_ARG_ENABLE_STRING(macos-target,
850 [ --enable-macos-target=VER (default=10.6)
851 Set the minimum MacOS version needed at runtime],
852 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
856 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
857 dnl Use the specified value
858 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
860 dnl No value specified on the command line or in the environment,
861 dnl use architecture minimum.
862 export MACOSX_DEPLOYMENT_TARGET=10.6
867 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
869 dnl ========================================================
870 dnl = Mac OS X SDK support
871 dnl ========================================================
874 MOZ_ARG_WITH_STRING(macos-sdk,
875 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
876 MACOS_SDK_DIR=$withval)
878 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
879 dnl NEXT_ROOT will be set and exported only if it's needed.
880 AC_SUBST(MACOS_SDK_DIR)
883 if test "$MACOS_SDK_DIR"; then
884 dnl Sync this section with the ones in NSPR and NSS.
885 dnl Changes to the cross environment here need to be accounted for in
886 dnl the libIDL checks (below) and xpidl build.
888 if test ! -d "$MACOS_SDK_DIR"; then
889 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
890 specify a valid SDK. SDKs are installed when the optional cross-development
891 tools are selected during the Xcode/Developer Tools installation.])
894 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
895 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
897 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
898 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
899 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
902 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
904 AC_TRY_COMPILE([#include <new>],[],
908 AC_MSG_RESULT($result)
910 if test "$result" = "no" ; then
911 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
915 fi # COMPILE_ENVIRONMENT
917 AC_MSG_CHECKING([compiler version])
918 # Just print it so it shows up in the logs.
919 cc_version=$($CC --version)
920 AC_MSG_RESULT([$cc_version])
922 if test -n "$MAKE"; then
923 if test `echo $MAKE | grep -c make.py` != 1; then
930 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
933 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
936 if test "$GMAKE" = ":"; then
937 AC_MSG_ERROR([GNU make not found])
941 if test -z "$MAKE"; then
945 if test "$COMPILE_ENVIRONMENT"; then
951 fi # COMPILE_ENVIRONMENT
953 dnl ========================================================
954 dnl set the defaults first
955 dnl ========================================================
971 MOZ_USER_DIR=".mozilla"
974 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
976 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
978 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
980 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
981 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
982 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxul -lxpcom_core -lmozalloc'
983 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
984 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxul -lmozalloc'
985 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)'
986 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
987 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
989 # These are specially defined on Windows only
992 XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
993 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
996 XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
997 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
1003 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1005 USE_DEPENDENT_LIBS=1
1007 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1009 if test -n "$CROSS_COMPILE"; then
1010 OS_TARGET="${target_os}"
1011 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1013 case "${target_os}" in
1014 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1015 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1016 gnu*) OS_ARCH=GNU ;;
1017 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1018 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
1019 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1022 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1025 OS_TARGET=`uname -s`
1026 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1027 OS_RELEASE=`uname -r`
1030 # Before this used `uname -m` when not cross compiling
1031 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1032 OS_TEST="${target_cpu}"
1034 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1036 #######################################################################
1037 # Master "Core Components" macros for getting the OS target #
1038 #######################################################################
1041 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1042 # cross-compilation.
1046 # Define and override various archtecture-specific variables, including
1055 case "$HOST_OS_ARCH" in
1069 if test -z "$GNU_CC"; then
1070 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1075 if test -z "$GNU_CXX"; then
1076 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1077 SOLARIS_SUNPRO_CXX=1
1080 AC_SUBST(SOLARIS_SUNPRO_CC)
1081 AC_SUBST(SOLARIS_SUNPRO_CXX)
1090 if test -z "$CROSS_COMPILE" ; then
1096 # If uname -s returns "Windows_NT", we assume that we are using
1097 # the uname.exe in MKS toolkit.
1099 # The -r option of MKS uname only returns the major version number.
1100 # So we need to use its -v option to get the minor version number.
1101 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1105 OS_MINOR_RELEASE=`uname -v`
1106 if test "$OS_MINOR_RELEASE" = "00"; then
1109 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1113 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1114 # the uname.exe in the MSYS tools.
1116 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1121 OS_RELEASE=`uname -v`.`uname -r`
1122 OS_TEST=${target_cpu}
1127 OS_RELEASE=`uname -v`
1130 case "${target_cpu}" in
1141 if test -z "$CROSS_COMPILE" ; then
1149 # Only set CPU_ARCH if we recognize the value of OS_TEST
1160 powerpc | ppc | rs6000)
1164 Alpha | alpha | ALPHA)
1197 if test -z "$OS_TARGET"; then
1200 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1202 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1203 dnl ===============================================================
1207 INTEL_ARCHITECTURE=1
1210 dnl Configure platform-specific CPU architecture compiler options.
1211 dnl ==============================================================
1214 dnl =================================================================
1215 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1216 dnl which is bad when cross compiling.
1217 dnl =================================================================
1218 if test "$COMPILE_ENVIRONMENT"; then
1219 configure_static_assert_macros='
1220 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1221 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1222 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1225 dnl test that the macros actually work:
1226 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1227 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1230 ac_cv_static_assertion_macros_work="yes"
1231 AC_TRY_COMPILE([$configure_static_assert_macros],
1232 [CONFIGURE_STATIC_ASSERT(1)],
1234 ac_cv_static_assertion_macros_work="no")
1235 AC_TRY_COMPILE([$configure_static_assert_macros],
1236 [CONFIGURE_STATIC_ASSERT(0)],
1237 ac_cv_static_assertion_macros_work="no",
1240 AC_TRY_COMPILE([$configure_static_assert_macros],
1241 [CONFIGURE_STATIC_ASSERT(1)],
1243 ac_cv_static_assertion_macros_work="no")
1244 AC_TRY_COMPILE([$configure_static_assert_macros],
1245 [CONFIGURE_STATIC_ASSERT(0)],
1246 ac_cv_static_assertion_macros_work="no",
1250 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1251 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1252 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1254 fi # COMPILE_ENVIRONMENT
1256 dnl ========================================================
1257 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1259 dnl ========================================================
1263 dnl ========================================================
1264 dnl Suppress Clang Argument Warnings
1265 dnl ========================================================
1266 if test -n "$CLANG_CC"; then
1267 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1268 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1270 if test -n "$CLANG_CXX"; then
1271 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1274 dnl ========================================================
1275 dnl = Use Address Sanitizer
1276 dnl ========================================================
1277 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1278 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1281 if test -n "$MOZ_ASAN"; then
1287 dnl ========================================================
1288 dnl = Enable hacks required for LLVM instrumentations
1289 dnl ========================================================
1290 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1291 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1294 if test -n "$MOZ_LLVM_HACKS"; then
1298 AC_SUBST(MOZ_NO_WLZDEFS)
1299 AC_SUBST(MOZ_CFLAGS_NSS)
1301 dnl ========================================================
1302 dnl GNU specific defaults
1303 dnl ========================================================
1304 if test "$GNU_CC"; then
1305 # Per bug 719659 comment 2, some of the headers on ancient build machines
1306 # may require gnu89 inline semantics. But otherwise, we use C99.
1307 CFLAGS="$CFLAGS -std=gnu99 -fgnu89-inline"
1308 # FIXME: Let us build with strict aliasing. bug 414641.
1309 CFLAGS="$CFLAGS -fno-strict-aliasing"
1310 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1311 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1312 DSO_LDOPTS='-shared'
1313 if test "$GCC_USE_GNU_LD"; then
1314 # Some tools like ASan use a runtime library that is only
1315 # linked against executables, so we must allow undefined
1316 # symbols for shared objects in some cases.
1317 if test -z "$MOZ_NO_WLZDEFS"; then
1318 # Don't allow undefined symbols in libraries
1319 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1322 WARNINGS_AS_ERRORS='-Werror'
1323 # Don't treat -Wuninitialized as error b/c it has lots of false positives.
1324 WARNINGS_AS_ERRORS="$WARNINGS_AS_ERRORS -Wno-error=uninitialized"
1325 # Don't treat -Wdeprecated-declarations as error b/c we don't want our
1326 # builds held hostage when a platform-specific API is suddenly deprecated.
1327 WARNINGS_AS_ERRORS="$WARNINGS_AS_ERRORS -Wno-error=deprecated-declarations"
1329 DSO_PIC_CFLAGS='-fPIC'
1330 ASFLAGS="$ASFLAGS -fPIC"
1331 AC_MSG_CHECKING([for --noexecstack option to as])
1332 _SAVE_CFLAGS=$CFLAGS
1333 CFLAGS="$CFLAGS -Wa,--noexecstack"
1334 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1335 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1336 AC_MSG_RESULT([no]))
1337 CFLAGS=$_SAVE_CFLAGS
1338 AC_MSG_CHECKING([for -z noexecstack option to ld])
1339 _SAVE_LDFLAGS=$LDFLAGS
1340 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1341 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1343 LDFLAGS=$_SAVE_LDFLAGS)
1344 AC_MSG_CHECKING([for --build-id option to ld])
1345 _SAVE_LDFLAGS=$LDFLAGS
1346 LDFLAGS="$LDFLAGS -Wl,--build-id"
1347 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1348 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1350 LDFLAGS=$_SAVE_LDFLAGS)
1353 # Check for -mssse3 on $CC
1354 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1355 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1356 _SAVE_CFLAGS=$CFLAGS
1357 CFLAGS="$CFLAGS -mssse3"
1358 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1359 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1360 AC_MSG_RESULT([no]))
1361 CFLAGS=$_SAVE_CFLAGS
1362 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
1364 # Check for -msse4.1 on $CC
1365 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1366 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1367 _SAVE_CFLAGS=$CFLAGS
1368 CFLAGS="$CFLAGS -msse4.1"
1369 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1370 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1371 AC_MSG_RESULT([no]))
1372 CFLAGS=$_SAVE_CFLAGS
1373 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
1375 # Turn on GNU-specific warnings:
1376 # -Wall - turn on a lot of warnings
1377 # -Wpointer-arith - good to have
1378 # -Wdeclaration-after-statement - MSVC doesn't like these
1379 # -Werror=return-type - catches missing returns, zero false positives
1380 # -Wtype-limits - catches overflow bugs, few false positives
1381 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1382 # -Wsign-compare - catches comparison of signed and unsigned types
1384 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1385 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1386 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1387 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1388 MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1390 # Turn off the following warnings that -Wall turns on:
1391 # -Wno-unused - lots of violations in third-party code
1393 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1395 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1396 # Don't use -Wcast-align with ICC or clang
1398 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1399 hppa | ia64 | sparc | arm)
1402 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1407 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1408 _USE_CPP_INCLUDE_FLAG=1
1409 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1411 elif test "$SOLARIS_SUNPRO_CC"; then
1413 if test "$CPU_ARCH" = "sparc"; then
1414 # for Sun Studio on Solaris/SPARC
1415 DSO_PIC_CFLAGS='-xcode=pic32'
1417 DSO_PIC_CFLAGS='-KPIC'
1419 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1421 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1422 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1424 DSO_LDOPTS='-shared'
1425 if test "$GNU_LD"; then
1426 # Don't allow undefined symbols in libraries
1427 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1431 DSO_PIC_CFLAGS='-KPIC'
1432 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1435 if test "$GNU_CXX"; then
1436 # FIXME: Let us build with strict aliasing. bug 414641.
1437 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1439 # Turn on GNU-specific warnings:
1440 # -Wall - turn on a lot of warnings
1441 # -Wpointer-arith - good to have
1442 # -Woverloaded-virtual - ???
1443 # -Werror=return-type - catches missing returns, zero false positives
1444 # -Wtype-limits - catches overflow bugs, few false positives
1445 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1446 # -Wsign-compare - catches comparison of signed and unsigned types
1448 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1449 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1450 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1451 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1452 MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1454 # Turn off the following warnings that -Wall turns on:
1455 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1457 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1459 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1460 # Don't use -Wcast-align with ICC or clang
1462 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1463 hppa | ia64 | sparc | arm)
1466 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1471 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1472 _USE_CPP_INCLUDE_FLAG=1
1474 # Recent clang and gcc support C++11 deleted functions without warnings if
1475 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1476 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1477 # unused. But clang's warning can be disabled, so when compiling with clang
1478 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1479 # deleted function syntax.
1480 if test "$CLANG_CXX"; then
1481 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1482 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1486 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1489 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1490 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1491 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1492 dnl normal behavior.
1493 dnl ========================================================
1495 MKSHLIB_UNFORCE_ALL=
1497 if test "$COMPILE_ENVIRONMENT"; then
1498 if test "$GNU_CC"; then
1499 AC_MSG_CHECKING(whether ld has archive extraction flags)
1500 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1501 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1502 ac_cv_mkshlib_force_and_unforce="no"
1503 exec 3<&0 <<LOOP_INPUT
1504 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1505 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1506 force="-Wl,-all"; unforce="-Wl,-none"
1513 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1516 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1518 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1522 eval $ac_cv_mkshlib_force_and_unforce
1523 MKSHLIB_FORCE_ALL=$force
1524 MKSHLIB_UNFORCE_ALL=$unforce
1527 fi # COMPILE_ENVIRONMENT
1529 dnl ========================================================
1530 dnl Checking for 64-bit OS
1531 dnl ========================================================
1532 if test "$COMPILE_ENVIRONMENT"; then
1535 AC_MSG_CHECKING(for 64-bit OS)
1536 AC_TRY_COMPILE([$configure_static_assert_macros],
1537 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1538 result="yes", result="no")
1539 AC_MSG_RESULT("$result")
1540 if test "$result" = "yes"; then
1541 AC_DEFINE(HAVE_64BIT_OS)
1544 AC_SUBST(HAVE_64BIT_OS)
1546 fi # COMPILE_ENVIRONMENT
1548 dnl ========================================================
1549 dnl Enable high-memory support on OS/2 by default.
1550 dnl ========================================================
1551 MOZ_OS2_HIGH_MEMORY=1
1552 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1553 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1554 MOZ_OS2_HIGH_MEMORY=,
1555 MOZ_OS2_HIGH_MEMORY=1 )
1556 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1558 dnl ========================================================
1559 dnl = Use profiling compile flags
1560 dnl ========================================================
1561 MOZ_ARG_ENABLE_BOOL(profiling,
1562 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1566 # For profiling builds keep the symbol information
1567 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1568 case "$OS_TARGET" in
1569 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1570 STRIP_FLAGS="--strip-debug"
1575 dnl ========================================================
1576 dnl = Use incremental GC
1577 dnl ========================================================
1579 MOZ_ARG_DISABLE_BOOL(gcincremental,
1580 [ --disable-gcincremental Disable incremental GC],
1582 if test -n "$JSGC_INCREMENTAL"; then
1583 AC_DEFINE(JSGC_INCREMENTAL)
1586 dnl ========================================================
1587 dnl = Use generational GC
1588 dnl ========================================================
1589 MOZ_ARG_ENABLE_BOOL(gcgenerational,
1590 [ --enable-gcgenerational Enable generational GC],
1591 JSGC_GENERATIONAL=1,
1592 JSGC_GENERATIONAL= )
1593 if test -n "$JSGC_GENERATIONAL"; then
1594 AC_DEFINE(JSGC_GENERATIONAL)
1597 dnl ========================================================
1598 dnl = Perform moving GC stack rooting analysis
1599 dnl ========================================================
1600 MOZ_ARG_ENABLE_BOOL(root-analysis,
1601 [ --enable-root-analysis Enable moving GC stack root analysis],
1602 JSGC_ROOT_ANALYSIS=1,
1603 JSGC_ROOT_ANALYSIS= )
1604 if test -n "$JSGC_ROOT_ANALYSIS"; then
1605 AC_DEFINE(JSGC_ROOT_ANALYSIS)
1608 dnl ========================================================
1609 dnl = Use exact stack rooting for GC
1610 dnl ========================================================
1611 MOZ_ARG_ENABLE_BOOL(exact-rooting,
1612 [ --enable-exact-rooting Enable use of exact stack roots for GC],
1613 JSGC_USE_EXACT_ROOTING=1,
1614 JSGC_USE_EXACT_ROOTING= )
1615 if test -n "$JSGC_USE_EXACT_ROOTING"; then
1616 AC_DEFINE(JSGC_USE_EXACT_ROOTING)
1619 dnl ========================================================
1621 dnl ========================================================
1622 MOZ_ARG_ENABLE_BOOL(valgrind,
1623 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1626 if test -n "$MOZ_VALGRIND"; then
1627 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1629 [--enable-valgrind specified but Valgrind is not installed]))
1630 AC_DEFINE(MOZ_VALGRIND)
1632 AC_SUBST(MOZ_VALGRIND)
1634 dnl ========================================================
1636 dnl ========================================================
1637 MOZ_ARG_ENABLE_BOOL(jprof,
1638 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1641 if test -n "$MOZ_JPROF"; then
1643 AC_DEFINE(MOZ_JPROF)
1646 dnl ========================================================
1648 dnl ========================================================
1649 MOZ_ENABLE_PROFILER_SPS=1
1651 case "${OS_TARGET}" in
1653 case "${CPU_ARCH}" in
1656 MOZ_ENABLE_PROFILER_SPS=
1660 case "${CPU_ARCH}" in
1663 MOZ_ENABLE_PROFILER_SPS=
1668 MOZ_ENABLE_PROFILER_SPS=
1672 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1673 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1676 dnl ========================================================
1678 dnl ========================================================
1679 MOZ_ARG_ENABLE_BOOL(shark,
1680 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1683 if test -n "$MOZ_SHARK"; then
1685 AC_DEFINE(MOZ_SHARK)
1688 dnl ========================================================
1690 dnl ========================================================
1691 MOZ_ARG_ENABLE_BOOL(instruments,
1692 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
1695 if test -n "$MOZ_INSTRUMENTS"; then
1697 AC_DEFINE(MOZ_INSTRUMENTS)
1700 dnl ========================================================
1702 dnl ========================================================
1703 MOZ_ARG_ENABLE_BOOL(callgrind,
1704 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1707 if test -n "$MOZ_CALLGRIND"; then
1709 AC_DEFINE(MOZ_CALLGRIND)
1712 dnl ========================================================
1714 dnl ========================================================
1715 MOZ_ARG_ENABLE_BOOL(vtune,
1716 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1719 if test -n "$MOZ_VTUNE"; then
1721 AC_DEFINE(MOZ_VTUNE)
1724 dnl ========================================================
1726 dnl ========================================================
1727 if test -n "$MOZ_PROFILING"; then
1728 AC_DEFINE(MOZ_PROFILING)
1731 dnl ========================================================
1732 dnl System overrides of the defaults for host
1733 dnl ========================================================
1736 if test -n "$_WIN32_MSVC"; then
1738 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1739 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1740 HOST_RANLIB='echo ranlib'
1742 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1744 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1745 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1746 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1747 HOST_BIN_SUFFIX=.exe
1750 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1754 case "${host_cpu}" in
1756 if test -n "$_WIN32_MSVC"; then
1757 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1761 if test -n "$_WIN32_MSVC"; then
1762 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1764 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1770 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1771 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1772 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1775 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1776 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1777 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1778 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1782 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1783 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1784 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1785 HOST_BIN_SUFFIX=.exe
1790 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1791 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1795 dnl Check for using a custom <stdint.h> implementation
1796 dnl ========================================================
1797 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1798 if test "$MOZ_CUSTOM_STDINT_H"; then
1799 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1800 AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1802 AC_MSG_RESULT(none specified)
1805 dnl Get mozilla version from central milestone file
1806 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1807 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1809 dnl Get version of various core apps from the version files.
1810 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1812 if test -z "$FIREFOX_VERSION"; then
1813 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1816 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1817 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1818 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1820 MOZ_DOING_LTO(lto_is_enabled)
1822 dnl ========================================================
1823 dnl System overrides of the defaults for target
1824 dnl ========================================================
1829 if test ! "$GNU_CC"; then
1830 if test ! "$HAVE_64BIT_OS"; then
1831 # Compiling with Visual Age C++ object model compat is the
1832 # default. To compile with object model ibm, add
1833 # AIX_OBJMODEL=ibm to .mozconfig.
1834 if test "$AIX_OBJMODEL" = "ibm"; then
1835 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1842 AC_SUBST(AIX_OBJMODEL)
1843 DSO_LDOPTS='-qmkshrobj=1'
1844 DSO_CFLAGS='-qflag=w:w'
1846 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1848 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1849 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1850 if test "$COMPILE_ENVIRONMENT"; then
1853 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1855 [#if (__IBMCPP__ < 900)
1856 #error "Bad compiler"
1858 _BAD_COMPILER=,_BAD_COMPILER=1)
1859 if test -n "$_BAD_COMPILER"; then
1861 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1863 AC_MSG_RESULT([yes])
1866 TARGET_COMPILER_ABI="ibmc"
1867 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1868 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1871 case "${target_os}" in
1876 if test "$COMPILE_ENVIRONMENT"; then
1877 MOZ_CHECK_HEADERS(sys/inttypes.h)
1879 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1883 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1884 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1885 MOZ_OPTIMIZE_FLAGS="-O3"
1886 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1887 if test "$HAVE_64BIT_OS"; then
1892 STRIP_FLAGS="$STRIP_FLAGS -x -S"
1893 # Check whether we're targeting OS X or iOS
1894 AC_CACHE_CHECK(for iOS target,
1896 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1897 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1901 ac_cv_ios_target="yes",
1902 ac_cv_ios_target="no")])
1903 if test "$ac_cv_ios_target" = "yes"; then
1905 AC_DEFINE(XP_DARWIN)
1906 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1908 AC_DEFINE(XP_MACOSX)
1909 AC_DEFINE(XP_DARWIN)
1910 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1911 # The ExceptionHandling framework is needed for Objective-C exception
1912 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1914 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1916 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1919 if test "x$lto_is_enabled" = "xyes"; then
1920 echo "Skipping -dead_strip because lto is enabled."
1921 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1922 dnl ===================================================================
1923 elif test "x$enable_dtrace" = "xyes"; then
1924 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1926 dnl check for the presence of the -dead_strip linker flag
1927 AC_MSG_CHECKING([for -dead_strip option to ld])
1928 _SAVE_LDFLAGS=$LDFLAGS
1929 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1930 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1931 if test -n "$_HAVE_DEAD_STRIP" ; then
1932 AC_MSG_RESULT([yes])
1933 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1938 LDFLAGS=$_SAVE_LDFLAGS
1941 dnl With newer linkers we need to pass -allow_heap_execute because of
1942 dnl Microsoft Silverlight (5.1.10411.0 at least).
1943 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1944 _SAVE_LDFLAGS=$LDFLAGS
1945 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1946 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1947 _HAVE_ALLOW_HEAP_EXECUTE=)
1948 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1949 AC_MSG_RESULT([yes])
1950 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1954 LDFLAGS=$_SAVE_LDFLAGS
1956 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1961 if test ! "$GNU_CC"; then
1965 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1966 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1967 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1970 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1971 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1974 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1975 AC_DEFINE(_LARGEFILE64_SOURCE)
1980 if test ! "$GNU_CC"; then
1981 DSO_LDOPTS='-b -Wl,+s'
1984 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1985 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1986 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1988 DSO_LDOPTS='-b -E +s'
1989 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1990 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1992 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1993 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1996 *-android*|*-linuxandroid*)
1997 AC_DEFINE(NO_PW_GECOS)
1999 if test -n "$gonkdir"; then
2000 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2004 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2007 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2009 MOZ_GFX_OPTIMIZE_MOBILE=1
2010 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2014 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2015 # Similarly for GNU_CXX and INTEL_CXX.
2016 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2017 # -Os has been broken on Intel's C/C++ compilers for quite a
2018 # while; Intel recommends against using it.
2019 MOZ_OPTIMIZE_FLAGS="-O2"
2020 elif test "$GNU_CC" -o "$GNU_CXX"; then
2021 case $GCC_VERSION in
2023 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
2024 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2026 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2027 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2030 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2034 case "${target_cpu}" in
2036 CFLAGS="$CFLAGS -mieee"
2037 CXXFLAGS="$CXXFLAGS -mieee"
2044 if test -z "$MC"; then
2054 # certain versions of cygwin's makedepend barf on the
2055 # #include <string> vs -I./dist/include/string issue so don't use it
2056 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
2058 CXX="$CXX -mwindows"
2059 CPP="$CPP -mwindows"
2060 CFLAGS="$CFLAGS -mms-bitfields"
2061 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2062 DSO_LDOPTS='-shared'
2063 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2064 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2066 # Use static libgcc and libstdc++
2067 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
2068 NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
2069 # Use temp file for windres (bug 213281)
2070 RCFLAGS='-O coff --use-temp-file'
2071 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2072 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2074 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxul -lxpcom_core -lmozalloc'
2075 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxul -lmozalloc'
2077 IMPORT_LIB_SUFFIX=dll.a
2079 # We use mix of both POSIX and Win32 printf format across the tree, so format
2080 # warnings are useless on mingw.
2081 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2082 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2084 TARGET_COMPILER_ABI=msvc
2088 if test "$AS_BIN"; then
2089 AS="$(basename "$AS_BIN")"
2092 AR_FLAGS='-NOLOGO -OUT:"$@"'
2094 RANLIB='echo not_ranlib'
2095 STRIP='echo not_strip'
2106 IMPORT_LIB_SUFFIX=lib
2107 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2108 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2110 MKSHLIB_UNFORCE_ALL=
2111 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2112 _USE_CPP_INCLUDE_FLAG=1
2113 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2114 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2115 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2116 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2117 # khuey says we can safely ignore MSVC warning C4251
2118 # MSVC warning C4244 (implicit type conversion may lose data) warns
2119 # and requires workarounds for perfectly valid code. Also, GCC/clang
2120 # don't warn about it by default. So for consistency/sanity, we turn
2121 # it off on MSVC, too.
2122 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2123 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2124 # MSVC warning C4482 warns when an enum value is refered specifing the
2125 # name of the enum itself. This behavior is allowed in C++11, and the
2126 # warning has been removed in VS2012.
2127 # MSVC warning C4800 warns when a value is implicitly cast to bool,
2128 # because this also forces narrowing to a single byte, which can be a
2129 # perf hit. But this matters so little in practice (and often we want
2130 # that behavior) that it's better to turn it off.
2131 # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2132 # on non-Western system locales even if it is in a comment.
2133 CFLAGS="$CFLAGS -wd4244 -wd4819"
2134 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2135 # make 'foo == bar;' error out
2136 CFLAGS="$CFLAGS -we4553"
2137 CXXFLAGS="$CXXFLAGS -we4553"
2138 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2139 MOZ_DEBUG_FLAGS='-Zi'
2140 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2141 WARNINGS_AS_ERRORS='-WX'
2142 MOZ_OPTIMIZE_FLAGS='-O1'
2144 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2145 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2146 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2147 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2148 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT -RELEASE"
2149 dnl For profile-guided optimization
2150 PROFILE_GEN_CFLAGS="-GL"
2151 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2152 dnl XXX: PGO builds can fail with warnings treated as errors,
2153 dnl specifically "no profile data available" appears to be
2154 dnl treated as an error sometimes. This might be a consequence
2155 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2156 dnl with the linker doing most of the work in the whole-program
2157 dnl optimization/PGO case. I think it's probably a compiler bug,
2158 dnl but we work around it here.
2159 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2160 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2161 dnl Probably also a compiler bug, but what can you do?
2162 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2163 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2164 if test "$_MSC_VER" -ge 1500; then
2165 dnl VS2008 or later supports SSSE3
2166 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2167 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
2170 AC_DEFINE(HAVE_SNPRINTF)
2175 AC_DEFINE(HW_THREADS)
2176 AC_DEFINE(STDC_HEADERS)
2177 AC_DEFINE(NEW_H, <new>)
2178 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2179 TARGET_MD_ARCH=win32
2180 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2182 MOZ_USER_DIR="Mozilla"
2184 dnl Hardcode to win95 for now - cls
2185 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2187 dnl set NO_X11 defines here as the general check is skipped on win32
2193 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2194 if test -n "$L10NBASEDIR"; then
2195 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2202 if test -z "$MOZ_TOOLS"; then
2203 AC_MSG_ERROR([MOZ_TOOLS is not set])
2205 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2206 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2207 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2209 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2210 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2211 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2218 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.])
2224 if test "$HAVE_64BIT_OS"; then
2225 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2228 if test -n "$GNU_CC"; then
2229 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2230 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2231 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2233 AC_DEFINE(HAVE_STDCALL)
2234 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2235 LDFLAGS="$LDFLAGS -SAFESEH"
2241 if test -n "$_WIN32_MSVC"; then
2242 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2247 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2254 CFLAGS="$CFLAGS -Dunix"
2255 CXXFLAGS="$CXXFLAGS -Dunix"
2256 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2258 DSO_PIC_CFLAGS='-fPIC -DPIC'
2259 DSO_LDOPTS='-shared'
2260 BIN_FLAGS='-Wl,--export-dynamic'
2262 DSO_PIC_CFLAGS='-fPIC -DPIC'
2263 DLL_SUFFIX=".so.1.0"
2264 DSO_LDOPTS='-shared'
2266 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2267 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2268 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2269 if test "$LIBRUNPATH"; then
2270 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2272 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
2273 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@)) -o $@'
2277 if test "$SO_VERSION"; then
2278 DLL_SUFFIX=".so.$SO_VERSION"
2280 DLL_SUFFIX=".so.1.0"
2282 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2284 DSO_PIC_CFLAGS='-fPIC'
2285 DSO_LDOPTS='-shared -fPIC'
2286 if test "$LIBRUNPATH"; then
2287 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2292 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2293 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2296 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2297 AC_DEFINE(TCPV40HDRS)
2303 IMPORT_LIB_SUFFIX=lib
2307 CFLAGS="$CFLAGS -Zomf"
2308 CXXFLAGS="$CXXFLAGS -Zomf"
2310 BIN_FLAGS='-Zlinker /ST:0x100000'
2314 WARNINGS_AS_ERRORS='-Werror'
2315 MOZ_DEBUG_FLAGS="-g -fno-inline"
2316 MOZ_OPTIMIZE_FLAGS="-O2"
2317 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2318 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2319 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2321 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2325 MOZ_USER_DIR="Mozilla"
2328 STRIP_FLAGS="/yua /ydd /yxd /ynl /anp /b- /cs+ /d /i- /ml1 /mr2 /mf2 /r+ /u+ /x- /zs:0 /zx /zd"
2330 if test "$MOZTOOLS"; then
2331 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2333 AC_MSG_ERROR([MOZTOOLS is not set])
2335 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2336 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2337 LDFLAGS="$LDFLAGS -Zhigh-mem"
2338 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2339 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2342 # GCC for OS/2 currently predefines these, but we don't want them
2343 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2344 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2346 AC_CACHE_CHECK(for __declspec(dllexport),
2348 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2350 ac_os2_declspec="yes",
2351 ac_os2_declspec="no")])
2352 if test "$ac_os2_declspec" != "yes"; then
2353 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2359 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2361 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2362 # libraries one level up (e.g. libnspr4.so)
2363 if test "$SOLARIS_SUNPRO_CC"; then
2364 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2365 LIBS="-lCrun -lCstd -lc $LIBS"
2366 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2367 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2368 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2369 LDFLAGS="-xildoff $LDFLAGS"
2370 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2371 _SAVE_LDFLAGS=$LDFLAGS
2372 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2373 AC_TRY_LINK([#include <stdio.h>],
2374 [printf("Hello World\n");],
2376 [LDFLAGS=$_SAVE_LDFLAGS])
2378 MOZ_OPTIMIZE_FLAGS="-xO4"
2379 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2380 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2381 MKSHLIB_FORCE_ALL='-z allextract'
2382 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2389 AS='/usr/ccs/bin/as'
2390 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2392 TARGET_COMPILER_ABI="sunc"
2393 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2394 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2395 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2399 [#if (__SUNPRO_CC < 0x590)
2402 _BAD_COMPILER=,_BAD_COMPILER=1)
2403 if test -n "$_BAD_COMPILER"; then
2405 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2410 [#if (__SUNPRO_CC >= 0x5100)
2411 #error "Sun C++ 5.10 or above"
2413 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2414 if test "$_ABOVE_SS12U1"; then
2416 CXXFLAGS="$CXXFLAGS -xannotate=no"
2418 AC_MSG_RESULT([$_res])
2421 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2423 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2424 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2425 ASFLAGS="$ASFLAGS -fPIC"
2426 DSO_LDOPTS='-shared'
2427 WARNINGS_AS_ERRORS='-Werror'
2429 _WARNINGS_CXXFLAGS=''
2430 if test "$OS_RELEASE" = "5.3"; then
2431 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2434 if test "$OS_RELEASE" = "5.5.1"; then
2435 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2440 DSO_LDOPTS='-Bdynamic'
2441 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2442 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2444 AC_DEFINE(SPRINTF_RETURNS_STRING)
2445 case "$(target_os)" in
2447 DLL_SUFFIX='.so.1.0'
2453 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2458 AC_SUBST(MOZ_LINKER)
2459 if test -n "$MOZ_LINKER"; then
2460 AC_DEFINE(MOZ_LINKER)
2463 dnl Only one oddball right now (QNX), but this gives us flexibility
2464 dnl if any other platforms need to override this in the future.
2465 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2467 dnl ========================================================
2468 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2469 dnl by now will not have any way to link most binaries (tests
2470 dnl as well as viewer, apprunner, etc.), because some symbols
2471 dnl will be left out of the "composite" .so's by ld as unneeded.
2472 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2473 dnl they can link in the static libs that provide the missing
2475 dnl ========================================================
2476 NO_LD_ARCHIVE_FLAGS=
2477 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2478 NO_LD_ARCHIVE_FLAGS=1
2482 NO_LD_ARCHIVE_FLAGS=
2485 NO_LD_ARCHIVE_FLAGS=
2488 if test -z "$GNU_CC"; then
2489 NO_LD_ARCHIVE_FLAGS=
2493 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2495 dnl ========================================================
2496 dnl = Flags to strip unused symbols from .so components and
2497 dnl = to export jemalloc symbols when linking a program
2498 dnl ========================================================
2500 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2501 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2504 if test -z "$GNU_CC"; then
2505 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2507 if test -z "$GCC_USE_GNU_LD"; then
2508 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2510 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2515 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2518 if test -n "$GNU_CC"; then
2519 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2524 if test -z "$COMPILE_ENVIRONMENT"; then
2525 SKIP_COMPILER_CHECKS=1
2526 SKIP_LIBRARY_CHECKS=1
2529 dnl ========================================================
2531 dnl = Debugging Options
2533 dnl = These must come before MOZ_COMPILER_OPTS so that MOZ_COMPILER_OPTS
2534 dnl = sees any debug flags set by the user.
2536 dnl ========================================================
2537 MOZ_ARG_HEADER(Debugging)
2539 dnl ========================================================
2540 dnl = Debug info is ON by default.
2541 dnl ========================================================
2542 if test -z "$MOZ_DEBUG_FLAGS"; then
2543 MOZ_DEBUG_FLAGS="-g"
2546 MOZ_ARG_ENABLE_STRING(debug,
2547 [ --enable-debug[=DBG] Enable building with developer debug info
2548 (using compiler flags DBG)],
2549 [ if test "$enableval" != "no"; then
2551 if test -n "$enableval" -a "$enableval" != "yes"; then
2552 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
2553 _MOZ_DEBUG_FLAGS_SET=1
2560 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
2561 MOZ_ARG_WITH_STRING(debug-label,
2562 [ --with-debug-label=LABELS
2563 Define DEBUG_<value> for each comma-separated
2565 [ for option in `echo $withval | sed 's/,/ /g'`; do
2566 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
2569 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
2571 if test -n "$MOZ_DEBUG"; then
2572 AC_MSG_CHECKING([for valid debug flags])
2573 _SAVE_CFLAGS=$CFLAGS
2574 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
2575 AC_TRY_COMPILE([#include <stdio.h>],
2576 [printf("Hello World\n");],
2579 AC_MSG_RESULT([$_results])
2580 if test "$_results" = "no"; then
2581 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
2583 CFLAGS=$_SAVE_CFLAGS
2586 dnl ========================================================
2587 dnl = Enable generation of debug symbols
2588 dnl ========================================================
2589 MOZ_ARG_ENABLE_STRING(debug-symbols,
2590 [ --enable-debug-symbols[=DBG]
2591 Enable debugging symbols (using compiler flags DBG)],
2592 [ if test "$enableval" != "no"; then
2594 if test -n "$enableval" -a "$enableval" != "yes"; then
2595 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
2596 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
2598 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
2604 MOZ_DEBUG_SYMBOLS=1)
2606 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
2607 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
2608 export MOZ_DEBUG_SYMBOLS
2612 if test -z "$SKIP_COMPILER_CHECKS"; then
2613 dnl Checks for typedefs, structures, and compiler characteristics.
2614 dnl ========================================================
2622 AC_MSG_CHECKING(for __stdcall)
2623 AC_CACHE_VAL(ac_cv___stdcall,
2624 [AC_TRY_COMPILE([template <typename Method> struct foo;
2625 template <> struct foo<void (*)()> {};
2626 template <> struct foo<void (__stdcall*)()> {};],
2628 [ac_cv___stdcall=true],
2629 [ac_cv___stdcall=false])])
2630 if test "$ac_cv___stdcall" = true ; then
2631 AC_DEFINE(HAVE_STDCALL)
2637 AC_MSG_CHECKING(for ssize_t)
2638 AC_CACHE_VAL(ac_cv_type_ssize_t,
2639 [AC_TRY_COMPILE([#include <stdio.h>
2640 #include <sys/types.h>],
2642 [ac_cv_type_ssize_t=true],
2643 [ac_cv_type_ssize_t=false])])
2644 if test "$ac_cv_type_ssize_t" = true ; then
2645 AC_DEFINE(HAVE_SSIZE_T)
2650 AC_STRUCT_ST_BLKSIZE
2651 AC_MSG_CHECKING(for siginfo_t)
2652 AC_CACHE_VAL(ac_cv_siginfo_t,
2653 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2654 #include <signal.h>],
2656 [ac_cv_siginfo_t=true],
2657 [ac_cv_siginfo_t=false])])
2658 if test "$ac_cv_siginfo_t" = true ; then
2659 AC_DEFINE(HAVE_SIGINFO_T)
2665 dnl Check for int64, uint, and uint_t.
2666 dnl ========================================================
2667 AC_MSG_CHECKING(for int64)
2668 AC_CACHE_VAL(ac_cv_int64,
2669 [AC_TRY_COMPILE([#include <stdio.h>
2670 #include <sys/types.h>],
2673 [ac_cv_int64=false])])
2674 if test "$ac_cv_int64" = true ; then
2675 AC_DEFINE(HAVE_INT64)
2680 AC_MSG_CHECKING(for uint)
2681 AC_CACHE_VAL(ac_cv_uint,
2682 [AC_TRY_COMPILE([#include <stdio.h>
2683 #include <sys/types.h>],
2686 [ac_cv_uint=false])])
2687 if test "$ac_cv_uint" = true ; then
2688 AC_DEFINE(HAVE_UINT)
2693 AC_MSG_CHECKING(for uint_t)
2694 AC_CACHE_VAL(ac_cv_uint_t,
2695 [AC_TRY_COMPILE([#include <stdio.h>
2696 #include <sys/types.h>],
2698 [ac_cv_uint_t=true],
2699 [ac_cv_uint_t=false])])
2700 if test "$ac_cv_uint_t" = true ; then
2701 AC_DEFINE(HAVE_UINT_T)
2707 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2708 dnl are defined when compiling C++ but not C. Since the result of this
2709 dnl test is used only in C++, do it in C++.
2712 AC_MSG_CHECKING(for uname.domainname)
2713 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2714 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2715 [ struct utsname *res; char *domain;
2716 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2717 [ac_cv_have_uname_domainname_field=true],
2718 [ac_cv_have_uname_domainname_field=false])])
2720 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2721 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2727 AC_MSG_CHECKING(for uname.__domainname)
2728 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2729 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2730 [ struct utsname *res; char *domain;
2731 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2732 [ac_cv_have_uname_us_domainname_field=true],
2733 [ac_cv_have_uname_us_domainname_field=false])])
2735 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2736 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2742 dnl Check whether we can use gcc's c++0x mode
2745 if test "$GNU_CXX"; then
2746 _SAVE_CXXFLAGS=$CXXFLAGS
2747 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2749 AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2750 ac_cv_cxx0x_headers_bug,
2751 [AC_TRY_COMPILE([#include <memory>], [],
2752 ac_cv_cxx0x_headers_bug="no",
2753 ac_cv_cxx0x_headers_bug="yes")])
2755 if test "$CLANG_CXX" -a "$ac_cv_cxx0x_headers_bug" = "yes"; then
2756 CXXFLAGS="$CXXFLAGS -I$_topsrcdir/build/unix/headers"
2757 AC_CACHE_CHECK(whether workaround for gcc c++0x headers conflict with clang works,
2758 ac_cv_cxx0x_clang_workaround,
2759 [AC_TRY_COMPILE([#include <memory>], [],
2760 ac_cv_cxx0x_clang_workaround="yes",
2761 ac_cv_cxx0x_clang_workaround="no")])
2763 if test "ac_cv_cxx0x_clang_workaround" = "no"; then
2764 CXXFLAGS="$_SAVE_CXXFLAGS"
2766 elif test "$ac_cv_cxx0x_headers_bug" = "yes"; then
2767 CXXFLAGS="$_SAVE_CXXFLAGS"
2771 dnl Check for usable char16_t (2 bytes, unsigned)
2772 dnl (we might not need the unsignedness check anymore)
2773 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2774 ac_cv_have_usable_char16_t,
2775 [AC_TRY_COMPILE([$configure_static_assert_macros],
2776 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2777 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2778 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2779 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2780 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2781 ac_cv_have_usable_char16_t="yes",
2782 ac_cv_have_usable_char16_t="no")])
2783 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2784 AC_DEFINE(HAVE_CPP_CHAR16_T)
2786 elif test "$GNU_CXX"; then
2787 CXXFLAGS="$_SAVE_CXXFLAGS"
2790 dnl Check for usable wchar_t (2 bytes, unsigned)
2791 dnl (we really don't need the unsignedness check anymore)
2792 dnl ========================================================
2794 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2795 ac_cv_have_usable_wchar_v2,
2796 [AC_TRY_COMPILE([#include <stddef.h>
2797 $configure_static_assert_macros],
2798 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2799 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2800 ac_cv_have_usable_wchar_v2="yes",
2801 ac_cv_have_usable_wchar_v2="no")])
2802 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2803 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2804 HAVE_CPP_2BYTE_WCHAR_T=1
2805 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2806 dnl This is really gcc-only
2807 dnl Do this test using CXX only since some versions of gcc
2808 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2809 dnl only have short-wchar support for c++.
2810 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2812 _SAVE_CXXFLAGS=$CXXFLAGS
2813 CXXFLAGS="$CXXFLAGS -fshort-wchar"
2815 AC_CACHE_CHECK(for compiler -fshort-wchar option,
2816 ac_cv_have_usable_wchar_option_v2,
2817 [AC_TRY_LINK([#include <stddef.h>
2818 $configure_static_assert_macros],
2819 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2820 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2821 ac_cv_have_usable_wchar_option_v2="yes",
2822 ac_cv_have_usable_wchar_option_v2="no")])
2824 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2825 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2826 HAVE_CPP_2BYTE_WCHAR_T=1
2827 if test "$OS_TARGET" = Android; then
2828 WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
2829 CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
2830 CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
2831 DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
2833 WCHAR_CFLAGS="-fshort-wchar"
2836 CXXFLAGS=$_SAVE_CXXFLAGS
2842 dnl Check for .hidden assembler directive and visibility attribute.
2843 dnl Borrowed from glibc configure.in
2844 dnl ===============================================================
2845 if test "$GNU_CC"; then
2846 AC_CACHE_CHECK(for visibility(hidden) attribute,
2847 ac_cv_visibility_hidden,
2848 [cat > conftest.c <<EOF
2849 int foo __attribute__ ((visibility ("hidden"))) = 1;
2851 ac_cv_visibility_hidden=no
2852 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2853 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2854 ac_cv_visibility_hidden=yes
2859 if test "$ac_cv_visibility_hidden" = "yes"; then
2860 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2862 AC_CACHE_CHECK(for visibility(default) attribute,
2863 ac_cv_visibility_default,
2864 [cat > conftest.c <<EOF
2865 int foo __attribute__ ((visibility ("default"))) = 1;
2867 ac_cv_visibility_default=no
2868 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2869 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2870 ac_cv_visibility_default=yes
2875 if test "$ac_cv_visibility_default" = "yes"; then
2876 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2878 AC_CACHE_CHECK(for visibility pragma support,
2879 ac_cv_visibility_pragma,
2880 [cat > conftest.c <<EOF
2881 #pragma GCC visibility push(hidden)
2883 #pragma GCC visibility push(default)
2884 int foo_default = 1;
2886 ac_cv_visibility_pragma=no
2887 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2888 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2889 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2890 ac_cv_visibility_pragma=yes
2896 if test "$ac_cv_visibility_pragma" = "yes"; then
2897 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2898 ac_cv_have_visibility_class_bug,
2899 [cat > conftest.c <<EOF
2900 #pragma GCC visibility push(hidden)
2901 struct __attribute__ ((visibility ("default"))) TestStruct {
2904 __attribute__ ((visibility ("default"))) void TestFunc() {
2908 ac_cv_have_visibility_class_bug=no
2909 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2910 ac_cv_have_visibility_class_bug=yes
2912 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2913 ac_cv_have_visibility_class_bug=yes
2916 rm -rf conftest.{c,S}
2919 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2920 ac_cv_have_visibility_builtin_bug,
2921 [cat > conftest.c <<EOF
2922 #pragma GCC visibility push(hidden)
2923 #pragma GCC visibility push(default)
2925 #pragma GCC visibility pop
2927 __attribute__ ((visibility ("default"))) void Func() {
2929 memset(c, 0, sizeof(c));
2932 ac_cv_have_visibility_builtin_bug=no
2933 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2934 ac_cv_have_visibility_builtin_bug=yes
2936 if test `grep -c "@PLT" conftest.S` = 0; then
2937 ac_cv_visibility_builtin_bug=yes
2940 rm -f conftest.{c,S}
2942 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2943 "$ac_cv_have_visibility_class_bug" = "no"; then
2944 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2945 WRAP_SYSTEM_INCLUDES=1
2946 STL_FLAGS='-I$(DIST)/stl_wrappers'
2949 VISIBILITY_FLAGS='-fvisibility=hidden'
2950 fi # have visibility pragma bug
2951 fi # have visibility pragma
2952 fi # have visibility(default) attribute
2953 fi # have visibility(hidden) attribute
2956 # visibility hidden flag for Sun Studio on Solaris
2957 if test "$SOLARIS_SUNPRO_CC"; then
2958 VISIBILITY_FLAGS='-xldscope=hidden'
2959 fi # Sun Studio on Solaris
2961 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2962 AC_SUBST(VISIBILITY_FLAGS)
2966 if test "$OS_TARGET" != WINNT; then
2967 # Only run this test with clang on non-Windows platforms, because clang
2968 # cannot do enough code gen for now to make this test work correctly.
2972 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2973 dnl ========================================================
2974 if test "$GNU_CC"; then
2975 CFLAGS_save="${CFLAGS}"
2976 CFLAGS="${CFLAGS} -Werror"
2977 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2978 ac_cv_force_align_arg_pointer,
2979 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2981 ac_cv_force_align_arg_pointer="yes",
2982 ac_cv_force_align_arg_pointer="no")])
2983 CFLAGS="${CFLAGS_save}"
2984 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2985 HAVE_GCC_ALIGN_ARG_POINTER=1
2987 HAVE_GCC_ALIGN_ARG_POINTER=
2990 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2992 dnl Checks for header files.
2993 dnl ========================================================
2995 case "$target_os" in
2997 # for stuff like -lXshm
2998 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3001 MOZ_CHECK_COMMON_HEADERS
3003 dnl These are all the places some variant of statfs can be hiding.
3004 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3007 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
3008 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
3010 dnl SCTP support - needs various network include headers
3011 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
3013 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
3015 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
3016 AC_CACHE_CHECK(for sockaddr_in.sin_len,
3017 ac_cv_sockaddr_in_sin_len,
3018 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
3019 #include <sys/types.h>
3021 #include <netinet/in.h>
3022 struct sockaddr_in x;
3023 void *foo = (void*) &x.sin_len;],
3025 [ac_cv_sockaddr_in_sin_len=true],
3026 [ac_cv_sockaddr_in_sin_len=false])])
3027 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
3028 AC_DEFINE(HAVE_SIN_LEN)
3029 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
3030 AC_DEFINE(HAVE_SCONN_LEN)
3033 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
3034 ac_cv_sockaddr_in6_sin6_len,
3035 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
3036 #include <sys/types.h>
3038 #include <netinet/in.h>
3039 struct sockaddr_in6 x;
3040 void *foo = (void*) &x.sin6_len;],
3042 [ac_cv_sockaddr_in6_sin6_len=true],
3043 [ac_cv_sockaddr_in6_sin6_len=false])])
3044 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
3045 AC_DEFINE(HAVE_SIN6_LEN)
3048 AC_CACHE_CHECK(for sockaddr.sa_len,
3049 ac_cv_sockaddr_sa_len,
3050 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
3051 #include <sys/types.h>
3053 #include <sys/socket.h>
3055 void *foo = (void*) &x.sa_len;],
3057 [ac_cv_sockaddr_sa_len=true],
3058 [ac_cv_sockaddr_sa_len=false])])
3059 if test "$ac_cv_sockaddr_sa_len" = true ; then
3060 AC_DEFINE(HAVE_SA_LEN)
3063 dnl Check whether the compiler supports the new-style C++ standard
3064 dnl library headers (i.e. <new>) or needs the old "new.h"
3067 MOZ_CHECK_HEADER(new, [NEW_H=new])
3068 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3071 AC_ARG_ENABLE(dtrace,
3072 [ --enable-dtrace build with dtrace support if available (default=no)],
3073 [enable_dtrace="yes"],)
3074 if test "x$enable_dtrace" = "xyes"; then
3075 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3076 if test -n "$HAVE_DTRACE"; then
3077 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3079 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3082 AC_SUBST(HAVE_DTRACE)
3088 MOZ_CHECK_HEADERS(sys/cdefs.h)
3092 MOZ_LINUX_PERF_EVENT
3094 dnl Checks for libraries.
3095 dnl ========================================================
3100 AC_CHECK_LIB(c_r, gethostbyname_r)
3104 dnl We don't want to link with libdl even if it's present on OS X, since
3105 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3107 dnl We don't want to link against libm or libpthread on Darwin since
3108 dnl they both are just symlinks to libSystem and explicitly linking
3109 dnl against libSystem causes issues when debugging (see bug 299601).
3116 AC_SEARCH_LIBS(dlopen, dl,
3117 MOZ_CHECK_HEADER(dlfcn.h,
3118 AC_DEFINE(HAVE_DLOPEN)))
3122 _SAVE_CFLAGS="$CFLAGS"
3123 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3124 AC_CHECK_FUNCS(dladdr memmem)
3125 CFLAGS="$_SAVE_CFLAGS"
3127 if test ! "$GNU_CXX"; then
3131 AC_CHECK_LIB(C_r, demangle)
3134 AC_CHECK_LIB(C, demangle)
3139 dnl OS/2 has socket in libc.
3144 AC_CHECK_LIB(socket, socket)
3148 XLIBS="$X_EXTRA_LIBS"
3150 dnl ========================================================
3151 dnl Checks for X libraries.
3152 dnl Ordering is important.
3153 dnl Xt is dependent upon SM as of X11R6
3154 dnl ========================================================
3155 if test "$no_x" = "yes"; then
3158 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3159 XLIBS="-lX11 $XLIBS"
3160 _SAVE_LDFLAGS="$LDFLAGS"
3161 LDFLAGS="$XLDFLAGS $LDFLAGS"
3162 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3163 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3164 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3165 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3167 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3168 unset ac_cv_lib_Xt_XtFree
3169 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3170 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3171 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3172 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3175 # AIX needs the motif library linked before libXt to prevent
3176 # crashes in plugins linked against Motif - Bug #98892
3177 case "${target_os}" in
3179 XT_LIBS="-lXm $XT_LIBS"
3183 dnl ========================================================
3184 dnl = Check for XShm
3185 dnl ========================================================
3186 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3189 dnl ========================================================
3191 dnl ========================================================
3192 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3193 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3194 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3195 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3197 LDFLAGS="$_SAVE_LDFLAGS"
3207 dnl ========================================================
3208 dnl = pthread support
3209 dnl = Start by checking whether the system support pthreads
3210 dnl ========================================================
3211 case "$target_os" in
3216 MOZ_CHECK_PTHREADS(pthreads,
3217 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3218 MOZ_CHECK_PTHREADS(pthread,
3219 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3220 MOZ_CHECK_PTHREADS(c_r,
3221 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3222 MOZ_CHECK_PTHREADS(c,
3231 dnl ========================================================
3232 dnl Check the command line for --with-pthreads
3233 dnl ========================================================
3234 MOZ_ARG_WITH_BOOL(pthreads,
3235 [ --with-pthreads Force use of system pthread library with NSPR ],
3236 [ if test "$MOZ_USE_PTHREADS"x = x; then
3237 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3243 dnl ========================================================
3244 dnl Do the platform specific pthread hackery
3245 dnl ========================================================
3246 if test "$MOZ_USE_PTHREADS"x != x
3249 dnl See if -pthread is supported.
3252 ac_cv_have_dash_pthread=no
3253 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3254 echo 'int main() { return 0; }' | cat > conftest.c
3255 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3256 if test $? -eq 0; then
3257 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3258 ac_cv_have_dash_pthread=yes
3259 case "$target_os" in
3261 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3264 CFLAGS="$CFLAGS -pthread"
3265 CXXFLAGS="$CXXFLAGS -pthread"
3271 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3274 dnl See if -pthreads is supported.
3276 ac_cv_have_dash_pthreads=no
3277 if test "$ac_cv_have_dash_pthread" = "no"; then
3278 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3279 echo 'int main() { return 0; }' | cat > conftest.c
3280 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3281 if test $? -eq 0; then
3282 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3283 ac_cv_have_dash_pthreads=yes
3284 CFLAGS="$CFLAGS -pthreads"
3285 CXXFLAGS="$CXXFLAGS -pthreads"
3289 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3294 AC_DEFINE(_REENTRANT)
3295 AC_DEFINE(_THREAD_SAFE)
3296 dnl -pthread links in -lpthread, so don't specify it explicitly.
3297 if test "$ac_cv_have_dash_pthread" = "yes"; then
3298 _PTHREAD_LDFLAGS="-pthread"
3302 *-*-openbsd*|*-*-bsdi*)
3303 AC_DEFINE(_REENTRANT)
3304 AC_DEFINE(_THREAD_SAFE)
3305 dnl -pthread links in -lc_r, so don't specify it explicitly.
3306 if test "$ac_cv_have_dash_pthread" = "yes"; then
3307 _PTHREAD_LDFLAGS="-pthread"
3311 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3312 AC_DEFINE(_REENTRANT)
3316 AC_DEFINE(_REENTRANT)
3320 AC_DEFINE(_REENTRANT)
3324 AC_DEFINE(_REENTRANT)
3325 if test "$SOLARIS_SUNPRO_CC"; then
3326 CFLAGS="$CFLAGS -mt"
3327 CXXFLAGS="$CXXFLAGS -mt"
3331 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3332 AC_SUBST(MOZ_USE_PTHREADS)
3336 dnl Checks for library functions.
3337 dnl ========================================================
3338 AC_PROG_GCC_TRADITIONAL
3340 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf memmove rint stat64 lstat64 truncate64 setbuf isatty)
3341 AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
3342 AC_CHECK_FUNCS(flockfile getpagesize)
3343 AC_CHECK_FUNCS(localtime_r strtok_r)
3345 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3346 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3347 ac_cv_clock_monotonic,
3348 [for libs in "" -lrt; do
3351 AC_TRY_LINK([#include <time.h>],
3352 [ struct timespec ts;
3353 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3354 ac_cv_clock_monotonic=$libs
3357 ac_cv_clock_monotonic=no)
3360 if test "$ac_cv_clock_monotonic" != "no"; then
3361 HAVE_CLOCK_MONOTONIC=1
3362 REALTIME_LIBS=$ac_cv_clock_monotonic
3363 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3364 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3365 AC_SUBST(REALTIME_LIBS)
3368 dnl check for wcrtomb/mbrtowc
3369 dnl =======================================================================
3370 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3373 AC_CACHE_CHECK(for wcrtomb,
3375 [AC_TRY_LINK([#include <wchar.h>],
3376 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3377 ac_cv_have_wcrtomb="yes",
3378 ac_cv_have_wcrtomb="no")])
3379 if test "$ac_cv_have_wcrtomb" = "yes"; then
3380 AC_DEFINE(HAVE_WCRTOMB)
3382 AC_CACHE_CHECK(for mbrtowc,
3384 [AC_TRY_LINK([#include <wchar.h>],
3385 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3386 ac_cv_have_mbrtowc="yes",
3387 ac_cv_have_mbrtowc="no")])
3388 if test "$ac_cv_have_mbrtowc" = "yes"; then
3389 AC_DEFINE(HAVE_MBRTOWC)
3396 ac_cv_func_res_ninit,
3399 #define _BSD_SOURCE 1
3403 [int foo = res_ninit(&_res);],
3404 [ac_cv_func_res_ninit=yes],
3405 [ac_cv_func_res_ninit=no])
3408 if test "$ac_cv_func_res_ninit" = "yes"; then
3409 AC_DEFINE(HAVE_RES_NINIT)
3410 dnl must add the link line we do something as foolish as this... dougt
3412 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3413 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3418 [for gnu_get_libc_version()],
3419 ac_cv_func_gnu_get_libc_version,
3421 #ifdef HAVE_GNU_LIBC_VERSION_H
3422 #include <gnu/libc-version.h>
3425 [const char *glibc_version = gnu_get_libc_version();],
3426 [ac_cv_func_gnu_get_libc_version=yes],
3427 [ac_cv_func_gnu_get_libc_version=no]
3431 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3432 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3436 darwin*|mingw*|os2*)
3440 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3441 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3442 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3444 LIBS="$LIBS $_ICONV_LIBS"
3453 iconv_t h = iconv_open("", "");
3454 iconv(h, NULL, NULL, NULL, NULL);
3457 [ac_cv_func_iconv=yes],
3458 [ac_cv_func_iconv=no]
3461 if test "$ac_cv_func_iconv" = "yes"; then
3462 AC_DEFINE(HAVE_ICONV)
3463 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3464 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3465 LIBICONV="$_ICONV_LIBS"
3467 [for iconv() with const input],
3468 ac_cv_func_const_iconv,
3474 const char *input = "testing";
3475 iconv_t h = iconv_open("", "");
3476 iconv(h, &input, NULL, NULL, NULL);
3479 [ac_cv_func_const_iconv=yes],
3480 [ac_cv_func_const_iconv=no]
3483 if test "$ac_cv_func_const_iconv" = "yes"; then
3484 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3496 dnl **********************
3497 dnl *** va_copy checks ***
3498 dnl **********************
3499 dnl we currently check for all three va_copy possibilities, so we get
3500 dnl all results in config.log for bug reports.
3501 AC_MSG_CHECKING(for an implementation of va_copy())
3502 AC_CACHE_VAL(ac_cv_va_copy,[
3505 void f (int i, ...) {
3506 va_list args1, args2;
3507 va_start (args1, i);
3508 va_copy (args2, args1);
3509 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3511 va_end (args1); va_end (args2);
3513 int main() { f (0, 42); return 0; }],
3519 AC_MSG_RESULT($ac_cv_va_copy)
3520 AC_MSG_CHECKING(for an implementation of __va_copy())
3521 AC_CACHE_VAL(ac_cv___va_copy,[
3524 void f (int i, ...) {
3525 va_list args1, args2;
3526 va_start (args1, i);
3527 __va_copy (args2, args1);
3528 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3530 va_end (args1); va_end (args2);
3532 int main() { f (0, 42); return 0; }],
3533 ac_cv___va_copy=yes,
3538 AC_MSG_RESULT($ac_cv___va_copy)
3539 AC_MSG_CHECKING(whether va_lists can be copied by value)
3540 AC_CACHE_VAL(ac_cv_va_val_copy,[
3543 void f (int i, ...) {
3544 va_list args1, args2;
3545 va_start (args1, i);
3547 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3549 va_end (args1); va_end (args2);
3551 int main() { f (0, 42); return 0; }],
3552 ac_cv_va_val_copy=yes,
3553 ac_cv_va_val_copy=no,
3554 ac_cv_va_val_copy=yes
3557 if test "x$ac_cv_va_copy" = "xyes"; then
3558 AC_DEFINE(VA_COPY, va_copy)
3559 AC_DEFINE(HAVE_VA_COPY)
3560 elif test "x$ac_cv___va_copy" = "xyes"; then
3561 AC_DEFINE(VA_COPY, __va_copy)
3562 AC_DEFINE(HAVE_VA_COPY)
3565 if test "x$ac_cv_va_val_copy" = "xno"; then
3566 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3568 AC_MSG_RESULT($ac_cv_va_val_copy)
3570 dnl ===================================================================
3571 dnl ========================================================
3572 dnl Put your C++ language/feature checks below
3573 dnl ========================================================
3577 if test "$GNU_CC"; then
3578 if test "$CPU_ARCH" = "arm" ; then
3579 AC_CACHE_CHECK(for ARM EABI,
3583 #if defined(__ARM_EABI__)
3586 #error Not ARM EABI.
3589 ac_cv_gcc_arm_eabi="yes",
3590 ac_cv_gcc_arm_eabi="no")])
3591 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3593 ARM_ABI_PREFIX=eabi-
3595 ARM_ABI_PREFIX=oabi-
3599 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3602 dnl Check to see if we can resolve ambiguity with |using|.
3603 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3604 ac_cv_cpp_ambiguity_resolving_using,
3605 [AC_TRY_COMPILE(class X {
3606 public: int go(const X&) {return 3;}
3607 int jo(const X&) {return 3;}
3609 class Y : public X {
3610 public: int go(int) {return 2;}
3611 int jo(int) {return 2;}
3613 private: using X::go;
3616 ac_cv_cpp_ambiguity_resolving_using=yes,
3617 ac_cv_cpp_ambiguity_resolving_using=no)])
3618 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3619 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3622 dnl See if a dynamic_cast to void* gives the most derived object.
3623 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3624 ac_cv_cpp_dynamic_cast_void_ptr,
3625 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3626 class Y { int j; public: virtual ~Y() { } };
3627 class Z : public X, public Y { int k; };
3633 return !((((void*)&mdo != (void*)subx) &&
3634 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3635 (((void*)&mdo != (void*)suby) &&
3636 ((void*)&mdo == dynamic_cast<void*>(suby))));
3638 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3639 ac_cv_cpp_dynamic_cast_void_ptr=no,
3640 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3641 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3642 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3646 dnl note that this one is reversed - if the test fails, then
3647 dnl we require implementations of unused virtual methods. Which
3648 dnl really blows because it means we'll have useless vtable
3650 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3651 ac_cv_cpp_unused_required,
3652 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3654 ac_cv_cpp_unused_required=no,
3655 ac_cv_cpp_unused_required=yes)])
3656 if test "$ac_cv_cpp_unused_required" = yes ; then
3657 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3661 dnl Some compilers have trouble comparing a constant reference to a templatized
3662 dnl class to zero, and require an explicit operator==() to be defined that takes
3663 dnl an int. This test separates the strong from the weak.
3665 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3666 ac_cv_trouble_comparing_to_zero,
3667 [AC_TRY_COMPILE([#include <algorithm>
3668 template <class T> class Foo {};
3670 template <class T> int operator==(const T2*, const T&) { return 0; }
3671 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3672 [Foo<int> f; return (0 != f);],
3673 ac_cv_trouble_comparing_to_zero=no,
3674 ac_cv_trouble_comparing_to_zero=yes)])
3675 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3676 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3679 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3680 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3681 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3683 _SAVE_LDFLAGS=$LDFLAGS
3684 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3685 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3686 ac_cv_thread_keyword,
3687 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3688 [return tlsIsMainThread;],
3689 ac_cv_thread_keyword=yes,
3690 ac_cv_thread_keyword=no)])
3691 LDFLAGS=$_SAVE_LDFLAGS
3692 # The custom dynamic linker doesn't support TLS variables
3694 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3695 # mips builds fail with TLS variables because of a binutils bug.
3697 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3702 *-android*|*-linuxandroid*)
3709 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3715 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3716 if test -n "$MOZ_LINKER"; then
3717 if test "$CPU_ARCH" = arm; then
3718 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3719 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3720 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3721 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3726 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3727 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3728 dnl We however want to avoid these text relocations, and this can be done
3729 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3730 dnl doesn't contain anything at all, beside placeholders for some sections,
3731 dnl and crtbegin only contains a finalizer function that calls
3732 dnl __cxa_finalize. The custom linker actually takes care of calling
3733 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3734 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3735 dnl link crtbegin and crtend at all.
3736 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3737 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3738 ac_cv_crt_has_text_relocations,
3739 [echo 'int foo() { return 0; }' > conftest.cpp
3740 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3741 test -s conftest${DLL_SUFFIX}; then
3742 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3743 ac_cv_crt_has_text_relocations=yes
3745 ac_cv_crt_has_text_relocations=no
3748 AC_ERROR([couldn't compile a simple C file])
3751 if test "$ac_cv_crt_has_text_relocations" = yes; then
3752 dnl While we want libraries to skip the CRT files, we don't want
3753 dnl executables to be treated the same way. We thus set the flag
3754 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3755 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3756 dnl Using LDFLAGS in nspr is safe, since we only really build
3757 dnl libraries there.
3758 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3759 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3763 dnl Check for the existence of various allocation headers/functions
3765 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3768 for file in $MALLOC_HEADERS; do
3769 MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3770 if test "$MALLOC_H" != ""; then
3771 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3776 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3777 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3779 AC_CHECK_FUNCS(malloc_usable_size)
3781 dnl See if compiler supports some gcc-style attributes
3783 AC_CACHE_CHECK(for __attribute__((always_inline)),
3784 ac_cv_attribute_always_inline,
3785 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3787 ac_cv_attribute_always_inline=yes,
3788 ac_cv_attribute_always_inline=no)])
3790 AC_CACHE_CHECK(for __attribute__((malloc)),
3791 ac_cv_attribute_malloc,
3792 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3794 ac_cv_attribute_malloc=yes,
3795 ac_cv_attribute_malloc=no)])
3797 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3798 ac_cv_attribute_warn_unused,
3799 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3801 ac_cv_attribute_warn_unused=yes,
3802 ac_cv_attribute_warn_unused=no)])
3804 dnl End of C++ language/feature checks
3807 dnl ========================================================
3808 dnl = Internationalization checks
3809 dnl ========================================================
3811 dnl Internationalization and Locale support is different
3812 dnl on various UNIX platforms. Checks for specific i18n
3813 dnl features go here.
3815 dnl check for LC_MESSAGES
3816 AC_CACHE_CHECK(for LC_MESSAGES,
3817 ac_cv_i18n_lc_messages,
3818 [AC_TRY_COMPILE([#include <locale.h>],
3819 [int category = LC_MESSAGES;],
3820 ac_cv_i18n_lc_messages=yes,
3821 ac_cv_i18n_lc_messages=no)])
3822 if test "$ac_cv_i18n_lc_messages" = yes; then
3823 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3826 AC_HAVE_FUNCS(localeconv)
3827 fi # ! SKIP_COMPILER_CHECKS
3830 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3831 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3834 dnl Mozilla specific options
3835 dnl ========================================================
3836 dnl The macros used for command line options
3837 dnl are defined in build/autoconf/altoptions.m4.
3839 dnl If the compiler supports these attributes, define them as
3840 dnl convenience macros.
3841 if test "$ac_cv_attribute_malloc" = yes ; then
3842 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3844 AC_DEFINE(NS_ATTR_MALLOC,)
3847 if test "$ac_cv_attribute_warn_unused" = yes ; then
3848 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3850 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3853 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3854 dnl features that Windows actually does support.
3856 if test -n "$SKIP_COMPILER_CHECKS"; then
3857 dnl Windows has malloc.h
3858 AC_DEFINE(MALLOC_H, [<malloc.h>])
3859 AC_DEFINE(HAVE_FORCEINLINE)
3860 AC_DEFINE(HAVE_LOCALECONV)
3861 fi # SKIP_COMPILER_CHECKS
3863 dnl ========================================================
3865 dnl = Check for external package dependencies
3867 dnl ========================================================
3868 MOZ_ARG_HEADER(External Packages)
3870 MOZ_ARG_WITH_STRING(libxul-sdk,
3871 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3872 LIBXUL_SDK_DIR=$withval)
3874 if test "$LIBXUL_SDK_DIR" = "yes"; then
3875 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3876 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3877 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3879 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3880 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3884 AC_SUBST(LIBXUL_SDK)
3886 if test -n "$LIBXUL_SDK"; then
3887 LIBXUL_DIST="$LIBXUL_SDK"
3889 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3891 AC_SUBST(LIBXUL_DIST)
3895 MOZ_ARG_WITH_BOOL(system-libxul,
3896 [ --with-system-libxul Use system installed libxul SDK],
3899 dnl ========================================================
3900 dnl = If NSPR was not detected in the system,
3901 dnl = use the one in the source tree (mozilla/nsprpub)
3902 dnl ========================================================
3903 MOZ_ARG_WITH_BOOL(system-nspr,
3904 [ --with-system-nspr Use system installed NSPR],
3905 _USE_SYSTEM_NSPR=1 )
3907 if test -n "$_USE_SYSTEM_NSPR"; then
3908 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])])
3911 if test -n "$MOZ_NATIVE_NSPR"; then
3912 _SAVE_CFLAGS=$CFLAGS
3913 CFLAGS="$CFLAGS $NSPR_CFLAGS"
3914 AC_TRY_COMPILE([#include "prtypes.h"],
3915 [#ifndef PR_STATIC_ASSERT
3916 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3918 [MOZ_NATIVE_NSPR=1],
3919 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3920 AC_TRY_COMPILE([#include "prtypes.h"],
3922 #error PR_UINT64 not defined or requires including prtypes.h
3924 [MOZ_NATIVE_NSPR=1],
3925 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3926 CFLAGS=$_SAVE_CFLAGS
3928 if test -z "$LIBXUL_SDK"; then
3929 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3930 if test -n "$GNU_CC"; then
3931 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3933 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3936 NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3937 NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3941 dnl set GRE_MILESTONE
3942 dnl ========================================================
3943 if test -n "$LIBXUL_SDK"; then
3944 GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3946 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3948 AC_SUBST(GRE_MILESTONE)
3950 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3951 # The logic works like this:
3952 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3953 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3954 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3955 case "$GRE_MILESTONE" in
3958 AC_DEFINE(NIGHTLY_BUILD)
3964 AC_DEFINE(RELEASE_BUILD)
3967 AC_SUBST(NIGHTLY_BUILD)
3968 AC_SUBST(RELEASE_BUILD)
3970 dnl system libevent Support
3971 dnl ========================================================
3972 MOZ_ARG_WITH_STRING(system-libevent,
3973 [ --with-system-libevent[=PFX]
3974 Use system libevent [installed at prefix PFX]],
3975 LIBEVENT_DIR=$withval)
3977 _SAVE_CFLAGS=$CFLAGS
3978 _SAVE_LDFLAGS=$LDFLAGS
3980 if test "$LIBEVENT_DIR" = yes; then
3981 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3982 MOZ_NATIVE_LIBEVENT=1,
3985 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3986 MOZ_NATIVE_LIBEVENT=
3987 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3988 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3989 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3990 MOZ_CHECK_HEADER(event.h,
3991 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3992 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3994 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3995 AC_CHECK_LIB(event, event_init,
3996 [MOZ_NATIVE_LIBEVENT=1
3997 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3998 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3999 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
4001 CFLAGS=$_SAVE_CFLAGS
4002 LDFLAGS=$_SAVE_LDFLAGS
4005 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4006 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
4007 AC_SUBST(MOZ_LIBEVENT_LIBS)
4009 dnl ========================================================
4010 dnl = If NSS was not detected in the system,
4011 dnl = use the one in the source tree (mozilla/security/nss)
4012 dnl ========================================================
4014 MOZ_ARG_WITH_BOOL(system-nss,
4015 [ --with-system-nss Use system installed NSS],
4018 if test -n "$_USE_SYSTEM_NSS"; then
4019 AM_PATH_NSS(3.15, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
4022 if test -n "$MOZ_NATIVE_NSS"; then
4023 NSS_LIBS="$NSS_LIBS -lcrmf"
4025 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4027 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
4029 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4030 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4031 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4032 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4033 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4035 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4039 dnl ======================
4041 dnl ======================
4043 AC_MSG_CHECKING([for YASM assembler])
4044 AC_CHECK_PROGS(YASM, yasm, "")
4046 if test -n "$YASM"; then
4047 dnl Pull out yasm's version string
4048 YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
4049 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4050 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4051 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4052 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4055 if test -z "$SKIP_LIBRARY_CHECKS"; then
4056 dnl system JPEG support
4057 dnl ========================================================
4058 MOZ_ARG_WITH_STRING(system-jpeg,
4059 [ --with-system-jpeg[=PFX]
4060 Use system libjpeg [installed at prefix PFX]],
4063 _SAVE_CFLAGS=$CFLAGS
4064 _SAVE_LDFLAGS=$LDFLAGS
4066 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4067 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4068 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4070 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4073 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
4076 if test "$MOZ_NATIVE_JPEG" = 1; then
4077 AC_TRY_COMPILE([ #include <stdio.h>
4078 #include <sys/types.h>
4079 #include <jpeglib.h> ],
4080 [ #if JPEG_LIB_VERSION < $MOZJPEG
4081 #error "Insufficient JPEG library version ($MOZJPEG required)."
4083 #ifndef JCS_EXTENSIONS
4084 #error "libjpeg-turbo JCS_EXTENSIONS required"
4088 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
4090 CFLAGS=$_SAVE_CFLAGS
4091 LDFLAGS=$_SAVE_LDFLAGS
4094 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
4095 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
4096 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
4098 fi # SKIP_LIBRARY_CHECKS
4100 dnl system ZLIB support
4101 dnl ========================================================
4102 MOZ_ZLIB_CHECK([1.2.3])
4104 if test "$MOZ_NATIVE_ZLIB" != 1; then
4106 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
4109 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
4110 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4113 if test -z "$SKIP_LIBRARY_CHECKS"; then
4114 dnl system BZIP2 Support
4115 dnl ========================================================
4116 MOZ_ARG_WITH_STRING(system-bz2,
4117 [ --with-system-bz2[=PFX]
4118 Use system libbz2 [installed at prefix PFX]],
4121 _SAVE_CFLAGS=$CFLAGS
4122 _SAVE_LDFLAGS=$LDFLAGS
4124 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4125 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4126 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4128 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4131 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
4132 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
4134 CFLAGS=$_SAVE_CFLAGS
4135 LDFLAGS=$_SAVE_LDFLAGS
4138 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
4139 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
4140 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4143 dnl system PNG Support
4144 dnl ========================================================
4145 MOZ_ARG_WITH_STRING(system-png,
4146 [ --with-system-png[=PFX]
4147 Use system libpng [installed at prefix PFX]],
4150 _SAVE_CFLAGS=$CFLAGS
4151 _SAVE_LDFLAGS=$LDFLAGS
4153 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4154 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4155 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4157 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4160 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
4161 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4162 AC_CHECK_LIB(png, png_get_acTL, ,
4163 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
4165 if test "$MOZ_NATIVE_PNG" = 1; then
4166 AC_TRY_COMPILE([ #include <stdio.h>
4167 #include <sys/types.h>
4169 [ #if PNG_LIBPNG_VER < $MOZPNG
4170 #error "Insufficient libpng version ($MOZPNG required)."
4172 #ifndef PNG_UINT_31_MAX
4173 #error "Insufficient libpng version."
4176 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4178 CFLAGS=$_SAVE_CFLAGS
4179 LDFLAGS=$_SAVE_LDFLAGS
4182 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
4183 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
4184 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
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
4298 MOZ_ONLY_TOUCH_EVENTS=
4299 MOZ_TOOLKIT_SEARCH=1
4301 MOZ_UNIVERSALCHARDET=1
4307 MOZ_DISABLE_CRYPTOLEGACY=
4311 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4314 MOZ_USE_NATIVE_POPUP_WINDOWS=
4315 MOZ_ANDROID_HISTORY=
4317 MOZ_ANDROID_WALLPAPER=
4322 MOZ_AUDIO_CHANNEL_MANAGER=
4325 case "$target_os" in
4328 AC_DEFINE(NS_ENABLE_TSF)
4333 *-android*|*-linuxandroid*)
4334 if test "$CPU_ARCH" = "arm" ; then
4339 if test -z "$gonkdir"; then
4344 MOZ_THEME_FASTSTRIPE=1
4352 MOZ_ARG_WITH_STRING(external-source-dir,
4353 [ --with-external-source-dir=dir
4354 External directory containing additional build files.],
4355 [ EXTERNAL_SOURCE_DIR=$withval])
4356 AC_SUBST(EXTERNAL_SOURCE_DIR)
4358 MOZ_ARG_ENABLE_STRING(application,
4359 [ --enable-application=APP
4363 tools/update-packaging (AUS-related packaging tools)],
4364 [ MOZ_BUILD_APP=$enableval ] )
4366 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4367 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4368 XULRUNNER_STUB_NAME=$withval)
4370 if test -z "$XULRUNNER_STUB_NAME"; then
4371 case "$target_os" in
4373 XULRUNNER_STUB_NAME=xulrunner
4376 XULRUNNER_STUB_NAME=xulrunner-stub
4379 AC_SUBST(XULRUNNER_STUB_NAME)
4381 AC_MSG_CHECKING([for application to build])
4382 if test -z "$MOZ_BUILD_APP"; then
4383 AC_MSG_RESULT([browser])
4384 MOZ_BUILD_APP=browser
4386 # "mobile" no longer exists.
4387 if test "$MOZ_BUILD_APP" = "mobile" ; then
4388 AC_MSG_RESULT([none])
4389 AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
4391 # We have a valid application only if it has a build.mk file in its top
4393 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4394 AC_MSG_RESULT([none])
4395 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4397 AC_MSG_RESULT([$MOZ_BUILD_APP])
4401 # The app update channel is 'default' when not supplied. The value is used in
4402 # the application's confvars.sh so it must be set before confvars.sh is called.
4403 MOZ_ARG_ENABLE_STRING([update-channel],
4404 [ --enable-update-channel=CHANNEL
4405 Select application update channel (default=default)],
4406 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4408 if test -z "$MOZ_UPDATE_CHANNEL"; then
4409 MOZ_UPDATE_CHANNEL=default
4411 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4412 AC_SUBST(MOZ_UPDATE_CHANNEL)
4414 # Allow to specify a Google API key file that contains the secret key to be
4415 # used for various Google API requests.
4416 MOZ_ARG_WITH_STRING(google-api-keyfile,
4417 [ --with-google-api-keyfile=file Use the secret key contained in the given keyfile for Google API requests],
4418 MOZ_GOOGLE_API_KEY=`cat $withval`)
4419 if test -z "$MOZ_GOOGLE_API_KEY"; then
4420 MOZ_GOOGLE_API_KEY=no-google-api-key
4422 AC_SUBST(MOZ_GOOGLE_API_KEY)
4424 # Allow the application to influence configure with a confvars.sh script.
4425 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4426 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4427 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4428 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4433 # Allow influencing configure with a defines.sh script.
4434 . "${srcdir}/build/defines.sh"
4436 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
4438 if test "$BUILDING_RELEASE"; then
4439 # Override value in defines.sh, if any
4440 EARLY_BETA_OR_EARLIER=
4441 elif test "$EARLY_BETA_OR_EARLIER"; then
4442 AC_DEFINE(EARLY_BETA_OR_EARLIER)
4444 AC_SUBST(EARLY_BETA_OR_EARLIER)
4446 # Allow the application to provide a subconfigure script
4447 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4448 do_output_subdirs() {
4449 if test -n "$_subconfigure_subdirs"; then
4450 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4452 _subconfigure_subdir="$1"
4453 _subconfigure_config_args="$ac_configure_args"
4455 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4456 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4457 "${srcdir}/build/autoconf/altoptions.m4" \
4458 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4463 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4464 MOZ_ARG_WITH_STRING(app-name,
4465 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4466 WITH_APP_NAME=$withval,
4469 if test -n "$WITH_APP_NAME" ; then
4470 MOZ_APP_NAME="$WITH_APP_NAME"
4473 MOZ_ARG_WITH_STRING(app-basename,
4474 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4475 WITH_APP_BASENAME=$withval,
4478 if test -n "$WITH_APP_BASENAME" ; then
4479 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4482 # Now is a good time to test for logic errors, define mismatches, etc.
4483 case "$MOZ_BUILD_APP" in
4485 if test "$LIBXUL_SDK"; then
4486 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4491 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4492 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4494 case "$MOZ_BUILD_APP" in
4496 AC_DEFINE(MOZ_PHOENIX)
4500 AC_DEFINE(MOZ_XULRUNNER)
4507 AC_SUBST(MOZ_BUILD_APP)
4508 AC_SUBST(MOZ_PHOENIX)
4509 AC_SUBST(MOZ_XULRUNNER)
4512 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4514 dnl ========================================================
4515 dnl Check android sdk version depending on mobile target
4516 dnl ========================================================
4518 if test -z "$gonkdir" ; then
4519 # Minimum Android SDK API Level we require.
4520 case "$MOZ_BUILD_APP" in
4522 android_min_api_level=16
4526 MOZ_ANDROID_SDK($android_min_api_level)
4529 dnl ========================================================
4531 dnl = Toolkit Options
4533 dnl ========================================================
4534 MOZ_ARG_HEADER(Toolkit Options)
4536 dnl ========================================================
4537 dnl = Select the default toolkit
4538 dnl ========================================================
4539 MOZ_ARG_ENABLE_STRING(default-toolkit,
4540 [ --enable-default-toolkit=TK
4541 Select default toolkit
4542 Platform specific defaults:
4543 Mac OS X - cairo-cocoa
4545 Win32 - cairo-windows
4549 [ _DEFAULT_TOOLKIT=$enableval ],
4550 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4552 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4553 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4554 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4555 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4556 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4557 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4558 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4559 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4560 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4561 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4563 dnl nglayout only supports building with one toolkit,
4564 dnl so ignore everything after the first comma (",").
4565 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4567 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4570 MOZ_ARG_WITHOUT_BOOL(x,
4571 [ --without-x Build without X11],
4574 dnl ========================================================
4575 dnl = Enable the toolkit as needed =
4576 dnl ========================================================
4580 case "$MOZ_WIDGET_TOOLKIT" in
4583 MOZ_WIDGET_TOOLKIT=windows
4586 MOZ_INSTRUMENT_EVENT_LOOP=1
4587 if test -n "$GNU_CC"; then
4593 MOZ_WIDGET_TOOLKIT=gtk3
4596 MOZ_ENABLE_XREMOTE=1
4598 MOZ_GL_DEFAULT_PROVIDER=GLX
4604 TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4605 TK_LIBS='$(MOZ_GTK3_LIBS)'
4607 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4609 MOZ_INSTRUMENT_EVENT_LOOP=1
4612 cairo-gtk2|cairo-gtk2-x11)
4613 MOZ_WIDGET_TOOLKIT=gtk2
4616 MOZ_ENABLE_XREMOTE=1
4618 MOZ_GL_DEFAULT_PROVIDER=GLX
4624 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4625 TK_LIBS='$(MOZ_GTK2_LIBS)'
4626 AC_DEFINE(MOZ_WIDGET_GTK2)
4628 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4630 MOZ_INSTRUMENT_EVENT_LOOP=1
4634 MOZ_WIDGET_TOOLKIT=qt
4636 if test -z "$WITHOUT_X11"; then
4637 MOZ_ENABLE_XREMOTE=1
4638 MOZ_GL_DEFAULT_PROVIDER=GLX
4647 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4648 TK_LIBS='$(MOZ_QT_LIBS)'
4649 AC_DEFINE(MOZ_WIDGET_QT)
4651 AC_DEFINE(QT_NO_KEYWORDS)
4655 MOZ_WIDGET_TOOLKIT=os2
4657 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4658 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4663 MOZ_WIDGET_TOOLKIT=cocoa
4664 AC_DEFINE(MOZ_WIDGET_COCOA)
4665 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4666 TK_LIBS='-framework CoreLocation -framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4667 TK_CFLAGS="-DNO_X11"
4668 CFLAGS="$CFLAGS $TK_CFLAGS"
4669 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4670 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc'
4671 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc'
4672 MOZ_USER_DIR="Mozilla"
4673 MOZ_FS_LAYOUT=bundle
4675 MOZ_INSTRUMENT_EVENT_LOOP=1
4679 MOZ_WIDGET_TOOLKIT=uikit
4680 AC_DEFINE(MOZ_WIDGET_UIKIT)
4681 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4682 TK_CFLAGS="-DNO_X11"
4683 TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4684 CFLAGS="$CFLAGS $TK_CFLAGS"
4685 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4686 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc'
4687 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc'
4688 MOZ_USER_DIR="Mozilla"
4689 MOZ_FS_LAYOUT=bundle
4693 AC_DEFINE(MOZ_WIDGET_ANDROID)
4694 MOZ_WIDGET_TOOLKIT=android
4695 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4696 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4699 MOZ_INSTRUMENT_EVENT_LOOP=1
4703 AC_DEFINE(MOZ_WIDGET_GONK)
4704 AC_DEFINE(MOZ_TOUCH)
4705 MOZ_WIDGET_TOOLKIT=gonk
4706 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4707 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4715 AC_SUBST(MOZ_PDF_PRINTING)
4716 if test "$MOZ_PDF_PRINTING"; then
4717 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4718 AC_DEFINE(MOZ_PDF_PRINTING)
4721 if test "$MOZ_ENABLE_XREMOTE"; then
4722 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4725 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4726 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4729 if test "$COMPILE_ENVIRONMENT"; then
4730 if test "$MOZ_ENABLE_GTK3"; then
4731 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4733 if test "$MOZ_ENABLE_GTK2"; then
4734 if test "$MOZ_X11"; then
4735 GDK_PACKAGES=gdk-x11-2.0
4738 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4741 fi # COMPILE_ENVIRONMENT
4743 AC_SUBST(MOZ_FS_LAYOUT)
4745 dnl ========================================================
4746 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4747 dnl their usage and use them in spidermonkey.
4748 dnl ========================================================
4749 MOZ_ARG_WITH_BOOL(arm-kuser,
4750 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4752 if test -n "$USE_ARM_KUSER"; then
4753 AC_DEFINE(USE_ARM_KUSER)
4756 dnl ========================================================
4757 dnl = startup-notification support module
4758 dnl ========================================================
4760 if test "$MOZ_ENABLE_GTK"
4762 MOZ_ENABLE_STARTUP_NOTIFICATION=
4764 MOZ_ARG_ENABLE_BOOL(startup-notification,
4765 [ --enable-startup-notification
4766 Enable startup-notification support (default: disabled) ],
4767 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4768 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4769 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4771 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4772 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4773 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4774 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4776 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4778 MOZ_ENABLE_STARTUP_NOTIFICATION=
4782 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4783 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4786 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4788 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4789 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4790 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4792 dnl ========================================================
4794 dnl ========================================================
4795 if test "$MOZ_ENABLE_QT"
4797 MOZ_ARG_WITH_STRING(qtdir,
4798 [ --with-qtdir=\$dir Specify Qt directory ],
4801 if test -z "$QTDIR"; then
4802 AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4804 HOST_QMAKE="$QTDIR/bin/qmake"
4806 QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | grep -oP '\d+\.\d+\.\d+'`
4808 if test -z "$QTDIR"; then
4811 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4812 PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5OpenGL Qt5Widgets Qt5PrintSupport, ,
4814 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4816 QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4817 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4820 AC_MSG_RESULT("Using qt4: $QT_VERSION")
4821 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL, ,
4823 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qt4 development package, (On Ubuntu, you might try installing the packages libqt4-dev libqt4-opengl-dev.)])
4827 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4831 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4832 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4834 MOZ_QT_CFLAGS="-DQT_SHARED"
4835 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4836 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4837 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4838 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4839 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4840 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4844 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4845 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml -lQt5OpenGL"
4846 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4847 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4848 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4849 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4852 AC_MSG_RESULT("Using qt4: $QT_VERSION")
4853 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4854 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4857 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4861 HOST_MOC="$QTDIR/bin/moc"
4862 HOST_RCC="$QTDIR/bin/rcc"
4864 if test -z "$HOST_MOC"; then
4865 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4868 if test -z "$HOST_RCC"; then
4869 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4876 MOZ_ENABLE_QMSYSTEM2=
4877 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4878 MOZ_ENABLE_QMSYSTEM2=1,
4879 MOZ_ENABLE_QMSYSTEM2=)
4881 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4882 MOZ_ENABLE_QMSYSTEM2=1
4883 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4884 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4885 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4888 MOZ_ENABLE_QTNETWORK=
4889 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4890 MOZ_ENABLE_QTNETWORK=1,
4891 MOZ_ENABLE_QTNETWORK=)
4893 if test "$MOZ_ENABLE_QTNETWORK"; then
4894 MOZ_ENABLE_QTNETWORK=1
4895 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4898 MOZ_ENABLE_QTMOBILITY=
4899 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4900 MOZ_ENABLE_QTMOBILITY=1,
4901 MOZ_ENABLE_QTMOBILITY=)
4902 if test "$MOZ_ENABLE_QTMOBILITY"; then
4903 MOZ_ENABLE_QTMOBILITY=1
4904 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4905 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4907 AC_CHECK_LIB(QtSensors, main, [
4908 MOZ_ENABLE_QTMOBILITY=1
4909 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4910 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4911 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4912 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4913 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4916 if test "$MOZ_ENABLE_QTMOBILITY"; then
4917 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4921 AC_SUBST(GTK_CONFIG)
4925 AC_SUBST(MOZ_ENABLE_GTK2)
4926 AC_SUBST(MOZ_ENABLE_GTK3)
4927 AC_SUBST(MOZ_ENABLE_GTK)
4928 AC_SUBST(MOZ_ENABLE_QT)
4929 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4930 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4931 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4932 AC_SUBST(MOZ_ENABLE_XREMOTE)
4933 AC_SUBST(MOZ_GTK2_CFLAGS)
4934 AC_SUBST(MOZ_GTK2_LIBS)
4935 AC_SUBST(MOZ_GTK3_CFLAGS)
4936 AC_SUBST(MOZ_GTK3_LIBS)
4937 AC_SUBST(MOZ_WIDGET_GTK)
4938 AC_SUBST(MOZ_QT_CFLAGS)
4939 AC_SUBST(MOZ_QT_LIBS)
4946 dnl ========================================================
4948 dnl = Components & Features
4950 dnl ========================================================
4951 MOZ_ARG_HEADER(Components and Features)
4953 dnl ========================================================
4955 dnl ========================================================
4956 MOZ_ARG_ENABLE_STRING(ui-locale,
4957 [ --enable-ui-locale=ab-CD
4958 Select the user interface locale (default: en-US)],
4959 MOZ_UI_LOCALE=$enableval )
4960 AC_SUBST(MOZ_UI_LOCALE)
4962 dnl ========================================================
4963 dnl = Trademarked Branding
4964 dnl ========================================================
4965 MOZ_ARG_ENABLE_BOOL(official-branding,
4966 [ --enable-official-branding
4967 Enable Official mozilla.org Branding
4968 Do not distribute builds with
4969 --enable-official-branding unless you have
4970 permission to use trademarks per
4971 http://www.mozilla.org/foundation/trademarks/ .],
4973 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4974 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4976 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4977 MOZ_OFFICIAL_BRANDING=1
4979 ], MOZ_OFFICIAL_BRANDING=)
4981 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4982 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4983 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4986 MOZ_ARG_WITH_STRING(branding,
4987 [ --with-branding=dir Use branding from the specified directory.],
4988 MOZ_BRANDING_DIRECTORY=$withval)
4990 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4991 if test -z "$REAL_BRANDING_DIRECTORY"; then
4992 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4995 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4996 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4999 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5001 dnl ========================================================
5002 dnl = Distribution ID
5003 dnl ========================================================
5004 MOZ_ARG_WITH_STRING(distribution-id,
5005 [ --with-distribution-id=ID
5006 Set distribution-specific id (default=org.mozilla)],
5007 [ val=`echo $withval`
5008 MOZ_DISTRIBUTION_ID="$val"])
5010 if test -z "$MOZ_DISTRIBUTION_ID"; then
5011 MOZ_DISTRIBUTION_ID="org.mozilla"
5014 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5015 AC_SUBST(MOZ_DISTRIBUTION_ID)
5018 dnl ========================================================
5019 dnl complex text support off by default
5020 dnl ========================================================
5021 MOZ_ARG_DISABLE_BOOL(pango,
5022 [ --disable-pango Disable usage of Pango ],
5026 dnl ========================================================
5028 dnl ========================================================
5029 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
5033 if test "$MOZ_PANGO"
5035 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5037 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
5038 AC_SUBST(MOZ_PANGO_CFLAGS)
5039 AC_SUBST(MOZ_PANGO_LIBS)
5040 AC_DEFINE(MOZ_PANGO)
5042 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
5043 AC_SUBST(FT2_CFLAGS)
5048 dnl ========================================================
5049 dnl = GnomeVFS, GIO and GConf support module
5050 dnl ========================================================
5054 dnl build the GIO extension by default only when the
5055 dnl GTK2 toolkit is in use.
5056 if test "$MOZ_ENABLE_GTK"
5062 dnl ========================================================
5063 dnl = GnomeVFS support module
5064 dnl ========================================================
5065 MOZ_ARG_ENABLE_BOOL(gnomevfs,
5066 [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
5067 MOZ_ENABLE_GNOMEVFS=force,
5068 MOZ_ENABLE_GNOMEVFS=)
5070 if test "$MOZ_ENABLE_GNOMEVFS"
5072 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5073 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5074 MOZ_ENABLE_GNOMEVFS=1
5075 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5077 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5079 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5081 MOZ_ENABLE_GNOMEVFS=
5085 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5086 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5087 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5089 dnl ========================================================
5090 dnl = GIO support module
5091 dnl ========================================================
5092 MOZ_ARG_DISABLE_BOOL(gio,
5093 [ --disable-gio Disable GIO support],
5095 MOZ_ENABLE_GIO=force)
5097 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
5099 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
5100 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
5101 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5102 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5104 AC_DEFINE(MOZ_ENABLE_GIO)
5106 if test "$MOZ_ENABLE_GIO" = "force"
5108 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5114 AC_SUBST(MOZ_ENABLE_GIO)
5115 AC_SUBST(MOZ_GIO_CFLAGS)
5116 AC_SUBST(MOZ_GIO_LIBS)
5118 dnl ========================================================
5119 dnl = GConf support module
5120 dnl ========================================================
5121 MOZ_ARG_DISABLE_BOOL(gconf,
5122 [ --disable-gconf Disable Gconf support ],
5124 MOZ_ENABLE_GCONF=force)
5126 if test "$MOZ_ENABLE_GCONF"
5128 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5129 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
5132 if test "$MOZ_ENABLE_GCONF" = "force"
5134 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5140 if test "$MOZ_ENABLE_GCONF"; then
5141 AC_DEFINE(MOZ_ENABLE_GCONF)
5144 AC_SUBST(MOZ_ENABLE_GCONF)
5145 AC_SUBST(MOZ_GCONF_CFLAGS)
5146 AC_SUBST(MOZ_GCONF_LIBS)
5149 dnl ========================================================
5150 dnl = libproxy support
5151 dnl ========================================================
5153 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
5155 MOZ_ENABLE_LIBPROXY=
5157 MOZ_ARG_ENABLE_BOOL(libproxy,
5158 [ --enable-libproxy Enable libproxy support ],
5159 MOZ_ENABLE_LIBPROXY=1,
5160 MOZ_ENABLE_LIBPROXY=)
5162 if test "$MOZ_ENABLE_LIBPROXY"
5164 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5165 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5168 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5169 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5170 AC_SUBST(MOZ_LIBPROXY_LIBS)
5172 dnl ========================================================
5173 dnl = GNOME component (mozgnome)
5174 dnl ========================================================
5176 if test "$MOZ_ENABLE_GTK2"
5178 MOZ_ENABLE_GNOME_COMPONENT=1
5180 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5182 dnl ========================================================
5183 dnl = libgnomeui support module
5184 dnl ========================================================
5186 if test "$MOZ_ENABLE_GTK"
5188 MOZ_ARG_ENABLE_BOOL(gnomeui,
5189 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
5190 MOZ_ENABLE_GNOMEUI=force,
5191 MOZ_ENABLE_GNOMEUI=)
5193 if test "$MOZ_ENABLE_GNOMEUI"
5195 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5197 MOZ_ENABLE_GNOMEUI=1
5199 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5201 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5207 if test "$MOZ_ENABLE_GNOMEUI"; then
5208 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5212 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5213 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5215 dnl ========================================================
5217 dnl ========================================================
5219 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
5223 MOZ_ARG_DISABLE_BOOL(dbus,
5224 [ --disable-dbus Disable dbus support ],
5228 if test "$MOZ_ENABLE_DBUS"
5230 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5231 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5232 AC_DEFINE(MOZ_ENABLE_DBUS)
5235 AC_SUBST(MOZ_ENABLE_DBUS)
5236 AC_SUBST(MOZ_DBUS_CFLAGS)
5237 AC_SUBST(MOZ_DBUS_LIBS)
5238 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5239 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5241 dnl ========================================================
5242 dnl = Enable Android History instead of Places
5243 dnl ========================================================
5244 if test -n "$MOZ_ANDROID_HISTORY"; then
5245 if test -z "$MOZ_PLACES"; then
5246 AC_DEFINE(MOZ_ANDROID_HISTORY)
5248 AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
5252 dnl ========================================================
5253 dnl = Build with the Android compositor
5254 dnl ========================================================
5255 if test -n "$MOZ_ANDROID_OMTC"; then
5256 dnl Do this if defined in confvars.sh
5257 AC_DEFINE(MOZ_ANDROID_OMTC)
5260 dnl ========================================================
5261 dnl = Disable WebSMS backend
5262 dnl ========================================================
5263 MOZ_ARG_DISABLE_BOOL(websms-backend,
5264 [ --disable-websms-backend
5265 Disable WebSMS backend],
5266 MOZ_WEBSMS_BACKEND=,
5267 MOZ_WEBSMS_BACKEND=1)
5269 if test -n "$MOZ_WEBSMS_BACKEND"; then
5270 AC_DEFINE(MOZ_WEBSMS_BACKEND)
5273 dnl ========================================================
5274 dnl = Enable SET_WALLPAPER permission on Android
5275 dnl ========================================================
5276 if test -n "$MOZ_ANDROID_WALLPAPER"; then
5277 AC_DEFINE(MOZ_ANDROID_WALLPAPER)
5280 dnl ========================================================
5281 dnl = Enable NFC permission on Android
5282 dnl ========================================================
5283 if test -n "$MOZ_ANDROID_BEAM"; then
5284 AC_DEFINE(MOZ_ANDROID_BEAM)
5287 dnl ========================================================
5288 dnl = Build Personal Security Manager
5289 dnl ========================================================
5290 MOZ_ARG_DISABLE_BOOL(crypto,
5291 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5295 dnl ========================================================
5296 dnl = JS Debugger XPCOM component (js/jsd)
5297 dnl ========================================================
5298 MOZ_ARG_DISABLE_BOOL(jsd,
5299 [ --disable-jsd Disable JavaScript debug library],
5304 dnl ========================================================
5305 dnl = Enable IPDL's "expensive" unit tests
5306 dnl ========================================================
5309 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5310 [ --enable-ipdl-tests Enable expensive IPDL tests],
5314 if test -n "$MOZ_IPDL_TESTS"; then
5315 AC_DEFINE(MOZ_IPDL_TESTS)
5318 AC_SUBST(MOZ_IPDL_TESTS)
5320 dnl ========================================================
5321 dnl = Disable building dbm
5322 dnl ========================================================
5323 MOZ_ARG_DISABLE_BOOL(dbm,
5324 [ --disable-dbm Disable building dbm],
5328 dnl bi-directional support always on
5332 dnl ========================================================
5333 dnl accessibility support on by default on all platforms
5334 dnl ========================================================
5335 MOZ_ARG_DISABLE_BOOL(accessibility,
5336 [ --disable-accessibility Disable accessibility support],
5339 if test "$ACCESSIBILITY"; then
5342 if test -z "$MIDL"; then
5343 if test "$GCC" != "yes"; then
5344 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5346 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.])
5350 AC_DEFINE(ACCESSIBILITY)
5353 dnl ========================================================
5354 dnl Accessibility is required for the linuxgl widget
5356 dnl ========================================================
5357 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5358 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5361 dnl ========================================================
5362 dnl Disable printing
5363 dnl ========================================================
5364 MOZ_ARG_DISABLE_BOOL(printing,
5365 [ --disable-printing Disable printing support],
5369 if test "$NS_PRINTING"; then
5370 AC_DEFINE(NS_PRINTING)
5371 AC_DEFINE(NS_PRINT_PREVIEW)
5374 dnl Turn off webrtc for OS's we don't handle yet, but allow
5375 dnl --enable-webrtc to override. Can disable for everything in
5376 dnl the master list above.
5377 if test -n "$MOZ_WEBRTC"; then
5379 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*)
5383 dnl default to disabled for all others
5389 # target_arch is from {ia32|x64|arm|ppc}
5392 WEBRTC_TARGET_ARCH=x64
5396 WEBRTC_TARGET_ARCH=arm
5400 WEBRTC_TARGET_ARCH=ia32
5404 WEBRTC_TARGET_ARCH=ppc
5407 # unsupported arch for webrtc
5408 WEBRTC_TARGET_ARCH=unknown
5414 dnl ========================================================
5415 dnl = Disable WebRTC code
5416 dnl ========================================================
5417 MOZ_ARG_DISABLE_BOOL(webrtc,
5418 [ --disable-webrtc Disable support for WebRTC],
5422 if test -n "$MOZ_WEBRTC"; then
5423 AC_DEFINE(MOZ_WEBRTC)
5424 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
5425 dnl opt/production builds (via MOZ_CRASH())
5426 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
5430 MOZ_VP8_ERROR_CONCEALMENT=1
5432 dnl enable once Signaling lands
5433 MOZ_WEBRTC_SIGNALING=1
5434 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5435 if test "${OS_TARGET}" = "WINNT"; then
5436 MOZ_WEBRTC_IN_LIBXUL=1
5438 dnl enable once PeerConnection lands
5439 MOZ_PEERCONNECTION=1
5440 AC_DEFINE(MOZ_PEERCONNECTION)
5447 AC_SUBST(MOZ_WEBRTC)
5448 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5449 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5450 AC_SUBST(MOZ_PEERCONNECTION)
5451 AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
5452 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5456 dnl Use integers over floats for audio on B2G and Android, because audio
5457 dnl backends for those platforms don't support floats.
5458 if test "$OS_TARGET" = "Android"; then
5459 MOZ_SAMPLE_TYPE_S16=1
5460 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5461 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5463 MOZ_SAMPLE_TYPE_FLOAT32=1
5464 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5465 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5468 dnl ========================================================
5469 dnl = Disable Speech API code
5470 dnl ========================================================
5471 MOZ_ARG_DISABLE_BOOL(webspeech,
5472 [ --disable-webspeech Disable support for HTML Speech API],
5476 if test -n "$MOZ_WEBSPEECH"; then
5477 AC_DEFINE(MOZ_WEBSPEECH)
5480 AC_SUBST(MOZ_WEBSPEECH)
5482 dnl ========================================================
5483 dnl = Enable Raw Codecs
5484 dnl ========================================================
5485 MOZ_ARG_ENABLE_BOOL(raw,
5486 [ --enable-raw Enable support for RAW media],
5490 if test -n "$MOZ_RAW"; then
5496 dnl ========================================================
5497 dnl = Disable Ogg Codecs
5498 dnl ========================================================
5499 MOZ_ARG_DISABLE_BOOL(ogg,
5500 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5504 if test -n "$MOZ_OGG"; then
5508 dnl Checks for __attribute__(aligned()) directive
5509 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5510 [ac_cv_c_attribute_aligned],
5511 [ac_cv_c_attribute_aligned=0
5512 CFLAGS_save="${CFLAGS}"
5513 CFLAGS="${CFLAGS} -Werror"
5514 for ac_cv_c_attr_align_try in 64 32 16 8; do
5515 echo "trying $ac_cv_c_attr_align_try"
5517 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5518 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5519 if test "$ac_cv_c_attribute_aligned" != 0; then
5523 CFLAGS="${CFLAGS_save}"])
5524 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5525 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5526 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5530 dnl ========================================================
5531 dnl = Disable Opus audio codec support
5532 dnl ========================================================
5533 MOZ_ARG_DISABLE_BOOL(opus,
5534 [ --disable-opus Disable support for Opus audio],
5538 dnl ========================================================
5539 dnl = Disable VP8 decoder support
5540 dnl ========================================================
5541 MOZ_ARG_DISABLE_BOOL(webm,
5542 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5546 if test -n "$MOZ_WEBM"; then
5551 dnl ========================================================
5552 dnl = Windows Media Foundation support
5553 dnl ========================================================
5554 if test "$OS_ARCH" = "WINNT"; then
5555 dnl Enable Windows Media Foundation support by default.
5556 dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5557 dnl guaranteed to have a recent-enough SDK to build WMF.
5561 MOZ_ARG_DISABLE_BOOL(wmf,
5562 [ --disable-wmf Disable support for Windows Media Foundation],
5566 if test -n "$MOZ_WMF"; then
5571 dnl ========================================================
5572 dnl = Enable media plugin support
5573 dnl ========================================================
5574 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5575 dnl Enable support on android by default
5579 MOZ_ARG_ENABLE_BOOL(media-plugins,
5580 [ --enable-media-plugins Enable support for media plugins],
5581 MOZ_MEDIA_PLUGINS=1,
5584 if test -n "$MOZ_MEDIA_PLUGINS"; then
5585 AC_DEFINE(MOZ_MEDIA_PLUGINS)
5588 dnl ========================================================
5589 dnl = Enable getUserMedia support
5590 dnl ========================================================
5591 MOZ_ARG_ENABLE_BOOL(media-navigator,
5592 [ --enable-media-navigator Enable support for getUserMedia],
5593 MOZ_MEDIA_NAVIGATOR=1,
5594 MOZ_MEDIA_NAVIGATOR=)
5596 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5597 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5600 dnl ========================================================
5601 dnl = Enable building OMX media plugin (B2G or Android)
5602 dnl ========================================================
5603 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5604 dnl Enable support on android by default
5608 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5609 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5613 if test -n "$MOZ_OMX_PLUGIN"; then
5614 if test "$OS_TARGET" = "Android"; then
5615 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5616 AC_DEFINE(MOZ_OMX_PLUGIN)
5618 dnl fail if we're not building on Gonk or Android
5619 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5623 dnl system libvpx Support
5624 dnl ========================================================
5625 MOZ_ARG_WITH_BOOL(system-libvpx,
5626 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5627 MOZ_NATIVE_LIBVPX=1)
5632 if test -n "$MOZ_VP8"; then
5634 if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5635 AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5637 if test -n "$MOZ_VP8_ENCODER" ; then
5638 AC_DEFINE(MOZ_VP8_ENCODER)
5641 if test -n "$MOZ_NATIVE_LIBVPX"; then
5642 dnl ============================
5643 dnl === libvpx Version check ===
5644 dnl ============================
5645 dnl Check to see if we have a system libvpx package.
5646 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5648 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5649 [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.])])
5652 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5653 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5658 AC_SUBST(MOZ_NATIVE_LIBVPX)
5659 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5660 AC_SUBST(MOZ_LIBVPX_LIBS)
5662 if test "$MOZ_WEBM"; then
5664 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5671 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5673 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5674 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5675 dnl We currently require gcc on all arm platforms.
5678 VPX_NEED_OBJ_INT_EXTRACT=
5680 dnl See if we have assembly on this platform.
5681 case "$OS_ARCH:$CPU_ARCH" in
5683 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5687 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5691 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5695 dnl Check for yasm 1.1 or greater.
5696 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5697 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.])
5698 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5699 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.])
5701 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5703 dnl The encoder needs obj_int_extract to get asm offsets.
5707 if test -n "$GNU_AS" ; then
5709 dnl These flags are a lie; they're just used to enable the requisite
5710 dnl opcodes; actual arch detection is done at runtime.
5711 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5712 VPX_DASH_C_FLAG="-c"
5713 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5714 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5719 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5720 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5725 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5726 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5732 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5733 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.])
5736 if test -n "$MOZ_VP8_ENCODER" -a \
5737 -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5738 dnl We prefer to get asm offsets using inline assembler, which the above
5739 dnl compilers can do. When we're not using one of those, we have to fall
5740 dnl back to obj_int_extract, which reads them from a compiled object
5741 dnl file. Unfortunately, that only works if we're compiling on a system
5742 dnl with the header files for the appropriate object file format.
5743 VPX_NEED_OBJ_INT_EXTRACT=1
5746 if test -n "$VPX_X86_ASM"; then
5747 AC_DEFINE(VPX_X86_ASM)
5748 elif test -n "$VPX_ARM_ASM"; then
5749 AC_DEFINE(VPX_ARM_ASM)
5751 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5755 dnl ========================================================
5756 dnl = Disable Wave decoder support
5757 dnl ========================================================
5758 MOZ_ARG_DISABLE_BOOL(wave,
5759 [ --disable-wave Disable Wave decoder support],
5763 if test -n "$MOZ_WAVE"; then
5768 dnl ========================================================
5769 dnl = Handle dependent CUBEB and MEDIA defines
5770 dnl ========================================================
5772 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5773 AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5776 if test -n "$MOZ_SOUNDTOUCH"; then
5777 AC_DEFINE(MOZ_SOUNDTOUCH)
5780 if test -n "$MOZ_CUBEB"; then
5781 AC_DEFINE(MOZ_CUBEB)
5784 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5785 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/])
5788 if test -n "$MOZ_VORBIS"; then
5789 AC_DEFINE(MOZ_VORBIS)
5792 if test -n "$MOZ_TREMOR"; then
5793 AC_DEFINE(MOZ_TREMOR)
5796 if test -n "$MOZ_OPUS"; then
5800 dnl ========================================================
5801 dnl = Check alsa availability on Linux if using sydneyaudio
5802 dnl ========================================================
5804 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5805 if test -n "$MOZ_CUBEB" -a "$OS_TARGET" = "Linux"; then
5809 MOZ_ARG_ENABLE_BOOL(alsa,
5810 [ --enable-alsa Enable Alsa support (default on Linux)],
5814 if test -n "$MOZ_ALSA"; then
5815 AC_DEFINE(MOZ_CUBEB)
5816 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5817 [echo "$MOZ_ALSA_PKG_ERRORS"
5818 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.)])])
5822 AC_SUBST(MOZ_ALSA_CFLAGS)
5823 AC_SUBST(MOZ_ALSA_LIBS)
5825 dnl ========================================================
5826 dnl = Enable PulseAudio
5827 dnl ========================================================
5829 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5830 [ --enable-pulseaudio Enable PulseAudio support (experimental)],
5834 if test -n "$MOZ_PULSEAUDIO"; then
5835 AC_DEFINE(MOZ_CUBEB)
5836 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5837 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5838 AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
5841 AC_SUBST(MOZ_PULSEAUDIO)
5842 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5843 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5845 dnl ========================================================
5846 dnl = Enable GStreamer
5847 dnl ========================================================
5848 if test "$OS_TARGET" = "Linux"; then
5852 MOZ_ARG_ENABLE_BOOL(gstreamer,
5853 [ --enable-gstreamer Enable GStreamer support],
5857 if test "$MOZ_GSTREAMER"; then
5858 # API version, eg 0.10, 1.0 etc
5859 GST_API_VERSION=0.10
5860 # core/base release number
5862 PKG_CHECK_MODULES(GSTREAMER,
5863 gstreamer-$GST_API_VERSION >= $GST_VERSION
5864 gstreamer-app-$GST_API_VERSION
5865 gstreamer-plugins-base-$GST_API_VERSION, ,
5866 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]))
5867 if test -n "$GSTREAMER_LIBS"; then
5868 _SAVE_LDFLAGS=$LDFLAGS
5869 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5870 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5871 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5872 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5874 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.])
5876 LDFLAGS=$_SAVE_LDFLAGS
5878 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])
5881 AC_SUBST(GSTREAMER_CFLAGS)
5882 AC_SUBST(GSTREAMER_LIBS)
5883 AC_SUBST(MOZ_GSTREAMER)
5885 if test -n "$MOZ_GSTREAMER"; then
5886 AC_DEFINE(MOZ_GSTREAMER)
5890 dnl ========================================================
5891 dnl Permissions System
5892 dnl ========================================================
5893 MOZ_ARG_DISABLE_BOOL(permissions,
5894 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5899 dnl ========================================================
5901 dnl ========================================================
5902 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5903 [ --disable-negotiateauth Disable GSS-API negotiation ],
5904 MOZ_AUTH_EXTENSION=,
5905 MOZ_AUTH_EXTENSION=1 )
5907 dnl ========================================================
5908 dnl Pref extensions (autoconfig)
5909 dnl ========================================================
5910 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5911 [ --disable-pref-extensions
5912 Disable pref extensions such as autoconfig],
5913 MOZ_PREF_EXTENSIONS=,
5914 MOZ_PREF_EXTENSIONS=1 )
5916 dnl ========================================================
5917 dnl Searching of system directories for extensions.
5918 dnl Note: this switch is meant to be used for test builds
5919 dnl whose behavior should not depend on what happens to be
5920 dnl installed on the local machine.
5921 dnl ========================================================
5922 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5923 [ --disable-system-extension-dirs
5924 Disable searching system- and account-global
5925 directories for extensions of any kind; use
5926 only profile-specific extension directories],
5927 ENABLE_SYSTEM_EXTENSION_DIRS=,
5928 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5929 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5930 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5933 dnl ========================================================
5934 dnl = Universalchardet
5935 dnl ========================================================
5936 MOZ_ARG_DISABLE_BOOL(universalchardet,
5937 [ --disable-universalchardet
5938 Disable universal encoding detection],
5939 MOZ_UNIVERSALCHARDET=,
5940 MOZ_UNIVERSALCHARDET=1 )
5942 if test -n "${JAVA_BIN_PATH}"; then
5943 dnl Look for javac and jar in the specified path.
5944 JAVA_PATH="$JAVA_BIN_PATH"
5946 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5947 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5950 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5951 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5952 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5953 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5954 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5955 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5957 if test -n "${JAVA_BIN_PATH}" -o \
5958 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5959 if test -z "$JAVA" -o "$JAVA" = ":"; then
5960 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}])
5962 if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5963 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}])
5965 if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5966 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}])
5968 if test -z "$JAR" -o "$JAR" = ":"; then
5969 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}])
5971 if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5972 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}])
5974 if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5975 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}])
5979 dnl ========================================================
5980 dnl = ANGLE OpenGL->D3D translator for WebGL
5981 dnl = * only applies to win32
5982 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5983 dnl ========================================================
5985 MOZ_DIRECTX_SDK_PATH=
5986 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5987 MOZ_D3DCOMPILER_CAB=
5988 MOZ_D3DCOMPILER_DLL=
5989 case "$target_os" in
5991 MOZ_ANGLE_RENDERER=1
5995 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5996 case "${target_cpu}" in
5998 MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
6001 MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
6005 MOZ_ARG_DISABLE_BOOL(webgl,
6006 [ --disable-webgl Disable building of the WebGL implementation],
6007 MOZ_WEBGL_DISABLED=1,
6008 MOZ_WEBGL_DISABLED=)
6010 if test -n "$MOZ_WEBGL_DISABLED"; then
6015 # Locate a DirectX SDK here so we can use it for both ANGLE and
6017 if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
6018 # Get the SDK path from the registry.
6019 # First try to get the June 2010 SDK
6020 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
6021 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
6022 # Otherwise just take whatever comes first
6023 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
6025 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'`
6028 if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
6029 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
6030 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.])
6033 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
6034 test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
6035 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
6036 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
6038 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.])
6041 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
6042 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'`
6044 if test -z "$MOZ_D3DX9_VERSION" ; then
6045 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.])
6048 MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6050 if test -z "$MOZ_D3DCOMPILER_CAB"; then
6051 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.])
6054 MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
6057 dnl ========================================================
6059 dnl ========================================================
6061 MOZ_GAMEPAD_BACKEND=stub
6063 # Gamepad DOM is built on supported platforms by default.
6064 case "$OS_TARGET" in
6072 MOZ_ARG_DISABLE_BOOL(gamepad,
6073 [ --disable-gamepad Disable gamepad support],
6077 if test "$MOZ_GAMEPAD"; then
6078 case "$OS_TARGET" in
6080 MOZ_GAMEPAD_BACKEND=cocoa
6083 if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
6084 if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
6087 elif test "$GCC" != "yes"; then
6090 if test -z "$MOZ_GAMEPAD"; then
6091 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.])
6093 MOZ_GAMEPAD_BACKEND=windows
6096 MOZ_CHECK_HEADER([linux/joystick.h])
6097 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
6098 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.])
6100 MOZ_GAMEPAD_BACKEND=linux
6106 AC_DEFINE(MOZ_GAMEPAD)
6108 AC_SUBST(MOZ_GAMEPAD)
6109 AC_SUBST(MOZ_GAMEPAD_BACKEND)
6111 dnl ========================================================
6112 dnl = Breakpad crash reporting (on by default on supported platforms)
6113 dnl ========================================================
6116 i?86-*-mingw*|x86_64-*-mingw*)
6119 i?86-apple-darwin*|x86_64-apple-darwin*)
6122 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6123 if test "$MOZ_ENABLE_GTK"; then
6127 *-android*|*-linuxandroid*)
6135 MOZ_ARG_DISABLE_BOOL(crashreporter,
6136 [ --disable-crashreporter Disable breakpad crash reporting],
6138 MOZ_CRASHREPORTER=1)
6140 if test -n "$MOZ_CRASHREPORTER"; then
6141 AC_DEFINE(MOZ_CRASHREPORTER)
6143 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
6144 test -z "$SKIP_LIBRARY_CHECKS"; then
6145 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6146 AC_SUBST(MOZ_GTHREAD_CFLAGS)
6147 AC_SUBST(MOZ_GTHREAD_LIBS)
6150 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
6151 AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH. Use --disable-crashreporter.])
6154 if test "$OS_ARCH" = "WINNT"; then
6155 if test -z "$HAVE_64BIT_OS"; then
6156 MOZ_CRASHREPORTER_INJECTOR=1
6157 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
6161 AC_DEFINE_UNQUOTED(BREAKPAD_CUSTOM_STDINT_H, "mozilla/StandardInteger.h")
6163 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6164 [ --with-crashreporter-enable-percent=NN
6165 Enable sending crash reports by default on NN% of users. (default=100)],
6166 [ val=`echo $withval | sed 's/[^0-9]//g'`
6167 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6169 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6170 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6172 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6174 dnl ========================================================
6175 dnl = libjpeg-turbo configuration
6176 dnl ========================================================
6178 if test -z "$MOZ_NATIVE_JPEG"; then
6182 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6183 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
6185 MOZ_LIBJPEG_TURBO=1)
6187 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6188 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6191 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6194 if test -n "$MOZ_LIBJPEG_TURBO"; then
6196 dnl Do we support libjpeg-turbo on this platform?
6197 case "$OS_ARCH:$OS_TEST" in
6199 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6200 LIBJPEG_TURBO_X86_ASM=1
6203 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6204 LIBJPEG_TURBO_X64_ASM=1
6206 WINNT:x86|WINNT:i?86)
6207 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6208 LIBJPEG_TURBO_X86_ASM=1
6211 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6212 LIBJPEG_TURBO_X64_ASM=1
6215 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6216 LIBJPEG_TURBO_ARM_ASM=1
6219 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6220 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6221 LIBJPEG_TURBO_X86_ASM=1
6225 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6226 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6227 LIBJPEG_TURBO_X64_ASM=1
6234 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6235 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6236 dnl it doesn't exist or we have too old of a version.
6237 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6238 LIBJPEG_TURBO_AS=$YASM
6240 if test -z "$LIBJPEG_TURBO_AS" ; then
6241 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.])
6244 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6245 dnl on Linux and 1.1 or newer everywhere else.
6246 if test "$OS_ARCH" = "Linux" ; then
6247 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
6248 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.])
6251 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6252 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.])
6257 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6258 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6259 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6260 echo "Using $AS as the assembler for ARM code."
6261 LIBJPEG_TURBO_AS=$AS
6264 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6265 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6266 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6267 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6268 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6269 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6270 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6271 dnl Warn if we're not building the optimized routines, even though the user
6272 dnl didn't specify --disable-libjpeg-turbo.
6273 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6276 dnl ========================================================
6277 dnl = Enable compilation of specific extension modules
6278 dnl ========================================================
6280 MOZ_ARG_ENABLE_STRING(extensions,
6281 [ --enable-extensions Enable extensions],
6282 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6283 if test "$option" = "yes" -o "$option" = "all"; then
6284 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6285 elif test "$option" = "no" -o "$option" = "none"; then
6287 elif test "$option" = "default"; then
6288 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6289 elif test `echo "$option" | grep -c \^-` != 0; then
6290 option=`echo $option | sed 's/^-//'`
6291 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6293 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6296 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6298 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6299 # Suppress warning on non-X11 platforms
6300 if test -n "$MOZ_X11"; then
6301 AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6303 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6306 dnl Do not build gnomevfs with libxul based apps
6307 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6308 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6311 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6312 # Suppress warning on non-X11 platforms
6313 if test -n "$MOZ_X11"; then
6314 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6316 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6319 dnl Do not build gio with libxul based apps
6320 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6321 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6324 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6326 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6328 AC_SUBST(MOZ_GIO_COMPONENT)
6330 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6331 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6332 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6336 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6338 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6339 dnl when trying to build a nonexistent extension.
6340 for extension in $MOZ_EXTENSIONS; do
6341 if test ! -d "${srcdir}/extensions/${extension}"; then
6342 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6346 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6347 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6350 dnl ========================================================
6351 dnl Build Freetype in the tree
6352 dnl ========================================================
6353 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6354 [ --enable-tree-freetype Enable Tree FreeType],
6355 MOZ_TREE_FREETYPE=1,
6356 MOZ_TREE_FREETYPE= )
6357 if test -n "$MOZ_TREE_FREETYPE"; then
6358 if test -n "$_WIN32_MSVC"; then
6359 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6361 AC_DEFINE(MOZ_TREE_FREETYPE)
6362 AC_SUBST(MOZ_TREE_FREETYPE)
6363 MOZ_ENABLE_CAIRO_FT=1
6364 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6365 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6366 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6367 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6369 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6370 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6371 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6372 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6373 AC_SUBST(CAIRO_FT_CFLAGS)
6376 dnl ========================================================
6378 dnl ========================================================
6379 dnl Abort Windows build if the required major version and
6380 dnl minimum minor version of Unicode NSIS isn't in the path
6381 dnl (unless in case of cross compiling, for which Unicode
6382 dnl is not yet sufficient).
6383 if test "$OS_ARCH" = "WINNT"; then
6384 REQ_NSIS_MAJOR_VER=2
6385 MIN_NSIS_MINOR_VER=46
6386 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensis)
6387 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6388 AC_MSG_RESULT([yes])
6390 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6392 if test ! "$MAKENSISU_VER" = ""; then
6393 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6394 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6396 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6397 if test "$MAKENSISU_VER" = "" || \
6398 test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6399 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6401 if test -z "$CROSS_COMPILE"; then
6402 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.])
6407 elif test -z "$CROSS_COMPILE"; then
6408 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.])
6414 dnl ========================================================
6416 dnl ========================================================
6417 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6418 [ --disable-webapp-runtime Disable Web App Runtime],
6419 MOZ_WEBAPP_RUNTIME=,
6420 MOZ_WEBAPP_RUNTIME=1)
6421 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6424 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6427 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6428 if test "$MOZ_WEBAPP_RUNTIME"; then
6429 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6432 AC_MSG_CHECKING([for tar archiver])
6433 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6434 if test -z "$TAR"; then
6435 AC_MSG_ERROR([no tar archiver found in \$PATH])
6437 AC_MSG_RESULT([$TAR])
6440 AC_MSG_CHECKING([for wget])
6441 AC_CHECK_PROGS(WGET, wget, "")
6442 AC_MSG_RESULT([$WGET])
6445 dnl ========================================================
6447 dnl ========================================================
6449 if test -n "$MOZ_SIGN_CMD"; then
6450 AC_DEFINE(MOZ_SIGNING)
6453 dnl ========================================================
6454 dnl Maintenance Service
6455 dnl ========================================================
6457 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6458 [ --enable-maintenance-service Enable building of maintenanceservice],
6459 MOZ_MAINTENANCE_SERVICE=1,
6460 MOZ_MAINTENANCE_SERVICE= )
6462 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6463 if test "$OS_ARCH" = "WINNT"; then
6464 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6466 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6470 dnl ========================================================
6471 dnl Verify MAR signatures
6472 dnl ========================================================
6474 MOZ_ARG_ENABLE_BOOL(verify-mar,
6475 [ --enable-verify-mar Enable verifying MAR signatures],
6476 MOZ_VERIFY_MAR_SIGNATURE=1,
6477 MOZ_VERIFY_MAR_SIGNATURE= )
6479 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6480 if test "$OS_ARCH" = "WINNT"; then
6481 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6483 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6487 dnl ========================================================
6488 dnl Enable building the signmar program.
6489 dnl This option is much different than the --enable-verify-mar option.
6490 dnl --enable-verify-mar is for enabling the verification check on MAR
6491 dnl files in the updater. The --enable-signmar option is for building
6492 dnl the signmar program.
6493 dnl ========================================================
6495 MOZ_ARG_ENABLE_BOOL(signmar,
6496 [ --enable-signmar Enable building the signmar program],
6497 MOZ_ENABLE_SIGNMAR=1,
6498 MOZ_ENABLE_SIGNMAR= )
6500 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6501 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6504 dnl ========================================================
6506 dnl ========================================================
6508 MOZ_ARG_DISABLE_BOOL(updater,
6509 [ --disable-updater Disable building of updater],
6513 if test -n "$MOZ_UPDATER"; then
6514 AC_DEFINE(MOZ_UPDATER)
6517 # tools/update-packaging is not checked out by default.
6518 MOZ_ARG_ENABLE_BOOL(update-packaging,
6519 [ --enable-update-packaging
6520 Enable tools/update-packaging],
6521 MOZ_UPDATE_PACKAGING=1,
6522 MOZ_UPDATE_PACKAGING= )
6523 AC_SUBST(MOZ_UPDATE_PACKAGING)
6525 dnl ========================================================
6526 dnl build the tests by default
6527 dnl ========================================================
6528 MOZ_ARG_DISABLE_BOOL(tests,
6529 [ --disable-tests Do not build test libraries & programs],
6533 if test -n "$ENABLE_TESTS"; then
6536 AC_DEFINE(MOZ_ENABLE_GTEST)
6537 AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6538 AC_SUBST(MOZ_ENABLE_GTEST)
6539 AC_SUBST(GTEST_HAS_RTTI)
6540 if test -n "$_WIN32_MSVC"; then
6541 AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6543 if test "${OS_TARGET}" = "Android"; then
6544 AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6545 AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6546 AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6547 AC_SUBST(GTEST_OS_LINUX_ANDROID)
6548 AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6549 AC_SUBST(GTEST_HAS_CLONE)
6553 dnl ========================================================
6554 dnl parental controls (for Windows Vista)
6555 dnl ========================================================
6556 MOZ_ARG_DISABLE_BOOL(parental-controls,
6557 [ --disable-parental-controls
6558 Do not build parental controls],
6559 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6560 MOZ_DISABLE_PARENTAL_CONTROLS=)
6561 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6562 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6565 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6567 dnl ========================================================
6568 dnl = Disable DOMCrypto
6569 dnl ========================================================
6570 if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
6571 AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
6573 AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
6575 dnl ========================================================
6576 dnl = Disable libpkix
6577 dnl ========================================================
6578 if test -n "$NSS_NO_LIBPKIX"; then
6579 AC_DEFINE(NSS_NO_LIBPKIX)
6581 AC_SUBST(NSS_NO_LIBPKIX)
6584 dnl ========================================================
6586 dnl = Module specific options
6588 dnl ========================================================
6589 MOZ_ARG_HEADER(Individual module options)
6591 dnl ========================================================
6592 dnl = Disable feed handling components
6593 dnl ========================================================
6594 MOZ_ARG_DISABLE_BOOL(feeds,
6595 [ --disable-feeds Disable feed handling and processing components],
6598 if test -n "$MOZ_FEEDS"; then
6599 AC_DEFINE(MOZ_FEEDS)
6601 if test "$MOZ_BUILD_APP" = "browser"; then
6602 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6606 dnl ========================================================
6607 dnl Check for sqlite
6608 dnl ========================================================
6611 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6612 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6613 MOZ_NATIVE_SQLITE=1,
6614 MOZ_NATIVE_SQLITE= )
6616 if test -z "$MOZ_NATIVE_SQLITE"
6619 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6621 dnl ============================
6622 dnl === SQLite Version check ===
6623 dnl ============================
6624 dnl Check to see if the system SQLite package is new enough.
6625 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6627 dnl ==================================
6628 dnl === SQLITE_SECURE_DELETE check ===
6629 dnl ==================================
6630 dnl Check to see if the system SQLite package is compiled with
6631 dnl SQLITE_SECURE_DELETE enabled.
6632 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6633 _SAVE_CFLAGS="$CFLAGS"
6634 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6636 LIBS="$LIBS $SQLITE_LIBS"
6637 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6639 #include "sqlite3.h"
6641 int main(int argc, char **argv){
6642 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6644 ac_cv_sqlite_secure_delete=yes,
6645 ac_cv_sqlite_secure_delete=no,
6646 ac_cv_sqlite_secure_delete=no
6649 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6650 CFLAGS="$_SAVE_CFLAGS"
6652 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6653 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6656 dnl ===============================
6657 dnl === SQLITE_THREADSAFE check ===
6658 dnl ===============================
6659 dnl Check to see if the system SQLite package is compiled with
6660 dnl SQLITE_THREADSAFE enabled.
6661 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6662 _SAVE_CFLAGS="$CFLAGS"
6663 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6665 LIBS="$LIBS $SQLITE_LIBS"
6666 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6668 #include "sqlite3.h"
6670 int main(int argc, char **argv){
6671 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6673 ac_cv_sqlite_threadsafe=yes,
6674 ac_cv_sqlite_threadsafe=no,
6675 ac_cv_sqlite_threadsafe=no
6678 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6679 CFLAGS="$_SAVE_CFLAGS"
6681 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6682 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6685 dnl ================================
6686 dnl === SQLITE_ENABLE_FTS3 check ===
6687 dnl ================================
6688 dnl check to see if the system SQLite package is compiled with
6689 dnl SQLITE_ENABLE_FTS3 enabled.
6690 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6691 _SAVE_CFLAGS="$CFLAGS"
6692 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6694 LIBS="$LIBS $SQLITE_LIBS"
6695 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6697 #include "sqlite3.h"
6699 int main(int argc, char **argv){
6700 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6702 ac_cv_sqlite_enable_fts3=yes,
6703 ac_cv_sqlite_enable_fts3=no,
6704 ac_cv_sqlite_enable_fts3=no
6707 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6708 CFLAGS="$_SAVE_CFLAGS"
6710 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6711 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6714 dnl =========================================
6715 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6716 dnl =========================================
6717 dnl check to see if the system SQLite package is compiled with
6718 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6719 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6720 _SAVE_CFLAGS="$CFLAGS"
6721 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6723 LIBS="$LIBS $SQLITE_LIBS"
6724 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6726 #include "sqlite3.h"
6728 int main(int argc, char **argv){
6729 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6731 ac_cv_sqlite_enable_unlock_notify=yes,
6732 ac_cv_sqlite_enable_unlock_notify=no,
6733 ac_cv_sqlite_enable_unlock_notify=no
6736 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6737 CFLAGS="$_SAVE_CFLAGS"
6739 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6740 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6744 if test -n "$MOZ_NATIVE_SQLITE"; then
6745 AC_DEFINE(MOZ_NATIVE_SQLITE)
6747 AC_SUBST(MOZ_NATIVE_SQLITE)
6749 dnl ========================================================
6750 dnl = Enable help viewer (off by default)
6751 dnl ========================================================
6752 if test -n "$MOZ_HELP_VIEWER"; then
6753 dnl Do this if defined in confvars.sh
6754 AC_DEFINE(MOZ_HELP_VIEWER)
6757 dnl ========================================================
6758 dnl = Enable safe browsing (anti-phishing)
6759 dnl ========================================================
6760 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6761 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6762 MOZ_SAFE_BROWSING=1,
6763 MOZ_SAFE_BROWSING= )
6764 if test -n "$MOZ_SAFE_BROWSING"; then
6765 AC_DEFINE(MOZ_SAFE_BROWSING)
6767 AC_SUBST(MOZ_SAFE_BROWSING)
6769 dnl ========================================================
6770 dnl = Enable url-classifier
6771 dnl ========================================================
6772 dnl Implicitly enabled by default if building with safe-browsing
6773 if test -n "$MOZ_SAFE_BROWSING"; then
6774 MOZ_URL_CLASSIFIER=1
6776 MOZ_ARG_ENABLE_BOOL(url-classifier,
6777 [ --enable-url-classifier Enable url classifier module],
6778 MOZ_URL_CLASSIFIER=1,
6779 MOZ_URL_CLASSIFIER= )
6780 if test -n "$MOZ_URL_CLASSIFIER"; then
6781 AC_DEFINE(MOZ_URL_CLASSIFIER)
6783 AC_SUBST(MOZ_URL_CLASSIFIER)
6785 dnl ========================================================
6786 dnl = Disable zipwriter
6787 dnl ========================================================
6788 MOZ_ARG_DISABLE_BOOL(zipwriter,
6789 [ --disable-zipwriter Disable zipwriter component],
6792 AC_SUBST(MOZ_ZIPWRITER)
6794 dnl ========================================================
6796 dnl ========================================================
6797 dnl superseded by QtNetwork starting from 4.7
6798 MOZ_ENABLE_LIBCONIC=1
6800 if test -n "$MOZ_ENABLE_QT"; then
6801 if test "$MOZ_ENABLE_QTNETWORK"; then
6802 MOZ_ENABLE_LIBCONIC=
6806 MOZ_ARG_DISABLE_BOOL(libconic,
6807 [ --disable-libconic Disable libconic],
6808 MOZ_ENABLE_LIBCONIC=,
6809 MOZ_ENABLE_LIBCONIC=1 )
6811 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6812 PKG_CHECK_MODULES(LIBCONIC, conic,
6813 MOZ_ENABLE_LIBCONIC=1,
6814 MOZ_ENABLE_LIBCONIC=)
6816 if test "$MOZ_ENABLE_LIBCONIC"; then
6817 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6820 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6821 AC_SUBST(LIBCONIC_CFLAGS)
6822 AC_SUBST(LIBCONIC_LIBS)
6824 dnl ========================================================
6826 dnl ========================================================
6828 MAEMO_SDK_TARGET_VER=-1
6830 MOZ_ARG_WITH_STRING(maemo-version,
6831 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6833 MAEMO_SDK_TARGET_VER=$withval)
6835 case "$MAEMO_SDK_TARGET_VER" in
6837 MOZ_PLATFORM_MAEMO=5
6841 MOZ_PLATFORM_MAEMO=6
6845 dnl We aren't compiling for Maemo, move on.
6848 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6852 if test $MOZ_PLATFORM_MAEMO; then
6853 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6855 if test -z "$MOZ_ENABLE_DBUS"; then
6856 AC_MSG_ERROR([DBus is required when building for Maemo])
6859 MOZ_GFX_OPTIMIZE_MOBILE=1
6860 MOZ_GL_DEFAULT_PROVIDER=EGL
6861 MOZ_MAEMO_LIBLOCATION=
6863 if test $MOZ_PLATFORM_MAEMO = 5; then
6864 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6865 MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6866 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6867 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6868 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6870 AC_SUBST(XCOMPOSITE_LIBS)
6872 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6873 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6874 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6875 if test -z "$_LIB_FOUND"; then
6876 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6880 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6881 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6882 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6883 if test -z "$_LIB_FOUND"; then
6884 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6887 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6888 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6889 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6890 if test -z "$_LIB_FOUND"; then
6891 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6895 if test $MOZ_PLATFORM_MAEMO = 6; then
6897 PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6900 if test "$_LIB_FOUND"; then
6901 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6902 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6903 MOZ_ENABLE_CONTENTMANAGER=1
6904 AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6906 AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6908 AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6910 dnl ========================================================
6911 dnl = Enable meego libcontentaction
6912 dnl ========================================================
6913 MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6914 [ --enable-meegocontentaction Enable meegocontentaction support],
6915 MOZ_MEEGOCONTENTACTION=1,
6916 MOZ_MEEGOCONTENTACTION=)
6918 if test -n "$MOZ_MEEGOCONTENTACTION"; then
6920 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6921 if test "$_LIB_FOUND"; then
6922 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6923 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6924 MOZ_ENABLE_CONTENTACTION=1
6925 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6926 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6930 MOZ_ARG_ENABLE_BOOL(meegotouch,
6931 [ --enable-meegotouch Enable meegotouch support],
6932 MOZ_MEEGOTOUCHENABLED=1,
6933 MOZ_MEEGOTOUCHENABLED=)
6935 if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6936 PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6937 if test "$_LIB_FOUND"; then
6938 MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6939 MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6940 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6942 AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6947 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6948 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6949 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6950 if test "$_LIB_FOUND"; then
6951 MOZ_MAEMO_LIBLOCATION=1
6952 AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6954 AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6956 AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6958 PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6959 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6960 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6961 if test "$_LIB_FOUND"; then
6962 MOZ_ENABLE_MEEGOTOUCHSHARE=1
6963 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6965 AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6967 AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6969 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6970 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6973 dnl ========================================================
6975 dnl ========================================================
6977 MOZ_ARG_WITH_STRING(gl-provider,
6978 [ --with-gl-provider=ID
6979 Set GL provider backend type],
6980 [ val=`echo $withval`
6981 MOZ_GL_PROVIDER="$val"])
6983 if test -n "$MOZ_GL_PROVIDER"; then
6984 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6985 AC_SUBST(MOZ_GL_PROVIDER)
6986 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6988 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6989 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6991 dnl ========================================================
6992 dnl = faststripe theme
6993 dnl ========================================================
6994 MOZ_ARG_ENABLE_BOOL(faststripe,
6995 [ --enable-faststripe Use faststripe theme],
6996 MOZ_THEME_FASTSTRIPE=1,
6997 MOZ_THEME_FASTSTRIPE= )
6998 AC_SUBST(MOZ_THEME_FASTSTRIPE)
7000 dnl ========================================================
7002 dnl = Feature options that require extra sources to be pulled
7004 dnl ========================================================
7005 dnl MOZ_ARG_HEADER(Features that require extra sources)
7007 dnl ========================================================
7009 dnl = Runtime debugging and Optimization Options
7011 dnl ========================================================
7012 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
7014 dnl ========================================================
7015 dnl enable mobile optimizations
7016 dnl ========================================================
7017 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7018 [ --enable-mobile-optimize
7019 Enable mobile optimizations],
7020 MOZ_GFX_OPTIMIZE_MOBILE=1)
7022 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7024 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7025 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7028 dnl ========================================================
7029 dnl = Enable code optimization. ON by default.
7030 dnl ========================================================
7031 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7032 MOZ_OPTIMIZE_FLAGS="-O"
7035 MOZ_ARG_ENABLE_STRING(optimize,
7036 [ --disable-optimize Disable compiler optimization
7037 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7038 [ if test "$enableval" != "no"; then
7040 if test -n "$enableval" -a "$enableval" != "yes"; then
7041 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7046 fi ], MOZ_OPTIMIZE=1)
7048 MOZ_SET_FRAMEPTR_FLAGS
7050 if test "$COMPILE_ENVIRONMENT"; then
7051 if test -n "$MOZ_OPTIMIZE"; then
7052 AC_MSG_CHECKING([for valid optimization flags])
7053 _SAVE_CFLAGS=$CFLAGS
7054 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7055 AC_TRY_COMPILE([#include <stdio.h>],
7056 [printf("Hello World\n");],
7059 AC_MSG_RESULT([$_results])
7060 if test "$_results" = "no"; then
7061 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7063 CFLAGS=$_SAVE_CFLAGS
7065 fi # COMPILE_ENVIRONMENT
7067 AC_SUBST(MOZ_OPTIMIZE)
7068 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
7069 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7070 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7071 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
7072 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7073 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
7075 dnl ========================================================
7076 dnl = Enable any treating of compile warnings as errors
7077 dnl ========================================================
7078 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
7079 [ --enable-warnings-as-errors
7080 Enable treating of warnings as errors],
7081 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
7082 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
7083 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
7084 WARNINGS_AS_ERRORS=''
7087 dnl ========================================================
7088 dnl = Disable runtime logging checks
7089 dnl ========================================================
7090 MOZ_ARG_DISABLE_BOOL(logging,
7091 [ --disable-logging Disable logging facilities],
7092 NS_DISABLE_LOGGING=1,
7093 NS_DISABLE_LOGGING= )
7094 if test "$NS_DISABLE_LOGGING"; then
7095 AC_DEFINE(NS_DISABLE_LOGGING)
7097 AC_DEFINE(MOZ_LOGGING)
7100 dnl ========================================================
7101 dnl = This will enable logging of addref, release, ctor, dtor.
7102 dnl ========================================================
7103 _ENABLE_LOGREFCNT=42
7104 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7105 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
7106 _ENABLE_LOGREFCNT=1,
7107 _ENABLE_LOGREFCNT= )
7108 if test "$_ENABLE_LOGREFCNT" = "1"; then
7109 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7110 elif test -z "$_ENABLE_LOGREFCNT"; then
7111 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7114 dnl ========================================================
7115 dnl moz_dump_painting
7116 dnl ========================================================
7117 MOZ_ARG_ENABLE_BOOL(dump-painting,
7118 [ --enable-dump-painting Enable paint debugging.],
7119 MOZ_DUMP_PAINTING=1,
7120 MOZ_DUMP_PAINTING= )
7121 if test -n "$MOZ_DUMP_PAINTING"; then
7122 AC_DEFINE(MOZ_DUMP_PAINTING)
7123 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
7125 if test -n "$MOZ_DEBUG"; then
7126 AC_DEFINE(MOZ_DUMP_PAINTING)
7129 dnl ========================================================
7130 dnl = Enable trace malloc
7131 dnl ========================================================
7132 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7133 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7134 [ --enable-trace-malloc Enable malloc tracing; also disables DMD and jemalloc],
7137 if test "$NS_TRACE_MALLOC"; then
7138 # Please, Mr. Linker Man, don't take away our symbol names
7139 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7141 AC_DEFINE(NS_TRACE_MALLOC)
7143 AC_SUBST(NS_TRACE_MALLOC)
7145 dnl ========================================================
7147 dnl ========================================================
7149 MOZ_ARG_ENABLE_BOOL(dmd,
7150 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
7154 if test "$NS_TRACE_MALLOC"; then # trace-malloc disables DMD
7157 if test "$MOZ_DMD"; then
7161 if test "${CPU_ARCH}" = "arm"; then
7162 CFLAGS="$CFLAGS -funwind-tables"
7163 CXXFLAGS="$CXXFLAGS -funwind-tables"
7166 MOZ_MEMORY=1 # DMD enables jemalloc
7167 MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
7171 dnl ========================================================
7172 dnl = Enable jemalloc
7173 dnl ========================================================
7174 MOZ_ARG_ENABLE_BOOL(jemalloc,
7175 [ --enable-jemalloc Replace memory allocator with jemalloc],
7179 if test "$NS_TRACE_MALLOC"; then
7183 if test "${OS_TARGET}" = "Android"; then
7184 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
7186 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
7187 dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
7188 if test -z "$GNU_CC"; then
7189 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7191 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
7194 dnl On other Unix systems, we only want to link executables against mozglue
7195 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7196 dnl On other Unix systems, where mozglue is a static library, jemalloc is
7197 dnl separated for the SDK, so we need to add it here.
7198 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
7199 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
7201 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
7202 if test -n "$GNU_CC"; then
7203 dnl And we need mozglue symbols to be exported.
7204 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
7206 if test "$MOZ_LINKER" = 1; then
7207 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
7211 dnl ========================================================
7212 dnl = Enable dynamic replacement of malloc implementation
7213 dnl ========================================================
7214 MOZ_ARG_ENABLE_BOOL(replace-malloc,
7215 [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
7216 MOZ_REPLACE_MALLOC=1,
7217 MOZ_REPLACE_MALLOC= )
7219 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
7220 dnl We don't want to enable jemalloc unconditionally because it may be a
7221 dnl deliberate choice not to enable it (bug 702250, for instance)
7222 AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
7223 elif test -n "$MOZ_REPLACE_MALLOC"; then
7224 MOZ_NATIVE_JEMALLOC=
7226 dnl Replace-malloc Mac linkage quirks
7227 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
7228 AC_CACHE_CHECK([how to do weak dynamic linking],
7229 ac_cv_weak_dynamic_linking,
7230 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
7231 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
7232 test -s conftest${DLL_SUFFIX}; then
7233 dnl There are several ways the linker can put link edit rules in a binary:
7234 dnl - classic info only (for OSX < 10.6)
7235 dnl - dyld info only
7237 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
7242 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
7247 dnl With classic info, we need to build with -flat_namespace.
7248 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
7249 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
7250 dnl forgets to set the weak flag in the dyld info.
7251 dnl See http://glandium.org/blog/?p=2764 for more details.
7253 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
7254 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
7255 dnl - "flat namespace" when -flat_namespace alone is needed
7256 dnl - "dummy library" when a dummy library and -flat_namespace are needed
7257 dnl - "compiler support" when nothing is needed
7258 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
7259 if test -n "$_CLASSIC_INFO"; then
7260 ac_cv_weak_dynamic_linking="flat namespace"
7262 ac_cv_weak_dynamic_linking="compiler support"
7265 if test -n "$_DYLD_INFO"; then
7266 ac_cv_weak_dynamic_linking="dummy library"
7268 ac_cv_weak_dynamic_linking="flat namespace"
7272 AC_ERROR([couldn't compile a simple C file])
7275 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
7278 AC_SUBST(MOZ_REPLACE_MALLOC)
7279 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
7281 dnl ========================================================
7282 dnl = Jemalloc build setup
7283 dnl ========================================================
7284 if test -z "$MOZ_MEMORY"; then
7285 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
7286 MOZ_NATIVE_JEMALLOC=1
7287 AC_CHECK_FUNCS(mallctl nallocm,,
7288 [MOZ_NATIVE_JEMALLOC=
7290 if test -n "$MOZ_NATIVE_JEMALLOC"; then
7292 AC_DEFINE(MOZ_MEMORY)
7293 AC_DEFINE(MOZ_JEMALLOC3)
7294 AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7299 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7300 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.])
7305 dnl Don't try to run compiler tests on Windows
7306 if test "$OS_ARCH" = "WINNT"; then
7307 if test -z "$HAVE_64BIT_OS"; then
7308 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7310 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7313 AC_CHECK_SIZEOF([int *], [4])
7314 case "${ac_cv_sizeof_int_p}" in
7316 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7319 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7322 AC_MSG_ERROR([Unexpected pointer size])
7327 AC_DEFINE(MOZ_MEMORY)
7328 if test -n "$MOZ_JEMALLOC3"; then
7329 AC_DEFINE(MOZ_JEMALLOC3)
7331 if test "x$MOZ_DEBUG" = "x1"; then
7332 AC_DEFINE(MOZ_MEMORY_DEBUG)
7334 dnl The generic feature tests that determine how to compute ncpus are long and
7335 dnl complicated. Therefore, simply define special cpp variables for the
7336 dnl platforms we have special knowledge of.
7339 AC_DEFINE(MOZ_MEMORY_DARWIN)
7342 AC_DEFINE(MOZ_MEMORY_BSD)
7344 *-android*|*-linuxandroid*)
7345 AC_DEFINE(MOZ_MEMORY_LINUX)
7346 AC_DEFINE(MOZ_MEMORY_ANDROID)
7347 if test -z "$gonkdir"; then
7350 AC_DEFINE(MOZ_MEMORY_GONK)
7355 AC_DEFINE(MOZ_MEMORY_LINUX)
7358 AC_DEFINE(MOZ_MEMORY_BSD)
7361 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7364 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7365 if test -z "$MOZ_DEBUG"; then
7366 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7368 WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7370 dnl Look for a broken crtdll.obj
7371 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7372 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7373 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7374 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7375 dnl Also pass this to NSPR/NSS
7376 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7378 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7385 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7389 AC_SUBST(MOZ_MEMORY)
7390 AC_SUBST(MOZ_JEMALLOC3)
7391 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7392 AC_SUBST(MOZ_GLUE_LDFLAGS)
7393 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7394 AC_SUBST(WIN32_CRT_LIBS)
7395 dnl Need to set this for make because NSS doesn't have configure
7398 dnl We need to wrap dlopen and related functions on Android because we use
7400 if test "$OS_TARGET" = Android; then
7401 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7402 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7403 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7404 if test -z "$gonkdir"; then
7405 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7406 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"
7410 dnl ========================================================
7411 dnl = Use malloc wrapper lib
7412 dnl ========================================================
7413 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7414 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7418 if test -n "$_WRAP_MALLOC"; then
7419 if test -n "$GNU_CC"; then
7420 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7421 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7422 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7423 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7424 dnl Wrap operator new and operator delete on Android.
7425 if test "$OS_TARGET" = "Android"; then
7426 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7427 dnl Wrap the nothrow variants too.
7428 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7431 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7435 dnl ========================================================
7436 dnl = Location of malloc wrapper lib
7437 dnl ========================================================
7438 MOZ_ARG_WITH_STRING(wrap-malloc,
7439 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7440 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7442 dnl ========================================================
7443 dnl = Use JS Call tracing
7444 dnl ========================================================
7445 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7446 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7447 MOZ_TRACE_JSCALLS=1,
7448 MOZ_TRACE_JSCALLS= )
7449 if test -n "$MOZ_TRACE_JSCALLS"; then
7450 AC_DEFINE(MOZ_TRACE_JSCALLS)
7453 dnl ========================================================
7454 dnl = Use incremental GC
7455 dnl ========================================================
7457 MOZ_ARG_DISABLE_BOOL(gcincremental,
7458 [ --disable-gcincremental Disable incremental GC],
7460 if test -n "$JSGC_INCREMENTAL"; then
7461 AC_DEFINE(JSGC_INCREMENTAL)
7464 dnl ========================================================
7465 dnl Zealous JavaScript GC
7466 dnl ========================================================
7467 MOZ_ARG_ENABLE_BOOL(gczeal,
7468 [ --enable-gczeal Enable zealous JavaScript GCing],
7471 if test -n "$JS_GC_ZEAL"; then
7472 AC_DEFINE(JS_GC_ZEAL)
7475 dnl ========================================================
7476 dnl JS opt-mode assertions and minidump instrumentation
7477 dnl ========================================================
7478 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7479 [ --enable-js-diagnostics
7480 Enable JS diagnostic assertions and breakpad data],
7481 JS_CRASH_DIAGNOSTICS=1,
7482 JS_CRASH_DIAGNOSTICS= )
7483 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7484 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7488 MOZ_CHECK_COMPILER_WRAPPER
7490 dnl ========================================================
7491 dnl = Enable static checking using gcc-dehydra
7492 dnl ========================================================
7494 MOZ_ARG_WITH_STRING(static-checking,
7495 [ --with-static-checking=path/to/gcc_dehydra.so
7496 Enable static checking of code using GCC-dehydra],
7497 DEHYDRA_PATH=$withval,
7500 if test -n "$DEHYDRA_PATH"; then
7501 if test ! -f "$DEHYDRA_PATH"; then
7502 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7504 AC_DEFINE(NS_STATIC_CHECKING)
7506 AC_SUBST(DEHYDRA_PATH)
7508 dnl ========================================================
7509 dnl = Enable using the clang plugin to build
7510 dnl ========================================================
7512 MOZ_ARG_ENABLE_BOOL(clang-plugin,
7513 [ --enable-clang-plugin Enable building with the mozilla clang plugin ],
7514 ENABLE_CLANG_PLUGIN=1,
7515 ENABLE_CLANG_PLUGIN= )
7516 if test -n "$ENABLE_CLANG_PLUGIN"; then
7517 if test -z "$CLANG_CC"; then
7518 AC_MSG_ERROR([Can't use clang plugin without clang.])
7520 AC_DEFINE(MOZ_CLANG_PLUGIN)
7523 AC_SUBST(ENABLE_CLANG_PLUGIN)
7525 dnl ========================================================
7526 dnl = Enable stripping of libs & executables
7527 dnl ========================================================
7528 MOZ_ARG_ENABLE_BOOL(strip,
7529 [ --enable-strip Enable stripping of libs & executables ],
7533 dnl ========================================================
7534 dnl = Enable stripping of libs & executables when packaging
7535 dnl ========================================================
7536 MOZ_ARG_ENABLE_BOOL(install-strip,
7537 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7541 dnl ========================================================
7542 dnl = --enable-elf-dynstr-gc
7543 dnl ========================================================
7544 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7545 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7546 USE_ELF_DYNSTR_GC=1,
7547 USE_ELF_DYNSTR_GC= )
7549 dnl ========================================================
7550 dnl = --disable-elf-hack
7551 dnl ========================================================
7554 MOZ_ARG_DISABLE_BOOL(elf-hack,
7555 [ --disable-elf-hack Disable elf hacks],
7559 # Disable elf hack for profiling because the built in profiler
7560 # doesn't read the segments properly with elf hack. This is
7561 # temporary and should be fixed soon in the profiler.
7562 if test "$MOZ_PROFILING" = 1; then
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 "$USE_ELF_HACK" = 1; 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.
7594 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7595 LINK_WITH_PT_GNU_RELRO,
7596 [echo "int main() {return 0;}" > conftest.${ac_ext}
7597 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7598 test -s conftest${ac_exeext}; then
7599 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7600 LINK_WITH_PT_GNU_RELRO=yes
7602 LINK_WITH_PT_GNU_RELRO=no
7605 dnl We really don't expect to get here, but just in case
7606 AC_ERROR([couldn't compile a simple C file])
7609 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7610 AC_MSG_WARN([Disabling elfhack])
7615 dnl ========================================================
7616 dnl = libstdc++ compatibility hacks
7617 dnl ========================================================
7620 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7621 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7624 AC_SUBST(STDCXX_COMPAT)
7626 if test -n "$STDCXX_COMPAT"; then
7627 eval $(CXX="$CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7628 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7629 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7632 dnl ========================================================
7634 dnl = Profiling and Instrumenting
7636 dnl ========================================================
7637 MOZ_ARG_HEADER(Profiling and Instrumenting)
7639 dnl ========================================================
7640 dnl = Enable runtime visual profiling logger
7641 dnl ========================================================
7642 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7643 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7644 MOZ_VISUAL_EVENT_TRACER=1,
7645 MOZ_VISUAL_EVENT_TRACER=)
7646 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7647 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7650 dnl ========================================================
7651 dnl Turn on reflow counting
7652 dnl ========================================================
7653 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7654 [ --enable-reflow-perf Enable reflow performance tracing],
7657 if test -n "$MOZ_REFLOW_PERF"; then
7658 AC_DEFINE(MOZ_REFLOW_PERF)
7661 dnl ========================================================
7662 dnl Enable code size metrics.
7663 dnl ========================================================
7664 MOZ_ARG_ENABLE_BOOL(codesighs,
7665 [ --enable-codesighs Enable code size analysis tools],
7666 _ENABLE_CODESIGHS=1,
7667 _ENABLE_CODESIGHS= )
7668 if test -n "$_ENABLE_CODESIGHS"; then
7669 if test -d $srcdir/tools/codesighs; then
7672 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7676 dnl ========================================================
7677 dnl = Enable Radio Interface for B2G (Gonk usually)
7678 dnl ========================================================
7679 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7680 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7683 if test -n "$MOZ_B2G_RIL"; then
7684 AC_DEFINE(MOZ_B2G_RIL)
7686 AC_SUBST(MOZ_B2G_RIL)
7688 dnl ========================================================
7689 dnl = Enable Radio FM for B2G (Gonk usually)
7690 dnl ========================================================
7691 if test -n "$MOZ_B2G_FM"; then
7692 AC_DEFINE(MOZ_B2G_FM)
7694 AC_SUBST(MOZ_B2G_FM)
7696 dnl ========================================================
7697 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7698 dnl ========================================================
7699 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7700 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7703 if test -n "$MOZ_B2G_BT"; then
7704 AC_DEFINE(MOZ_B2G_BT)
7706 AC_SUBST(MOZ_B2G_BT)
7708 dnl ========================================================
7709 dnl = Enable Support for Time Manager API
7710 dnl ========================================================
7711 if test -n "$MOZ_TIME_MANAGER"; then
7712 AC_DEFINE(MOZ_TIME_MANAGER)
7714 AC_SUBST(MOZ_TIME_MANAGER)
7716 dnl ========================================================
7717 dnl = Enable Camera Interface for B2G (Gonk usually)
7718 dnl ========================================================
7719 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7720 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7723 if test -n "$MOZ_B2G_CAMERA"; then
7724 AC_DEFINE(MOZ_B2G_CAMERA)
7726 AC_SUBST(MOZ_B2G_CAMERA)
7728 dnl ========================================================
7729 dnl = Enable Support B2G-specific changes to the NSS
7730 dnl = certificate trust database.
7731 dnl ========================================================
7732 if test -n "$MOZ_B2G_CERTDATA"; then
7733 AC_DEFINE(MOZ_B2G_CERTDATA)
7735 AC_SUBST(MOZ_B2G_CERTDATA)
7737 dnl ========================================================
7738 dnl = Enable Support for Payment API
7739 dnl ========================================================
7740 if test -n "$MOZ_PAY"; then
7745 dnl ========================================================
7746 dnl = Enable Support for AudioChannelManager API
7747 dnl ========================================================
7748 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7749 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7751 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7753 dnl ========================================================
7754 dnl = Support for demangling undefined symbols
7755 dnl ========================================================
7756 if test -z "$SKIP_LIBRARY_CHECKS"; then
7759 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7763 # Demangle only for debug or trace-malloc or DMD builds
7764 MOZ_DEMANGLE_SYMBOLS=
7765 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7766 MOZ_DEMANGLE_SYMBOLS=1
7767 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7769 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7771 dnl ========================================================
7772 dnl = Support for gcc stack unwinding (from gcc 3.3)
7773 dnl ========================================================
7774 if test -z "$SKIP_LIBRARY_CHECKS"; then
7775 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7778 dnl ========================================================
7780 dnl ========================================================
7782 MOZ_ARG_WITH_STRING(jitreport-granularity,
7783 [ --jitreport-granularity=N
7784 Default granularity at which to report JIT code
7787 1 - code ranges for whole functions only
7788 2 - per-line information
7789 3 - per-op information],
7790 JITREPORT_GRANULARITY=$withval,
7791 JITREPORT_GRANULARITY=3)
7793 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7795 dnl ========================================================
7799 dnl ========================================================
7800 MOZ_ARG_HEADER(Misc. Options)
7802 dnl ========================================================
7803 dnl update xterm title
7804 dnl ========================================================
7805 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7806 [ --enable-xterm-updates Update XTERM titles with current command.],
7810 dnl =========================================================
7812 dnl =========================================================
7813 MOZ_ARG_ENABLE_STRING([chrome-format],
7814 [ --enable-chrome-format=jar|flat|omni
7815 Select FORMAT of chrome files during packaging],
7816 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7818 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7819 MOZ_CHROME_FILE_FORMAT=jar
7822 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7823 AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7826 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7827 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7828 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7829 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7832 dnl =========================================================
7833 dnl Omnijar packaging (bug 552121)
7834 dnl =========================================================
7835 dnl Omnijar packaging is compatible with flat packaging.
7836 dnl In unpackaged builds, omnijar looks for files as if
7837 dnl things were flat packaged. After packaging, all files
7838 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7839 dnl is set to flat since putting files into jars is only
7840 dnl done during packaging with omnijar.
7841 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7843 AC_DEFINE(MOZ_OMNIJAR)
7845 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7846 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7847 MOZ_CHROME_FILE_FORMAT=flat
7849 MOZ_CHROME_FILE_FORMAT=symlink
7852 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7853 dnl Fennec's static resources live in the assets/ folder of the
7854 dnl APK. Adding a path to the name here works because we only
7855 dnl have one omnijar file in the final package (which is not the
7856 dnl case on desktop), and necessitates some contortions during
7857 dnl packaging so that the resources in the omnijar are considered
7858 dnl as rooted at / and not as rooted at assets/ (which again is
7859 dnl not the case on desktop: there are omnijars rooted at webrtc/,
7860 dnl etc). packager.mk handles changing the rooting of the single
7862 OMNIJAR_NAME=assets/omni.ja
7864 OMNIJAR_NAME=omni.ja
7867 AC_SUBST(OMNIJAR_NAME)
7868 AC_SUBST(MOZ_OMNIJAR)
7869 AC_SUBST(MOZ_PACKAGER_FORMAT)
7871 dnl ========================================================
7872 dnl = Define default location for MOZILLA_FIVE_HOME
7873 dnl ========================================================
7874 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7875 [ --with-default-mozilla-five-home
7876 Set the default value for MOZILLA_FIVE_HOME],
7877 [ val=`echo $withval`
7878 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7880 dnl ========================================================
7881 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7882 dnl ========================================================
7883 MOZ_ARG_WITH_STRING(user-appdir,
7884 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7885 [ val=`echo $withval`
7886 if echo "$val" | grep "\/" >/dev/null; then
7887 AC_MSG_ERROR("Homedir must be single relative path.")
7892 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7894 dnl ========================================================
7895 dnl = Doxygen configuration
7896 dnl ========================================================
7897 dnl Use commas to specify multiple dirs to this arg
7898 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7899 MOZ_ARG_WITH_STRING(doc-input-dirs,
7900 [ --with-doc-input-dirs=DIRS
7901 Header/idl dirs to create docs from],
7902 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7903 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7905 dnl Use commas to specify multiple dirs to this arg
7906 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7907 MOZ_ARG_WITH_STRING(doc-include-dirs,
7908 [ --with-doc-include-dirs=DIRS
7909 Include dirs to preprocess doc headers],
7910 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7911 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7913 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7914 MOZ_ARG_WITH_STRING(doc-output-dir,
7915 [ --with-doc-output-dir=DIR
7916 Dir to generate docs into],
7917 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7918 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7920 if test -z "$SKIP_COMPILER_CHECKS"; then
7921 dnl ========================================================
7923 dnl = Compiler Options
7925 dnl ========================================================
7926 MOZ_ARG_HEADER(Compiler Options)
7928 dnl ========================================================
7929 dnl Check for gcc -pipe support
7930 dnl ========================================================
7931 AC_MSG_CHECKING([for -pipe support])
7932 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7933 dnl Any gcc that supports firefox supports -pipe.
7934 CFLAGS="$CFLAGS -pipe"
7935 CXXFLAGS="$CXXFLAGS -pipe"
7936 AC_MSG_RESULT([yes])
7941 dnl ========================================================
7942 dnl Profile guided optimization (gcc checks)
7943 dnl ========================================================
7944 dnl Test for profiling options
7945 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7947 _SAVE_CFLAGS="$CFLAGS"
7948 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7950 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7951 AC_TRY_COMPILE([], [return 0;],
7952 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7953 result="yes" ], result="no")
7954 AC_MSG_RESULT([$result])
7956 if test $result = "yes"; then
7957 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7958 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7959 PROFILE_USE_LDFLAGS="-fprofile-use"
7962 CFLAGS="$_SAVE_CFLAGS"
7964 if test -n "$INTEL_CC"; then
7965 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7966 PROFILE_GEN_LDFLAGS=
7967 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7968 PROFILE_USE_LDFLAGS=
7971 dnl Sun Studio on Solaris
7972 if test "$SOLARIS_SUNPRO_CC"; then
7973 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7974 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7975 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7976 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7979 AC_SUBST(PROFILE_GEN_CFLAGS)
7980 AC_SUBST(PROFILE_GEN_LDFLAGS)
7981 AC_SUBST(PROFILE_USE_CFLAGS)
7982 AC_SUBST(PROFILE_USE_LDFLAGS)
7986 dnl ========================================================
7987 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7988 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7989 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7990 dnl ========================================================
7991 _SAVE_CXXFLAGS=$CXXFLAGS
7992 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7993 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7994 ac_nscap_nonconst_opeq_bug,
8003 template <class T, class U>
8004 int operator==(const Pointer<T>& rhs, U* lhs)
8006 return rhs.myPtr == lhs;
8009 template <class T, class U>
8010 int operator==(const Pointer<T>& rhs, const U* lhs)
8012 return rhs.myPtr == lhs;
8020 ac_nscap_nonconst_opeq_bug="no",
8021 ac_nscap_nonconst_opeq_bug="yes")])
8022 CXXFLAGS="$_SAVE_CXXFLAGS"
8024 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
8025 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
8027 fi # ! SKIP_COMPILER_CHECKS
8029 AC_DEFINE(CPP_THROW_NEW, [throw()])
8032 if test "$COMPILE_ENVIRONMENT"; then
8034 fi # COMPILE_ENVIRONMENT
8036 dnl ========================================================
8038 dnl = Build depencency options
8040 dnl ========================================================
8041 MOZ_ARG_HEADER(Build dependencies)
8043 if test "$GNU_CC" -a "$GNU_CXX"; then
8044 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
8045 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
8046 elif test "$SOLARIS_SUNPRO_CC"; then
8049 dnl Don't override this for MSVC
8050 if test -z "$_WIN32_MSVC"; then
8051 _USE_CPP_INCLUDE_FLAG=
8052 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8053 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8055 echo '#include <stdio.h>' > dummy-hello.c
8057 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8059 if test -z "$CL_INCLUDES_PREFIX"; then
8060 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8062 AC_SUBST(CL_INCLUDES_PREFIX)
8067 dnl ========================================================
8069 dnl = Static Build Options
8071 dnl ========================================================
8072 MOZ_ARG_HEADER(Static build options)
8074 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8075 if test "$OS_ARCH" = "WINNT"; then
8079 MOZ_ARG_ENABLE_BOOL(shared-js,
8080 [ --enable-shared-js
8081 Create a shared JavaScript library.],
8085 if test -n "$ENABLE_SHARED_JS"; then
8087 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
8089 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
8090 AC_DEFINE(MOZ_STATIC_JS)
8092 AC_SUBST(JS_SHARED_LIBRARY)
8094 AC_SUBST(LIBXUL_LIBS)
8095 XPCOM_LIBS="$LIBXUL_LIBS"
8097 dnl ========================================================
8099 dnl = Standalone module options
8101 dnl ========================================================
8102 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8105 dnl ========================================================
8107 if test -z "$SKIP_PATH_CHECKS"; then
8108 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8109 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8110 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8115 if test -z "${GLIB_GMODULE_LIBS}" \
8116 -a -n "${GLIB_CONFIG}"\
8117 -a "${GLIB_CONFIG}" != no\
8119 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8122 AC_SUBST(GLIB_CFLAGS)
8124 AC_SUBST(GLIB_GMODULE_LIBS)
8126 dnl ========================================================
8127 dnl Graphics checks.
8128 dnl ========================================================
8130 if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
8136 MOZ_ARG_ENABLE_BOOL(skia,
8137 [ --enable-skia Enable use of Skia],
8141 if test "$USE_FC_FREETYPE"; then
8142 if test "$COMPILE_ENVIRONMENT"; then
8143 dnl ========================================================
8144 dnl = Check for freetype2 and its functionality
8145 dnl ========================================================
8146 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
8148 if test "$_HAVE_FREETYPE2"; then
8150 _SAVE_CFLAGS="$CFLAGS"
8151 LIBS="$LIBS $FT2_LIBS"
8152 CFLAGS="$CFLAGS $FT2_CFLAGS"
8154 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
8155 ac_cv_member_FT_Bitmap_Size_y_ppem,
8156 [AC_TRY_COMPILE([#include <ft2build.h>
8157 #include FT_FREETYPE_H],
8159 if (sizeof s.y_ppem) return 0;
8161 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
8162 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
8163 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
8164 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
8166 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
8168 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
8169 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
8170 [FT_Bitmap_Size structure includes y_ppem field])
8172 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
8175 CFLAGS="$_SAVE_CFLAGS"
8178 _SAVE_CPPFLAGS="$CPPFLAGS"
8179 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8180 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8181 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8182 CPPFLAGS="$_SAVE_CPPFLAGS"
8184 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8187 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
8189 if test "$MOZ_PANGO"; then
8190 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
8191 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
8193 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
8194 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
8199 dnl ========================================================
8200 dnl Check for pixman and cairo
8201 dnl ========================================================
8204 MOZ_ARG_ENABLE_BOOL(system-cairo,
8205 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8210 MOZ_ARG_ENABLE_BOOL(system-pixman,
8211 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8213 MOZ_TREE_PIXMAN=force,
8216 # System cairo depends on system pixman
8217 if test "$MOZ_TREE_PIXMAN" = "force"; then
8218 if test -z "$MOZ_TREE_CAIRO"; then
8219 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
8223 elif test -z "$MOZ_TREE_CAIRO"; then
8227 if test "$MOZ_TREE_PIXMAN"; then
8228 AC_DEFINE(MOZ_TREE_PIXMAN)
8229 MOZ_PIXMAN_CFLAGS=""
8230 MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8232 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8233 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8234 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8236 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8237 AC_SUBST(MOZ_PIXMAN_LIBS)
8239 # Check for headers defining standard int types.
8240 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8242 if test "$MOZ_TREE_CAIRO"; then
8243 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8244 AC_DEFINE(MOZ_TREE_CAIRO)
8246 # For now we assume that we will have a uint64_t available through
8247 # one of the above headers or mozstdint.h.
8248 AC_DEFINE(HAVE_UINT64_T)
8250 # Define macros for cairo-features.h
8251 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8252 if test "$MOZ_X11"; then
8253 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8254 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8255 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8256 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8257 MOZ_ENABLE_CAIRO_FT=1
8258 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8260 case "$MOZ_WIDGET_TOOLKIT" in
8262 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8265 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8266 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8267 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8270 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8271 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8272 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8273 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8274 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8275 MOZ_ENABLE_D2D_SURFACE=1
8276 MOZ_ENABLE_DWRITE_FONT=1
8278 WIN32_DWRITE_FONT_FEATURE=
8279 WIN32_D2D_SURFACE_FEATURE=
8282 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8284 dnl D3D10 Layers depend on D2D Surfaces.
8285 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8286 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8290 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8291 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8292 MOZ_ENABLE_CAIRO_FT=1
8293 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8294 CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8298 if test "$USE_FC_FREETYPE"; then
8299 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8301 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8302 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8303 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8304 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8305 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8306 AC_SUBST(CAIRO_FT_CFLAGS)
8308 AC_SUBST(PS_SURFACE_FEATURE)
8309 AC_SUBST(PDF_SURFACE_FEATURE)
8310 AC_SUBST(SVG_SURFACE_FEATURE)
8311 AC_SUBST(XLIB_SURFACE_FEATURE)
8312 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8313 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8314 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8315 AC_SUBST(WIN32_SURFACE_FEATURE)
8316 AC_SUBST(OS2_SURFACE_FEATURE)
8317 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8318 AC_SUBST(FT_FONT_FEATURE)
8319 AC_SUBST(FC_FONT_FEATURE)
8320 AC_SUBST(WIN32_FONT_FEATURE)
8321 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8322 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8323 AC_SUBST(QUARTZ_FONT_FEATURE)
8324 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8325 AC_SUBST(QT_SURFACE_FEATURE)
8326 AC_SUBST(TEE_SURFACE_FEATURE)
8328 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8329 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8331 if test "$MOZ_X11"; then
8332 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8335 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8337 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8338 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8339 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8340 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8341 if test "$MOZ_X11"; then
8342 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8343 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8344 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8345 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8349 AC_SUBST(MOZ_TREE_CAIRO)
8350 AC_SUBST(MOZ_CAIRO_CFLAGS)
8351 AC_SUBST(MOZ_CAIRO_LIBS)
8352 AC_SUBST(MOZ_CAIRO_OSLIBS)
8353 AC_SUBST(MOZ_TREE_PIXMAN)
8355 dnl ========================================================
8357 dnl ========================================================
8359 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8362 dnl ========================================================
8364 dnl ========================================================
8365 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8366 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8368 dnl ========================================================
8370 dnl ========================================================
8371 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8372 AC_SUBST(MOZ_GRAPHITE_LIBS)
8374 dnl ========================================================
8376 dnl ========================================================
8377 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8378 AC_SUBST(MOZ_OTS_LIBS)
8380 dnl ========================================================
8382 dnl ========================================================
8383 if test "$MOZ_ENABLE_SKIA"; then
8384 MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8385 AC_DEFINE(MOZ_ENABLE_SKIA)
8387 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8388 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8389 elif test "$OS_ARCH" = "WINNT"; then
8394 if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64"; then
8395 MOZ_ENABLE_SKIA_GPU=1
8396 AC_DEFINE(USE_SKIA_GPU)
8397 AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8402 AC_SUBST(MOZ_ENABLE_SKIA)
8403 AC_SUBST(MOZ_SKIA_LIBS)
8405 dnl ========================================================
8407 dnl ========================================================
8408 MOZ_ARG_DISABLE_BOOL(xul,
8409 [ --disable-xul Disable XUL],
8411 if test "$MOZ_XUL"; then
8414 dnl remove extensions that require XUL
8415 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8420 dnl ========================================================
8421 dnl disable profile locking
8422 dnl do no use this in applications that can have more than
8423 dnl one process accessing the profile directory.
8424 dnl ========================================================
8425 MOZ_ARG_DISABLE_BOOL(profilelocking,
8426 [ --disable-profilelocking
8427 Disable profile locking],
8428 MOZ_PROFILELOCKING=,
8429 MOZ_PROFILELOCKING=1 )
8430 if test "$MOZ_PROFILELOCKING"; then
8431 AC_DEFINE(MOZ_PROFILELOCKING)
8434 dnl ========================================================
8435 dnl necko configuration options
8436 dnl ========================================================
8439 dnl option to disable various necko protocols
8441 MOZ_ARG_ENABLE_STRING(necko-protocols,
8442 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8443 Enable/disable specific protocol handlers],
8444 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8445 if test "$option" = "yes" -o "$option" = "all"; then
8446 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8447 elif test "$option" = "no" -o "$option" = "none"; then
8449 elif test "$option" = "default"; then
8450 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8451 elif test `echo "$option" | grep -c \^-` != 0; then
8452 option=`echo $option | sed 's/^-//'`
8453 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8455 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8458 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8460 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8461 AC_SUBST(NECKO_PROTOCOLS)
8462 for p in $NECKO_PROTOCOLS; do
8463 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8464 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8468 dnl option to disable necko's wifi scanner
8470 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8471 [ --disable-necko-wifi Disable necko wifi scanner],
8475 if test "$OS_ARCH" = "OS2"; then
8476 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8479 if test "$NECKO_WIFI" -a \
8480 "$OS_ARCH" != "Linux" -a \
8481 "$OS_ARCH" != "Darwin" -a \
8482 "$OS_ARCH" != "SunOS" -a \
8483 "$OS_ARCH" != "WINNT"; then
8484 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8487 if test "$NECKO_WIFI"; then
8488 AC_DEFINE(NECKO_WIFI)
8489 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8491 AC_SUBST(NECKO_WIFI)
8494 dnl option to disable cookies
8496 MOZ_ARG_DISABLE_BOOL(cookies,
8497 [ --disable-cookies Disable cookie support],
8500 AC_SUBST(NECKO_COOKIES)
8501 if test "$NECKO_COOKIES"; then
8502 AC_DEFINE(NECKO_COOKIES)
8503 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8507 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8509 MOZ_ARG_DISABLE_BOOL(ctypes,
8510 [ --disable-ctypes Disable js-ctypes],
8513 AC_SUBST(BUILD_CTYPES)
8514 if test "$BUILD_CTYPES"; then
8515 AC_DEFINE(BUILD_CTYPES)
8518 dnl Build Places if required
8519 if test "$MOZ_PLACES"; then
8520 AC_DEFINE(MOZ_PLACES)
8523 dnl Build SocialAPI if required
8524 if test "$MOZ_SOCIAL"; then
8525 AC_DEFINE(MOZ_SOCIAL)
8528 dnl Build Common JS modules provided by services.
8529 AC_SUBST(MOZ_SERVICES_COMMON)
8530 if test -n "$MOZ_SERVICES_COMMON"; then
8531 AC_DEFINE(MOZ_SERVICES_COMMON)
8534 dnl Build Services crypto component (used by Sync)
8535 AC_SUBST(MOZ_SERVICES_CRYPTO)
8536 if test -n "$MOZ_SERVICES_CRYPTO"; then
8537 AC_DEFINE(MOZ_SERVICES_CRYPTO)
8540 dnl Build Firefox Health Reporter Service
8541 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8542 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8543 AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8546 dnl Build Services metrics component
8547 AC_SUBST(MOZ_SERVICES_METRICS)
8548 if test -n "$MOZ_SERVICES_METRICS"; then
8549 AC_DEFINE(MOZ_SERVICES_METRICS)
8552 dnl Build Notifications if required
8553 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8554 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8555 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8558 dnl Build Sync Services if required
8559 AC_SUBST(MOZ_SERVICES_SYNC)
8560 if test -n "$MOZ_SERVICES_SYNC"; then
8561 AC_DEFINE(MOZ_SERVICES_SYNC)
8564 dnl Build Captive Portal Detector if required
8565 AC_SUBST(MOZ_CAPTIVEDETECT)
8566 if test -n "$MOZ_CAPTIVEDETECT"; then
8567 AC_DEFINE(MOZ_CAPTIVEDETECT)
8570 dnl Build WBMP decoder if required
8572 if test -n "$MOZ_WBMP"; then
8576 dnl ========================================================
8577 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8578 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8581 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8582 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8585 if test "$MOZ_APP_COMPONENT_MODULES"; then
8586 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8589 dnl ========================================================
8591 dnl = Maintainer debug option (no --enable equivalent)
8593 dnl ========================================================
8598 AC_SUBST(AR_EXTRACT)
8602 AC_SUBST(AS_DASH_C_FLAG)
8611 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8612 AC_SUBST(MOZ_UPDATE_XTERM)
8613 AC_SUBST(MOZ_PLATFORM_MAEMO)
8614 AC_SUBST(MOZ_AUTH_EXTENSION)
8615 AC_SUBST(MOZ_PERMISSIONS)
8616 AC_SUBST(MOZ_PREF_EXTENSIONS)
8617 AC_SUBST(MOZ_JS_LIBS)
8620 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8621 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8622 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8623 AC_SUBST(MOZ_DEBUG_FLAGS)
8624 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8625 AC_SUBST(WARNINGS_AS_ERRORS)
8626 AC_SUBST(MOZ_EXTENSIONS)
8627 AC_SUBST(MOZ_JSDEBUGGER)
8628 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8631 AC_SUBST(MOZ_INSTRUMENTS)
8632 AC_SUBST(MOZ_CALLGRIND)
8634 AC_SUBST(MOZ_PROFILING)
8636 AC_SUBST(MOZ_PLACES)
8637 AC_SUBST(MOZ_SOCIAL)
8638 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8640 AC_SUBST(NS_PRINTING)
8642 AC_SUBST(MOZ_HELP_VIEWER)
8643 AC_SUBST(TOOLCHAIN_PREFIX)
8652 AC_SUBST(MOZ_PROFILELOCKING)
8654 AC_SUBST(ENABLE_TESTS)
8655 AC_SUBST(ENABLE_MARIONETTE)
8657 AC_SUBST(MOZ_UNIVERSALCHARDET)
8658 AC_SUBST(ACCESSIBILITY)
8659 AC_SUBST(MOZ_SPELLCHECK)
8660 AC_SUBST(MOZ_ANDROID_OMTC)
8661 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8662 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8663 AC_SUBST(MOZ_CRASHREPORTER)
8664 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8665 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8666 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8667 AC_SUBST(MOZ_STUB_INSTALLER)
8668 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8669 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8670 AC_SUBST(MOZ_UPDATER)
8671 AC_SUBST(MOZ_ANGLE_RENDERER)
8672 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8673 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8674 AC_SUBST(MOZ_D3DX9_VERSION)
8675 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8676 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8679 AC_SUBST(MOZ_ANDROID_HISTORY)
8680 AC_SUBST(MOZ_WEBSMS_BACKEND)
8681 AC_SUBST(MOZ_ANDROID_WALLPAPER)
8682 AC_SUBST(MOZ_ANDROID_BEAM)
8683 AC_SUBST(ENABLE_STRIP)
8684 AC_SUBST(PKG_SKIP_STRIP)
8685 AC_SUBST(STRIP_FLAGS)
8686 AC_SUBST(USE_ELF_DYNSTR_GC)
8687 AC_SUBST(USE_ELF_HACK)
8688 AC_SUBST(INCREMENTAL_LINKER)
8689 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8690 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8692 AC_SUBST(MOZ_FIX_LINK_PATHS)
8693 AC_SUBST(XPCOM_LIBS)
8694 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8695 AC_SUBST(XPCOM_GLUE_LDOPTS)
8696 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8697 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8698 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8700 AC_SUBST(USE_DEPENDENT_LIBS)
8702 AC_SUBST(MOZ_BUILD_ROOT)
8703 AC_SUBST(MOZ_OS2_TOOLS)
8705 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8706 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8707 AC_SUBST(MOZ_LINKER_EXTRACT)
8709 dnl ========================================================
8710 dnl = Mac bundle name prefix
8711 dnl ========================================================
8712 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8713 [ --with-macbundlename-prefix=prefix
8714 Prefix for MOZ_MACBUNDLE_NAME],
8715 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8717 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8718 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8719 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8722 if test "$MOZ_DEBUG"; then
8723 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8725 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8727 AC_SUBST(MOZ_MACBUNDLE_NAME)
8729 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8730 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8731 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8732 if test "$MOZ_DEBUG"; then
8733 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8736 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8737 AC_SUBST(MOZ_MACBUNDLE_ID)
8739 dnl ========================================================
8740 dnl = Child Process Name for IPC
8741 dnl ========================================================
8742 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8743 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8745 # We want to let Android unpack the file at install time, but it only does
8746 # so if the file is named libsomething.so. The lib/ path is also required
8747 # because the unpacked file will be under the lib/ subdirectory and will
8748 # need to be executed from that path.
8749 MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8751 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8753 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8754 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8756 # The following variables are available to branding and application
8757 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8758 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8759 # impacts profile location and user-visible fields.
8760 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8761 # versions of a given application (e.g. Aurora and Firefox both use
8762 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8763 # for application.ini's "Name" field, which controls profile location in
8764 # the absence of a "Profile" field (see below), and various system
8765 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8766 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8767 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8768 # builds (e.g. Aurora for Firefox).
8769 # - MOZ_APP_VERSION: Defines the application version number.
8770 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8771 # defaults to a lowercase form of MOZ_APP_BASENAME.
8772 # - MOZ_APP_PROFILE: When set, used for application.ini's
8773 # "Profile" field, which controls profile location.
8774 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8775 # crash reporter server url.
8776 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8777 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8779 if test -z "$MOZ_APP_NAME"; then
8780 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8783 # For extensions and langpacks, we require a max version that is compatible
8784 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8785 # 10.0a1 and 10.0a2 aren't affected
8786 # 10.0 becomes 10.0.*
8787 # 10.0.1 becomes 10.0.*
8788 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8789 if test -z "$IS_ALPHA"; then
8791 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8794 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8797 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8798 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8799 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8801 AC_SUBST(MOZ_APP_NAME)
8802 AC_SUBST(MOZ_APP_DISPLAYNAME)
8803 AC_SUBST(MOZ_APP_BASENAME)
8804 AC_SUBST(MOZ_APP_VENDOR)
8805 AC_SUBST(MOZ_APP_PROFILE)
8806 AC_SUBST(MOZ_APP_ID)
8807 AC_SUBST(MAR_CHANNEL_ID)
8808 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8809 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8810 AC_SUBST(MOZ_EXTENSION_MANAGER)
8811 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8812 AC_SUBST(MOZ_APP_UA_NAME)
8813 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8814 AC_SUBST(MOZ_APP_VERSION)
8815 AC_SUBST(MOZ_APP_MAXVERSION)
8816 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8817 AC_SUBST(FIREFOX_VERSION)
8818 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8819 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8820 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8822 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8823 AC_SUBST(MOZ_UA_BUILDID)
8825 AC_SUBST(MOZ_APP_STATIC_INI)
8827 AC_SUBST(MOZ_PKG_SPECIAL)
8829 AC_SUBST(MOZILLA_OFFICIAL)
8831 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8832 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8834 if test "$MOZ_TELEMETRY_REPORTING"; then
8835 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8837 # Enable Telemetry by default for nightly and aurora channels
8838 if test -z "$RELEASE_BUILD"; then
8839 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8843 dnl If we have any service that uploads data (and requires data submission
8844 dnl policy alert), set MOZ_DATA_REPORTING.
8845 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8846 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8847 MOZ_DATA_REPORTING=1
8848 AC_DEFINE(MOZ_DATA_REPORTING)
8849 AC_SUBST(MOZ_DATA_REPORTING)
8853 AC_SUBST(MOZ_MAPINFO)
8854 AC_SUBST(MOZ_BROWSE_INFO)
8855 AC_SUBST(MOZ_TOOLS_DIR)
8856 AC_SUBST(WIN32_REDIST_DIR)
8859 dnl Echo the CFLAGS to remove extra whitespace.
8865 $_WARNINGS_CXXFLAGS \
8868 COMPILE_CFLAGS=`echo \
8873 COMPILE_CXXFLAGS=`echo \
8874 $_DEFINES_CXXFLAGS \
8878 AC_SUBST(SYSTEM_LIBXUL)
8879 AC_SUBST(MOZ_NATIVE_JPEG)
8880 AC_SUBST(MOZ_NATIVE_PNG)
8881 AC_SUBST(MOZ_NATIVE_BZ2)
8883 AC_SUBST(MOZ_JPEG_CFLAGS)
8884 AC_SUBST(MOZ_JPEG_LIBS)
8885 AC_SUBST(MOZ_BZ2_CFLAGS)
8886 AC_SUBST(MOZ_BZ2_LIBS)
8887 AC_SUBST(MOZ_PNG_CFLAGS)
8888 AC_SUBST(MOZ_PNG_LIBS)
8890 AC_SUBST(NSPR_CFLAGS)
8892 AC_SUBST(MOZ_NATIVE_NSPR)
8894 AC_SUBST(NSS_CFLAGS)
8896 AC_SUBST(MOZ_NATIVE_NSS)
8897 AC_SUBST(NSS_DISABLE_DBM)
8900 OS_CXXFLAGS="$CXXFLAGS"
8901 OS_CPPFLAGS="$CPPFLAGS"
8902 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8903 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8904 OS_LDFLAGS="$LDFLAGS"
8907 AC_SUBST(OS_CXXFLAGS)
8908 AC_SUBST(OS_CPPFLAGS)
8909 AC_SUBST(OS_COMPILE_CFLAGS)
8910 AC_SUBST(OS_COMPILE_CXXFLAGS)
8911 AC_SUBST(OS_LDFLAGS)
8913 AC_SUBST(CROSS_COMPILE)
8914 AC_SUBST(WCHAR_CFLAGS)
8918 AC_SUBST(HOST_CFLAGS)
8919 AC_SUBST(HOST_CXXFLAGS)
8920 AC_SUBST(HOST_LDFLAGS)
8921 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8923 AC_SUBST(HOST_AR_FLAGS)
8925 AC_SUBST(HOST_RANLIB)
8926 AC_SUBST(HOST_NSPR_MDCPUCFG)
8927 AC_SUBST(HOST_BIN_SUFFIX)
8928 AC_SUBST(HOST_OS_ARCH)
8930 AC_SUBST(TARGET_CPU)
8931 AC_SUBST(TARGET_VENDOR)
8933 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8934 AC_SUBST(TARGET_MD_ARCH)
8935 AC_SUBST(TARGET_XPCOM_ABI)
8938 AC_SUBST(OS_RELEASE)
8941 AC_SUBST(INTEL_ARCHITECTURE)
8943 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8945 AC_SUBST(WRAP_LDFLAGS)
8948 AC_SUBST(MKSHLIB_FORCE_ALL)
8949 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8950 AC_SUBST(DSO_CFLAGS)
8951 AC_SUBST(DSO_PIC_CFLAGS)
8952 AC_SUBST(DSO_LDOPTS)
8953 AC_SUBST(LIB_PREFIX)
8954 AC_SUBST(DLL_PREFIX)
8955 AC_SUBST(DLL_SUFFIX)
8956 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8957 AC_SUBST(LIB_SUFFIX)
8958 AC_SUBST(OBJ_SUFFIX)
8959 AC_SUBST(BIN_SUFFIX)
8960 AC_SUBST(ASM_SUFFIX)
8961 AC_SUBST(IMPORT_LIB_SUFFIX)
8963 AC_SUBST(CC_VERSION)
8964 AC_SUBST(CXX_VERSION)
8965 AC_SUBST(MSMANIFEST_TOOL)
8966 AC_SUBST(NS_ENABLE_TSF)
8967 AC_SUBST(MOZ_NSS_PATCH)
8968 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8969 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8971 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8972 AC_SUBST(MOZ_SOUNDTOUCH)
8975 AC_SUBST(MOZ_VORBIS)
8976 AC_SUBST(MOZ_TREMOR)
8981 AC_SUBST(MOZ_MEDIA_PLUGINS)
8982 AC_SUBST(MOZ_OMX_PLUGIN)
8983 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8984 AC_SUBST(MOZ_VP8_ENCODER)
8988 AC_SUBST(VPX_ASFLAGS)
8989 AC_SUBST(VPX_DASH_C_FLAG)
8990 AC_SUBST(VPX_AS_CONVERSION)
8991 AC_SUBST(VPX_ASM_SUFFIX)
8992 AC_SUBST(VPX_X86_ASM)
8993 AC_SUBST(VPX_ARM_ASM)
8994 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8995 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8996 AC_SUBST(LIBJPEG_TURBO_AS)
8997 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8998 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8999 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
9000 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
9002 AC_SUBST(MOZ_PACKAGE_JSSHELL)
9003 AC_SUBST(MOZ_FOLD_LIBS)
9005 AC_SUBST(MOZ_ENABLE_SZIP)
9006 AC_SUBST(MOZ_SZIP_FLAGS)
9008 AC_MSG_CHECKING([for posix_fallocate])
9009 AC_TRY_LINK([#define _XOPEN_SOURCE 600
9010 #include <fcntl.h>],
9011 [posix_fallocate(0, 0, 0);],
9012 [ac_cv___posix_fallocate=true],
9013 [ac_cv___posix_fallocate=false])
9015 if test "$ac_cv___posix_fallocate" = true ; then
9016 AC_DEFINE(HAVE_POSIX_FALLOCATE)
9022 dnl Check for missing components
9023 if test "$COMPILE_ENVIRONMENT"; then
9024 if test "$MOZ_X11"; then
9025 if test "$WITHOUT_X11"; then
9026 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
9028 dnl ====================================================
9029 dnl = Check if X headers exist
9030 dnl ====================================================
9031 _SAVE_CFLAGS=$CFLAGS
9032 CFLAGS="$CFLAGS $XCFLAGS"
9036 #include <X11/Xlib.h>
9037 #include <X11/Intrinsic.h>
9038 #include <X11/extensions/XShm.h>
9042 if ((dpy = XOpenDisplay(NULL)) == NULL) {
9043 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
9047 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
9048 CFLAGS="$_SAVE_CFLAGS"
9050 if test -n "$MISSING_X"; then
9051 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
9056 dnl Check for headers, etc. needed by WebGL.
9057 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
9058 MOZ_CHECK_HEADER(GL/glx.h)
9059 if test "$ac_cv_header_GL_glx_h" != "yes"; then
9060 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))])
9062 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
9063 fi # COMPILE_ENVIRONMENT
9065 dnl Set various defines and substitutions
9066 dnl ========================================================
9068 if test "$OS_ARCH" = "Darwin"; then
9070 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
9074 if test "$MOZ_DEBUG"; then
9075 AC_DEFINE(MOZ_REFLOW_PERF)
9076 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9079 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
9080 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9081 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9082 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9083 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9084 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9085 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9086 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9087 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9090 AC_SUBST(MOZILLA_VERSION)
9092 AC_SUBST(ac_configure_args)
9094 dnl Spit out some output
9095 dnl ========================================================
9097 dnl The following defines are used by xpcom
9098 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9100 HAVE_CPP_2BYTE_WCHAR_T
9101 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9103 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9104 HAVE_CPP_PARTIAL_SPECIALIZATION
9105 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9106 NEED_CPP_UNUSED_IMPLEMENTATIONS
9110 HAVE_ICONV_WITH_CONST_INPUT
9123 # FUTURE? Consider moving all these to moz.build files.
9125 netwerk/necko-config.h
9126 xpcom/xpcom-config.h
9127 xpcom/xpcom-private.h
9130 AC_OUTPUT([mozilla-config.h])
9132 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
9133 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
9134 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
9135 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
9136 # (apparently) only need this hack when egrep's "pattern" is particularly long
9137 # (as in the following code) and the first egrep on our $PATH is Apple's. See
9141 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
9148 # Generate Makefiles for WebRTC directly from .gyp files
9149 if test "${OS_TARGET}" = "WINNT"; then
9150 if test "$HAVE_64BIT_OS"; then
9155 EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
9157 elif test "${OS_TARGET}" = "Android"; then
9158 if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
9159 EXTRA_GYP_DEFINES="-G os=linux "
9161 EXTRA_GYP_DEFINES="-D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
9165 if test -n "$ARM_ARCH"; then
9166 if test "$ARM_ARCH" -lt 7; then
9167 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
9169 if test "${OS_TARGET}" = "Android"; then
9170 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=1 "
9172 dnl CPU detection for ARM works on Android only. armv7 always uses CPU detection, so
9173 dnl we have to set armv7=0 for non-Android target
9174 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
9179 # Keep libcubeb and audio_device backends in sync
9180 if test -n "$MOZ_ALSA"; then
9181 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=1"
9183 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=0"
9185 if test -n "$MOZ_PULSEAUDIO"; then
9186 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=1"
9188 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=0"
9191 # Don't try to compile ssse3/sse4.1 code if toolchain doesn't support
9192 if test -z "$HAVE_TOOLCHAIN_SUPPORT_SSSE3" || test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
9193 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
9196 if test -n "$MOZ_WEBRTC"; then
9197 AC_MSG_RESULT("generating WebRTC Makefiles...")
9199 if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
9200 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D build_with_gonk=1 -D include_internal_audio_device=0"
9203 dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
9204 dnl so that regeneration via dependencies works correctly
9205 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"
9207 if test -n HAVE_CLOCK_MONOTONIC; then
9208 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=1"
9210 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=0"
9213 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}"
9215 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9216 $GYP_WEBRTC_OPTIONS \
9217 --generator-output=${_objdir}/media/webrtc/trunk \
9218 ${srcdir}/media/webrtc/trunk/peerconnection.gyp
9219 if test "$?" != 0; then
9220 AC_MSG_ERROR([failed to generate WebRTC Makefiles])
9223 # XXX disable until we land the tranche with signaling
9224 if test -n "$MOZ_WEBRTC_SIGNALING"; then
9225 AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
9226 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9227 $GYP_WEBRTC_OPTIONS \
9228 -D build_for_test=0 \
9229 --generator-output=${_objdir}/media/webrtc/signaling \
9230 ${srcdir}/media/webrtc/signaling/signaling.gyp
9231 if test "$?" != 0; then
9232 AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
9235 AC_MSG_RESULT("generating WebRTC/SignalingTest Makefiles...")
9236 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9237 $GYP_WEBRTC_OPTIONS \
9238 -D build_for_test=1 \
9239 --generator-output=${_objdir}/media/webrtc/signalingtest \
9240 ${srcdir}/media/webrtc/signaling/signaling.gyp
9241 if test "$?" != 0; then
9242 AC_MSG_ERROR([failed to generate WebRTC/SignalingTest Makefiles])
9246 AC_MSG_RESULT("generating gtest Makefiles...")
9247 # Ok to pass some extra -D's that are ignored here
9248 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9249 $GYP_WEBRTC_OPTIONS \
9250 --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
9251 ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
9252 if test "$?" != 0; then
9253 AC_MSG_ERROR([failed to generate gtest Makefiles])
9256 AC_MSG_RESULT("generating nrappkit Makefiles...")
9257 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9258 $GYP_WEBRTC_OPTIONS \
9259 --generator-output=${_objdir}/media/mtransport/third_party/nrappkit \
9260 ${srcdir}/media/mtransport/third_party/nrappkit/nrappkit.gyp
9261 if test "$?" != 0; then
9262 AC_MSG_ERROR([failed to generate nrappkit Makefiles])
9265 AC_MSG_RESULT("generating nICEr Makefiles...")
9266 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9267 $GYP_WEBRTC_OPTIONS \
9268 --generator-output=${_objdir}/media/mtransport/third_party/nICEr \
9269 ${srcdir}/media/mtransport/third_party/nICEr/nicer.gyp
9270 if test "$?" != 0; then
9271 AC_MSG_ERROR([failed to generate nICEr Makefiles])
9275 # Generate a JSON config file for unittest harnesses etc to read
9276 # build configuration details from in a standardized way.
9277 OS_TARGET=${OS_TARGET} \
9278 TARGET_CPU=${TARGET_CPU} \
9279 MOZ_DEBUG=${MOZ_DEBUG} \
9280 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} \
9281 UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
9282 MOZ_CRASHREPORTER=${MOZ_CRASHREPORTER} \
9283 MOZ_APP_NAME=${MOZ_APP_NAME} \
9284 TOPSRCDIR=${_topsrcdir} \
9285 MOZ_ASAN=${MOZ_ASAN} \
9286 $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
9287 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
9288 rm ./mozinfo.json.tmp
9290 mv -f ./mozinfo.json.tmp ./mozinfo.json
9293 # Run jemalloc configure script
9295 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
9296 ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
9297 if test -n "$MOZ_REPLACE_MALLOC"; then
9298 # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9299 ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9300 ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9302 if test -n "$MOZ_JEMALLOC3"; then
9303 case "${OS_ARCH}" in
9305 # We want jemalloc functions to be kept hidden on both Mac and Windows
9306 # See memory/build/mozmemory_wrap.h for details.
9307 ac_configure_args="$ac_configure_args --without-export"
9310 elif test "${OS_ARCH}" = Darwin; then
9311 # When building as a replace-malloc lib, disabling the zone allocator
9312 # forces to use pthread_atfork.
9313 ac_configure_args="$ac_configure_args --disable-zone-allocator"
9315 _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9317 if test -z "$MOZ_REPLACE_MALLOC"; then
9319 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9323 elif test -z "$MOZ_JEMALLOC3"; then
9325 JEMALLOC_WRAPPER=replace_
9327 if test -n "$MANGLE"; then
9329 if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
9330 JEMALLOC_WRAPPER=__wrap_
9332 for mangle in ${MANGLE}; do
9333 if test -n "$MANGLED"; then
9334 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9336 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9339 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9342 if test -z "$MOZ_TLS"; then
9343 ac_configure_args="$ac_configure_args --disable-tls"
9345 EXTRA_CFLAGS="$CFLAGS"
9346 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9347 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9349 if test "$CROSS_COMPILE"; then
9350 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9352 _save_cache_file="$cache_file"
9353 cache_file=$_objdir/memory/jemalloc/src/config.cache
9355 if ! test -e memory/jemalloc; then
9356 mkdir -p memory/jemalloc
9359 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9360 cache_file="$_save_cache_file"
9361 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9364 # Run freetype configure script
9366 if test "$MOZ_TREE_FREETYPE"; then
9367 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9368 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9369 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9370 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9371 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9372 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --without-png"
9374 if ! test -e modules; then
9378 AC_OUTPUT_SUBDIRS(modules/freetype2)
9381 if test -z "$direct_nspr_config"; then
9382 dnl ========================================================
9383 dnl = Setup a nice relatively clean build environment for
9384 dnl = sub-configures.
9385 dnl ========================================================
9388 CFLAGS="$_SUBDIR_CFLAGS"
9389 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9390 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9391 LDFLAGS="$_SUBDIR_LDFLAGS"
9392 HOST_CC="$_SUBDIR_HOST_CC"
9393 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9394 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9401 # Run all configure scripts specified by a subconfigure
9402 if test -n "$_subconfigure_subdir"; then
9403 _save_ac_configure_args="$ac_configure_args"
9404 ac_configure_args="$_subconfigure_config_args"
9405 AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
9406 ac_configure_args="$_save_ac_configure_args"
9409 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9410 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9414 if test -n "$_WRAP_MALLOC"; then
9415 # Avoid doubling wrap malloc arguments
9416 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9419 if test -z "$MOZ_NATIVE_NSPR"; then
9420 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9421 if test -z "$MOZ_DEBUG"; then
9422 ac_configure_args="$ac_configure_args --disable-debug"
9424 ac_configure_args="$ac_configure_args --enable-debug"
9426 if test "$MOZ_OPTIMIZE" = "1"; then
9427 ac_configure_args="$ac_configure_args --enable-optimize"
9428 elif test -z "$MOZ_OPTIMIZE"; then
9429 ac_configure_args="$ac_configure_args --disable-optimize"
9431 if test -n "$HAVE_64BIT_OS"; then
9432 ac_configure_args="$ac_configure_args --enable-64bit"
9434 if test -n "$USE_ARM_KUSER"; then
9435 ac_configure_args="$ac_configure_args --with-arm-kuser"
9437 ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9439 # Save these, so we can mess with them for the subconfigure ..
9440 _SAVE_CFLAGS="$CFLAGS"
9441 _SAVE_CPPFLAGS="$CPPFLAGS"
9442 _SAVE_LDFLAGS="$LDFLAGS"
9444 if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9445 # dladdr is supported by the new linker, even when the system linker doesn't
9446 # support it. Trick nspr into using dladdr when it's not supported.
9447 export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9449 export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9450 export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
9452 AC_OUTPUT_SUBDIRS(nsprpub)
9454 # .. and restore them
9458 CFLAGS="$_SAVE_CFLAGS"
9459 CPPFLAGS="$_SAVE_CPPFLAGS"
9460 LDFLAGS="$_SAVE_LDFLAGS"
9462 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9465 dnl ========================================================
9466 dnl = Setup a nice relatively clean build environment for
9467 dnl = sub-configures.
9468 dnl ========================================================
9471 CFLAGS="$_SUBDIR_CFLAGS"
9472 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9473 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9474 LDFLAGS="$_SUBDIR_LDFLAGS"
9475 HOST_CC="$_SUBDIR_HOST_CC"
9476 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9477 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9480 if test -n "$ENABLE_CLANG_PLUGIN"; then
9481 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9482 AC_OUTPUT_SUBDIRS(build/clang-plugin)
9486 # Run the SpiderMonkey 'configure' script.
9487 dist=$MOZ_BUILD_ROOT/dist
9488 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9489 ac_configure_args="$ac_configure_args --enable-threadsafe"
9490 if test "A" = "A"; then # "$MOZ_BUILDAPP" != "browser", when desktop builds this
9491 # The Internationalization API is currently disabled in all non-standalone
9492 # SpiderMonkey builds, but it should be turned on for desktop builds soon.
9493 ac_configure_args="$ac_configure_args --disable-intl-api"
9495 if test "$BUILD_CTYPES"; then
9496 # Build js-ctypes on the platforms we can.
9497 ac_configure_args="$ac_configure_args --enable-ctypes"
9499 if test -z "$JS_SHARED_LIBRARY" ; then
9500 ac_configure_args="$ac_configure_args --disable-shared-js"
9502 if test -z "$MOZ_NATIVE_NSPR"; then
9503 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9504 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9506 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9507 ac_configure_args="$ac_configure_args --prefix=$dist"
9508 if test "$MOZ_MEMORY"; then
9509 ac_configure_args="$ac_configure_args --enable-jemalloc"
9511 if test -n "$MOZ_GLUE_LDFLAGS"; then
9512 export MOZ_GLUE_LDFLAGS
9514 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9515 export MOZ_GLUE_PROGRAM_LDFLAGS
9517 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9520 export MOZ_NATIVE_ZLIB
9521 export MOZ_ZLIB_CFLAGS
9522 export MOZ_ZLIB_LIBS
9524 export DONT_POPULATE_VIRTUALENV=1
9526 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9527 export STLPORT_CPPFLAGS
9528 export STLPORT_LDFLAGS
9530 export JS_STANDALONE=no
9532 if ! test -e js; then
9536 AC_OUTPUT_SUBDIRS(js/src)
9537 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9539 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR