1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl This Source Code Form is subject to the terms of the Mozilla Public
4 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
5 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 dnl Process this file with autoconf to produce a configure script.
8 dnl ========================================================
11 AC_INIT(config/config.mk)
12 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
14 TARGET_CPU="${target_cpu}"
15 TARGET_VENDOR="${target_vendor}"
16 TARGET_OS="${target_os}"
18 MOZ_DEB_TIMESTAMP=`date +"%a, %d %b %Y %T %z" 2>&1`
19 AC_SUBST(MOZ_DEB_TIMESTAMP)
21 dnl ========================================================
23 dnl = Don't change the following two lines. Doing so breaks:
25 dnl = CFLAGS="-foo" ./configure
27 dnl ========================================================
29 CPPFLAGS="${CPPFLAGS=}"
30 CXXFLAGS="${CXXFLAGS=}"
32 HOST_CFLAGS="${HOST_CFLAGS=}"
33 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
34 HOST_LDFLAGS="${HOST_LDFLAGS=}"
36 dnl ========================================================
37 dnl = Preserve certain environment flags passed to configure
38 dnl = We want sub projects to receive the same flags
39 dnl = untainted by this configure script
40 dnl ========================================================
43 _SUBDIR_CFLAGS="$CFLAGS"
44 _SUBDIR_CPPFLAGS="$CPPFLAGS"
45 _SUBDIR_CXXFLAGS="$CXXFLAGS"
46 _SUBDIR_LDFLAGS="$LDFLAGS"
47 _SUBDIR_HOST_CC="$HOST_CC"
48 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
49 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
50 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
51 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
53 dnl Set the version number of the libs included with mozilla
54 dnl ========================================================
61 dnl Set the minimum version of toolkit libs used by mozilla
62 dnl ========================================================
69 WINDRES_VERSION=2.14.90
75 STARTUP_NOTIFICATION_VERSION=0.8
82 dnl Set various checks
83 dnl ========================================================
87 dnl Initialize the Pthread test variables early so they can be
88 dnl overridden by each platform.
89 dnl ========================================================
93 dnl Do not allow a separate objdir build if a srcdir build exists.
94 dnl ==============================================================
95 _topsrcdir=`cd \`dirname $0\`; pwd`
98 if test "$_topsrcdir" != "$_objdir"
100 # Check for a couple representative files in the source tree
102 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
103 if test -f $file; then
104 _conflict_files="$_conflict_files $file"
107 if test "$_conflict_files"; then
109 echo "* Your source tree contains these files:"
110 for file in $_conflict_files; do
114 * This indicates that you previously built in the source tree.
115 * A source tree build can confuse the separate objdir build.
117 * To clean up the source tree:
130 COMPILE_ENVIRONMENT=1
131 MOZ_ARG_DISABLE_BOOL(compile-environment,
132 [ --disable-compile-environment
133 Disable compiler/library checks.],
134 COMPILE_ENVIRONMENT= )
135 AC_SUBST(COMPILE_ENVIRONMENT)
137 MOZ_ARG_WITH_STRING(l10n-base,
138 [ --with-l10n-base=DIR path to l10n repositories],
139 L10NBASEDIR=$withval)
140 if test -n "$L10NBASEDIR"; then
141 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
142 AC_MSG_ERROR([--with-l10n-base must specify a path])
143 elif test -d "$L10NBASEDIR"; then
144 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
146 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
149 AC_SUBST(L10NBASEDIR)
151 dnl Check for Perl first -- needed for win32 SDK checks
152 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
153 if test -z "$PERL" -o "$PERL" = ":"; then
154 AC_MSG_ERROR([perl not found in \$PATH])
157 MOZ_ARG_WITH_STRING(gonk,
159 location of gonk dir],
162 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
163 [ --with-gonk-toolchain-prefix=DIR
164 prefix to gonk toolchain commands],
165 gonk_toolchain_prefix=$withval)
167 if test -n "$gonkdir" ; then
168 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
169 android_source="$gonkdir"
170 ANDROID_SOURCE="$android_source"
171 ANDROID_NDK="${ANDROID_SOURCE}/ndk"
174 TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
175 AS="$gonk_toolchain_prefix"as
176 CC="$gonk_toolchain_prefix"gcc
177 CXX="$gonk_toolchain_prefix"g++
178 CPP="$gonk_toolchain_prefix"cpp
179 LD="$gonk_toolchain_prefix"ld
180 AR="$gonk_toolchain_prefix"ar
181 RANLIB="$gonk_toolchain_prefix"ranlib
182 STRIP="$gonk_toolchain_prefix"strip
184 STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/"
185 STLPORT_LIBS="-lstlport"
187 case "$target_cpu" in
196 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/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice"
197 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
198 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS $STLPORT_CPPFLAGS"
199 LIBS="$LIBS $STLPORT_LIBS"
201 dnl Add -llog by default, since we use it all over the place.
202 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/ -llog $LDFLAGS"
204 dnl prevent cross compile section from using these flags as host flags
205 if test -z "$HOST_CPPFLAGS" ; then
208 if test -z "$HOST_CFLAGS" ; then
211 if test -z "$HOST_CXXFLAGS" ; then
214 if test -z "$HOST_LDFLAGS" ; then
219 AC_DEFINE(HAVE_SYS_UIO_H)
220 AC_DEFINE(HAVE_PTHREADS)
222 MOZ_CHROME_FILE_FORMAT=omni
228 *-android*|*-linuxandroid*)
229 if test -z "$ANDROID_PACKAGE_NAME" ; then
230 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
232 MOZ_CHROME_FILE_FORMAT=omni
236 AC_PATH_PROG(OBJCOPY,objcopy)
241 AC_SUBST(ANDROID_SOURCE)
242 AC_SUBST(ANDROID_PACKAGE_NAME)
245 dnl ========================================================
246 dnl Checks for compilers.
247 dnl ========================================================
248 dnl Set CROSS_COMPILE in the environment when running configure
249 dnl to use the cross-compile setup for now
250 dnl ========================================================
252 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
255 if test "$COMPILE_ENVIRONMENT"; then
257 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
258 echo "cross compiling from $host to $target"
262 _SAVE_CFLAGS="$CFLAGS"
263 _SAVE_LDFLAGS="$LDFLAGS"
265 AC_MSG_CHECKING([for host c compiler])
266 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
267 if test -z "$HOST_CC"; then
268 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
270 AC_MSG_RESULT([$HOST_CC])
271 AC_MSG_CHECKING([for host c++ compiler])
272 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
273 if test -z "$HOST_CXX"; then
274 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
276 AC_MSG_RESULT([$HOST_CXX])
278 if test -z "$HOST_CFLAGS"; then
279 HOST_CFLAGS="$CFLAGS"
281 if test -z "$HOST_CXXFLAGS"; then
282 HOST_CXXFLAGS="$CXXFLAGS"
284 if test -z "$HOST_LDFLAGS"; then
285 HOST_LDFLAGS="$LDFLAGS"
287 if test -z "$HOST_AR_FLAGS"; then
288 HOST_AR_FLAGS="$AR_FLAGS"
290 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
291 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
293 CFLAGS="$HOST_CFLAGS"
294 LDFLAGS="$HOST_LDFLAGS"
296 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
297 AC_TRY_COMPILE([], [return(0);],
298 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
299 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
302 CFLAGS="$HOST_CXXFLAGS"
304 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
305 AC_TRY_COMPILE([], [return(0);],
306 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
307 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
311 LDFLAGS=$_SAVE_LDFLAGS
313 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
316 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
320 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
321 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
322 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
323 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
324 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
325 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
326 AC_DEFINE(CROSS_COMPILE)
331 # Work around the conftest.exe access problem on Windows
336 MOZ_PATH_PROGS(AS, $AS as, $CC)
337 AC_CHECK_PROGS(AR, ar, :)
338 AC_CHECK_PROGS(LD, ld, :)
339 AC_CHECK_PROGS(STRIP, strip, :)
340 AC_CHECK_PROGS(WINDRES, windres, :)
341 if test -z "$HOST_CC"; then
344 if test -z "$HOST_CFLAGS"; then
345 HOST_CFLAGS='$(CFLAGS)'
347 if test -z "$HOST_CXX"; then
350 if test -z "$HOST_CXXFLAGS"; then
351 HOST_CXXFLAGS='$(CXXFLAGS)'
353 if test -z "$HOST_LDFLAGS"; then
354 HOST_LDFLAGS='$(LDFLAGS)'
356 if test -z "$HOST_RANLIB"; then
357 HOST_RANLIB='$(RANLIB)'
359 if test -z "$HOST_AR"; then
362 if test -z "$HOST_AR_FLAGS"; then
363 HOST_AR_FLAGS='$(AR_FLAGS)'
373 if test "$GCC" = "yes"; then
375 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
377 if test "$GXX" = "yes"; then
379 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
381 if test "`echo | $AS -o conftest.out -v 2>&1 | grep -c GNU`" != "0"; then
385 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
388 if test "$GNU_CC"; then
389 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
396 if test "$GCC" = yes; then
397 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
402 if test "$GXX" = yes; then
403 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
410 if test "$GCC" = yes; then
411 if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
416 if test "$GXX" = yes; then
417 if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
422 dnl ========================================================
423 dnl Special win32 checks
424 dnl ========================================================
426 # With win8, sdk target=602, WINVER=602
427 MOZ_ARG_ENABLE_BOOL(metro,
428 [ --enable-metro Enable Windows Metro build targets],
431 if test -n "$MOZ_METRO"; then
433 # Target the Windows 8 Kit
435 # Allow a higher api set
437 # toolkit/library/makefile.in needs these, see nsDllMain.
439 CRTEXPDLLVERSION=1-1-0
441 # Target the Windows 7 SDK by default
446 AC_SUBST(CRTDLLVERSION)
447 AC_SUBST(CRTEXPDLLVERSION)
449 if test -n "$MOZ_METRO"; then
454 AC_MSG_ERROR([Metro builds only valid on the windows platform.]);
459 MOZ_ARG_WITH_STRING(windows-version,
460 [ --with-windows-version=WINSDK_TARGETVER
461 Windows SDK version to target. Lowest version
462 currently allowed is 601 (Win7), highest is 602 (Win8)],
463 WINSDK_TARGETVER=$withval)
465 # Currently only two sdk versions allowed, 601 and 602
466 case "$WINSDK_TARGETVER" in
468 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
472 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
478 if test "$GCC" != "yes"; then
479 # Check to see if we are really running in a msvc environemnt
481 AC_CHECK_PROGS(MIDL, midl)
483 # Make sure compilers are valid
484 CFLAGS="$CFLAGS -TC -nologo"
485 CXXFLAGS="$CXXFLAGS -TP -nologo"
488 AC_TRY_COMPILE([#include <stdio.h>],
489 [ printf("Hello World\n"); ],,
490 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
493 AC_TRY_COMPILE([#include <new.h>],
494 [ unsigned *test = new unsigned(42); ],,
495 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
499 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
502 # Determine compiler version
503 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
504 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
505 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
506 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
507 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
508 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
510 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
511 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
513 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
514 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
517 if test "$_CC_MAJOR_VERSION" = "14"; then
518 dnl Require VC8SP1 or newer.
519 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
520 if test "$_CC_RELEASE" -lt 50727 -o \
521 \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
522 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
527 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
528 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
529 elif test "$_CC_MAJOR_VERSION" = "15"; then
532 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
533 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
534 elif test "$_CC_MAJOR_VERSION" = "16"; then
537 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
538 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
539 elif test "$_CC_MAJOR_VERSION" = "17"; then
542 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
543 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
545 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
548 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
550 if test -n "$WIN32_REDIST_DIR"; then
551 if test ! -d "$WIN32_REDIST_DIR"; then
552 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
554 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
557 dnl Confirm we have the pri tools on win8 builds
558 if test -n "$MOZ_METRO"; then
559 AC_MSG_CHECKING([for makepri])
560 AC_CHECK_PROGS(MAKEPRI, makepri, "")
561 if test -z "MAKEPRI" ; then
562 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
567 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
568 dnl not something else like "magnetic tape manipulation utility".
569 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
570 if test -z "$MSMT_TOOL"; then
571 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
575 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
577 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
578 if test -z "$MSMANIFEST_TOOL_VERSION"; then
579 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
585 # Check linker version
586 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
587 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
588 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
589 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
595 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
596 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
597 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
598 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
599 # Add flags if necessary
600 AC_MSG_CHECKING([for midl flags])
603 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
604 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
605 # MIDL version 7.00.0500 or later has no problem.
606 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
607 AC_MSG_RESULT([need -env win32])
609 AC_MSG_RESULT([none needed])
613 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
616 AC_MSG_RESULT([none needed])
620 # Identify which version of the SDK we're building with
621 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
623 MOZ_CHECK_HEADERS([winsdkver.h])
624 if test "$ac_cv_header_winsdkver_h" = "yes"; then
625 # Get the highest _WIN32_WINNT and NTDDI versions supported
626 # Take the higher of the two
627 # This is done because the Windows 7 beta SDK reports its
628 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
629 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
631 [cat > conftest.h <<EOF
632 #include <winsdkver.h>
633 #include <sdkddkver.h>
635 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
636 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
638 #define WINSDK_MAXVER NTDDI_MAXVER
643 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
646 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
648 # Any SDK which doesn't have WinSDKVer.h is too old.
649 AC_MSG_ERROR([Your SDK does not have WinSDKVer.h. It is probably too old. Please upgrade to a newer SDK or 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.])
652 unset _MSVC_VER_FILTER
654 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
658 _SAVE_CXXFLAGS="$CXXFLAGS"
659 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
660 AC_TRY_COMPILE([#include <exception>],
661 [std::_Throw(std::exception()); return 0;],
662 ac_cv_have_std__Throw="yes",
663 ac_cv_have_std__Throw="no")
664 CXXFLAGS="$_SAVE_CXXFLAGS"
668 if test "$ac_cv_have_std__Throw" = "yes"; then
669 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
670 ac_cv_have_dllimport_exception_bug,
674 _SAVE_CXXFLAGS="$CXXFLAGS"
675 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
676 AC_TRY_LINK([#include <vector>],
677 [std::vector<int> v; return v.at(1);],
678 ac_cv_have_dllimport_exception_bug="no",
679 ac_cv_have_dllimport_exception_bug="yes")
680 CXXFLAGS="$_SAVE_CXXFLAGS"
683 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
685 MOZ_MSVC_STL_WRAP__Throw=1
686 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
689 AC_CACHE_CHECK(for overridable _RAISE,
694 _SAVE_CXXFLAGS="$CXXFLAGS"
695 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
696 AC_TRY_COMPILE([#include <xstddef>
698 #define _RAISE(x) externallyDefinedFunction((x).what())
701 [std::vector<int> v; return v.at(1);],
702 ac_cv_have__RAISE="no",
703 ac_cv_have__RAISE="yes")
704 CXXFLAGS="$_SAVE_CXXFLAGS"
707 if test "$ac_cv_have__RAISE" = "yes"; then
709 MOZ_MSVC_STL_WRAP__RAISE=1
710 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
712 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
716 if test "$WRAP_STL_INCLUDES" = "1"; then
717 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
720 # Check w32api version
721 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
722 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
723 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
724 AC_TRY_COMPILE([#include <w32api.h>],
725 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
726 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
727 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
728 #error "test failed."
730 , [ res=yes ], [ res=no ])
731 AC_MSG_RESULT([$res])
732 if test "$res" != "yes"; then
733 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
735 # Check windres version
736 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
737 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
738 AC_MSG_RESULT([$_WINDRES_VERSION])
739 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
740 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
741 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
742 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
743 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
744 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
745 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
746 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
747 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
748 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
749 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
750 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
752 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
755 MOZ_WINSDK_MAXVER=0x06020000
758 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
759 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
760 # Require OS features provided by IE 6.0 SP2 (XP SP2)
761 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
763 # If the maximum version supported by this SDK is lower than the target
765 AC_MSG_CHECKING([for Windows SDK being recent enough])
766 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
770 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.])
773 # Make sure the sdk / code we're targeting has the right toolset
774 AC_MSG_CHECKING([SDK and tools are in sync])
775 if test -n "$MOZ_METRO"; then
776 if test "$MOZ_MSVCVERSION" -gt "10"; then
780 AC_MSG_ERROR([Your MOZ_MSVCVERSION equals $MOZ_MSVCVERSION and you've enabled metro build support. You can't target metro without msvc 11 or higher. Disable metro support or switch to a newer set of tools.])
784 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
785 # Definitions matching sdkddkver.h
786 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
793 if test -n "$_WIN32_MSVC"; then
795 SKIP_COMPILER_CHECKS=1
796 SKIP_LIBRARY_CHECKS=1
798 # Since we're skipping compiler and library checks, hard-code
801 AC_DEFINE(HAVE_SETBUF)
802 AC_DEFINE(HAVE_ISATTY)
805 fi # COMPILE_ENVIRONMENT
818 AC_SUBST(WRAP_STL_INCLUDES)
819 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
820 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
822 dnl ========================================================
823 dnl Checks for programs.
824 dnl ========================================================
828 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
829 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
830 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
832 AC_MSG_RESULT([$_perl_version])
834 if test "$_perl_res" != 0; then
835 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
839 AC_MSG_CHECKING([for full perl installation])
840 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
842 if test "$_perl_res" != 0; then
844 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
849 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
850 if test -z "$PYTHON"; then
851 AC_MSG_ERROR([python was not found in \$PATH])
854 MOZ_ARG_WITH_BOOL(system-ply,
855 [ --with-system-ply Use system installed python ply library],
856 [if $PYTHON -c 'import ply' 2>&5; then
859 AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
862 AC_SUBST(MOZ_SYSTEM_PLY)
864 if test -z "$COMPILE_ENVIRONMENT"; then
865 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
867 AC_SUBST(NSINSTALL_BIN)
869 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
870 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
871 MOZ_PATH_PROGS(UNZIP, unzip)
872 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
873 AC_MSG_ERROR([unzip not found in \$PATH])
875 MOZ_PATH_PROGS(ZIP, zip)
876 if test -z "$ZIP" -o "$ZIP" = ":"; then
877 AC_MSG_ERROR([zip not found in \$PATH])
879 MOZ_PATH_PROG(MOZ_NATIVE_MAKEDEPEND, makedepend)
880 MOZ_PATH_PROG(XARGS, xargs)
881 if test -z "$XARGS" -o "$XARGS" = ":"; then
882 AC_MSG_ERROR([xargs not found in \$PATH .])
885 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
888 if test "$COMPILE_ENVIRONMENT"; then
890 dnl ========================================================
891 dnl = Mac OS X toolchain support
892 dnl ========================================================
896 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
897 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
898 dnl the environment and includedir purposes (when using an SDK, below),
899 dnl but remember the full version number for the libdir (SDK).
901 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
902 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
904 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
905 dnl Bug 280479, but this keeps popping up in bug 292530 too because
906 dnl 4.0.0/4061 is the default compiler in Tiger.
908 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
910 if test "$GCC_BUILD" = "4061" ; then
911 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
912 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
913 from building Mozilla. Upgrade to Xcode 2.1 or later.])
917 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
918 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
919 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
920 MOZ_PATH_PROGS(PBBUILD_BIN, pbbuild xcodebuild pbxbuild)
922 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
923 dnl it has moved into /usr/bin.
924 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
928 AC_SUBST(GCC_VERSION)
930 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
931 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
932 dnl when we can run target binaries.
933 AC_SUBST(UNIVERSAL_BINARY)
934 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
936 dnl ========================================================
937 dnl Check for MacOS deployment target version
938 dnl ========================================================
940 MOZ_ARG_ENABLE_STRING(macos-target,
941 [ --enable-macos-target=VER (default=10.5)
942 Set the minimum MacOS version needed at runtime],
943 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
947 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
948 dnl Use the specified value
949 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
951 dnl No value specified on the command line or in the environment,
952 dnl use architecture minimum.
953 case "${target_cpu}" in
955 export MACOSX_DEPLOYMENT_TARGET=10.5
958 export MACOSX_DEPLOYMENT_TARGET=10.6
965 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
967 dnl ========================================================
968 dnl = Mac OS X SDK support
969 dnl ========================================================
972 MOZ_ARG_WITH_STRING(macos-sdk,
973 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
974 MACOS_SDK_DIR=$withval)
976 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
977 dnl NEXT_ROOT will be set and exported only if it's needed.
978 AC_SUBST(MACOS_SDK_DIR)
981 if test "$MACOS_SDK_DIR"; then
982 dnl Sync this section with the ones in NSPR and NSS.
983 dnl Changes to the cross environment here need to be accounted for in
984 dnl the libIDL checks (below) and xpidl build.
986 if test ! -d "$MACOS_SDK_DIR"; then
987 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
988 specify a valid SDK. SDKs are installed when the optional cross-development
989 tools are selected during the Xcode/Developer Tools installation.])
992 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
993 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
994 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
996 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
997 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
999 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
1000 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1001 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1003 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1004 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1005 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
1006 dnl be ignored and cause warnings when -syslibroot is specified.
1007 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1008 dnl the -isysroot it receives, so this is only needed with 4.0.0.
1009 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1014 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1016 AC_TRY_COMPILE([#include <new>],[],
1020 AC_MSG_RESULT($result)
1022 if test "$result" = "no" ; then
1023 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1027 fi # COMPILE_ENVIRONMENT
1029 AC_MSG_CHECKING([compiler version])
1030 # Just print it so it shows up in the logs.
1031 cc_version=$($CC --version)
1032 AC_MSG_RESULT([$cc_version])
1034 if test -n "$MAKE"; then
1035 if test `echo $MAKE | grep -c make.py` != 1; then
1042 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1045 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1048 if test "$GMAKE" = ":"; then
1049 AC_MSG_ERROR([GNU make not found])
1053 if test -z "$MAKE"; then
1057 if test "$COMPILE_ENVIRONMENT"; then
1063 fi # COMPILE_ENVIRONMENT
1065 dnl ========================================================
1066 dnl set the defaults first
1067 dnl ========================================================
1070 AR_EXTRACT='$(AR) x'
1084 MOZ_USER_DIR=".mozilla"
1087 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
1089 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1091 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1093 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
1095 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1096 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1097 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1098 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1099 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1100 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1101 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1102 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1104 # These are specially defined on Windows only
1107 XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1108 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
1111 XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
1112 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
1118 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1120 USE_DEPENDENT_LIBS=1
1122 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1124 if test -n "$CROSS_COMPILE"; then
1125 OS_TARGET="${target_os}"
1126 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1128 case "${target_os}" in
1129 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1130 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1131 gnu*) OS_ARCH=GNU ;;
1132 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1133 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
1134 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1137 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1140 OS_TARGET=`uname -s`
1141 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1142 OS_RELEASE=`uname -r`
1145 # Before this used `uname -m` when not cross compiling
1146 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1147 OS_TEST="${target_cpu}"
1149 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1151 #######################################################################
1152 # Master "Core Components" macros for getting the OS target #
1153 #######################################################################
1156 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1157 # cross-compilation.
1161 # Define and override various archtecture-specific variables, including
1170 case "$HOST_OS_ARCH" in
1184 if test -z "$GNU_CC"; then
1185 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1190 if test -z "$GNU_CXX"; then
1191 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1192 SOLARIS_SUNPRO_CXX=1
1195 AC_SUBST(SOLARIS_SUNPRO_CC)
1196 AC_SUBST(SOLARIS_SUNPRO_CXX)
1208 if test -z "$CROSS_COMPILE" ; then
1214 # If uname -s returns "Windows_NT", we assume that we are using
1215 # the uname.exe in MKS toolkit.
1217 # The -r option of MKS uname only returns the major version number.
1218 # So we need to use its -v option to get the minor version number.
1219 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1223 OS_MINOR_RELEASE=`uname -v`
1224 if test "$OS_MINOR_RELEASE" = "00"; then
1227 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1231 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1232 # the uname.exe in the MSYS tools.
1234 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1239 OS_RELEASE=`uname -v`.`uname -r`
1240 OS_TEST=${target_cpu}
1248 OS_RELEASE=`uname -v`
1251 case "${target_cpu}" in
1262 if test -z "$CROSS_COMPILE" ; then
1270 # Only set CPU_ARCH if we recognize the value of OS_TEST
1281 powerpc | ppc | rs6000)
1285 Alpha | alpha | ALPHA)
1318 if test -z "$OS_TARGET"; then
1321 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1323 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1324 dnl ===============================================================
1328 INTEL_ARCHITECTURE=1
1331 dnl Configure platform-specific CPU architecture compiler options.
1332 dnl ==============================================================
1335 dnl =================================================================
1336 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1337 dnl which is bad when cross compiling.
1338 dnl =================================================================
1339 if test "$COMPILE_ENVIRONMENT"; then
1340 configure_static_assert_macros='
1341 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1342 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1343 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1346 dnl test that the macros actually work:
1347 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1348 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1351 ac_cv_static_assertion_macros_work="yes"
1352 AC_TRY_COMPILE([$configure_static_assert_macros],
1353 [CONFIGURE_STATIC_ASSERT(1)],
1355 ac_cv_static_assertion_macros_work="no")
1356 AC_TRY_COMPILE([$configure_static_assert_macros],
1357 [CONFIGURE_STATIC_ASSERT(0)],
1358 ac_cv_static_assertion_macros_work="no",
1361 AC_TRY_COMPILE([$configure_static_assert_macros],
1362 [CONFIGURE_STATIC_ASSERT(1)],
1364 ac_cv_static_assertion_macros_work="no")
1365 AC_TRY_COMPILE([$configure_static_assert_macros],
1366 [CONFIGURE_STATIC_ASSERT(0)],
1367 ac_cv_static_assertion_macros_work="no",
1371 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1372 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1373 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1375 fi # COMPILE_ENVIRONMENT
1377 dnl ========================================================
1378 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1380 dnl ========================================================
1384 dnl ========================================================
1385 dnl Suppress Clang Argument Warnings
1386 dnl ========================================================
1387 if test -n "$CLANG_CC"; then
1388 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1389 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1391 if test -n "$CLANG_CXX"; then
1392 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1395 dnl ========================================================
1396 dnl = Use Address Sanitizer
1397 dnl ========================================================
1398 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1399 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1402 if test -n "$MOZ_ASAN"; then
1408 dnl ========================================================
1409 dnl = Enable hacks required for LLVM instrumentations
1410 dnl ========================================================
1411 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1412 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1415 if test -n "$MOZ_LLVM_HACKS"; then
1419 AC_SUBST(MOZ_NO_WLZDEFS)
1420 AC_SUBST(MOZ_CFLAGS_NSS)
1422 dnl ========================================================
1423 dnl GNU specific defaults
1424 dnl ========================================================
1425 if test "$GNU_CC"; then
1426 # FIXME: Let us build with strict aliasing. bug 414641.
1427 CFLAGS="$CFLAGS -fno-strict-aliasing"
1428 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1429 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1430 DSO_LDOPTS='-shared'
1431 if test "$GCC_USE_GNU_LD"; then
1432 # Some tools like ASan use a runtime library that is only
1433 # linked against executables, so we must allow undefined
1434 # symbols for shared objects in some cases.
1435 if test -z "$MOZ_NO_WLZDEFS"; then
1436 # Don't allow undefined symbols in libraries
1437 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1440 WARNINGS_AS_ERRORS='-Werror -Wno-error=uninitialized'
1442 DSO_PIC_CFLAGS='-fPIC'
1443 ASFLAGS="$ASFLAGS -fPIC"
1444 AC_MSG_CHECKING([for --noexecstack option to as])
1445 _SAVE_CFLAGS=$CFLAGS
1446 CFLAGS="$CFLAGS -Wa,--noexecstack"
1447 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1448 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1449 AC_MSG_RESULT([no]))
1450 CFLAGS=$_SAVE_CFLAGS
1451 AC_MSG_CHECKING([for -z noexecstack option to ld])
1452 _SAVE_LDFLAGS=$LDFLAGS
1453 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1454 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1456 LDFLAGS=$_SAVE_LDFLAGS)
1458 # Check for -mssse3 on $CC
1459 AC_MSG_CHECKING([for -mssse3 option to $CC])
1460 HAVE_COMPILER_FLAG_MSSSE3=
1461 _SAVE_CFLAGS=$CFLAGS
1462 CFLAGS="$CFLAGS -mssse3"
1463 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1464 [HAVE_COMPILER_FLAG_MSSSE3=1],
1465 AC_MSG_RESULT([no]))
1466 CFLAGS=$_SAVE_CFLAGS
1467 AC_SUBST(HAVE_COMPILER_FLAG_MSSSE3)
1469 # Turn on GNU-specific warnings:
1470 # -Wall - turn on a lot of warnings
1471 # -pedantic - this is turned on below
1472 # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1473 # -Wdeclaration-after-statement - MSVC doesn't like these
1474 # -Werror=return-type - catches missing returns, zero false positives
1475 # -Wtype-limits - catches overflow bugs, few false positives
1476 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1478 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1479 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1480 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1481 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1483 # Turn off the following warnings that -Wall/-pedantic turn on:
1484 # -Wno-unused - lots of violations in third-party code
1485 # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1487 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1488 MOZ_C_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_c_has_wno_overlength_strings)
1490 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1491 # Don't use -Wcast-align with ICC or clang
1493 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1494 hppa | ia64 | sparc | arm)
1497 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1502 dnl Turn pedantic on but disable the warnings for long long
1505 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1506 _USE_CPP_INCLUDE_FLAG=1
1508 elif test "$SOLARIS_SUNPRO_CC"; then
1510 if test "$CPU_ARCH" = "sparc"; then
1511 # for Sun Studio on Solaris/SPARC
1512 DSO_PIC_CFLAGS='-xcode=pic32'
1514 DSO_PIC_CFLAGS='-KPIC'
1516 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1518 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1519 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1521 DSO_LDOPTS='-shared'
1522 if test "$GNU_LD"; then
1523 # Don't allow undefined symbols in libraries
1524 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1528 DSO_PIC_CFLAGS='-KPIC'
1529 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1532 if test "$GNU_CXX"; then
1533 # FIXME: Let us build with strict aliasing. bug 414641.
1534 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1536 # Turn on GNU-specific warnings:
1537 # -Wall - turn on a lot of warnings
1538 # -pedantic - this is turned on below
1539 # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1540 # -Woverloaded-virtual - ???
1541 # -Werror=return-type - catches missing returns, zero false positives
1542 # -Wtype-limits - catches overflow bugs, few false positives
1543 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1545 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1546 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1547 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1548 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1550 # Turn off the following warnings that -Wall/-pedantic turn on:
1551 # -Wno-ctor-dtor-privacy - ???
1552 # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1553 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1554 # -Wno-variadic-macros - ???
1556 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-ctor-dtor-privacy"
1557 MOZ_CXX_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_cxx_has_wno_overlength_strings)
1558 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1559 MOZ_CXX_SUPPORTS_WARNING(-Wno-, variadic-macros, ac_cxx_has_wno_variadic_macros)
1561 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1562 # Don't use -Wcast-align with ICC or clang
1564 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1565 hppa | ia64 | sparc | arm)
1568 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1573 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1574 _USE_CPP_INCLUDE_FLAG=1
1576 # Recent clang and gcc support C++11 deleted functions without warnings if
1577 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1578 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1579 # unused. But clang's warning can be disabled, so when compiling with clang
1580 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1581 # deleted function syntax.
1582 if test "$CLANG_CXX"; then
1583 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1584 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1588 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1591 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1592 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1593 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1594 dnl normal behavior.
1595 dnl ========================================================
1597 MKSHLIB_UNFORCE_ALL=
1599 if test "$COMPILE_ENVIRONMENT"; then
1600 if test "$GNU_CC"; then
1601 AC_MSG_CHECKING(whether ld has archive extraction flags)
1602 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1603 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1604 ac_cv_mkshlib_force_and_unforce="no"
1605 exec 3<&0 <<LOOP_INPUT
1606 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1607 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1608 force="-Wl,-all"; unforce="-Wl,-none"
1615 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1618 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1620 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1624 eval $ac_cv_mkshlib_force_and_unforce
1625 MKSHLIB_FORCE_ALL=$force
1626 MKSHLIB_UNFORCE_ALL=$unforce
1629 fi # COMPILE_ENVIRONMENT
1631 dnl ========================================================
1632 dnl Checking for 64-bit OS
1633 dnl ========================================================
1634 if test "$COMPILE_ENVIRONMENT"; then
1637 AC_MSG_CHECKING(for 64-bit OS)
1638 AC_TRY_COMPILE([$configure_static_assert_macros],
1639 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1640 result="yes", result="no")
1641 AC_MSG_RESULT("$result")
1642 if test "$result" = "yes"; then
1643 AC_DEFINE(HAVE_64BIT_OS)
1646 AC_SUBST(HAVE_64BIT_OS)
1648 fi # COMPILE_ENVIRONMENT
1650 dnl ========================================================
1651 dnl Enable high-memory support on OS/2 by default.
1652 dnl ========================================================
1653 MOZ_OS2_HIGH_MEMORY=1
1654 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1655 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1656 MOZ_OS2_HIGH_MEMORY=,
1657 MOZ_OS2_HIGH_MEMORY=1 )
1658 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1660 dnl ========================================================
1661 dnl = Use profiling compile flags
1662 dnl ========================================================
1663 MOZ_ARG_ENABLE_BOOL(profiling,
1664 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1668 # For profiling builds keep the symbol information
1669 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1670 STRIP_FLAGS="--strip-debug"
1673 dnl ========================================================
1675 dnl ========================================================
1676 MOZ_ARG_ENABLE_BOOL(valgrind,
1677 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1680 if test -n "$MOZ_VALGRIND"; then
1681 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1683 [--enable-valgrind specified but Valgrind is not installed]))
1684 AC_DEFINE(MOZ_VALGRIND)
1686 AC_SUBST(MOZ_VALGRIND)
1688 dnl ========================================================
1690 dnl ========================================================
1691 MOZ_ARG_ENABLE_BOOL(dmd,
1692 [ --enable-dmd Enable DMD; also disables jemalloc (default=no)],
1695 if test -n "$MOZ_DMD"; then
1696 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1698 [--enable-dmd specified but Valgrind is not installed]))
1702 dnl ========================================================
1704 dnl ========================================================
1705 MOZ_ARG_ENABLE_BOOL(jprof,
1706 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1709 if test -n "$MOZ_JPROF"; then
1711 AC_DEFINE(MOZ_JPROF)
1714 dnl ========================================================
1716 dnl ========================================================
1717 MOZ_ENABLE_PROFILER_SPS=1
1719 case "${OS_TARGET}" in
1721 case "${CPU_ARCH}" in
1724 MOZ_ENABLE_PROFILER_SPS=
1728 case "${CPU_ARCH}" in
1731 MOZ_ENABLE_PROFILER_SPS=
1736 MOZ_ENABLE_PROFILER_SPS=
1740 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1741 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1744 dnl ========================================================
1746 dnl ========================================================
1747 MOZ_ARG_ENABLE_BOOL(shark,
1748 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1751 if test -n "$MOZ_SHARK"; then
1753 AC_DEFINE(MOZ_SHARK)
1756 dnl ========================================================
1758 dnl ========================================================
1759 MOZ_ARG_ENABLE_BOOL(callgrind,
1760 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1763 if test -n "$MOZ_CALLGRIND"; then
1765 AC_DEFINE(MOZ_CALLGRIND)
1768 dnl ========================================================
1770 dnl ========================================================
1771 MOZ_ARG_ENABLE_BOOL(vtune,
1772 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1775 if test -n "$MOZ_VTUNE"; then
1777 AC_DEFINE(MOZ_VTUNE)
1780 dnl ========================================================
1782 dnl ========================================================
1783 if test -n "$MOZ_PROFILING"; then
1784 AC_DEFINE(MOZ_PROFILING)
1787 dnl ========================================================
1788 dnl System overrides of the defaults for host
1789 dnl ========================================================
1792 if test -n "$_WIN32_MSVC"; then
1794 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1795 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1796 HOST_RANLIB='echo ranlib'
1798 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1800 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1801 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1802 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1803 HOST_BIN_SUFFIX=.exe
1806 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1810 case "${host_cpu}" in
1812 if test -n "$_WIN32_MSVC"; then
1813 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1817 if test -n "$_WIN32_MSVC"; then
1818 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1820 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1826 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1827 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1828 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1831 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1832 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1833 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1834 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1838 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1839 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1840 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1841 HOST_BIN_SUFFIX=.exe
1846 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1847 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1851 dnl We require version 2.5 or newer of Python to build.
1852 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
1854 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
1857 if test "$_python_res" != 0; then
1858 AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
1860 AC_MSG_RESULT([yes])
1862 dnl Check for using a custom <stdint.h> implementation
1863 dnl ========================================================
1864 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1865 if test "$MOZ_CUSTOM_STDINT_H"; then
1866 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1867 AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1869 AC_MSG_RESULT(none specified)
1872 dnl Get mozilla version from central milestone file
1873 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1874 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1876 dnl Get version of various core apps from the version files.
1877 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1879 if test -z "$FIREFOX_VERSION"; then
1880 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1883 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1884 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1885 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1887 MOZ_DOING_LTO(lto_is_enabled)
1889 dnl ========================================================
1890 dnl System overrides of the defaults for target
1891 dnl ========================================================
1896 if test ! "$GNU_CC"; then
1897 if test ! "$HAVE_64BIT_OS"; then
1898 # Compiling with Visual Age C++ object model compat is the
1899 # default. To compile with object model ibm, add
1900 # AIX_OBJMODEL=ibm to .mozconfig.
1901 if test "$AIX_OBJMODEL" = "ibm"; then
1902 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1909 AC_SUBST(AIX_OBJMODEL)
1910 DSO_LDOPTS='-qmkshrobj=1'
1911 DSO_CFLAGS='-qflag=w:w'
1913 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1915 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1916 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1917 if test "$COMPILE_ENVIRONMENT"; then
1920 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1922 [#if (__IBMCPP__ < 900)
1923 #error "Bad compiler"
1925 _BAD_COMPILER=,_BAD_COMPILER=1)
1926 if test -n "$_BAD_COMPILER"; then
1928 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1930 AC_MSG_RESULT([yes])
1933 TARGET_COMPILER_ABI="ibmc"
1934 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1935 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1938 case "${target_os}" in
1943 if test "$COMPILE_ENVIRONMENT"; then
1944 MOZ_CHECK_HEADERS(sys/inttypes.h)
1946 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1950 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1959 _WARNINGS_CFLAGS="-Wall"
1960 _WARNINGS_CXXFLAGS="-Wall"
1961 # The test above doesn't work properly, at least on 3.1.
1962 MKSHLIB_FORCE_ALL=''
1963 MKSHLIB_UNFORCE_ALL=''
1969 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1970 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1971 MOZ_OPTIMIZE_FLAGS="-O3"
1973 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1974 if test "$HAVE_64BIT_OS"; then
1979 STRIP="$STRIP -x -S"
1980 # Check whether we're targeting OS X or iOS
1981 AC_CACHE_CHECK(for iOS target,
1983 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1984 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1988 ac_cv_ios_target="yes",
1989 ac_cv_ios_target="no")])
1990 if test "$ac_cv_ios_target" = "yes"; then
1992 AC_DEFINE(XP_DARWIN)
1993 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1995 AC_DEFINE(XP_MACOSX)
1996 AC_DEFINE(XP_DARWIN)
1997 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1998 # The ExceptionHandling framework is needed for Objective-C exception
1999 # logging code in nsObjCExceptions.h. Currently we only use that in debug
2001 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
2003 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2006 if test "x$lto_is_enabled" = "xyes"; then
2007 echo "Skipping -dead_strip because lto is enabled."
2008 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2009 dnl ===================================================================
2010 elif test "x$enable_dtrace" = "xyes"; then
2011 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2013 dnl check for the presence of the -dead_strip linker flag
2014 AC_MSG_CHECKING([for -dead_strip option to ld])
2015 _SAVE_LDFLAGS=$LDFLAGS
2016 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2017 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2018 if test -n "$_HAVE_DEAD_STRIP" ; then
2019 AC_MSG_RESULT([yes])
2020 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2025 LDFLAGS=$_SAVE_LDFLAGS
2028 dnl With newer linkers we need to pass -allow_heap_execute because of
2029 dnl Microsoft Silverlight (5.1.10411.0 at least).
2030 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
2031 _SAVE_LDFLAGS=$LDFLAGS
2032 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
2033 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
2034 _HAVE_ALLOW_HEAP_EXECUTE=)
2035 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
2036 AC_MSG_RESULT([yes])
2037 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
2041 LDFLAGS=$_SAVE_LDFLAGS
2043 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2047 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2048 DLL_SUFFIX=".so.1.0"
2049 DSO_LDOPTS="-shared"
2051 if test ! "$GNU_CC"; then
2052 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2058 if test ! "$GNU_CC"; then
2062 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2063 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2064 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2067 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2068 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2071 MOZ_NATIVE_MAKEDEPEND=
2072 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2073 AC_DEFINE(_LARGEFILE64_SOURCE)
2078 if test ! "$GNU_CC"; then
2079 DSO_LDOPTS='-b -Wl,+s'
2082 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2083 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2084 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2086 DSO_LDOPTS='-b -E +s'
2087 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2088 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2090 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2091 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2094 *-android*|*-linuxandroid*)
2095 AC_DEFINE(NO_PW_GECOS)
2097 if test -n "$gonkdir"; then
2098 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2102 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2105 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2107 MOZ_GFX_OPTIMIZE_MOBILE=1
2108 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2112 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2113 # Similarly for GNU_CXX and INTEL_CXX.
2114 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2115 # -Os has been broken on Intel's C/C++ compilers for quite a
2116 # while; Intel recommends against using it.
2117 MOZ_OPTIMIZE_FLAGS="-O2"
2118 MOZ_DEBUG_FLAGS="-g"
2119 elif test "$GNU_CC" -o "$GNU_CXX"; then
2120 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2121 case $GCC_VERSION in
2123 # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2124 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2126 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2127 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2128 MOZ_DEBUG_FLAGS="-g"
2131 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2135 case "${target_cpu}" in
2137 CFLAGS="$CFLAGS -mieee"
2138 CXXFLAGS="$CXXFLAGS -mieee"
2144 MOZ_DEBUG_FLAGS="-g" # We want inlining
2148 if test -z "$MC"; then
2158 # certain versions of cygwin's makedepend barf on the
2159 # #include <string> vs -I./dist/include/string issue so don't use it
2160 MOZ_NATIVE_MAKEDEPEND=
2161 if test -n "$GNU_CC"; then
2163 CXX="$CXX -mwindows"
2164 CPP="$CPP -mwindows"
2165 CFLAGS="$CFLAGS -mms-bitfields"
2166 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2167 DSO_LDOPTS='-shared'
2168 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2169 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2171 # Use temp file for windres (bug 213281)
2172 RCFLAGS='-O coff --use-temp-file'
2173 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2174 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv"
2176 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2177 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2179 IMPORT_LIB_SUFFIX=dll.a
2180 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2182 TARGET_COMPILER_ABI=msvc
2186 if test "$AS_BIN"; then
2187 AS="$(basename "$AS_BIN")"
2190 AR_FLAGS='-NOLOGO -OUT:"$@"'
2192 RANLIB='echo not_ranlib'
2193 STRIP='echo not_strip'
2204 IMPORT_LIB_SUFFIX=lib
2205 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2206 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2208 MKSHLIB_UNFORCE_ALL=
2209 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2210 _USE_CPP_INCLUDE_FLAG=1
2211 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2212 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2213 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2214 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2215 CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2216 # make 'foo == bar;' error out
2217 CFLAGS="$CFLAGS -we4553"
2218 CXXFLAGS="$CXXFLAGS -we4553"
2219 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2220 MOZ_DEBUG_FLAGS='-Zi'
2221 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2222 WARNINGS_AS_ERRORS='-WX'
2223 MOZ_OPTIMIZE_FLAGS='-O1'
2225 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2226 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2227 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2228 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2229 if test $_MSC_VER -ge 1400; then
2230 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2231 dnl For profile-guided optimization
2232 PROFILE_GEN_CFLAGS="-GL"
2233 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2234 dnl XXX: PGO builds can fail with warnings treated as errors,
2235 dnl specifically "no profile data available" appears to be
2236 dnl treated as an error sometimes. This might be a consequence
2237 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2238 dnl with the linker doing most of the work in the whole-program
2239 dnl optimization/PGO case. I think it's probably a compiler bug,
2240 dnl but we work around it here.
2241 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2242 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2243 dnl Probably also a compiler bug, but what can you do?
2244 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2245 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2248 AC_DEFINE(HAVE_SNPRINTF)
2253 AC_DEFINE(HW_THREADS)
2254 AC_DEFINE(STDC_HEADERS)
2255 AC_DEFINE(NEW_H, <new>)
2256 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2257 TARGET_MD_ARCH=win32
2258 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2260 MOZ_USER_DIR="Mozilla"
2262 dnl Hardcode to win95 for now - cls
2263 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2265 dnl set NO_X11 defines here as the general check is skipped on win32
2271 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2272 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2278 if test -z "$MOZ_TOOLS"; then
2279 AC_MSG_ERROR([MOZ_TOOLS is not set])
2281 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2282 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2283 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2285 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2286 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2287 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2294 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.])
2300 if test "$HAVE_64BIT_OS"; then
2301 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2304 if test $_MSC_VER -ge 1400; then
2305 LDFLAGS="$LDFLAGS -SAFESEH"
2308 if test -n "$GNU_CC"; then
2309 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2310 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2312 AC_DEFINE(HAVE_STDCALL)
2313 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2316 MOZ_CHECK_HEADERS(mmintrin.h)
2320 if test -n "$_WIN32_MSVC"; then
2321 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2326 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2330 if test "$HAVE_64BIT_OS"; then
2337 CFLAGS="$CFLAGS -Dunix"
2338 CXXFLAGS="$CXXFLAGS -Dunix"
2339 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2341 DSO_PIC_CFLAGS='-fPIC -DPIC'
2342 DSO_LDOPTS='-shared'
2343 BIN_FLAGS='-Wl,--export-dynamic'
2345 DSO_PIC_CFLAGS='-fPIC -DPIC'
2346 DLL_SUFFIX=".so.1.0"
2347 DSO_LDOPTS='-shared'
2349 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2350 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2351 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2352 if test "$LIBRUNPATH"; then
2353 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2355 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2356 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2360 if test "$SO_VERSION"; then
2361 DLL_SUFFIX=".so.$SO_VERSION"
2363 DLL_SUFFIX=".so.1.0"
2365 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2367 DSO_PIC_CFLAGS='-fPIC'
2368 DSO_LDOPTS='-shared -fPIC'
2369 if test "$LIBRUNPATH"; then
2370 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2375 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2376 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2379 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2380 AC_DEFINE(TCPV40HDRS)
2386 IMPORT_LIB_SUFFIX=lib
2390 CFLAGS="$CFLAGS -Zomf"
2391 CXXFLAGS="$CXXFLAGS -Zomf"
2393 BIN_FLAGS='-Zlinker /ST:0x100000'
2397 WARNINGS_AS_ERRORS='-Werror'
2398 MOZ_DEBUG_FLAGS="-g -fno-inline"
2399 MOZ_OPTIMIZE_FLAGS="-O2"
2400 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2401 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2402 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2404 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2408 MOZ_USER_DIR="Mozilla"
2411 if test "$MOZTOOLS"; then
2412 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2414 AC_MSG_ERROR([MOZTOOLS is not set])
2416 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2417 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2418 LDFLAGS="$LDFLAGS -Zhigh-mem"
2419 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2420 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2423 # GCC for OS/2 currently predefines these, but we don't want them
2424 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2425 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2427 AC_CACHE_CHECK(for __declspec(dllexport),
2429 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2431 ac_os2_declspec="yes",
2432 ac_os2_declspec="no")])
2433 if test "$ac_os2_declspec" != "yes"; then
2434 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2440 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2441 MOZ_NATIVE_MAKEDEPEND=
2443 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2444 # libraries one level up (e.g. libnspr4.so)
2445 if test "$SOLARIS_SUNPRO_CC"; then
2446 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2447 LIBS="-lCrun -lCstd -lc $LIBS"
2448 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2449 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2450 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2451 LDFLAGS="-xildoff $LDFLAGS"
2452 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2453 _SAVE_LDFLAGS=$LDFLAGS
2454 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2455 AC_TRY_LINK([#include <stdio.h>],
2456 [printf("Hello World\n");],
2458 [LDFLAGS=$_SAVE_LDFLAGS])
2460 MOZ_OPTIMIZE_FLAGS="-xO4"
2461 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2462 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2463 MKSHLIB_FORCE_ALL='-z allextract'
2464 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2471 AS='/usr/ccs/bin/as'
2472 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2474 TARGET_COMPILER_ABI="sunc"
2475 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2476 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2477 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2481 [#if (__SUNPRO_CC < 0x590)
2484 _BAD_COMPILER=,_BAD_COMPILER=1)
2485 if test -n "$_BAD_COMPILER"; then
2487 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2492 [#if (__SUNPRO_CC >= 0x5100)
2493 #error "Sun C++ 5.10 or above"
2495 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2496 if test "$_ABOVE_SS12U1"; then
2498 CXXFLAGS="$CXXFLAGS -xannotate=no"
2500 AC_MSG_RESULT([$_res])
2503 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2505 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2506 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2507 ASFLAGS="$ASFLAGS -fPIC"
2508 DSO_LDOPTS='-shared'
2509 WARNINGS_AS_ERRORS='-Werror'
2511 _WARNINGS_CXXFLAGS=''
2512 if test "$OS_RELEASE" = "5.3"; then
2513 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2516 if test "$OS_RELEASE" = "5.5.1"; then
2517 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2522 DSO_LDOPTS='-Bdynamic'
2523 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2524 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2526 AC_DEFINE(SPRINTF_RETURNS_STRING)
2527 case "$(target_os)" in
2529 DLL_SUFFIX='.so.1.0'
2535 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2540 AC_SUBST(MOZ_LINKER)
2541 if test -n "$MOZ_LINKER"; then
2542 AC_DEFINE(MOZ_LINKER)
2544 AC_SUBST(MOZ_ENABLE_SZIP)
2546 dnl Only one oddball right now (QNX), but this gives us flexibility
2547 dnl if any other platforms need to override this in the future.
2548 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2550 dnl ========================================================
2551 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2552 dnl by now will not have any way to link most binaries (tests
2553 dnl as well as viewer, apprunner, etc.), because some symbols
2554 dnl will be left out of the "composite" .so's by ld as unneeded.
2555 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2556 dnl they can link in the static libs that provide the missing
2558 dnl ========================================================
2559 NO_LD_ARCHIVE_FLAGS=
2560 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2561 NO_LD_ARCHIVE_FLAGS=1
2565 NO_LD_ARCHIVE_FLAGS=
2568 NO_LD_ARCHIVE_FLAGS=
2571 if test -z "$GNU_CC"; then
2572 NO_LD_ARCHIVE_FLAGS=
2576 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2578 dnl ========================================================
2579 dnl = Flags to strip unused symbols from .so components and
2580 dnl = to export jemalloc symbols when linking a program
2581 dnl ========================================================
2583 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2584 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2587 if test -z "$GNU_CC"; then
2588 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2590 if test -z "$GCC_USE_GNU_LD"; then
2591 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2593 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2598 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2601 if test -n "$GNU_CC"; then
2602 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2607 if test -z "$COMPILE_ENVIRONMENT"; then
2608 SKIP_COMPILER_CHECKS=1
2609 SKIP_LIBRARY_CHECKS=1
2613 if test -z "$SKIP_COMPILER_CHECKS"; then
2614 dnl Checks for typedefs, structures, and compiler characteristics.
2615 dnl ========================================================
2623 AC_MSG_CHECKING(for __stdcall)
2624 AC_CACHE_VAL(ac_cv___stdcall,
2625 [AC_TRY_COMPILE([template <typename Method> struct foo;
2626 template <> struct foo<void (*)()> {};
2627 template <> struct foo<void (__stdcall*)()> {};],
2629 [ac_cv___stdcall=true],
2630 [ac_cv___stdcall=false])])
2631 if test "$ac_cv___stdcall" = true ; then
2632 AC_DEFINE(HAVE_STDCALL)
2638 AC_MSG_CHECKING(for ssize_t)
2639 AC_CACHE_VAL(ac_cv_type_ssize_t,
2640 [AC_TRY_COMPILE([#include <stdio.h>
2641 #include <sys/types.h>],
2643 [ac_cv_type_ssize_t=true],
2644 [ac_cv_type_ssize_t=false])])
2645 if test "$ac_cv_type_ssize_t" = true ; then
2646 AC_DEFINE(HAVE_SSIZE_T)
2651 AC_STRUCT_ST_BLKSIZE
2652 AC_MSG_CHECKING(for siginfo_t)
2653 AC_CACHE_VAL(ac_cv_siginfo_t,
2654 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2655 #include <signal.h>],
2657 [ac_cv_siginfo_t=true],
2658 [ac_cv_siginfo_t=false])])
2659 if test "$ac_cv_siginfo_t" = true ; then
2660 AC_DEFINE(HAVE_SIGINFO_T)
2666 dnl Check for int64, uint, and uint_t.
2667 dnl ========================================================
2668 AC_MSG_CHECKING(for int64)
2669 AC_CACHE_VAL(ac_cv_int64,
2670 [AC_TRY_COMPILE([#include <stdio.h>
2671 #include <sys/types.h>],
2674 [ac_cv_int64=false])])
2675 if test "$ac_cv_int64" = true ; then
2676 AC_DEFINE(HAVE_INT64)
2681 AC_MSG_CHECKING(for uint)
2682 AC_CACHE_VAL(ac_cv_uint,
2683 [AC_TRY_COMPILE([#include <stdio.h>
2684 #include <sys/types.h>],
2687 [ac_cv_uint=false])])
2688 if test "$ac_cv_uint" = true ; then
2689 AC_DEFINE(HAVE_UINT)
2694 AC_MSG_CHECKING(for uint_t)
2695 AC_CACHE_VAL(ac_cv_uint_t,
2696 [AC_TRY_COMPILE([#include <stdio.h>
2697 #include <sys/types.h>],
2699 [ac_cv_uint_t=true],
2700 [ac_cv_uint_t=false])])
2701 if test "$ac_cv_uint_t" = true ; then
2702 AC_DEFINE(HAVE_UINT_T)
2708 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2709 dnl are defined when compiling C++ but not C. Since the result of this
2710 dnl test is used only in C++, do it in C++.
2713 AC_MSG_CHECKING(for uname.domainname)
2714 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2715 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2716 [ struct utsname *res; char *domain;
2717 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2718 [ac_cv_have_uname_domainname_field=true],
2719 [ac_cv_have_uname_domainname_field=false])])
2721 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2722 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2728 AC_MSG_CHECKING(for uname.__domainname)
2729 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2730 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2731 [ struct utsname *res; char *domain;
2732 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2733 [ac_cv_have_uname_us_domainname_field=true],
2734 [ac_cv_have_uname_us_domainname_field=false])])
2736 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2737 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2743 dnl Check whether we can use gcc's c++0x mode
2746 if test "$GNU_CXX"; then
2747 _SAVE_CXXFLAGS=$CXXFLAGS
2748 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2750 AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2751 ac_cv_cxx0x_headers_bug,
2752 [AC_TRY_COMPILE([#include <memory>], [],
2753 ac_cv_cxx0x_headers_bug="no",
2754 ac_cv_cxx0x_headers_bug="yes")])
2755 CXXFLAGS="$_SAVE_CXXFLAGS"
2756 if test "$ac_cv_cxx0x_headers_bug" = "no"; then
2757 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2761 dnl Check for usable char16_t (2 bytes, unsigned)
2762 dnl (we might not need the unsignedness check anymore)
2763 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2764 ac_cv_have_usable_char16_t,
2765 [AC_TRY_COMPILE([$configure_static_assert_macros],
2766 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2767 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2768 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2769 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2770 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2771 ac_cv_have_usable_char16_t="yes",
2772 ac_cv_have_usable_char16_t="no")])
2773 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2774 AC_DEFINE(HAVE_CPP_CHAR16_T)
2776 elif test "$GNU_CXX"; then
2777 CXXFLAGS="$_SAVE_CXXFLAGS"
2780 dnl Check for usable wchar_t (2 bytes, unsigned)
2781 dnl (we really don't need the unsignedness check anymore)
2782 dnl ========================================================
2784 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2785 ac_cv_have_usable_wchar_v2,
2786 [AC_TRY_COMPILE([#include <stddef.h>
2787 $configure_static_assert_macros],
2788 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2789 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2790 ac_cv_have_usable_wchar_v2="yes",
2791 ac_cv_have_usable_wchar_v2="no")])
2792 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2793 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2794 HAVE_CPP_2BYTE_WCHAR_T=1
2795 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2796 dnl This is really gcc-only
2797 dnl Do this test using CXX only since some versions of gcc
2798 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2799 dnl only have short-wchar support for c++.
2800 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2802 _SAVE_CXXFLAGS=$CXXFLAGS
2803 CXXFLAGS="$CXXFLAGS -fshort-wchar"
2805 AC_CACHE_CHECK(for compiler -fshort-wchar option,
2806 ac_cv_have_usable_wchar_option_v2,
2807 [AC_TRY_LINK([#include <stddef.h>
2808 $configure_static_assert_macros],
2809 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2810 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2811 ac_cv_have_usable_wchar_option_v2="yes",
2812 ac_cv_have_usable_wchar_option_v2="no")])
2814 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2815 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2816 HAVE_CPP_2BYTE_WCHAR_T=1
2817 if test "$OS_TARGET" = Android; then
2818 WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
2819 CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
2820 CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
2821 DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
2823 WCHAR_CFLAGS="-fshort-wchar"
2826 CXXFLAGS=$_SAVE_CXXFLAGS
2832 dnl Check for .hidden assembler directive and visibility attribute.
2833 dnl Borrowed from glibc configure.in
2834 dnl ===============================================================
2835 if test "$GNU_CC"; then
2836 AC_CACHE_CHECK(for visibility(hidden) attribute,
2837 ac_cv_visibility_hidden,
2838 [cat > conftest.c <<EOF
2839 int foo __attribute__ ((visibility ("hidden"))) = 1;
2841 ac_cv_visibility_hidden=no
2842 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2843 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2844 ac_cv_visibility_hidden=yes
2849 if test "$ac_cv_visibility_hidden" = "yes"; then
2850 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2852 AC_CACHE_CHECK(for visibility(default) attribute,
2853 ac_cv_visibility_default,
2854 [cat > conftest.c <<EOF
2855 int foo __attribute__ ((visibility ("default"))) = 1;
2857 ac_cv_visibility_default=no
2858 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2859 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2860 ac_cv_visibility_default=yes
2865 if test "$ac_cv_visibility_default" = "yes"; then
2866 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2868 AC_CACHE_CHECK(for visibility pragma support,
2869 ac_cv_visibility_pragma,
2870 [cat > conftest.c <<EOF
2871 #pragma GCC visibility push(hidden)
2873 #pragma GCC visibility push(default)
2874 int foo_default = 1;
2876 ac_cv_visibility_pragma=no
2877 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2878 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2879 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2880 ac_cv_visibility_pragma=yes
2886 if test "$ac_cv_visibility_pragma" = "yes"; then
2887 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2888 ac_cv_have_visibility_class_bug,
2889 [cat > conftest.c <<EOF
2890 #pragma GCC visibility push(hidden)
2891 struct __attribute__ ((visibility ("default"))) TestStruct {
2894 __attribute__ ((visibility ("default"))) void TestFunc() {
2898 ac_cv_have_visibility_class_bug=no
2899 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2900 ac_cv_have_visibility_class_bug=yes
2902 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2903 ac_cv_have_visibility_class_bug=yes
2906 rm -rf conftest.{c,S}
2909 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2910 ac_cv_have_visibility_builtin_bug,
2911 [cat > conftest.c <<EOF
2912 #pragma GCC visibility push(hidden)
2913 #pragma GCC visibility push(default)
2915 #pragma GCC visibility pop
2917 __attribute__ ((visibility ("default"))) void Func() {
2919 memset(c, 0, sizeof(c));
2922 ac_cv_have_visibility_builtin_bug=no
2923 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2924 ac_cv_have_visibility_builtin_bug=yes
2926 if test `grep -c "@PLT" conftest.S` = 0; then
2927 ac_cv_visibility_builtin_bug=yes
2930 rm -f conftest.{c,S}
2932 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2933 "$ac_cv_have_visibility_class_bug" = "no"; then
2934 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2935 WRAP_SYSTEM_INCLUDES=1
2936 STL_FLAGS='-I$(DIST)/stl_wrappers'
2939 VISIBILITY_FLAGS='-fvisibility=hidden'
2940 fi # have visibility pragma bug
2941 fi # have visibility pragma
2942 fi # have visibility(default) attribute
2943 fi # have visibility(hidden) attribute
2946 # visibility hidden flag for Sun Studio on Solaris
2947 if test "$SOLARIS_SUNPRO_CC"; then
2948 VISIBILITY_FLAGS='-xldscope=hidden'
2949 fi # Sun Studio on Solaris
2951 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2952 AC_SUBST(VISIBILITY_FLAGS)
2956 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2957 dnl ========================================================
2958 if test "$GNU_CC"; then
2959 CFLAGS_save="${CFLAGS}"
2960 CFLAGS="${CFLAGS} -Werror"
2961 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2962 ac_cv_force_align_arg_pointer,
2963 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2965 ac_cv_force_align_arg_pointer="yes",
2966 ac_cv_force_align_arg_pointer="no")])
2967 CFLAGS="${CFLAGS_save}"
2968 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2969 HAVE_GCC_ALIGN_ARG_POINTER=1
2971 HAVE_GCC_ALIGN_ARG_POINTER=
2974 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2976 dnl Checks for header files.
2977 dnl ========================================================
2979 case "$target_os" in
2981 # for stuff like -lXshm
2982 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2985 MOZ_CHECK_COMMON_HEADERS
2987 dnl These are all the places some variant of statfs can be hiding.
2988 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2991 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2992 MOZ_CHECK_HEADERS(linux/quota.h)
2994 dnl Try for MMX support
2995 dnl NB - later gcc versions require -mmmx for this header to be successfully
2996 dnl included (or another option which implies it, such as -march=pentium-mmx)
2997 MOZ_CHECK_HEADERS(mmintrin.h)
2999 dnl Check whether the compiler supports the new-style C++ standard
3000 dnl library headers (i.e. <new>) or needs the old "new.h"
3003 MOZ_CHECK_HEADER(new, [NEW_H=new])
3004 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3007 AC_ARG_ENABLE(dtrace,
3008 [ --enable-dtrace build with dtrace support if available (default=no)],
3009 [enable_dtrace="yes"],)
3010 if test "x$enable_dtrace" = "xyes"; then
3011 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3012 if test -n "$HAVE_DTRACE"; then
3013 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3015 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3018 AC_SUBST(HAVE_DTRACE)
3024 MOZ_CHECK_HEADERS(sys/cdefs.h)
3028 dnl Checks for libraries.
3029 dnl ========================================================
3034 AC_CHECK_LIB(c_r, gethostbyname_r)
3038 dnl We don't want to link with libdl even if it's present on OS X, since
3039 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3041 dnl We don't want to link against libm or libpthread on Darwin since
3042 dnl they both are just symlinks to libSystem and explicitly linking
3043 dnl against libSystem causes issues when debugging (see bug 299601).
3050 AC_SEARCH_LIBS(dlopen, dl,
3051 MOZ_CHECK_HEADER(dlfcn.h,
3052 AC_DEFINE(HAVE_DLOPEN)))
3056 _SAVE_CFLAGS="$CFLAGS"
3057 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3058 AC_CHECK_FUNCS(dladdr memmem)
3059 CFLAGS="$_SAVE_CFLAGS"
3061 if test ! "$GNU_CXX"; then
3065 AC_CHECK_LIB(C_r, demangle)
3068 AC_CHECK_LIB(C, demangle)
3073 dnl OS/2 has socket in libc.
3078 AC_CHECK_LIB(socket, socket)
3082 XLIBS="$X_EXTRA_LIBS"
3084 dnl ========================================================
3085 dnl Checks for X libraries.
3086 dnl Ordering is important.
3087 dnl Xt is dependent upon SM as of X11R6
3088 dnl ========================================================
3089 if test "$no_x" = "yes"; then
3092 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3093 XLIBS="-lX11 $XLIBS"
3094 _SAVE_LDFLAGS="$LDFLAGS"
3095 LDFLAGS="$XLDFLAGS $LDFLAGS"
3096 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3097 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3098 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3099 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3101 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3102 unset ac_cv_lib_Xt_XtFree
3103 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3104 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3105 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3106 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3109 # AIX needs the motif library linked before libXt to prevent
3110 # crashes in plugins linked against Motif - Bug #98892
3111 case "${target_os}" in
3113 XT_LIBS="-lXm $XT_LIBS"
3117 dnl ========================================================
3118 dnl = Check for XShm
3119 dnl ========================================================
3120 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3123 dnl ========================================================
3125 dnl ========================================================
3126 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3127 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3128 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3129 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3131 LDFLAGS="$_SAVE_LDFLAGS"
3141 dnl ========================================================
3142 dnl = pthread support
3143 dnl = Start by checking whether the system support pthreads
3144 dnl ========================================================
3145 case "$target_os" in
3150 MOZ_CHECK_PTHREADS(pthreads,
3151 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3152 MOZ_CHECK_PTHREADS(pthread,
3153 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3154 MOZ_CHECK_PTHREADS(c_r,
3155 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3156 MOZ_CHECK_PTHREADS(c,
3165 dnl ========================================================
3166 dnl Check the command line for --with-pthreads
3167 dnl ========================================================
3168 MOZ_ARG_WITH_BOOL(pthreads,
3169 [ --with-pthreads Force use of system pthread library with NSPR ],
3170 [ if test "$USE_PTHREADS"x = x; then
3171 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3177 dnl ========================================================
3178 dnl Do the platform specific pthread hackery
3179 dnl ========================================================
3180 if test "$USE_PTHREADS"x != x
3183 dnl See if -pthread is supported.
3186 ac_cv_have_dash_pthread=no
3187 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3188 echo 'int main() { return 0; }' | cat > conftest.c
3189 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3190 if test $? -eq 0; then
3191 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3192 ac_cv_have_dash_pthread=yes
3193 case "$target_os" in
3195 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3198 CFLAGS="$CFLAGS -pthread"
3199 CXXFLAGS="$CXXFLAGS -pthread"
3205 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3208 dnl See if -pthreads is supported.
3210 ac_cv_have_dash_pthreads=no
3211 if test "$ac_cv_have_dash_pthread" = "no"; then
3212 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3213 echo 'int main() { return 0; }' | cat > conftest.c
3214 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3215 if test $? -eq 0; then
3216 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3217 ac_cv_have_dash_pthreads=yes
3218 CFLAGS="$CFLAGS -pthreads"
3219 CXXFLAGS="$CXXFLAGS -pthreads"
3223 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3228 AC_DEFINE(_REENTRANT)
3229 AC_DEFINE(_THREAD_SAFE)
3230 dnl -pthread links in -lc_r, so don't specify it explicitly.
3231 if test "$ac_cv_have_dash_pthread" = "yes"; then
3232 _PTHREAD_LDFLAGS="-pthread"
3234 _PTHREAD_LDFLAGS="-lc_r"
3238 *-*-openbsd*|*-*-bsdi*)
3239 AC_DEFINE(_REENTRANT)
3240 AC_DEFINE(_THREAD_SAFE)
3241 dnl -pthread links in -lc_r, so don't specify it explicitly.
3242 if test "$ac_cv_have_dash_pthread" = "yes"; then
3243 _PTHREAD_LDFLAGS="-pthread"
3247 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3248 AC_DEFINE(_REENTRANT)
3252 AC_DEFINE(_REENTRANT)
3256 AC_DEFINE(_REENTRANT)
3260 AC_DEFINE(_REENTRANT)
3261 if test "$SOLARIS_SUNPRO_CC"; then
3262 CFLAGS="$CFLAGS -mt"
3263 CXXFLAGS="$CXXFLAGS -mt"
3267 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3271 dnl Checks for library functions.
3272 dnl ========================================================
3273 AC_PROG_GCC_TRADITIONAL
3275 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3276 AC_CHECK_FUNCS(flockfile getpagesize)
3277 AC_CHECK_FUNCS(localtime_r strtok_r)
3279 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3280 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3281 ac_cv_clock_monotonic,
3282 [for libs in "" -lrt; do
3285 AC_TRY_LINK([#include <time.h>],
3286 [ struct timespec ts;
3287 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3288 ac_cv_clock_monotonic=$libs
3290 ac_cv_clock_monotonic=no)
3293 if test "$ac_cv_clock_monotonic" != "no"; then
3294 HAVE_CLOCK_MONOTONIC=1
3295 REALTIME_LIBS=$ac_cv_clock_monotonic
3296 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3297 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3298 AC_SUBST(REALTIME_LIBS)
3301 dnl check for wcrtomb/mbrtowc
3302 dnl =======================================================================
3303 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3306 AC_CACHE_CHECK(for wcrtomb,
3308 [AC_TRY_LINK([#include <wchar.h>],
3309 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3310 ac_cv_have_wcrtomb="yes",
3311 ac_cv_have_wcrtomb="no")])
3312 if test "$ac_cv_have_wcrtomb" = "yes"; then
3313 AC_DEFINE(HAVE_WCRTOMB)
3315 AC_CACHE_CHECK(for mbrtowc,
3317 [AC_TRY_LINK([#include <wchar.h>],
3318 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3319 ac_cv_have_mbrtowc="yes",
3320 ac_cv_have_mbrtowc="no")])
3321 if test "$ac_cv_have_mbrtowc" = "yes"; then
3322 AC_DEFINE(HAVE_MBRTOWC)
3329 ac_cv_func_res_ninit,
3332 #define _BSD_SOURCE 1
3336 [int foo = res_ninit(&_res);],
3337 [ac_cv_func_res_ninit=yes],
3338 [ac_cv_func_res_ninit=no])
3341 if test "$ac_cv_func_res_ninit" = "yes"; then
3342 AC_DEFINE(HAVE_RES_NINIT)
3343 dnl must add the link line we do something as foolish as this... dougt
3345 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3346 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3351 [for gnu_get_libc_version()],
3352 ac_cv_func_gnu_get_libc_version,
3354 #ifdef HAVE_GNU_LIBC_VERSION_H
3355 #include <gnu/libc-version.h>
3358 [const char *glibc_version = gnu_get_libc_version();],
3359 [ac_cv_func_gnu_get_libc_version=yes],
3360 [ac_cv_func_gnu_get_libc_version=no]
3364 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3365 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3369 darwin*|mingw*|os2*)
3373 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3374 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3375 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3377 LIBS="$LIBS $_ICONV_LIBS"
3386 iconv_t h = iconv_open("", "");
3387 iconv(h, NULL, NULL, NULL, NULL);
3390 [ac_cv_func_iconv=yes],
3391 [ac_cv_func_iconv=no]
3394 if test "$ac_cv_func_iconv" = "yes"; then
3395 AC_DEFINE(HAVE_ICONV)
3396 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3397 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3398 LIBICONV="$_ICONV_LIBS"
3400 [for iconv() with const input],
3401 ac_cv_func_const_iconv,
3407 const char *input = "testing";
3408 iconv_t h = iconv_open("", "");
3409 iconv(h, &input, NULL, NULL, NULL);
3412 [ac_cv_func_const_iconv=yes],
3413 [ac_cv_func_const_iconv=no]
3416 if test "$ac_cv_func_const_iconv" = "yes"; then
3417 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3429 dnl **********************
3430 dnl *** va_copy checks ***
3431 dnl **********************
3432 dnl we currently check for all three va_copy possibilities, so we get
3433 dnl all results in config.log for bug reports.
3434 AC_MSG_CHECKING(for an implementation of va_copy())
3435 AC_CACHE_VAL(ac_cv_va_copy,[
3438 void f (int i, ...) {
3439 va_list args1, args2;
3440 va_start (args1, i);
3441 va_copy (args2, args1);
3442 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3444 va_end (args1); va_end (args2);
3446 int main() { f (0, 42); return 0; }],
3452 AC_MSG_RESULT($ac_cv_va_copy)
3453 AC_MSG_CHECKING(for an implementation of __va_copy())
3454 AC_CACHE_VAL(ac_cv___va_copy,[
3457 void f (int i, ...) {
3458 va_list args1, args2;
3459 va_start (args1, i);
3460 __va_copy (args2, args1);
3461 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3463 va_end (args1); va_end (args2);
3465 int main() { f (0, 42); return 0; }],
3466 ac_cv___va_copy=yes,
3471 AC_MSG_RESULT($ac_cv___va_copy)
3472 AC_MSG_CHECKING(whether va_lists can be copied by value)
3473 AC_CACHE_VAL(ac_cv_va_val_copy,[
3476 void f (int i, ...) {
3477 va_list args1, args2;
3478 va_start (args1, i);
3480 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3482 va_end (args1); va_end (args2);
3484 int main() { f (0, 42); return 0; }],
3485 ac_cv_va_val_copy=yes,
3486 ac_cv_va_val_copy=no,
3487 ac_cv_va_val_copy=yes
3490 if test "x$ac_cv_va_copy" = "xyes"; then
3491 AC_DEFINE(VA_COPY, va_copy)
3492 AC_DEFINE(HAVE_VA_COPY)
3493 elif test "x$ac_cv___va_copy" = "xyes"; then
3494 AC_DEFINE(VA_COPY, __va_copy)
3495 AC_DEFINE(HAVE_VA_COPY)
3498 if test "x$ac_cv_va_val_copy" = "xno"; then
3499 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3501 AC_MSG_RESULT($ac_cv_va_val_copy)
3503 dnl ===================================================================
3504 dnl ========================================================
3505 dnl Put your C++ language/feature checks below
3506 dnl ========================================================
3510 if test "$GNU_CC"; then
3511 if test "$CPU_ARCH" = "arm" ; then
3512 AC_CACHE_CHECK(for ARM EABI,
3516 #if defined(__ARM_EABI__)
3519 #error Not ARM EABI.
3522 ac_cv_gcc_arm_eabi="yes",
3523 ac_cv_gcc_arm_eabi="no")])
3524 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3526 ARM_ABI_PREFIX=eabi-
3528 ARM_ABI_PREFIX=oabi-
3532 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3535 dnl Check for support of modern template specialization syntax
3536 dnl Test code and requirement from scc@netscape.com.
3537 dnl Autoconf cut-and-paste job by waterson@netscape.com
3538 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3539 ac_cv_cpp_modern_specialize_template_syntax,
3540 [AC_TRY_COMPILE(template <class T> struct X { int a; };
3542 template <> struct X<Y> { double a; };,
3545 ac_cv_cpp_modern_specialize_template_syntax=yes,
3546 ac_cv_cpp_modern_specialize_template_syntax=no)])
3547 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
3548 AC_MSG_ERROR([The C++ compiler does not support template specialization])
3551 dnl Some compilers support only full specialization, and some don't.
3552 AC_CACHE_CHECK(whether partial template specialization works,
3553 ac_cv_cpp_partial_specialization,
3554 [AC_TRY_COMPILE(template <class T> class Foo {};
3555 template <class T> class Foo<T*> {};,
3557 ac_cv_cpp_partial_specialization=yes,
3558 ac_cv_cpp_partial_specialization=no)])
3559 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3560 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3563 dnl Check to see if we can resolve ambiguity with |using|.
3564 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3565 ac_cv_cpp_ambiguity_resolving_using,
3566 [AC_TRY_COMPILE(class X {
3567 public: int go(const X&) {return 3;}
3568 int jo(const X&) {return 3;}
3570 class Y : public X {
3571 public: int go(int) {return 2;}
3572 int jo(int) {return 2;}
3574 private: using X::go;
3577 ac_cv_cpp_ambiguity_resolving_using=yes,
3578 ac_cv_cpp_ambiguity_resolving_using=no)])
3579 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3580 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3583 dnl See if a dynamic_cast to void* gives the most derived object.
3584 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3585 ac_cv_cpp_dynamic_cast_void_ptr,
3586 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3587 class Y { int j; public: virtual ~Y() { } };
3588 class Z : public X, public Y { int k; };
3594 return !((((void*)&mdo != (void*)subx) &&
3595 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3596 (((void*)&mdo != (void*)suby) &&
3597 ((void*)&mdo == dynamic_cast<void*>(suby))));
3599 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3600 ac_cv_cpp_dynamic_cast_void_ptr=no,
3601 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3602 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3603 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3607 dnl note that this one is reversed - if the test fails, then
3608 dnl we require implementations of unused virtual methods. Which
3609 dnl really blows because it means we'll have useless vtable
3611 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3612 ac_cv_cpp_unused_required,
3613 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3615 ac_cv_cpp_unused_required=no,
3616 ac_cv_cpp_unused_required=yes)])
3617 if test "$ac_cv_cpp_unused_required" = yes ; then
3618 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3622 dnl Some compilers have trouble comparing a constant reference to a templatized
3623 dnl class to zero, and require an explicit operator==() to be defined that takes
3624 dnl an int. This test separates the strong from the weak.
3626 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3627 ac_cv_trouble_comparing_to_zero,
3628 [AC_TRY_COMPILE([#include <algorithm>
3629 template <class T> class Foo {};
3631 template <class T> int operator==(const T2*, const T&) { return 0; }
3632 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3633 [Foo<int> f; return (0 != f);],
3634 ac_cv_trouble_comparing_to_zero=no,
3635 ac_cv_trouble_comparing_to_zero=yes)])
3636 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3637 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3640 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3641 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3642 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3644 _SAVE_LDFLAGS=$LDFLAGS
3645 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3646 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3647 ac_cv_thread_keyword,
3648 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3649 [return tlsIsMainThread;],
3650 ac_cv_thread_keyword=yes,
3651 ac_cv_thread_keyword=no)])
3652 LDFLAGS=$_SAVE_LDFLAGS
3653 # The custom dynamic linker doesn't support TLS variables
3655 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3656 # mips builds fail with TLS variables because of a binutils bug.
3662 *-android*|*-linuxandroid*)
3666 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3672 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3673 if test -n "$MOZ_LINKER"; then
3674 if test "$CPU_ARCH" = arm; then
3675 dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
3676 ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
3677 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3678 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3679 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000"
3680 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000"
3685 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3686 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3687 dnl We however want to avoid these text relocations, and this can be done
3688 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3689 dnl doesn't contain anything at all, beside placeholders for some sections,
3690 dnl and crtbegin only contains a finalizer function that calls
3691 dnl __cxa_finalize. The custom linker actually takes care of calling
3692 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3693 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3694 dnl link crtbegin and crtend at all.
3695 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$OS_TARGET" = "Android"; then
3696 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3697 ac_cv_crt_has_text_relocations,
3698 [echo 'int foo() { return 0; }' > conftest.cpp
3699 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3700 test -s conftest${DLL_SUFFIX}; then
3701 if readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3702 ac_cv_crt_has_text_relocations=yes
3704 ac_cv_crt_has_text_relocations=no
3707 AC_ERROR([couldn't compile a simple C file])
3710 if test "$ac_cv_crt_has_text_relocations" = yes; then
3711 dnl While we want libraries to skip the CRT files, we don't want
3712 dnl executables to be treated the same way. We thus set the flag
3713 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3714 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3715 dnl Using LDFLAGS in nspr is safe, since we only really build
3716 dnl libraries there.
3717 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3718 NSPR_LDFLAGS=-nostartfiles
3722 dnl Check for the existence of various allocation headers/functions
3725 MOZ_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
3726 if test "$MALLOC_H" = ""; then
3727 MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
3728 if test "$MALLOC_H" = ""; then
3729 MOZ_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
3732 if test "$MALLOC_H" != ""; then
3733 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3736 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3737 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3739 dnl See if compiler supports some gcc-style attributes
3741 AC_CACHE_CHECK(for __attribute__((always_inline)),
3742 ac_cv_attribute_always_inline,
3743 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3745 ac_cv_attribute_always_inline=yes,
3746 ac_cv_attribute_always_inline=no)])
3748 AC_CACHE_CHECK(for __attribute__((malloc)),
3749 ac_cv_attribute_malloc,
3750 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3752 ac_cv_attribute_malloc=yes,
3753 ac_cv_attribute_malloc=no)])
3755 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3756 ac_cv_attribute_warn_unused,
3757 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3759 ac_cv_attribute_warn_unused=yes,
3760 ac_cv_attribute_warn_unused=no)])
3762 dnl End of C++ language/feature checks
3765 dnl ========================================================
3766 dnl = Internationalization checks
3767 dnl ========================================================
3769 dnl Internationalization and Locale support is different
3770 dnl on various UNIX platforms. Checks for specific i18n
3771 dnl features go here.
3773 dnl check for LC_MESSAGES
3774 AC_CACHE_CHECK(for LC_MESSAGES,
3775 ac_cv_i18n_lc_messages,
3776 [AC_TRY_COMPILE([#include <locale.h>],
3777 [int category = LC_MESSAGES;],
3778 ac_cv_i18n_lc_messages=yes,
3779 ac_cv_i18n_lc_messages=no)])
3780 if test "$ac_cv_i18n_lc_messages" = yes; then
3781 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3784 AC_HAVE_FUNCS(localeconv)
3785 fi # ! SKIP_COMPILER_CHECKS
3788 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3789 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3792 dnl Mozilla specific options
3793 dnl ========================================================
3794 dnl The macros used for command line options
3795 dnl are defined in build/autoconf/altoptions.m4.
3797 dnl If the compiler supports these attributes, define them as
3798 dnl convenience macros.
3799 if test "$ac_cv_attribute_always_inline" = yes ; then
3800 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
3802 AC_DEFINE(NS_ALWAYS_INLINE,)
3805 if test "$ac_cv_attribute_malloc" = yes ; then
3806 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3808 AC_DEFINE(NS_ATTR_MALLOC,)
3811 if test "$ac_cv_attribute_warn_unused" = yes ; then
3812 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3814 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3817 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3818 dnl features that Windows actually does support.
3820 if test -n "$SKIP_COMPILER_CHECKS"; then
3821 dnl Windows has malloc.h
3822 AC_DEFINE(MALLOC_H, [<malloc.h>])
3823 AC_DEFINE(HAVE_FORCEINLINE)
3824 AC_DEFINE(HAVE_LOCALECONV)
3825 fi # SKIP_COMPILER_CHECKS
3827 dnl ========================================================
3829 dnl = Check for external package dependencies
3831 dnl ========================================================
3832 MOZ_ARG_HEADER(External Packages)
3834 MOZ_ARG_WITH_STRING(libxul-sdk,
3835 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3836 LIBXUL_SDK_DIR=$withval)
3838 if test "$LIBXUL_SDK_DIR" = "yes"; then
3839 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3840 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3841 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3843 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3844 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3848 AC_SUBST(LIBXUL_SDK)
3850 if test -n "$LIBXUL_SDK"; then
3851 LIBXUL_DIST="$LIBXUL_SDK"
3853 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3855 AC_SUBST(LIBXUL_DIST)
3859 MOZ_ARG_WITH_BOOL(system-libxul,
3860 [ --with-system-libxul Use system installed libxul SDK],
3863 dnl ========================================================
3864 dnl = If NSPR was not detected in the system,
3865 dnl = use the one in the source tree (mozilla/nsprpub)
3866 dnl ========================================================
3867 MOZ_ARG_WITH_BOOL(system-nspr,
3868 [ --with-system-nspr Use system installed NSPR],
3869 _USE_SYSTEM_NSPR=1 )
3871 if test -n "$_USE_SYSTEM_NSPR"; then
3872 AM_PATH_NSPR(4.9.0, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
3875 if test -n "$MOZ_NATIVE_NSPR"; then
3876 _SAVE_CFLAGS=$CFLAGS
3877 CFLAGS="$CFLAGS $NSPR_CFLAGS"
3878 AC_TRY_COMPILE([#include "prtypes.h"],
3879 [#ifndef PR_STATIC_ASSERT
3880 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3882 [MOZ_NATIVE_NSPR=1],
3883 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3884 AC_TRY_COMPILE([#include "prtypes.h"],
3886 #error PR_UINT64 not defined or requires including prtypes.h
3888 [MOZ_NATIVE_NSPR=1],
3889 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3890 CFLAGS=$_SAVE_CFLAGS
3892 if test "$OS_ARCH" = "WINNT"; then
3893 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3894 if test -n "$GNU_CC"; then
3895 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3897 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3900 NSPR_CFLAGS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
3901 NSPR_LIBS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
3905 dnl system libevent Support
3906 dnl ========================================================
3907 MOZ_ARG_WITH_STRING(system-libevent,
3908 [ --with-system-libevent=[PFX]
3909 Use system libevent [installed at prefix PFX]],
3910 LIBEVENT_DIR=$withval)
3912 _SAVE_CFLAGS=$CFLAGS
3913 _SAVE_LDFLAGS=$LDFLAGS
3915 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3916 MOZ_NATIVE_LIBEVENT=
3918 if test "${LIBEVENT_DIR}" = "yes"; then
3921 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3922 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3923 MOZ_CHECK_HEADER(event.h,
3924 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3925 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3927 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3928 AC_CHECK_LIB(event, event_init,
3929 [MOZ_NATIVE_LIBEVENT=1
3930 MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
3931 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3932 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
3934 CFLAGS=$_SAVE_CFLAGS
3935 LDFLAGS=$_SAVE_LDFLAGS
3938 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3939 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
3940 AC_SUBST(MOZ_LIBEVENT_LIBS)
3942 dnl ========================================================
3943 dnl = If NSS was not detected in the system,
3944 dnl = use the one in the source tree (mozilla/security/nss)
3945 dnl ========================================================
3947 MOZ_ARG_WITH_BOOL(system-nss,
3948 [ --with-system-nss Use system installed NSS],
3951 if test -n "$_USE_SYSTEM_NSS"; then
3952 AM_PATH_NSS(3.13.2, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3955 if test -n "$MOZ_NATIVE_NSS"; then
3956 NSS_LIBS="$NSS_LIBS -lcrmf"
3958 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3960 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3961 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
3962 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
3963 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
3964 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
3966 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
3968 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3969 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3970 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3971 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3972 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3974 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3978 dnl ======================
3980 dnl ======================
3982 AC_MSG_CHECKING([for YASM assembler])
3983 AC_CHECK_PROGS(YASM, yasm, "")
3985 if test -n "$YASM"; then
3986 dnl Pull out yasm's version string
3988 _YASM_VER_FILTER='s|.* \([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*|\1|p'
3991 YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
3992 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3993 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3994 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3995 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3998 if test -z "$SKIP_LIBRARY_CHECKS"; then
3999 dnl system JPEG support
4000 dnl ========================================================
4001 MOZ_ARG_WITH_STRING(system-jpeg,
4002 [ --with-system-jpeg[=PFX]
4003 Use system libjpeg [installed at prefix PFX]],
4006 _SAVE_CFLAGS=$CFLAGS
4007 _SAVE_LDFLAGS=$LDFLAGS
4009 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4010 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4011 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4013 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4016 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
4019 if test "$MOZ_NATIVE_JPEG" = 1; then
4020 AC_TRY_COMPILE([ #include <stdio.h>
4021 #include <sys/types.h>
4022 #include <jpeglib.h> ],
4023 [ #if JPEG_LIB_VERSION < $MOZJPEG
4024 #error "Insufficient JPEG library version ($MOZJPEG required)."
4027 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
4029 CFLAGS=$_SAVE_CFLAGS
4030 LDFLAGS=$_SAVE_LDFLAGS
4033 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
4034 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
4035 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
4038 dnl system ZLIB support
4039 dnl ========================================================
4040 MOZ_ARG_WITH_STRING(system-zlib,
4041 [ --with-system-zlib[=PFX]
4042 Use system libz [installed at prefix PFX]],
4045 _SAVE_CFLAGS=$CFLAGS
4046 _SAVE_LDFLAGS=$LDFLAGS
4048 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4049 CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4050 LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4052 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4055 AC_CHECK_LIB(z, gzread, [MOZ_NATIVE_ZLIB=1 MOZ_ZLIB_LIBS="-lz"],
4058 if test "$MOZ_NATIVE_ZLIB" = 1; then
4059 MOZZLIBNUM=`echo $MOZZLIB | awk -F. '{printf "0x%x\n", ((($1 * 16 + $2) * 16) + $3) * 16 + $4}'`
4060 AC_TRY_COMPILE([ #include <stdio.h>
4062 #include <zlib.h> ],
4063 [ #if ZLIB_VERNUM < $MOZZLIBNUM
4064 #error "Insufficient zlib version ($MOZZLIBNUM required)."
4067 AC_MSG_ERROR([Insufficient zlib version for --with-system-zlib ($MOZZLIB required)]))
4069 CFLAGS=$_SAVE_CFLAGS
4070 LDFLAGS=$_SAVE_LDFLAGS
4073 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$MOZ_NATIVE_ZLIB" = 1; then
4074 MOZ_ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4075 MOZ_ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4078 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
4079 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4082 dnl system BZIP2 Support
4083 dnl ========================================================
4084 MOZ_ARG_WITH_STRING(system-bz2,
4085 [ --with-system-bz2[=PFX]
4086 Use system libbz2 [installed at prefix PFX]],
4089 _SAVE_CFLAGS=$CFLAGS
4090 _SAVE_LDFLAGS=$LDFLAGS
4092 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4093 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4094 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4096 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4099 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
4100 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
4102 CFLAGS=$_SAVE_CFLAGS
4103 LDFLAGS=$_SAVE_LDFLAGS
4106 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
4107 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
4108 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4111 dnl system PNG Support
4112 dnl ========================================================
4113 MOZ_ARG_WITH_STRING(system-png,
4114 [ --with-system-png[=PFX]
4115 Use system libpng [installed at prefix PFX]],
4118 _SAVE_CFLAGS=$CFLAGS
4119 _SAVE_LDFLAGS=$LDFLAGS
4121 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4122 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4123 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4125 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4128 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
4129 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4130 AC_CHECK_LIB(png, png_get_acTL, ,
4131 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
4133 if test "$MOZ_NATIVE_PNG" = 1; then
4134 AC_TRY_COMPILE([ #include <stdio.h>
4135 #include <sys/types.h>
4137 [ #if PNG_LIBPNG_VER < $MOZPNG
4138 #error "Insufficient libpng version ($MOZPNG required)."
4140 #ifndef PNG_UINT_31_MAX
4141 #error "Insufficient libpng version."
4144 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4146 CFLAGS=$_SAVE_CFLAGS
4147 LDFLAGS=$_SAVE_LDFLAGS
4150 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
4151 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
4152 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
4155 fi # SKIP_LIBRARY_CHECKS
4157 dnl system HunSpell Support
4158 dnl ========================================================
4159 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4160 [ --enable-system-hunspell
4161 Use system hunspell (located with pkgconfig)],
4162 MOZ_NATIVE_HUNSPELL=1 )
4164 if test -n "$MOZ_NATIVE_HUNSPELL"; then
4165 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4168 AC_SUBST(MOZ_NATIVE_HUNSPELL)
4170 dnl ========================================================
4171 dnl system libffi Support
4172 dnl ========================================================
4173 MOZ_ARG_ENABLE_BOOL(system-ffi,
4174 [ --enable-system-ffi Use system libffi (located with pkgconfig)],
4177 if test -n "$MOZ_NATIVE_FFI"; then
4178 # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4179 # for non-GCC compilers.
4180 if test -z "$GNU_CC"; then
4181 PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4183 PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4185 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4188 dnl ========================================================
4189 dnl Java SDK support
4190 dnl ========================================================
4193 MOZ_ARG_WITH_STRING(java-bin-path,
4194 [ --with-java-bin-path=dir
4195 Location of Java binaries (java, javac, jar)],
4196 JAVA_BIN_PATH=$withval)
4198 dnl ========================================================
4202 dnl ========================================================
4204 MOZ_ARG_HEADER(Application)
4207 ENABLE_SYSTEM_EXTENSION_DIRS=1
4208 MOZ_BRANDING_DIRECTORY=
4209 MOZ_OFFICIAL_BRANDING=
4214 MOZ_AUTH_EXTENSION=1
4218 MOZ_SPEEX_RESAMPLER=1
4227 MOZ_WEBRTC_SIGNALING=
4229 MOZ_MEDIA_NAVIGATOR=
4232 MOZ_VP8_ERROR_CONCEALMENT=
4242 LIBJPEG_TURBO_ASFLAGS=
4243 LIBJPEG_TURBO_X86_ASM=
4244 LIBJPEG_TURBO_X64_ASM=
4245 LIBJPEG_TURBO_ARM_ASM=
4249 MOZ_PREF_EXTENSIONS=1
4250 MOZ_PROFILELOCKING=1
4256 MOZ_JAVA_COMPOSITOR=
4257 MOZ_ONLY_TOUCH_EVENTS=
4259 MOZ_TOOLKIT_SEARCH=1
4261 MOZ_UNIVERSALCHARDET=1
4268 MOZ_DISABLE_DOMCRYPTO=
4272 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4275 MOZ_USE_NATIVE_POPUP_WINDOWS=
4276 MOZ_ANDROID_HISTORY=
4281 case "$target_os" in
4284 AC_DEFINE(NS_ENABLE_TSF)
4289 *-android*|*-linuxandroid*)
4290 if test "$CPU_ARCH" = "arm" ; then
4296 MOZ_THEME_FASTSTRIPE=1
4304 MOZ_ARG_ENABLE_STRING(application,
4305 [ --enable-application=APP
4309 tools/update-packaging (AUS-related packaging tools)],
4310 [ MOZ_BUILD_APP=$enableval ] )
4312 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4313 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4314 XULRUNNER_STUB_NAME=$withval)
4316 if test -z "$XULRUNNER_STUB_NAME"; then
4317 case "$target_os" in
4319 XULRUNNER_STUB_NAME=xulrunner
4322 XULRUNNER_STUB_NAME=xulrunner-stub
4325 AC_SUBST(XULRUNNER_STUB_NAME)
4327 AC_MSG_CHECKING([for application to build])
4328 if test -z "$MOZ_BUILD_APP"; then
4329 AC_MSG_RESULT([browser])
4330 MOZ_BUILD_APP=browser
4332 # default mobile to be mobile/xul
4333 if test "$MOZ_BUILD_APP" = "mobile" ; then
4334 MOZ_BUILD_APP=mobile/xul
4336 # We have a valid application only if it has a build.mk file in its top
4338 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4339 AC_MSG_RESULT([none])
4340 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4342 AC_MSG_RESULT([$MOZ_BUILD_APP])
4346 # Allow the application to influence configure with a confvars.sh script.
4348 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4349 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4350 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4351 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4356 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4357 MOZ_ARG_WITH_STRING(app-name,
4358 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4359 WITH_APP_NAME=$withval,
4362 if test -n "$WITH_APP_NAME" ; then
4363 MOZ_APP_NAME="$WITH_APP_NAME"
4366 MOZ_ARG_WITH_STRING(app-basename,
4367 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4368 WITH_APP_BASENAME=$withval,
4371 if test -n "$WITH_APP_BASENAME" ; then
4372 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4375 # Now is a good time to test for logic errors, define mismatches, etc.
4376 case "$MOZ_BUILD_APP" in
4378 if test "$LIBXUL_SDK"; then
4379 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4384 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4385 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4387 case "$MOZ_BUILD_APP" in
4389 AC_DEFINE(MOZ_PHOENIX)
4393 AC_DEFINE(MOZ_XULRUNNER)
4397 AC_SUBST(MOZ_BUILD_APP)
4398 AC_SUBST(MOZ_PHOENIX)
4399 AC_SUBST(MOZ_XULRUNNER)
4401 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4403 dnl ========================================================
4404 dnl Check android sdk version depending on mobile target
4405 dnl ========================================================
4407 if test -z "$gonkdir" ; then
4408 # Minimum Android SDK API Level we require.
4409 case "$MOZ_BUILD_APP" in
4411 android_min_api_level=13
4414 android_min_api_level=14
4418 MOZ_ANDROID_SDK($android_min_api_level)
4421 dnl ========================================================
4423 dnl = Toolkit Options
4425 dnl ========================================================
4426 MOZ_ARG_HEADER(Toolkit Options)
4428 dnl ========================================================
4429 dnl = Select the default toolkit
4430 dnl ========================================================
4431 MOZ_ARG_ENABLE_STRING(default-toolkit,
4432 [ --enable-default-toolkit=TK
4433 Select default toolkit
4434 Platform specific defaults:
4435 Mac OS X - cairo-cocoa
4437 Win32 - cairo-windows
4440 [ _DEFAULT_TOOLKIT=$enableval ],
4441 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4443 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4444 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4445 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4446 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4447 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4448 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4449 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4450 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4451 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4453 dnl nglayout only supports building with one toolkit,
4454 dnl so ignore everything after the first comma (",").
4455 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4457 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4460 MOZ_ARG_WITHOUT_BOOL(x,
4461 [ --without-x Build without X11],
4464 dnl ========================================================
4465 dnl = Enable the toolkit as needed =
4466 dnl ========================================================
4468 case "$MOZ_WIDGET_TOOLKIT" in
4471 MOZ_WIDGET_TOOLKIT=windows
4474 MOZ_INSTRUMENT_EVENT_LOOP=1
4477 cairo-gtk2|cairo-gtk2-x11)
4478 MOZ_WIDGET_TOOLKIT=gtk2
4480 MOZ_ENABLE_XREMOTE=1
4482 MOZ_GL_DEFAULT_PROVIDER=GLX
4488 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4489 TK_LIBS='$(MOZ_GTK2_LIBS)'
4490 AC_DEFINE(MOZ_WIDGET_GTK2)
4491 AC_DEFINE(MOZ_WIDGET_GTK,2)
4493 MOZ_INSTRUMENT_EVENT_LOOP=1
4497 MOZ_WIDGET_TOOLKIT=qt
4499 if test -z "$WITHOUT_X11"; then
4500 MOZ_ENABLE_XREMOTE=1
4501 MOZ_GL_DEFAULT_PROVIDER=GLX
4510 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4511 TK_LIBS='$(MOZ_QT_LIBS)'
4512 AC_DEFINE(MOZ_WIDGET_QT)
4517 MOZ_WIDGET_TOOLKIT=os2
4519 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4520 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4525 MOZ_WIDGET_TOOLKIT=cocoa
4526 AC_DEFINE(MOZ_WIDGET_COCOA)
4527 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4528 TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4529 TK_CFLAGS="-DNO_X11"
4530 CFLAGS="$CFLAGS $TK_CFLAGS"
4531 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4532 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4533 MOZ_USER_DIR="Mozilla"
4534 MOZ_FS_LAYOUT=bundle
4536 MOZ_INSTRUMENT_EVENT_LOOP=1
4540 MOZ_WIDGET_TOOLKIT=uikit
4541 AC_DEFINE(MOZ_WIDGET_UIKIT)
4542 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4543 TK_CFLAGS="-DNO_X11"
4544 TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4545 CFLAGS="$CFLAGS $TK_CFLAGS"
4546 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4547 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4548 MOZ_USER_DIR="Mozilla"
4549 MOZ_FS_LAYOUT=bundle
4553 AC_DEFINE(MOZ_WIDGET_ANDROID)
4554 MOZ_WIDGET_TOOLKIT=android
4555 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4556 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4559 MOZ_INSTRUMENT_EVENT_LOOP=1
4560 if test "$MOZ_BUILD_APP" = "mobile/xul"; then
4566 AC_DEFINE(MOZ_WIDGET_GONK)
4567 AC_DEFINE(MOZ_TOUCH)
4568 MOZ_WIDGET_TOOLKIT=gonk
4569 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4570 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4578 AC_SUBST(MOZ_OLD_LINKER)
4579 AC_SUBST(MOZ_PDF_PRINTING)
4580 if test "$MOZ_PDF_PRINTING"; then
4581 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4582 AC_DEFINE(MOZ_PDF_PRINTING)
4585 if test "$MOZ_ENABLE_XREMOTE"; then
4586 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4589 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4590 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4593 if test "$COMPILE_ENVIRONMENT"; then
4594 if test "$MOZ_ENABLE_GTK2"; then
4595 if test "$MOZ_X11"; then
4596 GDK_PACKAGES=gdk-x11-2.0
4599 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4602 fi # COMPILE_ENVIRONMENT
4604 AC_SUBST(MOZ_FS_LAYOUT)
4606 dnl ========================================================
4607 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4608 dnl their usage and use them in spidermonkey.
4609 dnl ========================================================
4610 MOZ_ARG_WITH_BOOL(arm-kuser,
4611 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4613 if test -n "$USE_ARM_KUSER"; then
4614 AC_DEFINE(USE_ARM_KUSER)
4617 dnl ========================================================
4618 dnl = startup-notification support module
4619 dnl ========================================================
4621 if test "$MOZ_ENABLE_GTK2"
4623 MOZ_ENABLE_STARTUP_NOTIFICATION=
4625 MOZ_ARG_ENABLE_BOOL(startup-notification,
4626 [ --enable-startup-notification
4627 Enable startup-notification support (default: disabled) ],
4628 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4629 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4630 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4632 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4633 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4634 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4635 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4637 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4639 MOZ_ENABLE_STARTUP_NOTIFICATION=
4643 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4644 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4647 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4649 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4650 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4651 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4653 dnl ========================================================
4655 dnl ========================================================
4656 if test "$MOZ_ENABLE_QT"
4658 MOZ_ARG_WITH_STRING(qtdir,
4659 [ --with-qtdir=\$dir Specify Qt directory ],
4662 if test -z "$QTDIR"; then
4663 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
4664 PKG_CHECK_MODULES(MOZ_QT5, QtWidgets QtMultimedia QtPrintSupport,
4667 if test "$MOZ_ENABLE_QT5"; then
4669 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
4670 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
4673 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4674 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4676 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4678 MOZ_QT_CFLAGS="-DQT_SHARED"
4679 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4680 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4681 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4682 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4683 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4684 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4685 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4686 HOST_MOC="$QTDIR/bin/moc"
4687 HOST_RCC="$QTDIR/bin/rcc"
4689 # QtWidgets was introduced only in Qt5
4690 if test -d $QTDIR/include/QtWidgets; then
4691 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4692 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4693 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtWidgets -lQtPrintSupport"
4696 if test -z "$HOST_MOC"; then
4697 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4700 if test -z "$HOST_RCC"; then
4701 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4708 MOZ_ENABLE_QMSYSTEM2=
4709 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4710 MOZ_ENABLE_QMSYSTEM2=1,
4711 MOZ_ENABLE_QMSYSTEM2=)
4713 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4714 MOZ_ENABLE_QMSYSTEM2=1
4715 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4716 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4717 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4720 MOZ_ENABLE_QTNETWORK=
4721 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4722 MOZ_ENABLE_QTNETWORK=1,
4723 MOZ_ENABLE_QTNETWORK=)
4725 if test "$MOZ_ENABLE_QTNETWORK"; then
4726 MOZ_ENABLE_QTNETWORK=1
4727 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4730 MOZ_ENABLE_QTMOBILITY=
4731 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4732 MOZ_ENABLE_QTMOBILITY=1,
4733 MOZ_ENABLE_QTMOBILITY=)
4734 if test "$MOZ_ENABLE_QTMOBILITY"; then
4735 MOZ_ENABLE_QTMOBILITY=1
4736 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4737 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4739 AC_CHECK_LIB(QtSensors, main, [
4740 MOZ_ENABLE_QTMOBILITY=1
4741 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4742 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4743 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4744 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4745 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4748 if test "$MOZ_ENABLE_QTMOBILITY"; then
4749 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4753 AC_SUBST(GTK_CONFIG)
4757 AC_SUBST(MOZ_ENABLE_GTK2)
4758 AC_SUBST(MOZ_ENABLE_QT)
4759 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4760 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4761 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4762 AC_SUBST(MOZ_ENABLE_XREMOTE)
4763 AC_SUBST(MOZ_GTK2_CFLAGS)
4764 AC_SUBST(MOZ_GTK2_LIBS)
4765 AC_SUBST(MOZ_QT_CFLAGS)
4766 AC_SUBST(MOZ_QT_LIBS)
4773 dnl ========================================================
4775 dnl = Components & Features
4777 dnl ========================================================
4778 MOZ_ARG_HEADER(Components and Features)
4780 dnl ========================================================
4782 dnl ========================================================
4783 MOZ_ARG_ENABLE_STRING(ui-locale,
4784 [ --enable-ui-locale=ab-CD
4785 Select the user interface locale (default: en-US)],
4786 MOZ_UI_LOCALE=$enableval )
4787 AC_SUBST(MOZ_UI_LOCALE)
4789 dnl ========================================================
4790 dnl = Trademarked Branding
4791 dnl ========================================================
4792 MOZ_ARG_ENABLE_BOOL(official-branding,
4793 [ --enable-official-branding
4794 Enable Official mozilla.org Branding
4795 Do not distribute builds with
4796 --enable-official-branding unless you have
4797 permission to use trademarks per
4798 http://www.mozilla.org/foundation/trademarks/ .],
4800 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4801 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4803 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4804 MOZ_OFFICIAL_BRANDING=1
4806 ], MOZ_OFFICIAL_BRANDING=)
4808 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4809 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4810 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4813 MOZ_ARG_WITH_STRING(branding,
4814 [ --with-branding=dir Use branding from the specified directory.],
4815 MOZ_BRANDING_DIRECTORY=$withval)
4817 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4818 if test -z "$REAL_BRANDING_DIRECTORY"; then
4819 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4822 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4823 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4826 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4828 dnl ========================================================
4829 dnl = Distribution ID
4830 dnl ========================================================
4831 MOZ_ARG_WITH_STRING(distribution-id,
4832 [ --with-distribution-id=ID
4833 Set distribution-specific id (default=org.mozilla)],
4834 [ val=`echo $withval`
4835 MOZ_DISTRIBUTION_ID="$val"])
4837 if test -z "$MOZ_DISTRIBUTION_ID"; then
4838 MOZ_DISTRIBUTION_ID="org.mozilla"
4841 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4842 AC_SUBST(MOZ_DISTRIBUTION_ID)
4845 dnl ========================================================
4846 dnl complex text support off by default
4847 dnl ========================================================
4848 MOZ_ARG_DISABLE_BOOL(pango,
4849 [ --disable-pango Disable usage of Pango ],
4853 dnl ========================================================
4855 dnl ========================================================
4856 if test "$MOZ_ENABLE_GTK2"
4860 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4862 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4863 AC_SUBST(MOZ_PANGO_CFLAGS)
4864 AC_SUBST(MOZ_PANGO_LIBS)
4865 if test "$MOZ_PANGO"
4867 AC_DEFINE(MOZ_PANGO)
4869 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
4870 AC_SUBST(FT2_CFLAGS)
4875 if test "$MOZ_ENABLE_QT"
4877 if test "$MOZ_PANGO"
4879 PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION],
4881 AC_SUBST(MOZ_PANGO_CFLAGS)
4882 AC_SUBST(MOZ_PANGO_LIBS)
4883 AC_DEFINE(MOZ_PANGO)
4886 echo "Pango library not found, will use FT2 font engine"
4893 dnl ========================================================
4894 dnl = GnomeVFS, GIO and GConf support module
4895 dnl ========================================================
4899 dnl build the gnomevfs extension by default only when the
4900 dnl GTK2 toolkit is in use.
4901 if test "$MOZ_ENABLE_GTK2"
4903 MOZ_ENABLE_GNOMEVFS=1
4907 dnl ========================================================
4908 dnl = GnomeVFS support module
4909 dnl ========================================================
4910 MOZ_ARG_DISABLE_BOOL(gnomevfs,
4911 [ --disable-gnomevfs Disable GnomeVFS support ],
4912 MOZ_ENABLE_GNOMEVFS=,
4913 MOZ_ENABLE_GNOMEVFS=force)
4915 if test "$MOZ_ENABLE_GNOMEVFS"
4917 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4918 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4919 MOZ_ENABLE_GNOMEVFS=1
4920 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4922 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4924 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4926 MOZ_ENABLE_GNOMEVFS=
4929 if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
4930 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4931 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4936 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4937 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4938 AC_SUBST(MOZ_GNOMEVFS_LIBS)
4940 dnl ========================================================
4941 dnl = GIO support module
4942 dnl ========================================================
4943 MOZ_ARG_ENABLE_BOOL(gio,
4944 [ --enable-gio Enable GIO support (default: disabled)],
4945 MOZ_ENABLE_GIO=force,
4948 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
4950 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4951 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4952 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4953 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4955 AC_DEFINE(MOZ_ENABLE_GIO)
4957 if test "$MOZ_ENABLE_GIO" = "force"
4959 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4965 AC_SUBST(MOZ_ENABLE_GIO)
4966 AC_SUBST(MOZ_GIO_CFLAGS)
4967 AC_SUBST(MOZ_GIO_LIBS)
4969 dnl ========================================================
4970 dnl = GConf support module
4971 dnl ========================================================
4972 MOZ_ARG_DISABLE_BOOL(gconf,
4973 [ --disable-gconf Disable Gconf support ],
4975 MOZ_ENABLE_GCONF=force)
4977 if test "$MOZ_ENABLE_GCONF"
4979 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4980 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4983 if test "$MOZ_ENABLE_GCONF" = "force"
4985 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4991 if test "$MOZ_ENABLE_GCONF"; then
4992 AC_DEFINE(MOZ_ENABLE_GCONF)
4995 AC_SUBST(MOZ_ENABLE_GCONF)
4996 AC_SUBST(MOZ_GCONF_CFLAGS)
4997 AC_SUBST(MOZ_GCONF_LIBS)
5000 dnl ========================================================
5001 dnl = libproxy support
5002 dnl ========================================================
5004 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5006 MOZ_ENABLE_LIBPROXY=
5008 MOZ_ARG_ENABLE_BOOL(libproxy,
5009 [ --enable-libproxy Enable libproxy support ],
5010 MOZ_ENABLE_LIBPROXY=1,
5011 MOZ_ENABLE_LIBPROXY=)
5013 if test "$MOZ_ENABLE_LIBPROXY"
5015 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5016 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5019 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5020 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5021 AC_SUBST(MOZ_LIBPROXY_LIBS)
5023 dnl ========================================================
5024 dnl = libnotify support
5025 dnl ========================================================
5027 if test "$MOZ_ENABLE_GTK2"
5029 MOZ_ENABLE_LIBNOTIFY=1
5031 MOZ_ARG_DISABLE_BOOL(libnotify,
5032 [ --disable-libnotify Disable libnotify support ],
5033 MOZ_ENABLE_LIBNOTIFY=,
5034 MOZ_ENABLE_LIBNOTIFY=1)
5036 if test "$MOZ_ENABLE_LIBNOTIFY"
5038 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5042 if test -z "$SKIP_LIBRARY_CHECKS"
5044 if test "$MOZ_ENABLE_GTK2"
5046 if test "$MOZ_ENABLE_LIBNOTIFY"
5048 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5052 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5053 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5054 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5056 dnl ========================================================
5057 dnl = GNOME component (mozgnome)
5058 dnl ========================================================
5060 # The GNOME component is built if one of
5061 # gnome-vfs, gio, gconf or libnotify is available.
5062 if test "$MOZ_ENABLE_GCONF" -o \
5063 "$MOZ_ENABLE_GNOMEVFS" -o \
5064 "$MOZ_ENABLE_GIO" -o \
5065 "$MOZ_ENABLE_LIBNOTIFY"; then
5066 MOZ_ENABLE_GNOME_COMPONENT=1
5068 MOZ_ENABLE_GNOME_COMPONENT=
5070 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5072 dnl ========================================================
5073 dnl = libgnomeui support module
5074 dnl ========================================================
5076 if test "$MOZ_ENABLE_GTK2"
5078 MOZ_ENABLE_GNOMEUI=1
5080 MOZ_ARG_DISABLE_BOOL(gnomeui,
5081 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5082 MOZ_ENABLE_GNOMEUI=,
5083 MOZ_ENABLE_GNOMEUI=force)
5085 if test "$MOZ_ENABLE_GNOMEUI"
5087 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5089 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5090 MOZ_ENABLE_GNOMEUI=1
5092 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5094 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5100 if test "$MOZ_ENABLE_GNOMEUI"; then
5101 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5105 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5106 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5107 AC_SUBST(MOZ_GNOMEUI_LIBS)
5109 dnl ========================================================
5111 dnl ========================================================
5113 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5117 MOZ_ARG_DISABLE_BOOL(dbus,
5118 [ --disable-dbus Disable dbus support ],
5122 if test "$MOZ_ENABLE_DBUS"
5124 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5125 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5126 AC_DEFINE(MOZ_ENABLE_DBUS)
5129 AC_SUBST(MOZ_ENABLE_DBUS)
5130 AC_SUBST(MOZ_DBUS_CFLAGS)
5131 AC_SUBST(MOZ_DBUS_LIBS)
5132 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5133 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5135 dnl ========================================================
5136 dnl = Enable Android History instead of Places
5137 dnl ========================================================
5138 if test -n "$MOZ_ANDROID_HISTORY"; then
5139 dnl Do this if defined in confvars.sh
5140 AC_DEFINE(MOZ_ANDROID_HISTORY)
5144 dnl ========================================================
5145 dnl = Build with the Android Java compositor
5146 dnl ========================================================
5147 if test -n "$MOZ_JAVA_COMPOSITOR"; then
5148 dnl Do this if defined in confvars.sh
5149 AC_DEFINE(MOZ_JAVA_COMPOSITOR)
5152 dnl ========================================================
5153 dnl = Disable WebSMS backend
5154 dnl ========================================================
5155 MOZ_ARG_DISABLE_BOOL(websms-backend,
5156 [ --disable-websms-backend
5157 Disable WebSMS backend],
5158 MOZ_WEBSMS_BACKEND=,
5159 MOZ_WEBSMS_BACKEND=1)
5161 if test -n "$MOZ_WEBSMS_BACKEND"; then
5162 AC_DEFINE(MOZ_WEBSMS_BACKEND)
5165 dnl ========================================================
5166 dnl = Build Personal Security Manager
5167 dnl ========================================================
5168 MOZ_ARG_DISABLE_BOOL(crypto,
5169 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5173 dnl ========================================================
5174 dnl = JS Debugger XPCOM component (js/jsd)
5175 dnl ========================================================
5176 MOZ_ARG_DISABLE_BOOL(jsd,
5177 [ --disable-jsd Disable JavaScript debug library],
5182 dnl ========================================================
5183 dnl = Enable IPDL's "expensive" unit tests
5184 dnl ========================================================
5187 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5188 [ --enable-ipdl-tests Enable expensive IPDL tests],
5192 if test -n "$MOZ_IPDL_TESTS"; then
5193 AC_DEFINE(MOZ_IPDL_TESTS)
5196 AC_SUBST(MOZ_IPDL_TESTS)
5198 dnl ========================================================
5199 dnl = Turns off code necessary for e10s compatibility
5200 dnl ========================================================
5201 dnl This is a temporary flag to be removed in bug 662601 when
5202 dnl it's no longer needed
5206 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5207 [ --enable-e10s-compat Turns off code for e10s compat],
5211 if test -n "$MOZ_E10S_COMPAT"; then
5212 AC_DEFINE(MOZ_E10S_COMPAT)
5215 dnl ========================================================
5216 dnl = Disable building dbm
5217 dnl ========================================================
5218 MOZ_ARG_DISABLE_BOOL(dbm,
5219 [ --disable-dbm Disable building dbm],
5223 dnl bi-directional support always on
5227 dnl ========================================================
5228 dnl accessibility support on by default on all platforms
5229 dnl ========================================================
5230 MOZ_ARG_DISABLE_BOOL(accessibility,
5231 [ --disable-accessibility Disable accessibility support],
5234 if test "$ACCESSIBILITY"; then
5235 AC_DEFINE(ACCESSIBILITY)
5238 dnl ========================================================
5239 dnl Disable printing
5240 dnl ========================================================
5241 MOZ_ARG_DISABLE_BOOL(printing,
5242 [ --disable-printing Disable printing support],
5246 if test "$NS_PRINTING"; then
5247 AC_DEFINE(NS_PRINTING)
5248 AC_DEFINE(NS_PRINT_PREVIEW)
5251 dnl ========================================================
5252 dnl = Disable WebRTC code
5253 dnl ========================================================
5254 MOZ_ARG_DISABLE_BOOL(webrtc,
5255 [ --disable-webrtc Disable support for WebRTC],
5259 if test -n "$MOZ_WEBRTC"; then
5260 AC_DEFINE(MOZ_WEBRTC)
5265 MOZ_VP8_ERROR_CONCEALMENT=1
5268 AC_SUBST(MOZ_WEBRTC)
5270 dnl ========================================================
5271 dnl = Enable Raw Codecs
5272 dnl ========================================================
5273 MOZ_ARG_ENABLE_BOOL(raw,
5274 [ --enable-raw Enable support for RAW media],
5278 if test -n "$MOZ_RAW"; then
5285 dnl ========================================================
5286 dnl = Disable Ogg Codecs
5287 dnl ========================================================
5288 MOZ_ARG_DISABLE_BOOL(ogg,
5289 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5293 if test -n "$MOZ_OGG"; then
5298 case "$target_cpu" in
5307 dnl Checks for __attribute__(aligned()) directive
5308 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5309 [ac_cv_c_attribute_aligned],
5310 [ac_cv_c_attribute_aligned=0
5311 CFLAGS_save="${CFLAGS}"
5312 CFLAGS="${CFLAGS} -Werror"
5313 for ac_cv_c_attr_align_try in 64 32 16 8; do
5314 echo "trying $ac_cv_c_attr_align_try"
5316 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5317 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5318 if test "$ac_cv_c_attribute_aligned" != 0; then
5322 CFLAGS="${CFLAGS_save}"])
5323 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5324 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5325 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5329 dnl ========================================================
5330 dnl = Disable Opus audio codec support
5331 dnl ========================================================
5332 MOZ_ARG_DISABLE_BOOL(opus,
5333 [ --disable-opus Disable support for Opus audio],
5337 dnl ========================================================
5338 dnl = Disable VP8 decoder support
5339 dnl ========================================================
5340 MOZ_ARG_DISABLE_BOOL(webm,
5341 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5345 if test -n "$MOZ_WEBM"; then
5350 dnl ========================================================
5351 dnl = Disable media plugin support
5352 dnl ========================================================
5353 MOZ_ARG_ENABLE_BOOL(media-plugins,
5354 [ --enable-media-plugins Enable support for media plugins],
5355 MOZ_MEDIA_PLUGINS=1,
5358 if test -n "$MOZ_MEDIA_PLUGINS"; then
5359 AC_DEFINE(MOZ_MEDIA_PLUGINS)
5362 dnl ========================================================
5363 dnl = Enable getUserMedia support
5364 dnl ========================================================
5365 MOZ_ARG_ENABLE_BOOL(media-navigator,
5366 [ --enable-media-navigator Enable support for getUserMedia],
5367 MOZ_MEDIA_NAVIGATOR=1,
5368 MOZ_MEDIA_NAVIGATOR=)
5370 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5371 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5374 dnl ========================================================
5375 dnl = Enable building OMX media plugin (B2G)
5376 dnl ========================================================
5377 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5378 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5382 if test -n "$MOZ_OMX_PLUGIN"; then
5383 if test "$OS_TARGET" = "Android" -a -n "$gonkdir"; then
5384 dnl Only allow building OMX plugin on Gonk (B2G)
5385 AC_DEFINE(MOZ_OMX_PLUGIN)
5387 dnl fail if we're not building on Gonk
5388 AC_MSG_ERROR([OMX media plugin can only be built on B2G])
5392 dnl system libvpx Support
5393 dnl ========================================================
5394 MOZ_ARG_WITH_BOOL(system-libvpx,
5395 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5396 MOZ_NATIVE_LIBVPX=1)
5398 MOZ_LIBVPX_INCLUDES=
5401 if test -n "$MOZ_VP8"; then
5403 if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5404 AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5406 if test -n "$MOZ_VP8_ENCODER" ; then
5407 AC_DEFINE(MOZ_VP8_ENCODER)
5410 if test -n "$MOZ_NATIVE_LIBVPX"; then
5411 dnl ============================
5412 dnl === libvpx Version check ===
5413 dnl ============================
5414 dnl Check to see if we have a system libvpx package.
5415 PKG_CHECK_MODULES(LIBVPX, vpx >= 1.0.0)
5417 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5418 [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.])])
5420 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5421 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5425 AC_SUBST(MOZ_NATIVE_LIBVPX)
5426 AC_SUBST(MOZ_LIBVPX_INCLUDES)
5427 AC_SUBST(MOZ_LIBVPX_LIBS)
5429 if test "$MOZ_WEBM"; then
5433 case "$target_cpu" in
5443 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5445 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5446 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5447 dnl We currently require gcc on all arm platforms.
5450 VPX_NEED_OBJ_INT_EXTRACT=
5452 dnl See if we have assembly on this platform.
5453 case "$OS_ARCH:$CPU_ARCH" in
5455 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5459 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5463 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5467 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5471 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5475 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5479 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5483 dnl Check for yasm 1.1 or greater.
5484 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5485 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.])
5486 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5487 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.])
5489 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5491 dnl The encoder needs obj_int_extract to get asm offsets.
5495 if test -n "$GNU_AS" ; then
5497 dnl These flags are a lie; they're just used to enable the requisite
5498 dnl opcodes; actual arch detection is done at runtime.
5499 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5500 VPX_DASH_C_FLAG="-c"
5501 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5502 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5507 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5508 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.])
5511 if test -n "$MOZ_VP8_ENCODER" -a \
5512 -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5513 dnl We prefer to get asm offsets using inline assembler, which the above
5514 dnl compilers can do. When we're not using one of those, we have to fall
5515 dnl back to obj_int_extract, which reads them from a compiled object
5516 dnl file. Unfortunately, that only works if we're compiling on a system
5517 dnl with the header files for the appropriate object file format.
5518 VPX_NEED_OBJ_INT_EXTRACT=1
5521 if test -n "$VPX_X86_ASM"; then
5522 AC_DEFINE(VPX_X86_ASM)
5523 elif test -n "$VPX_ARM_ASM"; then
5524 AC_DEFINE(VPX_ARM_ASM)
5526 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5530 dnl ========================================================
5531 dnl = Disable Wave decoder support
5532 dnl ========================================================
5533 MOZ_ARG_DISABLE_BOOL(wave,
5534 [ --disable-wave Disable Wave decoder support],
5538 if test -n "$MOZ_WAVE"; then
5545 dnl ========================================================
5546 dnl = Handle dependent SYDNEYAUDIO, CUBEB, and MEDIA defines
5547 dnl ========================================================
5549 if test -n "$MOZ_SYDNEYAUDIO"; then
5550 AC_DEFINE(MOZ_SYDNEYAUDIO)
5553 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5554 AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5557 if test -n "$MOZ_CUBEB"; then
5559 *-android*|*-linuxandroid*)
5560 dnl No Android implementation of libcubeb yet.
5563 AC_DEFINE(MOZ_CUBEB)
5566 AC_DEFINE(MOZ_CUBEB)
5569 AC_DEFINE(MOZ_CUBEB)
5572 AC_DEFINE(MOZ_CUBEB)
5575 dnl Other targets will be enabled soon.
5580 if test -n "$MOZ_MEDIA"; then
5581 AC_DEFINE(MOZ_MEDIA)
5584 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5585 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/])
5588 if test -n "$MOZ_VORBIS"; then
5589 AC_DEFINE(MOZ_VORBIS)
5592 if test -n "$MOZ_TREMOR"; then
5593 AC_DEFINE(MOZ_TREMOR)
5596 if test -n "$MOZ_OPUS"; then
5600 dnl ========================================================
5601 dnl = Check alsa availability on Linux if using sydneyaudio
5602 dnl ========================================================
5604 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5605 if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
5606 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5607 [echo "$MOZ_ALSA_PKG_ERRORS"
5608 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.)])])
5611 dnl ========================================================
5612 dnl = Enable GStreamer
5613 dnl ========================================================
5614 MOZ_ARG_ENABLE_BOOL(gstreamer,
5615 [ --enable-gstreamer Enable GStreamer support],
5619 if test "$MOZ_GSTREAMER"; then
5620 # API version, eg 0.10, 1.0 etc
5621 GST_API_VERSION=0.10
5622 # core/base release number
5623 # depend on >= 0.10.33 as that's when the playbin2 source-setup signal was
5626 PKG_CHECK_MODULES(GSTREAMER,
5627 gstreamer-$GST_API_VERSION >= $GST_VERSION
5628 gstreamer-app-$GST_API_VERSION
5629 gstreamer-plugins-base-$GST_API_VERSION)
5630 if test -n "$GSTREAMER_LIBS"; then
5631 _SAVE_LDFLAGS=$LDFLAGS
5632 LDFLAGS="$LDFLAGS -lgstvideo-$GST_API_VERSION"
5633 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5634 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5635 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5637 AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
5639 LDFLAGS=$_SAVE_LDFLAGS
5641 AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
5644 AC_SUBST(GSTREAMER_CFLAGS)
5645 AC_SUBST(GSTREAMER_LIBS)
5646 AC_SUBST(MOZ_GSTREAMER)
5648 if test -n "$MOZ_GSTREAMER"; then
5649 AC_DEFINE(MOZ_GSTREAMER)
5654 dnl ========================================================
5655 dnl Permissions System
5656 dnl ========================================================
5657 MOZ_ARG_DISABLE_BOOL(permissions,
5658 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5663 dnl ========================================================
5665 dnl ========================================================
5666 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5667 [ --disable-negotiateauth Disable GSS-API negotiation ],
5668 MOZ_AUTH_EXTENSION=,
5669 MOZ_AUTH_EXTENSION=1 )
5671 dnl ========================================================
5673 dnl ========================================================
5674 MOZ_ARG_DISABLE_BOOL(xtf,
5675 [ --disable-xtf Disable XTF (pluggable xml tags) support],
5678 if test "$MOZ_XTF"; then
5682 dnl ========================================================
5683 dnl Pref extensions (autoconfig)
5684 dnl ========================================================
5685 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5686 [ --disable-pref-extensions
5687 Disable pref extensions such as autoconfig],
5688 MOZ_PREF_EXTENSIONS=,
5689 MOZ_PREF_EXTENSIONS=1 )
5691 dnl ========================================================
5692 dnl Searching of system directories for extensions.
5693 dnl Note: this switch is meant to be used for test builds
5694 dnl whose behavior should not depend on what happens to be
5695 dnl installed on the local machine.
5696 dnl ========================================================
5697 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5698 [ --disable-system-extension-dirs
5699 Disable searching system- and account-global
5700 directories for extensions of any kind; use
5701 only profile-specific extension directories],
5702 ENABLE_SYSTEM_EXTENSION_DIRS=,
5703 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5704 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5705 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5708 dnl ========================================================
5709 dnl = Universalchardet
5710 dnl ========================================================
5711 MOZ_ARG_DISABLE_BOOL(universalchardet,
5712 [ --disable-universalchardet
5713 Disable universal encoding detection],
5714 MOZ_UNIVERSALCHARDET=,
5715 MOZ_UNIVERSALCHARDET=1 )
5717 if test -n "${JAVA_BIN_PATH}"; then
5718 dnl Look for javac and jar in the specified path.
5719 JAVA_PATH="$JAVA_BIN_PATH"
5721 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5722 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5725 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5726 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5727 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5729 if test -n "${JAVA_BIN_PATH}" -o \
5730 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5731 if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5732 AC_MSG_ERROR([The programs java, javac and jar were not found. Set \$JAVA_HOME to your java sdk directory or use --with-java-bin-path={java-bin-dir}])
5736 dnl ========================================================
5737 dnl = ANGLE OpenGL->D3D translator for WebGL
5738 dnl = * only applies to win32
5739 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5740 dnl ========================================================
5742 MOZ_DIRECTX_SDK_PATH=
5743 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5746 MOZ_D3DCOMPILER_CAB=
5748 MOZ_D3DCOMPILER_DLL=
5749 case "$target_os" in
5755 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5756 case "${target_cpu}" in
5758 MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5761 MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5765 if test -n "$MOZ_ANGLE"; then
5766 MOZ_ARG_DISABLE_BOOL(angle,
5767 [ --disable-angle Disable building of ANGLE for WebGL->D3D translation],
5771 if test -n "$MOZ_ANGLE"; then
5772 # Get the SDK path from the registry.
5773 # First try to get the June 2010 SDK
5774 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5775 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5776 # Otherwise just take whatever comes first
5777 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5780 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5781 AC_MSG_ERROR([Found the February 2010 DirectX SDK. This is too old. We now require the June 2010 DirectX SDK, or newer. Upgrade your SDK or to explicitly build without ANGLE, reconfigure with --disable-angle.])
5783 MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/'`
5788 if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
5789 if test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h && test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5790 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5795 if test -z "$MOZ_ANGLE" ; then
5796 AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for ANGLE. Please install it (June 2010 or newer). To explicitly build without ANGLE, reconfigure with --disable-angle.])
5799 if test -n "$MOZ_ANGLE" ; then
5800 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5801 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'`
5803 if test -z "$MOZ_D3DX9_VERSION" ; then
5804 AC_MSG_ERROR([Couldn't determine the D3DX9 version, needed for ANGLE. To explicitly build without ANGLE, reconfigure with --disable-angle.])
5807 if test -n "$MOZ_ANGLE" ; then
5808 MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5809 MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5811 MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
5812 MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5818 dnl ========================================================
5819 dnl = Breakpad crash reporting (on by default on supported platforms)
5820 dnl ========================================================
5823 i?86-*-mingw*|x86_64-*-mingw*)
5826 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
5829 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5830 if test "$MOZ_ENABLE_GTK2"; then
5834 *-android*|*-linuxandroid*)
5842 MOZ_ARG_DISABLE_BOOL(crashreporter,
5843 [ --disable-crashreporter Disable breakpad crash reporting],
5845 MOZ_CRASHREPORTER=1)
5847 if test -n "$MOZ_CRASHREPORTER"; then
5848 AC_DEFINE(MOZ_CRASHREPORTER)
5850 if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
5851 test -z "$SKIP_LIBRARY_CHECKS"; then
5852 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5853 AC_SUBST(MOZ_GTHREAD_CFLAGS)
5854 AC_SUBST(MOZ_GTHREAD_LIBS)
5856 MOZ_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter. Use --disable-crashreporter to disable the crash reporter.])])
5859 if (test "$OS_ARCH" != "$HOST_OS_ARCH"); then
5860 AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH. Use --disable-crashreporter.])
5863 if test "$OS_ARCH" == "WINNT" -a -z "$HAVE_64BIT_OS"; then
5864 MOZ_CRASHREPORTER_INJECTOR=1
5865 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5869 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5870 [ --with-crashreporter-enable-percent=NN
5871 Enable sending crash reports by default on NN% of users. (default=100)],
5872 [ val=`echo $withval | sed 's/[^0-9]//g'`
5873 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5875 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5876 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5878 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5880 dnl ========================================================
5881 dnl = libjpeg-turbo configuration
5882 dnl ========================================================
5884 if test -z "$MOZ_NATIVE_JPEG"; then
5888 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5889 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
5891 MOZ_LIBJPEG_TURBO=1)
5893 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
5894 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
5897 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
5900 if test -n "$MOZ_LIBJPEG_TURBO"; then
5902 dnl Do we support libjpeg-turbo on this platform?
5903 case "$OS_ARCH:$OS_TEST" in
5904 Linux:x86|Linux:i?86)
5905 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
5906 LIBJPEG_TURBO_X86_ASM=1
5909 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
5910 LIBJPEG_TURBO_X64_ASM=1
5913 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
5914 LIBJPEG_TURBO_X86_ASM=1
5917 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
5918 LIBJPEG_TURBO_X64_ASM=1
5921 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
5922 LIBJPEG_TURBO_X86_ASM=1
5925 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
5926 LIBJPEG_TURBO_X64_ASM=1
5928 WINNT:x86|WINNT:i?86)
5929 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
5930 LIBJPEG_TURBO_X86_ASM=1
5933 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
5934 LIBJPEG_TURBO_X64_ASM=1
5937 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
5938 LIBJPEG_TURBO_ARM_ASM=1
5944 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
5945 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
5946 dnl it doesn't exist or we have too old of a version.
5947 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
5948 AC_MSG_CHECKING([for Yasm assembler])
5949 AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
5951 if test -z "$LIBJPEG_TURBO_AS" ; then
5952 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.])
5955 dnl Check that we have the right yasm version. We require 1.0.1 or newer
5956 dnl on Linux and 1.1 or newer everywhere else.
5957 if test "$OS_ARCH" = "Linux" ; then
5958 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
5959 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.])
5962 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5963 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.])
5968 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
5969 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
5970 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
5971 echo "Using $AS as the assembler for ARM code."
5972 LIBJPEG_TURBO_AS=$AS
5975 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
5976 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
5977 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
5978 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
5979 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
5980 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
5981 elif test -n "$MOZ_LIBJPEG_TURBO"; then
5982 dnl Warn if we're not building the optimized routines, even though the user
5983 dnl didn't specify --disable-libjpeg-turbo.
5984 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
5987 dnl ========================================================
5988 dnl = Enable compilation of specific extension modules
5989 dnl ========================================================
5991 MOZ_ARG_ENABLE_STRING(extensions,
5992 [ --enable-extensions Enable extensions],
5993 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5994 if test "$option" = "yes" -o "$option" = "all"; then
5995 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5996 elif test "$option" = "no" -o "$option" = "none"; then
5998 elif test "$option" = "default"; then
5999 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6000 elif test `echo "$option" | grep -c \^-` != 0; then
6001 option=`echo $option | sed 's/^-//'`
6002 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6004 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6007 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6009 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6010 # Suppress warning on non-X11 platforms
6011 if test -n "$MOZ_X11"; then
6012 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6014 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6017 dnl Do not build gnomevfs with libxul based apps
6018 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6019 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6022 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6023 # Suppress warning on non-X11 platforms
6024 if test -n "$MOZ_X11"; then
6025 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6027 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6030 dnl Do not build gio with libxul based apps
6031 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6032 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6035 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6036 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6037 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6040 dnl xforms requires xtf
6041 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6042 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
6043 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6047 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6049 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6050 dnl when trying to build a nonexistent extension.
6051 for extension in $MOZ_EXTENSIONS; do
6052 if test ! -d "${srcdir}/extensions/${extension}"; then
6053 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6057 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6058 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6061 dnl ========================================================
6062 dnl CSS3 Flexbox Support
6063 dnl ========================================================
6064 if test -n "$MOZ_FLEXBOX"; then
6065 AC_DEFINE(MOZ_FLEXBOX)
6068 dnl ========================================================
6069 dnl SVG Display Lists
6070 dnl ========================================================
6071 if test -n "$MOZ_SVG_DLISTS"; then
6072 AC_DEFINE(MOZ_SVG_DLISTS)
6075 dnl ========================================================
6076 dnl Build Freetype in the tree
6077 dnl ========================================================
6078 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6079 [ --enable-tree-freetype Enable Tree FreeType],
6080 MOZ_TREE_FREETYPE=1,
6081 MOZ_TREE_FREETYPE= )
6082 if test -n "$MOZ_TREE_FREETYPE"; then
6083 if test -n "$_WIN32_MSVC"; then
6084 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6086 AC_DEFINE(MOZ_TREE_FREETYPE)
6087 AC_SUBST(MOZ_TREE_FREETYPE)
6088 MOZ_ENABLE_CAIRO_FT=1
6089 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6090 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6091 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6092 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6094 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6095 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6096 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6097 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6098 AC_SUBST(CAIRO_FT_CFLAGS)
6101 dnl ========================================================
6103 dnl ========================================================
6104 dnl Abort Windows build if the required major version and
6105 dnl minimum minor version of Unicode NSIS isn't in the path
6106 dnl (unless in case of cross compiling, for which Unicode
6107 dnl is not yet sufficient).
6108 if test "$OS_ARCH" = "WINNT"; then
6109 REQ_NSIS_MAJOR_VER=2
6110 MIN_NSIS_MINOR_VER=33
6111 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6112 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6113 AC_MSG_RESULT([yes])
6115 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6117 if test ! "$MAKENSISU_VER" = ""; then
6118 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6119 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6121 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6122 if test "$MAKENSISU_VER" = "" || \
6123 test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6124 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6126 if test -z "$CROSS_COMPILE"; then
6127 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.])
6132 elif test -z "$CROSS_COMPILE"; then
6133 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.])
6139 dnl ========================================================
6141 dnl ========================================================
6142 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6143 [ --disable-webapp-runtime Disable Web App Runtime],
6144 MOZ_WEBAPP_RUNTIME=,
6145 MOZ_WEBAPP_RUNTIME=1)
6146 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6149 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6152 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6153 if test "$MOZ_WEBAPP_RUNTIME"; then
6154 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6157 AC_MSG_CHECKING([for tar archiver])
6158 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6159 if test -z "$TAR"; then
6160 AC_MSG_ERROR([no tar archiver found in \$PATH])
6162 AC_MSG_RESULT([$TAR])
6165 AC_MSG_CHECKING([for wget])
6166 AC_CHECK_PROGS(WGET, wget, "")
6167 AC_MSG_RESULT([$WGET])
6170 dnl ========================================================
6172 dnl ========================================================
6174 if test -n "$MOZ_SIGN_CMD"; then
6175 AC_DEFINE(MOZ_SIGNING)
6178 dnl ========================================================
6179 dnl Maintenance Service
6180 dnl ========================================================
6182 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6183 [ --enable-maintenance-service Enable building of maintenanceservice],
6184 MOZ_MAINTENANCE_SERVICE=1,
6185 MOZ_MAINTENANCE_SERVICE= )
6187 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6188 if test "$OS_ARCH" = "WINNT"; then
6189 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6191 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6195 dnl ========================================================
6196 dnl Verify MAR signatures
6197 dnl ========================================================
6199 MOZ_ARG_ENABLE_BOOL(verify-mar,
6200 [ --enable-verify-mar Enable verifying MAR signatures],
6201 MOZ_VERIFY_MAR_SIGNATURE=1,
6202 MOZ_VERIFY_MAR_SIGNATURE= )
6204 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6205 if test "$OS_ARCH" = "WINNT"; then
6206 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6208 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6212 dnl ========================================================
6213 dnl Enable building the signmar program.
6214 dnl This option is much different than the --enable-verify-mar option.
6215 dnl --enable-verify-mar is for enabling the verification check on MAR
6216 dnl files in the updater. The --enable-signmar option is for building
6217 dnl the signmar program.
6218 dnl ========================================================
6220 MOZ_ARG_ENABLE_BOOL(signmar,
6221 [ --enable-signmar Enable building the signmar program],
6222 MOZ_ENABLE_SIGNMAR=1,
6223 MOZ_ENABLE_SIGNMAR= )
6225 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6226 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6229 dnl ========================================================
6231 dnl ========================================================
6233 MOZ_ARG_DISABLE_BOOL(updater,
6234 [ --disable-updater Disable building of updater],
6238 if test -n "$MOZ_UPDATER"; then
6239 AC_DEFINE(MOZ_UPDATER)
6242 # app update channel is 'default' when not supplied.
6243 MOZ_ARG_ENABLE_STRING([update-channel],
6244 [ --enable-update-channel=CHANNEL
6245 Select application update channel (default=default)],
6246 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6248 if test -z "$MOZ_UPDATE_CHANNEL"; then
6249 MOZ_UPDATE_CHANNEL=default
6251 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6252 AC_SUBST(MOZ_UPDATE_CHANNEL)
6254 # tools/update-packaging is not checked out by default.
6255 MOZ_ARG_ENABLE_BOOL(update-packaging,
6256 [ --enable-update-packaging
6257 Enable tools/update-packaging],
6258 MOZ_UPDATE_PACKAGING=1,
6259 MOZ_UPDATE_PACKAGING= )
6260 AC_SUBST(MOZ_UPDATE_PACKAGING)
6262 dnl ========================================================
6263 dnl build the tests by default
6264 dnl ========================================================
6265 MOZ_ARG_DISABLE_BOOL(tests,
6266 [ --disable-tests Do not build test libraries & programs],
6270 dnl ========================================================
6271 dnl parental controls (for Windows Vista)
6272 dnl ========================================================
6273 MOZ_ARG_DISABLE_BOOL(parental-controls,
6274 [ --disable-parental-controls
6275 Do not build parental controls],
6276 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6277 MOZ_DISABLE_PARENTAL_CONTROLS=)
6278 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6279 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6282 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6284 dnl ========================================================
6285 dnl = Disable DOMCrypto
6286 dnl ========================================================
6287 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6288 AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6291 dnl ========================================================
6293 dnl = Module specific options
6295 dnl ========================================================
6296 MOZ_ARG_HEADER(Individual module options)
6298 dnl ========================================================
6299 dnl = Disable feed handling components
6300 dnl ========================================================
6301 MOZ_ARG_DISABLE_BOOL(feeds,
6302 [ --disable-feeds Disable feed handling and processing components],
6305 if test -n "$MOZ_FEEDS"; then
6306 AC_DEFINE(MOZ_FEEDS)
6308 if test "$MOZ_BUILD_APP" = "browser"; then
6309 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6313 dnl ========================================================
6314 dnl Check for sqlite
6315 dnl ========================================================
6318 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6319 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6320 MOZ_NATIVE_SQLITE=1,
6321 MOZ_NATIVE_SQLITE= )
6323 if test -z "$MOZ_NATIVE_SQLITE"
6326 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6328 dnl ============================
6329 dnl === SQLite Version check ===
6330 dnl ============================
6331 dnl Check to see if the system SQLite package is new enough.
6332 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6334 dnl ==================================
6335 dnl === SQLITE_SECURE_DELETE check ===
6336 dnl ==================================
6337 dnl Check to see if the system SQLite package is compiled with
6338 dnl SQLITE_SECURE_DELETE enabled.
6339 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6340 _SAVE_CFLAGS="$CFLAGS"
6341 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6343 LIBS="$LIBS $SQLITE_LIBS"
6344 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6346 #include "sqlite3.h"
6348 int main(int argc, char **argv){
6349 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6351 ac_cv_sqlite_secure_delete=yes,
6352 ac_cv_sqlite_secure_delete=no,
6353 ac_cv_sqlite_secure_delete=no
6356 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6357 CFLAGS="$_SAVE_CFLAGS"
6359 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6360 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6363 dnl ===============================
6364 dnl === SQLITE_THREADSAFE check ===
6365 dnl ===============================
6366 dnl Check to see if the system SQLite package is compiled with
6367 dnl SQLITE_THREADSAFE enabled.
6368 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6369 _SAVE_CFLAGS="$CFLAGS"
6370 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6372 LIBS="$LIBS $SQLITE_LIBS"
6373 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6375 #include "sqlite3.h"
6377 int main(int argc, char **argv){
6378 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6380 ac_cv_sqlite_threadsafe=yes,
6381 ac_cv_sqlite_threadsafe=no,
6382 ac_cv_sqlite_threadsafe=no
6385 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6386 CFLAGS="$_SAVE_CFLAGS"
6388 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6389 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6392 dnl ================================
6393 dnl === SQLITE_ENABLE_FTS3 check ===
6394 dnl ================================
6395 dnl check to see if the system SQLite package is compiled with
6396 dnl SQLITE_ENABLE_FTS3 enabled.
6397 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6398 _SAVE_CFLAGS="$CFLAGS"
6399 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6401 LIBS="$LIBS $SQLITE_LIBS"
6402 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6404 #include "sqlite3.h"
6406 int main(int argc, char **argv){
6407 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6409 ac_cv_sqlite_enable_fts3=yes,
6410 ac_cv_sqlite_enable_fts3=no,
6411 ac_cv_sqlite_enable_fts3=no
6414 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6415 CFLAGS="$_SAVE_CFLAGS"
6417 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6418 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6421 dnl =========================================
6422 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6423 dnl =========================================
6424 dnl check to see if the system SQLite package is compiled with
6425 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6426 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6427 _SAVE_CFLAGS="$CFLAGS"
6428 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6430 LIBS="$LIBS $SQLITE_LIBS"
6431 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6433 #include "sqlite3.h"
6435 int main(int argc, char **argv){
6436 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6438 ac_cv_sqlite_enable_unlock_notify=yes,
6439 ac_cv_sqlite_enable_unlock_notify=no,
6440 ac_cv_sqlite_enable_unlock_notify=no
6443 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6444 CFLAGS="$_SAVE_CFLAGS"
6446 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6447 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6451 if test -n "$MOZ_NATIVE_SQLITE"; then
6452 AC_DEFINE(MOZ_NATIVE_SQLITE)
6454 AC_SUBST(MOZ_NATIVE_SQLITE)
6456 dnl ========================================================
6457 dnl = Enable help viewer (off by default)
6458 dnl ========================================================
6459 if test -n "$MOZ_HELP_VIEWER"; then
6460 dnl Do this if defined in confvars.sh
6461 AC_DEFINE(MOZ_HELP_VIEWER)
6464 dnl ========================================================
6465 dnl = Enable safe browsing (anti-phishing)
6466 dnl ========================================================
6467 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6468 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6469 MOZ_SAFE_BROWSING=1,
6470 MOZ_SAFE_BROWSING= )
6471 if test -n "$MOZ_SAFE_BROWSING"; then
6472 AC_DEFINE(MOZ_SAFE_BROWSING)
6474 AC_SUBST(MOZ_SAFE_BROWSING)
6476 dnl ========================================================
6477 dnl = Enable url-classifier
6478 dnl ========================================================
6479 dnl Implicitly enabled by default if building with safe-browsing
6480 if test -n "$MOZ_SAFE_BROWSING"; then
6481 MOZ_URL_CLASSIFIER=1
6483 MOZ_ARG_ENABLE_BOOL(url-classifier,
6484 [ --enable-url-classifier Enable url classifier module],
6485 MOZ_URL_CLASSIFIER=1,
6486 MOZ_URL_CLASSIFIER= )
6487 if test -n "$MOZ_URL_CLASSIFIER"; then
6488 AC_DEFINE(MOZ_URL_CLASSIFIER)
6490 AC_SUBST(MOZ_URL_CLASSIFIER)
6492 dnl ========================================================
6493 dnl = Disable zipwriter
6494 dnl ========================================================
6495 MOZ_ARG_DISABLE_BOOL(zipwriter,
6496 [ --disable-zipwriter Disable zipwriter component],
6499 AC_SUBST(MOZ_ZIPWRITER)
6501 dnl ========================================================
6503 dnl ========================================================
6504 dnl superseded by QtNetwork starting from 4.7
6505 MOZ_ENABLE_LIBCONIC=1
6507 if test -n "$MOZ_ENABLE_QT"; then
6508 if test "$MOZ_ENABLE_QTNETWORK"; then
6509 MOZ_ENABLE_LIBCONIC=
6513 MOZ_ARG_DISABLE_BOOL(libconic,
6514 [ --disable-libconic Disable libconic],
6515 MOZ_ENABLE_LIBCONIC=,
6516 MOZ_ENABLE_LIBCONIC=1 )
6518 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6519 PKG_CHECK_MODULES(LIBCONIC, conic,
6520 MOZ_ENABLE_LIBCONIC=1,
6521 MOZ_ENABLE_LIBCONIC=)
6523 if test "$MOZ_ENABLE_LIBCONIC"; then
6524 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6527 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6528 AC_SUBST(LIBCONIC_CFLAGS)
6529 AC_SUBST(LIBCONIC_LIBS)
6531 dnl ========================================================
6533 dnl ========================================================
6535 MAEMO_SDK_TARGET_VER=-1
6537 MOZ_ARG_WITH_STRING(maemo-version,
6538 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6540 MAEMO_SDK_TARGET_VER=$withval)
6542 case "$MAEMO_SDK_TARGET_VER" in
6544 MOZ_PLATFORM_MAEMO=5
6548 MOZ_PLATFORM_MAEMO=6
6552 dnl We aren't compiling for Maemo, move on.
6555 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6559 if test $MOZ_PLATFORM_MAEMO; then
6560 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6562 if test -z "$MOZ_ENABLE_DBUS"; then
6563 AC_MSG_ERROR([DBus is required when building for Maemo])
6566 MOZ_GFX_OPTIMIZE_MOBILE=1
6567 MOZ_GL_DEFAULT_PROVIDER=EGL
6568 MOZ_MAEMO_LIBLOCATION=
6570 if test $MOZ_PLATFORM_MAEMO = 5; then
6571 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6572 MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6573 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6574 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6575 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6577 AC_SUBST(XCOMPOSITE_LIBS)
6579 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6580 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6581 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6582 if test -z "$_LIB_FOUND"; then
6583 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6587 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6588 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6589 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6590 if test -z "$_LIB_FOUND"; then
6591 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6594 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6595 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6596 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6597 if test -z "$_LIB_FOUND"; then
6598 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6602 if test $MOZ_PLATFORM_MAEMO = 6; then
6604 PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6607 if test "$_LIB_FOUND"; then
6608 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6609 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6610 MOZ_ENABLE_CONTENTMANAGER=1
6611 AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6613 AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6615 AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6617 dnl ========================================================
6618 dnl = Enable meego libcontentaction
6619 dnl ========================================================
6620 MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6621 [ --enable-meegocontentaction Enable meegocontentaction support],
6622 MOZ_MEEGOCONTENTACTION=1,
6623 MOZ_MEEGOCONTENTACTION=)
6625 if test -n "$MOZ_MEEGOCONTENTACTION"; then
6627 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6628 if test "$_LIB_FOUND"; then
6629 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6630 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6631 MOZ_ENABLE_CONTENTACTION=1
6632 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6633 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6637 MOZ_ARG_ENABLE_BOOL(meegotouch,
6638 [ --enable-meegotouch Enable meegotouch support],
6639 MOZ_MEEGOTOUCHENABLED=1,
6640 MOZ_MEEGOTOUCHENABLED=)
6642 if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6643 PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6644 if test "$_LIB_FOUND"; then
6645 MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6646 MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6647 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6649 AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6654 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6655 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6656 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6657 if test "$_LIB_FOUND"; then
6658 MOZ_MAEMO_LIBLOCATION=1
6659 AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6661 AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6663 AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6665 PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6666 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6667 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6668 if test "$_LIB_FOUND"; then
6669 MOZ_ENABLE_MEEGOTOUCHSHARE=1
6670 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6672 AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6674 AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6676 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6677 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6680 dnl ========================================================
6681 dnl = XRender Composite
6682 dnl ========================================================
6683 MOZ_ARG_ENABLE_BOOL(egl-xrender-composite,
6684 [ --enable-egl-xrender-composite
6685 Enable EGL xrender composite optimizations],
6686 MOZ_EGL_XRENDER_COMPOSITE=1)
6688 if test -n "$MOZ_EGL_XRENDER_COMPOSITE"; then
6689 AC_DEFINE(MOZ_EGL_XRENDER_COMPOSITE)
6692 AC_SUBST(MOZ_EGL_XRENDER_COMPOSITE)
6694 dnl ========================================================
6696 dnl ========================================================
6698 MOZ_ARG_WITH_STRING(gl-provider,
6699 [ --with-gl-provider=ID
6700 Set GL provider backend type],
6701 [ val=`echo $withval`
6702 MOZ_GL_PROVIDER="$val"])
6704 if test -n "$MOZ_GL_PROVIDER"; then
6705 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6706 AC_SUBST(MOZ_GL_PROVIDER)
6707 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6709 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6711 dnl ========================================================
6712 dnl = faststripe theme
6713 dnl ========================================================
6714 MOZ_ARG_ENABLE_BOOL(faststripe,
6715 [ --enable-faststripe Use faststripe theme],
6716 MOZ_THEME_FASTSTRIPE=1,
6717 MOZ_THEME_FASTSTRIPE= )
6718 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6720 dnl ========================================================
6722 dnl = Feature options that require extra sources to be pulled
6724 dnl ========================================================
6725 dnl MOZ_ARG_HEADER(Features that require extra sources)
6727 dnl ========================================================
6729 dnl = Debugging Options
6731 dnl ========================================================
6732 MOZ_ARG_HEADER(Debugging and Optimizations)
6734 dnl ========================================================
6735 dnl = Disable building with debug info.
6736 dnl = Debugging is OFF by default
6737 dnl ========================================================
6738 if test -z "$MOZ_DEBUG_FLAGS"; then
6739 MOZ_DEBUG_FLAGS="-g"
6742 MOZ_ARG_ENABLE_STRING(debug,
6743 [ --enable-debug[=DBG] Enable building with developer debug info
6744 (using compiler flags DBG)],
6745 [ if test "$enableval" != "no"; then
6747 if test -n "$enableval" -a "$enableval" != "yes"; then
6748 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6749 _MOZ_DEBUG_FLAGS_SET=1
6756 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6757 MOZ_ARG_WITH_STRING(debug-label,
6758 [ --with-debug-label=LABELS
6759 Define DEBUG_<value> for each comma-separated
6761 [ for option in `echo $withval | sed 's/,/ /g'`; do
6762 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6765 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6767 if test -n "$MOZ_DEBUG"; then
6768 AC_MSG_CHECKING([for valid debug flags])
6769 _SAVE_CFLAGS=$CFLAGS
6770 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6771 AC_TRY_COMPILE([#include <stdio.h>],
6772 [printf("Hello World\n");],
6775 AC_MSG_RESULT([$_results])
6776 if test "$_results" = "no"; then
6777 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6779 CFLAGS=$_SAVE_CFLAGS
6782 dnl ========================================================
6783 dnl enable mobile optimizations
6784 dnl ========================================================
6785 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6786 [ --enable-mobile-optimize
6787 Enable mobile optimizations],
6788 MOZ_GFX_OPTIMIZE_MOBILE=1)
6790 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6792 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6793 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6796 dnl ========================================================
6797 dnl = Enable code optimization. ON by default.
6798 dnl ========================================================
6799 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6800 MOZ_OPTIMIZE_FLAGS="-O"
6803 MOZ_ARG_ENABLE_STRING(optimize,
6804 [ --disable-optimize Disable compiler optimization
6805 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6806 [ if test "$enableval" != "no"; then
6808 if test -n "$enableval" -a "$enableval" != "yes"; then
6809 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6814 fi ], MOZ_OPTIMIZE=1)
6816 MOZ_SET_FRAMEPTR_FLAGS
6818 if test "$COMPILE_ENVIRONMENT"; then
6819 if test -n "$MOZ_OPTIMIZE"; then
6820 AC_MSG_CHECKING([for valid optimization flags])
6821 _SAVE_CFLAGS=$CFLAGS
6822 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6823 AC_TRY_COMPILE([#include <stdio.h>],
6824 [printf("Hello World\n");],
6827 AC_MSG_RESULT([$_results])
6828 if test "$_results" = "no"; then
6829 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6831 CFLAGS=$_SAVE_CFLAGS
6833 fi # COMPILE_ENVIRONMENT
6835 AC_SUBST(MOZ_OPTIMIZE)
6836 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6837 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6838 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6839 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6840 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6841 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6843 dnl ========================================================
6844 dnl = Enable generation of debug symbols
6845 dnl ========================================================
6846 MOZ_ARG_ENABLE_STRING(debug-symbols,
6847 [ --enable-debug-symbols[=DBG]
6848 Enable debugging symbols (using compiler flags DBG)],
6849 [ if test "$enableval" != "no"; then
6851 if test -n "$enableval" -a "$enableval" != "yes"; then
6852 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6853 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6855 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6861 MOZ_DEBUG_SYMBOLS=1)
6863 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6864 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6865 export MOZ_DEBUG_SYMBOLS
6868 dnl ========================================================
6869 dnl = Enable any treating of compile warnings as errors
6870 dnl ========================================================
6871 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6872 [ --enable-warnings-as-errors
6873 Enable treating of warnings as errors],
6874 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6875 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6876 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6877 WARNINGS_AS_ERRORS=''
6880 dnl ========================================================
6881 dnl = Disable runtime logging checks
6882 dnl ========================================================
6883 MOZ_ARG_DISABLE_BOOL(logging,
6884 [ --disable-logging Disable logging facilities],
6885 NS_DISABLE_LOGGING=1,
6886 NS_DISABLE_LOGGING= )
6887 if test "$NS_DISABLE_LOGGING"; then
6888 AC_DEFINE(NS_DISABLE_LOGGING)
6890 AC_DEFINE(MOZ_LOGGING)
6893 dnl ========================================================
6894 dnl = This will enable logging of addref, release, ctor, dtor.
6895 dnl ========================================================
6896 _ENABLE_LOGREFCNT=42
6897 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6898 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6899 _ENABLE_LOGREFCNT=1,
6900 _ENABLE_LOGREFCNT= )
6901 if test "$_ENABLE_LOGREFCNT" = "1"; then
6902 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6903 elif test -z "$_ENABLE_LOGREFCNT"; then
6904 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6907 dnl ========================================================
6908 dnl moz_dump_painting
6909 dnl ========================================================
6910 MOZ_ARG_ENABLE_BOOL(dump-painting,
6911 [ --enable-dump-painting Enable paint debugging.],
6912 MOZ_DUMP_PAINTING=1,
6913 MOZ_DUMP_PAINTING= )
6914 if test -n "$MOZ_DUMP_PAINTING"; then
6915 AC_DEFINE(MOZ_DUMP_PAINTING)
6916 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6918 if test -n "$MOZ_DEBUG"; then
6919 AC_DEFINE(MOZ_DUMP_PAINTING)
6922 dnl ========================================================
6923 dnl = Enable trace malloc
6924 dnl ========================================================
6925 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6926 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6927 [ --enable-trace-malloc Enable malloc tracing; also disables jemalloc],
6930 if test "$NS_TRACE_MALLOC"; then
6931 # Please, Mr. Linker Man, don't take away our symbol names
6932 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6934 AC_DEFINE(NS_TRACE_MALLOC)
6936 AC_SUBST(NS_TRACE_MALLOC)
6938 dnl ========================================================
6939 dnl = Enable jemalloc
6940 dnl ========================================================
6941 MOZ_ARG_ENABLE_BOOL(jemalloc,
6942 [ --enable-jemalloc Replace memory allocator with jemalloc],
6946 if test "$NS_TRACE_MALLOC"; then
6949 if test "$MOZ_DMD"; then
6953 if test "${OS_TARGET}" = "Android"; then
6954 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6956 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
6957 dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
6958 if test -z "$GNU_CC"; then
6959 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6961 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6964 dnl On other Unix systems, we only want to link executables against mozglue
6965 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6966 dnl On other Unix systems, where mozglue is a static library, jemalloc is
6967 dnl separated for the SDK, so we need to add it here.
6968 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6969 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6971 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6972 if test -n "$GNU_CC"; then
6973 dnl And we need mozglue symbols to be exported.
6974 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6976 if test "$MOZ_LINKER" = 1; then
6977 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $ZLIB_LIBS"
6981 if test -z "$MOZ_MEMORY"; then
6984 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
6985 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.])
6990 dnl Don't try to run compiler tests on Windows
6991 if test "$OS_ARCH" = "WINNT"; then
6992 if test -z "$HAVE_64BIT_OS"; then
6993 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6995 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6998 AC_CHECK_SIZEOF([int *], [4])
6999 case "${ac_cv_sizeof_int_p}" in
7001 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7004 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7007 AC_MSG_ERROR([Unexpected pointer size])
7012 AC_DEFINE(MOZ_MEMORY)
7013 if test -n "$MOZ_JEMALLOC"; then
7014 AC_DEFINE(MOZ_JEMALLOC)
7016 if test "x$MOZ_DEBUG" = "x1"; then
7017 AC_DEFINE(MOZ_MEMORY_DEBUG)
7019 dnl The generic feature tests that determine how to compute ncpus are long and
7020 dnl complicated. Therefore, simply define special cpp variables for the
7021 dnl platforms we have special knowledge of.
7024 AC_DEFINE(MOZ_MEMORY_DARWIN)
7027 AC_DEFINE(MOZ_MEMORY_BSD)
7029 *-android*|*-linuxandroid*)
7030 AC_DEFINE(MOZ_MEMORY_LINUX)
7031 AC_DEFINE(MOZ_MEMORY_ANDROID)
7036 AC_DEFINE(MOZ_MEMORY_LINUX)
7039 AC_DEFINE(MOZ_MEMORY_BSD)
7042 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7045 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7046 if test -z "$MOZ_DEBUG"; then
7047 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7049 WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7051 dnl Look for a broken crtdll.obj
7052 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7053 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7054 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7055 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7056 dnl Also pass this to NSPR/NSS
7057 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7059 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7066 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7070 AC_SUBST(MOZ_MEMORY)
7071 AC_SUBST(MOZ_JEMALLOC)
7072 AC_SUBST(MOZ_GLUE_LDFLAGS)
7073 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7074 AC_SUBST(WIN32_CRT_LIBS)
7075 dnl Need to set this for make because NSS doesn't have configure
7078 dnl We need to wrap dlopen and related functions on Android because we use
7080 if test "$OS_TARGET" = Android; then
7081 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7082 if test -n "$MOZ_OLD_LINKER"; then
7083 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
7085 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7086 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7089 dnl ========================================================
7090 dnl = Use malloc wrapper lib
7091 dnl ========================================================
7092 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7093 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7097 if test -n "$_WRAP_MALLOC"; then
7098 if test -n "$GNU_CC"; then
7099 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7100 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7101 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7102 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7103 dnl Wrap operator new and operator delete on Android.
7104 if test "$OS_TARGET" = "Android"; then
7105 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7108 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7112 dnl ========================================================
7113 dnl = Location of malloc wrapper lib
7114 dnl ========================================================
7115 MOZ_ARG_WITH_STRING(wrap-malloc,
7116 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7117 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7119 dnl ========================================================
7120 dnl = Use JS Call tracing
7121 dnl ========================================================
7122 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7123 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7124 MOZ_TRACE_JSCALLS=1,
7125 MOZ_TRACE_JSCALLS= )
7126 if test -n "$MOZ_TRACE_JSCALLS"; then
7127 AC_DEFINE(MOZ_TRACE_JSCALLS)
7130 dnl ========================================================
7131 dnl = Use incremental GC
7132 dnl ========================================================
7134 MOZ_ARG_DISABLE_BOOL(gcincremental,
7135 [ --disable-gcincremental Disable incremental GC],
7137 if test -n "$JSGC_INCREMENTAL"; then
7138 AC_DEFINE(JSGC_INCREMENTAL)
7141 dnl ========================================================
7142 dnl ETW - Event Tracing for Windows
7143 dnl ========================================================
7144 MOZ_ARG_ENABLE_BOOL(ETW,
7145 [ --enable-ETW Enable ETW (Event Tracing for Windows) event reporting],
7148 if test -n "$MOZ_ETW"; then
7152 if test -n "$MOZ_ETW"; then
7153 if test -z "$MOZ_WINSDK_TARGETVER"; then
7154 AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7158 dnl ========================================================
7159 dnl Zealous JavaScript GC
7160 dnl ========================================================
7161 MOZ_ARG_ENABLE_BOOL(gczeal,
7162 [ --enable-gczeal Enable zealous JavaScript GCing],
7165 if test -n "$JS_GC_ZEAL"; then
7166 AC_DEFINE(JS_GC_ZEAL)
7169 dnl ========================================================
7170 dnl JS opt-mode assertions and minidump instrumentation
7171 dnl ========================================================
7172 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7173 [ --enable-js-diagnostics
7174 Enable JS diagnostic assertions and breakpad data],
7175 JS_CRASH_DIAGNOSTICS=1,
7176 JS_CRASH_DIAGNOSTICS= )
7177 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7178 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7181 dnl ======================================================
7182 dnl = Enable compiling with ccache
7183 dnl ======================================================
7184 MOZ_ARG_WITH_STRING(ccache,
7185 [ --with-ccache[=path/to/ccache]
7186 Enable compiling with ccache],
7187 CCACHE=$withval, CCACHE="no")
7189 if test "$CCACHE" != "no"; then
7190 if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7193 if test ! -e "$CCACHE"; then
7194 AC_MSG_ERROR([$CCACHE not found])
7197 MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7198 if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7199 AC_MSG_ERROR([ccache not found])
7200 elif test -x "$CCACHE"; then
7204 AC_MSG_ERROR([$CCACHE is not executable])
7208 dnl ========================================================
7209 dnl = Enable static checking using gcc-dehydra
7210 dnl ========================================================
7212 MOZ_ARG_WITH_STRING(static-checking,
7213 [ --with-static-checking=path/to/gcc_dehydra.so
7214 Enable static checking of code using GCC-dehydra],
7215 DEHYDRA_PATH=$withval,
7218 if test -n "$DEHYDRA_PATH"; then
7219 if test ! -f "$DEHYDRA_PATH"; then
7220 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7222 AC_DEFINE(NS_STATIC_CHECKING)
7224 AC_SUBST(DEHYDRA_PATH)
7226 dnl ========================================================
7227 dnl = Enable stripping of libs & executables
7228 dnl ========================================================
7229 MOZ_ARG_ENABLE_BOOL(strip,
7230 [ --enable-strip Enable stripping of libs & executables ],
7234 dnl ========================================================
7235 dnl = Enable stripping of libs & executables when packaging
7236 dnl ========================================================
7237 MOZ_ARG_ENABLE_BOOL(install-strip,
7238 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7242 dnl ========================================================
7243 dnl = --enable-elf-dynstr-gc
7244 dnl ========================================================
7245 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7246 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7247 USE_ELF_DYNSTR_GC=1,
7248 USE_ELF_DYNSTR_GC= )
7250 dnl ========================================================
7251 dnl = --disable-elf-hack
7252 dnl ========================================================
7255 MOZ_ARG_DISABLE_BOOL(elf-hack,
7256 [ --disable-elf-hack Disable elf hacks],
7260 # Disable elf hack for profiling because the built in profiler
7261 # doesn't read the segments properly with elf hack. This is
7262 # temporary and should be fixed soon in the profiler.
7263 if test "$MOZ_PROFILING" = 1; then
7267 # Only enable elfhack where supported
7268 if test "$USE_ELF_HACK" = 1; then
7269 case "${HOST_OS_ARCH},${OS_ARCH}" in
7271 case "${CPU_ARCH}" in
7286 if test "$USE_ELF_HACK" = 1; then
7287 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7288 dnl memory addresses it maps to. The result is that by the time elfhack
7289 dnl kicks in, it is not possible to apply relocations because of that,
7290 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7291 dnl segment. It makes elfhack mostly useless, so considering the problems
7292 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7293 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7294 dnl the linker creates PT_GNU_RELRO segments.
7295 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7296 LINK_WITH_PT_GNU_RELRO,
7297 [echo "int main() {return 0;}" > conftest.${ac_ext}
7298 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7299 test -s conftest${ac_exeext}; then
7300 if readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7301 LINK_WITH_PT_GNU_RELRO=yes
7303 LINK_WITH_PT_GNU_RELRO=no
7306 dnl We really don't expect to get here, but just in case
7307 AC_ERROR([couldn't compile a simple C file])
7310 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7311 AC_MSG_WARN([Disabling elfhack])
7316 dnl ========================================================
7317 dnl = libstdc++ compatibility hacks
7318 dnl ========================================================
7321 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7322 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7325 AC_SUBST(STDCXX_COMPAT)
7327 if test -n "$STDCXX_COMPAT"; then
7328 eval $(CXX="$CXX" MACOS_SDK_DIR="$MACOS_SDK_DIR" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7329 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7330 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7333 dnl ========================================================
7335 dnl = Profiling and Instrumenting
7337 dnl ========================================================
7338 MOZ_ARG_HEADER(Profiling and Instrumenting)
7340 dnl ========================================================
7341 dnl = Enable NS_FUNCTION_TIMER, which provides Function
7342 dnl = timing for identifying code bottlenecks
7343 dnl = NS_FUNCTION_TIMER is off by default.
7344 dnl ========================================================
7345 MOZ_ARG_ENABLE_BOOL(functiontimer,
7346 [ --enable-functiontimer Enable NS_FUNCTION_TIMER ],
7347 NS_FUNCTION_TIMER=1,
7348 NS_FUNCTION_TIMER= )
7349 if test -n "$NS_FUNCTION_TIMER"; then
7350 AC_DEFINE(NS_FUNCTION_TIMER)
7353 dnl ========================================================
7354 dnl = Enable runtime visual profiling logger
7355 dnl ========================================================
7356 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7357 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7358 MOZ_VISUAL_EVENT_TRACER=1,
7359 MOZ_VISUAL_EVENT_TRACER=)
7360 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7361 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7364 dnl ========================================================
7365 dnl Turn on reflow counting
7366 dnl ========================================================
7367 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7368 [ --enable-reflow-perf Enable reflow performance tracing],
7371 if test -n "$MOZ_REFLOW_PERF"; then
7372 AC_DEFINE(MOZ_REFLOW_PERF)
7375 dnl ========================================================
7376 dnl Enable code size metrics.
7377 dnl ========================================================
7378 MOZ_ARG_ENABLE_BOOL(codesighs,
7379 [ --enable-codesighs Enable code size analysis tools],
7380 _ENABLE_CODESIGHS=1,
7381 _ENABLE_CODESIGHS= )
7382 if test -n "$_ENABLE_CODESIGHS"; then
7383 if test -d $srcdir/tools/codesighs; then
7386 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7390 dnl ========================================================
7391 dnl = Enable Radio Interface for B2G (Gonk usually)
7392 dnl ========================================================
7393 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7394 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7397 if test -n "$MOZ_B2G_RIL"; then
7398 AC_DEFINE(MOZ_B2G_RIL)
7400 AC_SUBST(MOZ_B2G_RIL)
7402 dnl ========================================================
7403 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7404 dnl ========================================================
7405 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7406 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7409 if test -n "$MOZ_B2G_BT"; then
7410 AC_DEFINE(MOZ_B2G_BT)
7412 AC_SUBST(MOZ_B2G_BT)
7414 dnl ========================================================
7415 dnl = Enable Support for System Messages API
7416 dnl ========================================================
7418 AC_SUBST(MOZ_SYS_MSG)
7420 dnl ========================================================
7421 dnl = Support for demangling undefined symbols
7422 dnl ========================================================
7423 if test -z "$SKIP_LIBRARY_CHECKS"; then
7426 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7430 # Demangle only for debug or trace-malloc builds
7431 MOZ_DEMANGLE_SYMBOLS=
7432 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7433 MOZ_DEMANGLE_SYMBOLS=1
7434 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7436 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7438 dnl ========================================================
7439 dnl = Support for gcc stack unwinding (from gcc 3.3)
7440 dnl ========================================================
7441 if test -z "$SKIP_LIBRARY_CHECKS"; then
7442 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7445 dnl ========================================================
7447 dnl ========================================================
7449 MOZ_ARG_WITH_STRING(jitreport-granularity,
7450 [ --jitreport-granularity=N
7451 Default granularity at which to report JIT code
7454 1 - code ranges for whole functions only
7455 2 - per-line information
7456 3 - per-op information],
7457 JITREPORT_GRANULARITY=$withval,
7458 JITREPORT_GRANULARITY=3)
7460 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7462 dnl ========================================================
7466 dnl ========================================================
7467 MOZ_ARG_HEADER(Misc. Options)
7469 dnl ========================================================
7470 dnl update xterm title
7471 dnl ========================================================
7472 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7473 [ --enable-xterm-updates Update XTERM titles with current command.],
7477 dnl =========================================================
7479 dnl =========================================================
7480 MOZ_ARG_ENABLE_STRING([chrome-format],
7481 [ --enable-chrome-format=jar|flat|both|symlink|omni
7482 Select FORMAT of chrome files (default=jar)],
7483 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7485 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7486 MOZ_CHROME_FILE_FORMAT=jar
7489 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7490 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7491 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7492 test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7493 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7494 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7497 dnl =========================================================
7498 dnl Omnijar packaging (bug 552121)
7499 dnl =========================================================
7500 dnl Omnijar packaging is compatible with flat packaging.
7501 dnl In unpackaged builds, omnijar looks for files as if
7502 dnl things were flat packaged. After packaging, all files
7503 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7504 dnl is set to flat since putting files into jars is only
7505 dnl done during packaging with omnijar.
7506 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7508 AC_DEFINE(MOZ_OMNIJAR)
7509 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$OS_TARGET" = "Android"; then
7510 MOZ_CHROME_FILE_FORMAT=flat
7512 MOZ_CHROME_FILE_FORMAT=symlink
7514 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7515 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7518 OMNIJAR_NAME=omni.ja
7519 AC_SUBST(OMNIJAR_NAME)
7520 AC_SUBST(MOZ_OMNIJAR)
7522 dnl ========================================================
7523 dnl = Define default location for MOZILLA_FIVE_HOME
7524 dnl ========================================================
7525 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7526 [ --with-default-mozilla-five-home
7527 Set the default value for MOZILLA_FIVE_HOME],
7528 [ val=`echo $withval`
7529 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7531 dnl ========================================================
7532 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7533 dnl ========================================================
7534 MOZ_ARG_WITH_STRING(user-appdir,
7535 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7536 [ val=`echo $withval`
7537 if echo "$val" | grep "\/" >/dev/null; then
7538 AC_MSG_ERROR("Homedir must be single relative path.")
7543 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7545 dnl ========================================================
7546 dnl = Doxygen configuration
7547 dnl ========================================================
7548 dnl Use commas to specify multiple dirs to this arg
7549 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7550 MOZ_ARG_WITH_STRING(doc-input-dirs,
7551 [ --with-doc-input-dirs=DIRS
7552 Header/idl dirs to create docs from],
7553 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7554 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7556 dnl Use commas to specify multiple dirs to this arg
7557 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7558 MOZ_ARG_WITH_STRING(doc-include-dirs,
7559 [ --with-doc-include-dirs=DIRS
7560 Include dirs to preprocess doc headers],
7561 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7562 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7564 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7565 MOZ_ARG_WITH_STRING(doc-output-dir,
7566 [ --with-doc-output-dir=DIR
7567 Dir to generate docs into],
7568 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7569 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7571 if test -z "$SKIP_COMPILER_CHECKS"; then
7572 dnl ========================================================
7574 dnl = Compiler Options
7576 dnl ========================================================
7577 MOZ_ARG_HEADER(Compiler Options)
7579 dnl ========================================================
7580 dnl Check for gcc -pipe support
7581 dnl ========================================================
7582 AC_MSG_CHECKING([for -pipe support])
7583 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7584 dnl Any gcc that supports firefox supports -pipe.
7585 CFLAGS="$CFLAGS -pipe"
7586 CXXFLAGS="$CXXFLAGS -pipe"
7587 AC_MSG_RESULT([yes])
7592 dnl ========================================================
7593 dnl Profile guided optimization (gcc checks)
7594 dnl ========================================================
7595 dnl Test for profiling options
7596 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7598 _SAVE_CFLAGS="$CFLAGS"
7599 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7601 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7602 AC_TRY_COMPILE([], [return 0;],
7603 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7604 result="yes" ], result="no")
7605 AC_MSG_RESULT([$result])
7607 if test $result = "yes"; then
7608 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7609 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7610 PROFILE_USE_LDFLAGS="-fprofile-use"
7613 CFLAGS="$_SAVE_CFLAGS"
7615 if test -n "$INTEL_CC"; then
7616 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7617 PROFILE_GEN_LDFLAGS=
7618 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7619 PROFILE_USE_LDFLAGS=
7622 dnl Sun Studio on Solaris
7623 if test "$SOLARIS_SUNPRO_CC"; then
7624 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7625 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7626 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7627 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7630 AC_SUBST(PROFILE_GEN_CFLAGS)
7631 AC_SUBST(PROFILE_GEN_LDFLAGS)
7632 AC_SUBST(PROFILE_USE_CFLAGS)
7633 AC_SUBST(PROFILE_USE_LDFLAGS)
7637 dnl ========================================================
7638 dnl Test for -pedantic bustage
7639 dnl ========================================================
7640 MOZ_ARG_DISABLE_BOOL(pedantic,
7641 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
7643 if test "$_PEDANTIC"; then
7644 _SAVE_CXXFLAGS=$CXXFLAGS
7645 CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7646 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7647 AC_TRY_COMPILE([$configure_static_assert_macros],
7648 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7649 result="no", result="yes" )
7650 AC_MSG_RESULT([$result])
7651 CXXFLAGS="$_SAVE_CXXFLAGS"
7655 _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
7656 _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7659 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
7664 dnl ========================================================
7665 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7666 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7667 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7668 dnl ========================================================
7669 _SAVE_CXXFLAGS=$CXXFLAGS
7670 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7671 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7672 ac_nscap_nonconst_opeq_bug,
7681 template <class T, class U>
7682 int operator==(const Pointer<T>& rhs, U* lhs)
7684 return rhs.myPtr == lhs;
7687 template <class T, class U>
7688 int operator==(const Pointer<T>& rhs, const U* lhs)
7690 return rhs.myPtr == lhs;
7698 ac_nscap_nonconst_opeq_bug="no",
7699 ac_nscap_nonconst_opeq_bug="yes")])
7700 CXXFLAGS="$_SAVE_CXXFLAGS"
7702 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7703 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7705 fi # ! SKIP_COMPILER_CHECKS
7707 AC_DEFINE(CPP_THROW_NEW, [throw()])
7710 if test "$COMPILE_ENVIRONMENT"; then
7712 fi # COMPILE_ENVIRONMENT
7714 dnl ========================================================
7716 dnl = Build depencency options
7718 dnl ========================================================
7719 MOZ_ARG_HEADER(Build dependencies)
7721 dnl ========================================================
7722 dnl = Do not auto generate dependency info
7723 dnl ========================================================
7725 MOZ_ARG_DISABLE_BOOL(auto-deps,
7726 [ --disable-auto-deps Do not automatically generate dependency info],
7730 if test -n "$MOZ_AUTO_DEPS"; then
7731 dnl ========================================================
7732 dnl = Use mkdepend instead of $CC -MD for dependency generation
7733 dnl ========================================================
7735 MOZ_ARG_DISABLE_BOOL(md,
7736 [ --disable-md Do not use compiler-based dependencies ],
7739 [dnl Default is to turn on -MD if using GNU-compatible compilers
7740 if test "$GNU_CC" -a "$GNU_CXX"; then
7743 dnl Default is to use -xM if using Sun Studio on Solaris
7744 if test "$SOLARIS_SUNPRO_CC"; then
7747 if test "$_cpp_md_flag"; then
7749 _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
7750 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7751 if test "$SOLARIS_SUNPRO_CC"; then
7756 dnl Don't override this for MSVC
7757 if test -z "$_WIN32_MSVC"; then
7758 _USE_CPP_INCLUDE_FLAG=
7759 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7760 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7762 echo '#include <stdio.h>' > dummy-hello.c
7764 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7766 if test -z "$CL_INCLUDES_PREFIX"; then
7767 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7769 AC_SUBST(CL_INCLUDES_PREFIX)
7771 dnl cl.py provides dependency generation for MSVC
7772 CC_WRAPPER='$(PYTHON) -O $(topsrcdir)/build/cl.py'
7773 CXX_WRAPPER='$(PYTHON) -O $(topsrcdir)/build/cl.py'
7779 AC_SUBST(MOZ_AUTO_DEPS)
7780 AC_SUBST(COMPILER_DEPEND)
7782 AC_SUBST(CC_WRAPPER)
7783 AC_SUBST(CXX_WRAPPER)
7786 dnl ========================================================
7788 dnl = Static Build Options
7790 dnl ========================================================
7791 MOZ_ARG_HEADER(Static build options)
7793 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7794 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
7798 MOZ_ARG_ENABLE_BOOL(shared-js,
7799 [ --enable-shared-js
7800 Create a shared JavaScript library.],
7804 if test -n "$ENABLE_SHARED_JS"; then
7806 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7808 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7809 AC_DEFINE(MOZ_STATIC_JS)
7811 AC_SUBST(JS_SHARED_LIBRARY)
7813 AC_SUBST(LIBXUL_LIBS)
7814 XPCOM_LIBS="$LIBXUL_LIBS"
7816 dnl ========================================================
7818 dnl = Standalone module options
7820 dnl ========================================================
7821 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7824 dnl ========================================================
7826 if test -z "$SKIP_PATH_CHECKS"; then
7827 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7828 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7829 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7834 if test -z "${GLIB_GMODULE_LIBS}" \
7835 -a -n "${GLIB_CONFIG}"\
7836 -a "${GLIB_CONFIG}" != no\
7838 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7841 AC_SUBST(GLIB_CFLAGS)
7843 AC_SUBST(GLIB_GMODULE_LIBS)
7845 dnl ========================================================
7846 dnl Graphics checks.
7847 dnl ========================================================
7849 if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
7855 MOZ_ARG_ENABLE_BOOL(skia,
7856 [ --enable-skia Enable use of Skia],
7860 if test "$USE_FC_FREETYPE"; then
7861 if test "$COMPILE_ENVIRONMENT"; then
7862 dnl ========================================================
7863 dnl = Check for freetype2 and its functionality
7864 dnl ========================================================
7865 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7867 if test "$_HAVE_FREETYPE2"; then
7869 _SAVE_CFLAGS="$CFLAGS"
7870 LIBS="$LIBS $FT2_LIBS"
7871 CFLAGS="$CFLAGS $FT2_CFLAGS"
7873 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7874 ac_cv_member_FT_Bitmap_Size_y_ppem,
7875 [AC_TRY_COMPILE([#include <ft2build.h>
7876 #include FT_FREETYPE_H],
7878 if (sizeof s.y_ppem) return 0;
7880 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7881 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7882 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7883 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7885 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7887 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7888 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7889 [FT_Bitmap_Size structure includes y_ppem field])
7891 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
7894 CFLAGS="$_SAVE_CFLAGS"
7897 _SAVE_CPPFLAGS="$CPPFLAGS"
7898 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7899 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7900 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7901 CPPFLAGS="$_SAVE_CPPFLAGS"
7903 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7907 dnl ========================================================
7908 dnl Check for pixman and cairo
7909 dnl ========================================================
7912 MOZ_ARG_ENABLE_BOOL(system-cairo,
7913 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7918 MOZ_ARG_ENABLE_BOOL(system-pixman,
7919 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7921 MOZ_TREE_PIXMAN=force,
7924 # System cairo depends on system pixman
7925 if test "$MOZ_TREE_PIXMAN" = "force"; then
7926 if test -z "$MOZ_TREE_CAIRO"; then
7927 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7931 elif test -z "$MOZ_TREE_CAIRO"; then
7935 if test "$MOZ_TREE_PIXMAN"; then
7936 AC_DEFINE(MOZ_TREE_PIXMAN)
7937 MOZ_PIXMAN_CFLAGS=""
7938 MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
7940 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
7941 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
7942 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
7944 AC_SUBST(MOZ_PIXMAN_CFLAGS)
7945 AC_SUBST(MOZ_PIXMAN_LIBS)
7947 # Check for headers defining standard int types.
7948 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7950 if test "$MOZ_TREE_CAIRO"; then
7951 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7952 AC_DEFINE(MOZ_TREE_CAIRO)
7954 # For now we assume that we will have a uint64_t available through
7955 # one of the above headers or mozstdint.h.
7956 AC_DEFINE(HAVE_UINT64_T)
7958 # Define macros for cairo-features.h
7959 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
7960 if test "$MOZ_X11"; then
7961 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7962 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7963 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7964 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7965 MOZ_ENABLE_CAIRO_FT=1
7966 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7968 case "$MOZ_WIDGET_TOOLKIT" in
7970 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7973 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7974 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7975 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7978 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7979 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7980 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7981 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7982 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7983 MOZ_ENABLE_D2D_SURFACE=1
7984 MOZ_ENABLE_DWRITE_FONT=1
7986 WIN32_DWRITE_FONT_FEATURE=
7987 WIN32_D2D_SURFACE_FEATURE=
7990 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
7992 dnl D3D10 Layers depend on D2D Surfaces.
7993 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
7994 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
7998 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7999 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8000 MOZ_ENABLE_CAIRO_FT=1
8001 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8002 CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8006 if test "$USE_FC_FREETYPE"; then
8007 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8009 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8010 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8011 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8012 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8013 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8014 AC_SUBST(CAIRO_FT_CFLAGS)
8016 AC_SUBST(PS_SURFACE_FEATURE)
8017 AC_SUBST(PDF_SURFACE_FEATURE)
8018 AC_SUBST(SVG_SURFACE_FEATURE)
8019 AC_SUBST(XLIB_SURFACE_FEATURE)
8020 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8021 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8022 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8023 AC_SUBST(WIN32_SURFACE_FEATURE)
8024 AC_SUBST(OS2_SURFACE_FEATURE)
8025 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8026 AC_SUBST(FT_FONT_FEATURE)
8027 AC_SUBST(FC_FONT_FEATURE)
8028 AC_SUBST(WIN32_FONT_FEATURE)
8029 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8030 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8031 AC_SUBST(QUARTZ_FONT_FEATURE)
8032 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8033 AC_SUBST(QT_SURFACE_FEATURE)
8034 AC_SUBST(TEE_SURFACE_FEATURE)
8036 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8037 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8039 if test "$MOZ_X11"; then
8040 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8043 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8044 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8047 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8048 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8049 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8050 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8051 if test "$MOZ_X11"; then
8052 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8053 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8054 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8055 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8059 AC_SUBST(MOZ_TREE_CAIRO)
8060 AC_SUBST(MOZ_CAIRO_CFLAGS)
8061 AC_SUBST(MOZ_CAIRO_LIBS)
8062 AC_SUBST(MOZ_CAIRO_OSLIBS)
8063 AC_SUBST(MOZ_TREE_PIXMAN)
8065 dnl ========================================================
8067 dnl ========================================================
8069 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8072 dnl ========================================================
8074 dnl ========================================================
8075 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8076 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8078 dnl ========================================================
8080 dnl ========================================================
8081 if test "$MOZ_GRAPHITE"; then
8082 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8083 AC_DEFINE(MOZ_GRAPHITE)
8087 AC_SUBST(MOZ_GRAPHITE)
8088 AC_SUBST(MOZ_GRAPHITE_LIBS)
8090 dnl ========================================================
8092 dnl ========================================================
8093 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8094 AC_SUBST(MOZ_OTS_LIBS)
8096 dnl ========================================================
8098 dnl ========================================================
8099 if test "$MOZ_ENABLE_SKIA"; then
8100 MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8101 AC_DEFINE(MOZ_ENABLE_SKIA)
8105 AC_SUBST(MOZ_ENABLE_SKIA)
8106 AC_SUBST(MOZ_SKIA_LIBS)
8108 dnl ========================================================
8110 dnl ========================================================
8111 MOZ_ARG_DISABLE_BOOL(xul,
8112 [ --disable-xul Disable XUL],
8114 if test "$MOZ_XUL"; then
8117 dnl remove extensions that require XUL
8118 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8123 dnl ========================================================
8124 dnl disable profile locking
8125 dnl do no use this in applications that can have more than
8126 dnl one process accessing the profile directory.
8127 dnl ========================================================
8128 MOZ_ARG_DISABLE_BOOL(profilelocking,
8129 [ --disable-profilelocking
8130 Disable profile locking],
8131 MOZ_PROFILELOCKING=,
8132 MOZ_PROFILELOCKING=1 )
8133 if test "$MOZ_PROFILELOCKING"; then
8134 AC_DEFINE(MOZ_PROFILELOCKING)
8137 dnl ========================================================
8138 dnl necko configuration options
8139 dnl ========================================================
8142 dnl option to disable various necko protocols
8144 MOZ_ARG_ENABLE_STRING(necko-protocols,
8145 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8146 Enable/disable specific protocol handlers],
8147 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8148 if test "$option" = "yes" -o "$option" = "all"; then
8149 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8150 elif test "$option" = "no" -o "$option" = "none"; then
8152 elif test "$option" = "default"; then
8153 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8154 elif test `echo "$option" | grep -c \^-` != 0; then
8155 option=`echo $option | sed 's/^-//'`
8156 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8158 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8161 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8163 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8164 AC_SUBST(NECKO_PROTOCOLS)
8165 for p in $NECKO_PROTOCOLS; do
8166 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8170 dnl option to disable necko's wifi scanner
8172 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8173 [ --disable-necko-wifi Disable necko wifi scanner],
8177 if test "$OS_ARCH" = "OS2"; then
8178 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8181 if test "$NECKO_WIFI" -a \
8182 "$OS_ARCH" != "Linux" -a \
8183 "$OS_ARCH" != "Darwin" -a \
8184 "$OS_ARCH" != "SunOS" -a \
8185 "$OS_ARCH" != "WINNT"; then
8186 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8189 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8191 MOZ_CHECK_HEADER([iwlib.h])
8192 if test "$ac_cv_header_iwlib_h" != "yes"; then
8193 AC_MSG_ERROR([Can't find header iwlib.h for Necko WiFi scanning (might be in package libiw-dev (Ubuntu) or wireless-tools-devel (Fedora) or libiw-devel (openSUSE)); use --disable-necko-wifi to disable])
8197 if test "$NECKO_WIFI"; then
8198 AC_DEFINE(NECKO_WIFI)
8200 AC_SUBST(NECKO_WIFI)
8203 dnl option to disable cookies
8205 MOZ_ARG_DISABLE_BOOL(cookies,
8206 [ --disable-cookies Disable cookie support],
8209 AC_SUBST(NECKO_COOKIES)
8210 if test "$NECKO_COOKIES"; then
8211 AC_DEFINE(NECKO_COOKIES)
8215 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8217 MOZ_ARG_DISABLE_BOOL(ctypes,
8218 [ --disable-ctypes Disable js-ctypes],
8221 AC_SUBST(BUILD_CTYPES)
8222 if test "$BUILD_CTYPES"; then
8223 AC_DEFINE(BUILD_CTYPES)
8226 dnl NECKO_ configuration options are not global
8227 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8229 dnl Build Places if required
8230 if test "$MOZ_PLACES"; then
8231 AC_DEFINE(MOZ_PLACES)
8234 dnl Build Apps in the Cloud (AITC) if required
8235 AC_SUBST(MOZ_SERVICES_AITC)
8236 if test -n "$MOZ_SERVICES_AITC"; then
8237 AC_DEFINE(MOZ_SERVICES_AITC)
8240 dnl Build Notifications if required
8241 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8242 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8243 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8246 dnl Build Sync Services if required
8247 AC_SUBST(MOZ_SERVICES_SYNC)
8248 if test -n "$MOZ_SERVICES_SYNC"; then
8249 AC_DEFINE(MOZ_SERVICES_SYNC)
8252 dnl ========================================================
8253 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8254 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8257 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8258 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8261 if test "$MOZ_APP_COMPONENT_MODULES"; then
8262 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8265 dnl ========================================================
8267 dnl = Maintainer debug option (no --enable equivalent)
8269 dnl ========================================================
8274 AC_SUBST(AR_EXTRACT)
8278 AC_SUBST(AS_DASH_C_FLAG)
8287 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8288 AC_SUBST(MOZ_UPDATE_XTERM)
8289 AC_SUBST(MOZ_PLATFORM_MAEMO)
8290 AC_SUBST(MOZ_AUTH_EXTENSION)
8291 AC_SUBST(MOZ_PERMISSIONS)
8293 AC_SUBST(MOZ_PREF_EXTENSIONS)
8294 AC_SUBST(MOZ_JS_LIBS)
8297 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8298 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8299 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8300 AC_SUBST(MOZ_DEBUG_FLAGS)
8301 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8302 AC_SUBST(WARNINGS_AS_ERRORS)
8303 AC_SUBST(MOZ_EXTENSIONS)
8304 AC_SUBST(MOZ_JSDEBUGGER)
8305 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8308 AC_SUBST(MOZ_CALLGRIND)
8311 AC_SUBST(MOZ_PROFILING)
8313 AC_SUBST(MOZ_PLACES)
8314 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8316 AC_SUBST(NS_PRINTING)
8318 AC_SUBST(MOZ_HELP_VIEWER)
8319 AC_SUBST(TOOLCHAIN_PREFIX)
8325 AC_SUBST(MOZ_PROFILELOCKING)
8327 AC_SUBST(ENABLE_TESTS)
8328 AC_SUBST(ENABLE_MARIONETTE)
8330 AC_SUBST(MOZ_UNIVERSALCHARDET)
8331 AC_SUBST(ACCESSIBILITY)
8332 AC_SUBST(MOZ_SPELLCHECK)
8333 AC_SUBST(MOZ_JAVA_COMPOSITOR)
8334 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8335 AC_SUBST(MOZ_CRASHREPORTER)
8336 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8337 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8338 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8339 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8340 AC_SUBST(MOZ_UPDATER)
8342 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8343 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8344 AC_SUBST(MOZ_D3DX9_VERSION)
8345 AC_SUBST(MOZ_D3DX9_CAB)
8346 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8347 AC_SUBST(MOZ_D3DX9_DLL)
8348 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8351 AC_SUBST(MOZ_ANDROID_HISTORY)
8352 AC_SUBST(MOZ_WEBSMS_BACKEND)
8353 AC_SUBST(ENABLE_STRIP)
8354 AC_SUBST(PKG_SKIP_STRIP)
8355 AC_SUBST(STRIP_FLAGS)
8356 AC_SUBST(USE_ELF_DYNSTR_GC)
8357 AC_SUBST(USE_ELF_HACK)
8358 AC_SUBST(INCREMENTAL_LINKER)
8359 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8360 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8362 AC_SUBST(MOZ_FIX_LINK_PATHS)
8363 AC_SUBST(XPCOM_LIBS)
8364 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8365 AC_SUBST(XPCOM_GLUE_LDOPTS)
8366 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8367 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8368 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8370 AC_SUBST(USE_DEPENDENT_LIBS)
8372 AC_SUBST(MOZ_BUILD_ROOT)
8373 AC_SUBST(MOZ_OS2_TOOLS)
8375 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8376 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8377 AC_SUBST(MOZ_LINKER_EXTRACT)
8379 dnl ========================================================
8380 dnl = Mac bundle name prefix
8381 dnl ========================================================
8382 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8383 [ --with-macbundlename-prefix=prefix
8384 Prefix for MOZ_MACBUNDLE_NAME],
8385 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8387 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8388 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8389 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8392 if test "$MOZ_DEBUG"; then
8393 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8395 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8397 AC_SUBST(MOZ_MACBUNDLE_NAME)
8399 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8400 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8401 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8402 if test "$MOZ_DEBUG"; then
8403 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8406 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8407 AC_SUBST(MOZ_MACBUNDLE_ID)
8409 # The following variables are available to branding and application
8410 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8411 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8412 # impacts profile location and user-visible fields.
8413 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8414 # versions of a given application (e.g. Aurora and Firefox both use
8415 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8416 # for application.ini's "Name" field, which controls profile location in
8417 # the absence of a "Profile" field (see below), and various system
8418 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8419 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8420 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8421 # builds (e.g. Aurora for Firefox).
8422 # - MOZ_APP_VERSION: Defines the application version number.
8423 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8424 # defaults to a lowercase form of MOZ_APP_BASENAME.
8425 # - MOZ_APP_PROFILE: When set, used for application.ini's
8426 # "Profile" field, which controls profile location.
8427 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8428 # crash reporter server url.
8429 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8430 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8432 if test -z "$MOZ_APP_NAME"; then
8433 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8436 # For extensions and langpacks, we require a max version that is compatible
8437 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8438 # 10.0a1 and 10.0a2 aren't affected
8439 # 10.0 becomes 10.0.*
8440 # 10.0.1 becomes 10.0.*
8441 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8442 if test -z "$IS_ALPHA"; then
8444 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8447 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8450 AC_SUBST(MOZ_APP_NAME)
8451 AC_SUBST(MOZ_APP_DISPLAYNAME)
8452 AC_SUBST(MOZ_APP_BASENAME)
8453 AC_SUBST(MOZ_APP_VENDOR)
8454 AC_SUBST(MOZ_APP_PROFILE)
8455 AC_SUBST(MOZ_APP_ID)
8456 AC_SUBST(MAR_CHANNEL_ID)
8457 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8458 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8459 AC_SUBST(MOZ_EXTENSION_MANAGER)
8460 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8461 AC_SUBST(MOZ_APP_UA_NAME)
8462 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8463 AC_SUBST(MOZ_APP_VERSION)
8464 AC_SUBST(MOZ_APP_MAXVERSION)
8465 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8466 AC_SUBST(FIREFOX_VERSION)
8468 # We can't use the static application.ini data when building against
8470 if test -n "$LIBXUL_SDK"; then
8473 AC_SUBST(MOZ_APP_STATIC_INI)
8475 AC_SUBST(MOZ_PKG_SPECIAL)
8477 AC_SUBST(MOZILLA_OFFICIAL)
8479 if test "$MOZ_TELEMETRY_REPORTING"; then
8480 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8484 AC_SUBST(MOZ_MAPINFO)
8485 AC_SUBST(MOZ_BROWSE_INFO)
8486 AC_SUBST(MOZ_TOOLS_DIR)
8487 AC_SUBST(WIN32_REDIST_DIR)
8490 dnl Echo the CFLAGS to remove extra whitespace.
8496 $_WARNINGS_CXXFLAGS \
8499 COMPILE_CFLAGS=`echo \
8504 COMPILE_CXXFLAGS=`echo \
8505 $_DEFINES_CXXFLAGS \
8509 AC_SUBST(MOZ_NATIVE_MAKEDEPEND)
8510 AC_SUBST(SYSTEM_LIBXUL)
8511 AC_SUBST(MOZ_NATIVE_JPEG)
8512 AC_SUBST(MOZ_NATIVE_PNG)
8513 AC_SUBST(MOZ_NATIVE_ZLIB)
8514 AC_SUBST(MOZ_NATIVE_BZ2)
8516 AC_SUBST(MOZ_FLEXBOX)
8517 AC_SUBST(MOZ_JPEG_CFLAGS)
8518 AC_SUBST(MOZ_JPEG_LIBS)
8519 AC_SUBST(MOZ_ZLIB_CFLAGS)
8520 AC_SUBST(MOZ_ZLIB_LIBS)
8521 AC_SUBST(MOZ_BZ2_CFLAGS)
8522 AC_SUBST(MOZ_BZ2_LIBS)
8523 AC_SUBST(MOZ_PNG_CFLAGS)
8524 AC_SUBST(MOZ_PNG_LIBS)
8526 AC_SUBST(NSPR_CFLAGS)
8528 AC_SUBST(MOZ_NATIVE_NSPR)
8530 AC_SUBST(NSS_CFLAGS)
8532 AC_SUBST(NSS_DEP_LIBS)
8533 AC_SUBST(MOZ_NATIVE_NSS)
8534 AC_SUBST(NSS_DISABLE_DBM)
8537 OS_CXXFLAGS="$CXXFLAGS"
8538 OS_CPPFLAGS="$CPPFLAGS"
8539 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8540 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8541 OS_LDFLAGS="$LDFLAGS"
8544 AC_SUBST(OS_CXXFLAGS)
8545 AC_SUBST(OS_CPPFLAGS)
8546 AC_SUBST(OS_COMPILE_CFLAGS)
8547 AC_SUBST(OS_COMPILE_CXXFLAGS)
8548 AC_SUBST(OS_LDFLAGS)
8550 AC_SUBST(CROSS_COMPILE)
8551 AC_SUBST(WCHAR_CFLAGS)
8555 AC_SUBST(HOST_CFLAGS)
8556 AC_SUBST(HOST_CXXFLAGS)
8557 AC_SUBST(HOST_LDFLAGS)
8558 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8560 AC_SUBST(HOST_AR_FLAGS)
8562 AC_SUBST(HOST_RANLIB)
8563 AC_SUBST(HOST_NSPR_MDCPUCFG)
8564 AC_SUBST(HOST_BIN_SUFFIX)
8565 AC_SUBST(HOST_OS_ARCH)
8567 AC_SUBST(TARGET_CPU)
8568 AC_SUBST(TARGET_VENDOR)
8570 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8571 AC_SUBST(TARGET_MD_ARCH)
8572 AC_SUBST(TARGET_XPCOM_ABI)
8575 AC_SUBST(OS_RELEASE)
8578 AC_SUBST(INTEL_ARCHITECTURE)
8580 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8582 AC_SUBST(WRAP_LDFLAGS)
8585 AC_SUBST(MKSHLIB_FORCE_ALL)
8586 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8587 AC_SUBST(DSO_CFLAGS)
8588 AC_SUBST(DSO_PIC_CFLAGS)
8589 AC_SUBST(DSO_LDOPTS)
8590 AC_SUBST(LIB_PREFIX)
8591 AC_SUBST(DLL_PREFIX)
8592 AC_SUBST(DLL_SUFFIX)
8593 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8594 AC_SUBST(LIB_SUFFIX)
8595 AC_SUBST(OBJ_SUFFIX)
8596 AC_SUBST(BIN_SUFFIX)
8597 AC_SUBST(ASM_SUFFIX)
8598 AC_SUBST(IMPORT_LIB_SUFFIX)
8600 AC_SUBST(CC_VERSION)
8601 AC_SUBST(CXX_VERSION)
8602 AC_SUBST(MSMANIFEST_TOOL)
8603 AC_SUBST(NS_ENABLE_TSF)
8604 AC_SUBST(MOZ_NSS_PATCH)
8605 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8606 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8609 AC_SUBST(MOZ_SYDNEYAUDIO)
8610 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8613 AC_SUBST(MOZ_VORBIS)
8614 AC_SUBST(MOZ_TREMOR)
8617 AC_SUBST(MOZ_MEDIA_PLUGINS)
8618 AC_SUBST(MOZ_OMX_PLUGIN)
8619 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8620 AC_SUBST(MOZ_VP8_ENCODER)
8623 AC_SUBST(MOZ_ALSA_LIBS)
8624 AC_SUBST(MOZ_ALSA_CFLAGS)
8626 AC_SUBST(VPX_ASFLAGS)
8627 AC_SUBST(VPX_DASH_C_FLAG)
8628 AC_SUBST(VPX_AS_CONVERSION)
8629 AC_SUBST(VPX_ASM_SUFFIX)
8630 AC_SUBST(VPX_X86_ASM)
8631 AC_SUBST(VPX_ARM_ASM)
8632 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8633 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8634 AC_SUBST(LIBJPEG_TURBO_AS)
8635 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8636 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8637 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8638 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8640 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8642 AC_MSG_CHECKING([for posix_fallocate])
8643 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8644 #include <fcntl.h>],
8645 [posix_fallocate(0, 0, 0);],
8646 [ac_cv___posix_fallocate=true],
8647 [ac_cv___posix_fallocate=false])
8649 if test "$ac_cv___posix_fallocate" = true ; then
8650 AC_DEFINE(HAVE_POSIX_FALLOCATE)
8656 dnl Check for missing components
8657 if test "$COMPILE_ENVIRONMENT"; then
8658 if test "$MOZ_X11"; then
8659 if test "$WITHOUT_X11"; then
8660 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8662 dnl ====================================================
8663 dnl = Check if X headers exist
8664 dnl ====================================================
8665 _SAVE_CFLAGS=$CFLAGS
8666 CFLAGS="$CFLAGS $XCFLAGS"
8670 #include <X11/Xlib.h>
8671 #include <X11/Intrinsic.h>
8672 #include <X11/extensions/XShm.h>
8676 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8677 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8681 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8682 CFLAGS="$_SAVE_CFLAGS"
8684 if test -n "$MISSING_X"; then
8685 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8690 dnl Check for headers, etc. needed by WebGL.
8691 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8692 MOZ_CHECK_HEADER(GL/glx.h)
8693 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8694 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))])
8696 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8697 fi # COMPILE_ENVIRONMENT
8699 dnl Set various defines and substitutions
8700 dnl ========================================================
8702 if test "$OS_ARCH" = "Darwin"; then
8704 AC_DEFINE(UNIX_ASYNC_DNS)
8705 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8707 AC_DEFINE(UNIX_ASYNC_DNS)
8710 if test "$MOZ_DEBUG"; then
8711 AC_DEFINE(MOZ_REFLOW_PERF)
8712 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8715 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8716 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8717 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8718 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8719 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8720 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8721 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8722 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8723 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8728 WIN_TOP_SRC=`cd $srcdir; pwd -W`
8732 AC_SUBST(WIN_TOP_SRC)
8734 AC_SUBST(MOZILLA_VERSION)
8736 AC_SUBST(ac_configure_args)
8738 dnl Spit out some output
8739 dnl ========================================================
8741 dnl The following defines are used by xpcom
8742 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8744 HAVE_CPP_2BYTE_WCHAR_T
8745 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8747 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8748 HAVE_CPP_PARTIAL_SPECIALIZATION
8749 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8751 NEED_CPP_UNUSED_IMPLEMENTATIONS
8755 HAVE_ICONV_WITH_CONST_INPUT
8763 netwerk/necko-config.h
8764 xpcom/xpcom-config.h
8765 xpcom/xpcom-private.h
8768 # Hack around an Apple bug that effects the egrep that comes with OS X 10.7.
8769 # "arch -arch i386 egrep" always uses the 32-bit Intel part of the egrep fat
8770 # binary, even on 64-bit systems. We (apparently) only need this hack when
8771 # egrep's "pattern" is particularly long (as in the following code).
8775 FIXED_EGREP="arch -arch i386 egrep"
8782 # Save the defines header file before autoconf removes it.
8783 # (Do not add AC_DEFINE calls after this line.)
8784 _CONFIG_TMP=confdefs-tmp.h
8785 _CONFIG_DEFS_H=mozilla-config.h
8787 cat > $_CONFIG_TMP <<\EOF
8788 /* List of defines generated by configure. Included with preprocessor flag,
8789 * -include, to avoid long list of -D defines on the compile command-line.
8793 #ifndef _MOZILLA_CONFIG_H_
8794 #define _MOZILLA_CONFIG_H_
8797 _EGREP_PATTERN='^#define ('
8798 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8799 for f in $_NON_GLOBAL_ACDEFINES; do
8800 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8803 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8805 sort confdefs.h | $FIXED_EGREP -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8807 if test "$?" != 0; then
8808 AC_MSG_ERROR([Error outputting config definitions])
8811 cat >> $_CONFIG_TMP <<\EOF
8813 /* The c99 defining the limit macros (UINT32_MAX for example), says:
8814 * C++ implementations should define these macros only when __STDC_LIMIT_MACROS
8815 * is defined before <stdint.h> is included. */
8816 #define __STDC_LIMIT_MACROS
8818 /* Force-include hunspell_alloc_hooks.h for hunspell, so that we don't need to
8819 * modify it directly.
8821 * HUNSPELL_STATIC is defined in extensions/spellcheck/hunspell/src/Makefile.in,
8822 * unless --enable-system-hunspell is defined.
8824 #if defined(HUNSPELL_STATIC)
8825 #include "hunspell_alloc_hooks.h"
8828 #endif /* _MOZILLA_CONFIG_H_ */
8832 # Only write mozilla-config.h when something changes (or it doesn't exist)
8833 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8836 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8837 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8839 echo ==== $_CONFIG_DEFS_H =================================
8843 dnl Probably shouldn't call this manually but we always want the output of DEFS
8844 rm -f confdefs.h.save
8845 mv confdefs.h confdefs.h.save
8846 $FIXED_EGREP -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8847 if test "$?" != 0; then
8848 AC_MSG_ERROR([Error outputting confdefs.h])
8850 AC_OUTPUT_MAKE_DEFS()
8854 mv confdefs.h.save confdefs.h
8856 dnl Create a virtualenv where we can install local Python packages
8857 AC_MSG_RESULT([Creating Python virtualenv])
8859 mkdir -p _virtualenv
8860 MACOSX_DEPLOYMENT_TARGET= PYTHONDONTWRITEBYTECODE= $PYTHON $_topsrcdir/other-licenses/virtualenv/virtualenv.py --system-site-packages ./_virtualenv
8863 PYTHON=$MOZ_BUILD_ROOT/_virtualenv/Scripts/python.exe
8866 PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python
8872 dnl Load the list of Makefiles to generate.
8873 dnl To add new Makefiles, edit allmakefiles.sh.
8874 dnl allmakefiles.sh sets the variable, MAKEFILES.
8875 . ${srcdir}/allmakefiles.sh
8877 dnl Run a perl script to quickly create the makefiles.
8878 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8879 dnl for the files it cannot handle correctly. This way, config.status
8880 dnl will handle these files.
8881 dnl If it fails, nothing is set and config.status will run as usual.
8883 dnl This does not change the $MAKEFILES variable.
8885 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8887 if test "$res" != 0; then
8893 echo $MAKEFILES > unallmakefiles
8895 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8897 AC_OUTPUT($MAKEFILES)
8899 # Generate Makefiles for WebRTC directly from .gyp files
8900 if test "${OS_TARGET}" = "WINNT"; then
8901 if test "$HAVE_64BIT_OS"; then
8906 EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
8909 if test -n "$MOZ_WEBRTC"; then
8910 AC_MSG_RESULT("generating WebRTC Makefiles...")
8912 GYP_WEBRTC_OPTIONS="--format=mozmake -D build_with_mozilla=1 -D enable_protobuf=0 -D include_internal_video_render=0 ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
8914 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8915 $GYP_WEBRTC_OPTIONS \
8916 --generator-output=${_objdir}/media/webrtc/trunk \
8917 ${srcdir}/media/webrtc/trunk/peerconnection.gyp
8918 if test "$?" != 0; then
8919 AC_MSG_ERROR([failed to generate WebRTC Makefiles])
8922 # XXX disable until we land the tranche with signaling
8923 if test -n "$MOZ_WEBRTC_SIGNALING"; then
8924 AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
8925 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8926 $GYP_WEBRTC_OPTIONS \
8927 --generator-output=${_objdir}/media/webrtc/signaling \
8928 ${srcdir}/media/webrtc/signaling/signaling.gyp
8929 if test "$?" != 0; then
8930 AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
8934 AC_MSG_RESULT("generating gtest Makefiles...")
8935 # Ok to pass some extra -D's that are ignored here
8936 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8937 $GYP_WEBRTC_OPTIONS \
8938 --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
8939 ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
8940 if test "$?" != 0; then
8941 AC_MSG_ERROR([failed to generate gtest Makefiles])
8945 # Populate the virtualenv
8946 AC_MSG_RESULT([Populating Python virtualenv])
8947 $MAKE -C build/virtualenv MACOSX_DEPLOYMENT_TARGET= || exit 1
8949 # Generate a JSON config file for unittest harnesses etc to read
8950 # build configuration details from in a standardized way.
8951 OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
8952 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
8953 $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
8954 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
8955 rm ./mozinfo.json.tmp
8957 mv -f ./mozinfo.json.tmp ./mozinfo.json
8960 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8961 if test "$CAIRO_FEATURES_H"; then
8962 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8963 echo "$CAIRO_FEATURES_H is unchanged"
8964 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8966 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8970 # Run jemalloc configure script
8972 if test "$MOZ_JEMALLOC" -a "$MOZ_MEMORY"; then
8973 ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
8974 if test "$OS_ARCH" = "Linux"; then
8975 MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
8978 if test -n "$_WRAP_MALLOC"; then
8979 JEMALLOC_WRAPPER=__wrap_
8981 for mangle in ${MANGLE}; do
8982 if test -n "$MANGLED"; then
8983 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
8985 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
8988 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
8991 if test -z "$MOZ_TLS"; then
8992 ac_configure_args="$ac_configure_args --disable-tls"
8994 EXTRA_CFLAGS="$CFLAGS"
8995 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
8996 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
8998 if test "$CROSS_COMPILE"; then
8999 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9001 _save_cache_file="$cache_file"
9002 cache_file=$_objdir/memory/jemalloc/src/config.cache
9003 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9004 cache_file="$_save_cache_file"
9005 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9008 dnl Build libunwind for Android profiling builds
9009 if test "$OS_TARGET" = "Android" -a "$MOZ_PROFILING"; then
9010 old_ac_configure_arg="$ac_configure_args"
9011 ac_configure_args="--build=${build} --host=${target_alias} --disable-shared --enable-block-signals=no"
9012 if test "$MOZ_DEBUG"; then
9013 ac_configure_args="$ac_configure_args --enable-debug"
9015 if test "$DSO_PIC_CFLAGS"; then
9016 ac_configure_args="$ac_configure_args --with-pic"
9018 ac_configure_args="$ac_configure_args \
9022 CFLAGS=\"$CFLAGS\" \
9023 CXXFLAGS=\"$CXXFLAGS\" \
9024 CPPFLAGS=\"$CPPFLAGS\" \
9026 LDFLAGS=\"$LDFLAGS\" \
9028 RANLIB=\"$RANLIB\" \
9032 # Use a separate cache file for libunwind, since it does not use caching.
9033 mkdir -p $_objdir/tools/profiler/libunwind/src
9034 old_cache_file=$cache_file
9035 cache_file=$_objdir/tools/profiler/libunwind/src/config.cache
9036 old_config_files=$CONFIG_FILES
9038 AC_OUTPUT_SUBDIRS(tools/profiler/libunwind/src)
9039 cache_file=$old_cache_file
9040 ac_configure_args="$old_ac_configure_args"
9041 CONFIG_FILES=$old_config_files
9044 # Run freetype configure script
9046 if test "$MOZ_TREE_FREETYPE"; then
9047 export CFLAGS="$CFLAGS -std=c99"
9048 export CPPFLAGS="$CPPFLAGS"
9049 export CXXFLAGS="$CXXFLAGS"
9050 export LDFLAGS="$LDFLAGS"
9051 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9052 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9053 AC_OUTPUT_SUBDIRS(modules/freetype2)
9056 if test -z "$direct_nspr_config"; then
9057 dnl ========================================================
9058 dnl = Setup a nice relatively clean build environment for
9059 dnl = sub-configures.
9060 dnl ========================================================
9063 CFLAGS="$_SUBDIR_CFLAGS"
9064 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9065 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9066 LDFLAGS="$_SUBDIR_LDFLAGS"
9067 HOST_CC="$_SUBDIR_HOST_CC"
9068 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9069 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9076 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9077 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9081 if test -n "$_WRAP_MALLOC"; then
9082 # Avoid doubling wrap malloc arguments
9083 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9086 if test -z "$MOZ_NATIVE_NSPR"; then
9087 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9088 if test -z "$MOZ_DEBUG"; then
9089 ac_configure_args="$ac_configure_args --disable-debug"
9091 ac_configure_args="$ac_configure_args --enable-debug"
9093 if test "$MOZ_OPTIMIZE" = "1"; then
9094 ac_configure_args="$ac_configure_args --enable-optimize"
9095 elif test -z "$MOZ_OPTIMIZE"; then
9096 ac_configure_args="$ac_configure_args --disable-optimize"
9098 if test -n "$HAVE_64BIT_OS"; then
9099 ac_configure_args="$ac_configure_args --enable-64bit"
9101 if test -n "$USE_ARM_KUSER"; then
9102 ac_configure_args="$ac_configure_args --with-arm-kuser"
9104 ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9105 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9106 # dladdr is supported by the new linker, even when the system linker doesn't
9107 # support it. Trick nspr into using dladdr when it's not supported.
9108 _SAVE_CPPFLAGS="$CPPFLAGS"
9109 export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9111 _SAVE_LDFLAGS="$LDFLAGS"
9112 export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9113 AC_OUTPUT_SUBDIRS(nsprpub)
9114 LDFLAGS="$_SAVE_LDFLAGS"
9115 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no; then
9117 CPPFLAGS="$_SAVE_CFLAGS"
9119 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9122 if test -z "$MOZ_NATIVE_NSPR"; then
9123 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9124 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9125 if test "$OS_ARCH" != "WINNT"; then
9126 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9127 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9128 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9129 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9131 rm -f config/autoconf.mk.bak
9134 dnl ========================================================
9135 dnl = Setup a nice relatively clean build environment for
9136 dnl = sub-configures.
9137 dnl ========================================================
9140 CFLAGS="$_SUBDIR_CFLAGS"
9141 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9142 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9143 LDFLAGS="$_SUBDIR_LDFLAGS"
9144 HOST_CC="$_SUBDIR_HOST_CC"
9145 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9146 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9149 # Run the SpiderMonkey 'configure' script.
9150 dist=$MOZ_BUILD_ROOT/dist
9151 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9152 ac_configure_args="$ac_configure_args --enable-threadsafe"
9153 if test "$BUILD_CTYPES"; then
9154 # Build js-ctypes on the platforms we can.
9155 ac_configure_args="$ac_configure_args --enable-ctypes"
9157 if test -z "$JS_SHARED_LIBRARY" ; then
9158 ac_configure_args="$ac_configure_args --disable-shared-js"
9160 if test -z "$MOZ_NATIVE_NSPR"; then
9161 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9162 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9164 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9165 ac_configure_args="$ac_configure_args --prefix=$dist"
9166 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9167 if test "$MOZ_MEMORY"; then
9168 ac_configure_args="$ac_configure_args --enable-jemalloc"
9170 if test -n "$MOZ_GLUE_LDFLAGS"; then
9171 export MOZ_GLUE_LDFLAGS
9173 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9174 export MOZ_GLUE_PROGRAM_LDFLAGS
9177 export STLPORT_CPPFLAGS
9178 export STLPORT_LDFLAGS
9180 AC_OUTPUT_SUBDIRS(js/src)
9181 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9183 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9185 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9186 dnl Needs to be at the end to respect possible changes from NSPR configure
9187 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9188 echo "config/autoconf.mk is unchanged"
9189 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9191 rm -f config/autoconf.mk.orig 2> /dev/null