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 ========================================================
60 dnl Set the minimum version of toolkit libs used by mozilla
61 dnl ========================================================
68 WINDRES_VERSION=2.14.90
74 STARTUP_NOTIFICATION_VERSION=0.8
81 dnl Set various checks
82 dnl ========================================================
86 dnl Initialize the Pthread test variables early so they can be
87 dnl overridden by each platform.
88 dnl ========================================================
92 dnl Do not allow a separate objdir build if a srcdir build exists.
93 dnl ==============================================================
94 _topsrcdir=`cd \`dirname $0\`; pwd`
97 if test "$_topsrcdir" != "$_objdir"
99 # Check for a couple representative files in the source tree
101 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
102 if test -f $file; then
103 _conflict_files="$_conflict_files $file"
106 if test "$_conflict_files"; then
108 echo "* Your source tree contains these files:"
109 for file in $_conflict_files; do
113 * This indicates that you previously built in the source tree.
114 * A source tree build can confuse the separate objdir build.
116 * To clean up the source tree:
129 COMPILE_ENVIRONMENT=1
130 MOZ_ARG_DISABLE_BOOL(compile-environment,
131 [ --disable-compile-environment
132 Disable compiler/library checks.],
133 COMPILE_ENVIRONMENT= )
134 AC_SUBST(COMPILE_ENVIRONMENT)
136 MOZ_ARG_WITH_STRING(l10n-base,
137 [ --with-l10n-base=DIR path to l10n repositories],
138 L10NBASEDIR=$withval)
139 if test -n "$L10NBASEDIR"; then
140 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
141 AC_MSG_ERROR([--with-l10n-base must specify a path])
142 elif test -d "$L10NBASEDIR"; then
143 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
145 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
148 AC_SUBST(L10NBASEDIR)
150 dnl Check for Perl first -- needed for win32 SDK checks
151 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
152 if test -z "$PERL" -o "$PERL" = ":"; then
153 AC_MSG_ERROR([perl not found in \$PATH])
156 MOZ_ARG_WITH_STRING(gonk,
158 location of gonk dir],
161 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
162 [ --with-gonk-toolchain-prefix=DIR
163 prefix to gonk toolchain commands],
164 gonk_toolchain_prefix=$withval)
166 if test -n "$gonkdir" ; then
167 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
168 android_source="$gonkdir"
169 ANDROID_SOURCE="$android_source"
170 ANDROID_NDK="${ANDROID_SOURCE}/ndk"
173 TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
174 AS="$gonk_toolchain_prefix"as
175 CC="$gonk_toolchain_prefix"gcc
176 CXX="$gonk_toolchain_prefix"g++
177 CPP="$gonk_toolchain_prefix"cpp
178 LD="$gonk_toolchain_prefix"ld
179 AR="$gonk_toolchain_prefix"ar
180 RANLIB="$gonk_toolchain_prefix"ranlib
181 STRIP="$gonk_toolchain_prefix"strip
183 STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/"
184 STLPORT_LIBS="-lstlport"
186 case "$target_cpu" in
195 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"
196 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
197 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS $STLPORT_CPPFLAGS"
198 LIBS="$LIBS $STLPORT_LIBS"
200 dnl Add -llog by default, since we use it all over the place.
201 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"
203 dnl prevent cross compile section from using these flags as host flags
204 if test -z "$HOST_CPPFLAGS" ; then
207 if test -z "$HOST_CFLAGS" ; then
210 if test -z "$HOST_CXXFLAGS" ; then
213 if test -z "$HOST_LDFLAGS" ; then
218 AC_DEFINE(HAVE_SYS_UIO_H)
219 AC_DEFINE(HAVE_PTHREADS)
221 MOZ_CHROME_FILE_FORMAT=omni
227 *-android*|*-linuxandroid*)
228 if test -z "$ANDROID_PACKAGE_NAME" ; then
229 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
231 MOZ_CHROME_FILE_FORMAT=omni
235 AC_PATH_PROG(OBJCOPY,objcopy)
240 AC_SUBST(ANDROID_SOURCE)
241 AC_SUBST(ANDROID_PACKAGE_NAME)
244 dnl ========================================================
245 dnl Checks for compilers.
246 dnl ========================================================
247 dnl Set CROSS_COMPILE in the environment when running configure
248 dnl to use the cross-compile setup for now
249 dnl ========================================================
251 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
254 if test "$COMPILE_ENVIRONMENT"; then
256 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
257 echo "cross compiling from $host to $target"
261 _SAVE_CFLAGS="$CFLAGS"
262 _SAVE_LDFLAGS="$LDFLAGS"
264 AC_MSG_CHECKING([for host c compiler])
265 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
266 if test -z "$HOST_CC"; then
267 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
269 AC_MSG_RESULT([$HOST_CC])
270 AC_MSG_CHECKING([for host c++ compiler])
271 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
272 if test -z "$HOST_CXX"; then
273 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
275 AC_MSG_RESULT([$HOST_CXX])
277 if test -z "$HOST_CFLAGS"; then
278 HOST_CFLAGS="$CFLAGS"
280 if test -z "$HOST_CXXFLAGS"; then
281 HOST_CXXFLAGS="$CXXFLAGS"
283 if test -z "$HOST_LDFLAGS"; then
284 HOST_LDFLAGS="$LDFLAGS"
286 if test -z "$HOST_AR_FLAGS"; then
287 HOST_AR_FLAGS="$AR_FLAGS"
289 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
290 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
292 CFLAGS="$HOST_CFLAGS"
293 LDFLAGS="$HOST_LDFLAGS"
295 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
296 AC_TRY_COMPILE([], [return(0);],
297 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
298 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
301 CFLAGS="$HOST_CXXFLAGS"
303 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
304 AC_TRY_COMPILE([], [return(0);],
305 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
306 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
310 LDFLAGS=$_SAVE_LDFLAGS
312 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
315 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
319 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
320 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
321 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
322 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
323 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
324 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
325 AC_DEFINE(CROSS_COMPILE)
330 # Work around the conftest.exe access problem on Windows
335 MOZ_PATH_PROGS(AS, $AS as, $CC)
336 AC_CHECK_PROGS(AR, ar, :)
337 AC_CHECK_PROGS(LD, ld, :)
338 AC_CHECK_PROGS(STRIP, strip, :)
339 AC_CHECK_PROGS(WINDRES, windres, :)
340 if test -z "$HOST_CC"; then
343 if test -z "$HOST_CFLAGS"; then
344 HOST_CFLAGS='$(CFLAGS)'
346 if test -z "$HOST_CXX"; then
349 if test -z "$HOST_CXXFLAGS"; then
350 HOST_CXXFLAGS='$(CXXFLAGS)'
352 if test -z "$HOST_LDFLAGS"; then
353 HOST_LDFLAGS='$(LDFLAGS)'
355 if test -z "$HOST_RANLIB"; then
356 HOST_RANLIB='$(RANLIB)'
358 if test -z "$HOST_AR"; then
361 if test -z "$HOST_AR_FLAGS"; then
362 HOST_AR_FLAGS='$(AR_FLAGS)'
372 if test "$GCC" = "yes"; then
374 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
376 if test "$GXX" = "yes"; then
378 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
380 if test "`echo | $AS -o conftest.out -v 2>&1 | grep -c GNU`" != "0"; then
384 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
387 if test "$GNU_CC"; then
388 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
395 if test "$GCC" = yes; then
396 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
401 if test "$GXX" = yes; then
402 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
409 if test "$GCC" = yes; then
410 if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
415 if test "$GXX" = yes; then
416 if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
421 dnl ========================================================
422 dnl Special win32 checks
423 dnl ========================================================
425 # With win8, sdk target=602, WINVER=602
426 MOZ_ARG_ENABLE_BOOL(metro,
427 [ --enable-metro Enable Windows Metro build targets],
430 if test -n "$MOZ_METRO"; then
432 # Target the Windows 8 Kit
434 # Allow a higher api set
436 # toolkit/library/makefile.in needs these, see nsDllMain.
438 CRTEXPDLLVERSION=1-1-0
440 # Target the Windows 7 SDK by default
445 AC_SUBST(CRTDLLVERSION)
446 AC_SUBST(CRTEXPDLLVERSION)
448 if test -n "$MOZ_METRO"; then
453 AC_MSG_ERROR([Metro builds only valid on the windows platform.]);
458 MOZ_ARG_WITH_STRING(windows-version,
459 [ --with-windows-version=WINSDK_TARGETVER
460 Windows SDK version to target. Lowest version
461 currently allowed is 601 (Win7), highest is 602 (Win8)],
462 WINSDK_TARGETVER=$withval)
464 # Currently only two sdk versions allowed, 601 and 602
465 case "$WINSDK_TARGETVER" in
467 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
471 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
477 if test "$GCC" != "yes"; then
478 # Check to see if we are really running in a msvc environemnt
480 AC_CHECK_PROGS(MIDL, midl)
482 # Make sure compilers are valid
483 CFLAGS="$CFLAGS -TC -nologo"
484 CXXFLAGS="$CXXFLAGS -TP -nologo"
487 AC_TRY_COMPILE([#include <stdio.h>],
488 [ printf("Hello World\n"); ],,
489 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
492 AC_TRY_COMPILE([#include <new.h>],
493 [ unsigned *test = new unsigned(42); ],,
494 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
498 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
501 # Determine compiler version
502 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
503 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
504 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
505 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
506 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
507 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
509 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
510 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
512 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
513 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
516 if test "$_CC_MAJOR_VERSION" = "14"; then
517 dnl Require VC8SP1 or newer.
518 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
519 if test "$_CC_RELEASE" -lt 50727 -o \
520 \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
521 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.])
526 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
527 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
528 elif test "$_CC_MAJOR_VERSION" = "15"; then
531 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
532 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
533 elif test "$_CC_MAJOR_VERSION" = "16"; then
536 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
537 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
538 elif test "$_CC_MAJOR_VERSION" = "17"; then
541 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
542 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
544 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
547 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
549 if test -n "$WIN32_REDIST_DIR"; then
550 if test ! -d "$WIN32_REDIST_DIR"; then
551 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
553 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
556 dnl Confirm we have the pri tools on win8 builds
557 if test -n "$MOZ_METRO"; then
558 AC_MSG_CHECKING([for makepri])
559 AC_CHECK_PROGS(MAKEPRI, makepri, "")
560 if test -z "MAKEPRI" ; then
561 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
566 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
567 dnl not something else like "magnetic tape manipulation utility".
568 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
569 if test -z "$MSMT_TOOL"; then
570 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
574 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
576 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
577 if test -z "$MSMANIFEST_TOOL_VERSION"; then
578 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
584 # Check linker version
585 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
586 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
587 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
588 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
594 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
595 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
596 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
597 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
598 # Add flags if necessary
599 AC_MSG_CHECKING([for midl flags])
602 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
603 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
604 # MIDL version 7.00.0500 or later has no problem.
605 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
606 AC_MSG_RESULT([need -env win32])
608 AC_MSG_RESULT([none needed])
612 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
615 AC_MSG_RESULT([none needed])
619 # Identify which version of the SDK we're building with
620 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
622 MOZ_CHECK_HEADERS([winsdkver.h])
623 if test "$ac_cv_header_winsdkver_h" = "yes"; then
624 # Get the highest _WIN32_WINNT and NTDDI versions supported
625 # Take the higher of the two
626 # This is done because the Windows 7 beta SDK reports its
627 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
628 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
630 [cat > conftest.h <<EOF
631 #include <winsdkver.h>
632 #include <sdkddkver.h>
634 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
635 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
637 #define WINSDK_MAXVER NTDDI_MAXVER
642 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
645 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
647 # Any SDK which doesn't have WinSDKVer.h is too old.
648 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.])
651 unset _MSVC_VER_FILTER
653 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
657 _SAVE_CXXFLAGS="$CXXFLAGS"
658 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
659 AC_TRY_COMPILE([#include <exception>],
660 [std::_Throw(std::exception()); return 0;],
661 ac_cv_have_std__Throw="yes",
662 ac_cv_have_std__Throw="no")
663 CXXFLAGS="$_SAVE_CXXFLAGS"
667 if test "$ac_cv_have_std__Throw" = "yes"; then
668 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
669 ac_cv_have_dllimport_exception_bug,
673 _SAVE_CXXFLAGS="$CXXFLAGS"
674 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
675 AC_TRY_LINK([#include <vector>],
676 [std::vector<int> v; return v.at(1);],
677 ac_cv_have_dllimport_exception_bug="no",
678 ac_cv_have_dllimport_exception_bug="yes")
679 CXXFLAGS="$_SAVE_CXXFLAGS"
682 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
684 MOZ_MSVC_STL_WRAP__Throw=1
685 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
688 AC_CACHE_CHECK(for overridable _RAISE,
693 _SAVE_CXXFLAGS="$CXXFLAGS"
694 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
695 AC_TRY_COMPILE([#include <xstddef>
697 #define _RAISE(x) externallyDefinedFunction((x).what())
700 [std::vector<int> v; return v.at(1);],
701 ac_cv_have__RAISE="no",
702 ac_cv_have__RAISE="yes")
703 CXXFLAGS="$_SAVE_CXXFLAGS"
706 if test "$ac_cv_have__RAISE" = "yes"; then
708 MOZ_MSVC_STL_WRAP__RAISE=1
709 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
711 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
715 if test "$WRAP_STL_INCLUDES" = "1"; then
716 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
719 # Check w32api version
720 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
721 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
722 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
723 AC_TRY_COMPILE([#include <w32api.h>],
724 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
725 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
726 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
727 #error "test failed."
729 , [ res=yes ], [ res=no ])
730 AC_MSG_RESULT([$res])
731 if test "$res" != "yes"; then
732 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
734 # Check windres version
735 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
736 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
737 AC_MSG_RESULT([$_WINDRES_VERSION])
738 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
739 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
740 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
741 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
742 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
743 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
744 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
745 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
746 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
747 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
748 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
749 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
751 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
754 MOZ_WINSDK_MAXVER=0x06020000
757 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
758 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
759 # Require OS features provided by IE 6.0 SP2 (XP SP2)
760 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
762 # If the maximum version supported by this SDK is lower than the target
764 AC_MSG_CHECKING([for Windows SDK being recent enough])
765 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
769 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.])
772 # Make sure the sdk / code we're targeting has the right toolset
773 AC_MSG_CHECKING([SDK and tools are in sync])
774 if test -n "$MOZ_METRO"; then
775 if test "$MOZ_MSVCVERSION" -gt "10"; then
779 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.])
783 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
784 # Definitions matching sdkddkver.h
785 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
792 if test -n "$_WIN32_MSVC"; then
794 SKIP_COMPILER_CHECKS=1
795 SKIP_LIBRARY_CHECKS=1
797 # Since we're skipping compiler and library checks, hard-code
800 AC_DEFINE(HAVE_SETBUF)
801 AC_DEFINE(HAVE_ISATTY)
804 fi # COMPILE_ENVIRONMENT
817 AC_SUBST(WRAP_STL_INCLUDES)
818 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
819 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
821 dnl ========================================================
822 dnl Checks for programs.
823 dnl ========================================================
827 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
828 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
829 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
831 AC_MSG_RESULT([$_perl_version])
833 if test "$_perl_res" != 0; then
834 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
838 AC_MSG_CHECKING([for full perl installation])
839 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
841 if test "$_perl_res" != 0; then
843 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
848 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
849 if test -z "$PYTHON"; then
850 AC_MSG_ERROR([python was not found in \$PATH])
853 MOZ_ARG_WITH_BOOL(system-ply,
854 [ --with-system-ply Use system installed python ply library],
855 [if $PYTHON -c 'import ply' 2>&5; then
858 AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
861 AC_SUBST(MOZ_SYSTEM_PLY)
863 if test -z "$COMPILE_ENVIRONMENT"; then
864 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
866 AC_SUBST(NSINSTALL_BIN)
868 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
869 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
870 MOZ_PATH_PROGS(UNZIP, unzip)
871 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
872 AC_MSG_ERROR([unzip not found in \$PATH])
874 MOZ_PATH_PROGS(ZIP, zip)
875 if test -z "$ZIP" -o "$ZIP" = ":"; then
876 AC_MSG_ERROR([zip not found in \$PATH])
878 MOZ_PATH_PROG(MOZ_NATIVE_MAKEDEPEND, makedepend)
879 MOZ_PATH_PROG(XARGS, xargs)
880 if test -z "$XARGS" -o "$XARGS" = ":"; then
881 AC_MSG_ERROR([xargs not found in \$PATH .])
884 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
887 if test "$COMPILE_ENVIRONMENT"; then
889 dnl ========================================================
890 dnl = Mac OS X toolchain support
891 dnl ========================================================
895 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
896 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
897 dnl the environment and includedir purposes (when using an SDK, below),
898 dnl but remember the full version number for the libdir (SDK).
900 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
901 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
903 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
904 dnl Bug 280479, but this keeps popping up in bug 292530 too because
905 dnl 4.0.0/4061 is the default compiler in Tiger.
907 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
909 if test "$GCC_BUILD" = "4061" ; then
910 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
911 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
912 from building Mozilla. Upgrade to Xcode 2.1 or later.])
916 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
917 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
918 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
919 MOZ_PATH_PROGS(PBBUILD_BIN, pbbuild xcodebuild pbxbuild)
921 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
922 dnl it has moved into /usr/bin.
923 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
927 AC_SUBST(GCC_VERSION)
929 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
930 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
931 dnl when we can run target binaries.
932 AC_SUBST(UNIVERSAL_BINARY)
933 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
935 dnl ========================================================
936 dnl Check for MacOS deployment target version
937 dnl ========================================================
939 MOZ_ARG_ENABLE_STRING(macos-target,
940 [ --enable-macos-target=VER (default=10.5)
941 Set the minimum MacOS version needed at runtime],
942 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
946 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
947 dnl Use the specified value
948 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
950 dnl No value specified on the command line or in the environment,
951 dnl use architecture minimum.
952 case "${target_cpu}" in
954 export MACOSX_DEPLOYMENT_TARGET=10.5
957 export MACOSX_DEPLOYMENT_TARGET=10.6
964 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
966 dnl ========================================================
967 dnl = Mac OS X SDK support
968 dnl ========================================================
971 MOZ_ARG_WITH_STRING(macos-sdk,
972 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
973 MACOS_SDK_DIR=$withval)
975 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
976 dnl NEXT_ROOT will be set and exported only if it's needed.
977 AC_SUBST(MACOS_SDK_DIR)
980 if test "$MACOS_SDK_DIR"; then
981 dnl Sync this section with the ones in NSPR and NSS.
982 dnl Changes to the cross environment here need to be accounted for in
983 dnl the libIDL checks (below) and xpidl build.
985 if test ! -d "$MACOS_SDK_DIR"; then
986 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
987 specify a valid SDK. SDKs are installed when the optional cross-development
988 tools are selected during the Xcode/Developer Tools installation.])
991 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
992 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
993 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
995 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
996 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
998 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
999 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1000 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1002 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1003 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1004 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
1005 dnl be ignored and cause warnings when -syslibroot is specified.
1006 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1007 dnl the -isysroot it receives, so this is only needed with 4.0.0.
1008 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1013 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1015 AC_TRY_COMPILE([#include <new>],[],
1019 AC_MSG_RESULT($result)
1021 if test "$result" = "no" ; then
1022 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1026 fi # COMPILE_ENVIRONMENT
1028 AC_MSG_CHECKING([compiler version])
1029 # Just print it so it shows up in the logs.
1030 cc_version=$($CC --version)
1031 AC_MSG_RESULT([$cc_version])
1033 if test -n "$MAKE"; then
1034 if test `echo $MAKE | grep -c make.py` != 1; then
1041 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1044 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1047 if test "$GMAKE" = ":"; then
1048 AC_MSG_ERROR([GNU make not found])
1052 if test -z "$MAKE"; then
1056 if test "$COMPILE_ENVIRONMENT"; then
1062 fi # COMPILE_ENVIRONMENT
1064 dnl ========================================================
1065 dnl set the defaults first
1066 dnl ========================================================
1069 AR_EXTRACT='$(AR) x'
1083 MOZ_USER_DIR=".mozilla"
1086 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
1088 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1090 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
1092 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1093 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1094 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1095 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1096 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1097 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1098 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1099 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1101 # These are specially defined on Windows only
1104 XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1105 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
1108 XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
1109 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
1115 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1117 USE_DEPENDENT_LIBS=1
1119 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1121 if test -n "$CROSS_COMPILE"; then
1122 OS_TARGET="${target_os}"
1123 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1125 case "${target_os}" in
1126 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1127 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1128 gnu*) OS_ARCH=GNU ;;
1129 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1130 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
1131 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1134 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1137 OS_TARGET=`uname -s`
1138 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1139 OS_RELEASE=`uname -r`
1142 # Before this used `uname -m` when not cross compiling
1143 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1144 OS_TEST="${target_cpu}"
1146 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1148 #######################################################################
1149 # Master "Core Components" macros for getting the OS target #
1150 #######################################################################
1153 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1154 # cross-compilation.
1158 # Define and override various archtecture-specific variables, including
1167 case "$HOST_OS_ARCH" in
1181 if test -z "$GNU_CC"; then
1182 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1187 if test -z "$GNU_CXX"; then
1188 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1189 SOLARIS_SUNPRO_CXX=1
1192 AC_SUBST(SOLARIS_SUNPRO_CC)
1193 AC_SUBST(SOLARIS_SUNPRO_CXX)
1205 if test -z "$CROSS_COMPILE" ; then
1211 # If uname -s returns "Windows_NT", we assume that we are using
1212 # the uname.exe in MKS toolkit.
1214 # The -r option of MKS uname only returns the major version number.
1215 # So we need to use its -v option to get the minor version number.
1216 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1220 OS_MINOR_RELEASE=`uname -v`
1221 if test "$OS_MINOR_RELEASE" = "00"; then
1224 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1228 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1229 # the uname.exe in the MSYS tools.
1231 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1236 OS_RELEASE=`uname -v`.`uname -r`
1237 OS_TEST=${target_cpu}
1245 OS_RELEASE=`uname -v`
1248 case "${target_cpu}" in
1259 if test -z "$CROSS_COMPILE" ; then
1267 # Only set CPU_ARCH if we recognize the value of OS_TEST
1278 powerpc | ppc | rs6000)
1282 Alpha | alpha | ALPHA)
1315 if test -z "$OS_TARGET"; then
1318 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1320 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1321 dnl ===============================================================
1325 INTEL_ARCHITECTURE=1
1328 dnl Configure platform-specific CPU architecture compiler options.
1329 dnl ==============================================================
1332 dnl =================================================================
1333 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1334 dnl which is bad when cross compiling.
1335 dnl =================================================================
1336 if test "$COMPILE_ENVIRONMENT"; then
1337 configure_static_assert_macros='
1338 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1339 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1340 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1343 dnl test that the macros actually work:
1344 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1345 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1348 ac_cv_static_assertion_macros_work="yes"
1349 AC_TRY_COMPILE([$configure_static_assert_macros],
1350 [CONFIGURE_STATIC_ASSERT(1)],
1352 ac_cv_static_assertion_macros_work="no")
1353 AC_TRY_COMPILE([$configure_static_assert_macros],
1354 [CONFIGURE_STATIC_ASSERT(0)],
1355 ac_cv_static_assertion_macros_work="no",
1358 AC_TRY_COMPILE([$configure_static_assert_macros],
1359 [CONFIGURE_STATIC_ASSERT(1)],
1361 ac_cv_static_assertion_macros_work="no")
1362 AC_TRY_COMPILE([$configure_static_assert_macros],
1363 [CONFIGURE_STATIC_ASSERT(0)],
1364 ac_cv_static_assertion_macros_work="no",
1368 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1369 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1370 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1372 fi # COMPILE_ENVIRONMENT
1374 dnl ========================================================
1375 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1377 dnl ========================================================
1381 dnl ========================================================
1382 dnl Suppress Clang Argument Warnings
1383 dnl ========================================================
1384 if test -n "$CLANG_CC"; then
1385 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1386 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1388 if test -n "$CLANG_CXX"; then
1389 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1392 dnl ========================================================
1393 dnl = Use Address Sanitizer
1394 dnl ========================================================
1395 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1396 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1399 if test -n "$MOZ_ASAN"; then
1405 dnl ========================================================
1406 dnl = Enable hacks required for LLVM instrumentations
1407 dnl ========================================================
1408 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1409 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1412 if test -n "$MOZ_LLVM_HACKS"; then
1416 AC_SUBST(MOZ_NO_WLZDEFS)
1417 AC_SUBST(MOZ_CFLAGS_NSS)
1419 dnl ========================================================
1420 dnl GNU specific defaults
1421 dnl ========================================================
1422 if test "$GNU_CC"; then
1423 # FIXME: Let us build with strict aliasing. bug 414641.
1424 CFLAGS="$CFLAGS -fno-strict-aliasing"
1425 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1426 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1427 DSO_LDOPTS='-shared'
1428 if test "$GCC_USE_GNU_LD"; then
1429 # Some tools like ASan use a runtime library that is only
1430 # linked against executables, so we must allow undefined
1431 # symbols for shared objects in some cases.
1432 if test -z "$MOZ_NO_WLZDEFS"; then
1433 # Don't allow undefined symbols in libraries
1434 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1437 WARNINGS_AS_ERRORS='-Werror -Wno-error=uninitialized'
1439 DSO_PIC_CFLAGS='-fPIC'
1440 ASFLAGS="$ASFLAGS -fPIC"
1441 AC_MSG_CHECKING([for --noexecstack option to as])
1442 _SAVE_CFLAGS=$CFLAGS
1443 CFLAGS="$CFLAGS -Wa,--noexecstack"
1444 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1445 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1446 AC_MSG_RESULT([no]))
1447 CFLAGS=$_SAVE_CFLAGS
1448 AC_MSG_CHECKING([for -z noexecstack option to ld])
1449 _SAVE_LDFLAGS=$LDFLAGS
1450 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1451 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1453 LDFLAGS=$_SAVE_LDFLAGS)
1455 # Check for -mssse3 on $CC
1456 AC_MSG_CHECKING([for -mssse3 option to $CC])
1457 HAVE_COMPILER_FLAG_MSSSE3=
1458 _SAVE_CFLAGS=$CFLAGS
1459 CFLAGS="$CFLAGS -mssse3"
1460 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1461 [HAVE_COMPILER_FLAG_MSSSE3=1],
1462 AC_MSG_RESULT([no]))
1463 CFLAGS=$_SAVE_CFLAGS
1464 AC_SUBST(HAVE_COMPILER_FLAG_MSSSE3)
1466 # Turn on GNU-specific warnings:
1467 # -Wall - turn on a lot of warnings
1468 # -pedantic - this is turned on below
1469 # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1470 # -Wdeclaration-after-statement - MSVC doesn't like these
1471 # -Werror=return-type - catches missing returns, zero false positives
1472 # -Wtype-limits - catches overflow bugs, few false positives
1473 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1475 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1476 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1477 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1478 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1480 # Turn off the following warnings that -Wall/-pedantic turn on:
1481 # -Wno-unused - lots of violations in third-party code
1482 # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1484 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1485 MOZ_C_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_c_has_wno_overlength_strings)
1487 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1488 # Don't use -Wcast-align with ICC or clang
1490 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1491 hppa | ia64 | sparc | arm)
1494 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1499 dnl Turn pedantic on but disable the warnings for long long
1502 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1503 _USE_CPP_INCLUDE_FLAG=1
1505 elif test "$SOLARIS_SUNPRO_CC"; then
1507 if test "$CPU_ARCH" = "sparc"; then
1508 # for Sun Studio on Solaris/SPARC
1509 DSO_PIC_CFLAGS='-xcode=pic32'
1511 DSO_PIC_CFLAGS='-KPIC'
1513 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1515 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1516 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1518 DSO_LDOPTS='-shared'
1519 if test "$GNU_LD"; then
1520 # Don't allow undefined symbols in libraries
1521 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1525 DSO_PIC_CFLAGS='-KPIC'
1526 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1529 if test "$GNU_CXX"; then
1530 # FIXME: Let us build with strict aliasing. bug 414641.
1531 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1533 # Turn on GNU-specific warnings:
1534 # -Wall - turn on a lot of warnings
1535 # -pedantic - this is turned on below
1536 # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1537 # -Woverloaded-virtual - ???
1538 # -Werror=return-type - catches missing returns, zero false positives
1539 # -Wtype-limits - catches overflow bugs, few false positives
1540 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1542 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1543 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1544 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1545 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1547 # Turn off the following warnings that -Wall/-pedantic turn on:
1548 # -Wno-ctor-dtor-privacy - ???
1549 # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1550 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1551 # -Wno-variadic-macros - ???
1553 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-ctor-dtor-privacy"
1554 MOZ_CXX_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_cxx_has_wno_overlength_strings)
1555 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1556 MOZ_CXX_SUPPORTS_WARNING(-Wno-, variadic-macros, ac_cxx_has_wno_variadic_macros)
1558 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1559 # Don't use -Wcast-align with ICC or clang
1561 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1562 hppa | ia64 | sparc | arm)
1565 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1570 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1571 _USE_CPP_INCLUDE_FLAG=1
1573 # Recent clang and gcc support C++11 deleted functions without warnings if
1574 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1575 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1576 # unused. But clang's warning can be disabled, so when compiling with clang
1577 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1578 # deleted function syntax.
1579 if test "$CLANG_CXX"; then
1580 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1581 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1585 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1588 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1589 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1590 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1591 dnl normal behavior.
1592 dnl ========================================================
1594 MKSHLIB_UNFORCE_ALL=
1596 if test "$COMPILE_ENVIRONMENT"; then
1597 if test "$GNU_CC"; then
1598 AC_MSG_CHECKING(whether ld has archive extraction flags)
1599 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1600 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1601 ac_cv_mkshlib_force_and_unforce="no"
1602 exec 3<&0 <<LOOP_INPUT
1603 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1604 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1605 force="-Wl,-all"; unforce="-Wl,-none"
1612 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1615 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1617 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1621 eval $ac_cv_mkshlib_force_and_unforce
1622 MKSHLIB_FORCE_ALL=$force
1623 MKSHLIB_UNFORCE_ALL=$unforce
1626 fi # COMPILE_ENVIRONMENT
1628 dnl ========================================================
1629 dnl Checking for 64-bit OS
1630 dnl ========================================================
1631 if test "$COMPILE_ENVIRONMENT"; then
1634 AC_MSG_CHECKING(for 64-bit OS)
1635 AC_TRY_COMPILE([$configure_static_assert_macros],
1636 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1637 result="yes", result="no")
1638 AC_MSG_RESULT("$result")
1639 if test "$result" = "yes"; then
1640 AC_DEFINE(HAVE_64BIT_OS)
1643 AC_SUBST(HAVE_64BIT_OS)
1645 fi # COMPILE_ENVIRONMENT
1647 dnl ========================================================
1648 dnl Enable high-memory support on OS/2 by default.
1649 dnl ========================================================
1650 MOZ_OS2_HIGH_MEMORY=1
1651 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1652 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1653 MOZ_OS2_HIGH_MEMORY=,
1654 MOZ_OS2_HIGH_MEMORY=1 )
1655 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1657 dnl ========================================================
1658 dnl = Use profiling compile flags
1659 dnl ========================================================
1660 MOZ_ARG_ENABLE_BOOL(profiling,
1661 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1665 # For profiling builds keep the symbol information
1666 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1667 STRIP_FLAGS="--strip-debug"
1670 dnl ========================================================
1672 dnl ========================================================
1673 MOZ_ARG_ENABLE_BOOL(valgrind,
1674 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1677 if test -n "$MOZ_VALGRIND"; then
1678 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1680 [--enable-valgrind specified but Valgrind is not installed]))
1681 AC_DEFINE(MOZ_VALGRIND)
1683 AC_SUBST(MOZ_VALGRIND)
1685 dnl ========================================================
1687 dnl ========================================================
1688 MOZ_ARG_ENABLE_BOOL(dmd,
1689 [ --enable-dmd Enable DMD; also disables jemalloc (default=no)],
1692 if test -n "$MOZ_DMD"; then
1693 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1695 [--enable-dmd specified but Valgrind is not installed]))
1699 dnl ========================================================
1701 dnl ========================================================
1702 MOZ_ARG_ENABLE_BOOL(jprof,
1703 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1706 if test -n "$MOZ_JPROF"; then
1708 AC_DEFINE(MOZ_JPROF)
1711 dnl ========================================================
1713 dnl ========================================================
1714 MOZ_ENABLE_PROFILER_SPS=1
1716 case "${OS_TARGET}" in
1718 case "${CPU_ARCH}" in
1721 MOZ_ENABLE_PROFILER_SPS=
1725 case "${CPU_ARCH}" in
1728 MOZ_ENABLE_PROFILER_SPS=
1733 MOZ_ENABLE_PROFILER_SPS=
1737 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1738 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1741 dnl ========================================================
1743 dnl ========================================================
1744 MOZ_ARG_ENABLE_BOOL(shark,
1745 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1748 if test -n "$MOZ_SHARK"; then
1750 AC_DEFINE(MOZ_SHARK)
1753 dnl ========================================================
1755 dnl ========================================================
1756 MOZ_ARG_ENABLE_BOOL(callgrind,
1757 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1760 if test -n "$MOZ_CALLGRIND"; then
1762 AC_DEFINE(MOZ_CALLGRIND)
1765 dnl ========================================================
1767 dnl ========================================================
1768 MOZ_ARG_ENABLE_BOOL(vtune,
1769 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1772 if test -n "$MOZ_VTUNE"; then
1774 AC_DEFINE(MOZ_VTUNE)
1777 dnl ========================================================
1779 dnl ========================================================
1780 if test -n "$MOZ_PROFILING"; then
1781 AC_DEFINE(MOZ_PROFILING)
1784 dnl ========================================================
1785 dnl System overrides of the defaults for host
1786 dnl ========================================================
1789 if test -n "$_WIN32_MSVC"; then
1791 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1792 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1793 HOST_RANLIB='echo ranlib'
1795 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1797 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1798 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1799 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1800 HOST_BIN_SUFFIX=.exe
1803 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1807 case "${host_cpu}" in
1809 if test -n "$_WIN32_MSVC"; then
1810 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1814 if test -n "$_WIN32_MSVC"; then
1815 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1817 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1823 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1824 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1825 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1828 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1829 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1830 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1831 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1835 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1836 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1837 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1838 HOST_BIN_SUFFIX=.exe
1843 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1844 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1848 dnl We require version 2.5 or newer of Python to build.
1849 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
1851 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
1854 if test "$_python_res" != 0; then
1855 AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
1857 AC_MSG_RESULT([yes])
1859 dnl Check for using a custom <stdint.h> implementation
1860 dnl ========================================================
1861 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1862 if test "$MOZ_CUSTOM_STDINT_H"; then
1863 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1864 AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1866 AC_MSG_RESULT(none specified)
1869 dnl Get mozilla version from central milestone file
1870 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1871 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1873 dnl Get version of various core apps from the version files.
1874 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1876 if test -z "$FIREFOX_VERSION"; then
1877 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1880 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1881 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1882 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1884 MOZ_DOING_LTO(lto_is_enabled)
1886 dnl ========================================================
1887 dnl System overrides of the defaults for target
1888 dnl ========================================================
1893 if test ! "$GNU_CC"; then
1894 if test ! "$HAVE_64BIT_OS"; then
1895 # Compiling with Visual Age C++ object model compat is the
1896 # default. To compile with object model ibm, add
1897 # AIX_OBJMODEL=ibm to .mozconfig.
1898 if test "$AIX_OBJMODEL" = "ibm"; then
1899 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1906 AC_SUBST(AIX_OBJMODEL)
1907 DSO_LDOPTS='-qmkshrobj=1'
1908 DSO_CFLAGS='-qflag=w:w'
1910 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1912 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1913 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1914 if test "$COMPILE_ENVIRONMENT"; then
1917 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1919 [#if (__IBMCPP__ < 900)
1920 #error "Bad compiler"
1922 _BAD_COMPILER=,_BAD_COMPILER=1)
1923 if test -n "$_BAD_COMPILER"; then
1925 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1927 AC_MSG_RESULT([yes])
1930 TARGET_COMPILER_ABI="ibmc"
1931 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1932 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1935 case "${target_os}" in
1940 if test "$COMPILE_ENVIRONMENT"; then
1941 MOZ_CHECK_HEADERS(sys/inttypes.h)
1943 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1947 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1956 _WARNINGS_CFLAGS="-Wall"
1957 _WARNINGS_CXXFLAGS="-Wall"
1958 # The test above doesn't work properly, at least on 3.1.
1959 MKSHLIB_FORCE_ALL=''
1960 MKSHLIB_UNFORCE_ALL=''
1966 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1967 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1968 MOZ_OPTIMIZE_FLAGS="-O3"
1970 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1971 if test "$HAVE_64BIT_OS"; then
1976 STRIP="$STRIP -x -S"
1977 # Check whether we're targeting OS X or iOS
1978 AC_CACHE_CHECK(for iOS target,
1980 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1981 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1985 ac_cv_ios_target="yes",
1986 ac_cv_ios_target="no")])
1987 if test "$ac_cv_ios_target" = "yes"; then
1989 AC_DEFINE(XP_DARWIN)
1990 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1992 AC_DEFINE(XP_MACOSX)
1993 AC_DEFINE(XP_DARWIN)
1994 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1995 # The ExceptionHandling framework is needed for Objective-C exception
1996 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1998 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
2000 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2003 if test "x$lto_is_enabled" = "xyes"; then
2004 echo "Skipping -dead_strip because lto is enabled."
2005 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2006 dnl ===================================================================
2007 elif test "x$enable_dtrace" = "xyes"; then
2008 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2010 dnl check for the presence of the -dead_strip linker flag
2011 AC_MSG_CHECKING([for -dead_strip option to ld])
2012 _SAVE_LDFLAGS=$LDFLAGS
2013 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2014 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2015 if test -n "$_HAVE_DEAD_STRIP" ; then
2016 AC_MSG_RESULT([yes])
2017 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2022 LDFLAGS=$_SAVE_LDFLAGS
2025 dnl With newer linkers we need to pass -allow_heap_execute because of
2026 dnl Microsoft Silverlight (5.1.10411.0 at least).
2027 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
2028 _SAVE_LDFLAGS=$LDFLAGS
2029 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
2030 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
2031 _HAVE_ALLOW_HEAP_EXECUTE=)
2032 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
2033 AC_MSG_RESULT([yes])
2034 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
2038 LDFLAGS=$_SAVE_LDFLAGS
2040 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2044 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2045 DLL_SUFFIX=".so.1.0"
2046 DSO_LDOPTS="-shared"
2048 if test ! "$GNU_CC"; then
2049 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2055 if test ! "$GNU_CC"; then
2059 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2060 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2061 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2064 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2065 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2068 MOZ_NATIVE_MAKEDEPEND=
2069 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2070 AC_DEFINE(_LARGEFILE64_SOURCE)
2075 if test ! "$GNU_CC"; then
2076 DSO_LDOPTS='-b -Wl,+s'
2079 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2080 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2081 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2083 DSO_LDOPTS='-b -E +s'
2084 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2085 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2087 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2088 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2091 *-android*|*-linuxandroid*)
2092 AC_DEFINE(NO_PW_GECOS)
2094 if test -n "$gonkdir"; then
2095 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2099 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2102 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2104 MOZ_GFX_OPTIMIZE_MOBILE=1
2105 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2109 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2110 # Similarly for GNU_CXX and INTEL_CXX.
2111 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2112 # -Os has been broken on Intel's C/C++ compilers for quite a
2113 # while; Intel recommends against using it.
2114 MOZ_OPTIMIZE_FLAGS="-O2"
2115 MOZ_DEBUG_FLAGS="-g"
2116 elif test "$GNU_CC" -o "$GNU_CXX"; then
2117 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2118 case $GCC_VERSION in
2120 # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2121 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2123 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2124 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2125 MOZ_DEBUG_FLAGS="-g"
2128 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2132 case "${target_cpu}" in
2134 CFLAGS="$CFLAGS -mieee"
2135 CXXFLAGS="$CXXFLAGS -mieee"
2141 MOZ_DEBUG_FLAGS="-g" # We want inlining
2145 if test -z "$MC"; then
2155 # certain versions of cygwin's makedepend barf on the
2156 # #include <string> vs -I./dist/include/string issue so don't use it
2157 MOZ_NATIVE_MAKEDEPEND=
2158 if test -n "$GNU_CC"; then
2160 CXX="$CXX -mwindows"
2161 CPP="$CPP -mwindows"
2162 CFLAGS="$CFLAGS -mms-bitfields"
2163 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2164 DSO_LDOPTS='-shared'
2165 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2166 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2168 # Use temp file for windres (bug 213281)
2169 RCFLAGS='-O coff --use-temp-file'
2170 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2171 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv"
2173 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2174 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2176 IMPORT_LIB_SUFFIX=dll.a
2177 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2179 TARGET_COMPILER_ABI=msvc
2183 if test "$AS_BIN"; then
2184 AS="$(basename "$AS_BIN")"
2187 AR_FLAGS='-NOLOGO -OUT:"$@"'
2189 RANLIB='echo not_ranlib'
2190 STRIP='echo not_strip'
2201 IMPORT_LIB_SUFFIX=lib
2202 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2203 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2205 MKSHLIB_UNFORCE_ALL=
2206 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2207 _USE_CPP_INCLUDE_FLAG=1
2208 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2209 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2210 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2211 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2212 CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2213 # make 'foo == bar;' error out
2214 CFLAGS="$CFLAGS -we4553"
2215 CXXFLAGS="$CXXFLAGS -we4553"
2216 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2217 MOZ_DEBUG_FLAGS='-Zi'
2218 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2219 WARNINGS_AS_ERRORS='-WX'
2220 MOZ_OPTIMIZE_FLAGS='-O1'
2222 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2223 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2224 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2225 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2226 if test $_MSC_VER -ge 1400; then
2227 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2228 dnl For profile-guided optimization
2229 PROFILE_GEN_CFLAGS="-GL"
2230 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2231 dnl XXX: PGO builds can fail with warnings treated as errors,
2232 dnl specifically "no profile data available" appears to be
2233 dnl treated as an error sometimes. This might be a consequence
2234 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2235 dnl with the linker doing most of the work in the whole-program
2236 dnl optimization/PGO case. I think it's probably a compiler bug,
2237 dnl but we work around it here.
2238 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2239 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2240 dnl Probably also a compiler bug, but what can you do?
2241 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2242 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2245 AC_DEFINE(HAVE_SNPRINTF)
2250 AC_DEFINE(HW_THREADS)
2251 AC_DEFINE(STDC_HEADERS)
2252 AC_DEFINE(NEW_H, <new>)
2253 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2254 TARGET_MD_ARCH=win32
2255 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2257 MOZ_USER_DIR="Mozilla"
2259 dnl Hardcode to win95 for now - cls
2260 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2262 dnl set NO_X11 defines here as the general check is skipped on win32
2268 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2269 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2275 if test -z "$MOZ_TOOLS"; then
2276 AC_MSG_ERROR([MOZ_TOOLS is not set])
2278 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2279 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2280 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2282 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2283 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2284 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2291 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.])
2297 if test "$HAVE_64BIT_OS"; then
2298 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2301 if test $_MSC_VER -ge 1400; then
2302 LDFLAGS="$LDFLAGS -SAFESEH"
2305 if test -n "$GNU_CC"; then
2306 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2307 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2309 AC_DEFINE(HAVE_STDCALL)
2310 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2313 MOZ_CHECK_HEADERS(mmintrin.h)
2317 if test -n "$_WIN32_MSVC"; then
2318 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2323 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2327 if test "$HAVE_64BIT_OS"; then
2334 CFLAGS="$CFLAGS -Dunix"
2335 CXXFLAGS="$CXXFLAGS -Dunix"
2336 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2338 DSO_PIC_CFLAGS='-fPIC -DPIC'
2339 DSO_LDOPTS='-shared'
2340 BIN_FLAGS='-Wl,--export-dynamic'
2342 DSO_PIC_CFLAGS='-fPIC -DPIC'
2343 DLL_SUFFIX=".so.1.0"
2344 DSO_LDOPTS='-shared'
2346 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2347 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2348 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2349 if test "$LIBRUNPATH"; then
2350 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2352 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2353 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2357 if test "$SO_VERSION"; then
2358 DLL_SUFFIX=".so.$SO_VERSION"
2360 DLL_SUFFIX=".so.1.0"
2362 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2364 DSO_PIC_CFLAGS='-fPIC'
2365 DSO_LDOPTS='-shared -fPIC'
2366 if test "$LIBRUNPATH"; then
2367 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2372 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2373 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2376 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2377 AC_DEFINE(TCPV40HDRS)
2383 IMPORT_LIB_SUFFIX=lib
2387 CFLAGS="$CFLAGS -Zomf"
2388 CXXFLAGS="$CXXFLAGS -Zomf"
2390 BIN_FLAGS='-Zlinker /ST:0x100000'
2394 WARNINGS_AS_ERRORS='-Werror'
2395 MOZ_DEBUG_FLAGS="-g -fno-inline"
2396 MOZ_OPTIMIZE_FLAGS="-O2"
2397 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2398 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2399 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2401 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2405 MOZ_USER_DIR="Mozilla"
2408 if test "$MOZTOOLS"; then
2409 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2411 AC_MSG_ERROR([MOZTOOLS is not set])
2413 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2414 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2415 LDFLAGS="$LDFLAGS -Zhigh-mem"
2416 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2417 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2420 # GCC for OS/2 currently predefines these, but we don't want them
2421 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2422 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2424 AC_CACHE_CHECK(for __declspec(dllexport),
2426 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2428 ac_os2_declspec="yes",
2429 ac_os2_declspec="no")])
2430 if test "$ac_os2_declspec" != "yes"; then
2431 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2437 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2438 MOZ_NATIVE_MAKEDEPEND=
2440 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2441 # libraries one level up (e.g. libnspr4.so)
2442 if test "$SOLARIS_SUNPRO_CC"; then
2443 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2444 LIBS="-lCrun -lCstd -lc $LIBS"
2445 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2446 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2447 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2448 LDFLAGS="-xildoff $LDFLAGS"
2449 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2450 _SAVE_LDFLAGS=$LDFLAGS
2451 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2452 AC_TRY_LINK([#include <stdio.h>],
2453 [printf("Hello World\n");],
2455 [LDFLAGS=$_SAVE_LDFLAGS])
2457 MOZ_OPTIMIZE_FLAGS="-xO4"
2458 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2459 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2460 MKSHLIB_FORCE_ALL='-z allextract'
2461 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2468 AS='/usr/ccs/bin/as'
2469 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2471 TARGET_COMPILER_ABI="sunc"
2472 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2473 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2474 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2478 [#if (__SUNPRO_CC < 0x590)
2481 _BAD_COMPILER=,_BAD_COMPILER=1)
2482 if test -n "$_BAD_COMPILER"; then
2484 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2489 [#if (__SUNPRO_CC >= 0x5100)
2490 #error "Sun C++ 5.10 or above"
2492 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2493 if test "$_ABOVE_SS12U1"; then
2495 CXXFLAGS="$CXXFLAGS -xannotate=no"
2497 AC_MSG_RESULT([$_res])
2500 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2502 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2503 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2504 ASFLAGS="$ASFLAGS -fPIC"
2505 DSO_LDOPTS='-shared'
2506 WARNINGS_AS_ERRORS='-Werror'
2508 _WARNINGS_CXXFLAGS=''
2509 if test "$OS_RELEASE" = "5.3"; then
2510 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2513 if test "$OS_RELEASE" = "5.5.1"; then
2514 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2519 DSO_LDOPTS='-Bdynamic'
2520 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2521 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2523 AC_DEFINE(SPRINTF_RETURNS_STRING)
2524 case "$(target_os)" in
2526 DLL_SUFFIX='.so.1.0'
2532 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2537 AC_SUBST(MOZ_LINKER)
2538 if test -n "$MOZ_LINKER"; then
2539 AC_DEFINE(MOZ_LINKER)
2541 AC_SUBST(MOZ_ENABLE_SZIP)
2543 dnl Only one oddball right now (QNX), but this gives us flexibility
2544 dnl if any other platforms need to override this in the future.
2545 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2547 dnl ========================================================
2548 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2549 dnl by now will not have any way to link most binaries (tests
2550 dnl as well as viewer, apprunner, etc.), because some symbols
2551 dnl will be left out of the "composite" .so's by ld as unneeded.
2552 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2553 dnl they can link in the static libs that provide the missing
2555 dnl ========================================================
2556 NO_LD_ARCHIVE_FLAGS=
2557 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2558 NO_LD_ARCHIVE_FLAGS=1
2562 NO_LD_ARCHIVE_FLAGS=
2565 NO_LD_ARCHIVE_FLAGS=
2568 if test -z "$GNU_CC"; then
2569 NO_LD_ARCHIVE_FLAGS=
2573 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2575 dnl ========================================================
2576 dnl = Flags to strip unused symbols from .so components and
2577 dnl = to export jemalloc symbols when linking a program
2578 dnl ========================================================
2580 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2581 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2584 if test -z "$GNU_CC"; then
2585 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2587 if test -z "$GCC_USE_GNU_LD"; then
2588 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2590 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2595 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2598 if test -n "$GNU_CC"; then
2599 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2604 if test -z "$COMPILE_ENVIRONMENT"; then
2605 SKIP_COMPILER_CHECKS=1
2606 SKIP_LIBRARY_CHECKS=1
2610 if test -z "$SKIP_COMPILER_CHECKS"; then
2611 dnl Checks for typedefs, structures, and compiler characteristics.
2612 dnl ========================================================
2620 AC_MSG_CHECKING(for __stdcall)
2621 AC_CACHE_VAL(ac_cv___stdcall,
2622 [AC_TRY_COMPILE([template <typename Method> struct foo;
2623 template <> struct foo<void (*)()> {};
2624 template <> struct foo<void (__stdcall*)()> {};],
2626 [ac_cv___stdcall=true],
2627 [ac_cv___stdcall=false])])
2628 if test "$ac_cv___stdcall" = true ; then
2629 AC_DEFINE(HAVE_STDCALL)
2635 AC_MSG_CHECKING(for ssize_t)
2636 AC_CACHE_VAL(ac_cv_type_ssize_t,
2637 [AC_TRY_COMPILE([#include <stdio.h>
2638 #include <sys/types.h>],
2640 [ac_cv_type_ssize_t=true],
2641 [ac_cv_type_ssize_t=false])])
2642 if test "$ac_cv_type_ssize_t" = true ; then
2643 AC_DEFINE(HAVE_SSIZE_T)
2648 AC_STRUCT_ST_BLKSIZE
2649 AC_MSG_CHECKING(for siginfo_t)
2650 AC_CACHE_VAL(ac_cv_siginfo_t,
2651 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2652 #include <signal.h>],
2654 [ac_cv_siginfo_t=true],
2655 [ac_cv_siginfo_t=false])])
2656 if test "$ac_cv_siginfo_t" = true ; then
2657 AC_DEFINE(HAVE_SIGINFO_T)
2663 dnl Check for int64, uint, and uint_t.
2664 dnl ========================================================
2665 AC_MSG_CHECKING(for int64)
2666 AC_CACHE_VAL(ac_cv_int64,
2667 [AC_TRY_COMPILE([#include <stdio.h>
2668 #include <sys/types.h>],
2671 [ac_cv_int64=false])])
2672 if test "$ac_cv_int64" = true ; then
2673 AC_DEFINE(HAVE_INT64)
2678 AC_MSG_CHECKING(for uint)
2679 AC_CACHE_VAL(ac_cv_uint,
2680 [AC_TRY_COMPILE([#include <stdio.h>
2681 #include <sys/types.h>],
2684 [ac_cv_uint=false])])
2685 if test "$ac_cv_uint" = true ; then
2686 AC_DEFINE(HAVE_UINT)
2691 AC_MSG_CHECKING(for uint_t)
2692 AC_CACHE_VAL(ac_cv_uint_t,
2693 [AC_TRY_COMPILE([#include <stdio.h>
2694 #include <sys/types.h>],
2696 [ac_cv_uint_t=true],
2697 [ac_cv_uint_t=false])])
2698 if test "$ac_cv_uint_t" = true ; then
2699 AC_DEFINE(HAVE_UINT_T)
2705 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2706 dnl are defined when compiling C++ but not C. Since the result of this
2707 dnl test is used only in C++, do it in C++.
2710 AC_MSG_CHECKING(for uname.domainname)
2711 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2712 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2713 [ struct utsname *res; char *domain;
2714 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2715 [ac_cv_have_uname_domainname_field=true],
2716 [ac_cv_have_uname_domainname_field=false])])
2718 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2719 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2725 AC_MSG_CHECKING(for uname.__domainname)
2726 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2727 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2728 [ struct utsname *res; char *domain;
2729 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2730 [ac_cv_have_uname_us_domainname_field=true],
2731 [ac_cv_have_uname_us_domainname_field=false])])
2733 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2734 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2740 dnl Check whether we can use gcc's c++0x mode
2743 if test "$GNU_CXX"; then
2744 _SAVE_CXXFLAGS=$CXXFLAGS
2745 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2747 AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2748 ac_cv_cxx0x_headers_bug,
2749 [AC_TRY_COMPILE([#include <memory>], [],
2750 ac_cv_cxx0x_headers_bug="no",
2751 ac_cv_cxx0x_headers_bug="yes")])
2752 CXXFLAGS="$_SAVE_CXXFLAGS"
2753 if test "$ac_cv_cxx0x_headers_bug" = "no"; then
2754 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2758 dnl Check for usable char16_t (2 bytes, unsigned)
2759 dnl (we might not need the unsignedness check anymore)
2760 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2761 ac_cv_have_usable_char16_t,
2762 [AC_TRY_COMPILE([$configure_static_assert_macros],
2763 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2764 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2765 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2766 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2767 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2768 ac_cv_have_usable_char16_t="yes",
2769 ac_cv_have_usable_char16_t="no")])
2770 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2771 AC_DEFINE(HAVE_CPP_CHAR16_T)
2773 elif test "$GNU_CXX"; then
2774 CXXFLAGS="$_SAVE_CXXFLAGS"
2777 dnl Check for usable wchar_t (2 bytes, unsigned)
2778 dnl (we really don't need the unsignedness check anymore)
2779 dnl ========================================================
2781 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2782 ac_cv_have_usable_wchar_v2,
2783 [AC_TRY_COMPILE([#include <stddef.h>
2784 $configure_static_assert_macros],
2785 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2786 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2787 ac_cv_have_usable_wchar_v2="yes",
2788 ac_cv_have_usable_wchar_v2="no")])
2789 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2790 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2791 HAVE_CPP_2BYTE_WCHAR_T=1
2792 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2793 dnl This is really gcc-only
2794 dnl Do this test using CXX only since some versions of gcc
2795 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2796 dnl only have short-wchar support for c++.
2797 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2799 _SAVE_CXXFLAGS=$CXXFLAGS
2800 CXXFLAGS="$CXXFLAGS -fshort-wchar"
2802 AC_CACHE_CHECK(for compiler -fshort-wchar option,
2803 ac_cv_have_usable_wchar_option_v2,
2804 [AC_TRY_LINK([#include <stddef.h>
2805 $configure_static_assert_macros],
2806 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2807 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2808 ac_cv_have_usable_wchar_option_v2="yes",
2809 ac_cv_have_usable_wchar_option_v2="no")])
2811 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2812 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2813 HAVE_CPP_2BYTE_WCHAR_T=1
2814 if test "$OS_TARGET" = Android; then
2815 WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
2816 CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
2817 CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
2818 DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
2820 WCHAR_CFLAGS="-fshort-wchar"
2823 CXXFLAGS=$_SAVE_CXXFLAGS
2829 dnl Check for .hidden assembler directive and visibility attribute.
2830 dnl Borrowed from glibc configure.in
2831 dnl ===============================================================
2832 if test "$GNU_CC"; then
2833 AC_CACHE_CHECK(for visibility(hidden) attribute,
2834 ac_cv_visibility_hidden,
2835 [cat > conftest.c <<EOF
2836 int foo __attribute__ ((visibility ("hidden"))) = 1;
2838 ac_cv_visibility_hidden=no
2839 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2840 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2841 ac_cv_visibility_hidden=yes
2846 if test "$ac_cv_visibility_hidden" = "yes"; then
2847 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2849 AC_CACHE_CHECK(for visibility(default) attribute,
2850 ac_cv_visibility_default,
2851 [cat > conftest.c <<EOF
2852 int foo __attribute__ ((visibility ("default"))) = 1;
2854 ac_cv_visibility_default=no
2855 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2856 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2857 ac_cv_visibility_default=yes
2862 if test "$ac_cv_visibility_default" = "yes"; then
2863 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2865 AC_CACHE_CHECK(for visibility pragma support,
2866 ac_cv_visibility_pragma,
2867 [cat > conftest.c <<EOF
2868 #pragma GCC visibility push(hidden)
2870 #pragma GCC visibility push(default)
2871 int foo_default = 1;
2873 ac_cv_visibility_pragma=no
2874 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2875 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2876 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2877 ac_cv_visibility_pragma=yes
2883 if test "$ac_cv_visibility_pragma" = "yes"; then
2884 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2885 ac_cv_have_visibility_class_bug,
2886 [cat > conftest.c <<EOF
2887 #pragma GCC visibility push(hidden)
2888 struct __attribute__ ((visibility ("default"))) TestStruct {
2891 __attribute__ ((visibility ("default"))) void TestFunc() {
2895 ac_cv_have_visibility_class_bug=no
2896 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2897 ac_cv_have_visibility_class_bug=yes
2899 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2900 ac_cv_have_visibility_class_bug=yes
2903 rm -rf conftest.{c,S}
2906 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2907 ac_cv_have_visibility_builtin_bug,
2908 [cat > conftest.c <<EOF
2909 #pragma GCC visibility push(hidden)
2910 #pragma GCC visibility push(default)
2912 #pragma GCC visibility pop
2914 __attribute__ ((visibility ("default"))) void Func() {
2916 memset(c, 0, sizeof(c));
2919 ac_cv_have_visibility_builtin_bug=no
2920 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2921 ac_cv_have_visibility_builtin_bug=yes
2923 if test `grep -c "@PLT" conftest.S` = 0; then
2924 ac_cv_visibility_builtin_bug=yes
2927 rm -f conftest.{c,S}
2929 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2930 "$ac_cv_have_visibility_class_bug" = "no"; then
2931 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2932 WRAP_SYSTEM_INCLUDES=1
2933 STL_FLAGS='-I$(DIST)/stl_wrappers'
2936 VISIBILITY_FLAGS='-fvisibility=hidden'
2937 fi # have visibility pragma bug
2938 fi # have visibility pragma
2939 fi # have visibility(default) attribute
2940 fi # have visibility(hidden) attribute
2943 # visibility hidden flag for Sun Studio on Solaris
2944 if test "$SOLARIS_SUNPRO_CC"; then
2945 VISIBILITY_FLAGS='-xldscope=hidden'
2946 fi # Sun Studio on Solaris
2948 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2949 AC_SUBST(VISIBILITY_FLAGS)
2953 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2954 dnl ========================================================
2955 if test "$GNU_CC"; then
2956 CFLAGS_save="${CFLAGS}"
2957 CFLAGS="${CFLAGS} -Werror"
2958 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2959 ac_cv_force_align_arg_pointer,
2960 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2962 ac_cv_force_align_arg_pointer="yes",
2963 ac_cv_force_align_arg_pointer="no")])
2964 CFLAGS="${CFLAGS_save}"
2965 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2966 HAVE_GCC_ALIGN_ARG_POINTER=1
2968 HAVE_GCC_ALIGN_ARG_POINTER=
2971 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2973 dnl Checks for header files.
2974 dnl ========================================================
2976 case "$target_os" in
2978 # for stuff like -lXshm
2979 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2982 MOZ_CHECK_COMMON_HEADERS
2984 dnl These are all the places some variant of statfs can be hiding.
2985 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2988 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2989 MOZ_CHECK_HEADERS(linux/quota.h)
2991 dnl Try for MMX support
2992 dnl NB - later gcc versions require -mmmx for this header to be successfully
2993 dnl included (or another option which implies it, such as -march=pentium-mmx)
2994 MOZ_CHECK_HEADERS(mmintrin.h)
2996 dnl Check whether the compiler supports the new-style C++ standard
2997 dnl library headers (i.e. <new>) or needs the old "new.h"
3000 MOZ_CHECK_HEADER(new, [NEW_H=new])
3001 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3004 AC_ARG_ENABLE(dtrace,
3005 [ --enable-dtrace build with dtrace support if available (default=no)],
3006 [enable_dtrace="yes"],)
3007 if test "x$enable_dtrace" = "xyes"; then
3008 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3009 if test -n "$HAVE_DTRACE"; then
3010 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3012 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3015 AC_SUBST(HAVE_DTRACE)
3021 MOZ_CHECK_HEADERS(sys/cdefs.h)
3025 dnl Checks for libraries.
3026 dnl ========================================================
3031 AC_CHECK_LIB(c_r, gethostbyname_r)
3035 dnl We don't want to link with libdl even if it's present on OS X, since
3036 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3038 dnl We don't want to link against libm or libpthread on Darwin since
3039 dnl they both are just symlinks to libSystem and explicitly linking
3040 dnl against libSystem causes issues when debugging (see bug 299601).
3047 AC_SEARCH_LIBS(dlopen, dl,
3048 MOZ_CHECK_HEADER(dlfcn.h,
3049 AC_DEFINE(HAVE_DLOPEN)))
3053 _SAVE_CFLAGS="$CFLAGS"
3054 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3055 AC_CHECK_FUNCS(dladdr memmem)
3056 CFLAGS="$_SAVE_CFLAGS"
3058 if test ! "$GNU_CXX"; then
3062 AC_CHECK_LIB(C_r, demangle)
3065 AC_CHECK_LIB(C, demangle)
3070 dnl OS/2 has socket in libc.
3075 AC_CHECK_LIB(socket, socket)
3079 XLIBS="$X_EXTRA_LIBS"
3081 dnl ========================================================
3082 dnl Checks for X libraries.
3083 dnl Ordering is important.
3084 dnl Xt is dependent upon SM as of X11R6
3085 dnl ========================================================
3086 if test "$no_x" = "yes"; then
3089 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3090 XLIBS="-lX11 $XLIBS"
3091 _SAVE_LDFLAGS="$LDFLAGS"
3092 LDFLAGS="$XLDFLAGS $LDFLAGS"
3093 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3094 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3095 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3096 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3098 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3099 unset ac_cv_lib_Xt_XtFree
3100 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3101 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3102 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3103 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3106 # AIX needs the motif library linked before libXt to prevent
3107 # crashes in plugins linked against Motif - Bug #98892
3108 case "${target_os}" in
3110 XT_LIBS="-lXm $XT_LIBS"
3114 dnl ========================================================
3115 dnl = Check for XShm
3116 dnl ========================================================
3117 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3120 dnl ========================================================
3122 dnl ========================================================
3123 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3124 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3125 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3126 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3128 LDFLAGS="$_SAVE_LDFLAGS"
3138 dnl ========================================================
3139 dnl = pthread support
3140 dnl = Start by checking whether the system support pthreads
3141 dnl ========================================================
3142 case "$target_os" in
3147 MOZ_CHECK_PTHREADS(pthreads,
3148 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3149 MOZ_CHECK_PTHREADS(pthread,
3150 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3151 MOZ_CHECK_PTHREADS(c_r,
3152 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3153 MOZ_CHECK_PTHREADS(c,
3162 dnl ========================================================
3163 dnl Check the command line for --with-pthreads
3164 dnl ========================================================
3165 MOZ_ARG_WITH_BOOL(pthreads,
3166 [ --with-pthreads Force use of system pthread library with NSPR ],
3167 [ if test "$USE_PTHREADS"x = x; then
3168 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3174 dnl ========================================================
3175 dnl Do the platform specific pthread hackery
3176 dnl ========================================================
3177 if test "$USE_PTHREADS"x != x
3180 dnl See if -pthread is supported.
3183 ac_cv_have_dash_pthread=no
3184 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3185 echo 'int main() { return 0; }' | cat > conftest.c
3186 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3187 if test $? -eq 0; then
3188 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3189 ac_cv_have_dash_pthread=yes
3190 case "$target_os" in
3192 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3195 CFLAGS="$CFLAGS -pthread"
3196 CXXFLAGS="$CXXFLAGS -pthread"
3202 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3205 dnl See if -pthreads is supported.
3207 ac_cv_have_dash_pthreads=no
3208 if test "$ac_cv_have_dash_pthread" = "no"; then
3209 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3210 echo 'int main() { return 0; }' | cat > conftest.c
3211 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3212 if test $? -eq 0; then
3213 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3214 ac_cv_have_dash_pthreads=yes
3215 CFLAGS="$CFLAGS -pthreads"
3216 CXXFLAGS="$CXXFLAGS -pthreads"
3220 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3225 AC_DEFINE(_REENTRANT)
3226 AC_DEFINE(_THREAD_SAFE)
3227 dnl -pthread links in -lc_r, so don't specify it explicitly.
3228 if test "$ac_cv_have_dash_pthread" = "yes"; then
3229 _PTHREAD_LDFLAGS="-pthread"
3231 _PTHREAD_LDFLAGS="-lc_r"
3235 *-*-openbsd*|*-*-bsdi*)
3236 AC_DEFINE(_REENTRANT)
3237 AC_DEFINE(_THREAD_SAFE)
3238 dnl -pthread links in -lc_r, so don't specify it explicitly.
3239 if test "$ac_cv_have_dash_pthread" = "yes"; then
3240 _PTHREAD_LDFLAGS="-pthread"
3244 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3245 AC_DEFINE(_REENTRANT)
3249 AC_DEFINE(_REENTRANT)
3253 AC_DEFINE(_REENTRANT)
3257 AC_DEFINE(_REENTRANT)
3258 if test "$SOLARIS_SUNPRO_CC"; then
3259 CFLAGS="$CFLAGS -mt"
3260 CXXFLAGS="$CXXFLAGS -mt"
3264 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3268 dnl Checks for library functions.
3269 dnl ========================================================
3270 AC_PROG_GCC_TRADITIONAL
3272 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3273 AC_CHECK_FUNCS(flockfile getpagesize)
3274 AC_CHECK_FUNCS(localtime_r strtok_r)
3276 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3277 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3278 ac_cv_clock_monotonic,
3279 [for libs in "" -lrt; do
3282 AC_TRY_LINK([#include <time.h>],
3283 [ struct timespec ts;
3284 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3285 ac_cv_clock_monotonic=$libs
3287 ac_cv_clock_monotonic=no)
3290 if test "$ac_cv_clock_monotonic" != "no"; then
3291 HAVE_CLOCK_MONOTONIC=1
3292 REALTIME_LIBS=$ac_cv_clock_monotonic
3293 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3294 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3295 AC_SUBST(REALTIME_LIBS)
3298 dnl check for wcrtomb/mbrtowc
3299 dnl =======================================================================
3300 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3303 AC_CACHE_CHECK(for wcrtomb,
3305 [AC_TRY_LINK([#include <wchar.h>],
3306 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3307 ac_cv_have_wcrtomb="yes",
3308 ac_cv_have_wcrtomb="no")])
3309 if test "$ac_cv_have_wcrtomb" = "yes"; then
3310 AC_DEFINE(HAVE_WCRTOMB)
3312 AC_CACHE_CHECK(for mbrtowc,
3314 [AC_TRY_LINK([#include <wchar.h>],
3315 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3316 ac_cv_have_mbrtowc="yes",
3317 ac_cv_have_mbrtowc="no")])
3318 if test "$ac_cv_have_mbrtowc" = "yes"; then
3319 AC_DEFINE(HAVE_MBRTOWC)
3326 ac_cv_func_res_ninit,
3329 #define _BSD_SOURCE 1
3333 [int foo = res_ninit(&_res);],
3334 [ac_cv_func_res_ninit=yes],
3335 [ac_cv_func_res_ninit=no])
3338 if test "$ac_cv_func_res_ninit" = "yes"; then
3339 AC_DEFINE(HAVE_RES_NINIT)
3340 dnl must add the link line we do something as foolish as this... dougt
3342 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3343 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3348 [for gnu_get_libc_version()],
3349 ac_cv_func_gnu_get_libc_version,
3351 #ifdef HAVE_GNU_LIBC_VERSION_H
3352 #include <gnu/libc-version.h>
3355 [const char *glibc_version = gnu_get_libc_version();],
3356 [ac_cv_func_gnu_get_libc_version=yes],
3357 [ac_cv_func_gnu_get_libc_version=no]
3361 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3362 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3366 darwin*|mingw*|os2*)
3370 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3371 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3372 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3374 LIBS="$LIBS $_ICONV_LIBS"
3383 iconv_t h = iconv_open("", "");
3384 iconv(h, NULL, NULL, NULL, NULL);
3387 [ac_cv_func_iconv=yes],
3388 [ac_cv_func_iconv=no]
3391 if test "$ac_cv_func_iconv" = "yes"; then
3392 AC_DEFINE(HAVE_ICONV)
3393 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3394 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3395 LIBICONV="$_ICONV_LIBS"
3397 [for iconv() with const input],
3398 ac_cv_func_const_iconv,
3404 const char *input = "testing";
3405 iconv_t h = iconv_open("", "");
3406 iconv(h, &input, NULL, NULL, NULL);
3409 [ac_cv_func_const_iconv=yes],
3410 [ac_cv_func_const_iconv=no]
3413 if test "$ac_cv_func_const_iconv" = "yes"; then
3414 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3426 dnl **********************
3427 dnl *** va_copy checks ***
3428 dnl **********************
3429 dnl we currently check for all three va_copy possibilities, so we get
3430 dnl all results in config.log for bug reports.
3431 AC_MSG_CHECKING(for an implementation of va_copy())
3432 AC_CACHE_VAL(ac_cv_va_copy,[
3435 void f (int i, ...) {
3436 va_list args1, args2;
3437 va_start (args1, i);
3438 va_copy (args2, args1);
3439 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3441 va_end (args1); va_end (args2);
3443 int main() { f (0, 42); return 0; }],
3449 AC_MSG_RESULT($ac_cv_va_copy)
3450 AC_MSG_CHECKING(for an implementation of __va_copy())
3451 AC_CACHE_VAL(ac_cv___va_copy,[
3454 void f (int i, ...) {
3455 va_list args1, args2;
3456 va_start (args1, i);
3457 __va_copy (args2, args1);
3458 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3460 va_end (args1); va_end (args2);
3462 int main() { f (0, 42); return 0; }],
3463 ac_cv___va_copy=yes,
3468 AC_MSG_RESULT($ac_cv___va_copy)
3469 AC_MSG_CHECKING(whether va_lists can be copied by value)
3470 AC_CACHE_VAL(ac_cv_va_val_copy,[
3473 void f (int i, ...) {
3474 va_list args1, args2;
3475 va_start (args1, i);
3477 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3479 va_end (args1); va_end (args2);
3481 int main() { f (0, 42); return 0; }],
3482 ac_cv_va_val_copy=yes,
3483 ac_cv_va_val_copy=no,
3484 ac_cv_va_val_copy=yes
3487 if test "x$ac_cv_va_copy" = "xyes"; then
3488 AC_DEFINE(VA_COPY, va_copy)
3489 AC_DEFINE(HAVE_VA_COPY)
3490 elif test "x$ac_cv___va_copy" = "xyes"; then
3491 AC_DEFINE(VA_COPY, __va_copy)
3492 AC_DEFINE(HAVE_VA_COPY)
3495 if test "x$ac_cv_va_val_copy" = "xno"; then
3496 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3498 AC_MSG_RESULT($ac_cv_va_val_copy)
3500 dnl ===================================================================
3501 dnl ========================================================
3502 dnl Put your C++ language/feature checks below
3503 dnl ========================================================
3507 if test "$GNU_CC"; then
3508 if test "$CPU_ARCH" = "arm" ; then
3509 AC_CACHE_CHECK(for ARM EABI,
3513 #if defined(__ARM_EABI__)
3516 #error Not ARM EABI.
3519 ac_cv_gcc_arm_eabi="yes",
3520 ac_cv_gcc_arm_eabi="no")])
3521 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3523 ARM_ABI_PREFIX=eabi-
3525 ARM_ABI_PREFIX=oabi-
3529 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3532 dnl Check for support of modern template specialization syntax
3533 dnl Test code and requirement from scc@netscape.com.
3534 dnl Autoconf cut-and-paste job by waterson@netscape.com
3535 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3536 ac_cv_cpp_modern_specialize_template_syntax,
3537 [AC_TRY_COMPILE(template <class T> struct X { int a; };
3539 template <> struct X<Y> { double a; };,
3542 ac_cv_cpp_modern_specialize_template_syntax=yes,
3543 ac_cv_cpp_modern_specialize_template_syntax=no)])
3544 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
3545 AC_MSG_ERROR([The C++ compiler does not support template specialization])
3548 dnl Some compilers support only full specialization, and some don't.
3549 AC_CACHE_CHECK(whether partial template specialization works,
3550 ac_cv_cpp_partial_specialization,
3551 [AC_TRY_COMPILE(template <class T> class Foo {};
3552 template <class T> class Foo<T*> {};,
3554 ac_cv_cpp_partial_specialization=yes,
3555 ac_cv_cpp_partial_specialization=no)])
3556 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3557 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3560 dnl Check to see if we can resolve ambiguity with |using|.
3561 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3562 ac_cv_cpp_ambiguity_resolving_using,
3563 [AC_TRY_COMPILE(class X {
3564 public: int go(const X&) {return 3;}
3565 int jo(const X&) {return 3;}
3567 class Y : public X {
3568 public: int go(int) {return 2;}
3569 int jo(int) {return 2;}
3571 private: using X::go;
3574 ac_cv_cpp_ambiguity_resolving_using=yes,
3575 ac_cv_cpp_ambiguity_resolving_using=no)])
3576 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3577 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3580 dnl See if a dynamic_cast to void* gives the most derived object.
3581 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3582 ac_cv_cpp_dynamic_cast_void_ptr,
3583 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3584 class Y { int j; public: virtual ~Y() { } };
3585 class Z : public X, public Y { int k; };
3591 return !((((void*)&mdo != (void*)subx) &&
3592 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3593 (((void*)&mdo != (void*)suby) &&
3594 ((void*)&mdo == dynamic_cast<void*>(suby))));
3596 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3597 ac_cv_cpp_dynamic_cast_void_ptr=no,
3598 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3599 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3600 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3604 dnl note that this one is reversed - if the test fails, then
3605 dnl we require implementations of unused virtual methods. Which
3606 dnl really blows because it means we'll have useless vtable
3608 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3609 ac_cv_cpp_unused_required,
3610 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3612 ac_cv_cpp_unused_required=no,
3613 ac_cv_cpp_unused_required=yes)])
3614 if test "$ac_cv_cpp_unused_required" = yes ; then
3615 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3619 dnl Some compilers have trouble comparing a constant reference to a templatized
3620 dnl class to zero, and require an explicit operator==() to be defined that takes
3621 dnl an int. This test separates the strong from the weak.
3623 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3624 ac_cv_trouble_comparing_to_zero,
3625 [AC_TRY_COMPILE([#include <algorithm>
3626 template <class T> class Foo {};
3628 template <class T> int operator==(const T2*, const T&) { return 0; }
3629 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3630 [Foo<int> f; return (0 != f);],
3631 ac_cv_trouble_comparing_to_zero=no,
3632 ac_cv_trouble_comparing_to_zero=yes)])
3633 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3634 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3637 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3638 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3639 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3641 _SAVE_LDFLAGS=$LDFLAGS
3642 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3643 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3644 ac_cv_thread_keyword,
3645 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3646 [return tlsIsMainThread;],
3647 ac_cv_thread_keyword=yes,
3648 ac_cv_thread_keyword=no)])
3649 LDFLAGS=$_SAVE_LDFLAGS
3650 # The custom dynamic linker doesn't support TLS variables
3652 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3653 # mips builds fail with TLS variables because of a binutils bug.
3659 *-android*|*-linuxandroid*)
3663 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3669 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3670 if test -n "$MOZ_LINKER"; then
3671 if test "$CPU_ARCH" = arm; then
3672 dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
3673 ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
3674 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3675 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3676 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000"
3677 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000"
3682 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3683 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3684 dnl We however want to avoid these text relocations, and this can be done
3685 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3686 dnl doesn't contain anything at all, beside placeholders for some sections,
3687 dnl and crtbegin only contains a finalizer function that calls
3688 dnl __cxa_finalize. The custom linker actually takes care of calling
3689 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3690 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3691 dnl link crtbegin and crtend at all.
3692 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$OS_TARGET" = "Android"; then
3693 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3694 ac_cv_crt_has_text_relocations,
3695 [echo 'int foo() { return 0; }' > conftest.cpp
3696 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3697 test -s conftest${DLL_SUFFIX}; then
3698 if readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3699 ac_cv_crt_has_text_relocations=yes
3701 ac_cv_crt_has_text_relocations=no
3704 AC_ERROR([couldn't compile a simple C file])
3707 if test "$ac_cv_crt_has_text_relocations" = yes; then
3708 dnl While we want libraries to skip the CRT files, we don't want
3709 dnl executables to be treated the same way. We thus set the flag
3710 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3711 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3712 dnl Using LDFLAGS in nspr is safe, since we only really build
3713 dnl libraries there.
3714 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3715 NSPR_LDFLAGS=-nostartfiles
3719 dnl Check for the existence of various allocation headers/functions
3722 MOZ_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
3723 if test "$MALLOC_H" = ""; then
3724 MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
3725 if test "$MALLOC_H" = ""; then
3726 MOZ_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
3729 if test "$MALLOC_H" != ""; then
3730 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3733 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3734 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3736 dnl See if compiler supports some gcc-style attributes
3738 AC_CACHE_CHECK(for __attribute__((always_inline)),
3739 ac_cv_attribute_always_inline,
3740 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3742 ac_cv_attribute_always_inline=yes,
3743 ac_cv_attribute_always_inline=no)])
3745 AC_CACHE_CHECK(for __attribute__((malloc)),
3746 ac_cv_attribute_malloc,
3747 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3749 ac_cv_attribute_malloc=yes,
3750 ac_cv_attribute_malloc=no)])
3752 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3753 ac_cv_attribute_warn_unused,
3754 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3756 ac_cv_attribute_warn_unused=yes,
3757 ac_cv_attribute_warn_unused=no)])
3759 dnl End of C++ language/feature checks
3762 dnl ========================================================
3763 dnl = Internationalization checks
3764 dnl ========================================================
3766 dnl Internationalization and Locale support is different
3767 dnl on various UNIX platforms. Checks for specific i18n
3768 dnl features go here.
3770 dnl check for LC_MESSAGES
3771 AC_CACHE_CHECK(for LC_MESSAGES,
3772 ac_cv_i18n_lc_messages,
3773 [AC_TRY_COMPILE([#include <locale.h>],
3774 [int category = LC_MESSAGES;],
3775 ac_cv_i18n_lc_messages=yes,
3776 ac_cv_i18n_lc_messages=no)])
3777 if test "$ac_cv_i18n_lc_messages" = yes; then
3778 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3781 AC_HAVE_FUNCS(localeconv)
3782 fi # ! SKIP_COMPILER_CHECKS
3785 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3786 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3789 dnl Mozilla specific options
3790 dnl ========================================================
3791 dnl The macros used for command line options
3792 dnl are defined in build/autoconf/altoptions.m4.
3794 dnl If the compiler supports these attributes, define them as
3795 dnl convenience macros.
3796 if test "$ac_cv_attribute_always_inline" = yes ; then
3797 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
3799 AC_DEFINE(NS_ALWAYS_INLINE,)
3802 if test "$ac_cv_attribute_malloc" = yes ; then
3803 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3805 AC_DEFINE(NS_ATTR_MALLOC,)
3808 if test "$ac_cv_attribute_warn_unused" = yes ; then
3809 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3811 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3814 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3815 dnl features that Windows actually does support.
3817 if test -n "$SKIP_COMPILER_CHECKS"; then
3818 dnl Windows has malloc.h
3819 AC_DEFINE(MALLOC_H, [<malloc.h>])
3820 AC_DEFINE(HAVE_FORCEINLINE)
3821 AC_DEFINE(HAVE_LOCALECONV)
3822 fi # SKIP_COMPILER_CHECKS
3824 dnl ========================================================
3826 dnl = Check for external package dependencies
3828 dnl ========================================================
3829 MOZ_ARG_HEADER(External Packages)
3831 MOZ_ARG_WITH_STRING(libxul-sdk,
3832 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3833 LIBXUL_SDK_DIR=$withval)
3835 if test "$LIBXUL_SDK_DIR" = "yes"; then
3836 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3837 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3838 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3840 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3841 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3845 AC_SUBST(LIBXUL_SDK)
3847 if test -n "$LIBXUL_SDK"; then
3848 LIBXUL_DIST="$LIBXUL_SDK"
3850 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3852 AC_SUBST(LIBXUL_DIST)
3856 MOZ_ARG_WITH_BOOL(system-libxul,
3857 [ --with-system-libxul Use system installed libxul SDK],
3860 dnl ========================================================
3861 dnl = If NSPR was not detected in the system,
3862 dnl = use the one in the source tree (mozilla/nsprpub)
3863 dnl ========================================================
3864 MOZ_ARG_WITH_BOOL(system-nspr,
3865 [ --with-system-nspr Use system installed NSPR],
3866 _USE_SYSTEM_NSPR=1 )
3868 if test -n "$_USE_SYSTEM_NSPR"; then
3869 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])])
3872 if test -n "$MOZ_NATIVE_NSPR"; then
3873 _SAVE_CFLAGS=$CFLAGS
3874 CFLAGS="$CFLAGS $NSPR_CFLAGS"
3875 AC_TRY_COMPILE([#include "prtypes.h"],
3876 [#ifndef PR_STATIC_ASSERT
3877 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3879 [MOZ_NATIVE_NSPR=1],
3880 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3881 AC_TRY_COMPILE([#include "prtypes.h"],
3883 #error PR_UINT64 not defined or requires including prtypes.h
3885 [MOZ_NATIVE_NSPR=1],
3886 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3887 CFLAGS=$_SAVE_CFLAGS
3889 if test "$OS_ARCH" = "WINNT"; then
3890 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3891 if test -n "$GNU_CC"; then
3892 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3894 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3897 NSPR_CFLAGS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
3898 NSPR_LIBS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
3902 dnl system libevent Support
3903 dnl ========================================================
3904 MOZ_ARG_WITH_STRING(system-libevent,
3905 [ --with-system-libevent=[PFX]
3906 Use system libevent [installed at prefix PFX]],
3907 LIBEVENT_DIR=$withval)
3909 _SAVE_CFLAGS=$CFLAGS
3910 _SAVE_LDFLAGS=$LDFLAGS
3912 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3913 MOZ_NATIVE_LIBEVENT=
3915 if test "${LIBEVENT_DIR}" = "yes"; then
3918 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3919 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3920 MOZ_CHECK_HEADER(event.h,
3921 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3922 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3924 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3925 AC_CHECK_LIB(event, event_init,
3926 [MOZ_NATIVE_LIBEVENT=1
3927 MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
3928 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3929 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
3931 CFLAGS=$_SAVE_CFLAGS
3932 LDFLAGS=$_SAVE_LDFLAGS
3935 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3936 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
3937 AC_SUBST(MOZ_LIBEVENT_LIBS)
3939 dnl ========================================================
3940 dnl = If NSS was not detected in the system,
3941 dnl = use the one in the source tree (mozilla/security/nss)
3942 dnl ========================================================
3944 MOZ_ARG_WITH_BOOL(system-nss,
3945 [ --with-system-nss Use system installed NSS],
3948 if test -n "$_USE_SYSTEM_NSS"; then
3949 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])])
3952 if test -n "$MOZ_NATIVE_NSS"; then
3953 NSS_LIBS="$NSS_LIBS -lcrmf"
3955 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3957 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3958 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
3959 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
3960 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
3961 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
3963 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
3965 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3966 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3967 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3968 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3969 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3971 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3975 dnl ======================
3977 dnl ======================
3979 AC_MSG_CHECKING([for YASM assembler])
3980 AC_CHECK_PROGS(YASM, yasm, "")
3982 if test -n "$YASM"; then
3983 dnl Pull out yasm's version string
3985 _YASM_VER_FILTER='s|.* \([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*|\1|p'
3988 YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
3989 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3990 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3991 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3992 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3995 if test -z "$SKIP_LIBRARY_CHECKS"; then
3996 dnl system JPEG support
3997 dnl ========================================================
3998 MOZ_ARG_WITH_STRING(system-jpeg,
3999 [ --with-system-jpeg[=PFX]
4000 Use system libjpeg [installed at prefix PFX]],
4003 _SAVE_CFLAGS=$CFLAGS
4004 _SAVE_LDFLAGS=$LDFLAGS
4006 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4007 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4008 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4010 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4013 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
4016 if test "$MOZ_NATIVE_JPEG" = 1; then
4017 AC_TRY_COMPILE([ #include <stdio.h>
4018 #include <sys/types.h>
4019 #include <jpeglib.h> ],
4020 [ #if JPEG_LIB_VERSION < $MOZJPEG
4021 #error "Insufficient JPEG library version ($MOZJPEG required)."
4024 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
4026 CFLAGS=$_SAVE_CFLAGS
4027 LDFLAGS=$_SAVE_LDFLAGS
4030 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
4031 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
4032 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
4034 fi # SKIP_LIBRARY_CHECKS
4036 dnl system ZLIB support
4037 dnl ========================================================
4038 MOZ_ZLIB_CHECK([1.2.3])
4040 if test "$MOZ_NATIVE_ZLIB" != 1; then
4042 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
4045 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
4046 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4049 if test -z "$SKIP_LIBRARY_CHECKS"; then
4050 dnl system BZIP2 Support
4051 dnl ========================================================
4052 MOZ_ARG_WITH_STRING(system-bz2,
4053 [ --with-system-bz2[=PFX]
4054 Use system libbz2 [installed at prefix PFX]],
4057 _SAVE_CFLAGS=$CFLAGS
4058 _SAVE_LDFLAGS=$LDFLAGS
4060 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4061 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4062 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4064 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4067 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
4068 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
4070 CFLAGS=$_SAVE_CFLAGS
4071 LDFLAGS=$_SAVE_LDFLAGS
4074 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
4075 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
4076 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4079 dnl system PNG Support
4080 dnl ========================================================
4081 MOZ_ARG_WITH_STRING(system-png,
4082 [ --with-system-png[=PFX]
4083 Use system libpng [installed at prefix PFX]],
4086 _SAVE_CFLAGS=$CFLAGS
4087 _SAVE_LDFLAGS=$LDFLAGS
4089 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4090 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4091 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4093 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4096 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
4097 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4098 AC_CHECK_LIB(png, png_get_acTL, ,
4099 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
4101 if test "$MOZ_NATIVE_PNG" = 1; then
4102 AC_TRY_COMPILE([ #include <stdio.h>
4103 #include <sys/types.h>
4105 [ #if PNG_LIBPNG_VER < $MOZPNG
4106 #error "Insufficient libpng version ($MOZPNG required)."
4108 #ifndef PNG_UINT_31_MAX
4109 #error "Insufficient libpng version."
4112 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4114 CFLAGS=$_SAVE_CFLAGS
4115 LDFLAGS=$_SAVE_LDFLAGS
4118 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
4119 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
4120 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
4123 fi # SKIP_LIBRARY_CHECKS
4125 dnl system HunSpell Support
4126 dnl ========================================================
4127 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4128 [ --enable-system-hunspell
4129 Use system hunspell (located with pkgconfig)],
4130 MOZ_NATIVE_HUNSPELL=1 )
4132 if test -n "$MOZ_NATIVE_HUNSPELL"; then
4133 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4136 AC_SUBST(MOZ_NATIVE_HUNSPELL)
4138 dnl ========================================================
4139 dnl system libffi Support
4140 dnl ========================================================
4141 MOZ_ARG_ENABLE_BOOL(system-ffi,
4142 [ --enable-system-ffi Use system libffi (located with pkgconfig)],
4145 if test -n "$MOZ_NATIVE_FFI"; then
4146 # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4147 # for non-GCC compilers.
4148 if test -z "$GNU_CC"; then
4149 PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4151 PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4153 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4156 dnl ========================================================
4157 dnl Java SDK support
4158 dnl ========================================================
4161 MOZ_ARG_WITH_STRING(java-bin-path,
4162 [ --with-java-bin-path=dir
4163 Location of Java binaries (java, javac, jar)],
4164 JAVA_BIN_PATH=$withval)
4166 dnl ========================================================
4170 dnl ========================================================
4172 MOZ_ARG_HEADER(Application)
4175 ENABLE_SYSTEM_EXTENSION_DIRS=1
4176 MOZ_BRANDING_DIRECTORY=
4177 MOZ_OFFICIAL_BRANDING=
4182 MOZ_AUTH_EXTENSION=1
4186 MOZ_SPEEX_RESAMPLER=1
4195 MOZ_WEBRTC_SIGNALING=
4197 MOZ_MEDIA_NAVIGATOR=
4200 MOZ_VP8_ERROR_CONCEALMENT=
4210 LIBJPEG_TURBO_ASFLAGS=
4211 LIBJPEG_TURBO_X86_ASM=
4212 LIBJPEG_TURBO_X64_ASM=
4213 LIBJPEG_TURBO_ARM_ASM=
4217 MOZ_PREF_EXTENSIONS=1
4218 MOZ_PROFILELOCKING=1
4224 MOZ_JAVA_COMPOSITOR=
4225 MOZ_ONLY_TOUCH_EVENTS=
4227 MOZ_TOOLKIT_SEARCH=1
4229 MOZ_UNIVERSALCHARDET=1
4236 MOZ_DISABLE_DOMCRYPTO=
4240 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4243 MOZ_USE_NATIVE_POPUP_WINDOWS=
4244 MOZ_ANDROID_HISTORY=
4249 case "$target_os" in
4252 AC_DEFINE(NS_ENABLE_TSF)
4257 *-android*|*-linuxandroid*)
4258 if test "$CPU_ARCH" = "arm" ; then
4264 MOZ_THEME_FASTSTRIPE=1
4272 MOZ_ARG_ENABLE_STRING(application,
4273 [ --enable-application=APP
4277 tools/update-packaging (AUS-related packaging tools)],
4278 [ MOZ_BUILD_APP=$enableval ] )
4280 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4281 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4282 XULRUNNER_STUB_NAME=$withval)
4284 if test -z "$XULRUNNER_STUB_NAME"; then
4285 case "$target_os" in
4287 XULRUNNER_STUB_NAME=xulrunner
4290 XULRUNNER_STUB_NAME=xulrunner-stub
4293 AC_SUBST(XULRUNNER_STUB_NAME)
4295 AC_MSG_CHECKING([for application to build])
4296 if test -z "$MOZ_BUILD_APP"; then
4297 AC_MSG_RESULT([browser])
4298 MOZ_BUILD_APP=browser
4300 # default mobile to be mobile/xul
4301 if test "$MOZ_BUILD_APP" = "mobile" ; then
4302 MOZ_BUILD_APP=mobile/xul
4304 # We have a valid application only if it has a build.mk file in its top
4306 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4307 AC_MSG_RESULT([none])
4308 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4310 AC_MSG_RESULT([$MOZ_BUILD_APP])
4314 # Allow the application to influence configure with a confvars.sh script.
4316 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4317 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4318 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4319 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4324 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4325 MOZ_ARG_WITH_STRING(app-name,
4326 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4327 WITH_APP_NAME=$withval,
4330 if test -n "$WITH_APP_NAME" ; then
4331 MOZ_APP_NAME="$WITH_APP_NAME"
4334 MOZ_ARG_WITH_STRING(app-basename,
4335 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4336 WITH_APP_BASENAME=$withval,
4339 if test -n "$WITH_APP_BASENAME" ; then
4340 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4343 # Now is a good time to test for logic errors, define mismatches, etc.
4344 case "$MOZ_BUILD_APP" in
4346 if test "$LIBXUL_SDK"; then
4347 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4352 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4353 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4355 case "$MOZ_BUILD_APP" in
4357 AC_DEFINE(MOZ_PHOENIX)
4361 AC_DEFINE(MOZ_XULRUNNER)
4365 AC_SUBST(MOZ_BUILD_APP)
4366 AC_SUBST(MOZ_PHOENIX)
4367 AC_SUBST(MOZ_XULRUNNER)
4369 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4371 dnl ========================================================
4372 dnl Check android sdk version depending on mobile target
4373 dnl ========================================================
4375 if test -z "$gonkdir" ; then
4376 # Minimum Android SDK API Level we require.
4377 case "$MOZ_BUILD_APP" in
4379 android_min_api_level=13
4382 android_min_api_level=14
4386 MOZ_ANDROID_SDK($android_min_api_level)
4389 dnl ========================================================
4391 dnl = Toolkit Options
4393 dnl ========================================================
4394 MOZ_ARG_HEADER(Toolkit Options)
4396 dnl ========================================================
4397 dnl = Select the default toolkit
4398 dnl ========================================================
4399 MOZ_ARG_ENABLE_STRING(default-toolkit,
4400 [ --enable-default-toolkit=TK
4401 Select default toolkit
4402 Platform specific defaults:
4403 Mac OS X - cairo-cocoa
4405 Win32 - cairo-windows
4408 [ _DEFAULT_TOOLKIT=$enableval ],
4409 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4411 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4412 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4413 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4414 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4415 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4416 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4417 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4418 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4419 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4421 dnl nglayout only supports building with one toolkit,
4422 dnl so ignore everything after the first comma (",").
4423 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4425 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4428 MOZ_ARG_WITHOUT_BOOL(x,
4429 [ --without-x Build without X11],
4432 dnl ========================================================
4433 dnl = Enable the toolkit as needed =
4434 dnl ========================================================
4436 case "$MOZ_WIDGET_TOOLKIT" in
4439 MOZ_WIDGET_TOOLKIT=windows
4442 MOZ_INSTRUMENT_EVENT_LOOP=1
4445 cairo-gtk2|cairo-gtk2-x11)
4446 MOZ_WIDGET_TOOLKIT=gtk2
4448 MOZ_ENABLE_XREMOTE=1
4450 MOZ_GL_DEFAULT_PROVIDER=GLX
4456 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4457 TK_LIBS='$(MOZ_GTK2_LIBS)'
4458 AC_DEFINE(MOZ_WIDGET_GTK2)
4459 AC_DEFINE(MOZ_WIDGET_GTK,2)
4461 MOZ_INSTRUMENT_EVENT_LOOP=1
4465 MOZ_WIDGET_TOOLKIT=qt
4467 if test -z "$WITHOUT_X11"; then
4468 MOZ_ENABLE_XREMOTE=1
4469 MOZ_GL_DEFAULT_PROVIDER=GLX
4478 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4479 TK_LIBS='$(MOZ_QT_LIBS)'
4480 AC_DEFINE(MOZ_WIDGET_QT)
4485 MOZ_WIDGET_TOOLKIT=os2
4487 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4488 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4493 MOZ_WIDGET_TOOLKIT=cocoa
4494 AC_DEFINE(MOZ_WIDGET_COCOA)
4495 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4496 TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4497 TK_CFLAGS="-DNO_X11"
4498 CFLAGS="$CFLAGS $TK_CFLAGS"
4499 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4500 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4501 MOZ_USER_DIR="Mozilla"
4502 MOZ_FS_LAYOUT=bundle
4504 MOZ_INSTRUMENT_EVENT_LOOP=1
4508 MOZ_WIDGET_TOOLKIT=uikit
4509 AC_DEFINE(MOZ_WIDGET_UIKIT)
4510 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4511 TK_CFLAGS="-DNO_X11"
4512 TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4513 CFLAGS="$CFLAGS $TK_CFLAGS"
4514 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4515 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4516 MOZ_USER_DIR="Mozilla"
4517 MOZ_FS_LAYOUT=bundle
4521 AC_DEFINE(MOZ_WIDGET_ANDROID)
4522 MOZ_WIDGET_TOOLKIT=android
4523 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4524 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4527 MOZ_INSTRUMENT_EVENT_LOOP=1
4528 if test "$MOZ_BUILD_APP" = "mobile/xul"; then
4534 AC_DEFINE(MOZ_WIDGET_GONK)
4535 AC_DEFINE(MOZ_TOUCH)
4536 MOZ_WIDGET_TOOLKIT=gonk
4537 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4538 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4546 AC_SUBST(MOZ_OLD_LINKER)
4547 AC_SUBST(MOZ_PDF_PRINTING)
4548 if test "$MOZ_PDF_PRINTING"; then
4549 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4550 AC_DEFINE(MOZ_PDF_PRINTING)
4553 if test "$MOZ_ENABLE_XREMOTE"; then
4554 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4557 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4558 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4561 if test "$COMPILE_ENVIRONMENT"; then
4562 if test "$MOZ_ENABLE_GTK2"; then
4563 if test "$MOZ_X11"; then
4564 GDK_PACKAGES=gdk-x11-2.0
4567 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4570 fi # COMPILE_ENVIRONMENT
4572 AC_SUBST(MOZ_FS_LAYOUT)
4574 dnl ========================================================
4575 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4576 dnl their usage and use them in spidermonkey.
4577 dnl ========================================================
4578 MOZ_ARG_WITH_BOOL(arm-kuser,
4579 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4581 if test -n "$USE_ARM_KUSER"; then
4582 AC_DEFINE(USE_ARM_KUSER)
4585 dnl ========================================================
4586 dnl = startup-notification support module
4587 dnl ========================================================
4589 if test "$MOZ_ENABLE_GTK2"
4591 MOZ_ENABLE_STARTUP_NOTIFICATION=
4593 MOZ_ARG_ENABLE_BOOL(startup-notification,
4594 [ --enable-startup-notification
4595 Enable startup-notification support (default: disabled) ],
4596 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4597 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4598 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4600 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4601 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4602 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4603 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4605 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4607 MOZ_ENABLE_STARTUP_NOTIFICATION=
4611 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4612 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4615 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4617 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4618 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4619 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4621 dnl ========================================================
4623 dnl ========================================================
4624 if test "$MOZ_ENABLE_QT"
4626 MOZ_ARG_WITH_STRING(qtdir,
4627 [ --with-qtdir=\$dir Specify Qt directory ],
4630 if test -z "$QTDIR"; then
4631 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
4632 PKG_CHECK_MODULES(MOZ_QT5, QtWidgets QtMultimedia QtPrintSupport,
4635 if test "$MOZ_ENABLE_QT5"; then
4637 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
4638 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
4641 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4642 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4644 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4646 MOZ_QT_CFLAGS="-DQT_SHARED"
4647 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4648 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4649 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4650 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4651 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4652 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4653 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4654 HOST_MOC="$QTDIR/bin/moc"
4655 HOST_RCC="$QTDIR/bin/rcc"
4657 # QtWidgets was introduced only in Qt5
4658 if test -d $QTDIR/include/QtWidgets; then
4659 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4660 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4661 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtWidgets -lQtPrintSupport"
4664 if test -z "$HOST_MOC"; then
4665 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4668 if test -z "$HOST_RCC"; then
4669 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4676 MOZ_ENABLE_QMSYSTEM2=
4677 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4678 MOZ_ENABLE_QMSYSTEM2=1,
4679 MOZ_ENABLE_QMSYSTEM2=)
4681 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4682 MOZ_ENABLE_QMSYSTEM2=1
4683 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4684 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4685 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4688 MOZ_ENABLE_QTNETWORK=
4689 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4690 MOZ_ENABLE_QTNETWORK=1,
4691 MOZ_ENABLE_QTNETWORK=)
4693 if test "$MOZ_ENABLE_QTNETWORK"; then
4694 MOZ_ENABLE_QTNETWORK=1
4695 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4698 MOZ_ENABLE_QTMOBILITY=
4699 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4700 MOZ_ENABLE_QTMOBILITY=1,
4701 MOZ_ENABLE_QTMOBILITY=)
4702 if test "$MOZ_ENABLE_QTMOBILITY"; then
4703 MOZ_ENABLE_QTMOBILITY=1
4704 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4705 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4707 AC_CHECK_LIB(QtSensors, main, [
4708 MOZ_ENABLE_QTMOBILITY=1
4709 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4710 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4711 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4712 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4713 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4716 if test "$MOZ_ENABLE_QTMOBILITY"; then
4717 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4721 AC_SUBST(GTK_CONFIG)
4725 AC_SUBST(MOZ_ENABLE_GTK2)
4726 AC_SUBST(MOZ_ENABLE_QT)
4727 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4728 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4729 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4730 AC_SUBST(MOZ_ENABLE_XREMOTE)
4731 AC_SUBST(MOZ_GTK2_CFLAGS)
4732 AC_SUBST(MOZ_GTK2_LIBS)
4733 AC_SUBST(MOZ_QT_CFLAGS)
4734 AC_SUBST(MOZ_QT_LIBS)
4741 dnl ========================================================
4743 dnl = Components & Features
4745 dnl ========================================================
4746 MOZ_ARG_HEADER(Components and Features)
4748 dnl ========================================================
4750 dnl ========================================================
4751 MOZ_ARG_ENABLE_STRING(ui-locale,
4752 [ --enable-ui-locale=ab-CD
4753 Select the user interface locale (default: en-US)],
4754 MOZ_UI_LOCALE=$enableval )
4755 AC_SUBST(MOZ_UI_LOCALE)
4757 dnl ========================================================
4758 dnl = Trademarked Branding
4759 dnl ========================================================
4760 MOZ_ARG_ENABLE_BOOL(official-branding,
4761 [ --enable-official-branding
4762 Enable Official mozilla.org Branding
4763 Do not distribute builds with
4764 --enable-official-branding unless you have
4765 permission to use trademarks per
4766 http://www.mozilla.org/foundation/trademarks/ .],
4768 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4769 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4771 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4772 MOZ_OFFICIAL_BRANDING=1
4774 ], MOZ_OFFICIAL_BRANDING=)
4776 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4777 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4778 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4781 MOZ_ARG_WITH_STRING(branding,
4782 [ --with-branding=dir Use branding from the specified directory.],
4783 MOZ_BRANDING_DIRECTORY=$withval)
4785 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4786 if test -z "$REAL_BRANDING_DIRECTORY"; then
4787 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4790 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4791 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4794 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4796 dnl ========================================================
4797 dnl = Distribution ID
4798 dnl ========================================================
4799 MOZ_ARG_WITH_STRING(distribution-id,
4800 [ --with-distribution-id=ID
4801 Set distribution-specific id (default=org.mozilla)],
4802 [ val=`echo $withval`
4803 MOZ_DISTRIBUTION_ID="$val"])
4805 if test -z "$MOZ_DISTRIBUTION_ID"; then
4806 MOZ_DISTRIBUTION_ID="org.mozilla"
4809 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4810 AC_SUBST(MOZ_DISTRIBUTION_ID)
4813 dnl ========================================================
4814 dnl complex text support off by default
4815 dnl ========================================================
4816 MOZ_ARG_DISABLE_BOOL(pango,
4817 [ --disable-pango Disable usage of Pango ],
4821 dnl ========================================================
4823 dnl ========================================================
4824 if test "$MOZ_ENABLE_GTK2"
4828 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4830 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4831 AC_SUBST(MOZ_PANGO_CFLAGS)
4832 AC_SUBST(MOZ_PANGO_LIBS)
4833 if test "$MOZ_PANGO"
4835 AC_DEFINE(MOZ_PANGO)
4837 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
4838 AC_SUBST(FT2_CFLAGS)
4843 if test "$MOZ_ENABLE_QT"
4845 if test "$MOZ_PANGO"
4847 PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION],
4849 AC_SUBST(MOZ_PANGO_CFLAGS)
4850 AC_SUBST(MOZ_PANGO_LIBS)
4851 AC_DEFINE(MOZ_PANGO)
4854 echo "Pango library not found, will use FT2 font engine"
4861 dnl ========================================================
4862 dnl = GnomeVFS, GIO and GConf support module
4863 dnl ========================================================
4867 dnl build the gnomevfs extension by default only when the
4868 dnl GTK2 toolkit is in use.
4869 if test "$MOZ_ENABLE_GTK2"
4871 MOZ_ENABLE_GNOMEVFS=1
4875 dnl ========================================================
4876 dnl = GnomeVFS support module
4877 dnl ========================================================
4878 MOZ_ARG_DISABLE_BOOL(gnomevfs,
4879 [ --disable-gnomevfs Disable GnomeVFS support ],
4880 MOZ_ENABLE_GNOMEVFS=,
4881 MOZ_ENABLE_GNOMEVFS=force)
4883 if test "$MOZ_ENABLE_GNOMEVFS"
4885 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4886 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4887 MOZ_ENABLE_GNOMEVFS=1
4888 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4890 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4892 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4894 MOZ_ENABLE_GNOMEVFS=
4897 if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
4898 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4899 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4904 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4905 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4906 AC_SUBST(MOZ_GNOMEVFS_LIBS)
4908 dnl ========================================================
4909 dnl = GIO support module
4910 dnl ========================================================
4911 MOZ_ARG_ENABLE_BOOL(gio,
4912 [ --enable-gio Enable GIO support (default: disabled)],
4913 MOZ_ENABLE_GIO=force,
4916 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
4918 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4919 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4920 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4921 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4923 AC_DEFINE(MOZ_ENABLE_GIO)
4925 if test "$MOZ_ENABLE_GIO" = "force"
4927 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4933 AC_SUBST(MOZ_ENABLE_GIO)
4934 AC_SUBST(MOZ_GIO_CFLAGS)
4935 AC_SUBST(MOZ_GIO_LIBS)
4937 dnl ========================================================
4938 dnl = GConf support module
4939 dnl ========================================================
4940 MOZ_ARG_DISABLE_BOOL(gconf,
4941 [ --disable-gconf Disable Gconf support ],
4943 MOZ_ENABLE_GCONF=force)
4945 if test "$MOZ_ENABLE_GCONF"
4947 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4948 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4951 if test "$MOZ_ENABLE_GCONF" = "force"
4953 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4959 if test "$MOZ_ENABLE_GCONF"; then
4960 AC_DEFINE(MOZ_ENABLE_GCONF)
4963 AC_SUBST(MOZ_ENABLE_GCONF)
4964 AC_SUBST(MOZ_GCONF_CFLAGS)
4965 AC_SUBST(MOZ_GCONF_LIBS)
4968 dnl ========================================================
4969 dnl = libproxy support
4970 dnl ========================================================
4972 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4974 MOZ_ENABLE_LIBPROXY=
4976 MOZ_ARG_ENABLE_BOOL(libproxy,
4977 [ --enable-libproxy Enable libproxy support ],
4978 MOZ_ENABLE_LIBPROXY=1,
4979 MOZ_ENABLE_LIBPROXY=)
4981 if test "$MOZ_ENABLE_LIBPROXY"
4983 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4984 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4987 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4988 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
4989 AC_SUBST(MOZ_LIBPROXY_LIBS)
4991 dnl ========================================================
4992 dnl = libnotify support
4993 dnl ========================================================
4995 if test "$MOZ_ENABLE_GTK2"
4997 MOZ_ENABLE_LIBNOTIFY=1
4999 MOZ_ARG_DISABLE_BOOL(libnotify,
5000 [ --disable-libnotify Disable libnotify support ],
5001 MOZ_ENABLE_LIBNOTIFY=,
5002 MOZ_ENABLE_LIBNOTIFY=1)
5004 if test "$MOZ_ENABLE_LIBNOTIFY"
5006 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5010 if test -z "$SKIP_LIBRARY_CHECKS"
5012 if test "$MOZ_ENABLE_GTK2"
5014 if test "$MOZ_ENABLE_LIBNOTIFY"
5016 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5020 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5021 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5022 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5024 dnl ========================================================
5025 dnl = GNOME component (mozgnome)
5026 dnl ========================================================
5028 # The GNOME component is built if one of
5029 # gnome-vfs, gio, gconf or libnotify is available.
5030 if test "$MOZ_ENABLE_GCONF" -o \
5031 "$MOZ_ENABLE_GNOMEVFS" -o \
5032 "$MOZ_ENABLE_GIO" -o \
5033 "$MOZ_ENABLE_LIBNOTIFY"; then
5034 MOZ_ENABLE_GNOME_COMPONENT=1
5036 MOZ_ENABLE_GNOME_COMPONENT=
5038 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5040 dnl ========================================================
5041 dnl = libgnomeui support module
5042 dnl ========================================================
5044 if test "$MOZ_ENABLE_GTK2"
5046 MOZ_ENABLE_GNOMEUI=1
5048 MOZ_ARG_DISABLE_BOOL(gnomeui,
5049 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5050 MOZ_ENABLE_GNOMEUI=,
5051 MOZ_ENABLE_GNOMEUI=force)
5053 if test "$MOZ_ENABLE_GNOMEUI"
5055 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5057 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5058 MOZ_ENABLE_GNOMEUI=1
5060 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5062 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5068 if test "$MOZ_ENABLE_GNOMEUI"; then
5069 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5073 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5074 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5075 AC_SUBST(MOZ_GNOMEUI_LIBS)
5077 dnl ========================================================
5079 dnl ========================================================
5081 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5085 MOZ_ARG_DISABLE_BOOL(dbus,
5086 [ --disable-dbus Disable dbus support ],
5090 if test "$MOZ_ENABLE_DBUS"
5092 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5093 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5094 AC_DEFINE(MOZ_ENABLE_DBUS)
5097 AC_SUBST(MOZ_ENABLE_DBUS)
5098 AC_SUBST(MOZ_DBUS_CFLAGS)
5099 AC_SUBST(MOZ_DBUS_LIBS)
5100 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5101 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5103 dnl ========================================================
5104 dnl = Enable Android History instead of Places
5105 dnl ========================================================
5106 if test -n "$MOZ_ANDROID_HISTORY"; then
5107 dnl Do this if defined in confvars.sh
5108 AC_DEFINE(MOZ_ANDROID_HISTORY)
5112 dnl ========================================================
5113 dnl = Build with the Android Java compositor
5114 dnl ========================================================
5115 if test -n "$MOZ_JAVA_COMPOSITOR"; then
5116 dnl Do this if defined in confvars.sh
5117 AC_DEFINE(MOZ_JAVA_COMPOSITOR)
5120 dnl ========================================================
5121 dnl = Disable WebSMS backend
5122 dnl ========================================================
5123 MOZ_ARG_DISABLE_BOOL(websms-backend,
5124 [ --disable-websms-backend
5125 Disable WebSMS backend],
5126 MOZ_WEBSMS_BACKEND=,
5127 MOZ_WEBSMS_BACKEND=1)
5129 if test -n "$MOZ_WEBSMS_BACKEND"; then
5130 AC_DEFINE(MOZ_WEBSMS_BACKEND)
5133 dnl ========================================================
5134 dnl = Build Personal Security Manager
5135 dnl ========================================================
5136 MOZ_ARG_DISABLE_BOOL(crypto,
5137 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5141 dnl ========================================================
5142 dnl = JS Debugger XPCOM component (js/jsd)
5143 dnl ========================================================
5144 MOZ_ARG_DISABLE_BOOL(jsd,
5145 [ --disable-jsd Disable JavaScript debug library],
5150 dnl ========================================================
5151 dnl = Enable IPDL's "expensive" unit tests
5152 dnl ========================================================
5155 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5156 [ --enable-ipdl-tests Enable expensive IPDL tests],
5160 if test -n "$MOZ_IPDL_TESTS"; then
5161 AC_DEFINE(MOZ_IPDL_TESTS)
5164 AC_SUBST(MOZ_IPDL_TESTS)
5166 dnl ========================================================
5167 dnl = Turns off code necessary for e10s compatibility
5168 dnl ========================================================
5169 dnl This is a temporary flag to be removed in bug 662601 when
5170 dnl it's no longer needed
5174 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5175 [ --enable-e10s-compat Turns off code for e10s compat],
5179 if test -n "$MOZ_E10S_COMPAT"; then
5180 AC_DEFINE(MOZ_E10S_COMPAT)
5183 dnl ========================================================
5184 dnl = Disable building dbm
5185 dnl ========================================================
5186 MOZ_ARG_DISABLE_BOOL(dbm,
5187 [ --disable-dbm Disable building dbm],
5191 dnl bi-directional support always on
5195 dnl ========================================================
5196 dnl accessibility support on by default on all platforms
5197 dnl ========================================================
5198 MOZ_ARG_DISABLE_BOOL(accessibility,
5199 [ --disable-accessibility Disable accessibility support],
5202 if test "$ACCESSIBILITY"; then
5203 AC_DEFINE(ACCESSIBILITY)
5206 dnl ========================================================
5207 dnl Disable printing
5208 dnl ========================================================
5209 MOZ_ARG_DISABLE_BOOL(printing,
5210 [ --disable-printing Disable printing support],
5214 if test "$NS_PRINTING"; then
5215 AC_DEFINE(NS_PRINTING)
5216 AC_DEFINE(NS_PRINT_PREVIEW)
5219 dnl Turn off webrtc for OS's we don't handle yet, but allow
5220 dnl --enable-webrtc to override. Can disable for everything in
5221 dnl the master list above.
5222 if test -n "$MOZ_WEBRTC"; then
5224 *-android*|*-linuxandroid*)
5225 dnl Make sure doesn't get matched by *-linux*
5228 *-linux*|*-mingw*|*-darwin*)
5232 dnl default to disabled for all others
5238 dnl ========================================================
5239 dnl = Disable WebRTC code
5240 dnl ========================================================
5241 MOZ_ARG_DISABLE_BOOL(webrtc,
5242 [ --disable-webrtc Disable support for WebRTC],
5246 if test -n "$MOZ_WEBRTC"; then
5247 AC_DEFINE(MOZ_WEBRTC)
5252 MOZ_VP8_ERROR_CONCEALMENT=1
5255 AC_SUBST(MOZ_WEBRTC)
5257 dnl ========================================================
5258 dnl = Enable Raw Codecs
5259 dnl ========================================================
5260 MOZ_ARG_ENABLE_BOOL(raw,
5261 [ --enable-raw Enable support for RAW media],
5265 if test -n "$MOZ_RAW"; then
5272 dnl ========================================================
5273 dnl = Disable Ogg Codecs
5274 dnl ========================================================
5275 MOZ_ARG_DISABLE_BOOL(ogg,
5276 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5280 if test -n "$MOZ_OGG"; then
5285 case "$target_cpu" in
5294 dnl Checks for __attribute__(aligned()) directive
5295 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5296 [ac_cv_c_attribute_aligned],
5297 [ac_cv_c_attribute_aligned=0
5298 CFLAGS_save="${CFLAGS}"
5299 CFLAGS="${CFLAGS} -Werror"
5300 for ac_cv_c_attr_align_try in 64 32 16 8; do
5301 echo "trying $ac_cv_c_attr_align_try"
5303 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5304 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5305 if test "$ac_cv_c_attribute_aligned" != 0; then
5309 CFLAGS="${CFLAGS_save}"])
5310 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5311 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5312 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5316 dnl ========================================================
5317 dnl = Disable Opus audio codec support
5318 dnl ========================================================
5319 MOZ_ARG_DISABLE_BOOL(opus,
5320 [ --disable-opus Disable support for Opus audio],
5324 dnl ========================================================
5325 dnl = Disable VP8 decoder support
5326 dnl ========================================================
5327 MOZ_ARG_DISABLE_BOOL(webm,
5328 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5332 if test -n "$MOZ_WEBM"; then
5337 dnl ========================================================
5338 dnl = Disable media plugin support
5339 dnl ========================================================
5340 MOZ_ARG_ENABLE_BOOL(media-plugins,
5341 [ --enable-media-plugins Enable support for media plugins],
5342 MOZ_MEDIA_PLUGINS=1,
5345 if test -n "$MOZ_MEDIA_PLUGINS"; then
5346 AC_DEFINE(MOZ_MEDIA_PLUGINS)
5349 dnl ========================================================
5350 dnl = Enable getUserMedia support
5351 dnl ========================================================
5352 MOZ_ARG_ENABLE_BOOL(media-navigator,
5353 [ --enable-media-navigator Enable support for getUserMedia],
5354 MOZ_MEDIA_NAVIGATOR=1,
5355 MOZ_MEDIA_NAVIGATOR=)
5357 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5358 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5361 dnl ========================================================
5362 dnl = Enable building OMX media plugin (B2G)
5363 dnl ========================================================
5364 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5365 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5369 if test -n "$MOZ_OMX_PLUGIN"; then
5370 if test "$OS_TARGET" = "Android" -a -n "$gonkdir"; then
5371 dnl Only allow building OMX plugin on Gonk (B2G)
5372 AC_DEFINE(MOZ_OMX_PLUGIN)
5374 dnl fail if we're not building on Gonk
5375 AC_MSG_ERROR([OMX media plugin can only be built on B2G])
5379 dnl system libvpx Support
5380 dnl ========================================================
5381 MOZ_ARG_WITH_BOOL(system-libvpx,
5382 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5383 MOZ_NATIVE_LIBVPX=1)
5385 MOZ_LIBVPX_INCLUDES=
5388 if test -n "$MOZ_VP8"; then
5390 if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5391 AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5393 if test -n "$MOZ_VP8_ENCODER" ; then
5394 AC_DEFINE(MOZ_VP8_ENCODER)
5397 if test -n "$MOZ_NATIVE_LIBVPX"; then
5398 dnl ============================
5399 dnl === libvpx Version check ===
5400 dnl ============================
5401 dnl Check to see if we have a system libvpx package.
5402 PKG_CHECK_MODULES(LIBVPX, vpx >= 1.0.0)
5404 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5405 [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.])])
5407 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5408 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5412 AC_SUBST(MOZ_NATIVE_LIBVPX)
5413 AC_SUBST(MOZ_LIBVPX_INCLUDES)
5414 AC_SUBST(MOZ_LIBVPX_LIBS)
5416 if test "$MOZ_WEBM"; then
5420 case "$target_cpu" in
5430 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5432 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5433 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5434 dnl We currently require gcc on all arm platforms.
5437 VPX_NEED_OBJ_INT_EXTRACT=
5439 dnl See if we have assembly on this platform.
5440 case "$OS_ARCH:$CPU_ARCH" in
5442 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5446 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5450 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5454 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5458 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5462 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5466 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5470 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5474 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5478 dnl Check for yasm 1.1 or greater.
5479 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5480 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.])
5481 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5482 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.])
5484 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5486 dnl The encoder needs obj_int_extract to get asm offsets.
5490 if test -n "$GNU_AS" ; then
5492 dnl These flags are a lie; they're just used to enable the requisite
5493 dnl opcodes; actual arch detection is done at runtime.
5494 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5495 VPX_DASH_C_FLAG="-c"
5496 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5497 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5502 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5503 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.])
5506 if test -n "$MOZ_VP8_ENCODER" -a \
5507 -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5508 dnl We prefer to get asm offsets using inline assembler, which the above
5509 dnl compilers can do. When we're not using one of those, we have to fall
5510 dnl back to obj_int_extract, which reads them from a compiled object
5511 dnl file. Unfortunately, that only works if we're compiling on a system
5512 dnl with the header files for the appropriate object file format.
5513 VPX_NEED_OBJ_INT_EXTRACT=1
5516 if test -n "$VPX_X86_ASM"; then
5517 AC_DEFINE(VPX_X86_ASM)
5518 elif test -n "$VPX_ARM_ASM"; then
5519 AC_DEFINE(VPX_ARM_ASM)
5521 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5525 dnl ========================================================
5526 dnl = Disable Wave decoder support
5527 dnl ========================================================
5528 MOZ_ARG_DISABLE_BOOL(wave,
5529 [ --disable-wave Disable Wave decoder support],
5533 if test -n "$MOZ_WAVE"; then
5540 dnl ========================================================
5541 dnl = Handle dependent SYDNEYAUDIO, CUBEB, and MEDIA defines
5542 dnl ========================================================
5544 if test -n "$MOZ_SYDNEYAUDIO"; then
5545 AC_DEFINE(MOZ_SYDNEYAUDIO)
5548 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5549 AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5552 if test -n "$MOZ_CUBEB"; then
5554 *-android*|*-linuxandroid*)
5555 dnl No Android implementation of libcubeb yet.
5558 AC_DEFINE(MOZ_CUBEB)
5561 AC_DEFINE(MOZ_CUBEB)
5564 AC_DEFINE(MOZ_CUBEB)
5567 AC_DEFINE(MOZ_CUBEB)
5570 dnl Other targets will be enabled soon.
5575 if test -n "$MOZ_MEDIA"; then
5576 AC_DEFINE(MOZ_MEDIA)
5579 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5580 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/])
5583 if test -n "$MOZ_VORBIS"; then
5584 AC_DEFINE(MOZ_VORBIS)
5587 if test -n "$MOZ_TREMOR"; then
5588 AC_DEFINE(MOZ_TREMOR)
5591 if test -n "$MOZ_OPUS"; then
5595 dnl ========================================================
5596 dnl = Check alsa availability on Linux if using sydneyaudio
5597 dnl ========================================================
5599 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5600 if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
5601 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5602 [echo "$MOZ_ALSA_PKG_ERRORS"
5603 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.)])])
5606 dnl ========================================================
5607 dnl = Enable GStreamer
5608 dnl ========================================================
5609 MOZ_ARG_ENABLE_BOOL(gstreamer,
5610 [ --enable-gstreamer Enable GStreamer support],
5614 if test "$MOZ_GSTREAMER"; then
5615 # API version, eg 0.10, 1.0 etc
5616 GST_API_VERSION=0.10
5617 # core/base release number
5618 # depend on >= 0.10.33 as that's when the playbin2 source-setup signal was
5621 PKG_CHECK_MODULES(GSTREAMER,
5622 gstreamer-$GST_API_VERSION >= $GST_VERSION
5623 gstreamer-app-$GST_API_VERSION
5624 gstreamer-plugins-base-$GST_API_VERSION)
5625 if test -n "$GSTREAMER_LIBS"; then
5626 _SAVE_LDFLAGS=$LDFLAGS
5627 LDFLAGS="$LDFLAGS -lgstvideo-$GST_API_VERSION"
5628 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5629 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5630 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5632 AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
5634 LDFLAGS=$_SAVE_LDFLAGS
5636 AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
5639 AC_SUBST(GSTREAMER_CFLAGS)
5640 AC_SUBST(GSTREAMER_LIBS)
5641 AC_SUBST(MOZ_GSTREAMER)
5643 if test -n "$MOZ_GSTREAMER"; then
5644 AC_DEFINE(MOZ_GSTREAMER)
5649 dnl ========================================================
5650 dnl Permissions System
5651 dnl ========================================================
5652 MOZ_ARG_DISABLE_BOOL(permissions,
5653 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5658 dnl ========================================================
5660 dnl ========================================================
5661 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5662 [ --disable-negotiateauth Disable GSS-API negotiation ],
5663 MOZ_AUTH_EXTENSION=,
5664 MOZ_AUTH_EXTENSION=1 )
5666 dnl ========================================================
5668 dnl ========================================================
5669 MOZ_ARG_DISABLE_BOOL(xtf,
5670 [ --disable-xtf Disable XTF (pluggable xml tags) support],
5673 if test "$MOZ_XTF"; then
5677 dnl ========================================================
5678 dnl Pref extensions (autoconfig)
5679 dnl ========================================================
5680 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5681 [ --disable-pref-extensions
5682 Disable pref extensions such as autoconfig],
5683 MOZ_PREF_EXTENSIONS=,
5684 MOZ_PREF_EXTENSIONS=1 )
5686 dnl ========================================================
5687 dnl Searching of system directories for extensions.
5688 dnl Note: this switch is meant to be used for test builds
5689 dnl whose behavior should not depend on what happens to be
5690 dnl installed on the local machine.
5691 dnl ========================================================
5692 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5693 [ --disable-system-extension-dirs
5694 Disable searching system- and account-global
5695 directories for extensions of any kind; use
5696 only profile-specific extension directories],
5697 ENABLE_SYSTEM_EXTENSION_DIRS=,
5698 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5699 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5700 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5703 dnl ========================================================
5704 dnl = Universalchardet
5705 dnl ========================================================
5706 MOZ_ARG_DISABLE_BOOL(universalchardet,
5707 [ --disable-universalchardet
5708 Disable universal encoding detection],
5709 MOZ_UNIVERSALCHARDET=,
5710 MOZ_UNIVERSALCHARDET=1 )
5712 if test -n "${JAVA_BIN_PATH}"; then
5713 dnl Look for javac and jar in the specified path.
5714 JAVA_PATH="$JAVA_BIN_PATH"
5716 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5717 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5720 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5721 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5722 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5724 if test -n "${JAVA_BIN_PATH}" -o \
5725 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5726 if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5727 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}])
5731 dnl ========================================================
5732 dnl = ANGLE OpenGL->D3D translator for WebGL
5733 dnl = * only applies to win32
5734 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5735 dnl ========================================================
5737 MOZ_DIRECTX_SDK_PATH=
5738 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5741 MOZ_D3DCOMPILER_CAB=
5743 MOZ_D3DCOMPILER_DLL=
5744 case "$target_os" in
5746 MOZ_ANGLE_RENDERER=1
5750 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5751 case "${target_cpu}" in
5753 MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5756 MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5760 MOZ_ARG_DISABLE_BOOL(webgl,
5761 [ --disable-webgl Disable building of the WebGL implementation],
5762 MOZ_WEBGL_DISABLED=1,
5763 MOZ_WEBGL_DISABLED=)
5765 if test -n "$MOZ_WEBGL_DISABLED"; then
5770 if test -n "$MOZ_ANGLE_RENDERER"; then
5771 # Get the SDK path from the registry.
5772 # First try to get the June 2010 SDK
5773 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5774 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5775 # Otherwise just take whatever comes first
5776 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5779 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5780 AC_MSG_ERROR([Found the February 2010 DirectX SDK. Need the June 2010 DirectX SDK, or newer. Upgrade your SDK or reconfigure with --disable-webgl.])
5782 MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/'`
5785 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5786 test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5787 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5788 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5790 AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for WebGL. Either install it (June 2010 version or newer), or reconfigure with --disable-webgl.])
5793 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5794 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'`
5796 if test -z "$MOZ_D3DX9_VERSION" ; then
5797 AC_MSG_ERROR([Couldn't determine the D3DX9 version, needed for WebGL. Either reinstall the DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5800 MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5801 MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5803 MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
5804 MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5807 dnl ========================================================
5808 dnl = Breakpad crash reporting (on by default on supported platforms)
5809 dnl ========================================================
5812 i?86-*-mingw*|x86_64-*-mingw*)
5815 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
5818 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5819 if test "$MOZ_ENABLE_GTK2"; then
5823 *-android*|*-linuxandroid*)
5831 MOZ_ARG_DISABLE_BOOL(crashreporter,
5832 [ --disable-crashreporter Disable breakpad crash reporting],
5834 MOZ_CRASHREPORTER=1)
5836 if test -n "$MOZ_CRASHREPORTER"; then
5837 AC_DEFINE(MOZ_CRASHREPORTER)
5839 if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
5840 test -z "$SKIP_LIBRARY_CHECKS"; then
5841 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5842 AC_SUBST(MOZ_GTHREAD_CFLAGS)
5843 AC_SUBST(MOZ_GTHREAD_LIBS)
5845 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.])])
5848 if (test "$OS_ARCH" != "$HOST_OS_ARCH"); then
5849 AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH. Use --disable-crashreporter.])
5852 if test "$OS_ARCH" == "WINNT" -a -z "$HAVE_64BIT_OS"; then
5853 MOZ_CRASHREPORTER_INJECTOR=1
5854 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5858 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5859 [ --with-crashreporter-enable-percent=NN
5860 Enable sending crash reports by default on NN% of users. (default=100)],
5861 [ val=`echo $withval | sed 's/[^0-9]//g'`
5862 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5864 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5865 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5867 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5869 dnl ========================================================
5870 dnl = libjpeg-turbo configuration
5871 dnl ========================================================
5873 if test -z "$MOZ_NATIVE_JPEG"; then
5877 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5878 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
5880 MOZ_LIBJPEG_TURBO=1)
5882 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
5883 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
5886 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
5889 if test -n "$MOZ_LIBJPEG_TURBO"; then
5891 dnl Do we support libjpeg-turbo on this platform?
5892 case "$OS_ARCH:$OS_TEST" in
5893 Linux:x86|Linux:i?86)
5894 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
5895 LIBJPEG_TURBO_X86_ASM=1
5898 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
5899 LIBJPEG_TURBO_X64_ASM=1
5902 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
5903 LIBJPEG_TURBO_X86_ASM=1
5906 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
5907 LIBJPEG_TURBO_X64_ASM=1
5910 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
5911 LIBJPEG_TURBO_X86_ASM=1
5914 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
5915 LIBJPEG_TURBO_X64_ASM=1
5917 WINNT:x86|WINNT:i?86)
5918 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
5919 LIBJPEG_TURBO_X86_ASM=1
5922 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
5923 LIBJPEG_TURBO_X64_ASM=1
5926 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
5927 LIBJPEG_TURBO_ARM_ASM=1
5933 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
5934 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
5935 dnl it doesn't exist or we have too old of a version.
5936 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
5937 AC_MSG_CHECKING([for Yasm assembler])
5938 AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
5940 if test -z "$LIBJPEG_TURBO_AS" ; then
5941 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.])
5944 dnl Check that we have the right yasm version. We require 1.0.1 or newer
5945 dnl on Linux and 1.1 or newer everywhere else.
5946 if test "$OS_ARCH" = "Linux" ; then
5947 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
5948 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.])
5951 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5952 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.])
5957 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
5958 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
5959 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
5960 echo "Using $AS as the assembler for ARM code."
5961 LIBJPEG_TURBO_AS=$AS
5964 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
5965 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
5966 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
5967 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
5968 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
5969 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
5970 elif test -n "$MOZ_LIBJPEG_TURBO"; then
5971 dnl Warn if we're not building the optimized routines, even though the user
5972 dnl didn't specify --disable-libjpeg-turbo.
5973 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
5976 dnl ========================================================
5977 dnl = Enable compilation of specific extension modules
5978 dnl ========================================================
5980 MOZ_ARG_ENABLE_STRING(extensions,
5981 [ --enable-extensions Enable extensions],
5982 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5983 if test "$option" = "yes" -o "$option" = "all"; then
5984 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5985 elif test "$option" = "no" -o "$option" = "none"; then
5987 elif test "$option" = "default"; then
5988 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5989 elif test `echo "$option" | grep -c \^-` != 0; then
5990 option=`echo $option | sed 's/^-//'`
5991 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5993 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5996 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5998 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5999 # Suppress warning on non-X11 platforms
6000 if test -n "$MOZ_X11"; then
6001 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6003 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6006 dnl Do not build gnomevfs with libxul based apps
6007 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6008 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6011 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6012 # Suppress warning on non-X11 platforms
6013 if test -n "$MOZ_X11"; then
6014 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6016 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6019 dnl Do not build gio with libxul based apps
6020 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6021 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6024 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6025 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6026 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6029 dnl xforms requires xtf
6030 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6031 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
6032 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6036 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6038 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6039 dnl when trying to build a nonexistent extension.
6040 for extension in $MOZ_EXTENSIONS; do
6041 if test ! -d "${srcdir}/extensions/${extension}"; then
6042 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6046 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6047 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6050 dnl ========================================================
6051 dnl CSS3 Flexbox Support
6052 dnl ========================================================
6053 if test -n "$MOZ_FLEXBOX"; then
6054 AC_DEFINE(MOZ_FLEXBOX)
6057 dnl ========================================================
6058 dnl SVG Display Lists
6059 dnl ========================================================
6060 if test -n "$MOZ_SVG_DLISTS"; then
6061 AC_DEFINE(MOZ_SVG_DLISTS)
6064 dnl ========================================================
6065 dnl Build Freetype in the tree
6066 dnl ========================================================
6067 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6068 [ --enable-tree-freetype Enable Tree FreeType],
6069 MOZ_TREE_FREETYPE=1,
6070 MOZ_TREE_FREETYPE= )
6071 if test -n "$MOZ_TREE_FREETYPE"; then
6072 if test -n "$_WIN32_MSVC"; then
6073 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6075 AC_DEFINE(MOZ_TREE_FREETYPE)
6076 AC_SUBST(MOZ_TREE_FREETYPE)
6077 MOZ_ENABLE_CAIRO_FT=1
6078 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6079 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6080 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6081 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6083 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6084 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6085 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6086 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6087 AC_SUBST(CAIRO_FT_CFLAGS)
6090 dnl ========================================================
6092 dnl ========================================================
6093 dnl Abort Windows build if the required major version and
6094 dnl minimum minor version of Unicode NSIS isn't in the path
6095 dnl (unless in case of cross compiling, for which Unicode
6096 dnl is not yet sufficient).
6097 if test "$OS_ARCH" = "WINNT"; then
6098 REQ_NSIS_MAJOR_VER=2
6099 MIN_NSIS_MINOR_VER=33
6100 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6101 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6102 AC_MSG_RESULT([yes])
6104 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6106 if test ! "$MAKENSISU_VER" = ""; then
6107 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6108 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6110 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6111 if test "$MAKENSISU_VER" = "" || \
6112 test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6113 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6115 if test -z "$CROSS_COMPILE"; then
6116 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.])
6121 elif test -z "$CROSS_COMPILE"; then
6122 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.])
6128 dnl ========================================================
6130 dnl ========================================================
6131 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6132 [ --disable-webapp-runtime Disable Web App Runtime],
6133 MOZ_WEBAPP_RUNTIME=,
6134 MOZ_WEBAPP_RUNTIME=1)
6135 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6138 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6141 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6142 if test "$MOZ_WEBAPP_RUNTIME"; then
6143 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6146 AC_MSG_CHECKING([for tar archiver])
6147 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6148 if test -z "$TAR"; then
6149 AC_MSG_ERROR([no tar archiver found in \$PATH])
6151 AC_MSG_RESULT([$TAR])
6154 AC_MSG_CHECKING([for wget])
6155 AC_CHECK_PROGS(WGET, wget, "")
6156 AC_MSG_RESULT([$WGET])
6159 dnl ========================================================
6161 dnl ========================================================
6163 if test -n "$MOZ_SIGN_CMD"; then
6164 AC_DEFINE(MOZ_SIGNING)
6167 dnl ========================================================
6168 dnl Maintenance Service
6169 dnl ========================================================
6171 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6172 [ --enable-maintenance-service Enable building of maintenanceservice],
6173 MOZ_MAINTENANCE_SERVICE=1,
6174 MOZ_MAINTENANCE_SERVICE= )
6176 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6177 if test "$OS_ARCH" = "WINNT"; then
6178 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6180 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6184 dnl ========================================================
6185 dnl Verify MAR signatures
6186 dnl ========================================================
6188 MOZ_ARG_ENABLE_BOOL(verify-mar,
6189 [ --enable-verify-mar Enable verifying MAR signatures],
6190 MOZ_VERIFY_MAR_SIGNATURE=1,
6191 MOZ_VERIFY_MAR_SIGNATURE= )
6193 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6194 if test "$OS_ARCH" = "WINNT"; then
6195 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6197 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6201 dnl ========================================================
6202 dnl Enable building the signmar program.
6203 dnl This option is much different than the --enable-verify-mar option.
6204 dnl --enable-verify-mar is for enabling the verification check on MAR
6205 dnl files in the updater. The --enable-signmar option is for building
6206 dnl the signmar program.
6207 dnl ========================================================
6209 MOZ_ARG_ENABLE_BOOL(signmar,
6210 [ --enable-signmar Enable building the signmar program],
6211 MOZ_ENABLE_SIGNMAR=1,
6212 MOZ_ENABLE_SIGNMAR= )
6214 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6215 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6218 dnl ========================================================
6220 dnl ========================================================
6222 MOZ_ARG_DISABLE_BOOL(updater,
6223 [ --disable-updater Disable building of updater],
6227 if test -n "$MOZ_UPDATER"; then
6228 AC_DEFINE(MOZ_UPDATER)
6231 # app update channel is 'default' when not supplied.
6232 MOZ_ARG_ENABLE_STRING([update-channel],
6233 [ --enable-update-channel=CHANNEL
6234 Select application update channel (default=default)],
6235 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6237 if test -z "$MOZ_UPDATE_CHANNEL"; then
6238 MOZ_UPDATE_CHANNEL=default
6240 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6241 AC_SUBST(MOZ_UPDATE_CHANNEL)
6243 # tools/update-packaging is not checked out by default.
6244 MOZ_ARG_ENABLE_BOOL(update-packaging,
6245 [ --enable-update-packaging
6246 Enable tools/update-packaging],
6247 MOZ_UPDATE_PACKAGING=1,
6248 MOZ_UPDATE_PACKAGING= )
6249 AC_SUBST(MOZ_UPDATE_PACKAGING)
6251 dnl ========================================================
6252 dnl build the tests by default
6253 dnl ========================================================
6254 MOZ_ARG_DISABLE_BOOL(tests,
6255 [ --disable-tests Do not build test libraries & programs],
6259 dnl ========================================================
6260 dnl parental controls (for Windows Vista)
6261 dnl ========================================================
6262 MOZ_ARG_DISABLE_BOOL(parental-controls,
6263 [ --disable-parental-controls
6264 Do not build parental controls],
6265 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6266 MOZ_DISABLE_PARENTAL_CONTROLS=)
6267 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6268 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6271 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6273 dnl ========================================================
6274 dnl = Disable DOMCrypto
6275 dnl ========================================================
6276 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6277 AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6280 dnl ========================================================
6282 dnl = Module specific options
6284 dnl ========================================================
6285 MOZ_ARG_HEADER(Individual module options)
6287 dnl ========================================================
6288 dnl = Disable feed handling components
6289 dnl ========================================================
6290 MOZ_ARG_DISABLE_BOOL(feeds,
6291 [ --disable-feeds Disable feed handling and processing components],
6294 if test -n "$MOZ_FEEDS"; then
6295 AC_DEFINE(MOZ_FEEDS)
6297 if test "$MOZ_BUILD_APP" = "browser"; then
6298 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6302 dnl ========================================================
6303 dnl Check for sqlite
6304 dnl ========================================================
6307 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6308 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6309 MOZ_NATIVE_SQLITE=1,
6310 MOZ_NATIVE_SQLITE= )
6312 if test -z "$MOZ_NATIVE_SQLITE"
6315 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6317 dnl ============================
6318 dnl === SQLite Version check ===
6319 dnl ============================
6320 dnl Check to see if the system SQLite package is new enough.
6321 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6323 dnl ==================================
6324 dnl === SQLITE_SECURE_DELETE check ===
6325 dnl ==================================
6326 dnl Check to see if the system SQLite package is compiled with
6327 dnl SQLITE_SECURE_DELETE enabled.
6328 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6329 _SAVE_CFLAGS="$CFLAGS"
6330 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6332 LIBS="$LIBS $SQLITE_LIBS"
6333 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6335 #include "sqlite3.h"
6337 int main(int argc, char **argv){
6338 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6340 ac_cv_sqlite_secure_delete=yes,
6341 ac_cv_sqlite_secure_delete=no,
6342 ac_cv_sqlite_secure_delete=no
6345 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6346 CFLAGS="$_SAVE_CFLAGS"
6348 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6349 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6352 dnl ===============================
6353 dnl === SQLITE_THREADSAFE check ===
6354 dnl ===============================
6355 dnl Check to see if the system SQLite package is compiled with
6356 dnl SQLITE_THREADSAFE enabled.
6357 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6358 _SAVE_CFLAGS="$CFLAGS"
6359 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6361 LIBS="$LIBS $SQLITE_LIBS"
6362 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6364 #include "sqlite3.h"
6366 int main(int argc, char **argv){
6367 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6369 ac_cv_sqlite_threadsafe=yes,
6370 ac_cv_sqlite_threadsafe=no,
6371 ac_cv_sqlite_threadsafe=no
6374 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6375 CFLAGS="$_SAVE_CFLAGS"
6377 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6378 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6381 dnl ================================
6382 dnl === SQLITE_ENABLE_FTS3 check ===
6383 dnl ================================
6384 dnl check to see if the system SQLite package is compiled with
6385 dnl SQLITE_ENABLE_FTS3 enabled.
6386 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6387 _SAVE_CFLAGS="$CFLAGS"
6388 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6390 LIBS="$LIBS $SQLITE_LIBS"
6391 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6393 #include "sqlite3.h"
6395 int main(int argc, char **argv){
6396 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6398 ac_cv_sqlite_enable_fts3=yes,
6399 ac_cv_sqlite_enable_fts3=no,
6400 ac_cv_sqlite_enable_fts3=no
6403 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6404 CFLAGS="$_SAVE_CFLAGS"
6406 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6407 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6410 dnl =========================================
6411 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6412 dnl =========================================
6413 dnl check to see if the system SQLite package is compiled with
6414 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6415 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6416 _SAVE_CFLAGS="$CFLAGS"
6417 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6419 LIBS="$LIBS $SQLITE_LIBS"
6420 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6422 #include "sqlite3.h"
6424 int main(int argc, char **argv){
6425 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6427 ac_cv_sqlite_enable_unlock_notify=yes,
6428 ac_cv_sqlite_enable_unlock_notify=no,
6429 ac_cv_sqlite_enable_unlock_notify=no
6432 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6433 CFLAGS="$_SAVE_CFLAGS"
6435 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6436 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6440 if test -n "$MOZ_NATIVE_SQLITE"; then
6441 AC_DEFINE(MOZ_NATIVE_SQLITE)
6443 AC_SUBST(MOZ_NATIVE_SQLITE)
6445 dnl ========================================================
6446 dnl = Enable help viewer (off by default)
6447 dnl ========================================================
6448 if test -n "$MOZ_HELP_VIEWER"; then
6449 dnl Do this if defined in confvars.sh
6450 AC_DEFINE(MOZ_HELP_VIEWER)
6453 dnl ========================================================
6454 dnl = Enable safe browsing (anti-phishing)
6455 dnl ========================================================
6456 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6457 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6458 MOZ_SAFE_BROWSING=1,
6459 MOZ_SAFE_BROWSING= )
6460 if test -n "$MOZ_SAFE_BROWSING"; then
6461 AC_DEFINE(MOZ_SAFE_BROWSING)
6463 AC_SUBST(MOZ_SAFE_BROWSING)
6465 dnl ========================================================
6466 dnl = Enable url-classifier
6467 dnl ========================================================
6468 dnl Implicitly enabled by default if building with safe-browsing
6469 if test -n "$MOZ_SAFE_BROWSING"; then
6470 MOZ_URL_CLASSIFIER=1
6472 MOZ_ARG_ENABLE_BOOL(url-classifier,
6473 [ --enable-url-classifier Enable url classifier module],
6474 MOZ_URL_CLASSIFIER=1,
6475 MOZ_URL_CLASSIFIER= )
6476 if test -n "$MOZ_URL_CLASSIFIER"; then
6477 AC_DEFINE(MOZ_URL_CLASSIFIER)
6479 AC_SUBST(MOZ_URL_CLASSIFIER)
6481 dnl ========================================================
6482 dnl = Disable zipwriter
6483 dnl ========================================================
6484 MOZ_ARG_DISABLE_BOOL(zipwriter,
6485 [ --disable-zipwriter Disable zipwriter component],
6488 AC_SUBST(MOZ_ZIPWRITER)
6490 dnl ========================================================
6492 dnl ========================================================
6493 dnl superseded by QtNetwork starting from 4.7
6494 MOZ_ENABLE_LIBCONIC=1
6496 if test -n "$MOZ_ENABLE_QT"; then
6497 if test "$MOZ_ENABLE_QTNETWORK"; then
6498 MOZ_ENABLE_LIBCONIC=
6502 MOZ_ARG_DISABLE_BOOL(libconic,
6503 [ --disable-libconic Disable libconic],
6504 MOZ_ENABLE_LIBCONIC=,
6505 MOZ_ENABLE_LIBCONIC=1 )
6507 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6508 PKG_CHECK_MODULES(LIBCONIC, conic,
6509 MOZ_ENABLE_LIBCONIC=1,
6510 MOZ_ENABLE_LIBCONIC=)
6512 if test "$MOZ_ENABLE_LIBCONIC"; then
6513 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6516 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6517 AC_SUBST(LIBCONIC_CFLAGS)
6518 AC_SUBST(LIBCONIC_LIBS)
6520 dnl ========================================================
6522 dnl ========================================================
6524 MAEMO_SDK_TARGET_VER=-1
6526 MOZ_ARG_WITH_STRING(maemo-version,
6527 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6529 MAEMO_SDK_TARGET_VER=$withval)
6531 case "$MAEMO_SDK_TARGET_VER" in
6533 MOZ_PLATFORM_MAEMO=5
6537 MOZ_PLATFORM_MAEMO=6
6541 dnl We aren't compiling for Maemo, move on.
6544 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6548 if test $MOZ_PLATFORM_MAEMO; then
6549 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6551 if test -z "$MOZ_ENABLE_DBUS"; then
6552 AC_MSG_ERROR([DBus is required when building for Maemo])
6555 MOZ_GFX_OPTIMIZE_MOBILE=1
6556 MOZ_GL_DEFAULT_PROVIDER=EGL
6557 MOZ_MAEMO_LIBLOCATION=
6559 if test $MOZ_PLATFORM_MAEMO = 5; then
6560 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6561 MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6562 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6563 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6564 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6566 AC_SUBST(XCOMPOSITE_LIBS)
6568 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6569 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6570 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6571 if test -z "$_LIB_FOUND"; then
6572 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6576 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6577 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6578 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6579 if test -z "$_LIB_FOUND"; then
6580 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6583 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6584 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6585 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6586 if test -z "$_LIB_FOUND"; then
6587 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6591 if test $MOZ_PLATFORM_MAEMO = 6; then
6593 PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6596 if test "$_LIB_FOUND"; then
6597 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6598 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6599 MOZ_ENABLE_CONTENTMANAGER=1
6600 AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6602 AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6604 AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6606 dnl ========================================================
6607 dnl = Enable meego libcontentaction
6608 dnl ========================================================
6609 MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6610 [ --enable-meegocontentaction Enable meegocontentaction support],
6611 MOZ_MEEGOCONTENTACTION=1,
6612 MOZ_MEEGOCONTENTACTION=)
6614 if test -n "$MOZ_MEEGOCONTENTACTION"; then
6616 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6617 if test "$_LIB_FOUND"; then
6618 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6619 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6620 MOZ_ENABLE_CONTENTACTION=1
6621 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6622 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6626 MOZ_ARG_ENABLE_BOOL(meegotouch,
6627 [ --enable-meegotouch Enable meegotouch support],
6628 MOZ_MEEGOTOUCHENABLED=1,
6629 MOZ_MEEGOTOUCHENABLED=)
6631 if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6632 PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6633 if test "$_LIB_FOUND"; then
6634 MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6635 MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6636 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6638 AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6643 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6644 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6645 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6646 if test "$_LIB_FOUND"; then
6647 MOZ_MAEMO_LIBLOCATION=1
6648 AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6650 AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6652 AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6654 PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6655 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6656 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6657 if test "$_LIB_FOUND"; then
6658 MOZ_ENABLE_MEEGOTOUCHSHARE=1
6659 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6661 AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6663 AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6665 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6666 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6669 dnl ========================================================
6670 dnl = XRender Composite
6671 dnl ========================================================
6672 MOZ_ARG_ENABLE_BOOL(egl-xrender-composite,
6673 [ --enable-egl-xrender-composite
6674 Enable EGL xrender composite optimizations],
6675 MOZ_EGL_XRENDER_COMPOSITE=1)
6677 if test -n "$MOZ_EGL_XRENDER_COMPOSITE"; then
6678 AC_DEFINE(MOZ_EGL_XRENDER_COMPOSITE)
6681 AC_SUBST(MOZ_EGL_XRENDER_COMPOSITE)
6683 dnl ========================================================
6685 dnl ========================================================
6687 MOZ_ARG_WITH_STRING(gl-provider,
6688 [ --with-gl-provider=ID
6689 Set GL provider backend type],
6690 [ val=`echo $withval`
6691 MOZ_GL_PROVIDER="$val"])
6693 if test -n "$MOZ_GL_PROVIDER"; then
6694 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6695 AC_SUBST(MOZ_GL_PROVIDER)
6696 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6698 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6700 dnl ========================================================
6701 dnl = faststripe theme
6702 dnl ========================================================
6703 MOZ_ARG_ENABLE_BOOL(faststripe,
6704 [ --enable-faststripe Use faststripe theme],
6705 MOZ_THEME_FASTSTRIPE=1,
6706 MOZ_THEME_FASTSTRIPE= )
6707 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6709 dnl ========================================================
6711 dnl = Feature options that require extra sources to be pulled
6713 dnl ========================================================
6714 dnl MOZ_ARG_HEADER(Features that require extra sources)
6716 dnl ========================================================
6718 dnl = Debugging Options
6720 dnl ========================================================
6721 MOZ_ARG_HEADER(Debugging and Optimizations)
6723 dnl ========================================================
6724 dnl = Disable building with debug info.
6725 dnl = Debugging is OFF by default
6726 dnl ========================================================
6727 if test -z "$MOZ_DEBUG_FLAGS"; then
6728 MOZ_DEBUG_FLAGS="-g"
6731 MOZ_ARG_ENABLE_STRING(debug,
6732 [ --enable-debug[=DBG] Enable building with developer debug info
6733 (using compiler flags DBG)],
6734 [ if test "$enableval" != "no"; then
6736 if test -n "$enableval" -a "$enableval" != "yes"; then
6737 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6738 _MOZ_DEBUG_FLAGS_SET=1
6745 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6746 MOZ_ARG_WITH_STRING(debug-label,
6747 [ --with-debug-label=LABELS
6748 Define DEBUG_<value> for each comma-separated
6750 [ for option in `echo $withval | sed 's/,/ /g'`; do
6751 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6754 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6756 if test -n "$MOZ_DEBUG"; then
6757 AC_MSG_CHECKING([for valid debug flags])
6758 _SAVE_CFLAGS=$CFLAGS
6759 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6760 AC_TRY_COMPILE([#include <stdio.h>],
6761 [printf("Hello World\n");],
6764 AC_MSG_RESULT([$_results])
6765 if test "$_results" = "no"; then
6766 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6768 CFLAGS=$_SAVE_CFLAGS
6771 dnl ========================================================
6772 dnl enable mobile optimizations
6773 dnl ========================================================
6774 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6775 [ --enable-mobile-optimize
6776 Enable mobile optimizations],
6777 MOZ_GFX_OPTIMIZE_MOBILE=1)
6779 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6781 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6782 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6785 dnl ========================================================
6786 dnl = Enable code optimization. ON by default.
6787 dnl ========================================================
6788 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6789 MOZ_OPTIMIZE_FLAGS="-O"
6792 MOZ_ARG_ENABLE_STRING(optimize,
6793 [ --disable-optimize Disable compiler optimization
6794 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6795 [ if test "$enableval" != "no"; then
6797 if test -n "$enableval" -a "$enableval" != "yes"; then
6798 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6803 fi ], MOZ_OPTIMIZE=1)
6805 MOZ_SET_FRAMEPTR_FLAGS
6807 if test "$COMPILE_ENVIRONMENT"; then
6808 if test -n "$MOZ_OPTIMIZE"; then
6809 AC_MSG_CHECKING([for valid optimization flags])
6810 _SAVE_CFLAGS=$CFLAGS
6811 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6812 AC_TRY_COMPILE([#include <stdio.h>],
6813 [printf("Hello World\n");],
6816 AC_MSG_RESULT([$_results])
6817 if test "$_results" = "no"; then
6818 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6820 CFLAGS=$_SAVE_CFLAGS
6822 fi # COMPILE_ENVIRONMENT
6824 AC_SUBST(MOZ_OPTIMIZE)
6825 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6826 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6827 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6828 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6829 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6830 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6832 dnl ========================================================
6833 dnl = Enable generation of debug symbols
6834 dnl ========================================================
6835 MOZ_ARG_ENABLE_STRING(debug-symbols,
6836 [ --enable-debug-symbols[=DBG]
6837 Enable debugging symbols (using compiler flags DBG)],
6838 [ if test "$enableval" != "no"; then
6840 if test -n "$enableval" -a "$enableval" != "yes"; then
6841 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6842 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6844 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6850 MOZ_DEBUG_SYMBOLS=1)
6852 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6853 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6854 export MOZ_DEBUG_SYMBOLS
6857 dnl ========================================================
6858 dnl = Enable any treating of compile warnings as errors
6859 dnl ========================================================
6860 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6861 [ --enable-warnings-as-errors
6862 Enable treating of warnings as errors],
6863 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6864 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6865 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6866 WARNINGS_AS_ERRORS=''
6869 dnl ========================================================
6870 dnl = Disable runtime logging checks
6871 dnl ========================================================
6872 MOZ_ARG_DISABLE_BOOL(logging,
6873 [ --disable-logging Disable logging facilities],
6874 NS_DISABLE_LOGGING=1,
6875 NS_DISABLE_LOGGING= )
6876 if test "$NS_DISABLE_LOGGING"; then
6877 AC_DEFINE(NS_DISABLE_LOGGING)
6879 AC_DEFINE(MOZ_LOGGING)
6882 dnl ========================================================
6883 dnl = This will enable logging of addref, release, ctor, dtor.
6884 dnl ========================================================
6885 _ENABLE_LOGREFCNT=42
6886 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6887 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6888 _ENABLE_LOGREFCNT=1,
6889 _ENABLE_LOGREFCNT= )
6890 if test "$_ENABLE_LOGREFCNT" = "1"; then
6891 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6892 elif test -z "$_ENABLE_LOGREFCNT"; then
6893 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6896 dnl ========================================================
6897 dnl moz_dump_painting
6898 dnl ========================================================
6899 MOZ_ARG_ENABLE_BOOL(dump-painting,
6900 [ --enable-dump-painting Enable paint debugging.],
6901 MOZ_DUMP_PAINTING=1,
6902 MOZ_DUMP_PAINTING= )
6903 if test -n "$MOZ_DUMP_PAINTING"; then
6904 AC_DEFINE(MOZ_DUMP_PAINTING)
6905 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6907 if test -n "$MOZ_DEBUG"; then
6908 AC_DEFINE(MOZ_DUMP_PAINTING)
6911 dnl ========================================================
6912 dnl = Enable trace malloc
6913 dnl ========================================================
6914 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6915 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6916 [ --enable-trace-malloc Enable malloc tracing; also disables jemalloc],
6919 if test "$NS_TRACE_MALLOC"; then
6920 # Please, Mr. Linker Man, don't take away our symbol names
6921 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6923 AC_DEFINE(NS_TRACE_MALLOC)
6925 AC_SUBST(NS_TRACE_MALLOC)
6927 dnl ========================================================
6928 dnl = Enable jemalloc
6929 dnl ========================================================
6930 MOZ_ARG_ENABLE_BOOL(jemalloc,
6931 [ --enable-jemalloc Replace memory allocator with jemalloc],
6935 if test "$NS_TRACE_MALLOC"; then
6938 if test "$MOZ_DMD"; then
6942 if test "${OS_TARGET}" = "Android"; then
6943 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6945 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
6946 dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
6947 if test -z "$GNU_CC"; then
6948 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6950 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6953 dnl On other Unix systems, we only want to link executables against mozglue
6954 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6955 dnl On other Unix systems, where mozglue is a static library, jemalloc is
6956 dnl separated for the SDK, so we need to add it here.
6957 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6958 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6960 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6961 if test -n "$GNU_CC"; then
6962 dnl And we need mozglue symbols to be exported.
6963 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6965 if test "$MOZ_LINKER" = 1; then
6966 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $ZLIB_LIBS"
6970 if test -z "$MOZ_MEMORY"; then
6973 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
6974 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.])
6979 dnl Don't try to run compiler tests on Windows
6980 if test "$OS_ARCH" = "WINNT"; then
6981 if test -z "$HAVE_64BIT_OS"; then
6982 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6984 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6987 AC_CHECK_SIZEOF([int *], [4])
6988 case "${ac_cv_sizeof_int_p}" in
6990 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6993 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6996 AC_MSG_ERROR([Unexpected pointer size])
7001 AC_DEFINE(MOZ_MEMORY)
7002 if test -n "$MOZ_JEMALLOC"; then
7003 AC_DEFINE(MOZ_JEMALLOC)
7005 if test "x$MOZ_DEBUG" = "x1"; then
7006 AC_DEFINE(MOZ_MEMORY_DEBUG)
7008 dnl The generic feature tests that determine how to compute ncpus are long and
7009 dnl complicated. Therefore, simply define special cpp variables for the
7010 dnl platforms we have special knowledge of.
7013 AC_DEFINE(MOZ_MEMORY_DARWIN)
7016 AC_DEFINE(MOZ_MEMORY_BSD)
7018 *-android*|*-linuxandroid*)
7019 AC_DEFINE(MOZ_MEMORY_LINUX)
7020 AC_DEFINE(MOZ_MEMORY_ANDROID)
7025 AC_DEFINE(MOZ_MEMORY_LINUX)
7028 AC_DEFINE(MOZ_MEMORY_BSD)
7031 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7034 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7035 if test -z "$MOZ_DEBUG"; then
7036 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7038 WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7040 dnl Look for a broken crtdll.obj
7041 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7042 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7043 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7044 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7045 dnl Also pass this to NSPR/NSS
7046 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7048 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7055 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7059 AC_SUBST(MOZ_MEMORY)
7060 AC_SUBST(MOZ_JEMALLOC)
7061 AC_SUBST(MOZ_GLUE_LDFLAGS)
7062 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7063 AC_SUBST(WIN32_CRT_LIBS)
7064 dnl Need to set this for make because NSS doesn't have configure
7067 dnl We need to wrap dlopen and related functions on Android because we use
7069 if test "$OS_TARGET" = Android; then
7070 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7071 if test -n "$MOZ_OLD_LINKER"; then
7072 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
7074 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7075 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7078 dnl ========================================================
7079 dnl = Use malloc wrapper lib
7080 dnl ========================================================
7081 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7082 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7086 if test -n "$_WRAP_MALLOC"; then
7087 if test -n "$GNU_CC"; then
7088 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7089 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7090 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7091 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7092 dnl Wrap operator new and operator delete on Android.
7093 if test "$OS_TARGET" = "Android"; then
7094 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7097 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7101 dnl ========================================================
7102 dnl = Location of malloc wrapper lib
7103 dnl ========================================================
7104 MOZ_ARG_WITH_STRING(wrap-malloc,
7105 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7106 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7108 dnl ========================================================
7109 dnl = Use JS Call tracing
7110 dnl ========================================================
7111 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7112 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7113 MOZ_TRACE_JSCALLS=1,
7114 MOZ_TRACE_JSCALLS= )
7115 if test -n "$MOZ_TRACE_JSCALLS"; then
7116 AC_DEFINE(MOZ_TRACE_JSCALLS)
7119 dnl ========================================================
7120 dnl = Use incremental GC
7121 dnl ========================================================
7123 MOZ_ARG_DISABLE_BOOL(gcincremental,
7124 [ --disable-gcincremental Disable incremental GC],
7126 if test -n "$JSGC_INCREMENTAL"; then
7127 AC_DEFINE(JSGC_INCREMENTAL)
7130 dnl ========================================================
7131 dnl ETW - Event Tracing for Windows
7132 dnl ========================================================
7133 MOZ_ARG_ENABLE_BOOL(ETW,
7134 [ --enable-ETW Enable ETW (Event Tracing for Windows) event reporting],
7137 if test -n "$MOZ_ETW"; then
7141 if test -n "$MOZ_ETW"; then
7142 if test -z "$MOZ_WINSDK_TARGETVER"; then
7143 AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7147 dnl ========================================================
7148 dnl Zealous JavaScript GC
7149 dnl ========================================================
7150 MOZ_ARG_ENABLE_BOOL(gczeal,
7151 [ --enable-gczeal Enable zealous JavaScript GCing],
7154 if test -n "$JS_GC_ZEAL"; then
7155 AC_DEFINE(JS_GC_ZEAL)
7158 dnl ========================================================
7159 dnl JS opt-mode assertions and minidump instrumentation
7160 dnl ========================================================
7161 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7162 [ --enable-js-diagnostics
7163 Enable JS diagnostic assertions and breakpad data],
7164 JS_CRASH_DIAGNOSTICS=1,
7165 JS_CRASH_DIAGNOSTICS= )
7166 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7167 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7170 dnl ======================================================
7171 dnl = Enable compiling with ccache
7172 dnl ======================================================
7173 MOZ_ARG_WITH_STRING(ccache,
7174 [ --with-ccache[=path/to/ccache]
7175 Enable compiling with ccache],
7176 CCACHE=$withval, CCACHE="no")
7178 if test "$CCACHE" != "no"; then
7179 if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7182 if test ! -e "$CCACHE"; then
7183 AC_MSG_ERROR([$CCACHE not found])
7186 MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7187 if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7188 AC_MSG_ERROR([ccache not found])
7189 elif test -x "$CCACHE"; then
7193 AC_MSG_ERROR([$CCACHE is not executable])
7197 dnl ========================================================
7198 dnl = Enable static checking using gcc-dehydra
7199 dnl ========================================================
7201 MOZ_ARG_WITH_STRING(static-checking,
7202 [ --with-static-checking=path/to/gcc_dehydra.so
7203 Enable static checking of code using GCC-dehydra],
7204 DEHYDRA_PATH=$withval,
7207 if test -n "$DEHYDRA_PATH"; then
7208 if test ! -f "$DEHYDRA_PATH"; then
7209 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7211 AC_DEFINE(NS_STATIC_CHECKING)
7213 AC_SUBST(DEHYDRA_PATH)
7215 dnl ========================================================
7216 dnl = Enable stripping of libs & executables
7217 dnl ========================================================
7218 MOZ_ARG_ENABLE_BOOL(strip,
7219 [ --enable-strip Enable stripping of libs & executables ],
7223 dnl ========================================================
7224 dnl = Enable stripping of libs & executables when packaging
7225 dnl ========================================================
7226 MOZ_ARG_ENABLE_BOOL(install-strip,
7227 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7231 dnl ========================================================
7232 dnl = --enable-elf-dynstr-gc
7233 dnl ========================================================
7234 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7235 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7236 USE_ELF_DYNSTR_GC=1,
7237 USE_ELF_DYNSTR_GC= )
7239 dnl ========================================================
7240 dnl = --disable-elf-hack
7241 dnl ========================================================
7244 MOZ_ARG_DISABLE_BOOL(elf-hack,
7245 [ --disable-elf-hack Disable elf hacks],
7249 # Disable elf hack for profiling because the built in profiler
7250 # doesn't read the segments properly with elf hack. This is
7251 # temporary and should be fixed soon in the profiler.
7252 if test "$MOZ_PROFILING" = 1; then
7256 # Only enable elfhack where supported
7257 if test "$USE_ELF_HACK" = 1; then
7258 case "${HOST_OS_ARCH},${OS_ARCH}" in
7260 case "${CPU_ARCH}" in
7275 if test "$USE_ELF_HACK" = 1; then
7276 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7277 dnl memory addresses it maps to. The result is that by the time elfhack
7278 dnl kicks in, it is not possible to apply relocations because of that,
7279 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7280 dnl segment. It makes elfhack mostly useless, so considering the problems
7281 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7282 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7283 dnl the linker creates PT_GNU_RELRO segments.
7284 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7285 LINK_WITH_PT_GNU_RELRO,
7286 [echo "int main() {return 0;}" > conftest.${ac_ext}
7287 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7288 test -s conftest${ac_exeext}; then
7289 if readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7290 LINK_WITH_PT_GNU_RELRO=yes
7292 LINK_WITH_PT_GNU_RELRO=no
7295 dnl We really don't expect to get here, but just in case
7296 AC_ERROR([couldn't compile a simple C file])
7299 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7300 AC_MSG_WARN([Disabling elfhack])
7305 dnl ========================================================
7306 dnl = libstdc++ compatibility hacks
7307 dnl ========================================================
7310 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7311 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7314 AC_SUBST(STDCXX_COMPAT)
7316 if test -n "$STDCXX_COMPAT"; then
7317 eval $(CXX="$CXX" MACOS_SDK_DIR="$MACOS_SDK_DIR" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7318 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7319 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7322 dnl ========================================================
7324 dnl = Profiling and Instrumenting
7326 dnl ========================================================
7327 MOZ_ARG_HEADER(Profiling and Instrumenting)
7329 dnl ========================================================
7330 dnl = Enable NS_FUNCTION_TIMER, which provides Function
7331 dnl = timing for identifying code bottlenecks
7332 dnl = NS_FUNCTION_TIMER is off by default.
7333 dnl ========================================================
7334 MOZ_ARG_ENABLE_BOOL(functiontimer,
7335 [ --enable-functiontimer Enable NS_FUNCTION_TIMER ],
7336 NS_FUNCTION_TIMER=1,
7337 NS_FUNCTION_TIMER= )
7338 if test -n "$NS_FUNCTION_TIMER"; then
7339 AC_DEFINE(NS_FUNCTION_TIMER)
7342 dnl ========================================================
7343 dnl = Enable runtime visual profiling logger
7344 dnl ========================================================
7345 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7346 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7347 MOZ_VISUAL_EVENT_TRACER=1,
7348 MOZ_VISUAL_EVENT_TRACER=)
7349 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7350 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7353 dnl ========================================================
7354 dnl Turn on reflow counting
7355 dnl ========================================================
7356 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7357 [ --enable-reflow-perf Enable reflow performance tracing],
7360 if test -n "$MOZ_REFLOW_PERF"; then
7361 AC_DEFINE(MOZ_REFLOW_PERF)
7364 dnl ========================================================
7365 dnl Enable code size metrics.
7366 dnl ========================================================
7367 MOZ_ARG_ENABLE_BOOL(codesighs,
7368 [ --enable-codesighs Enable code size analysis tools],
7369 _ENABLE_CODESIGHS=1,
7370 _ENABLE_CODESIGHS= )
7371 if test -n "$_ENABLE_CODESIGHS"; then
7372 if test -d $srcdir/tools/codesighs; then
7375 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7379 dnl ========================================================
7380 dnl = Enable Radio Interface for B2G (Gonk usually)
7381 dnl ========================================================
7382 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7383 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7386 if test -n "$MOZ_B2G_RIL"; then
7387 AC_DEFINE(MOZ_B2G_RIL)
7389 AC_SUBST(MOZ_B2G_RIL)
7391 dnl ========================================================
7392 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7393 dnl ========================================================
7394 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7395 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7398 if test -n "$MOZ_B2G_BT"; then
7399 AC_DEFINE(MOZ_B2G_BT)
7401 AC_SUBST(MOZ_B2G_BT)
7403 dnl ========================================================
7404 dnl = Enable Support for System Messages API
7405 dnl ========================================================
7407 AC_SUBST(MOZ_SYS_MSG)
7409 dnl ========================================================
7410 dnl = Support for demangling undefined symbols
7411 dnl ========================================================
7412 if test -z "$SKIP_LIBRARY_CHECKS"; then
7415 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7419 # Demangle only for debug or trace-malloc builds
7420 MOZ_DEMANGLE_SYMBOLS=
7421 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7422 MOZ_DEMANGLE_SYMBOLS=1
7423 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7425 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7427 dnl ========================================================
7428 dnl = Support for gcc stack unwinding (from gcc 3.3)
7429 dnl ========================================================
7430 if test -z "$SKIP_LIBRARY_CHECKS"; then
7431 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7434 dnl ========================================================
7436 dnl ========================================================
7438 MOZ_ARG_WITH_STRING(jitreport-granularity,
7439 [ --jitreport-granularity=N
7440 Default granularity at which to report JIT code
7443 1 - code ranges for whole functions only
7444 2 - per-line information
7445 3 - per-op information],
7446 JITREPORT_GRANULARITY=$withval,
7447 JITREPORT_GRANULARITY=3)
7449 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7451 dnl ========================================================
7455 dnl ========================================================
7456 MOZ_ARG_HEADER(Misc. Options)
7458 dnl ========================================================
7459 dnl update xterm title
7460 dnl ========================================================
7461 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7462 [ --enable-xterm-updates Update XTERM titles with current command.],
7466 dnl =========================================================
7468 dnl =========================================================
7469 MOZ_ARG_ENABLE_STRING([chrome-format],
7470 [ --enable-chrome-format=jar|flat|both|symlink|omni
7471 Select FORMAT of chrome files (default=jar)],
7472 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7474 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7475 MOZ_CHROME_FILE_FORMAT=jar
7478 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7479 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7480 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7481 test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7482 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7483 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7486 dnl =========================================================
7487 dnl Omnijar packaging (bug 552121)
7488 dnl =========================================================
7489 dnl Omnijar packaging is compatible with flat packaging.
7490 dnl In unpackaged builds, omnijar looks for files as if
7491 dnl things were flat packaged. After packaging, all files
7492 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7493 dnl is set to flat since putting files into jars is only
7494 dnl done during packaging with omnijar.
7495 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7497 AC_DEFINE(MOZ_OMNIJAR)
7498 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$OS_TARGET" = "Android"; then
7499 MOZ_CHROME_FILE_FORMAT=flat
7501 MOZ_CHROME_FILE_FORMAT=symlink
7503 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7504 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7507 OMNIJAR_NAME=omni.ja
7508 AC_SUBST(OMNIJAR_NAME)
7509 AC_SUBST(MOZ_OMNIJAR)
7511 dnl ========================================================
7512 dnl = Define default location for MOZILLA_FIVE_HOME
7513 dnl ========================================================
7514 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7515 [ --with-default-mozilla-five-home
7516 Set the default value for MOZILLA_FIVE_HOME],
7517 [ val=`echo $withval`
7518 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7520 dnl ========================================================
7521 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7522 dnl ========================================================
7523 MOZ_ARG_WITH_STRING(user-appdir,
7524 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7525 [ val=`echo $withval`
7526 if echo "$val" | grep "\/" >/dev/null; then
7527 AC_MSG_ERROR("Homedir must be single relative path.")
7532 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7534 dnl ========================================================
7535 dnl = Doxygen configuration
7536 dnl ========================================================
7537 dnl Use commas to specify multiple dirs to this arg
7538 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7539 MOZ_ARG_WITH_STRING(doc-input-dirs,
7540 [ --with-doc-input-dirs=DIRS
7541 Header/idl dirs to create docs from],
7542 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7543 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7545 dnl Use commas to specify multiple dirs to this arg
7546 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7547 MOZ_ARG_WITH_STRING(doc-include-dirs,
7548 [ --with-doc-include-dirs=DIRS
7549 Include dirs to preprocess doc headers],
7550 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7551 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7553 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7554 MOZ_ARG_WITH_STRING(doc-output-dir,
7555 [ --with-doc-output-dir=DIR
7556 Dir to generate docs into],
7557 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7558 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7560 if test -z "$SKIP_COMPILER_CHECKS"; then
7561 dnl ========================================================
7563 dnl = Compiler Options
7565 dnl ========================================================
7566 MOZ_ARG_HEADER(Compiler Options)
7568 dnl ========================================================
7569 dnl Check for gcc -pipe support
7570 dnl ========================================================
7571 AC_MSG_CHECKING([for -pipe support])
7572 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7573 dnl Any gcc that supports firefox supports -pipe.
7574 CFLAGS="$CFLAGS -pipe"
7575 CXXFLAGS="$CXXFLAGS -pipe"
7576 AC_MSG_RESULT([yes])
7581 dnl ========================================================
7582 dnl Profile guided optimization (gcc checks)
7583 dnl ========================================================
7584 dnl Test for profiling options
7585 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7587 _SAVE_CFLAGS="$CFLAGS"
7588 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7590 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7591 AC_TRY_COMPILE([], [return 0;],
7592 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7593 result="yes" ], result="no")
7594 AC_MSG_RESULT([$result])
7596 if test $result = "yes"; then
7597 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7598 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7599 PROFILE_USE_LDFLAGS="-fprofile-use"
7602 CFLAGS="$_SAVE_CFLAGS"
7604 if test -n "$INTEL_CC"; then
7605 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7606 PROFILE_GEN_LDFLAGS=
7607 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7608 PROFILE_USE_LDFLAGS=
7611 dnl Sun Studio on Solaris
7612 if test "$SOLARIS_SUNPRO_CC"; then
7613 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7614 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7615 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7616 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7619 AC_SUBST(PROFILE_GEN_CFLAGS)
7620 AC_SUBST(PROFILE_GEN_LDFLAGS)
7621 AC_SUBST(PROFILE_USE_CFLAGS)
7622 AC_SUBST(PROFILE_USE_LDFLAGS)
7626 dnl ========================================================
7627 dnl Test for -pedantic bustage
7628 dnl ========================================================
7629 MOZ_ARG_DISABLE_BOOL(pedantic,
7630 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
7632 if test "$_PEDANTIC"; then
7633 _SAVE_CXXFLAGS=$CXXFLAGS
7634 CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7635 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7636 AC_TRY_COMPILE([$configure_static_assert_macros],
7637 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7638 result="no", result="yes" )
7639 AC_MSG_RESULT([$result])
7640 CXXFLAGS="$_SAVE_CXXFLAGS"
7644 _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
7645 _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7648 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
7653 dnl ========================================================
7654 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7655 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7656 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7657 dnl ========================================================
7658 _SAVE_CXXFLAGS=$CXXFLAGS
7659 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7660 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7661 ac_nscap_nonconst_opeq_bug,
7670 template <class T, class U>
7671 int operator==(const Pointer<T>& rhs, U* lhs)
7673 return rhs.myPtr == lhs;
7676 template <class T, class U>
7677 int operator==(const Pointer<T>& rhs, const U* lhs)
7679 return rhs.myPtr == lhs;
7687 ac_nscap_nonconst_opeq_bug="no",
7688 ac_nscap_nonconst_opeq_bug="yes")])
7689 CXXFLAGS="$_SAVE_CXXFLAGS"
7691 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7692 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7694 fi # ! SKIP_COMPILER_CHECKS
7696 AC_DEFINE(CPP_THROW_NEW, [throw()])
7699 if test "$COMPILE_ENVIRONMENT"; then
7701 fi # COMPILE_ENVIRONMENT
7703 dnl ========================================================
7705 dnl = Build depencency options
7707 dnl ========================================================
7708 MOZ_ARG_HEADER(Build dependencies)
7710 dnl ========================================================
7711 dnl = Do not auto generate dependency info
7712 dnl ========================================================
7714 MOZ_ARG_DISABLE_BOOL(auto-deps,
7715 [ --disable-auto-deps Do not automatically generate dependency info],
7719 if test -n "$MOZ_AUTO_DEPS"; then
7720 dnl ========================================================
7721 dnl = Use mkdepend instead of $CC -MD for dependency generation
7722 dnl ========================================================
7724 MOZ_ARG_DISABLE_BOOL(md,
7725 [ --disable-md Do not use compiler-based dependencies ],
7728 [dnl Default is to turn on -MD if using GNU-compatible compilers
7729 if test "$GNU_CC" -a "$GNU_CXX"; then
7732 dnl Default is to use -xM if using Sun Studio on Solaris
7733 if test "$SOLARIS_SUNPRO_CC"; then
7736 if test "$_cpp_md_flag"; then
7738 _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
7739 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7740 if test "$SOLARIS_SUNPRO_CC"; then
7745 dnl Don't override this for MSVC
7746 if test -z "$_WIN32_MSVC"; then
7747 _USE_CPP_INCLUDE_FLAG=
7748 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7749 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7751 echo '#include <stdio.h>' > dummy-hello.c
7753 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7755 if test -z "$CL_INCLUDES_PREFIX"; then
7756 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7758 AC_SUBST(CL_INCLUDES_PREFIX)
7760 dnl cl.py provides dependency generation for MSVC
7761 CC_WRAPPER='$(PYTHON) -O $(topsrcdir)/build/cl.py'
7762 CXX_WRAPPER='$(PYTHON) -O $(topsrcdir)/build/cl.py'
7768 AC_SUBST(MOZ_AUTO_DEPS)
7769 AC_SUBST(COMPILER_DEPEND)
7771 AC_SUBST(CC_WRAPPER)
7772 AC_SUBST(CXX_WRAPPER)
7775 dnl ========================================================
7777 dnl = Static Build Options
7779 dnl ========================================================
7780 MOZ_ARG_HEADER(Static build options)
7782 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7783 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
7787 MOZ_ARG_ENABLE_BOOL(shared-js,
7788 [ --enable-shared-js
7789 Create a shared JavaScript library.],
7793 if test -n "$ENABLE_SHARED_JS"; then
7795 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7797 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7798 AC_DEFINE(MOZ_STATIC_JS)
7800 AC_SUBST(JS_SHARED_LIBRARY)
7802 AC_SUBST(LIBXUL_LIBS)
7803 XPCOM_LIBS="$LIBXUL_LIBS"
7805 dnl ========================================================
7807 dnl = Standalone module options
7809 dnl ========================================================
7810 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7813 dnl ========================================================
7815 if test -z "$SKIP_PATH_CHECKS"; then
7816 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7817 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7818 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7823 if test -z "${GLIB_GMODULE_LIBS}" \
7824 -a -n "${GLIB_CONFIG}"\
7825 -a "${GLIB_CONFIG}" != no\
7827 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7830 AC_SUBST(GLIB_CFLAGS)
7832 AC_SUBST(GLIB_GMODULE_LIBS)
7834 dnl ========================================================
7835 dnl Graphics checks.
7836 dnl ========================================================
7838 if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
7844 MOZ_ARG_ENABLE_BOOL(skia,
7845 [ --enable-skia Enable use of Skia],
7849 if test "$USE_FC_FREETYPE"; then
7850 if test "$COMPILE_ENVIRONMENT"; then
7851 dnl ========================================================
7852 dnl = Check for freetype2 and its functionality
7853 dnl ========================================================
7854 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7856 if test "$_HAVE_FREETYPE2"; then
7858 _SAVE_CFLAGS="$CFLAGS"
7859 LIBS="$LIBS $FT2_LIBS"
7860 CFLAGS="$CFLAGS $FT2_CFLAGS"
7862 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7863 ac_cv_member_FT_Bitmap_Size_y_ppem,
7864 [AC_TRY_COMPILE([#include <ft2build.h>
7865 #include FT_FREETYPE_H],
7867 if (sizeof s.y_ppem) return 0;
7869 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7870 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7871 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7872 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7874 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7876 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7877 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7878 [FT_Bitmap_Size structure includes y_ppem field])
7880 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
7883 CFLAGS="$_SAVE_CFLAGS"
7886 _SAVE_CPPFLAGS="$CPPFLAGS"
7887 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7888 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7889 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7890 CPPFLAGS="$_SAVE_CPPFLAGS"
7892 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7896 dnl ========================================================
7897 dnl Check for pixman and cairo
7898 dnl ========================================================
7901 MOZ_ARG_ENABLE_BOOL(system-cairo,
7902 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7907 MOZ_ARG_ENABLE_BOOL(system-pixman,
7908 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7910 MOZ_TREE_PIXMAN=force,
7913 # System cairo depends on system pixman
7914 if test "$MOZ_TREE_PIXMAN" = "force"; then
7915 if test -z "$MOZ_TREE_CAIRO"; then
7916 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7920 elif test -z "$MOZ_TREE_CAIRO"; then
7924 if test "$MOZ_TREE_PIXMAN"; then
7925 AC_DEFINE(MOZ_TREE_PIXMAN)
7926 MOZ_PIXMAN_CFLAGS=""
7927 MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
7929 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
7930 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
7931 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
7933 AC_SUBST(MOZ_PIXMAN_CFLAGS)
7934 AC_SUBST(MOZ_PIXMAN_LIBS)
7936 # Check for headers defining standard int types.
7937 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7939 if test "$MOZ_TREE_CAIRO"; then
7940 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7941 AC_DEFINE(MOZ_TREE_CAIRO)
7943 # For now we assume that we will have a uint64_t available through
7944 # one of the above headers or mozstdint.h.
7945 AC_DEFINE(HAVE_UINT64_T)
7947 # Define macros for cairo-features.h
7948 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
7949 if test "$MOZ_X11"; then
7950 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7951 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7952 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7953 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7954 MOZ_ENABLE_CAIRO_FT=1
7955 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7957 case "$MOZ_WIDGET_TOOLKIT" in
7959 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7962 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7963 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7964 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7967 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7968 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7969 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7970 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7971 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7972 MOZ_ENABLE_D2D_SURFACE=1
7973 MOZ_ENABLE_DWRITE_FONT=1
7975 WIN32_DWRITE_FONT_FEATURE=
7976 WIN32_D2D_SURFACE_FEATURE=
7979 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
7981 dnl D3D10 Layers depend on D2D Surfaces.
7982 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
7983 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
7987 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7988 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7989 MOZ_ENABLE_CAIRO_FT=1
7990 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7991 CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7995 if test "$USE_FC_FREETYPE"; then
7996 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7998 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7999 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8000 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8001 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8002 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8003 AC_SUBST(CAIRO_FT_CFLAGS)
8005 AC_SUBST(PS_SURFACE_FEATURE)
8006 AC_SUBST(PDF_SURFACE_FEATURE)
8007 AC_SUBST(SVG_SURFACE_FEATURE)
8008 AC_SUBST(XLIB_SURFACE_FEATURE)
8009 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8010 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8011 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8012 AC_SUBST(WIN32_SURFACE_FEATURE)
8013 AC_SUBST(OS2_SURFACE_FEATURE)
8014 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8015 AC_SUBST(FT_FONT_FEATURE)
8016 AC_SUBST(FC_FONT_FEATURE)
8017 AC_SUBST(WIN32_FONT_FEATURE)
8018 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8019 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8020 AC_SUBST(QUARTZ_FONT_FEATURE)
8021 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8022 AC_SUBST(QT_SURFACE_FEATURE)
8023 AC_SUBST(TEE_SURFACE_FEATURE)
8025 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8026 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8028 if test "$MOZ_X11"; then
8029 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8032 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8033 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8036 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8037 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8038 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8039 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8040 if test "$MOZ_X11"; then
8041 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8042 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8043 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8044 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8048 AC_SUBST(MOZ_TREE_CAIRO)
8049 AC_SUBST(MOZ_CAIRO_CFLAGS)
8050 AC_SUBST(MOZ_CAIRO_LIBS)
8051 AC_SUBST(MOZ_CAIRO_OSLIBS)
8052 AC_SUBST(MOZ_TREE_PIXMAN)
8054 dnl ========================================================
8056 dnl ========================================================
8058 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8061 dnl ========================================================
8063 dnl ========================================================
8064 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8065 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8067 dnl ========================================================
8069 dnl ========================================================
8070 if test "$MOZ_GRAPHITE"; then
8071 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8072 AC_DEFINE(MOZ_GRAPHITE)
8076 AC_SUBST(MOZ_GRAPHITE)
8077 AC_SUBST(MOZ_GRAPHITE_LIBS)
8079 dnl ========================================================
8081 dnl ========================================================
8082 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8083 AC_SUBST(MOZ_OTS_LIBS)
8085 dnl ========================================================
8087 dnl ========================================================
8088 if test "$MOZ_ENABLE_SKIA"; then
8089 MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8090 AC_DEFINE(MOZ_ENABLE_SKIA)
8094 AC_SUBST(MOZ_ENABLE_SKIA)
8095 AC_SUBST(MOZ_SKIA_LIBS)
8097 dnl ========================================================
8099 dnl ========================================================
8100 MOZ_ARG_DISABLE_BOOL(xul,
8101 [ --disable-xul Disable XUL],
8103 if test "$MOZ_XUL"; then
8106 dnl remove extensions that require XUL
8107 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8112 dnl ========================================================
8113 dnl disable profile locking
8114 dnl do no use this in applications that can have more than
8115 dnl one process accessing the profile directory.
8116 dnl ========================================================
8117 MOZ_ARG_DISABLE_BOOL(profilelocking,
8118 [ --disable-profilelocking
8119 Disable profile locking],
8120 MOZ_PROFILELOCKING=,
8121 MOZ_PROFILELOCKING=1 )
8122 if test "$MOZ_PROFILELOCKING"; then
8123 AC_DEFINE(MOZ_PROFILELOCKING)
8126 dnl ========================================================
8127 dnl necko configuration options
8128 dnl ========================================================
8131 dnl option to disable various necko protocols
8133 MOZ_ARG_ENABLE_STRING(necko-protocols,
8134 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8135 Enable/disable specific protocol handlers],
8136 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8137 if test "$option" = "yes" -o "$option" = "all"; then
8138 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8139 elif test "$option" = "no" -o "$option" = "none"; then
8141 elif test "$option" = "default"; then
8142 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8143 elif test `echo "$option" | grep -c \^-` != 0; then
8144 option=`echo $option | sed 's/^-//'`
8145 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8147 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8150 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8152 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8153 AC_SUBST(NECKO_PROTOCOLS)
8154 for p in $NECKO_PROTOCOLS; do
8155 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8159 dnl option to disable necko's wifi scanner
8161 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8162 [ --disable-necko-wifi Disable necko wifi scanner],
8166 if test "$OS_ARCH" = "OS2"; then
8167 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8170 if test "$NECKO_WIFI" -a \
8171 "$OS_ARCH" != "Linux" -a \
8172 "$OS_ARCH" != "Darwin" -a \
8173 "$OS_ARCH" != "SunOS" -a \
8174 "$OS_ARCH" != "WINNT"; then
8175 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8178 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8180 MOZ_CHECK_HEADER([iwlib.h])
8181 if test "$ac_cv_header_iwlib_h" != "yes"; then
8182 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])
8186 if test "$NECKO_WIFI"; then
8187 AC_DEFINE(NECKO_WIFI)
8189 AC_SUBST(NECKO_WIFI)
8192 dnl option to disable cookies
8194 MOZ_ARG_DISABLE_BOOL(cookies,
8195 [ --disable-cookies Disable cookie support],
8198 AC_SUBST(NECKO_COOKIES)
8199 if test "$NECKO_COOKIES"; then
8200 AC_DEFINE(NECKO_COOKIES)
8204 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8206 MOZ_ARG_DISABLE_BOOL(ctypes,
8207 [ --disable-ctypes Disable js-ctypes],
8210 AC_SUBST(BUILD_CTYPES)
8211 if test "$BUILD_CTYPES"; then
8212 AC_DEFINE(BUILD_CTYPES)
8215 dnl NECKO_ configuration options are not global
8216 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8218 dnl Build Places if required
8219 if test "$MOZ_PLACES"; then
8220 AC_DEFINE(MOZ_PLACES)
8223 dnl Build Apps in the Cloud (AITC) if required
8224 AC_SUBST(MOZ_SERVICES_AITC)
8225 if test -n "$MOZ_SERVICES_AITC"; then
8226 AC_DEFINE(MOZ_SERVICES_AITC)
8229 dnl Build Notifications if required
8230 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8231 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8232 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8235 dnl Build Sync Services if required
8236 AC_SUBST(MOZ_SERVICES_SYNC)
8237 if test -n "$MOZ_SERVICES_SYNC"; then
8238 AC_DEFINE(MOZ_SERVICES_SYNC)
8241 dnl ========================================================
8242 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8243 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8246 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8247 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8250 if test "$MOZ_APP_COMPONENT_MODULES"; then
8251 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8254 dnl ========================================================
8256 dnl = Maintainer debug option (no --enable equivalent)
8258 dnl ========================================================
8263 AC_SUBST(AR_EXTRACT)
8267 AC_SUBST(AS_DASH_C_FLAG)
8276 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8277 AC_SUBST(MOZ_UPDATE_XTERM)
8278 AC_SUBST(MOZ_PLATFORM_MAEMO)
8279 AC_SUBST(MOZ_AUTH_EXTENSION)
8280 AC_SUBST(MOZ_PERMISSIONS)
8282 AC_SUBST(MOZ_PREF_EXTENSIONS)
8283 AC_SUBST(MOZ_JS_LIBS)
8286 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8287 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8288 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8289 AC_SUBST(MOZ_DEBUG_FLAGS)
8290 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8291 AC_SUBST(WARNINGS_AS_ERRORS)
8292 AC_SUBST(MOZ_EXTENSIONS)
8293 AC_SUBST(MOZ_JSDEBUGGER)
8294 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8297 AC_SUBST(MOZ_CALLGRIND)
8300 AC_SUBST(MOZ_PROFILING)
8302 AC_SUBST(MOZ_PLACES)
8303 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8305 AC_SUBST(NS_PRINTING)
8307 AC_SUBST(MOZ_HELP_VIEWER)
8308 AC_SUBST(TOOLCHAIN_PREFIX)
8314 AC_SUBST(MOZ_PROFILELOCKING)
8316 AC_SUBST(ENABLE_TESTS)
8317 AC_SUBST(ENABLE_MARIONETTE)
8319 AC_SUBST(MOZ_UNIVERSALCHARDET)
8320 AC_SUBST(ACCESSIBILITY)
8321 AC_SUBST(MOZ_SPELLCHECK)
8322 AC_SUBST(MOZ_JAVA_COMPOSITOR)
8323 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8324 AC_SUBST(MOZ_CRASHREPORTER)
8325 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8326 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8327 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8328 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8329 AC_SUBST(MOZ_UPDATER)
8330 AC_SUBST(MOZ_ANGLE_RENDERER)
8331 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8332 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8333 AC_SUBST(MOZ_D3DX9_VERSION)
8334 AC_SUBST(MOZ_D3DX9_CAB)
8335 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8336 AC_SUBST(MOZ_D3DX9_DLL)
8337 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8340 AC_SUBST(MOZ_ANDROID_HISTORY)
8341 AC_SUBST(MOZ_WEBSMS_BACKEND)
8342 AC_SUBST(ENABLE_STRIP)
8343 AC_SUBST(PKG_SKIP_STRIP)
8344 AC_SUBST(STRIP_FLAGS)
8345 AC_SUBST(USE_ELF_DYNSTR_GC)
8346 AC_SUBST(USE_ELF_HACK)
8347 AC_SUBST(INCREMENTAL_LINKER)
8348 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8349 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8351 AC_SUBST(MOZ_FIX_LINK_PATHS)
8352 AC_SUBST(XPCOM_LIBS)
8353 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8354 AC_SUBST(XPCOM_GLUE_LDOPTS)
8355 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8356 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8357 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8359 AC_SUBST(USE_DEPENDENT_LIBS)
8361 AC_SUBST(MOZ_BUILD_ROOT)
8362 AC_SUBST(MOZ_OS2_TOOLS)
8364 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8365 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8366 AC_SUBST(MOZ_LINKER_EXTRACT)
8367 AC_SUBST(MOZ_PER_WINDOW_PRIVATE_BROWSING)
8369 dnl ========================================================
8370 dnl = Mac bundle name prefix
8371 dnl ========================================================
8372 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8373 [ --with-macbundlename-prefix=prefix
8374 Prefix for MOZ_MACBUNDLE_NAME],
8375 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8377 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8378 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8379 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8382 if test "$MOZ_DEBUG"; then
8383 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8385 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8387 AC_SUBST(MOZ_MACBUNDLE_NAME)
8389 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8390 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8391 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8392 if test "$MOZ_DEBUG"; then
8393 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8396 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8397 AC_SUBST(MOZ_MACBUNDLE_ID)
8399 # The following variables are available to branding and application
8400 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8401 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8402 # impacts profile location and user-visible fields.
8403 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8404 # versions of a given application (e.g. Aurora and Firefox both use
8405 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8406 # for application.ini's "Name" field, which controls profile location in
8407 # the absence of a "Profile" field (see below), and various system
8408 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8409 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8410 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8411 # builds (e.g. Aurora for Firefox).
8412 # - MOZ_APP_VERSION: Defines the application version number.
8413 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8414 # defaults to a lowercase form of MOZ_APP_BASENAME.
8415 # - MOZ_APP_PROFILE: When set, used for application.ini's
8416 # "Profile" field, which controls profile location.
8417 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8418 # crash reporter server url.
8419 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8420 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8422 if test -z "$MOZ_APP_NAME"; then
8423 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8426 # For extensions and langpacks, we require a max version that is compatible
8427 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8428 # 10.0a1 and 10.0a2 aren't affected
8429 # 10.0 becomes 10.0.*
8430 # 10.0.1 becomes 10.0.*
8431 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8432 if test -z "$IS_ALPHA"; then
8434 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8437 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8440 AC_SUBST(MOZ_APP_NAME)
8441 AC_SUBST(MOZ_APP_DISPLAYNAME)
8442 AC_SUBST(MOZ_APP_BASENAME)
8443 AC_SUBST(MOZ_APP_VENDOR)
8444 AC_SUBST(MOZ_APP_PROFILE)
8445 AC_SUBST(MOZ_APP_ID)
8446 AC_SUBST(MAR_CHANNEL_ID)
8447 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8448 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8449 AC_SUBST(MOZ_EXTENSION_MANAGER)
8450 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8451 AC_SUBST(MOZ_APP_UA_NAME)
8452 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8453 AC_SUBST(MOZ_APP_VERSION)
8454 AC_SUBST(MOZ_APP_MAXVERSION)
8455 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8456 AC_SUBST(FIREFOX_VERSION)
8458 # We can't use the static application.ini data when building against
8460 if test -n "$LIBXUL_SDK"; then
8463 AC_SUBST(MOZ_APP_STATIC_INI)
8465 AC_SUBST(MOZ_PKG_SPECIAL)
8467 AC_SUBST(MOZILLA_OFFICIAL)
8469 if test "$MOZ_TELEMETRY_REPORTING"; then
8470 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8474 AC_SUBST(MOZ_MAPINFO)
8475 AC_SUBST(MOZ_BROWSE_INFO)
8476 AC_SUBST(MOZ_TOOLS_DIR)
8477 AC_SUBST(WIN32_REDIST_DIR)
8480 dnl Echo the CFLAGS to remove extra whitespace.
8486 $_WARNINGS_CXXFLAGS \
8489 COMPILE_CFLAGS=`echo \
8494 COMPILE_CXXFLAGS=`echo \
8495 $_DEFINES_CXXFLAGS \
8499 AC_SUBST(MOZ_NATIVE_MAKEDEPEND)
8500 AC_SUBST(SYSTEM_LIBXUL)
8501 AC_SUBST(MOZ_NATIVE_JPEG)
8502 AC_SUBST(MOZ_NATIVE_PNG)
8503 AC_SUBST(MOZ_NATIVE_BZ2)
8505 AC_SUBST(MOZ_FLEXBOX)
8506 AC_SUBST(MOZ_JPEG_CFLAGS)
8507 AC_SUBST(MOZ_JPEG_LIBS)
8508 AC_SUBST(MOZ_BZ2_CFLAGS)
8509 AC_SUBST(MOZ_BZ2_LIBS)
8510 AC_SUBST(MOZ_PNG_CFLAGS)
8511 AC_SUBST(MOZ_PNG_LIBS)
8513 AC_SUBST(NSPR_CFLAGS)
8515 AC_SUBST(MOZ_NATIVE_NSPR)
8517 AC_SUBST(NSS_CFLAGS)
8519 AC_SUBST(NSS_DEP_LIBS)
8520 AC_SUBST(MOZ_NATIVE_NSS)
8521 AC_SUBST(NSS_DISABLE_DBM)
8524 OS_CXXFLAGS="$CXXFLAGS"
8525 OS_CPPFLAGS="$CPPFLAGS"
8526 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8527 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8528 OS_LDFLAGS="$LDFLAGS"
8531 AC_SUBST(OS_CXXFLAGS)
8532 AC_SUBST(OS_CPPFLAGS)
8533 AC_SUBST(OS_COMPILE_CFLAGS)
8534 AC_SUBST(OS_COMPILE_CXXFLAGS)
8535 AC_SUBST(OS_LDFLAGS)
8537 AC_SUBST(CROSS_COMPILE)
8538 AC_SUBST(WCHAR_CFLAGS)
8542 AC_SUBST(HOST_CFLAGS)
8543 AC_SUBST(HOST_CXXFLAGS)
8544 AC_SUBST(HOST_LDFLAGS)
8545 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8547 AC_SUBST(HOST_AR_FLAGS)
8549 AC_SUBST(HOST_RANLIB)
8550 AC_SUBST(HOST_NSPR_MDCPUCFG)
8551 AC_SUBST(HOST_BIN_SUFFIX)
8552 AC_SUBST(HOST_OS_ARCH)
8554 AC_SUBST(TARGET_CPU)
8555 AC_SUBST(TARGET_VENDOR)
8557 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8558 AC_SUBST(TARGET_MD_ARCH)
8559 AC_SUBST(TARGET_XPCOM_ABI)
8562 AC_SUBST(OS_RELEASE)
8565 AC_SUBST(INTEL_ARCHITECTURE)
8567 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8569 AC_SUBST(WRAP_LDFLAGS)
8572 AC_SUBST(MKSHLIB_FORCE_ALL)
8573 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8574 AC_SUBST(DSO_CFLAGS)
8575 AC_SUBST(DSO_PIC_CFLAGS)
8576 AC_SUBST(DSO_LDOPTS)
8577 AC_SUBST(LIB_PREFIX)
8578 AC_SUBST(DLL_PREFIX)
8579 AC_SUBST(DLL_SUFFIX)
8580 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8581 AC_SUBST(LIB_SUFFIX)
8582 AC_SUBST(OBJ_SUFFIX)
8583 AC_SUBST(BIN_SUFFIX)
8584 AC_SUBST(ASM_SUFFIX)
8585 AC_SUBST(IMPORT_LIB_SUFFIX)
8587 AC_SUBST(CC_VERSION)
8588 AC_SUBST(CXX_VERSION)
8589 AC_SUBST(MSMANIFEST_TOOL)
8590 AC_SUBST(NS_ENABLE_TSF)
8591 AC_SUBST(MOZ_NSS_PATCH)
8592 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8593 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8596 AC_SUBST(MOZ_SYDNEYAUDIO)
8597 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8600 AC_SUBST(MOZ_VORBIS)
8601 AC_SUBST(MOZ_TREMOR)
8604 AC_SUBST(MOZ_MEDIA_PLUGINS)
8605 AC_SUBST(MOZ_OMX_PLUGIN)
8606 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8607 AC_SUBST(MOZ_VP8_ENCODER)
8610 AC_SUBST(MOZ_ALSA_LIBS)
8611 AC_SUBST(MOZ_ALSA_CFLAGS)
8613 AC_SUBST(VPX_ASFLAGS)
8614 AC_SUBST(VPX_DASH_C_FLAG)
8615 AC_SUBST(VPX_AS_CONVERSION)
8616 AC_SUBST(VPX_ASM_SUFFIX)
8617 AC_SUBST(VPX_X86_ASM)
8618 AC_SUBST(VPX_ARM_ASM)
8619 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8620 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8621 AC_SUBST(LIBJPEG_TURBO_AS)
8622 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8623 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8624 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8625 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8627 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8629 AC_MSG_CHECKING([for posix_fallocate])
8630 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8631 #include <fcntl.h>],
8632 [posix_fallocate(0, 0, 0);],
8633 [ac_cv___posix_fallocate=true],
8634 [ac_cv___posix_fallocate=false])
8636 if test "$ac_cv___posix_fallocate" = true ; then
8637 AC_DEFINE(HAVE_POSIX_FALLOCATE)
8643 dnl Check for missing components
8644 if test "$COMPILE_ENVIRONMENT"; then
8645 if test "$MOZ_X11"; then
8646 if test "$WITHOUT_X11"; then
8647 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8649 dnl ====================================================
8650 dnl = Check if X headers exist
8651 dnl ====================================================
8652 _SAVE_CFLAGS=$CFLAGS
8653 CFLAGS="$CFLAGS $XCFLAGS"
8657 #include <X11/Xlib.h>
8658 #include <X11/Intrinsic.h>
8659 #include <X11/extensions/XShm.h>
8663 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8664 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8668 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8669 CFLAGS="$_SAVE_CFLAGS"
8671 if test -n "$MISSING_X"; then
8672 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8677 dnl Check for headers, etc. needed by WebGL.
8678 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8679 MOZ_CHECK_HEADER(GL/glx.h)
8680 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8681 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))])
8683 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8684 fi # COMPILE_ENVIRONMENT
8686 dnl Set various defines and substitutions
8687 dnl ========================================================
8689 if test "$OS_ARCH" = "Darwin"; then
8691 AC_DEFINE(UNIX_ASYNC_DNS)
8692 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8694 AC_DEFINE(UNIX_ASYNC_DNS)
8697 if test "$MOZ_DEBUG"; then
8698 AC_DEFINE(MOZ_REFLOW_PERF)
8699 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8702 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8703 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8704 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8705 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8706 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8707 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8708 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8709 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8710 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8715 WIN_TOP_SRC=`cd $srcdir; pwd -W`
8719 AC_SUBST(WIN_TOP_SRC)
8721 AC_SUBST(MOZILLA_VERSION)
8723 AC_SUBST(ac_configure_args)
8725 dnl Spit out some output
8726 dnl ========================================================
8728 dnl The following defines are used by xpcom
8729 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8731 HAVE_CPP_2BYTE_WCHAR_T
8732 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8734 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8735 HAVE_CPP_PARTIAL_SPECIALIZATION
8736 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8738 NEED_CPP_UNUSED_IMPLEMENTATIONS
8742 HAVE_ICONV_WITH_CONST_INPUT
8750 netwerk/necko-config.h
8751 xpcom/xpcom-config.h
8752 xpcom/xpcom-private.h
8755 # Hack around an Apple bug that effects the egrep that comes with OS X 10.7.
8756 # "arch -arch i386 egrep" always uses the 32-bit Intel part of the egrep fat
8757 # binary, even on 64-bit systems. We (apparently) only need this hack when
8758 # egrep's "pattern" is particularly long (as in the following code).
8762 FIXED_EGREP="arch -arch i386 egrep"
8769 # Save the defines header file before autoconf removes it.
8770 # (Do not add AC_DEFINE calls after this line.)
8771 _CONFIG_TMP=confdefs-tmp.h
8772 _CONFIG_DEFS_H=mozilla-config.h
8774 cat > $_CONFIG_TMP <<\EOF
8775 /* List of defines generated by configure. Included with preprocessor flag,
8776 * -include, to avoid long list of -D defines on the compile command-line.
8780 #ifndef _MOZILLA_CONFIG_H_
8781 #define _MOZILLA_CONFIG_H_
8784 _EGREP_PATTERN='^#define ('
8785 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8786 for f in $_NON_GLOBAL_ACDEFINES; do
8787 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8790 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8792 sort confdefs.h | $FIXED_EGREP -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8794 if test "$?" != 0; then
8795 AC_MSG_ERROR([Error outputting config definitions])
8798 cat >> $_CONFIG_TMP <<\EOF
8800 /* The c99 defining the limit macros (UINT32_MAX for example), says:
8801 * C++ implementations should define these macros only when __STDC_LIMIT_MACROS
8802 * is defined before <stdint.h> is included. */
8803 #define __STDC_LIMIT_MACROS
8805 /* Force-include hunspell_alloc_hooks.h for hunspell, so that we don't need to
8806 * modify it directly.
8808 * HUNSPELL_STATIC is defined in extensions/spellcheck/hunspell/src/Makefile.in,
8809 * unless --enable-system-hunspell is defined.
8811 #if defined(HUNSPELL_STATIC)
8812 #include "hunspell_alloc_hooks.h"
8815 #endif /* _MOZILLA_CONFIG_H_ */
8819 # Only write mozilla-config.h when something changes (or it doesn't exist)
8820 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8823 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8824 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8826 echo ==== $_CONFIG_DEFS_H =================================
8830 dnl Probably shouldn't call this manually but we always want the output of DEFS
8831 rm -f confdefs.h.save
8832 mv confdefs.h confdefs.h.save
8833 $FIXED_EGREP -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8834 if test "$?" != 0; then
8835 AC_MSG_ERROR([Error outputting confdefs.h])
8837 AC_OUTPUT_MAKE_DEFS()
8841 mv confdefs.h.save confdefs.h
8843 dnl Create a virtualenv where we can install local Python packages
8844 AC_MSG_RESULT([Creating Python virtualenv])
8846 mkdir -p _virtualenv
8847 MACOSX_DEPLOYMENT_TARGET= PYTHONDONTWRITEBYTECODE= $PYTHON $_topsrcdir/other-licenses/virtualenv/virtualenv.py --system-site-packages ./_virtualenv
8850 PYTHON=$MOZ_BUILD_ROOT/_virtualenv/Scripts/python.exe
8853 PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python
8859 dnl Load the list of Makefiles to generate.
8860 dnl To add new Makefiles, edit allmakefiles.sh.
8861 dnl allmakefiles.sh sets the variable, MAKEFILES.
8862 . ${srcdir}/allmakefiles.sh
8864 dnl Run a perl script to quickly create the makefiles.
8865 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8866 dnl for the files it cannot handle correctly. This way, config.status
8867 dnl will handle these files.
8868 dnl If it fails, nothing is set and config.status will run as usual.
8870 dnl This does not change the $MAKEFILES variable.
8872 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8874 if test "$res" != 0; then
8880 echo $MAKEFILES > unallmakefiles
8882 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8884 AC_OUTPUT($MAKEFILES)
8886 # Generate Makefiles for WebRTC directly from .gyp files
8887 if test "${OS_TARGET}" = "WINNT"; then
8888 if test "$HAVE_64BIT_OS"; then
8893 EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
8896 if test -n "$MOZ_WEBRTC"; then
8897 AC_MSG_RESULT("generating WebRTC Makefiles...")
8899 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}"
8901 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8902 $GYP_WEBRTC_OPTIONS \
8903 --generator-output=${_objdir}/media/webrtc/trunk \
8904 ${srcdir}/media/webrtc/trunk/peerconnection.gyp
8905 if test "$?" != 0; then
8906 AC_MSG_ERROR([failed to generate WebRTC Makefiles])
8909 # XXX disable until we land the tranche with signaling
8910 if test -n "$MOZ_WEBRTC_SIGNALING"; then
8911 AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
8912 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8913 $GYP_WEBRTC_OPTIONS \
8914 --generator-output=${_objdir}/media/webrtc/signaling \
8915 ${srcdir}/media/webrtc/signaling/signaling.gyp
8916 if test "$?" != 0; then
8917 AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
8921 AC_MSG_RESULT("generating gtest Makefiles...")
8922 # Ok to pass some extra -D's that are ignored here
8923 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8924 $GYP_WEBRTC_OPTIONS \
8925 --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
8926 ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
8927 if test "$?" != 0; then
8928 AC_MSG_ERROR([failed to generate gtest Makefiles])
8932 # Populate the virtualenv
8933 AC_MSG_RESULT([Populating Python virtualenv])
8934 $MAKE -C build/virtualenv MACOSX_DEPLOYMENT_TARGET= || exit 1
8936 # Generate a JSON config file for unittest harnesses etc to read
8937 # build configuration details from in a standardized way.
8938 OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
8939 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
8940 $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
8941 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
8942 rm ./mozinfo.json.tmp
8944 mv -f ./mozinfo.json.tmp ./mozinfo.json
8947 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8948 if test "$CAIRO_FEATURES_H"; then
8949 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8950 echo "$CAIRO_FEATURES_H is unchanged"
8951 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8953 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8957 # Run jemalloc configure script
8959 if test "$MOZ_JEMALLOC" -a "$MOZ_MEMORY"; then
8960 ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
8961 if test "$OS_ARCH" = "Linux"; then
8962 MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
8965 if test -n "$_WRAP_MALLOC"; then
8966 JEMALLOC_WRAPPER=__wrap_
8968 for mangle in ${MANGLE}; do
8969 if test -n "$MANGLED"; then
8970 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
8972 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
8975 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
8978 if test -z "$MOZ_TLS"; then
8979 ac_configure_args="$ac_configure_args --disable-tls"
8981 EXTRA_CFLAGS="$CFLAGS"
8982 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
8983 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
8985 if test "$CROSS_COMPILE"; then
8986 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
8988 _save_cache_file="$cache_file"
8989 cache_file=$_objdir/memory/jemalloc/src/config.cache
8990 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
8991 cache_file="$_save_cache_file"
8992 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8995 dnl Build libunwind for Android profiling builds
8996 if test "$OS_TARGET" = "Android" -a "$MOZ_PROFILING"; then
8997 old_ac_configure_arg="$ac_configure_args"
8998 ac_configure_args="--build=${build} --host=${target_alias} --disable-shared --enable-block-signals=no"
8999 if test "$MOZ_DEBUG"; then
9000 ac_configure_args="$ac_configure_args --enable-debug"
9002 if test "$DSO_PIC_CFLAGS"; then
9003 ac_configure_args="$ac_configure_args --with-pic"
9005 ac_configure_args="$ac_configure_args \
9009 CFLAGS=\"$CFLAGS\" \
9010 CXXFLAGS=\"$CXXFLAGS\" \
9011 CPPFLAGS=\"$CPPFLAGS\" \
9013 LDFLAGS=\"$LDFLAGS\" \
9015 RANLIB=\"$RANLIB\" \
9019 # Use a separate cache file for libunwind, since it does not use caching.
9020 mkdir -p $_objdir/tools/profiler/libunwind/src
9021 old_cache_file=$cache_file
9022 cache_file=$_objdir/tools/profiler/libunwind/src/config.cache
9023 old_config_files=$CONFIG_FILES
9025 AC_OUTPUT_SUBDIRS(tools/profiler/libunwind/src)
9026 cache_file=$old_cache_file
9027 ac_configure_args="$old_ac_configure_args"
9028 CONFIG_FILES=$old_config_files
9031 # Run freetype configure script
9033 if test "$MOZ_TREE_FREETYPE"; then
9034 export CFLAGS="$CFLAGS -std=c99"
9035 export CPPFLAGS="$CPPFLAGS"
9036 export CXXFLAGS="$CXXFLAGS"
9037 export LDFLAGS="$LDFLAGS"
9038 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9039 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9040 AC_OUTPUT_SUBDIRS(modules/freetype2)
9043 if test -z "$direct_nspr_config"; then
9044 dnl ========================================================
9045 dnl = Setup a nice relatively clean build environment for
9046 dnl = sub-configures.
9047 dnl ========================================================
9050 CFLAGS="$_SUBDIR_CFLAGS"
9051 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9052 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9053 LDFLAGS="$_SUBDIR_LDFLAGS"
9054 HOST_CC="$_SUBDIR_HOST_CC"
9055 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9056 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9063 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9064 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9068 if test -n "$_WRAP_MALLOC"; then
9069 # Avoid doubling wrap malloc arguments
9070 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9073 if test -z "$MOZ_NATIVE_NSPR"; then
9074 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9075 if test -z "$MOZ_DEBUG"; then
9076 ac_configure_args="$ac_configure_args --disable-debug"
9078 ac_configure_args="$ac_configure_args --enable-debug"
9080 if test "$MOZ_OPTIMIZE" = "1"; then
9081 ac_configure_args="$ac_configure_args --enable-optimize"
9082 elif test -z "$MOZ_OPTIMIZE"; then
9083 ac_configure_args="$ac_configure_args --disable-optimize"
9085 if test -n "$HAVE_64BIT_OS"; then
9086 ac_configure_args="$ac_configure_args --enable-64bit"
9088 if test -n "$USE_ARM_KUSER"; then
9089 ac_configure_args="$ac_configure_args --with-arm-kuser"
9091 ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9092 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9093 # dladdr is supported by the new linker, even when the system linker doesn't
9094 # support it. Trick nspr into using dladdr when it's not supported.
9095 _SAVE_CPPFLAGS="$CPPFLAGS"
9096 export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9098 _SAVE_LDFLAGS="$LDFLAGS"
9099 export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9100 AC_OUTPUT_SUBDIRS(nsprpub)
9101 LDFLAGS="$_SAVE_LDFLAGS"
9102 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no; then
9104 CPPFLAGS="$_SAVE_CFLAGS"
9106 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9109 if test -z "$MOZ_NATIVE_NSPR"; then
9110 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9111 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9112 if test "$OS_ARCH" != "WINNT"; then
9113 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9114 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9115 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9116 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9118 rm -f config/autoconf.mk.bak
9121 dnl ========================================================
9122 dnl = Setup a nice relatively clean build environment for
9123 dnl = sub-configures.
9124 dnl ========================================================
9127 CFLAGS="$_SUBDIR_CFLAGS"
9128 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9129 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9130 LDFLAGS="$_SUBDIR_LDFLAGS"
9131 HOST_CC="$_SUBDIR_HOST_CC"
9132 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9133 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9136 # Run the SpiderMonkey 'configure' script.
9137 dist=$MOZ_BUILD_ROOT/dist
9138 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9139 ac_configure_args="$ac_configure_args --enable-threadsafe"
9140 if test "$BUILD_CTYPES"; then
9141 # Build js-ctypes on the platforms we can.
9142 ac_configure_args="$ac_configure_args --enable-ctypes"
9144 if test -z "$JS_SHARED_LIBRARY" ; then
9145 ac_configure_args="$ac_configure_args --disable-shared-js"
9147 if test -z "$MOZ_NATIVE_NSPR"; then
9148 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9149 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9151 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9152 ac_configure_args="$ac_configure_args --prefix=$dist"
9153 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9154 if test "$MOZ_MEMORY"; then
9155 ac_configure_args="$ac_configure_args --enable-jemalloc"
9157 if test -n "$MOZ_GLUE_LDFLAGS"; then
9158 export MOZ_GLUE_LDFLAGS
9160 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9161 export MOZ_GLUE_PROGRAM_LDFLAGS
9163 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9166 export MOZ_NATIVE_ZLIB
9167 export MOZ_ZLIB_CFLAGS
9168 export MOZ_ZLIB_LIBS
9170 export STLPORT_CPPFLAGS
9171 export STLPORT_LDFLAGS
9173 AC_OUTPUT_SUBDIRS(js/src)
9174 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9176 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9178 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9179 dnl Needs to be at the end to respect possible changes from NSPR configure
9180 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9181 echo "config/autoconf.mk is unchanged"
9182 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9184 rm -f config/autoconf.mk.orig 2> /dev/null