2 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
3 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
4 dnl This Source Code Form is subject to the terms of the Mozilla Public
5 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
6 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 dnl Process this file with autoconf to produce a configure script.
9 dnl ========================================================
12 AC_INIT(config/config.mk)
13 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
15 TARGET_CPU="${target_cpu}"
16 TARGET_VENDOR="${target_vendor}"
17 TARGET_OS="${target_os}"
19 MOZ_DEB_TIMESTAMP=`date +"%a, %d %b %Y %T %z" 2>&1`
20 AC_SUBST(MOZ_DEB_TIMESTAMP)
22 dnl ========================================================
24 dnl = Don't change the following two lines. Doing so breaks:
26 dnl = CFLAGS="-foo" ./configure
28 dnl ========================================================
30 CPPFLAGS="${CPPFLAGS=}"
31 CXXFLAGS="${CXXFLAGS=}"
33 HOST_CFLAGS="${HOST_CFLAGS=}"
34 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
35 HOST_LDFLAGS="${HOST_LDFLAGS=}"
37 dnl ========================================================
38 dnl = Preserve certain environment flags passed to configure
39 dnl = We want sub projects to receive the same flags
40 dnl = untainted by this configure script
41 dnl ========================================================
44 _SUBDIR_CFLAGS="$CFLAGS"
45 _SUBDIR_CPPFLAGS="$CPPFLAGS"
46 _SUBDIR_CXXFLAGS="$CXXFLAGS"
47 _SUBDIR_LDFLAGS="$LDFLAGS"
48 _SUBDIR_HOST_CC="$HOST_CC"
49 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
50 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
51 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
52 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
54 dnl Set the version number of the libs included with mozilla
55 dnl ========================================================
61 dnl Set the minimum version of toolkit libs used by mozilla
62 dnl ========================================================
65 PYTHON_VERSION_MAJOR=2
66 PYTHON_VERSION_MINOR=5
70 WINDRES_VERSION=2.14.90
76 STARTUP_NOTIFICATION_VERSION=0.8
82 dnl Set various checks
83 dnl ========================================================
87 dnl Initialize the Pthread test variables early so they can be
88 dnl overridden by each platform.
89 dnl ========================================================
93 dnl Do not allow a separate objdir build if a srcdir build exists.
94 dnl ==============================================================
95 _topsrcdir=`cd \`dirname $0\`; pwd`
98 if test "$_topsrcdir" != "$_objdir"
100 # Check for a couple representative files in the source tree
102 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
103 if test -f $file; then
104 _conflict_files="$_conflict_files $file"
107 if test "$_conflict_files"; then
109 echo "* Your source tree contains these files:"
110 for file in $_conflict_files; do
114 * This indicates that you previously built in the source tree.
115 * A source tree build can confuse the separate objdir build.
117 * To clean up the source tree:
130 COMPILE_ENVIRONMENT=1
131 MOZ_ARG_DISABLE_BOOL(compile-environment,
132 [ --disable-compile-environment
133 Disable compiler/library checks.],
134 COMPILE_ENVIRONMENT= )
135 AC_SUBST(COMPILE_ENVIRONMENT)
137 MOZ_ARG_WITH_STRING(l10n-base,
138 [ --with-l10n-base=DIR path to l10n repositories],
139 L10NBASEDIR=$withval)
140 if test -n "$L10NBASEDIR"; then
141 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
142 AC_MSG_ERROR([--with-l10n-base must specify a path])
143 elif test -d "$L10NBASEDIR"; then
144 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
146 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
149 AC_SUBST(L10NBASEDIR)
151 dnl Check for Perl first -- needed for win32 SDK checks
152 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
153 if test -z "$PERL" -o "$PERL" = ":"; then
154 AC_MSG_ERROR([perl not found in \$PATH])
158 if test -n "$GAIADIR" ; then
159 AC_DEFINE(PACKAGE_GAIA)
162 MOZ_ARG_WITH_STRING(gonk,
164 location of gonk dir],
167 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
168 [ --with-gonk-toolchain-prefix=DIR
169 prefix to gonk toolchain commands],
170 gonk_toolchain_prefix=$withval)
172 if test -n "$gonkdir" ; then
173 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
174 android_source="$gonkdir"
175 ANDROID_SOURCE="$android_source"
176 ANDROID_NDK="${ANDROID_SOURCE}/ndk"
179 TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
180 AS="$gonk_toolchain_prefix"as
181 CC="$gonk_toolchain_prefix"gcc
182 CXX="$gonk_toolchain_prefix"g++
183 CPP="$gonk_toolchain_prefix"cpp
184 LD="$gonk_toolchain_prefix"ld
185 AR="$gonk_toolchain_prefix"ar
186 RANLIB="$gonk_toolchain_prefix"ranlib
187 STRIP="$gonk_toolchain_prefix"strip
189 STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/ -I$gonkdir/external/stlport/stlport/"
190 STLPORT_LIBS="-lstlport"
192 case "$target_cpu" in
201 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 -I$gonkdir/external/bluetooth/bluez/lib $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice -I$gonkdir/frameworks/base/services/camera -I$gonkdir/system/media/wilhelm/include -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/dalvik/libnativehelper/include/nativehelper"
202 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
203 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
204 dnl Add -llog by default, since we use it all over the place.
205 LIBS="$LIBS -llog $STLPORT_LIBS"
207 LDFLAGS="-mandroid -L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ $LDFLAGS"
209 dnl prevent cross compile section from using these flags as host flags
210 if test -z "$HOST_CPPFLAGS" ; then
213 if test -z "$HOST_CFLAGS" ; then
216 if test -z "$HOST_CXXFLAGS" ; then
219 if test -z "$HOST_LDFLAGS" ; then
224 AC_DEFINE(HAVE_SYS_UIO_H)
225 AC_DEFINE(HAVE_PTHREADS)
227 MOZ_CHROME_FILE_FORMAT=omni
233 *-android*|*-linuxandroid*)
234 if test -z "$ANDROID_PACKAGE_NAME" ; then
235 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
237 MOZ_CHROME_FILE_FORMAT=omni
241 AC_PATH_PROG(OBJCOPY,objcopy)
246 AC_SUBST(ANDROID_SOURCE)
247 AC_SUBST(ANDROID_PACKAGE_NAME)
250 dnl ========================================================
251 dnl Checks for compilers.
252 dnl ========================================================
253 dnl Set CROSS_COMPILE in the environment when running configure
254 dnl to use the cross-compile setup for now
255 dnl ========================================================
257 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
260 if test "$COMPILE_ENVIRONMENT"; then
262 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
263 echo "cross compiling from $host to $target"
267 _SAVE_CFLAGS="$CFLAGS"
268 _SAVE_LDFLAGS="$LDFLAGS"
270 AC_MSG_CHECKING([for host c compiler])
271 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
272 if test -z "$HOST_CC"; then
273 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
275 AC_MSG_RESULT([$HOST_CC])
276 AC_MSG_CHECKING([for host c++ compiler])
277 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
278 if test -z "$HOST_CXX"; then
279 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
281 AC_MSG_RESULT([$HOST_CXX])
283 if test -z "$HOST_CFLAGS"; then
284 HOST_CFLAGS="$CFLAGS"
286 if test -z "$HOST_CXXFLAGS"; then
287 HOST_CXXFLAGS="$CXXFLAGS"
289 if test -z "$HOST_LDFLAGS"; then
290 HOST_LDFLAGS="$LDFLAGS"
292 if test -z "$HOST_AR_FLAGS"; then
293 HOST_AR_FLAGS="$AR_FLAGS"
295 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
296 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
298 CFLAGS="$HOST_CFLAGS"
299 LDFLAGS="$HOST_LDFLAGS"
301 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
302 AC_TRY_COMPILE([], [return(0);],
303 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
304 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
307 CFLAGS="$HOST_CXXFLAGS"
309 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
310 AC_TRY_COMPILE([], [return(0);],
311 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
312 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
316 LDFLAGS=$_SAVE_LDFLAGS
318 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
321 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
325 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
326 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
327 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
328 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
329 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
330 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
331 AC_DEFINE(CROSS_COMPILE)
336 # Work around the conftest.exe access problem on Windows
341 MOZ_PATH_PROGS(AS, $AS as, $CC)
342 AC_CHECK_PROGS(AR, ar, :)
343 AC_CHECK_PROGS(LD, ld, :)
344 AC_CHECK_PROGS(STRIP, strip, :)
345 AC_CHECK_PROGS(WINDRES, windres, :)
346 if test -z "$HOST_CC"; then
349 if test -z "$HOST_CFLAGS"; then
350 HOST_CFLAGS="$CFLAGS"
352 if test -z "$HOST_CXX"; then
355 if test -z "$HOST_CXXFLAGS"; then
356 HOST_CXXFLAGS="$CXXFLAGS"
358 if test -z "$HOST_LDFLAGS"; then
359 HOST_LDFLAGS="$LDFLAGS"
361 if test -z "$HOST_RANLIB"; then
362 HOST_RANLIB="$RANLIB"
364 if test -z "$HOST_AR"; then
367 if test -z "$HOST_AR_FLAGS"; then
368 HOST_AR_FLAGS="$AR_FLAGS"
372 if test -n "$MOZ_WINCONSOLE"; then
373 AC_DEFINE(MOZ_WINCONSOLE)
378 dnl ========================================================
379 dnl Special win32 checks
380 dnl ========================================================
382 # With win8, sdk target=602, WINVER=602
383 MOZ_ARG_ENABLE_BOOL(metro,
384 [ --enable-metro Enable Windows Metro build targets],
387 if test -n "$MOZ_METRO"; then
389 # Target the Windows 8 Kit
391 # Allow a higher api set
393 # toolkit/library/makefile.in needs these, see nsDllMain.
395 CRTEXPDLLVERSION=1-1-0
397 # Target the Windows 7 SDK by default
402 AC_SUBST(CRTDLLVERSION)
403 AC_SUBST(CRTEXPDLLVERSION)
405 if test -n "$MOZ_METRO"; then
410 AC_MSG_ERROR([Metro builds only valid on the windows platform.]);
415 MOZ_ARG_WITH_STRING(windows-version,
416 [ --with-windows-version=WINSDK_TARGETVER
417 Windows SDK version to target. Lowest version
418 currently allowed is 601 (Win7), highest is 602 (Win8)],
419 WINSDK_TARGETVER=$withval)
421 # Currently only two sdk versions allowed, 601 and 602
422 case "$WINSDK_TARGETVER" in
424 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
428 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
434 if test "$GCC" != "yes"; then
435 # Check to see if we are really running in a msvc environemnt
437 AC_CHECK_PROGS(MIDL, midl)
439 # Make sure compilers are valid
440 CFLAGS="$CFLAGS -TC -nologo"
441 CXXFLAGS="$CXXFLAGS -TP -nologo"
444 AC_TRY_COMPILE([#include <stdio.h>],
445 [ printf("Hello World\n"); ],,
446 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
449 AC_TRY_COMPILE([#include <new.h>],
450 [ unsigned *test = new unsigned(42); ],,
451 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
455 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
458 # Determine compiler version
459 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
460 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
461 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
462 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
463 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
464 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
466 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
467 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
469 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
470 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
473 if test "$_CC_MAJOR_VERSION" = "14"; then
474 dnl Require VC8SP1 or newer.
475 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
476 if test "$_CC_RELEASE" -lt 50727 -o \
477 \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
478 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.])
483 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
484 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
485 elif test "$_CC_MAJOR_VERSION" = "15"; then
488 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
489 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
490 elif test "$_CC_MAJOR_VERSION" = "16"; then
493 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
494 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
495 elif test "$_CC_MAJOR_VERSION" = "17"; then
498 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
499 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
501 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
504 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
506 if test -n "$WIN32_REDIST_DIR"; then
507 if test ! -d "$WIN32_REDIST_DIR"; then
508 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
510 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
513 dnl Confirm we have the pri tools on win8 builds
514 if test -n "$MOZ_METRO"; then
515 AC_MSG_CHECKING([for makepri])
516 AC_CHECK_PROGS(MAKEPRI, makepri, "")
517 if test -z "MAKEPRI" ; then
518 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
523 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
524 dnl not something else like "magnetic tape manipulation utility".
525 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
526 if test -z "$MSMT_TOOL"; then
527 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
531 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
533 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
534 if test -z "$MSMANIFEST_TOOL_VERSION"; then
535 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
541 # Check linker version
542 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
543 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
544 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
545 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
551 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
552 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
553 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
554 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
555 # Add flags if necessary
556 AC_MSG_CHECKING([for midl flags])
559 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
560 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
561 # MIDL version 7.00.0500 or later has no problem.
562 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
563 AC_MSG_RESULT([need -env win32])
565 AC_MSG_RESULT([none needed])
569 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
572 AC_MSG_RESULT([none needed])
576 # Identify which version of the SDK we're building with
577 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
579 MOZ_CHECK_HEADERS([winsdkver.h])
580 if test "$ac_cv_header_winsdkver_h" = "yes"; then
581 # Get the highest _WIN32_WINNT and NTDDI versions supported
582 # Take the higher of the two
583 # This is done because the Windows 7 beta SDK reports its
584 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
585 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
587 [cat > conftest.h <<EOF
588 #include <winsdkver.h>
589 #include <sdkddkver.h>
591 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
592 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
594 #define WINSDK_MAXVER NTDDI_MAXVER
599 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
602 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
604 # Any SDK which doesn't have WinSDKVer.h is too old.
605 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.])
608 unset _MSVC_VER_FILTER
610 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
614 _SAVE_CXXFLAGS="$CXXFLAGS"
615 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
616 AC_TRY_COMPILE([#include <exception>],
617 [std::_Throw(std::exception()); return 0;],
618 ac_cv_have_std__Throw="yes",
619 ac_cv_have_std__Throw="no")
620 CXXFLAGS="$_SAVE_CXXFLAGS"
624 if test "$ac_cv_have_std__Throw" = "yes"; then
625 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
626 ac_cv_have_dllimport_exception_bug,
630 _SAVE_CXXFLAGS="$CXXFLAGS"
631 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
632 AC_TRY_LINK([#include <vector>],
633 [std::vector<int> v; return v.at(1);],
634 ac_cv_have_dllimport_exception_bug="no",
635 ac_cv_have_dllimport_exception_bug="yes")
636 CXXFLAGS="$_SAVE_CXXFLAGS"
639 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
641 MOZ_MSVC_STL_WRAP__Throw=1
642 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
645 AC_CACHE_CHECK(for overridable _RAISE,
650 _SAVE_CXXFLAGS="$CXXFLAGS"
651 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
652 AC_TRY_COMPILE([#include <xstddef>
654 #define _RAISE(x) externallyDefinedFunction((x).what())
657 [std::vector<int> v; return v.at(1);],
658 ac_cv_have__RAISE="no",
659 ac_cv_have__RAISE="yes")
660 CXXFLAGS="$_SAVE_CXXFLAGS"
663 if test "$ac_cv_have__RAISE" = "yes"; then
665 MOZ_MSVC_STL_WRAP__RAISE=1
666 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
668 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
672 if test "$WRAP_STL_INCLUDES" = "1"; then
673 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
676 # Check w32api version
677 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
678 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
679 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
680 AC_TRY_COMPILE([#include <w32api.h>],
681 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
682 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
683 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
684 #error "test failed."
686 , [ res=yes ], [ res=no ])
687 AC_MSG_RESULT([$res])
688 if test "$res" != "yes"; then
689 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
691 # Check windres version
692 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
693 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
694 AC_MSG_RESULT([$_WINDRES_VERSION])
695 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
696 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
697 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
698 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
699 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
700 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
701 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
702 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
703 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
704 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
705 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
706 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
708 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
711 MOZ_WINSDK_MAXVER=0x06020000
714 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
715 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
716 # Require OS features provided by IE 6.0 SP2 (XP SP2)
717 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
719 # If the maximum version supported by this SDK is lower than the target
721 AC_MSG_CHECKING([for Windows SDK being recent enough])
722 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
726 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.])
729 # Make sure the sdk / code we're targeting has the right toolset
730 AC_MSG_CHECKING([SDK and tools are in sync])
731 if test -n "$MOZ_METRO"; then
732 if test "$MOZ_MSVCVERSION" -gt "10"; then
736 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.])
740 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
741 # Definitions matching sdkddkver.h
742 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
749 if test -n "$_WIN32_MSVC"; then
751 SKIP_COMPILER_CHECKS=1
752 SKIP_LIBRARY_CHECKS=1
754 # Since we're skipping compiler and library checks, hard-code
757 AC_DEFINE(HAVE_SETBUF)
758 AC_DEFINE(HAVE_ISATTY)
761 fi # COMPILE_ENVIRONMENT
774 AC_SUBST(WRAP_STL_INCLUDES)
775 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
776 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
778 dnl ========================================================
779 dnl Checks for programs.
780 dnl ========================================================
784 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
785 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
786 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
788 AC_MSG_RESULT([$_perl_version])
790 if test "$_perl_res" != 0; then
791 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
795 AC_MSG_CHECKING([for full perl installation])
796 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
798 if test "$_perl_res" != 0; then
800 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
805 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
806 if test -z "$PYTHON"; then
807 AC_MSG_ERROR([python was not found in \$PATH])
810 MOZ_ARG_WITH_BOOL(system-ply,
811 [ --with-system-ply Use system installed python ply library],
812 [if $PYTHON -c 'import ply' 2>&5; then
815 AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
818 AC_SUBST(MOZ_SYSTEM_PLY)
820 if test -z "$COMPILE_ENVIRONMENT"; then
821 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
823 AC_SUBST(NSINSTALL_BIN)
825 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
826 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
827 MOZ_PATH_PROGS(UNZIP, unzip)
828 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
829 AC_MSG_ERROR([unzip not found in \$PATH])
831 MOZ_PATH_PROGS(ZIP, zip)
832 if test -z "$ZIP" -o "$ZIP" = ":"; then
833 AC_MSG_ERROR([zip not found in \$PATH])
835 MOZ_PATH_PROG(XARGS, xargs)
836 if test -z "$XARGS" -o "$XARGS" = ":"; then
837 AC_MSG_ERROR([xargs not found in \$PATH .])
840 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
843 if test "$COMPILE_ENVIRONMENT"; then
845 dnl ========================================================
846 dnl = Mac OS X toolchain support
847 dnl ========================================================
851 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
852 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
853 dnl the environment and includedir purposes (when using an SDK, below),
854 dnl but remember the full version number for the libdir (SDK).
856 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
857 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
859 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
860 dnl Bug 280479, but this keeps popping up in bug 292530 too because
861 dnl 4.0.0/4061 is the default compiler in Tiger.
863 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
865 if test "$GCC_BUILD" = "4061" ; then
866 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
867 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
868 from building Mozilla. Upgrade to Xcode 2.1 or later.])
872 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
873 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
874 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
875 MOZ_PATH_PROGS(PBBUILD_BIN, pbbuild xcodebuild pbxbuild)
877 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
878 dnl it has moved into /usr/bin.
879 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
883 AC_SUBST(GCC_VERSION)
885 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
886 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
887 dnl when we can run target binaries.
888 AC_SUBST(UNIVERSAL_BINARY)
889 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
891 dnl ========================================================
892 dnl Check for MacOS deployment target version
893 dnl ========================================================
895 MOZ_ARG_ENABLE_STRING(macos-target,
896 [ --enable-macos-target=VER (default=10.6)
897 Set the minimum MacOS version needed at runtime],
898 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
902 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
903 dnl Use the specified value
904 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
906 dnl No value specified on the command line or in the environment,
907 dnl use architecture minimum.
908 export MACOSX_DEPLOYMENT_TARGET=10.6
913 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
915 dnl ========================================================
916 dnl = Mac OS X SDK support
917 dnl ========================================================
920 MOZ_ARG_WITH_STRING(macos-sdk,
921 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
922 MACOS_SDK_DIR=$withval)
924 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
925 dnl NEXT_ROOT will be set and exported only if it's needed.
926 AC_SUBST(MACOS_SDK_DIR)
929 if test "$MACOS_SDK_DIR"; then
930 dnl Sync this section with the ones in NSPR and NSS.
931 dnl Changes to the cross environment here need to be accounted for in
932 dnl the libIDL checks (below) and xpidl build.
934 if test ! -d "$MACOS_SDK_DIR"; then
935 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
936 specify a valid SDK. SDKs are installed when the optional cross-development
937 tools are selected during the Xcode/Developer Tools installation.])
940 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
941 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
942 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
944 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
945 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
947 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
948 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
949 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
951 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
952 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
953 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
954 dnl be ignored and cause warnings when -syslibroot is specified.
955 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
956 dnl the -isysroot it receives, so this is only needed with 4.0.0.
957 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
962 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
964 AC_TRY_COMPILE([#include <new>],[],
968 AC_MSG_RESULT($result)
970 if test "$result" = "no" ; then
971 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
975 fi # COMPILE_ENVIRONMENT
977 AC_MSG_CHECKING([compiler version])
978 # Just print it so it shows up in the logs.
979 cc_version=$($CC --version)
980 AC_MSG_RESULT([$cc_version])
982 if test -n "$MAKE"; then
983 if test `echo $MAKE | grep -c make.py` != 1; then
990 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
993 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
996 if test "$GMAKE" = ":"; then
997 AC_MSG_ERROR([GNU make not found])
1001 if test -z "$MAKE"; then
1005 if test "$COMPILE_ENVIRONMENT"; then
1011 fi # COMPILE_ENVIRONMENT
1013 dnl ========================================================
1014 dnl set the defaults first
1015 dnl ========================================================
1018 AR_EXTRACT='$(AR) x'
1031 MOZ_USER_DIR=".mozilla"
1034 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
1036 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1038 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
1040 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1041 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1042 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1043 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1044 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1045 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1046 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1047 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1049 # These are specially defined on Windows only
1052 XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1053 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
1056 XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
1057 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
1063 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1065 USE_DEPENDENT_LIBS=1
1067 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1069 if test -n "$CROSS_COMPILE"; then
1070 OS_TARGET="${target_os}"
1071 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1073 case "${target_os}" in
1074 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1075 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1076 gnu*) OS_ARCH=GNU ;;
1077 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1078 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
1079 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1082 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1085 OS_TARGET=`uname -s`
1086 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1087 OS_RELEASE=`uname -r`
1090 # Before this used `uname -m` when not cross compiling
1091 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1092 OS_TEST="${target_cpu}"
1094 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1096 #######################################################################
1097 # Master "Core Components" macros for getting the OS target #
1098 #######################################################################
1101 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1102 # cross-compilation.
1106 # Define and override various archtecture-specific variables, including
1115 case "$HOST_OS_ARCH" in
1129 if test -z "$GNU_CC"; then
1130 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1135 if test -z "$GNU_CXX"; then
1136 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1137 SOLARIS_SUNPRO_CXX=1
1140 AC_SUBST(SOLARIS_SUNPRO_CC)
1141 AC_SUBST(SOLARIS_SUNPRO_CXX)
1153 if test -z "$CROSS_COMPILE" ; then
1159 # If uname -s returns "Windows_NT", we assume that we are using
1160 # the uname.exe in MKS toolkit.
1162 # The -r option of MKS uname only returns the major version number.
1163 # So we need to use its -v option to get the minor version number.
1164 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1168 OS_MINOR_RELEASE=`uname -v`
1169 if test "$OS_MINOR_RELEASE" = "00"; then
1172 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1176 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1177 # the uname.exe in the MSYS tools.
1179 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1184 OS_RELEASE=`uname -v`.`uname -r`
1185 OS_TEST=${target_cpu}
1193 OS_RELEASE=`uname -v`
1196 case "${target_cpu}" in
1207 if test -z "$CROSS_COMPILE" ; then
1215 # Only set CPU_ARCH if we recognize the value of OS_TEST
1226 powerpc | ppc | rs6000)
1230 Alpha | alpha | ALPHA)
1263 if test -z "$OS_TARGET"; then
1266 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1268 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1269 dnl ===============================================================
1273 INTEL_ARCHITECTURE=1
1276 dnl Configure platform-specific CPU architecture compiler options.
1277 dnl ==============================================================
1280 dnl =================================================================
1281 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1282 dnl which is bad when cross compiling.
1283 dnl =================================================================
1284 if test "$COMPILE_ENVIRONMENT"; then
1285 configure_static_assert_macros='
1286 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1287 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1288 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1291 dnl test that the macros actually work:
1292 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1293 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1296 ac_cv_static_assertion_macros_work="yes"
1297 AC_TRY_COMPILE([$configure_static_assert_macros],
1298 [CONFIGURE_STATIC_ASSERT(1)],
1300 ac_cv_static_assertion_macros_work="no")
1301 AC_TRY_COMPILE([$configure_static_assert_macros],
1302 [CONFIGURE_STATIC_ASSERT(0)],
1303 ac_cv_static_assertion_macros_work="no",
1306 AC_TRY_COMPILE([$configure_static_assert_macros],
1307 [CONFIGURE_STATIC_ASSERT(1)],
1309 ac_cv_static_assertion_macros_work="no")
1310 AC_TRY_COMPILE([$configure_static_assert_macros],
1311 [CONFIGURE_STATIC_ASSERT(0)],
1312 ac_cv_static_assertion_macros_work="no",
1316 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1317 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1318 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1320 fi # COMPILE_ENVIRONMENT
1322 dnl ========================================================
1323 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1325 dnl ========================================================
1329 dnl ========================================================
1330 dnl Suppress Clang Argument Warnings
1331 dnl ========================================================
1332 if test -n "$CLANG_CC"; then
1333 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1334 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1336 if test -n "$CLANG_CXX"; then
1337 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1340 dnl ========================================================
1341 dnl = Use Address Sanitizer
1342 dnl ========================================================
1343 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1344 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1347 if test -n "$MOZ_ASAN"; then
1353 dnl ========================================================
1354 dnl = Enable hacks required for LLVM instrumentations
1355 dnl ========================================================
1356 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1357 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1360 if test -n "$MOZ_LLVM_HACKS"; then
1364 AC_SUBST(MOZ_NO_WLZDEFS)
1365 AC_SUBST(MOZ_CFLAGS_NSS)
1367 dnl ========================================================
1368 dnl GNU specific defaults
1369 dnl ========================================================
1370 if test "$GNU_CC"; then
1371 # FIXME: Let us build with strict aliasing. bug 414641.
1372 CFLAGS="$CFLAGS -fno-strict-aliasing"
1373 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1374 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1375 DSO_LDOPTS='-shared'
1376 if test "$GCC_USE_GNU_LD"; then
1377 # Some tools like ASan use a runtime library that is only
1378 # linked against executables, so we must allow undefined
1379 # symbols for shared objects in some cases.
1380 if test -z "$MOZ_NO_WLZDEFS"; then
1381 # Don't allow undefined symbols in libraries
1382 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1385 WARNINGS_AS_ERRORS='-Werror -Wno-error=uninitialized'
1387 DSO_PIC_CFLAGS='-fPIC'
1388 ASFLAGS="$ASFLAGS -fPIC"
1389 AC_MSG_CHECKING([for --noexecstack option to as])
1390 _SAVE_CFLAGS=$CFLAGS
1391 CFLAGS="$CFLAGS -Wa,--noexecstack"
1392 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1393 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1394 AC_MSG_RESULT([no]))
1395 CFLAGS=$_SAVE_CFLAGS
1396 AC_MSG_CHECKING([for -z noexecstack option to ld])
1397 _SAVE_LDFLAGS=$LDFLAGS
1398 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1399 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1401 LDFLAGS=$_SAVE_LDFLAGS)
1403 # Check for -mssse3 on $CC
1404 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1405 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1406 _SAVE_CFLAGS=$CFLAGS
1407 CFLAGS="$CFLAGS -mssse3"
1408 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1409 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1410 AC_MSG_RESULT([no]))
1411 CFLAGS=$_SAVE_CFLAGS
1412 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
1414 # Turn on GNU-specific warnings:
1415 # -Wall - turn on a lot of warnings
1416 # -pedantic - this is turned on below
1417 # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1418 # -Wdeclaration-after-statement - MSVC doesn't like these
1419 # -Werror=return-type - catches missing returns, zero false positives
1420 # -Wtype-limits - catches overflow bugs, few false positives
1421 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1423 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1424 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1425 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1426 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1428 # Turn off the following warnings that -Wall/-pedantic turn on:
1429 # -Wno-unused - lots of violations in third-party code
1430 # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1432 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1433 MOZ_C_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_c_has_wno_overlength_strings)
1435 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1436 # Don't use -Wcast-align with ICC or clang
1438 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1439 hppa | ia64 | sparc | arm)
1442 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1447 dnl Turn pedantic on but disable the warnings for long long
1450 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1451 _USE_CPP_INCLUDE_FLAG=1
1453 elif test "$SOLARIS_SUNPRO_CC"; then
1455 if test "$CPU_ARCH" = "sparc"; then
1456 # for Sun Studio on Solaris/SPARC
1457 DSO_PIC_CFLAGS='-xcode=pic32'
1459 DSO_PIC_CFLAGS='-KPIC'
1461 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1463 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1464 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1466 DSO_LDOPTS='-shared'
1467 if test "$GNU_LD"; then
1468 # Don't allow undefined symbols in libraries
1469 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1473 DSO_PIC_CFLAGS='-KPIC'
1474 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1477 if test "$GNU_CXX"; then
1478 # FIXME: Let us build with strict aliasing. bug 414641.
1479 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1481 # Turn on GNU-specific warnings:
1482 # -Wall - turn on a lot of warnings
1483 # -pedantic - this is turned on below
1484 # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1485 # -Woverloaded-virtual - ???
1486 # -Werror=return-type - catches missing returns, zero false positives
1487 # -Wtype-limits - catches overflow bugs, few false positives
1488 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1489 # -Werror=conversion-null - catches conversions between NULL and non-pointer types
1491 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1492 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1493 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1494 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1495 MOZ_CXX_SUPPORTS_WARNING(-W, error=conversion-null, ac_cxx_has_werror_conversion_null)
1497 # Turn off the following warnings that -Wall/-pedantic turn on:
1498 # -Wno-ctor-dtor-privacy - ???
1499 # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1500 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1501 # -Wno-variadic-macros - ???
1503 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-ctor-dtor-privacy"
1504 MOZ_CXX_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_cxx_has_wno_overlength_strings)
1505 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1506 MOZ_CXX_SUPPORTS_WARNING(-Wno-, variadic-macros, ac_cxx_has_wno_variadic_macros)
1508 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1509 # Don't use -Wcast-align with ICC or clang
1511 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1512 hppa | ia64 | sparc | arm)
1515 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1520 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1521 _USE_CPP_INCLUDE_FLAG=1
1523 # Recent clang and gcc support C++11 deleted functions without warnings if
1524 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1525 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1526 # unused. But clang's warning can be disabled, so when compiling with clang
1527 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1528 # deleted function syntax.
1529 if test "$CLANG_CXX"; then
1530 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1531 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1535 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1538 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1539 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1540 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1541 dnl normal behavior.
1542 dnl ========================================================
1544 MKSHLIB_UNFORCE_ALL=
1546 if test "$COMPILE_ENVIRONMENT"; then
1547 if test "$GNU_CC"; then
1548 AC_MSG_CHECKING(whether ld has archive extraction flags)
1549 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1550 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1551 ac_cv_mkshlib_force_and_unforce="no"
1552 exec 3<&0 <<LOOP_INPUT
1553 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1554 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1555 force="-Wl,-all"; unforce="-Wl,-none"
1562 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1565 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1567 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1571 eval $ac_cv_mkshlib_force_and_unforce
1572 MKSHLIB_FORCE_ALL=$force
1573 MKSHLIB_UNFORCE_ALL=$unforce
1576 fi # COMPILE_ENVIRONMENT
1578 dnl ========================================================
1579 dnl Checking for 64-bit OS
1580 dnl ========================================================
1581 if test "$COMPILE_ENVIRONMENT"; then
1584 AC_MSG_CHECKING(for 64-bit OS)
1585 AC_TRY_COMPILE([$configure_static_assert_macros],
1586 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1587 result="yes", result="no")
1588 AC_MSG_RESULT("$result")
1589 if test "$result" = "yes"; then
1590 AC_DEFINE(HAVE_64BIT_OS)
1593 AC_SUBST(HAVE_64BIT_OS)
1595 fi # COMPILE_ENVIRONMENT
1597 dnl ========================================================
1598 dnl Enable high-memory support on OS/2 by default.
1599 dnl ========================================================
1600 MOZ_OS2_HIGH_MEMORY=1
1601 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1602 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1603 MOZ_OS2_HIGH_MEMORY=,
1604 MOZ_OS2_HIGH_MEMORY=1 )
1605 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1607 dnl ========================================================
1608 dnl = Use profiling compile flags
1609 dnl ========================================================
1610 MOZ_ARG_ENABLE_BOOL(profiling,
1611 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1615 # For profiling builds keep the symbol information
1616 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1617 STRIP_FLAGS="--strip-debug"
1620 dnl ========================================================
1621 dnl = Use incremental GC
1622 dnl ========================================================
1624 MOZ_ARG_DISABLE_BOOL(gcincremental,
1625 [ --disable-gcincremental Disable incremental GC],
1627 if test -n "$JSGC_INCREMENTAL"; then
1628 AC_DEFINE(JSGC_INCREMENTAL)
1631 dnl ========================================================
1632 dnl = Use generational GC
1633 dnl ========================================================
1634 MOZ_ARG_ENABLE_BOOL(gcgenerational,
1635 [ --enable-gcgenerational Enable generational GC],
1636 JSGC_GENERATIONAL=1,
1637 JSGC_GENERATIONAL= )
1638 if test -n "$JSGC_GENERATIONAL"; then
1639 AC_DEFINE(JSGC_GENERATIONAL)
1642 dnl ========================================================
1643 dnl = Perform moving GC stack rooting analysis
1644 dnl ========================================================
1645 MOZ_ARG_ENABLE_BOOL(root-analysis,
1646 [ --enable-root-analysis Enable moving GC stack root analysis],
1647 JSGC_ROOT_ANALYSIS=1,
1648 JSGC_ROOT_ANALYSIS= )
1649 if test -n "$JSGC_ROOT_ANALYSIS"; then
1650 AC_DEFINE(JSGC_ROOT_ANALYSIS)
1653 dnl ========================================================
1654 dnl = Use exact stack rooting for GC
1655 dnl ========================================================
1656 MOZ_ARG_ENABLE_BOOL(exact-rooting,
1657 [ --enable-exact-rooting Enable use of exact stack roots for GC],
1658 JSGC_USE_EXACT_ROOTING=1,
1659 JSGC_USE_EXACT_ROOTING= )
1660 if test -n "$JSGC_USE_EXACT_ROOTING"; then
1661 AC_DEFINE(JSGC_USE_EXACT_ROOTING)
1664 dnl ========================================================
1666 dnl ========================================================
1667 MOZ_ARG_ENABLE_BOOL(valgrind,
1668 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1671 if test -n "$MOZ_VALGRIND"; then
1672 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1674 [--enable-valgrind specified but Valgrind is not installed]))
1675 AC_DEFINE(MOZ_VALGRIND)
1677 AC_SUBST(MOZ_VALGRIND)
1679 dnl ========================================================
1681 dnl ========================================================
1682 MOZ_ARG_ENABLE_BOOL(dmd,
1683 [ --enable-dmd Enable DMD; also disables jemalloc (default=no)],
1686 if test -n "$MOZ_DMD"; then
1687 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1689 [--enable-dmd specified but Valgrind is not installed]))
1693 dnl ========================================================
1695 dnl ========================================================
1696 MOZ_ARG_ENABLE_BOOL(jprof,
1697 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1700 if test -n "$MOZ_JPROF"; then
1702 AC_DEFINE(MOZ_JPROF)
1705 dnl ========================================================
1707 dnl ========================================================
1708 MOZ_ENABLE_PROFILER_SPS=1
1710 case "${OS_TARGET}" in
1712 case "${CPU_ARCH}" in
1715 MOZ_ENABLE_PROFILER_SPS=
1719 case "${CPU_ARCH}" in
1722 MOZ_ENABLE_PROFILER_SPS=
1727 MOZ_ENABLE_PROFILER_SPS=
1731 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1732 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1735 dnl ========================================================
1737 dnl ========================================================
1738 MOZ_ARG_ENABLE_BOOL(shark,
1739 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1742 if test -n "$MOZ_SHARK"; then
1744 AC_DEFINE(MOZ_SHARK)
1747 dnl ========================================================
1749 dnl ========================================================
1750 MOZ_ARG_ENABLE_BOOL(callgrind,
1751 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1754 if test -n "$MOZ_CALLGRIND"; then
1756 AC_DEFINE(MOZ_CALLGRIND)
1759 dnl ========================================================
1761 dnl ========================================================
1762 MOZ_ARG_ENABLE_BOOL(vtune,
1763 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1766 if test -n "$MOZ_VTUNE"; then
1768 AC_DEFINE(MOZ_VTUNE)
1771 dnl ========================================================
1773 dnl ========================================================
1774 if test -n "$MOZ_PROFILING"; then
1775 AC_DEFINE(MOZ_PROFILING)
1778 dnl ========================================================
1779 dnl System overrides of the defaults for host
1780 dnl ========================================================
1783 if test -n "$_WIN32_MSVC"; then
1785 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1786 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1787 HOST_RANLIB='echo ranlib'
1789 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1791 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1792 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1793 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1794 HOST_BIN_SUFFIX=.exe
1797 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1801 case "${host_cpu}" in
1803 if test -n "$_WIN32_MSVC"; then
1804 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1808 if test -n "$_WIN32_MSVC"; then
1809 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1811 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1817 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1818 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1819 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1822 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1823 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1824 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1825 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1829 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1830 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1831 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1832 HOST_BIN_SUFFIX=.exe
1837 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1838 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1842 dnl We require version 2.5 or newer of Python to build.
1843 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR but not 3.x])
1846 read python_version_major python_version_minor python_version_micro <<EOF
1847 `$PYTHON -c 'import sys; print sys.version_info[0], sys.version_info[1], sys.version_info[2]'`
1851 if test $python_version_major -ne $PYTHON_VERSION_MAJOR; then
1852 AC_MSG_ERROR([Cannot build on Python $python_version_major.])
1854 if test $python_version_minor -lt $PYTHON_VERSION_MINOR; then
1855 AC_MSG_ERROR([Cannot build on Python $python_version_major.$python_version_minor. You need at least $PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR.])
1858 AC_MSG_RESULT([yes])
1860 dnl Check for using a custom <stdint.h> implementation
1861 dnl ========================================================
1862 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1863 if test "$MOZ_CUSTOM_STDINT_H"; then
1864 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1865 AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1867 AC_MSG_RESULT(none specified)
1870 dnl Get mozilla version from central milestone file
1871 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1872 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1874 dnl Get version of various core apps from the version files.
1875 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1877 if test -z "$FIREFOX_VERSION"; then
1878 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1881 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1882 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1883 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1885 MOZ_DOING_LTO(lto_is_enabled)
1887 dnl ========================================================
1888 dnl System overrides of the defaults for target
1889 dnl ========================================================
1894 if test ! "$GNU_CC"; then
1895 if test ! "$HAVE_64BIT_OS"; then
1896 # Compiling with Visual Age C++ object model compat is the
1897 # default. To compile with object model ibm, add
1898 # AIX_OBJMODEL=ibm to .mozconfig.
1899 if test "$AIX_OBJMODEL" = "ibm"; then
1900 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1907 AC_SUBST(AIX_OBJMODEL)
1908 DSO_LDOPTS='-qmkshrobj=1'
1909 DSO_CFLAGS='-qflag=w:w'
1911 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1913 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1914 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1915 if test "$COMPILE_ENVIRONMENT"; then
1918 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1920 [#if (__IBMCPP__ < 900)
1921 #error "Bad compiler"
1923 _BAD_COMPILER=,_BAD_COMPILER=1)
1924 if test -n "$_BAD_COMPILER"; then
1926 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1928 AC_MSG_RESULT([yes])
1931 TARGET_COMPILER_ABI="ibmc"
1932 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1933 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1936 case "${target_os}" in
1941 if test "$COMPILE_ENVIRONMENT"; then
1942 MOZ_CHECK_HEADERS(sys/inttypes.h)
1944 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1948 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1957 _WARNINGS_CFLAGS="-Wall"
1958 _WARNINGS_CXXFLAGS="-Wall"
1959 # The test above doesn't work properly, at least on 3.1.
1960 MKSHLIB_FORCE_ALL=''
1961 MKSHLIB_UNFORCE_ALL=''
1967 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1968 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1969 MOZ_OPTIMIZE_FLAGS="-O3"
1971 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1972 if test "$HAVE_64BIT_OS"; then
1977 STRIP="$STRIP -x -S"
1978 # Check whether we're targeting OS X or iOS
1979 AC_CACHE_CHECK(for iOS target,
1981 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1982 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1986 ac_cv_ios_target="yes",
1987 ac_cv_ios_target="no")])
1988 if test "$ac_cv_ios_target" = "yes"; then
1990 AC_DEFINE(XP_DARWIN)
1991 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1993 AC_DEFINE(XP_MACOSX)
1994 AC_DEFINE(XP_DARWIN)
1995 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1996 # The ExceptionHandling framework is needed for Objective-C exception
1997 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1999 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
2001 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2004 if test "x$lto_is_enabled" = "xyes"; then
2005 echo "Skipping -dead_strip because lto is enabled."
2006 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2007 dnl ===================================================================
2008 elif test "x$enable_dtrace" = "xyes"; then
2009 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2011 dnl check for the presence of the -dead_strip linker flag
2012 AC_MSG_CHECKING([for -dead_strip option to ld])
2013 _SAVE_LDFLAGS=$LDFLAGS
2014 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2015 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2016 if test -n "$_HAVE_DEAD_STRIP" ; then
2017 AC_MSG_RESULT([yes])
2018 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2023 LDFLAGS=$_SAVE_LDFLAGS
2026 dnl With newer linkers we need to pass -allow_heap_execute because of
2027 dnl Microsoft Silverlight (5.1.10411.0 at least).
2028 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
2029 _SAVE_LDFLAGS=$LDFLAGS
2030 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
2031 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
2032 _HAVE_ALLOW_HEAP_EXECUTE=)
2033 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
2034 AC_MSG_RESULT([yes])
2035 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
2039 LDFLAGS=$_SAVE_LDFLAGS
2041 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2046 if test ! "$GNU_CC"; then
2050 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2051 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2052 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2055 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2056 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2059 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2060 AC_DEFINE(_LARGEFILE64_SOURCE)
2065 if test ! "$GNU_CC"; then
2066 DSO_LDOPTS='-b -Wl,+s'
2069 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2070 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2071 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2073 DSO_LDOPTS='-b -E +s'
2074 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2075 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2077 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2078 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2081 *-android*|*-linuxandroid*)
2082 AC_DEFINE(NO_PW_GECOS)
2084 if test -n "$gonkdir"; then
2085 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2090 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2093 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2095 MOZ_GFX_OPTIMIZE_MOBILE=1
2096 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2100 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2101 # Similarly for GNU_CXX and INTEL_CXX.
2102 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2103 # -Os has been broken on Intel's C/C++ compilers for quite a
2104 # while; Intel recommends against using it.
2105 MOZ_OPTIMIZE_FLAGS="-O2"
2106 MOZ_DEBUG_FLAGS="-g"
2107 elif test "$GNU_CC" -o "$GNU_CXX"; then
2108 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2109 case $GCC_VERSION in
2111 # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2112 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2114 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2115 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2116 MOZ_DEBUG_FLAGS="-g"
2119 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2123 case "${target_cpu}" in
2125 CFLAGS="$CFLAGS -mieee"
2126 CXXFLAGS="$CXXFLAGS -mieee"
2132 MOZ_DEBUG_FLAGS="-g" # We want inlining
2136 if test -z "$MC"; then
2146 # certain versions of cygwin's makedepend barf on the
2147 # #include <string> vs -I./dist/include/string issue so don't use it
2148 if test -n "$GNU_CC"; then
2150 CXX="$CXX -mwindows"
2151 CPP="$CPP -mwindows"
2152 CFLAGS="$CFLAGS -mms-bitfields"
2153 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2154 DSO_LDOPTS='-shared'
2155 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2156 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2158 # Use temp file for windres (bug 213281)
2159 RCFLAGS='-O coff --use-temp-file'
2160 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2161 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv"
2163 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2164 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2166 IMPORT_LIB_SUFFIX=dll.a
2167 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2169 # We use mix of both POSIX and Win32 printf format across the tree, so format
2170 # warnings are useless on mingw.
2171 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2172 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2174 TARGET_COMPILER_ABI=msvc
2178 if test "$AS_BIN"; then
2179 AS="$(basename "$AS_BIN")"
2182 AR_FLAGS='-NOLOGO -OUT:"$@"'
2184 RANLIB='echo not_ranlib'
2185 STRIP='echo not_strip'
2196 IMPORT_LIB_SUFFIX=lib
2197 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2198 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2200 MKSHLIB_UNFORCE_ALL=
2201 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2202 _USE_CPP_INCLUDE_FLAG=1
2203 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2204 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2205 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2206 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2207 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2208 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2209 # MSVC warning C4800 warns when a value is implicitly cast to bool,
2210 # because this also forces narrowing to a single byte, which can be a
2211 # perf hit. But this matters so little in practice (and often we want
2212 # that behavior) that it's better to turn it off.
2213 CXXFLAGS="$CXXFLAGS -wd4345 -wd4351 -wd4800"
2214 # make 'foo == bar;' error out
2215 CFLAGS="$CFLAGS -we4553"
2216 CXXFLAGS="$CXXFLAGS -we4553"
2217 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2218 MOZ_DEBUG_FLAGS='-Zi'
2219 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2220 WARNINGS_AS_ERRORS='-WX'
2221 MOZ_OPTIMIZE_FLAGS='-O1'
2223 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2224 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2225 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2226 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
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"
2244 AC_DEFINE(HAVE_SNPRINTF)
2249 AC_DEFINE(HW_THREADS)
2250 AC_DEFINE(STDC_HEADERS)
2251 AC_DEFINE(NEW_H, <new>)
2252 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2253 TARGET_MD_ARCH=win32
2254 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2256 MOZ_USER_DIR="Mozilla"
2258 dnl Hardcode to win95 for now - cls
2259 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2261 dnl set NO_X11 defines here as the general check is skipped on win32
2267 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2268 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2274 if test -z "$MOZ_TOOLS"; then
2275 AC_MSG_ERROR([MOZ_TOOLS is not set])
2277 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2278 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2279 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2281 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2282 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2283 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2290 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.])
2296 if test "$HAVE_64BIT_OS"; then
2297 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2300 if test -n "$GNU_CC"; then
2301 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2302 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2303 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup"
2305 AC_DEFINE(HAVE_STDCALL)
2306 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2307 LDFLAGS="$LDFLAGS -SAFESEH"
2313 if test -n "$_WIN32_MSVC"; then
2314 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2319 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2323 if test "$HAVE_64BIT_OS"; then
2330 CFLAGS="$CFLAGS -Dunix"
2331 CXXFLAGS="$CXXFLAGS -Dunix"
2332 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2334 DSO_PIC_CFLAGS='-fPIC -DPIC'
2335 DSO_LDOPTS='-shared'
2336 BIN_FLAGS='-Wl,--export-dynamic'
2338 DSO_PIC_CFLAGS='-fPIC -DPIC'
2339 DLL_SUFFIX=".so.1.0"
2340 DSO_LDOPTS='-shared'
2342 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2343 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2344 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2345 if test "$LIBRUNPATH"; then
2346 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2348 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2349 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2353 if test "$SO_VERSION"; then
2354 DLL_SUFFIX=".so.$SO_VERSION"
2356 DLL_SUFFIX=".so.1.0"
2358 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2360 DSO_PIC_CFLAGS='-fPIC'
2361 DSO_LDOPTS='-shared -fPIC'
2362 if test "$LIBRUNPATH"; then
2363 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2368 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2369 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2372 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2373 AC_DEFINE(TCPV40HDRS)
2379 IMPORT_LIB_SUFFIX=lib
2383 CFLAGS="$CFLAGS -Zomf"
2384 CXXFLAGS="$CXXFLAGS -Zomf"
2386 BIN_FLAGS='-Zlinker /ST:0x100000'
2390 WARNINGS_AS_ERRORS='-Werror'
2391 MOZ_DEBUG_FLAGS="-g -fno-inline"
2392 MOZ_OPTIMIZE_FLAGS="-O2"
2393 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2394 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2395 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2397 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2401 MOZ_USER_DIR="Mozilla"
2404 if test "$MOZTOOLS"; then
2405 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2407 AC_MSG_ERROR([MOZTOOLS is not set])
2409 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2410 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2411 LDFLAGS="$LDFLAGS -Zhigh-mem"
2412 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2413 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2416 # GCC for OS/2 currently predefines these, but we don't want them
2417 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2418 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2420 AC_CACHE_CHECK(for __declspec(dllexport),
2422 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2424 ac_os2_declspec="yes",
2425 ac_os2_declspec="no")])
2426 if test "$ac_os2_declspec" != "yes"; then
2427 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2433 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2435 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2436 # libraries one level up (e.g. libnspr4.so)
2437 if test "$SOLARIS_SUNPRO_CC"; then
2438 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2439 LIBS="-lCrun -lCstd -lc $LIBS"
2440 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2441 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2442 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2443 LDFLAGS="-xildoff $LDFLAGS"
2444 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2445 _SAVE_LDFLAGS=$LDFLAGS
2446 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2447 AC_TRY_LINK([#include <stdio.h>],
2448 [printf("Hello World\n");],
2450 [LDFLAGS=$_SAVE_LDFLAGS])
2452 MOZ_OPTIMIZE_FLAGS="-xO4"
2453 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2454 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2455 MKSHLIB_FORCE_ALL='-z allextract'
2456 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2463 AS='/usr/ccs/bin/as'
2464 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2466 TARGET_COMPILER_ABI="sunc"
2467 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2468 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2469 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2473 [#if (__SUNPRO_CC < 0x590)
2476 _BAD_COMPILER=,_BAD_COMPILER=1)
2477 if test -n "$_BAD_COMPILER"; then
2479 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2484 [#if (__SUNPRO_CC >= 0x5100)
2485 #error "Sun C++ 5.10 or above"
2487 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2488 if test "$_ABOVE_SS12U1"; then
2490 CXXFLAGS="$CXXFLAGS -xannotate=no"
2492 AC_MSG_RESULT([$_res])
2495 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2497 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2498 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2499 ASFLAGS="$ASFLAGS -fPIC"
2500 DSO_LDOPTS='-shared'
2501 WARNINGS_AS_ERRORS='-Werror'
2503 _WARNINGS_CXXFLAGS=''
2504 if test "$OS_RELEASE" = "5.3"; then
2505 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2508 if test "$OS_RELEASE" = "5.5.1"; then
2509 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2514 DSO_LDOPTS='-Bdynamic'
2515 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2516 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2518 AC_DEFINE(SPRINTF_RETURNS_STRING)
2519 case "$(target_os)" in
2521 DLL_SUFFIX='.so.1.0'
2527 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2532 AC_SUBST(MOZ_LINKER)
2533 if test -n "$MOZ_LINKER"; then
2534 AC_DEFINE(MOZ_LINKER)
2536 AC_SUBST(MOZ_ENABLE_SZIP)
2538 dnl Only one oddball right now (QNX), but this gives us flexibility
2539 dnl if any other platforms need to override this in the future.
2540 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2542 dnl ========================================================
2543 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2544 dnl by now will not have any way to link most binaries (tests
2545 dnl as well as viewer, apprunner, etc.), because some symbols
2546 dnl will be left out of the "composite" .so's by ld as unneeded.
2547 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2548 dnl they can link in the static libs that provide the missing
2550 dnl ========================================================
2551 NO_LD_ARCHIVE_FLAGS=
2552 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2553 NO_LD_ARCHIVE_FLAGS=1
2557 NO_LD_ARCHIVE_FLAGS=
2560 NO_LD_ARCHIVE_FLAGS=
2563 if test -z "$GNU_CC"; then
2564 NO_LD_ARCHIVE_FLAGS=
2568 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2570 dnl ========================================================
2571 dnl = Flags to strip unused symbols from .so components and
2572 dnl = to export jemalloc symbols when linking a program
2573 dnl ========================================================
2575 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2576 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2579 if test -z "$GNU_CC"; then
2580 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2582 if test -z "$GCC_USE_GNU_LD"; then
2583 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2585 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2590 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2593 if test -n "$GNU_CC"; then
2594 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2599 if test -z "$COMPILE_ENVIRONMENT"; then
2600 SKIP_COMPILER_CHECKS=1
2601 SKIP_LIBRARY_CHECKS=1
2605 if test -z "$SKIP_COMPILER_CHECKS"; then
2606 dnl Checks for typedefs, structures, and compiler characteristics.
2607 dnl ========================================================
2615 AC_MSG_CHECKING(for __stdcall)
2616 AC_CACHE_VAL(ac_cv___stdcall,
2617 [AC_TRY_COMPILE([template <typename Method> struct foo;
2618 template <> struct foo<void (*)()> {};
2619 template <> struct foo<void (__stdcall*)()> {};],
2621 [ac_cv___stdcall=true],
2622 [ac_cv___stdcall=false])])
2623 if test "$ac_cv___stdcall" = true ; then
2624 AC_DEFINE(HAVE_STDCALL)
2630 AC_MSG_CHECKING(for ssize_t)
2631 AC_CACHE_VAL(ac_cv_type_ssize_t,
2632 [AC_TRY_COMPILE([#include <stdio.h>
2633 #include <sys/types.h>],
2635 [ac_cv_type_ssize_t=true],
2636 [ac_cv_type_ssize_t=false])])
2637 if test "$ac_cv_type_ssize_t" = true ; then
2638 AC_DEFINE(HAVE_SSIZE_T)
2643 AC_STRUCT_ST_BLKSIZE
2644 AC_MSG_CHECKING(for siginfo_t)
2645 AC_CACHE_VAL(ac_cv_siginfo_t,
2646 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2647 #include <signal.h>],
2649 [ac_cv_siginfo_t=true],
2650 [ac_cv_siginfo_t=false])])
2651 if test "$ac_cv_siginfo_t" = true ; then
2652 AC_DEFINE(HAVE_SIGINFO_T)
2658 dnl Check for int64, uint, and uint_t.
2659 dnl ========================================================
2660 AC_MSG_CHECKING(for int64)
2661 AC_CACHE_VAL(ac_cv_int64,
2662 [AC_TRY_COMPILE([#include <stdio.h>
2663 #include <sys/types.h>],
2666 [ac_cv_int64=false])])
2667 if test "$ac_cv_int64" = true ; then
2668 AC_DEFINE(HAVE_INT64)
2673 AC_MSG_CHECKING(for uint)
2674 AC_CACHE_VAL(ac_cv_uint,
2675 [AC_TRY_COMPILE([#include <stdio.h>
2676 #include <sys/types.h>],
2679 [ac_cv_uint=false])])
2680 if test "$ac_cv_uint" = true ; then
2681 AC_DEFINE(HAVE_UINT)
2686 AC_MSG_CHECKING(for uint_t)
2687 AC_CACHE_VAL(ac_cv_uint_t,
2688 [AC_TRY_COMPILE([#include <stdio.h>
2689 #include <sys/types.h>],
2691 [ac_cv_uint_t=true],
2692 [ac_cv_uint_t=false])])
2693 if test "$ac_cv_uint_t" = true ; then
2694 AC_DEFINE(HAVE_UINT_T)
2700 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2701 dnl are defined when compiling C++ but not C. Since the result of this
2702 dnl test is used only in C++, do it in C++.
2705 AC_MSG_CHECKING(for uname.domainname)
2706 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2707 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2708 [ struct utsname *res; char *domain;
2709 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2710 [ac_cv_have_uname_domainname_field=true],
2711 [ac_cv_have_uname_domainname_field=false])])
2713 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2714 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2720 AC_MSG_CHECKING(for uname.__domainname)
2721 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2722 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2723 [ struct utsname *res; char *domain;
2724 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2725 [ac_cv_have_uname_us_domainname_field=true],
2726 [ac_cv_have_uname_us_domainname_field=false])])
2728 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2729 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2735 dnl Check whether we can use gcc's c++0x mode
2738 if test "$GNU_CXX"; then
2739 _SAVE_CXXFLAGS=$CXXFLAGS
2740 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2742 AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2743 ac_cv_cxx0x_headers_bug,
2744 [AC_TRY_COMPILE([#include <memory>], [],
2745 ac_cv_cxx0x_headers_bug="no",
2746 ac_cv_cxx0x_headers_bug="yes")])
2747 CXXFLAGS="$_SAVE_CXXFLAGS"
2748 if test "$ac_cv_cxx0x_headers_bug" = "no"; then
2749 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2753 dnl Check for usable char16_t (2 bytes, unsigned)
2754 dnl (we might not need the unsignedness check anymore)
2755 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2756 ac_cv_have_usable_char16_t,
2757 [AC_TRY_COMPILE([$configure_static_assert_macros],
2758 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2759 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2760 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2761 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2762 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2763 ac_cv_have_usable_char16_t="yes",
2764 ac_cv_have_usable_char16_t="no")])
2765 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2766 AC_DEFINE(HAVE_CPP_CHAR16_T)
2768 elif test "$GNU_CXX"; then
2769 CXXFLAGS="$_SAVE_CXXFLAGS"
2772 dnl Check for usable wchar_t (2 bytes, unsigned)
2773 dnl (we really don't need the unsignedness check anymore)
2774 dnl ========================================================
2776 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2777 ac_cv_have_usable_wchar_v2,
2778 [AC_TRY_COMPILE([#include <stddef.h>
2779 $configure_static_assert_macros],
2780 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2781 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2782 ac_cv_have_usable_wchar_v2="yes",
2783 ac_cv_have_usable_wchar_v2="no")])
2784 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2785 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2786 HAVE_CPP_2BYTE_WCHAR_T=1
2787 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2788 dnl This is really gcc-only
2789 dnl Do this test using CXX only since some versions of gcc
2790 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2791 dnl only have short-wchar support for c++.
2792 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2794 _SAVE_CXXFLAGS=$CXXFLAGS
2795 CXXFLAGS="$CXXFLAGS -fshort-wchar"
2797 AC_CACHE_CHECK(for compiler -fshort-wchar option,
2798 ac_cv_have_usable_wchar_option_v2,
2799 [AC_TRY_LINK([#include <stddef.h>
2800 $configure_static_assert_macros],
2801 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2802 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2803 ac_cv_have_usable_wchar_option_v2="yes",
2804 ac_cv_have_usable_wchar_option_v2="no")])
2806 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2807 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2808 HAVE_CPP_2BYTE_WCHAR_T=1
2809 if test "$OS_TARGET" = Android; then
2810 WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
2811 CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
2812 CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
2813 DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
2815 WCHAR_CFLAGS="-fshort-wchar"
2818 CXXFLAGS=$_SAVE_CXXFLAGS
2824 dnl Check for .hidden assembler directive and visibility attribute.
2825 dnl Borrowed from glibc configure.in
2826 dnl ===============================================================
2827 if test "$GNU_CC"; then
2828 AC_CACHE_CHECK(for visibility(hidden) attribute,
2829 ac_cv_visibility_hidden,
2830 [cat > conftest.c <<EOF
2831 int foo __attribute__ ((visibility ("hidden"))) = 1;
2833 ac_cv_visibility_hidden=no
2834 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2835 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2836 ac_cv_visibility_hidden=yes
2841 if test "$ac_cv_visibility_hidden" = "yes"; then
2842 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2844 AC_CACHE_CHECK(for visibility(default) attribute,
2845 ac_cv_visibility_default,
2846 [cat > conftest.c <<EOF
2847 int foo __attribute__ ((visibility ("default"))) = 1;
2849 ac_cv_visibility_default=no
2850 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2851 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2852 ac_cv_visibility_default=yes
2857 if test "$ac_cv_visibility_default" = "yes"; then
2858 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2860 AC_CACHE_CHECK(for visibility pragma support,
2861 ac_cv_visibility_pragma,
2862 [cat > conftest.c <<EOF
2863 #pragma GCC visibility push(hidden)
2865 #pragma GCC visibility push(default)
2866 int foo_default = 1;
2868 ac_cv_visibility_pragma=no
2869 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2870 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2871 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2872 ac_cv_visibility_pragma=yes
2878 if test "$ac_cv_visibility_pragma" = "yes"; then
2879 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2880 ac_cv_have_visibility_class_bug,
2881 [cat > conftest.c <<EOF
2882 #pragma GCC visibility push(hidden)
2883 struct __attribute__ ((visibility ("default"))) TestStruct {
2886 __attribute__ ((visibility ("default"))) void TestFunc() {
2890 ac_cv_have_visibility_class_bug=no
2891 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2892 ac_cv_have_visibility_class_bug=yes
2894 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2895 ac_cv_have_visibility_class_bug=yes
2898 rm -rf conftest.{c,S}
2901 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2902 ac_cv_have_visibility_builtin_bug,
2903 [cat > conftest.c <<EOF
2904 #pragma GCC visibility push(hidden)
2905 #pragma GCC visibility push(default)
2907 #pragma GCC visibility pop
2909 __attribute__ ((visibility ("default"))) void Func() {
2911 memset(c, 0, sizeof(c));
2914 ac_cv_have_visibility_builtin_bug=no
2915 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2916 ac_cv_have_visibility_builtin_bug=yes
2918 if test `grep -c "@PLT" conftest.S` = 0; then
2919 ac_cv_visibility_builtin_bug=yes
2922 rm -f conftest.{c,S}
2924 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2925 "$ac_cv_have_visibility_class_bug" = "no"; then
2926 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2927 WRAP_SYSTEM_INCLUDES=1
2928 STL_FLAGS='-I$(DIST)/stl_wrappers'
2931 VISIBILITY_FLAGS='-fvisibility=hidden'
2932 fi # have visibility pragma bug
2933 fi # have visibility pragma
2934 fi # have visibility(default) attribute
2935 fi # have visibility(hidden) attribute
2938 # visibility hidden flag for Sun Studio on Solaris
2939 if test "$SOLARIS_SUNPRO_CC"; then
2940 VISIBILITY_FLAGS='-xldscope=hidden'
2941 fi # Sun Studio on Solaris
2943 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2944 AC_SUBST(VISIBILITY_FLAGS)
2950 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2951 dnl ========================================================
2952 if test "$GNU_CC"; then
2953 CFLAGS_save="${CFLAGS}"
2954 CFLAGS="${CFLAGS} -Werror"
2955 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2956 ac_cv_force_align_arg_pointer,
2957 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2959 ac_cv_force_align_arg_pointer="yes",
2960 ac_cv_force_align_arg_pointer="no")])
2961 CFLAGS="${CFLAGS_save}"
2962 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2963 HAVE_GCC_ALIGN_ARG_POINTER=1
2965 HAVE_GCC_ALIGN_ARG_POINTER=
2968 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2970 dnl Checks for header files.
2971 dnl ========================================================
2973 case "$target_os" in
2975 # for stuff like -lXshm
2976 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2979 MOZ_CHECK_COMMON_HEADERS
2981 dnl These are all the places some variant of statfs can be hiding.
2982 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2985 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2986 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2988 dnl SCTP support - needs various network include headers
2989 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2991 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2993 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2994 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2995 ac_cv_sockaddr_in_sin_len,
2996 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2997 #include <sys/types.h>
2999 #include <netinet/in.h>
3000 struct sockaddr_in x;
3001 void *foo = (void*) &x.sin_len;],
3003 [ac_cv_sockaddr_in_sin_len=true],
3004 [ac_cv_sockaddr_in_sin_len=false])])
3005 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
3006 AC_DEFINE(HAVE_SIN_LEN)
3007 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
3008 AC_DEFINE(HAVE_SCONN_LEN)
3011 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
3012 ac_cv_sockaddr_in6_sin6_len,
3013 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
3014 #include <sys/types.h>
3016 #include <netinet/in.h>
3017 struct sockaddr_in6 x;
3018 void *foo = (void*) &x.sin6_len;],
3020 [ac_cv_sockaddr_in6_sin6_len=true],
3021 [ac_cv_sockaddr_in6_sin6_len=false])])
3022 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
3023 AC_DEFINE(HAVE_SIN6_LEN)
3026 AC_CACHE_CHECK(for sockaddr.sa_len,
3027 ac_cv_sockaddr_sa_len,
3028 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
3029 #include <sys/types.h>
3031 #include <sys/socket.h>
3033 void *foo = (void*) &x.sa_len;],
3035 [ac_cv_sockaddr_sa_len=true],
3036 [ac_cv_sockaddr_sa_len=false])])
3037 if test "$ac_cv_sockaddr_sa_len" = true ; then
3038 AC_DEFINE(HAVE_SA_LEN)
3041 dnl Check whether the compiler supports the new-style C++ standard
3042 dnl library headers (i.e. <new>) or needs the old "new.h"
3045 MOZ_CHECK_HEADER(new, [NEW_H=new])
3046 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3049 AC_ARG_ENABLE(dtrace,
3050 [ --enable-dtrace build with dtrace support if available (default=no)],
3051 [enable_dtrace="yes"],)
3052 if test "x$enable_dtrace" = "xyes"; then
3053 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3054 if test -n "$HAVE_DTRACE"; then
3055 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3057 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3060 AC_SUBST(HAVE_DTRACE)
3066 MOZ_CHECK_HEADERS(sys/cdefs.h)
3070 MOZ_LINUX_PERF_EVENT
3072 dnl Checks for libraries.
3073 dnl ========================================================
3078 AC_CHECK_LIB(c_r, gethostbyname_r)
3082 dnl We don't want to link with libdl even if it's present on OS X, since
3083 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3085 dnl We don't want to link against libm or libpthread on Darwin since
3086 dnl they both are just symlinks to libSystem and explicitly linking
3087 dnl against libSystem causes issues when debugging (see bug 299601).
3094 AC_SEARCH_LIBS(dlopen, dl,
3095 MOZ_CHECK_HEADER(dlfcn.h,
3096 AC_DEFINE(HAVE_DLOPEN)))
3100 _SAVE_CFLAGS="$CFLAGS"
3101 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3102 AC_CHECK_FUNCS(dladdr memmem)
3103 CFLAGS="$_SAVE_CFLAGS"
3105 if test ! "$GNU_CXX"; then
3109 AC_CHECK_LIB(C_r, demangle)
3112 AC_CHECK_LIB(C, demangle)
3117 dnl OS/2 has socket in libc.
3122 AC_CHECK_LIB(socket, socket)
3126 XLIBS="$X_EXTRA_LIBS"
3128 dnl ========================================================
3129 dnl Checks for X libraries.
3130 dnl Ordering is important.
3131 dnl Xt is dependent upon SM as of X11R6
3132 dnl ========================================================
3133 if test "$no_x" = "yes"; then
3136 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3137 XLIBS="-lX11 $XLIBS"
3138 _SAVE_LDFLAGS="$LDFLAGS"
3139 LDFLAGS="$XLDFLAGS $LDFLAGS"
3140 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3141 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3142 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3143 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3145 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3146 unset ac_cv_lib_Xt_XtFree
3147 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3148 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3149 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3150 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3153 # AIX needs the motif library linked before libXt to prevent
3154 # crashes in plugins linked against Motif - Bug #98892
3155 case "${target_os}" in
3157 XT_LIBS="-lXm $XT_LIBS"
3161 dnl ========================================================
3162 dnl = Check for XShm
3163 dnl ========================================================
3164 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3167 dnl ========================================================
3169 dnl ========================================================
3170 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3171 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3172 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3173 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3175 LDFLAGS="$_SAVE_LDFLAGS"
3185 dnl ========================================================
3186 dnl = pthread support
3187 dnl = Start by checking whether the system support pthreads
3188 dnl ========================================================
3189 case "$target_os" in
3194 MOZ_CHECK_PTHREADS(pthreads,
3195 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3196 MOZ_CHECK_PTHREADS(pthread,
3197 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3198 MOZ_CHECK_PTHREADS(c_r,
3199 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3200 MOZ_CHECK_PTHREADS(c,
3209 dnl ========================================================
3210 dnl Check the command line for --with-pthreads
3211 dnl ========================================================
3212 MOZ_ARG_WITH_BOOL(pthreads,
3213 [ --with-pthreads Force use of system pthread library with NSPR ],
3214 [ if test "$USE_PTHREADS"x = x; then
3215 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3221 dnl ========================================================
3222 dnl Do the platform specific pthread hackery
3223 dnl ========================================================
3224 if test "$USE_PTHREADS"x != x
3227 dnl See if -pthread is supported.
3230 ac_cv_have_dash_pthread=no
3231 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3232 echo 'int main() { return 0; }' | cat > conftest.c
3233 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3234 if test $? -eq 0; then
3235 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3236 ac_cv_have_dash_pthread=yes
3237 case "$target_os" in
3239 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3242 CFLAGS="$CFLAGS -pthread"
3243 CXXFLAGS="$CXXFLAGS -pthread"
3249 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3252 dnl See if -pthreads is supported.
3254 ac_cv_have_dash_pthreads=no
3255 if test "$ac_cv_have_dash_pthread" = "no"; then
3256 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3257 echo 'int main() { return 0; }' | cat > conftest.c
3258 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3259 if test $? -eq 0; then
3260 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3261 ac_cv_have_dash_pthreads=yes
3262 CFLAGS="$CFLAGS -pthreads"
3263 CXXFLAGS="$CXXFLAGS -pthreads"
3267 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3272 AC_DEFINE(_REENTRANT)
3273 AC_DEFINE(_THREAD_SAFE)
3274 dnl -pthread links in -lpthread, so don't specify it explicitly.
3275 if test "$ac_cv_have_dash_pthread" = "yes"; then
3276 _PTHREAD_LDFLAGS="-pthread"
3280 *-*-openbsd*|*-*-bsdi*)
3281 AC_DEFINE(_REENTRANT)
3282 AC_DEFINE(_THREAD_SAFE)
3283 dnl -pthread links in -lc_r, so don't specify it explicitly.
3284 if test "$ac_cv_have_dash_pthread" = "yes"; then
3285 _PTHREAD_LDFLAGS="-pthread"
3289 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3290 AC_DEFINE(_REENTRANT)
3294 AC_DEFINE(_REENTRANT)
3298 AC_DEFINE(_REENTRANT)
3302 AC_DEFINE(_REENTRANT)
3303 if test "$SOLARIS_SUNPRO_CC"; then
3304 CFLAGS="$CFLAGS -mt"
3305 CXXFLAGS="$CXXFLAGS -mt"
3309 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3313 dnl Checks for library functions.
3314 dnl ========================================================
3315 AC_PROG_GCC_TRADITIONAL
3317 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf memmove rint stat64 lstat64 truncate64 setbuf isatty)
3318 AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
3319 AC_CHECK_FUNCS(flockfile getpagesize)
3320 AC_CHECK_FUNCS(localtime_r strtok_r)
3322 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3323 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3324 ac_cv_clock_monotonic,
3325 [for libs in "" -lrt; do
3328 AC_TRY_LINK([#include <time.h>],
3329 [ struct timespec ts;
3330 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3331 ac_cv_clock_monotonic=$libs
3334 ac_cv_clock_monotonic=no)
3337 if test "$ac_cv_clock_monotonic" != "no"; then
3338 HAVE_CLOCK_MONOTONIC=1
3339 REALTIME_LIBS=$ac_cv_clock_monotonic
3340 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3341 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3342 AC_SUBST(REALTIME_LIBS)
3345 dnl check for wcrtomb/mbrtowc
3346 dnl =======================================================================
3347 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3350 AC_CACHE_CHECK(for wcrtomb,
3352 [AC_TRY_LINK([#include <wchar.h>],
3353 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3354 ac_cv_have_wcrtomb="yes",
3355 ac_cv_have_wcrtomb="no")])
3356 if test "$ac_cv_have_wcrtomb" = "yes"; then
3357 AC_DEFINE(HAVE_WCRTOMB)
3359 AC_CACHE_CHECK(for mbrtowc,
3361 [AC_TRY_LINK([#include <wchar.h>],
3362 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3363 ac_cv_have_mbrtowc="yes",
3364 ac_cv_have_mbrtowc="no")])
3365 if test "$ac_cv_have_mbrtowc" = "yes"; then
3366 AC_DEFINE(HAVE_MBRTOWC)
3373 ac_cv_func_res_ninit,
3376 #define _BSD_SOURCE 1
3380 [int foo = res_ninit(&_res);],
3381 [ac_cv_func_res_ninit=yes],
3382 [ac_cv_func_res_ninit=no])
3385 if test "$ac_cv_func_res_ninit" = "yes"; then
3386 AC_DEFINE(HAVE_RES_NINIT)
3387 dnl must add the link line we do something as foolish as this... dougt
3389 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3390 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3395 [for gnu_get_libc_version()],
3396 ac_cv_func_gnu_get_libc_version,
3398 #ifdef HAVE_GNU_LIBC_VERSION_H
3399 #include <gnu/libc-version.h>
3402 [const char *glibc_version = gnu_get_libc_version();],
3403 [ac_cv_func_gnu_get_libc_version=yes],
3404 [ac_cv_func_gnu_get_libc_version=no]
3408 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3409 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3413 darwin*|mingw*|os2*)
3417 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3418 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3419 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3421 LIBS="$LIBS $_ICONV_LIBS"
3430 iconv_t h = iconv_open("", "");
3431 iconv(h, NULL, NULL, NULL, NULL);
3434 [ac_cv_func_iconv=yes],
3435 [ac_cv_func_iconv=no]
3438 if test "$ac_cv_func_iconv" = "yes"; then
3439 AC_DEFINE(HAVE_ICONV)
3440 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3441 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3442 LIBICONV="$_ICONV_LIBS"
3444 [for iconv() with const input],
3445 ac_cv_func_const_iconv,
3451 const char *input = "testing";
3452 iconv_t h = iconv_open("", "");
3453 iconv(h, &input, NULL, NULL, NULL);
3456 [ac_cv_func_const_iconv=yes],
3457 [ac_cv_func_const_iconv=no]
3460 if test "$ac_cv_func_const_iconv" = "yes"; then
3461 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3473 dnl **********************
3474 dnl *** va_copy checks ***
3475 dnl **********************
3476 dnl we currently check for all three va_copy possibilities, so we get
3477 dnl all results in config.log for bug reports.
3478 AC_MSG_CHECKING(for an implementation of va_copy())
3479 AC_CACHE_VAL(ac_cv_va_copy,[
3482 void f (int i, ...) {
3483 va_list args1, args2;
3484 va_start (args1, i);
3485 va_copy (args2, args1);
3486 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3488 va_end (args1); va_end (args2);
3490 int main() { f (0, 42); return 0; }],
3496 AC_MSG_RESULT($ac_cv_va_copy)
3497 AC_MSG_CHECKING(for an implementation of __va_copy())
3498 AC_CACHE_VAL(ac_cv___va_copy,[
3501 void f (int i, ...) {
3502 va_list args1, args2;
3503 va_start (args1, i);
3504 __va_copy (args2, args1);
3505 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3507 va_end (args1); va_end (args2);
3509 int main() { f (0, 42); return 0; }],
3510 ac_cv___va_copy=yes,
3515 AC_MSG_RESULT($ac_cv___va_copy)
3516 AC_MSG_CHECKING(whether va_lists can be copied by value)
3517 AC_CACHE_VAL(ac_cv_va_val_copy,[
3520 void f (int i, ...) {
3521 va_list args1, args2;
3522 va_start (args1, i);
3524 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3526 va_end (args1); va_end (args2);
3528 int main() { f (0, 42); return 0; }],
3529 ac_cv_va_val_copy=yes,
3530 ac_cv_va_val_copy=no,
3531 ac_cv_va_val_copy=yes
3534 if test "x$ac_cv_va_copy" = "xyes"; then
3535 AC_DEFINE(VA_COPY, va_copy)
3536 AC_DEFINE(HAVE_VA_COPY)
3537 elif test "x$ac_cv___va_copy" = "xyes"; then
3538 AC_DEFINE(VA_COPY, __va_copy)
3539 AC_DEFINE(HAVE_VA_COPY)
3542 if test "x$ac_cv_va_val_copy" = "xno"; then
3543 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3545 AC_MSG_RESULT($ac_cv_va_val_copy)
3547 dnl ===================================================================
3548 dnl ========================================================
3549 dnl Put your C++ language/feature checks below
3550 dnl ========================================================
3554 if test "$GNU_CC"; then
3555 if test "$CPU_ARCH" = "arm" ; then
3556 AC_CACHE_CHECK(for ARM EABI,
3560 #if defined(__ARM_EABI__)
3563 #error Not ARM EABI.
3566 ac_cv_gcc_arm_eabi="yes",
3567 ac_cv_gcc_arm_eabi="no")])
3568 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3570 ARM_ABI_PREFIX=eabi-
3572 ARM_ABI_PREFIX=oabi-
3576 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3579 dnl Check for support of modern template specialization syntax
3580 dnl Test code and requirement from scc@netscape.com.
3581 dnl Autoconf cut-and-paste job by waterson@netscape.com
3582 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3583 ac_cv_cpp_modern_specialize_template_syntax,
3584 [AC_TRY_COMPILE(template <class T> struct X { int a; };
3586 template <> struct X<Y> { double a; };,
3589 ac_cv_cpp_modern_specialize_template_syntax=yes,
3590 ac_cv_cpp_modern_specialize_template_syntax=no)])
3591 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
3592 AC_MSG_ERROR([The C++ compiler does not support template specialization])
3595 dnl Some compilers support only full specialization, and some don't.
3596 AC_CACHE_CHECK(whether partial template specialization works,
3597 ac_cv_cpp_partial_specialization,
3598 [AC_TRY_COMPILE(template <class T> class Foo {};
3599 template <class T> class Foo<T*> {};,
3601 ac_cv_cpp_partial_specialization=yes,
3602 ac_cv_cpp_partial_specialization=no)])
3603 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3604 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3607 dnl Check to see if we can resolve ambiguity with |using|.
3608 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3609 ac_cv_cpp_ambiguity_resolving_using,
3610 [AC_TRY_COMPILE(class X {
3611 public: int go(const X&) {return 3;}
3612 int jo(const X&) {return 3;}
3614 class Y : public X {
3615 public: int go(int) {return 2;}
3616 int jo(int) {return 2;}
3618 private: using X::go;
3621 ac_cv_cpp_ambiguity_resolving_using=yes,
3622 ac_cv_cpp_ambiguity_resolving_using=no)])
3623 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3624 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3627 dnl See if a dynamic_cast to void* gives the most derived object.
3628 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3629 ac_cv_cpp_dynamic_cast_void_ptr,
3630 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3631 class Y { int j; public: virtual ~Y() { } };
3632 class Z : public X, public Y { int k; };
3638 return !((((void*)&mdo != (void*)subx) &&
3639 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3640 (((void*)&mdo != (void*)suby) &&
3641 ((void*)&mdo == dynamic_cast<void*>(suby))));
3643 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3644 ac_cv_cpp_dynamic_cast_void_ptr=no,
3645 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3646 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3647 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3651 dnl note that this one is reversed - if the test fails, then
3652 dnl we require implementations of unused virtual methods. Which
3653 dnl really blows because it means we'll have useless vtable
3655 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3656 ac_cv_cpp_unused_required,
3657 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3659 ac_cv_cpp_unused_required=no,
3660 ac_cv_cpp_unused_required=yes)])
3661 if test "$ac_cv_cpp_unused_required" = yes ; then
3662 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3666 dnl Some compilers have trouble comparing a constant reference to a templatized
3667 dnl class to zero, and require an explicit operator==() to be defined that takes
3668 dnl an int. This test separates the strong from the weak.
3670 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3671 ac_cv_trouble_comparing_to_zero,
3672 [AC_TRY_COMPILE([#include <algorithm>
3673 template <class T> class Foo {};
3675 template <class T> int operator==(const T2*, const T&) { return 0; }
3676 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3677 [Foo<int> f; return (0 != f);],
3678 ac_cv_trouble_comparing_to_zero=no,
3679 ac_cv_trouble_comparing_to_zero=yes)])
3680 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3681 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3684 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3685 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3686 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3688 _SAVE_LDFLAGS=$LDFLAGS
3689 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3690 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3691 ac_cv_thread_keyword,
3692 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3693 [return tlsIsMainThread;],
3694 ac_cv_thread_keyword=yes,
3695 ac_cv_thread_keyword=no)])
3696 LDFLAGS=$_SAVE_LDFLAGS
3697 # The custom dynamic linker doesn't support TLS variables
3699 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3700 # mips builds fail with TLS variables because of a binutils bug.
3702 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3707 *-android*|*-linuxandroid*)
3714 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3720 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3721 if test -n "$MOZ_LINKER"; then
3722 if test "$CPU_ARCH" = arm; then
3723 dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
3724 ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
3725 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3726 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3727 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000"
3728 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000"
3733 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3734 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3735 dnl We however want to avoid these text relocations, and this can be done
3736 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3737 dnl doesn't contain anything at all, beside placeholders for some sections,
3738 dnl and crtbegin only contains a finalizer function that calls
3739 dnl __cxa_finalize. The custom linker actually takes care of calling
3740 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3741 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3742 dnl link crtbegin and crtend at all.
3743 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$OS_TARGET" = "Android"; then
3744 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3745 ac_cv_crt_has_text_relocations,
3746 [echo 'int foo() { return 0; }' > conftest.cpp
3747 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3748 test -s conftest${DLL_SUFFIX}; then
3749 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3750 ac_cv_crt_has_text_relocations=yes
3752 ac_cv_crt_has_text_relocations=no
3755 AC_ERROR([couldn't compile a simple C file])
3758 if test "$ac_cv_crt_has_text_relocations" = yes; then
3759 dnl While we want libraries to skip the CRT files, we don't want
3760 dnl executables to be treated the same way. We thus set the flag
3761 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3762 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3763 dnl Using LDFLAGS in nspr is safe, since we only really build
3764 dnl libraries there.
3765 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3766 NSPR_LDFLAGS=-nostartfiles
3770 dnl Check for the existence of various allocation headers/functions
3773 MOZ_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
3774 if test "$MALLOC_H" = ""; then
3775 MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
3776 if test "$MALLOC_H" = ""; then
3777 MOZ_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
3780 if test "$MALLOC_H" != ""; then
3781 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3784 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3785 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3787 dnl See if compiler supports some gcc-style attributes
3789 AC_CACHE_CHECK(for __attribute__((always_inline)),
3790 ac_cv_attribute_always_inline,
3791 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3793 ac_cv_attribute_always_inline=yes,
3794 ac_cv_attribute_always_inline=no)])
3796 AC_CACHE_CHECK(for __attribute__((malloc)),
3797 ac_cv_attribute_malloc,
3798 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3800 ac_cv_attribute_malloc=yes,
3801 ac_cv_attribute_malloc=no)])
3803 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3804 ac_cv_attribute_warn_unused,
3805 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3807 ac_cv_attribute_warn_unused=yes,
3808 ac_cv_attribute_warn_unused=no)])
3810 dnl End of C++ language/feature checks
3813 dnl ========================================================
3814 dnl = Internationalization checks
3815 dnl ========================================================
3817 dnl Internationalization and Locale support is different
3818 dnl on various UNIX platforms. Checks for specific i18n
3819 dnl features go here.
3821 dnl check for LC_MESSAGES
3822 AC_CACHE_CHECK(for LC_MESSAGES,
3823 ac_cv_i18n_lc_messages,
3824 [AC_TRY_COMPILE([#include <locale.h>],
3825 [int category = LC_MESSAGES;],
3826 ac_cv_i18n_lc_messages=yes,
3827 ac_cv_i18n_lc_messages=no)])
3828 if test "$ac_cv_i18n_lc_messages" = yes; then
3829 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3832 AC_HAVE_FUNCS(localeconv)
3833 fi # ! SKIP_COMPILER_CHECKS
3836 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3837 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3840 dnl Mozilla specific options
3841 dnl ========================================================
3842 dnl The macros used for command line options
3843 dnl are defined in build/autoconf/altoptions.m4.
3845 dnl If the compiler supports these attributes, define them as
3846 dnl convenience macros.
3847 if test "$ac_cv_attribute_always_inline" = yes ; then
3848 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
3850 AC_DEFINE(NS_ALWAYS_INLINE,)
3853 if test "$ac_cv_attribute_malloc" = yes ; then
3854 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3856 AC_DEFINE(NS_ATTR_MALLOC,)
3859 if test "$ac_cv_attribute_warn_unused" = yes ; then
3860 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3862 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3865 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3866 dnl features that Windows actually does support.
3868 if test -n "$SKIP_COMPILER_CHECKS"; then
3869 dnl Windows has malloc.h
3870 AC_DEFINE(MALLOC_H, [<malloc.h>])
3871 AC_DEFINE(HAVE_FORCEINLINE)
3872 AC_DEFINE(HAVE_LOCALECONV)
3873 fi # SKIP_COMPILER_CHECKS
3875 dnl ========================================================
3877 dnl = Check for external package dependencies
3879 dnl ========================================================
3880 MOZ_ARG_HEADER(External Packages)
3882 MOZ_ARG_WITH_STRING(libxul-sdk,
3883 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3884 LIBXUL_SDK_DIR=$withval)
3886 if test "$LIBXUL_SDK_DIR" = "yes"; then
3887 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3888 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3889 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3891 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3892 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3896 AC_SUBST(LIBXUL_SDK)
3898 if test -n "$LIBXUL_SDK"; then
3899 LIBXUL_DIST="$LIBXUL_SDK"
3901 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3903 AC_SUBST(LIBXUL_DIST)
3907 MOZ_ARG_WITH_BOOL(system-libxul,
3908 [ --with-system-libxul Use system installed libxul SDK],
3911 dnl ========================================================
3912 dnl = If NSPR was not detected in the system,
3913 dnl = use the one in the source tree (mozilla/nsprpub)
3914 dnl ========================================================
3915 MOZ_ARG_WITH_BOOL(system-nspr,
3916 [ --with-system-nspr Use system installed NSPR],
3917 _USE_SYSTEM_NSPR=1 )
3919 if test -n "$_USE_SYSTEM_NSPR"; then
3920 AM_PATH_NSPR(4.9.3, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
3923 if test -n "$MOZ_NATIVE_NSPR"; then
3924 _SAVE_CFLAGS=$CFLAGS
3925 CFLAGS="$CFLAGS $NSPR_CFLAGS"
3926 AC_TRY_COMPILE([#include "prtypes.h"],
3927 [#ifndef PR_STATIC_ASSERT
3928 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3930 [MOZ_NATIVE_NSPR=1],
3931 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3932 AC_TRY_COMPILE([#include "prtypes.h"],
3934 #error PR_UINT64 not defined or requires including prtypes.h
3936 [MOZ_NATIVE_NSPR=1],
3937 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3938 CFLAGS=$_SAVE_CFLAGS
3940 if test -z "$LIBXUL_SDK"; then
3941 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3942 if test -n "$GNU_CC"; then
3943 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3945 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3948 NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3949 NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3953 dnl system libevent Support
3954 dnl ========================================================
3955 MOZ_ARG_WITH_STRING(system-libevent,
3956 [ --with-system-libevent[=PFX]
3957 Use system libevent [installed at prefix PFX]],
3958 LIBEVENT_DIR=$withval)
3960 _SAVE_CFLAGS=$CFLAGS
3961 _SAVE_LDFLAGS=$LDFLAGS
3963 if test "$LIBEVENT_DIR" = yes; then
3964 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3965 MOZ_NATIVE_LIBEVENT=1,
3968 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3969 MOZ_NATIVE_LIBEVENT=
3970 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3971 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3972 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3973 MOZ_CHECK_HEADER(event.h,
3974 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3975 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3977 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3978 AC_CHECK_LIB(event, event_init,
3979 [MOZ_NATIVE_LIBEVENT=1
3980 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3981 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3982 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3984 CFLAGS=$_SAVE_CFLAGS
3985 LDFLAGS=$_SAVE_LDFLAGS
3988 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3989 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
3990 AC_SUBST(MOZ_LIBEVENT_LIBS)
3992 dnl ========================================================
3993 dnl = If NSS was not detected in the system,
3994 dnl = use the one in the source tree (mozilla/security/nss)
3995 dnl ========================================================
3997 MOZ_ARG_WITH_BOOL(system-nss,
3998 [ --with-system-nss Use system installed NSS],
4001 if test -n "$_USE_SYSTEM_NSS"; then
4002 AM_PATH_NSS(3.14, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
4005 if test -n "$MOZ_NATIVE_NSS"; then
4006 NSS_LIBS="$NSS_LIBS -lcrmf"
4008 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4010 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4011 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4012 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4013 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4014 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4016 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
4018 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4019 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4020 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4021 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4022 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4024 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4028 dnl ======================
4030 dnl ======================
4032 AC_MSG_CHECKING([for YASM assembler])
4033 AC_CHECK_PROGS(YASM, yasm, "")
4035 if test -n "$YASM"; then
4036 dnl Pull out yasm's version string
4037 YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
4038 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4039 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4040 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4041 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4044 if test -z "$SKIP_LIBRARY_CHECKS"; then
4045 dnl system JPEG support
4046 dnl ========================================================
4047 MOZ_ARG_WITH_STRING(system-jpeg,
4048 [ --with-system-jpeg[=PFX]
4049 Use system libjpeg [installed at prefix PFX]],
4052 _SAVE_CFLAGS=$CFLAGS
4053 _SAVE_LDFLAGS=$LDFLAGS
4055 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4056 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4057 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4059 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4062 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
4065 if test "$MOZ_NATIVE_JPEG" = 1; then
4066 AC_TRY_COMPILE([ #include <stdio.h>
4067 #include <sys/types.h>
4068 #include <jpeglib.h> ],
4069 [ #if JPEG_LIB_VERSION < $MOZJPEG
4070 #error "Insufficient JPEG library version ($MOZJPEG required)."
4072 #ifndef JCS_EXTENSIONS
4073 #error "libjpeg-turbo JCS_EXTENSIONS required"
4077 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
4079 CFLAGS=$_SAVE_CFLAGS
4080 LDFLAGS=$_SAVE_LDFLAGS
4083 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
4084 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
4085 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
4087 fi # SKIP_LIBRARY_CHECKS
4089 dnl system ZLIB support
4090 dnl ========================================================
4091 MOZ_ZLIB_CHECK([1.2.3])
4093 if test "$MOZ_NATIVE_ZLIB" != 1; then
4095 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
4098 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
4099 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4102 if test -z "$SKIP_LIBRARY_CHECKS"; then
4103 dnl system BZIP2 Support
4104 dnl ========================================================
4105 MOZ_ARG_WITH_STRING(system-bz2,
4106 [ --with-system-bz2[=PFX]
4107 Use system libbz2 [installed at prefix PFX]],
4110 _SAVE_CFLAGS=$CFLAGS
4111 _SAVE_LDFLAGS=$LDFLAGS
4113 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4114 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4115 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4117 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4120 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
4121 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
4123 CFLAGS=$_SAVE_CFLAGS
4124 LDFLAGS=$_SAVE_LDFLAGS
4127 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
4128 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
4129 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4132 dnl system PNG Support
4133 dnl ========================================================
4134 MOZ_ARG_WITH_STRING(system-png,
4135 [ --with-system-png[=PFX]
4136 Use system libpng [installed at prefix PFX]],
4139 _SAVE_CFLAGS=$CFLAGS
4140 _SAVE_LDFLAGS=$LDFLAGS
4142 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4143 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4144 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4146 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4149 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
4150 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4151 AC_CHECK_LIB(png, png_get_acTL, ,
4152 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
4154 if test "$MOZ_NATIVE_PNG" = 1; then
4155 AC_TRY_COMPILE([ #include <stdio.h>
4156 #include <sys/types.h>
4158 [ #if PNG_LIBPNG_VER < $MOZPNG
4159 #error "Insufficient libpng version ($MOZPNG required)."
4161 #ifndef PNG_UINT_31_MAX
4162 #error "Insufficient libpng version."
4165 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4167 CFLAGS=$_SAVE_CFLAGS
4168 LDFLAGS=$_SAVE_LDFLAGS
4171 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
4172 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
4173 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
4176 fi # SKIP_LIBRARY_CHECKS
4178 dnl system HunSpell Support
4179 dnl ========================================================
4180 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4181 [ --enable-system-hunspell
4182 Use system hunspell (located with pkgconfig)],
4183 MOZ_NATIVE_HUNSPELL=1 )
4185 if test -n "$MOZ_NATIVE_HUNSPELL"; then
4186 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4189 AC_SUBST(MOZ_NATIVE_HUNSPELL)
4191 dnl ========================================================
4192 dnl system libffi Support
4193 dnl ========================================================
4194 MOZ_ARG_ENABLE_BOOL(system-ffi,
4195 [ --enable-system-ffi Use system libffi (located with pkgconfig)],
4198 if test -n "$MOZ_NATIVE_FFI"; then
4199 # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4200 # for non-GCC compilers.
4201 if test -z "$GNU_CC"; then
4202 PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4204 PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4206 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4209 dnl ========================================================
4210 dnl Java SDK support
4211 dnl ========================================================
4214 MOZ_ARG_WITH_STRING(java-bin-path,
4215 [ --with-java-bin-path=dir
4216 Location of Java binaries (java, javac, jar)],
4217 JAVA_BIN_PATH=$withval)
4219 dnl ========================================================
4223 dnl ========================================================
4225 MOZ_ARG_HEADER(Application)
4228 ENABLE_SYSTEM_EXTENSION_DIRS=1
4229 MOZ_BRANDING_DIRECTORY=
4230 MOZ_OFFICIAL_BRANDING=
4235 MOZ_AUTH_EXTENSION=1
4239 MOZ_SPEEX_RESAMPLER=1
4244 MOZ_SAMPLE_TYPE_FLOAT32=
4245 MOZ_SAMPLE_TYPE_S16=
4253 MOZ_WEBRTC_SIGNALING=
4254 MOZ_WEBRTC_IN_LIBXUL=
4257 MOZ_MEDIA_NAVIGATOR=
4260 MOZ_VP8_ERROR_CONCEALMENT=
4270 LIBJPEG_TURBO_ASFLAGS=
4271 LIBJPEG_TURBO_X86_ASM=
4272 LIBJPEG_TURBO_X64_ASM=
4273 LIBJPEG_TURBO_ARM_ASM=
4277 MOZ_PREF_EXTENSIONS=1
4278 MOZ_PROFILELOCKING=1
4285 MOZ_ONLY_TOUCH_EVENTS=
4286 MOZ_TOOLKIT_SEARCH=1
4288 MOZ_UNIVERSALCHARDET=1
4295 MOZ_DISABLE_DOMCRYPTO=
4299 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4302 MOZ_USE_NATIVE_POPUP_WINDOWS=
4303 MOZ_ANDROID_HISTORY=
4310 case "$target_os" in
4313 AC_DEFINE(NS_ENABLE_TSF)
4318 *-android*|*-linuxandroid*)
4319 if test "$CPU_ARCH" = "arm" ; then
4324 if test -z "$gonkdir"; then
4329 MOZ_THEME_FASTSTRIPE=1
4337 MOZ_ARG_ENABLE_STRING(application,
4338 [ --enable-application=APP
4342 tools/update-packaging (AUS-related packaging tools)],
4343 [ MOZ_BUILD_APP=$enableval ] )
4345 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4346 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4347 XULRUNNER_STUB_NAME=$withval)
4349 if test -z "$XULRUNNER_STUB_NAME"; then
4350 case "$target_os" in
4352 XULRUNNER_STUB_NAME=xulrunner
4355 XULRUNNER_STUB_NAME=xulrunner-stub
4358 AC_SUBST(XULRUNNER_STUB_NAME)
4360 AC_MSG_CHECKING([for application to build])
4361 if test -z "$MOZ_BUILD_APP"; then
4362 AC_MSG_RESULT([browser])
4363 MOZ_BUILD_APP=browser
4365 # default mobile to be mobile/xul
4366 if test "$MOZ_BUILD_APP" = "mobile" ; then
4367 MOZ_BUILD_APP=mobile/xul
4369 # We have a valid application only if it has a build.mk file in its top
4371 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4372 AC_MSG_RESULT([none])
4373 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4375 AC_MSG_RESULT([$MOZ_BUILD_APP])
4379 # Allow the application to influence configure with a confvars.sh script.
4381 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4382 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4383 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4384 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4389 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4390 MOZ_ARG_WITH_STRING(app-name,
4391 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4392 WITH_APP_NAME=$withval,
4395 if test -n "$WITH_APP_NAME" ; then
4396 MOZ_APP_NAME="$WITH_APP_NAME"
4399 MOZ_ARG_WITH_STRING(app-basename,
4400 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4401 WITH_APP_BASENAME=$withval,
4404 if test -n "$WITH_APP_BASENAME" ; then
4405 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4408 # Now is a good time to test for logic errors, define mismatches, etc.
4409 case "$MOZ_BUILD_APP" in
4411 if test "$LIBXUL_SDK"; then
4412 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4417 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4418 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4420 case "$MOZ_BUILD_APP" in
4422 AC_DEFINE(MOZ_PHOENIX)
4426 AC_DEFINE(MOZ_XULRUNNER)
4430 AC_SUBST(MOZ_BUILD_APP)
4431 AC_SUBST(MOZ_PHOENIX)
4432 AC_SUBST(MOZ_XULRUNNER)
4434 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4436 dnl ========================================================
4437 dnl Check android sdk version depending on mobile target
4438 dnl ========================================================
4440 if test -z "$gonkdir" ; then
4441 # Minimum Android SDK API Level we require.
4442 case "$MOZ_BUILD_APP" in
4444 android_min_api_level=13
4447 android_min_api_level=16
4451 MOZ_ANDROID_SDK($android_min_api_level)
4454 dnl ========================================================
4456 dnl = Toolkit Options
4458 dnl ========================================================
4459 MOZ_ARG_HEADER(Toolkit Options)
4461 dnl ========================================================
4462 dnl = Select the default toolkit
4463 dnl ========================================================
4464 MOZ_ARG_ENABLE_STRING(default-toolkit,
4465 [ --enable-default-toolkit=TK
4466 Select default toolkit
4467 Platform specific defaults:
4468 Mac OS X - cairo-cocoa
4470 Win32 - cairo-windows
4473 [ _DEFAULT_TOOLKIT=$enableval ],
4474 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4476 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4477 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4478 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4479 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4480 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4481 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4482 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4483 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4484 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4486 dnl nglayout only supports building with one toolkit,
4487 dnl so ignore everything after the first comma (",").
4488 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4490 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4493 MOZ_ARG_WITHOUT_BOOL(x,
4494 [ --without-x Build without X11],
4497 dnl ========================================================
4498 dnl = Enable the toolkit as needed =
4499 dnl ========================================================
4503 case "$MOZ_WIDGET_TOOLKIT" in
4506 MOZ_WIDGET_TOOLKIT=windows
4509 MOZ_INSTRUMENT_EVENT_LOOP=1
4512 cairo-gtk2|cairo-gtk2-x11)
4513 MOZ_WIDGET_TOOLKIT=gtk2
4515 MOZ_ENABLE_XREMOTE=1
4517 MOZ_GL_DEFAULT_PROVIDER=GLX
4523 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4524 TK_LIBS='$(MOZ_GTK2_LIBS)'
4525 AC_DEFINE(MOZ_WIDGET_GTK2)
4527 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4529 MOZ_INSTRUMENT_EVENT_LOOP=1
4533 MOZ_WIDGET_TOOLKIT=qt
4535 if test -z "$WITHOUT_X11"; then
4536 MOZ_ENABLE_XREMOTE=1
4537 MOZ_GL_DEFAULT_PROVIDER=GLX
4546 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4547 TK_LIBS='$(MOZ_QT_LIBS)'
4548 AC_DEFINE(MOZ_WIDGET_QT)
4553 MOZ_WIDGET_TOOLKIT=os2
4555 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4556 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4561 MOZ_WIDGET_TOOLKIT=cocoa
4562 AC_DEFINE(MOZ_WIDGET_COCOA)
4563 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4564 TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4565 TK_CFLAGS="-DNO_X11"
4566 CFLAGS="$CFLAGS $TK_CFLAGS"
4567 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4568 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4569 MOZ_USER_DIR="Mozilla"
4570 MOZ_FS_LAYOUT=bundle
4572 MOZ_INSTRUMENT_EVENT_LOOP=1
4576 MOZ_WIDGET_TOOLKIT=uikit
4577 AC_DEFINE(MOZ_WIDGET_UIKIT)
4578 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4579 TK_CFLAGS="-DNO_X11"
4580 TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4581 CFLAGS="$CFLAGS $TK_CFLAGS"
4582 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4583 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4584 MOZ_USER_DIR="Mozilla"
4585 MOZ_FS_LAYOUT=bundle
4589 AC_DEFINE(MOZ_WIDGET_ANDROID)
4590 MOZ_WIDGET_TOOLKIT=android
4591 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4592 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4595 MOZ_INSTRUMENT_EVENT_LOOP=1
4596 if test "$MOZ_BUILD_APP" = "mobile/xul"; then
4602 AC_DEFINE(MOZ_WIDGET_GONK)
4603 AC_DEFINE(MOZ_TOUCH)
4604 MOZ_WIDGET_TOOLKIT=gonk
4605 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4606 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4614 AC_SUBST(MOZ_OLD_LINKER)
4615 AC_SUBST(MOZ_PDF_PRINTING)
4616 if test "$MOZ_PDF_PRINTING"; then
4617 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4618 AC_DEFINE(MOZ_PDF_PRINTING)
4621 if test "$MOZ_ENABLE_XREMOTE"; then
4622 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4625 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4626 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4629 if test "$COMPILE_ENVIRONMENT"; then
4630 if test "$MOZ_ENABLE_GTK2"; then
4631 if test "$MOZ_X11"; then
4632 GDK_PACKAGES=gdk-x11-2.0
4635 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4638 fi # COMPILE_ENVIRONMENT
4640 AC_SUBST(MOZ_FS_LAYOUT)
4642 dnl ========================================================
4643 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4644 dnl their usage and use them in spidermonkey.
4645 dnl ========================================================
4646 MOZ_ARG_WITH_BOOL(arm-kuser,
4647 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4649 if test -n "$USE_ARM_KUSER"; then
4650 AC_DEFINE(USE_ARM_KUSER)
4653 dnl ========================================================
4654 dnl = startup-notification support module
4655 dnl ========================================================
4657 if test "$MOZ_ENABLE_GTK2"
4659 MOZ_ENABLE_STARTUP_NOTIFICATION=
4661 MOZ_ARG_ENABLE_BOOL(startup-notification,
4662 [ --enable-startup-notification
4663 Enable startup-notification support (default: disabled) ],
4664 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4665 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4666 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4668 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4669 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4670 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4671 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4673 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4675 MOZ_ENABLE_STARTUP_NOTIFICATION=
4679 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4680 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4683 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4685 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4686 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4687 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4689 dnl ========================================================
4691 dnl ========================================================
4692 if test "$MOZ_ENABLE_QT"
4694 MOZ_ARG_WITH_STRING(qtdir,
4695 [ --with-qtdir=\$dir Specify Qt directory ],
4698 if test -z "$QTDIR"; then
4699 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
4700 PKG_CHECK_MODULES(MOZ_QT5, QtWidgets QtMultimedia QtPrintSupport,
4703 if test "$MOZ_ENABLE_QT5"; then
4705 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
4706 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
4709 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4710 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4712 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4714 MOZ_QT_CFLAGS="-DQT_SHARED"
4715 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4716 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4717 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4718 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4719 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4720 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4721 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4722 HOST_MOC="$QTDIR/bin/moc"
4723 HOST_RCC="$QTDIR/bin/rcc"
4725 # QtWidgets was introduced only in Qt5
4726 if test -d $QTDIR/include/QtWidgets; then
4727 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4728 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4729 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtWidgets -lQtPrintSupport"
4732 if test -z "$HOST_MOC"; then
4733 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4736 if test -z "$HOST_RCC"; then
4737 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4744 MOZ_ENABLE_QMSYSTEM2=
4745 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4746 MOZ_ENABLE_QMSYSTEM2=1,
4747 MOZ_ENABLE_QMSYSTEM2=)
4749 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4750 MOZ_ENABLE_QMSYSTEM2=1
4751 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4752 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4753 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4756 MOZ_ENABLE_QTNETWORK=
4757 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4758 MOZ_ENABLE_QTNETWORK=1,
4759 MOZ_ENABLE_QTNETWORK=)
4761 if test "$MOZ_ENABLE_QTNETWORK"; then
4762 MOZ_ENABLE_QTNETWORK=1
4763 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4766 MOZ_ENABLE_QTMOBILITY=
4767 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4768 MOZ_ENABLE_QTMOBILITY=1,
4769 MOZ_ENABLE_QTMOBILITY=)
4770 if test "$MOZ_ENABLE_QTMOBILITY"; then
4771 MOZ_ENABLE_QTMOBILITY=1
4772 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4773 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4775 AC_CHECK_LIB(QtSensors, main, [
4776 MOZ_ENABLE_QTMOBILITY=1
4777 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4778 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4779 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4780 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4781 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4784 if test "$MOZ_ENABLE_QTMOBILITY"; then
4785 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4789 AC_SUBST(GTK_CONFIG)
4793 AC_SUBST(MOZ_ENABLE_GTK2)
4794 AC_SUBST(MOZ_ENABLE_QT)
4795 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4796 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4797 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4798 AC_SUBST(MOZ_ENABLE_XREMOTE)
4799 AC_SUBST(MOZ_GTK2_CFLAGS)
4800 AC_SUBST(MOZ_GTK2_LIBS)
4801 AC_SUBST(MOZ_WIDGET_GTK)
4802 AC_SUBST(MOZ_QT_CFLAGS)
4803 AC_SUBST(MOZ_QT_LIBS)
4810 dnl ========================================================
4812 dnl = Components & Features
4814 dnl ========================================================
4815 MOZ_ARG_HEADER(Components and Features)
4817 dnl ========================================================
4819 dnl ========================================================
4820 MOZ_ARG_ENABLE_STRING(ui-locale,
4821 [ --enable-ui-locale=ab-CD
4822 Select the user interface locale (default: en-US)],
4823 MOZ_UI_LOCALE=$enableval )
4824 AC_SUBST(MOZ_UI_LOCALE)
4826 dnl ========================================================
4827 dnl = Trademarked Branding
4828 dnl ========================================================
4829 MOZ_ARG_ENABLE_BOOL(official-branding,
4830 [ --enable-official-branding
4831 Enable Official mozilla.org Branding
4832 Do not distribute builds with
4833 --enable-official-branding unless you have
4834 permission to use trademarks per
4835 http://www.mozilla.org/foundation/trademarks/ .],
4837 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4838 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4840 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4841 MOZ_OFFICIAL_BRANDING=1
4843 ], MOZ_OFFICIAL_BRANDING=)
4845 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4846 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4847 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4850 MOZ_ARG_WITH_STRING(branding,
4851 [ --with-branding=dir Use branding from the specified directory.],
4852 MOZ_BRANDING_DIRECTORY=$withval)
4854 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4855 if test -z "$REAL_BRANDING_DIRECTORY"; then
4856 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4859 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4860 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4863 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4865 dnl ========================================================
4866 dnl = Distribution ID
4867 dnl ========================================================
4868 MOZ_ARG_WITH_STRING(distribution-id,
4869 [ --with-distribution-id=ID
4870 Set distribution-specific id (default=org.mozilla)],
4871 [ val=`echo $withval`
4872 MOZ_DISTRIBUTION_ID="$val"])
4874 if test -z "$MOZ_DISTRIBUTION_ID"; then
4875 MOZ_DISTRIBUTION_ID="org.mozilla"
4878 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4879 AC_SUBST(MOZ_DISTRIBUTION_ID)
4882 dnl ========================================================
4883 dnl complex text support off by default
4884 dnl ========================================================
4885 MOZ_ARG_DISABLE_BOOL(pango,
4886 [ --disable-pango Disable usage of Pango ],
4890 dnl ========================================================
4892 dnl ========================================================
4893 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4897 if test "$MOZ_PANGO"
4899 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4901 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4902 AC_SUBST(MOZ_PANGO_CFLAGS)
4903 AC_SUBST(MOZ_PANGO_LIBS)
4904 AC_DEFINE(MOZ_PANGO)
4906 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
4907 AC_SUBST(FT2_CFLAGS)
4912 dnl ========================================================
4913 dnl = GnomeVFS, GIO and GConf support module
4914 dnl ========================================================
4918 dnl build the GIO extension by default only when the
4919 dnl GTK2 toolkit is in use.
4920 if test "$MOZ_ENABLE_GTK2"
4926 dnl ========================================================
4927 dnl = GnomeVFS support module
4928 dnl ========================================================
4929 MOZ_ARG_ENABLE_BOOL(gnomevfs,
4930 [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
4931 MOZ_ENABLE_GNOMEVFS=force,
4932 MOZ_ENABLE_GNOMEVFS=)
4934 if test "$MOZ_ENABLE_GNOMEVFS"
4936 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4937 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4938 MOZ_ENABLE_GNOMEVFS=1
4939 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4941 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4943 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4945 MOZ_ENABLE_GNOMEVFS=
4949 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4950 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4951 AC_SUBST(MOZ_GNOMEVFS_LIBS)
4953 dnl ========================================================
4954 dnl = GIO support module
4955 dnl ========================================================
4956 MOZ_ARG_DISABLE_BOOL(gio,
4957 [ --disable-gio Disable GIO support],
4959 MOZ_ENABLE_GIO=force)
4961 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
4963 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4964 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4965 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4966 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4968 AC_DEFINE(MOZ_ENABLE_GIO)
4970 if test "$MOZ_ENABLE_GIO" = "force"
4972 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4978 AC_SUBST(MOZ_ENABLE_GIO)
4979 AC_SUBST(MOZ_GIO_CFLAGS)
4980 AC_SUBST(MOZ_GIO_LIBS)
4982 dnl ========================================================
4983 dnl = GConf support module
4984 dnl ========================================================
4985 MOZ_ARG_DISABLE_BOOL(gconf,
4986 [ --disable-gconf Disable Gconf support ],
4988 MOZ_ENABLE_GCONF=force)
4990 if test "$MOZ_ENABLE_GCONF"
4992 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4993 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4996 if test "$MOZ_ENABLE_GCONF" = "force"
4998 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5004 if test "$MOZ_ENABLE_GCONF"; then
5005 AC_DEFINE(MOZ_ENABLE_GCONF)
5008 AC_SUBST(MOZ_ENABLE_GCONF)
5009 AC_SUBST(MOZ_GCONF_CFLAGS)
5010 AC_SUBST(MOZ_GCONF_LIBS)
5013 dnl ========================================================
5014 dnl = libproxy support
5015 dnl ========================================================
5017 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5019 MOZ_ENABLE_LIBPROXY=
5021 MOZ_ARG_ENABLE_BOOL(libproxy,
5022 [ --enable-libproxy Enable libproxy support ],
5023 MOZ_ENABLE_LIBPROXY=1,
5024 MOZ_ENABLE_LIBPROXY=)
5026 if test "$MOZ_ENABLE_LIBPROXY"
5028 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5029 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5032 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5033 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5034 AC_SUBST(MOZ_LIBPROXY_LIBS)
5036 dnl ========================================================
5037 dnl = GNOME component (mozgnome)
5038 dnl ========================================================
5040 if test "$MOZ_ENABLE_GTK2"
5042 MOZ_ENABLE_GNOME_COMPONENT=1
5044 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5046 dnl ========================================================
5047 dnl = libgnomeui support module
5048 dnl ========================================================
5050 if test "$MOZ_ENABLE_GTK2"
5052 MOZ_ARG_ENABLE_BOOL(gnomeui,
5053 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
5054 MOZ_ENABLE_GNOMEUI=force,
5055 MOZ_ENABLE_GNOMEUI=)
5057 if test "$MOZ_ENABLE_GNOMEUI"
5059 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5061 MOZ_ENABLE_GNOMEUI=1
5063 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5065 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5071 if test "$MOZ_ENABLE_GNOMEUI"; then
5072 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5076 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5077 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5079 dnl ========================================================
5081 dnl ========================================================
5083 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5087 MOZ_ARG_DISABLE_BOOL(dbus,
5088 [ --disable-dbus Disable dbus support ],
5092 if test "$MOZ_ENABLE_DBUS"
5094 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5095 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5096 AC_DEFINE(MOZ_ENABLE_DBUS)
5099 AC_SUBST(MOZ_ENABLE_DBUS)
5100 AC_SUBST(MOZ_DBUS_CFLAGS)
5101 AC_SUBST(MOZ_DBUS_LIBS)
5102 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5103 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5105 dnl ========================================================
5106 dnl = Enable Android History instead of Places
5107 dnl ========================================================
5108 if test -n "$MOZ_ANDROID_HISTORY"; then
5109 dnl Do this if defined in confvars.sh
5110 AC_DEFINE(MOZ_ANDROID_HISTORY)
5114 dnl ========================================================
5115 dnl = Build with the Android compositor
5116 dnl ========================================================
5117 if test -n "$MOZ_ANDROID_OMTC"; then
5118 dnl Do this if defined in confvars.sh
5119 AC_DEFINE(MOZ_ANDROID_OMTC)
5122 dnl ========================================================
5123 dnl = Disable WebSMS backend
5124 dnl ========================================================
5125 MOZ_ARG_DISABLE_BOOL(websms-backend,
5126 [ --disable-websms-backend
5127 Disable WebSMS backend],
5128 MOZ_WEBSMS_BACKEND=,
5129 MOZ_WEBSMS_BACKEND=1)
5131 if test -n "$MOZ_WEBSMS_BACKEND"; then
5132 AC_DEFINE(MOZ_WEBSMS_BACKEND)
5135 dnl ========================================================
5136 dnl = Build Personal Security Manager
5137 dnl ========================================================
5138 MOZ_ARG_DISABLE_BOOL(crypto,
5139 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5143 dnl ========================================================
5144 dnl = JS Debugger XPCOM component (js/jsd)
5145 dnl ========================================================
5146 MOZ_ARG_DISABLE_BOOL(jsd,
5147 [ --disable-jsd Disable JavaScript debug library],
5152 dnl ========================================================
5153 dnl = Enable IPDL's "expensive" unit tests
5154 dnl ========================================================
5157 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5158 [ --enable-ipdl-tests Enable expensive IPDL tests],
5162 if test -n "$MOZ_IPDL_TESTS"; then
5163 AC_DEFINE(MOZ_IPDL_TESTS)
5166 AC_SUBST(MOZ_IPDL_TESTS)
5168 dnl ========================================================
5169 dnl = Turns off code necessary for e10s compatibility
5170 dnl ========================================================
5171 dnl This is a temporary flag to be removed in bug 662601 when
5172 dnl it's no longer needed
5176 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5177 [ --enable-e10s-compat Turns off code for e10s compat],
5181 if test -n "$MOZ_E10S_COMPAT"; then
5182 AC_DEFINE(MOZ_E10S_COMPAT)
5185 dnl ========================================================
5186 dnl = Disable building dbm
5187 dnl ========================================================
5188 MOZ_ARG_DISABLE_BOOL(dbm,
5189 [ --disable-dbm Disable building dbm],
5193 dnl bi-directional support always on
5197 dnl ========================================================
5198 dnl accessibility support on by default on all platforms
5199 dnl ========================================================
5200 MOZ_ARG_DISABLE_BOOL(accessibility,
5201 [ --disable-accessibility Disable accessibility support],
5204 if test "$ACCESSIBILITY"; then
5205 AC_DEFINE(ACCESSIBILITY)
5208 dnl ========================================================
5209 dnl Disable printing
5210 dnl ========================================================
5211 MOZ_ARG_DISABLE_BOOL(printing,
5212 [ --disable-printing Disable printing support],
5216 if test "$NS_PRINTING"; then
5217 AC_DEFINE(NS_PRINTING)
5218 AC_DEFINE(NS_PRINT_PREVIEW)
5221 dnl Turn off webrtc for OS's we don't handle yet, but allow
5222 dnl --enable-webrtc to override. Can disable for everything in
5223 dnl the master list above.
5224 if test -n "$MOZ_WEBRTC"; then
5226 *-android*|*-linuxandroid*)
5227 dnl Make sure doesn't get matched by *-linux*
5230 *-linux*|*-mingw*|*-darwin*)
5234 dnl default to disabled for all others
5240 dnl ========================================================
5241 dnl = Disable WebRTC code
5242 dnl ========================================================
5243 MOZ_ARG_DISABLE_BOOL(webrtc,
5244 [ --disable-webrtc Disable support for WebRTC],
5248 if test -n "$MOZ_WEBRTC"; then
5249 AC_DEFINE(MOZ_WEBRTC)
5254 MOZ_VP8_ERROR_CONCEALMENT=1
5255 dnl enable once Signaling lands
5256 MOZ_WEBRTC_SIGNALING=1
5257 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5258 if test "${OS_TARGET}" = "WINNT"; then
5259 MOZ_WEBRTC_IN_LIBXUL=1
5261 dnl enable once PeerConnection lands
5262 MOZ_PEERCONNECTION=1
5263 AC_DEFINE(MOZ_PEERCONNECTION)
5270 AC_SUBST(MOZ_WEBRTC)
5271 AC_SUBST(MOZ_WEBRTC_TESTS)
5272 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5273 AC_SUBST(MOZ_PEERCONNECTION)
5274 AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
5278 case "$target_cpu" in
5280 MOZ_SAMPLE_TYPE_S16=1
5281 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5282 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5285 MOZ_SAMPLE_TYPE_FLOAT32=1
5286 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5287 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5291 dnl ========================================================
5292 dnl = Enable Raw Codecs
5293 dnl ========================================================
5294 MOZ_ARG_ENABLE_BOOL(raw,
5295 [ --enable-raw Enable support for RAW media],
5299 if test -n "$MOZ_RAW"; then
5306 dnl ========================================================
5307 dnl = Disable Ogg Codecs
5308 dnl ========================================================
5309 MOZ_ARG_DISABLE_BOOL(ogg,
5310 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5314 if test -n "$MOZ_OGG"; then
5320 dnl Checks for __attribute__(aligned()) directive
5321 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5322 [ac_cv_c_attribute_aligned],
5323 [ac_cv_c_attribute_aligned=0
5324 CFLAGS_save="${CFLAGS}"
5325 CFLAGS="${CFLAGS} -Werror"
5326 for ac_cv_c_attr_align_try in 64 32 16 8; do
5327 echo "trying $ac_cv_c_attr_align_try"
5329 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5330 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5331 if test "$ac_cv_c_attribute_aligned" != 0; then
5335 CFLAGS="${CFLAGS_save}"])
5336 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5337 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5338 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5342 dnl ========================================================
5343 dnl = Disable Opus audio codec support
5344 dnl ========================================================
5345 MOZ_ARG_DISABLE_BOOL(opus,
5346 [ --disable-opus Disable support for Opus audio],
5350 dnl ========================================================
5351 dnl = Disable VP8 decoder support
5352 dnl ========================================================
5353 MOZ_ARG_DISABLE_BOOL(webm,
5354 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5358 if test -n "$MOZ_WEBM"; then
5363 dnl ========================================================
5364 dnl = Enable DASH-WebM support
5365 dnl ========================================================
5366 MOZ_ARG_ENABLE_BOOL(dash,
5367 [ --enable-dash Enable support for DASH-WebM],
5371 if test -n "$MOZ_DASH"; then
5372 if test -n "$MOZ_WEBM"; then
5375 dnl Fail if WebM is not enabled as well as DASH.
5376 AC_MSG_ERROR([WebM is currently disabled and must be enabled for DASH
5381 dnl ========================================================
5382 dnl = Enable media plugin support
5383 dnl ========================================================
5384 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5385 dnl Enable support on android by default
5389 MOZ_ARG_ENABLE_BOOL(media-plugins,
5390 [ --enable-media-plugins Enable support for media plugins],
5391 MOZ_MEDIA_PLUGINS=1,
5394 if test -n "$MOZ_MEDIA_PLUGINS"; then
5395 AC_DEFINE(MOZ_MEDIA_PLUGINS)
5398 dnl ========================================================
5399 dnl = Enable getUserMedia support
5400 dnl ========================================================
5401 MOZ_ARG_ENABLE_BOOL(media-navigator,
5402 [ --enable-media-navigator Enable support for getUserMedia],
5403 MOZ_MEDIA_NAVIGATOR=1,
5404 MOZ_MEDIA_NAVIGATOR=)
5406 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5407 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5410 dnl ========================================================
5411 dnl = Enable building OMX media plugin (B2G or Android)
5412 dnl ========================================================
5413 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5414 dnl Enable support on android by default
5418 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5419 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5423 if test -n "$MOZ_OMX_PLUGIN"; then
5424 if test "$OS_TARGET" = "Android"; then
5425 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5426 AC_DEFINE(MOZ_OMX_PLUGIN)
5428 dnl fail if we're not building on Gonk or Android
5429 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5433 dnl system libvpx Support
5434 dnl ========================================================
5435 MOZ_ARG_WITH_BOOL(system-libvpx,
5436 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5437 MOZ_NATIVE_LIBVPX=1)
5442 if test -n "$MOZ_VP8"; then
5444 if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5445 AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5447 if test -n "$MOZ_VP8_ENCODER" ; then
5448 AC_DEFINE(MOZ_VP8_ENCODER)
5451 if test -n "$MOZ_NATIVE_LIBVPX"; then
5452 dnl ============================
5453 dnl === libvpx Version check ===
5454 dnl ============================
5455 dnl Check to see if we have a system libvpx package.
5456 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5458 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5459 [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.])])
5462 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5463 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5468 AC_SUBST(MOZ_NATIVE_LIBVPX)
5469 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5470 AC_SUBST(MOZ_LIBVPX_LIBS)
5472 if test "$MOZ_WEBM"; then
5476 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5483 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5485 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5486 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5487 dnl We currently require gcc on all arm platforms.
5490 VPX_NEED_OBJ_INT_EXTRACT=
5492 dnl See if we have assembly on this platform.
5493 case "$OS_ARCH:$CPU_ARCH" in
5495 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5499 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5503 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5507 dnl Check for yasm 1.1 or greater.
5508 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5509 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.])
5510 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5511 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.])
5513 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5515 dnl The encoder needs obj_int_extract to get asm offsets.
5519 if test -n "$GNU_AS" ; then
5521 dnl These flags are a lie; they're just used to enable the requisite
5522 dnl opcodes; actual arch detection is done at runtime.
5523 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5524 VPX_DASH_C_FLAG="-c"
5525 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5526 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5531 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5532 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5537 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5538 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5544 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5545 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.])
5548 if test -n "$MOZ_VP8_ENCODER" -a \
5549 -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5550 dnl We prefer to get asm offsets using inline assembler, which the above
5551 dnl compilers can do. When we're not using one of those, we have to fall
5552 dnl back to obj_int_extract, which reads them from a compiled object
5553 dnl file. Unfortunately, that only works if we're compiling on a system
5554 dnl with the header files for the appropriate object file format.
5555 VPX_NEED_OBJ_INT_EXTRACT=1
5558 if test -n "$VPX_X86_ASM"; then
5559 AC_DEFINE(VPX_X86_ASM)
5560 elif test -n "$VPX_ARM_ASM"; then
5561 AC_DEFINE(VPX_ARM_ASM)
5563 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5567 dnl ========================================================
5568 dnl = Disable Wave decoder support
5569 dnl ========================================================
5570 MOZ_ARG_DISABLE_BOOL(wave,
5571 [ --disable-wave Disable Wave decoder support],
5575 if test -n "$MOZ_WAVE"; then
5582 dnl ========================================================
5583 dnl = Handle dependent SYDNEYAUDIO, CUBEB, and MEDIA defines
5584 dnl ========================================================
5586 if test -n "$MOZ_SYDNEYAUDIO"; then
5587 AC_DEFINE(MOZ_SYDNEYAUDIO)
5590 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5591 AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5594 if test -n "$MOZ_CUBEB"; then
5596 *-android*|*-linuxandroid*)
5597 if test -n "$gonkdir"; then
5598 AC_DEFINE(MOZ_CUBEB)
5600 dnl No Android implementation of libcubeb yet.
5603 AC_DEFINE(MOZ_CUBEB)
5606 AC_DEFINE(MOZ_CUBEB)
5609 AC_DEFINE(MOZ_CUBEB)
5612 AC_DEFINE(MOZ_CUBEB)
5615 dnl Other targets will be enabled soon.
5620 if test -n "$MOZ_MEDIA"; then
5621 AC_DEFINE(MOZ_MEDIA)
5624 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5625 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/])
5628 if test -n "$MOZ_VORBIS"; then
5629 AC_DEFINE(MOZ_VORBIS)
5632 if test -n "$MOZ_TREMOR"; then
5633 AC_DEFINE(MOZ_TREMOR)
5636 if test -n "$MOZ_OPUS"; then
5640 dnl ========================================================
5641 dnl = Check alsa availability on Linux if using sydneyaudio
5642 dnl ========================================================
5644 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5645 if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
5646 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5647 [echo "$MOZ_ALSA_PKG_ERRORS"
5648 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.)])])
5651 dnl ========================================================
5652 dnl = Enable PulseAudio
5653 dnl ========================================================
5655 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5656 [ --enable-pulseaudio Enable PulseAudio support (experimental)],
5660 if test -n "$MOZ_PULSEAUDIO"; then
5661 AC_DEFINE(MOZ_CUBEB)
5662 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5663 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5664 AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
5667 AC_SUBST(MOZ_PULSEAUDIO)
5668 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5669 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5671 dnl ========================================================
5672 dnl = Enable GStreamer
5673 dnl ========================================================
5674 MOZ_ARG_ENABLE_BOOL(gstreamer,
5675 [ --enable-gstreamer Enable GStreamer support],
5679 if test "$MOZ_GSTREAMER"; then
5680 # API version, eg 0.10, 1.0 etc
5681 GST_API_VERSION=0.10
5682 # core/base release number
5683 # depend on >= 0.10.33 as that's when the playbin2 source-setup signal was
5686 PKG_CHECK_MODULES(GSTREAMER,
5687 gstreamer-$GST_API_VERSION >= $GST_VERSION
5688 gstreamer-app-$GST_API_VERSION
5689 gstreamer-plugins-base-$GST_API_VERSION)
5690 if test -n "$GSTREAMER_LIBS"; then
5691 _SAVE_LDFLAGS=$LDFLAGS
5692 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5693 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5694 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5695 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5697 AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
5699 LDFLAGS=$_SAVE_LDFLAGS
5701 AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
5704 AC_SUBST(GSTREAMER_CFLAGS)
5705 AC_SUBST(GSTREAMER_LIBS)
5706 AC_SUBST(MOZ_GSTREAMER)
5708 if test -n "$MOZ_GSTREAMER"; then
5709 AC_DEFINE(MOZ_GSTREAMER)
5714 dnl ========================================================
5715 dnl Permissions System
5716 dnl ========================================================
5717 MOZ_ARG_DISABLE_BOOL(permissions,
5718 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5723 dnl ========================================================
5725 dnl ========================================================
5726 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5727 [ --disable-negotiateauth Disable GSS-API negotiation ],
5728 MOZ_AUTH_EXTENSION=,
5729 MOZ_AUTH_EXTENSION=1 )
5731 dnl ========================================================
5733 dnl ========================================================
5734 MOZ_ARG_DISABLE_BOOL(xtf,
5735 [ --disable-xtf Disable XTF (pluggable xml tags) support],
5738 if test "$MOZ_XTF"; then
5742 dnl ========================================================
5743 dnl Pref extensions (autoconfig)
5744 dnl ========================================================
5745 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5746 [ --disable-pref-extensions
5747 Disable pref extensions such as autoconfig],
5748 MOZ_PREF_EXTENSIONS=,
5749 MOZ_PREF_EXTENSIONS=1 )
5751 dnl ========================================================
5752 dnl Searching of system directories for extensions.
5753 dnl Note: this switch is meant to be used for test builds
5754 dnl whose behavior should not depend on what happens to be
5755 dnl installed on the local machine.
5756 dnl ========================================================
5757 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5758 [ --disable-system-extension-dirs
5759 Disable searching system- and account-global
5760 directories for extensions of any kind; use
5761 only profile-specific extension directories],
5762 ENABLE_SYSTEM_EXTENSION_DIRS=,
5763 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5764 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5765 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5768 dnl ========================================================
5769 dnl = Universalchardet
5770 dnl ========================================================
5771 MOZ_ARG_DISABLE_BOOL(universalchardet,
5772 [ --disable-universalchardet
5773 Disable universal encoding detection],
5774 MOZ_UNIVERSALCHARDET=,
5775 MOZ_UNIVERSALCHARDET=1 )
5777 if test -n "${JAVA_BIN_PATH}"; then
5778 dnl Look for javac and jar in the specified path.
5779 JAVA_PATH="$JAVA_BIN_PATH"
5781 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5782 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5785 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5786 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5787 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5789 if test -n "${JAVA_BIN_PATH}" -o \
5790 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5791 if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5792 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}])
5796 dnl ========================================================
5797 dnl = ANGLE OpenGL->D3D translator for WebGL
5798 dnl = * only applies to win32
5799 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5800 dnl ========================================================
5802 MOZ_DIRECTX_SDK_PATH=
5803 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5806 MOZ_D3DCOMPILER_CAB=
5808 MOZ_D3DCOMPILER_DLL=
5809 case "$target_os" in
5811 MOZ_ANGLE_RENDERER=1
5815 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5816 case "${target_cpu}" in
5818 MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5821 MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5825 MOZ_ARG_DISABLE_BOOL(webgl,
5826 [ --disable-webgl Disable building of the WebGL implementation],
5827 MOZ_WEBGL_DISABLED=1,
5828 MOZ_WEBGL_DISABLED=)
5830 if test -n "$MOZ_WEBGL_DISABLED"; then
5835 if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
5836 # Get the SDK path from the registry.
5837 # First try to get the June 2010 SDK
5838 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5839 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5840 # Otherwise just take whatever comes first
5841 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5844 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5845 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.])
5847 MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/'`
5850 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5851 test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5852 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5853 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5855 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.])
5858 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5859 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'`
5861 if test -z "$MOZ_D3DX9_VERSION" ; then
5862 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.])
5865 MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5866 MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5868 if test -z "$MOZ_D3DX9_CAB" -o -z "$MOZ_D3DCOMPILER_CAB"; then
5869 AC_MSG_ERROR([Couldn't find the DirectX redistributable files. Either reinstall the DirectX SDK (making sure the "DirectX Redistributable Files" option is selected), or reconfigure with --disable-webgl.])
5872 MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
5873 MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5876 dnl ========================================================
5877 dnl = Breakpad crash reporting (on by default on supported platforms)
5878 dnl ========================================================
5881 i?86-*-mingw*|x86_64-*-mingw*)
5884 i?86-apple-darwin*|x86_64-apple-darwin*)
5887 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5888 if test "$MOZ_ENABLE_GTK2"; then
5892 *-android*|*-linuxandroid*)
5900 MOZ_ARG_DISABLE_BOOL(crashreporter,
5901 [ --disable-crashreporter Disable breakpad crash reporting],
5903 MOZ_CRASHREPORTER=1)
5905 if test -n "$MOZ_CRASHREPORTER"; then
5906 AC_DEFINE(MOZ_CRASHREPORTER)
5908 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5909 test -z "$SKIP_LIBRARY_CHECKS"; then
5910 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5911 AC_SUBST(MOZ_GTHREAD_CFLAGS)
5912 AC_SUBST(MOZ_GTHREAD_LIBS)
5914 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.])])
5917 if test "$OS_ARCH" != "$HOST_OS_ARCH"; then
5918 AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH. Use --disable-crashreporter.])
5921 if test "$OS_ARCH" = "WINNT" -a -z "$HAVE_64BIT_OS"; then
5922 MOZ_CRASHREPORTER_INJECTOR=1
5923 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5927 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5928 [ --with-crashreporter-enable-percent=NN
5929 Enable sending crash reports by default on NN% of users. (default=100)],
5930 [ val=`echo $withval | sed 's/[^0-9]//g'`
5931 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5933 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5934 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5936 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5938 dnl ========================================================
5939 dnl = libjpeg-turbo configuration
5940 dnl ========================================================
5942 if test -z "$MOZ_NATIVE_JPEG"; then
5946 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5947 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
5949 MOZ_LIBJPEG_TURBO=1)
5951 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
5952 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
5955 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
5958 if test -n "$MOZ_LIBJPEG_TURBO"; then
5960 dnl Do we support libjpeg-turbo on this platform?
5961 case "$OS_ARCH:$OS_TEST" in
5963 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
5964 LIBJPEG_TURBO_X86_ASM=1
5967 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
5968 LIBJPEG_TURBO_X64_ASM=1
5970 WINNT:x86|WINNT:i?86)
5971 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
5972 LIBJPEG_TURBO_X86_ASM=1
5975 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
5976 LIBJPEG_TURBO_X64_ASM=1
5979 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
5980 LIBJPEG_TURBO_ARM_ASM=1
5983 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5984 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
5985 LIBJPEG_TURBO_X86_ASM=1
5989 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5990 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
5991 LIBJPEG_TURBO_X64_ASM=1
5998 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
5999 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6000 dnl it doesn't exist or we have too old of a version.
6001 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6002 AC_MSG_CHECKING([for Yasm assembler])
6003 AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
6005 if test -z "$LIBJPEG_TURBO_AS" ; then
6006 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.])
6009 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6010 dnl on Linux and 1.1 or newer everywhere else.
6011 if test "$OS_ARCH" = "Linux" ; then
6012 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
6013 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.])
6016 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6017 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.])
6022 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6023 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6024 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6025 echo "Using $AS as the assembler for ARM code."
6026 LIBJPEG_TURBO_AS=$AS
6029 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6030 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6031 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6032 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6033 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6034 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6035 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6036 dnl Warn if we're not building the optimized routines, even though the user
6037 dnl didn't specify --disable-libjpeg-turbo.
6038 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6041 dnl ========================================================
6042 dnl = Enable compilation of specific extension modules
6043 dnl ========================================================
6045 MOZ_ARG_ENABLE_STRING(extensions,
6046 [ --enable-extensions Enable extensions],
6047 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6048 if test "$option" = "yes" -o "$option" = "all"; then
6049 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6050 elif test "$option" = "no" -o "$option" = "none"; then
6052 elif test "$option" = "default"; then
6053 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6054 elif test `echo "$option" | grep -c \^-` != 0; then
6055 option=`echo $option | sed 's/^-//'`
6056 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6058 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6061 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6063 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6064 # Suppress warning on non-X11 platforms
6065 if test -n "$MOZ_X11"; then
6066 AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6068 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6071 dnl Do not build gnomevfs with libxul based apps
6072 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6073 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6076 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6077 # Suppress warning on non-X11 platforms
6078 if test -n "$MOZ_X11"; then
6079 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6081 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6084 dnl Do not build gio with libxul based apps
6085 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6086 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6089 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6090 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6091 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6094 dnl xforms requires xtf
6095 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6096 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
6097 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6101 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6103 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6104 dnl when trying to build a nonexistent extension.
6105 for extension in $MOZ_EXTENSIONS; do
6106 if test ! -d "${srcdir}/extensions/${extension}"; then
6107 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6111 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6112 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6115 dnl ========================================================
6116 dnl CSS3 Flexbox Support
6117 dnl ========================================================
6118 if test -n "$MOZ_FLEXBOX"; then
6119 AC_DEFINE(MOZ_FLEXBOX)
6122 dnl ========================================================
6123 dnl Build Freetype in the tree
6124 dnl ========================================================
6125 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6126 [ --enable-tree-freetype Enable Tree FreeType],
6127 MOZ_TREE_FREETYPE=1,
6128 MOZ_TREE_FREETYPE= )
6129 if test -n "$MOZ_TREE_FREETYPE"; then
6130 if test -n "$_WIN32_MSVC"; then
6131 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6133 AC_DEFINE(MOZ_TREE_FREETYPE)
6134 AC_SUBST(MOZ_TREE_FREETYPE)
6135 MOZ_ENABLE_CAIRO_FT=1
6136 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6137 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6138 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6139 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6141 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6142 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6143 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6144 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6145 AC_SUBST(CAIRO_FT_CFLAGS)
6148 dnl ========================================================
6150 dnl ========================================================
6151 dnl Abort Windows build if the required major version and
6152 dnl minimum minor version of Unicode NSIS isn't in the path
6153 dnl (unless in case of cross compiling, for which Unicode
6154 dnl is not yet sufficient).
6155 if test "$OS_ARCH" = "WINNT"; then
6156 REQ_NSIS_MAJOR_VER=2
6157 MIN_NSIS_MINOR_VER=33
6158 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6159 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6160 AC_MSG_RESULT([yes])
6162 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6164 if test ! "$MAKENSISU_VER" = ""; then
6165 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6166 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6168 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6169 if test "$MAKENSISU_VER" = "" || \
6170 test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6171 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6173 if test -z "$CROSS_COMPILE"; then
6174 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.])
6179 elif test -z "$CROSS_COMPILE"; then
6180 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.])
6186 dnl ========================================================
6188 dnl ========================================================
6189 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6190 [ --disable-webapp-runtime Disable Web App Runtime],
6191 MOZ_WEBAPP_RUNTIME=,
6192 MOZ_WEBAPP_RUNTIME=1)
6193 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6196 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6199 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6200 if test "$MOZ_WEBAPP_RUNTIME"; then
6201 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6204 AC_MSG_CHECKING([for tar archiver])
6205 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6206 if test -z "$TAR"; then
6207 AC_MSG_ERROR([no tar archiver found in \$PATH])
6209 AC_MSG_RESULT([$TAR])
6212 AC_MSG_CHECKING([for wget])
6213 AC_CHECK_PROGS(WGET, wget, "")
6214 AC_MSG_RESULT([$WGET])
6217 dnl ========================================================
6219 dnl ========================================================
6221 if test -n "$MOZ_SIGN_CMD"; then
6222 AC_DEFINE(MOZ_SIGNING)
6225 dnl ========================================================
6226 dnl Maintenance Service
6227 dnl ========================================================
6229 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6230 [ --enable-maintenance-service Enable building of maintenanceservice],
6231 MOZ_MAINTENANCE_SERVICE=1,
6232 MOZ_MAINTENANCE_SERVICE= )
6234 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6235 if test "$OS_ARCH" = "WINNT"; then
6236 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6238 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6242 dnl ========================================================
6243 dnl Verify MAR signatures
6244 dnl ========================================================
6246 MOZ_ARG_ENABLE_BOOL(verify-mar,
6247 [ --enable-verify-mar Enable verifying MAR signatures],
6248 MOZ_VERIFY_MAR_SIGNATURE=1,
6249 MOZ_VERIFY_MAR_SIGNATURE= )
6251 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6252 if test "$OS_ARCH" = "WINNT"; then
6253 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6255 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6259 dnl ========================================================
6260 dnl Enable building the signmar program.
6261 dnl This option is much different than the --enable-verify-mar option.
6262 dnl --enable-verify-mar is for enabling the verification check on MAR
6263 dnl files in the updater. The --enable-signmar option is for building
6264 dnl the signmar program.
6265 dnl ========================================================
6267 MOZ_ARG_ENABLE_BOOL(signmar,
6268 [ --enable-signmar Enable building the signmar program],
6269 MOZ_ENABLE_SIGNMAR=1,
6270 MOZ_ENABLE_SIGNMAR= )
6272 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6273 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6276 dnl ========================================================
6278 dnl ========================================================
6280 MOZ_ARG_DISABLE_BOOL(updater,
6281 [ --disable-updater Disable building of updater],
6285 if test -n "$MOZ_UPDATER"; then
6286 AC_DEFINE(MOZ_UPDATER)
6289 # app update channel is 'default' when not supplied.
6290 MOZ_ARG_ENABLE_STRING([update-channel],
6291 [ --enable-update-channel=CHANNEL
6292 Select application update channel (default=default)],
6293 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6295 if test -z "$MOZ_UPDATE_CHANNEL"; then
6296 MOZ_UPDATE_CHANNEL=default
6298 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6299 AC_SUBST(MOZ_UPDATE_CHANNEL)
6301 # tools/update-packaging is not checked out by default.
6302 MOZ_ARG_ENABLE_BOOL(update-packaging,
6303 [ --enable-update-packaging
6304 Enable tools/update-packaging],
6305 MOZ_UPDATE_PACKAGING=1,
6306 MOZ_UPDATE_PACKAGING= )
6307 AC_SUBST(MOZ_UPDATE_PACKAGING)
6309 dnl ========================================================
6310 dnl build the tests by default
6311 dnl ========================================================
6312 MOZ_ARG_DISABLE_BOOL(tests,
6313 [ --disable-tests Do not build test libraries & programs],
6317 dnl ========================================================
6318 dnl parental controls (for Windows Vista)
6319 dnl ========================================================
6320 MOZ_ARG_DISABLE_BOOL(parental-controls,
6321 [ --disable-parental-controls
6322 Do not build parental controls],
6323 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6324 MOZ_DISABLE_PARENTAL_CONTROLS=)
6325 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6326 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6329 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6331 dnl ========================================================
6332 dnl = Disable DOMCrypto
6333 dnl ========================================================
6334 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6335 AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6338 dnl ========================================================
6340 dnl = Module specific options
6342 dnl ========================================================
6343 MOZ_ARG_HEADER(Individual module options)
6345 dnl ========================================================
6346 dnl = Disable feed handling components
6347 dnl ========================================================
6348 MOZ_ARG_DISABLE_BOOL(feeds,
6349 [ --disable-feeds Disable feed handling and processing components],
6352 if test -n "$MOZ_FEEDS"; then
6353 AC_DEFINE(MOZ_FEEDS)
6355 if test "$MOZ_BUILD_APP" = "browser"; then
6356 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6360 dnl ========================================================
6361 dnl Check for sqlite
6362 dnl ========================================================
6365 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6366 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6367 MOZ_NATIVE_SQLITE=1,
6368 MOZ_NATIVE_SQLITE= )
6370 if test -z "$MOZ_NATIVE_SQLITE"
6373 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6375 dnl ============================
6376 dnl === SQLite Version check ===
6377 dnl ============================
6378 dnl Check to see if the system SQLite package is new enough.
6379 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6381 dnl ==================================
6382 dnl === SQLITE_SECURE_DELETE check ===
6383 dnl ==================================
6384 dnl Check to see if the system SQLite package is compiled with
6385 dnl SQLITE_SECURE_DELETE enabled.
6386 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE 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_secure_delete,[
6393 #include "sqlite3.h"
6395 int main(int argc, char **argv){
6396 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6398 ac_cv_sqlite_secure_delete=yes,
6399 ac_cv_sqlite_secure_delete=no,
6400 ac_cv_sqlite_secure_delete=no
6403 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6404 CFLAGS="$_SAVE_CFLAGS"
6406 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6407 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6410 dnl ===============================
6411 dnl === SQLITE_THREADSAFE check ===
6412 dnl ===============================
6413 dnl Check to see if the system SQLite package is compiled with
6414 dnl SQLITE_THREADSAFE enabled.
6415 AC_MSG_CHECKING(for SQLITE_THREADSAFE 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_threadsafe,[
6422 #include "sqlite3.h"
6424 int main(int argc, char **argv){
6425 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6427 ac_cv_sqlite_threadsafe=yes,
6428 ac_cv_sqlite_threadsafe=no,
6429 ac_cv_sqlite_threadsafe=no
6432 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6433 CFLAGS="$_SAVE_CFLAGS"
6435 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6436 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6439 dnl ================================
6440 dnl === SQLITE_ENABLE_FTS3 check ===
6441 dnl ================================
6442 dnl check to see if the system SQLite package is compiled with
6443 dnl SQLITE_ENABLE_FTS3 enabled.
6444 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6445 _SAVE_CFLAGS="$CFLAGS"
6446 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6448 LIBS="$LIBS $SQLITE_LIBS"
6449 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6451 #include "sqlite3.h"
6453 int main(int argc, char **argv){
6454 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6456 ac_cv_sqlite_enable_fts3=yes,
6457 ac_cv_sqlite_enable_fts3=no,
6458 ac_cv_sqlite_enable_fts3=no
6461 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6462 CFLAGS="$_SAVE_CFLAGS"
6464 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6465 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6468 dnl =========================================
6469 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6470 dnl =========================================
6471 dnl check to see if the system SQLite package is compiled with
6472 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6473 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6474 _SAVE_CFLAGS="$CFLAGS"
6475 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6477 LIBS="$LIBS $SQLITE_LIBS"
6478 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6480 #include "sqlite3.h"
6482 int main(int argc, char **argv){
6483 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6485 ac_cv_sqlite_enable_unlock_notify=yes,
6486 ac_cv_sqlite_enable_unlock_notify=no,
6487 ac_cv_sqlite_enable_unlock_notify=no
6490 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6491 CFLAGS="$_SAVE_CFLAGS"
6493 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6494 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6498 if test -n "$MOZ_NATIVE_SQLITE"; then
6499 AC_DEFINE(MOZ_NATIVE_SQLITE)
6501 AC_SUBST(MOZ_NATIVE_SQLITE)
6503 dnl ========================================================
6504 dnl = Enable help viewer (off by default)
6505 dnl ========================================================
6506 if test -n "$MOZ_HELP_VIEWER"; then
6507 dnl Do this if defined in confvars.sh
6508 AC_DEFINE(MOZ_HELP_VIEWER)
6511 dnl ========================================================
6512 dnl = Enable safe browsing (anti-phishing)
6513 dnl ========================================================
6514 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6515 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6516 MOZ_SAFE_BROWSING=1,
6517 MOZ_SAFE_BROWSING= )
6518 if test -n "$MOZ_SAFE_BROWSING"; then
6519 AC_DEFINE(MOZ_SAFE_BROWSING)
6521 AC_SUBST(MOZ_SAFE_BROWSING)
6523 dnl ========================================================
6524 dnl = Enable url-classifier
6525 dnl ========================================================
6526 dnl Implicitly enabled by default if building with safe-browsing
6527 if test -n "$MOZ_SAFE_BROWSING"; then
6528 MOZ_URL_CLASSIFIER=1
6530 MOZ_ARG_ENABLE_BOOL(url-classifier,
6531 [ --enable-url-classifier Enable url classifier module],
6532 MOZ_URL_CLASSIFIER=1,
6533 MOZ_URL_CLASSIFIER= )
6534 if test -n "$MOZ_URL_CLASSIFIER"; then
6535 AC_DEFINE(MOZ_URL_CLASSIFIER)
6537 AC_SUBST(MOZ_URL_CLASSIFIER)
6539 dnl ========================================================
6540 dnl = Disable zipwriter
6541 dnl ========================================================
6542 MOZ_ARG_DISABLE_BOOL(zipwriter,
6543 [ --disable-zipwriter Disable zipwriter component],
6546 AC_SUBST(MOZ_ZIPWRITER)
6548 dnl ========================================================
6550 dnl ========================================================
6551 dnl superseded by QtNetwork starting from 4.7
6552 MOZ_ENABLE_LIBCONIC=1
6554 if test -n "$MOZ_ENABLE_QT"; then
6555 if test "$MOZ_ENABLE_QTNETWORK"; then
6556 MOZ_ENABLE_LIBCONIC=
6560 MOZ_ARG_DISABLE_BOOL(libconic,
6561 [ --disable-libconic Disable libconic],
6562 MOZ_ENABLE_LIBCONIC=,
6563 MOZ_ENABLE_LIBCONIC=1 )
6565 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6566 PKG_CHECK_MODULES(LIBCONIC, conic,
6567 MOZ_ENABLE_LIBCONIC=1,
6568 MOZ_ENABLE_LIBCONIC=)
6570 if test "$MOZ_ENABLE_LIBCONIC"; then
6571 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6574 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6575 AC_SUBST(LIBCONIC_CFLAGS)
6576 AC_SUBST(LIBCONIC_LIBS)
6578 dnl ========================================================
6580 dnl ========================================================
6582 MAEMO_SDK_TARGET_VER=-1
6584 MOZ_ARG_WITH_STRING(maemo-version,
6585 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6587 MAEMO_SDK_TARGET_VER=$withval)
6589 case "$MAEMO_SDK_TARGET_VER" in
6591 MOZ_PLATFORM_MAEMO=5
6595 MOZ_PLATFORM_MAEMO=6
6599 dnl We aren't compiling for Maemo, move on.
6602 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6606 if test $MOZ_PLATFORM_MAEMO; then
6607 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6609 if test -z "$MOZ_ENABLE_DBUS"; then
6610 AC_MSG_ERROR([DBus is required when building for Maemo])
6613 MOZ_GFX_OPTIMIZE_MOBILE=1
6614 MOZ_GL_DEFAULT_PROVIDER=EGL
6615 MOZ_MAEMO_LIBLOCATION=
6617 if test $MOZ_PLATFORM_MAEMO = 5; then
6618 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6619 MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6620 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6621 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6622 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6624 AC_SUBST(XCOMPOSITE_LIBS)
6626 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6627 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6628 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6629 if test -z "$_LIB_FOUND"; then
6630 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6634 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6635 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6636 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6637 if test -z "$_LIB_FOUND"; then
6638 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6641 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6642 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6643 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6644 if test -z "$_LIB_FOUND"; then
6645 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6649 if test $MOZ_PLATFORM_MAEMO = 6; then
6651 PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6654 if test "$_LIB_FOUND"; then
6655 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6656 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6657 MOZ_ENABLE_CONTENTMANAGER=1
6658 AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6660 AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6662 AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6664 dnl ========================================================
6665 dnl = Enable meego libcontentaction
6666 dnl ========================================================
6667 MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6668 [ --enable-meegocontentaction Enable meegocontentaction support],
6669 MOZ_MEEGOCONTENTACTION=1,
6670 MOZ_MEEGOCONTENTACTION=)
6672 if test -n "$MOZ_MEEGOCONTENTACTION"; then
6674 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6675 if test "$_LIB_FOUND"; then
6676 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6677 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6678 MOZ_ENABLE_CONTENTACTION=1
6679 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6680 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6684 MOZ_ARG_ENABLE_BOOL(meegotouch,
6685 [ --enable-meegotouch Enable meegotouch support],
6686 MOZ_MEEGOTOUCHENABLED=1,
6687 MOZ_MEEGOTOUCHENABLED=)
6689 if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6690 PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6691 if test "$_LIB_FOUND"; then
6692 MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6693 MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6694 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6696 AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6701 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6702 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6703 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6704 if test "$_LIB_FOUND"; then
6705 MOZ_MAEMO_LIBLOCATION=1
6706 AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6708 AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6710 AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6712 PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6713 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6714 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6715 if test "$_LIB_FOUND"; then
6716 MOZ_ENABLE_MEEGOTOUCHSHARE=1
6717 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6719 AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6721 AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6723 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6724 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6727 dnl ========================================================
6728 dnl = XRender Composite
6729 dnl ========================================================
6730 MOZ_ARG_ENABLE_BOOL(egl-xrender-composite,
6731 [ --enable-egl-xrender-composite
6732 Enable EGL xrender composite optimizations],
6733 MOZ_EGL_XRENDER_COMPOSITE=1)
6735 if test -n "$MOZ_EGL_XRENDER_COMPOSITE"; then
6736 AC_DEFINE(MOZ_EGL_XRENDER_COMPOSITE)
6739 AC_SUBST(MOZ_EGL_XRENDER_COMPOSITE)
6741 dnl ========================================================
6743 dnl ========================================================
6745 MOZ_ARG_WITH_STRING(gl-provider,
6746 [ --with-gl-provider=ID
6747 Set GL provider backend type],
6748 [ val=`echo $withval`
6749 MOZ_GL_PROVIDER="$val"])
6751 if test -n "$MOZ_GL_PROVIDER"; then
6752 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6753 AC_SUBST(MOZ_GL_PROVIDER)
6754 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6756 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6758 dnl ========================================================
6759 dnl = faststripe theme
6760 dnl ========================================================
6761 MOZ_ARG_ENABLE_BOOL(faststripe,
6762 [ --enable-faststripe Use faststripe theme],
6763 MOZ_THEME_FASTSTRIPE=1,
6764 MOZ_THEME_FASTSTRIPE= )
6765 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6767 dnl ========================================================
6769 dnl = Feature options that require extra sources to be pulled
6771 dnl ========================================================
6772 dnl MOZ_ARG_HEADER(Features that require extra sources)
6774 dnl ========================================================
6776 dnl = Debugging Options
6778 dnl ========================================================
6779 MOZ_ARG_HEADER(Debugging and Optimizations)
6781 dnl ========================================================
6782 dnl = Disable building with debug info.
6783 dnl = Debugging is OFF by default
6784 dnl ========================================================
6785 if test -z "$MOZ_DEBUG_FLAGS"; then
6786 MOZ_DEBUG_FLAGS="-g"
6789 MOZ_ARG_ENABLE_STRING(debug,
6790 [ --enable-debug[=DBG] Enable building with developer debug info
6791 (using compiler flags DBG)],
6792 [ if test "$enableval" != "no"; then
6794 if test -n "$enableval" -a "$enableval" != "yes"; then
6795 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6796 _MOZ_DEBUG_FLAGS_SET=1
6803 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6804 MOZ_ARG_WITH_STRING(debug-label,
6805 [ --with-debug-label=LABELS
6806 Define DEBUG_<value> for each comma-separated
6808 [ for option in `echo $withval | sed 's/,/ /g'`; do
6809 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6812 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6814 if test -n "$MOZ_DEBUG"; then
6815 AC_MSG_CHECKING([for valid debug flags])
6816 _SAVE_CFLAGS=$CFLAGS
6817 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6818 AC_TRY_COMPILE([#include <stdio.h>],
6819 [printf("Hello World\n");],
6822 AC_MSG_RESULT([$_results])
6823 if test "$_results" = "no"; then
6824 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6826 CFLAGS=$_SAVE_CFLAGS
6829 dnl ========================================================
6830 dnl enable mobile optimizations
6831 dnl ========================================================
6832 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6833 [ --enable-mobile-optimize
6834 Enable mobile optimizations],
6835 MOZ_GFX_OPTIMIZE_MOBILE=1)
6837 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6839 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6840 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6843 dnl ========================================================
6844 dnl = Enable code optimization. ON by default.
6845 dnl ========================================================
6846 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6847 MOZ_OPTIMIZE_FLAGS="-O"
6850 MOZ_ARG_ENABLE_STRING(optimize,
6851 [ --disable-optimize Disable compiler optimization
6852 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6853 [ if test "$enableval" != "no"; then
6855 if test -n "$enableval" -a "$enableval" != "yes"; then
6856 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6861 fi ], MOZ_OPTIMIZE=1)
6863 MOZ_SET_FRAMEPTR_FLAGS
6865 if test "$COMPILE_ENVIRONMENT"; then
6866 if test -n "$MOZ_OPTIMIZE"; then
6867 AC_MSG_CHECKING([for valid optimization flags])
6868 _SAVE_CFLAGS=$CFLAGS
6869 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6870 AC_TRY_COMPILE([#include <stdio.h>],
6871 [printf("Hello World\n");],
6874 AC_MSG_RESULT([$_results])
6875 if test "$_results" = "no"; then
6876 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6878 CFLAGS=$_SAVE_CFLAGS
6880 fi # COMPILE_ENVIRONMENT
6882 AC_SUBST(MOZ_OPTIMIZE)
6883 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6884 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6885 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6886 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6887 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6888 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6890 dnl ========================================================
6891 dnl = Enable generation of debug symbols
6892 dnl ========================================================
6893 MOZ_ARG_ENABLE_STRING(debug-symbols,
6894 [ --enable-debug-symbols[=DBG]
6895 Enable debugging symbols (using compiler flags DBG)],
6896 [ if test "$enableval" != "no"; then
6898 if test -n "$enableval" -a "$enableval" != "yes"; then
6899 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6900 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6902 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6908 MOZ_DEBUG_SYMBOLS=1)
6910 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6911 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6912 export MOZ_DEBUG_SYMBOLS
6915 dnl ========================================================
6916 dnl = Enable any treating of compile warnings as errors
6917 dnl ========================================================
6918 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6919 [ --enable-warnings-as-errors
6920 Enable treating of warnings as errors],
6921 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6922 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6923 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6924 WARNINGS_AS_ERRORS=''
6927 dnl ========================================================
6928 dnl = Disable runtime logging checks
6929 dnl ========================================================
6930 MOZ_ARG_DISABLE_BOOL(logging,
6931 [ --disable-logging Disable logging facilities],
6932 NS_DISABLE_LOGGING=1,
6933 NS_DISABLE_LOGGING= )
6934 if test "$NS_DISABLE_LOGGING"; then
6935 AC_DEFINE(NS_DISABLE_LOGGING)
6937 AC_DEFINE(MOZ_LOGGING)
6940 dnl ========================================================
6941 dnl = This will enable logging of addref, release, ctor, dtor.
6942 dnl ========================================================
6943 _ENABLE_LOGREFCNT=42
6944 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6945 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6946 _ENABLE_LOGREFCNT=1,
6947 _ENABLE_LOGREFCNT= )
6948 if test "$_ENABLE_LOGREFCNT" = "1"; then
6949 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6950 elif test -z "$_ENABLE_LOGREFCNT"; then
6951 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6954 dnl ========================================================
6955 dnl moz_dump_painting
6956 dnl ========================================================
6957 MOZ_ARG_ENABLE_BOOL(dump-painting,
6958 [ --enable-dump-painting Enable paint debugging.],
6959 MOZ_DUMP_PAINTING=1,
6960 MOZ_DUMP_PAINTING= )
6961 if test -n "$MOZ_DUMP_PAINTING"; then
6962 AC_DEFINE(MOZ_DUMP_PAINTING)
6963 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6965 if test -n "$MOZ_DEBUG"; then
6966 AC_DEFINE(MOZ_DUMP_PAINTING)
6969 dnl ========================================================
6970 dnl = Enable trace malloc
6971 dnl ========================================================
6972 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6973 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6974 [ --enable-trace-malloc Enable malloc tracing; also disables jemalloc],
6977 if test "$NS_TRACE_MALLOC"; then
6978 # Please, Mr. Linker Man, don't take away our symbol names
6979 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6981 AC_DEFINE(NS_TRACE_MALLOC)
6983 AC_SUBST(NS_TRACE_MALLOC)
6985 dnl ========================================================
6986 dnl = Enable jemalloc
6987 dnl ========================================================
6988 MOZ_ARG_ENABLE_BOOL(jemalloc,
6989 [ --enable-jemalloc Replace memory allocator with jemalloc],
6993 if test "$NS_TRACE_MALLOC"; then
6996 if test "$MOZ_DMD"; then
7000 if test "${OS_TARGET}" = "Android"; then
7001 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
7003 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
7004 dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
7005 if test -z "$GNU_CC"; then
7006 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7008 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
7011 dnl On other Unix systems, we only want to link executables against mozglue
7012 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7013 dnl On other Unix systems, where mozglue is a static library, jemalloc is
7014 dnl separated for the SDK, so we need to add it here.
7015 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
7016 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
7018 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
7019 if test -n "$GNU_CC"; then
7020 dnl And we need mozglue symbols to be exported.
7021 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
7023 if test "$MOZ_LINKER" = 1; then
7024 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $ZLIB_LIBS"
7028 if test -z "$MOZ_MEMORY"; then
7031 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7032 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.])
7037 dnl Don't try to run compiler tests on Windows
7038 if test "$OS_ARCH" = "WINNT"; then
7039 if test -z "$HAVE_64BIT_OS"; then
7040 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7042 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7045 AC_CHECK_SIZEOF([int *], [4])
7046 case "${ac_cv_sizeof_int_p}" in
7048 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7051 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7054 AC_MSG_ERROR([Unexpected pointer size])
7059 AC_DEFINE(MOZ_MEMORY)
7060 if test -n "$MOZ_JEMALLOC"; then
7061 AC_DEFINE(MOZ_JEMALLOC)
7063 if test "x$MOZ_DEBUG" = "x1"; then
7064 AC_DEFINE(MOZ_MEMORY_DEBUG)
7066 dnl The generic feature tests that determine how to compute ncpus are long and
7067 dnl complicated. Therefore, simply define special cpp variables for the
7068 dnl platforms we have special knowledge of.
7071 AC_DEFINE(MOZ_MEMORY_DARWIN)
7074 AC_DEFINE(MOZ_MEMORY_BSD)
7076 *-android*|*-linuxandroid*)
7077 AC_DEFINE(MOZ_MEMORY_LINUX)
7078 AC_DEFINE(MOZ_MEMORY_ANDROID)
7079 if test -z "$gonkdir"; then
7082 AC_DEFINE(MOZ_MEMORY_GONK)
7087 AC_DEFINE(MOZ_MEMORY_LINUX)
7090 AC_DEFINE(MOZ_MEMORY_BSD)
7093 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7096 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7097 if test -z "$MOZ_DEBUG"; then
7098 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7100 WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7102 dnl Look for a broken crtdll.obj
7103 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7104 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7105 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7106 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7107 dnl Also pass this to NSPR/NSS
7108 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7110 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7117 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7121 AC_SUBST(MOZ_MEMORY)
7122 AC_SUBST(MOZ_JEMALLOC)
7123 AC_SUBST(MOZ_GLUE_LDFLAGS)
7124 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7125 AC_SUBST(WIN32_CRT_LIBS)
7126 dnl Need to set this for make because NSS doesn't have configure
7129 dnl We need to wrap dlopen and related functions on Android because we use
7131 if test "$OS_TARGET" = Android; then
7132 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7133 if test -n "$MOZ_OLD_LINKER"; then
7134 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
7136 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7137 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7140 dnl ========================================================
7141 dnl = Use malloc wrapper lib
7142 dnl ========================================================
7143 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7144 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7148 if test -n "$_WRAP_MALLOC"; then
7149 if test -n "$GNU_CC"; then
7150 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7151 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7152 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7153 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7154 dnl Wrap operator new and operator delete on Android.
7155 if test "$OS_TARGET" = "Android"; then
7156 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7159 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7163 dnl ========================================================
7164 dnl = Location of malloc wrapper lib
7165 dnl ========================================================
7166 MOZ_ARG_WITH_STRING(wrap-malloc,
7167 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7168 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7170 dnl ========================================================
7171 dnl = Use JS Call tracing
7172 dnl ========================================================
7173 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7174 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7175 MOZ_TRACE_JSCALLS=1,
7176 MOZ_TRACE_JSCALLS= )
7177 if test -n "$MOZ_TRACE_JSCALLS"; then
7178 AC_DEFINE(MOZ_TRACE_JSCALLS)
7181 dnl ========================================================
7182 dnl = Use incremental GC
7183 dnl ========================================================
7185 MOZ_ARG_DISABLE_BOOL(gcincremental,
7186 [ --disable-gcincremental Disable incremental GC],
7188 if test -n "$JSGC_INCREMENTAL"; then
7189 AC_DEFINE(JSGC_INCREMENTAL)
7192 dnl ========================================================
7193 dnl ETW - Event Tracing for Windows
7194 dnl ========================================================
7195 MOZ_ARG_ENABLE_BOOL(ETW,
7196 [ --enable-ETW Enable ETW (Event Tracing for Windows) event reporting],
7199 if test -n "$MOZ_ETW"; then
7203 if test -n "$MOZ_ETW"; then
7204 if test -z "$MOZ_WINSDK_TARGETVER"; then
7205 AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7209 dnl ========================================================
7210 dnl Zealous JavaScript GC
7211 dnl ========================================================
7212 MOZ_ARG_ENABLE_BOOL(gczeal,
7213 [ --enable-gczeal Enable zealous JavaScript GCing],
7216 if test -n "$JS_GC_ZEAL"; then
7217 AC_DEFINE(JS_GC_ZEAL)
7220 dnl ========================================================
7221 dnl JS opt-mode assertions and minidump instrumentation
7222 dnl ========================================================
7223 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7224 [ --enable-js-diagnostics
7225 Enable JS diagnostic assertions and breakpad data],
7226 JS_CRASH_DIAGNOSTICS=1,
7227 JS_CRASH_DIAGNOSTICS= )
7228 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7229 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7234 dnl ========================================================
7235 dnl = Enable static checking using gcc-dehydra
7236 dnl ========================================================
7238 MOZ_ARG_WITH_STRING(static-checking,
7239 [ --with-static-checking=path/to/gcc_dehydra.so
7240 Enable static checking of code using GCC-dehydra],
7241 DEHYDRA_PATH=$withval,
7244 if test -n "$DEHYDRA_PATH"; then
7245 if test ! -f "$DEHYDRA_PATH"; then
7246 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7248 AC_DEFINE(NS_STATIC_CHECKING)
7250 AC_SUBST(DEHYDRA_PATH)
7252 dnl ========================================================
7253 dnl = Enable stripping of libs & executables
7254 dnl ========================================================
7255 MOZ_ARG_ENABLE_BOOL(strip,
7256 [ --enable-strip Enable stripping of libs & executables ],
7260 dnl ========================================================
7261 dnl = Enable stripping of libs & executables when packaging
7262 dnl ========================================================
7263 MOZ_ARG_ENABLE_BOOL(install-strip,
7264 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7268 dnl ========================================================
7269 dnl = --enable-elf-dynstr-gc
7270 dnl ========================================================
7271 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7272 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7273 USE_ELF_DYNSTR_GC=1,
7274 USE_ELF_DYNSTR_GC= )
7276 dnl ========================================================
7277 dnl = --disable-elf-hack
7278 dnl ========================================================
7281 MOZ_ARG_DISABLE_BOOL(elf-hack,
7282 [ --disable-elf-hack Disable elf hacks],
7286 # Disable elf hack for profiling because the built in profiler
7287 # doesn't read the segments properly with elf hack. This is
7288 # temporary and should be fixed soon in the profiler.
7289 if test "$MOZ_PROFILING" = 1; then
7293 # Only enable elfhack where supported
7294 if test "$USE_ELF_HACK" = 1; then
7295 case "${HOST_OS_ARCH},${OS_ARCH}" in
7297 case "${CPU_ARCH}" in
7312 if test "$USE_ELF_HACK" = 1; then
7313 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7314 dnl memory addresses it maps to. The result is that by the time elfhack
7315 dnl kicks in, it is not possible to apply relocations because of that,
7316 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7317 dnl segment. It makes elfhack mostly useless, so considering the problems
7318 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7319 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7320 dnl the linker creates PT_GNU_RELRO segments.
7321 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7322 LINK_WITH_PT_GNU_RELRO,
7323 [echo "int main() {return 0;}" > conftest.${ac_ext}
7324 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7325 test -s conftest${ac_exeext}; then
7326 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7327 LINK_WITH_PT_GNU_RELRO=yes
7329 LINK_WITH_PT_GNU_RELRO=no
7332 dnl We really don't expect to get here, but just in case
7333 AC_ERROR([couldn't compile a simple C file])
7336 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7337 AC_MSG_WARN([Disabling elfhack])
7342 dnl ========================================================
7343 dnl = libstdc++ compatibility hacks
7344 dnl ========================================================
7347 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7348 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7351 AC_SUBST(STDCXX_COMPAT)
7353 if test -n "$STDCXX_COMPAT"; then
7354 eval $(CXX="$CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7355 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7356 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7359 dnl ========================================================
7361 dnl = Profiling and Instrumenting
7363 dnl ========================================================
7364 MOZ_ARG_HEADER(Profiling and Instrumenting)
7366 dnl ========================================================
7367 dnl = Enable runtime visual profiling logger
7368 dnl ========================================================
7369 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7370 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7371 MOZ_VISUAL_EVENT_TRACER=1,
7372 MOZ_VISUAL_EVENT_TRACER=)
7373 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7374 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7377 dnl ========================================================
7378 dnl Turn on reflow counting
7379 dnl ========================================================
7380 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7381 [ --enable-reflow-perf Enable reflow performance tracing],
7384 if test -n "$MOZ_REFLOW_PERF"; then
7385 AC_DEFINE(MOZ_REFLOW_PERF)
7388 dnl ========================================================
7389 dnl Enable code size metrics.
7390 dnl ========================================================
7391 MOZ_ARG_ENABLE_BOOL(codesighs,
7392 [ --enable-codesighs Enable code size analysis tools],
7393 _ENABLE_CODESIGHS=1,
7394 _ENABLE_CODESIGHS= )
7395 if test -n "$_ENABLE_CODESIGHS"; then
7396 if test -d $srcdir/tools/codesighs; then
7399 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7403 dnl ========================================================
7404 dnl = Enable Radio Interface for B2G (Gonk usually)
7405 dnl ========================================================
7406 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7407 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7410 if test -n "$MOZ_B2G_RIL"; then
7411 AC_DEFINE(MOZ_B2G_RIL)
7413 AC_SUBST(MOZ_B2G_RIL)
7415 dnl ========================================================
7416 dnl = Enable Radio FM for B2G (Gonk usually)
7417 dnl ========================================================
7418 if test -n "$MOZ_B2G_FM"; then
7419 AC_DEFINE(MOZ_B2G_FM)
7421 AC_SUBST(MOZ_B2G_FM)
7423 dnl ========================================================
7424 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7425 dnl ========================================================
7426 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7427 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7430 if test -n "$MOZ_B2G_BT"; then
7431 AC_DEFINE(MOZ_B2G_BT)
7433 AC_SUBST(MOZ_B2G_BT)
7435 dnl ========================================================
7436 dnl = Enable Support for System Messages API
7437 dnl ========================================================
7438 if test -n "$MOZ_SYS_MSG"; then
7439 AC_DEFINE(MOZ_SYS_MSG)
7441 AC_SUBST(MOZ_SYS_MSG)
7443 dnl ========================================================
7444 dnl = Enable Camera Interface for B2G (Gonk usually)
7445 dnl ========================================================
7446 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7447 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7450 if test -n "$MOZ_B2G_CAMERA"; then
7451 AC_DEFINE(MOZ_B2G_CAMERA)
7453 AC_SUBST(MOZ_B2G_CAMERA)
7455 dnl ========================================================
7456 dnl = Enable Support for Payment API
7457 dnl ========================================================
7458 if test -n "$MOZ_PAY"; then
7463 dnl ========================================================
7464 dnl = Support for demangling undefined symbols
7465 dnl ========================================================
7466 if test -z "$SKIP_LIBRARY_CHECKS"; then
7469 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7473 # Demangle only for debug or trace-malloc builds
7474 MOZ_DEMANGLE_SYMBOLS=
7475 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7476 MOZ_DEMANGLE_SYMBOLS=1
7477 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7479 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7481 dnl ========================================================
7482 dnl = Support for gcc stack unwinding (from gcc 3.3)
7483 dnl ========================================================
7484 if test -z "$SKIP_LIBRARY_CHECKS"; then
7485 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7488 dnl ========================================================
7490 dnl ========================================================
7492 MOZ_ARG_WITH_STRING(jitreport-granularity,
7493 [ --jitreport-granularity=N
7494 Default granularity at which to report JIT code
7497 1 - code ranges for whole functions only
7498 2 - per-line information
7499 3 - per-op information],
7500 JITREPORT_GRANULARITY=$withval,
7501 JITREPORT_GRANULARITY=3)
7503 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7505 dnl ========================================================
7509 dnl ========================================================
7510 MOZ_ARG_HEADER(Misc. Options)
7512 dnl ========================================================
7513 dnl update xterm title
7514 dnl ========================================================
7515 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7516 [ --enable-xterm-updates Update XTERM titles with current command.],
7520 dnl =========================================================
7522 dnl =========================================================
7523 MOZ_ARG_ENABLE_STRING([chrome-format],
7524 [ --enable-chrome-format=jar|flat|both|symlink|omni
7525 Select FORMAT of chrome files (default=jar)],
7526 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7528 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7529 MOZ_CHROME_FILE_FORMAT=jar
7532 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7533 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7534 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7535 test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7536 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7537 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7540 dnl =========================================================
7541 dnl Omnijar packaging (bug 552121)
7542 dnl =========================================================
7543 dnl Omnijar packaging is compatible with flat packaging.
7544 dnl In unpackaged builds, omnijar looks for files as if
7545 dnl things were flat packaged. After packaging, all files
7546 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7547 dnl is set to flat since putting files into jars is only
7548 dnl done during packaging with omnijar.
7549 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7551 AC_DEFINE(MOZ_OMNIJAR)
7552 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$OS_TARGET" = "Android"; then
7553 MOZ_CHROME_FILE_FORMAT=flat
7555 MOZ_CHROME_FILE_FORMAT=symlink
7557 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7558 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7561 OMNIJAR_NAME=omni.ja
7562 AC_SUBST(OMNIJAR_NAME)
7563 AC_SUBST(MOZ_OMNIJAR)
7565 dnl ========================================================
7566 dnl = Define default location for MOZILLA_FIVE_HOME
7567 dnl ========================================================
7568 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7569 [ --with-default-mozilla-five-home
7570 Set the default value for MOZILLA_FIVE_HOME],
7571 [ val=`echo $withval`
7572 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7574 dnl ========================================================
7575 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7576 dnl ========================================================
7577 MOZ_ARG_WITH_STRING(user-appdir,
7578 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7579 [ val=`echo $withval`
7580 if echo "$val" | grep "\/" >/dev/null; then
7581 AC_MSG_ERROR("Homedir must be single relative path.")
7586 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7588 dnl ========================================================
7589 dnl = Doxygen configuration
7590 dnl ========================================================
7591 dnl Use commas to specify multiple dirs to this arg
7592 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7593 MOZ_ARG_WITH_STRING(doc-input-dirs,
7594 [ --with-doc-input-dirs=DIRS
7595 Header/idl dirs to create docs from],
7596 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7597 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7599 dnl Use commas to specify multiple dirs to this arg
7600 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7601 MOZ_ARG_WITH_STRING(doc-include-dirs,
7602 [ --with-doc-include-dirs=DIRS
7603 Include dirs to preprocess doc headers],
7604 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7605 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7607 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7608 MOZ_ARG_WITH_STRING(doc-output-dir,
7609 [ --with-doc-output-dir=DIR
7610 Dir to generate docs into],
7611 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7612 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7614 if test -z "$SKIP_COMPILER_CHECKS"; then
7615 dnl ========================================================
7617 dnl = Compiler Options
7619 dnl ========================================================
7620 MOZ_ARG_HEADER(Compiler Options)
7622 dnl ========================================================
7623 dnl Check for gcc -pipe support
7624 dnl ========================================================
7625 AC_MSG_CHECKING([for -pipe support])
7626 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7627 dnl Any gcc that supports firefox supports -pipe.
7628 CFLAGS="$CFLAGS -pipe"
7629 CXXFLAGS="$CXXFLAGS -pipe"
7630 AC_MSG_RESULT([yes])
7635 dnl ========================================================
7636 dnl Profile guided optimization (gcc checks)
7637 dnl ========================================================
7638 dnl Test for profiling options
7639 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7641 _SAVE_CFLAGS="$CFLAGS"
7642 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7644 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7645 AC_TRY_COMPILE([], [return 0;],
7646 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7647 result="yes" ], result="no")
7648 AC_MSG_RESULT([$result])
7650 if test $result = "yes"; then
7651 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7652 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7653 PROFILE_USE_LDFLAGS="-fprofile-use"
7656 CFLAGS="$_SAVE_CFLAGS"
7658 if test -n "$INTEL_CC"; then
7659 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7660 PROFILE_GEN_LDFLAGS=
7661 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7662 PROFILE_USE_LDFLAGS=
7665 dnl Sun Studio on Solaris
7666 if test "$SOLARIS_SUNPRO_CC"; then
7667 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7668 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7669 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7670 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7673 AC_SUBST(PROFILE_GEN_CFLAGS)
7674 AC_SUBST(PROFILE_GEN_LDFLAGS)
7675 AC_SUBST(PROFILE_USE_CFLAGS)
7676 AC_SUBST(PROFILE_USE_LDFLAGS)
7680 dnl ========================================================
7681 dnl Test for -pedantic bustage
7682 dnl ========================================================
7683 MOZ_ARG_DISABLE_BOOL(pedantic,
7684 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
7686 if test "$_PEDANTIC"; then
7687 _SAVE_CXXFLAGS=$CXXFLAGS
7688 CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7689 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7690 AC_TRY_COMPILE([$configure_static_assert_macros],
7691 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7692 result="no", result="yes" )
7693 AC_MSG_RESULT([$result])
7694 CXXFLAGS="$_SAVE_CXXFLAGS"
7698 _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
7699 _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7702 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
7707 dnl ========================================================
7708 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7709 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7710 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7711 dnl ========================================================
7712 _SAVE_CXXFLAGS=$CXXFLAGS
7713 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7714 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7715 ac_nscap_nonconst_opeq_bug,
7724 template <class T, class U>
7725 int operator==(const Pointer<T>& rhs, U* lhs)
7727 return rhs.myPtr == lhs;
7730 template <class T, class U>
7731 int operator==(const Pointer<T>& rhs, const U* lhs)
7733 return rhs.myPtr == lhs;
7741 ac_nscap_nonconst_opeq_bug="no",
7742 ac_nscap_nonconst_opeq_bug="yes")])
7743 CXXFLAGS="$_SAVE_CXXFLAGS"
7745 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7746 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7748 fi # ! SKIP_COMPILER_CHECKS
7750 AC_DEFINE(CPP_THROW_NEW, [throw()])
7753 if test "$COMPILE_ENVIRONMENT"; then
7755 fi # COMPILE_ENVIRONMENT
7757 dnl ========================================================
7759 dnl = Build depencency options
7761 dnl ========================================================
7762 MOZ_ARG_HEADER(Build dependencies)
7764 if test "$GNU_CC" -a "$GNU_CXX"; then
7765 _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
7766 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7767 elif test "$SOLARIS_SUNPRO_CC"; then
7770 dnl Don't override this for MSVC
7771 if test -z "$_WIN32_MSVC"; then
7772 _USE_CPP_INCLUDE_FLAG=
7773 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7774 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7776 echo '#include <stdio.h>' > dummy-hello.c
7778 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7780 if test -z "$CL_INCLUDES_PREFIX"; then
7781 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7783 AC_SUBST(CL_INCLUDES_PREFIX)
7788 dnl ========================================================
7790 dnl = Static Build Options
7792 dnl ========================================================
7793 MOZ_ARG_HEADER(Static build options)
7795 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7796 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
7800 MOZ_ARG_ENABLE_BOOL(shared-js,
7801 [ --enable-shared-js
7802 Create a shared JavaScript library.],
7806 if test -n "$ENABLE_SHARED_JS"; then
7808 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7810 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7811 AC_DEFINE(MOZ_STATIC_JS)
7813 AC_SUBST(JS_SHARED_LIBRARY)
7815 AC_SUBST(LIBXUL_LIBS)
7816 XPCOM_LIBS="$LIBXUL_LIBS"
7818 dnl ========================================================
7820 dnl = Standalone module options
7822 dnl ========================================================
7823 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7826 dnl ========================================================
7828 if test -z "$SKIP_PATH_CHECKS"; then
7829 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7830 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7831 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7836 if test -z "${GLIB_GMODULE_LIBS}" \
7837 -a -n "${GLIB_CONFIG}"\
7838 -a "${GLIB_CONFIG}" != no\
7840 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7843 AC_SUBST(GLIB_CFLAGS)
7845 AC_SUBST(GLIB_GMODULE_LIBS)
7847 dnl ========================================================
7848 dnl Graphics checks.
7849 dnl ========================================================
7851 if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
7857 MOZ_ARG_ENABLE_BOOL(skia,
7858 [ --enable-skia Enable use of Skia],
7862 if test "$USE_FC_FREETYPE"; then
7863 if test "$COMPILE_ENVIRONMENT"; then
7864 dnl ========================================================
7865 dnl = Check for freetype2 and its functionality
7866 dnl ========================================================
7867 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7869 if test "$_HAVE_FREETYPE2"; then
7871 _SAVE_CFLAGS="$CFLAGS"
7872 LIBS="$LIBS $FT2_LIBS"
7873 CFLAGS="$CFLAGS $FT2_CFLAGS"
7875 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7876 ac_cv_member_FT_Bitmap_Size_y_ppem,
7877 [AC_TRY_COMPILE([#include <ft2build.h>
7878 #include FT_FREETYPE_H],
7880 if (sizeof s.y_ppem) return 0;
7882 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7883 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7884 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7885 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7887 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7889 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7890 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7891 [FT_Bitmap_Size structure includes y_ppem field])
7893 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
7896 CFLAGS="$_SAVE_CFLAGS"
7899 _SAVE_CPPFLAGS="$CPPFLAGS"
7900 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7901 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7902 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7903 CPPFLAGS="$_SAVE_CPPFLAGS"
7905 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7908 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
7910 if test "$MOZ_PANGO"; then
7911 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
7912 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
7914 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
7915 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
7920 dnl ========================================================
7921 dnl Check for pixman and cairo
7922 dnl ========================================================
7925 MOZ_ARG_ENABLE_BOOL(system-cairo,
7926 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7931 MOZ_ARG_ENABLE_BOOL(system-pixman,
7932 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7934 MOZ_TREE_PIXMAN=force,
7937 # System cairo depends on system pixman
7938 if test "$MOZ_TREE_PIXMAN" = "force"; then
7939 if test -z "$MOZ_TREE_CAIRO"; then
7940 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7944 elif test -z "$MOZ_TREE_CAIRO"; then
7948 if test "$MOZ_TREE_PIXMAN"; then
7949 AC_DEFINE(MOZ_TREE_PIXMAN)
7950 MOZ_PIXMAN_CFLAGS=""
7951 MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
7953 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
7954 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
7955 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
7957 AC_SUBST(MOZ_PIXMAN_CFLAGS)
7958 AC_SUBST(MOZ_PIXMAN_LIBS)
7960 # Check for headers defining standard int types.
7961 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7963 if test "$MOZ_TREE_CAIRO"; then
7964 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7965 AC_DEFINE(MOZ_TREE_CAIRO)
7967 # For now we assume that we will have a uint64_t available through
7968 # one of the above headers or mozstdint.h.
7969 AC_DEFINE(HAVE_UINT64_T)
7971 # Define macros for cairo-features.h
7972 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
7973 if test "$MOZ_X11"; then
7974 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7975 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7976 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7977 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7978 MOZ_ENABLE_CAIRO_FT=1
7979 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7981 case "$MOZ_WIDGET_TOOLKIT" in
7983 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7986 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7987 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7988 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7991 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7992 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7993 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7994 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7995 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7996 MOZ_ENABLE_D2D_SURFACE=1
7997 MOZ_ENABLE_DWRITE_FONT=1
7999 WIN32_DWRITE_FONT_FEATURE=
8000 WIN32_D2D_SURFACE_FEATURE=
8003 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8005 dnl D3D10 Layers depend on D2D Surfaces.
8006 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8007 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8011 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8012 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8013 MOZ_ENABLE_CAIRO_FT=1
8014 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8015 CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8019 if test "$USE_FC_FREETYPE"; then
8020 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8022 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8023 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8024 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8025 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8026 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8027 AC_SUBST(CAIRO_FT_CFLAGS)
8029 AC_SUBST(PS_SURFACE_FEATURE)
8030 AC_SUBST(PDF_SURFACE_FEATURE)
8031 AC_SUBST(SVG_SURFACE_FEATURE)
8032 AC_SUBST(XLIB_SURFACE_FEATURE)
8033 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8034 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8035 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8036 AC_SUBST(WIN32_SURFACE_FEATURE)
8037 AC_SUBST(OS2_SURFACE_FEATURE)
8038 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8039 AC_SUBST(FT_FONT_FEATURE)
8040 AC_SUBST(FC_FONT_FEATURE)
8041 AC_SUBST(WIN32_FONT_FEATURE)
8042 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8043 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8044 AC_SUBST(QUARTZ_FONT_FEATURE)
8045 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8046 AC_SUBST(QT_SURFACE_FEATURE)
8047 AC_SUBST(TEE_SURFACE_FEATURE)
8049 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8050 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8052 if test "$MOZ_X11"; then
8053 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8056 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8058 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8059 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8060 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8061 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8062 if test "$MOZ_X11"; then
8063 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8064 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8065 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8066 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8070 AC_SUBST(MOZ_TREE_CAIRO)
8071 AC_SUBST(MOZ_CAIRO_CFLAGS)
8072 AC_SUBST(MOZ_CAIRO_LIBS)
8073 AC_SUBST(MOZ_CAIRO_OSLIBS)
8074 AC_SUBST(MOZ_TREE_PIXMAN)
8076 dnl ========================================================
8078 dnl ========================================================
8080 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8083 dnl ========================================================
8085 dnl ========================================================
8086 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8087 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8089 dnl ========================================================
8091 dnl ========================================================
8092 if test "$MOZ_GRAPHITE"; then
8093 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8094 AC_DEFINE(MOZ_GRAPHITE)
8098 AC_SUBST(MOZ_GRAPHITE)
8099 AC_SUBST(MOZ_GRAPHITE_LIBS)
8101 dnl ========================================================
8103 dnl ========================================================
8104 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8105 AC_SUBST(MOZ_OTS_LIBS)
8107 dnl ========================================================
8109 dnl ========================================================
8110 if test "$MOZ_ENABLE_SKIA"; then
8111 MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8112 AC_DEFINE(MOZ_ENABLE_SKIA)
8116 AC_SUBST(MOZ_ENABLE_SKIA)
8117 AC_SUBST(MOZ_SKIA_LIBS)
8119 dnl ========================================================
8121 dnl ========================================================
8122 MOZ_ARG_DISABLE_BOOL(xul,
8123 [ --disable-xul Disable XUL],
8125 if test "$MOZ_XUL"; then
8128 dnl remove extensions that require XUL
8129 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8134 dnl ========================================================
8135 dnl disable profile locking
8136 dnl do no use this in applications that can have more than
8137 dnl one process accessing the profile directory.
8138 dnl ========================================================
8139 MOZ_ARG_DISABLE_BOOL(profilelocking,
8140 [ --disable-profilelocking
8141 Disable profile locking],
8142 MOZ_PROFILELOCKING=,
8143 MOZ_PROFILELOCKING=1 )
8144 if test "$MOZ_PROFILELOCKING"; then
8145 AC_DEFINE(MOZ_PROFILELOCKING)
8148 dnl ========================================================
8149 dnl necko configuration options
8150 dnl ========================================================
8153 dnl option to disable various necko protocols
8155 MOZ_ARG_ENABLE_STRING(necko-protocols,
8156 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8157 Enable/disable specific protocol handlers],
8158 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8159 if test "$option" = "yes" -o "$option" = "all"; then
8160 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8161 elif test "$option" = "no" -o "$option" = "none"; then
8163 elif test "$option" = "default"; then
8164 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8165 elif test `echo "$option" | grep -c \^-` != 0; then
8166 option=`echo $option | sed 's/^-//'`
8167 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8169 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8172 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8174 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8175 AC_SUBST(NECKO_PROTOCOLS)
8176 for p in $NECKO_PROTOCOLS; do
8177 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8178 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8182 dnl option to disable necko's wifi scanner
8184 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8185 [ --disable-necko-wifi Disable necko wifi scanner],
8189 if test "$OS_ARCH" = "OS2"; then
8190 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8193 if test "$NECKO_WIFI" -a \
8194 "$OS_ARCH" != "Linux" -a \
8195 "$OS_ARCH" != "Darwin" -a \
8196 "$OS_ARCH" != "SunOS" -a \
8197 "$OS_ARCH" != "WINNT"; then
8198 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8201 if test "$NECKO_WIFI"; then
8202 AC_DEFINE(NECKO_WIFI)
8203 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8205 AC_SUBST(NECKO_WIFI)
8208 dnl option to disable cookies
8210 MOZ_ARG_DISABLE_BOOL(cookies,
8211 [ --disable-cookies Disable cookie support],
8214 AC_SUBST(NECKO_COOKIES)
8215 if test "$NECKO_COOKIES"; then
8216 AC_DEFINE(NECKO_COOKIES)
8217 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8221 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8223 MOZ_ARG_DISABLE_BOOL(ctypes,
8224 [ --disable-ctypes Disable js-ctypes],
8227 AC_SUBST(BUILD_CTYPES)
8228 if test "$BUILD_CTYPES"; then
8229 AC_DEFINE(BUILD_CTYPES)
8232 dnl Build Places if required
8233 if test "$MOZ_PLACES"; then
8234 AC_DEFINE(MOZ_PLACES)
8237 dnl Build Apps in the Cloud (AITC) if required
8238 AC_SUBST(MOZ_SERVICES_AITC)
8239 if test -n "$MOZ_SERVICES_AITC"; then
8240 AC_DEFINE(MOZ_SERVICES_AITC)
8243 dnl Build Notifications if required
8244 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8245 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8246 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8249 dnl Build Sync Services if required
8250 AC_SUBST(MOZ_SERVICES_SYNC)
8251 if test -n "$MOZ_SERVICES_SYNC"; then
8252 AC_DEFINE(MOZ_SERVICES_SYNC)
8255 dnl ========================================================
8256 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8257 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8260 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8261 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8264 if test "$MOZ_APP_COMPONENT_MODULES"; then
8265 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8268 dnl ========================================================
8270 dnl = Maintainer debug option (no --enable equivalent)
8272 dnl ========================================================
8277 AC_SUBST(AR_EXTRACT)
8281 AC_SUBST(AS_DASH_C_FLAG)
8290 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8291 AC_SUBST(MOZ_UPDATE_XTERM)
8292 AC_SUBST(MOZ_PLATFORM_MAEMO)
8293 AC_SUBST(MOZ_AUTH_EXTENSION)
8294 AC_SUBST(MOZ_PERMISSIONS)
8296 AC_SUBST(MOZ_PREF_EXTENSIONS)
8297 AC_SUBST(MOZ_JS_LIBS)
8300 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8301 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8302 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8303 AC_SUBST(MOZ_DEBUG_FLAGS)
8304 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8305 AC_SUBST(WARNINGS_AS_ERRORS)
8306 AC_SUBST(MOZ_EXTENSIONS)
8307 AC_SUBST(MOZ_JSDEBUGGER)
8308 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8311 AC_SUBST(MOZ_CALLGRIND)
8314 AC_SUBST(MOZ_PROFILING)
8316 AC_SUBST(MOZ_PLACES)
8317 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8319 AC_SUBST(NS_PRINTING)
8321 AC_SUBST(MOZ_HELP_VIEWER)
8322 AC_SUBST(TOOLCHAIN_PREFIX)
8328 AC_SUBST(MOZ_PROFILELOCKING)
8330 AC_SUBST(ENABLE_TESTS)
8331 AC_SUBST(ENABLE_MARIONETTE)
8333 AC_SUBST(MOZ_UNIVERSALCHARDET)
8334 AC_SUBST(ACCESSIBILITY)
8335 AC_SUBST(MOZ_SPELLCHECK)
8336 AC_SUBST(MOZ_ANDROID_OMTC)
8337 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8338 AC_SUBST(MOZ_CRASHREPORTER)
8339 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8340 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8341 AC_SUBST(MOZ_STUB_INSTALLER)
8342 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8343 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8344 AC_SUBST(MOZ_UPDATER)
8345 AC_SUBST(MOZ_ANGLE_RENDERER)
8346 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8347 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8348 AC_SUBST(MOZ_D3DX9_VERSION)
8349 AC_SUBST(MOZ_D3DX9_CAB)
8350 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8351 AC_SUBST(MOZ_D3DX9_DLL)
8352 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8355 AC_SUBST(MOZ_ANDROID_HISTORY)
8356 AC_SUBST(MOZ_WEBSMS_BACKEND)
8357 AC_SUBST(ENABLE_STRIP)
8358 AC_SUBST(PKG_SKIP_STRIP)
8359 AC_SUBST(STRIP_FLAGS)
8360 AC_SUBST(USE_ELF_DYNSTR_GC)
8361 AC_SUBST(USE_ELF_HACK)
8362 AC_SUBST(INCREMENTAL_LINKER)
8363 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8364 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8366 AC_SUBST(MOZ_FIX_LINK_PATHS)
8367 AC_SUBST(XPCOM_LIBS)
8368 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8369 AC_SUBST(XPCOM_GLUE_LDOPTS)
8370 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8371 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8372 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8374 AC_SUBST(USE_DEPENDENT_LIBS)
8376 AC_SUBST(MOZ_BUILD_ROOT)
8377 AC_SUBST(MOZ_OS2_TOOLS)
8379 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8380 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8381 AC_SUBST(MOZ_LINKER_EXTRACT)
8382 AC_SUBST(MOZ_PER_WINDOW_PRIVATE_BROWSING)
8384 if test -n "$MOZ_PER_WINDOW_PRIVATE_BROWSING" ; then
8385 AC_DEFINE(MOZ_PER_WINDOW_PRIVATE_BROWSING)
8388 dnl ========================================================
8389 dnl = Mac bundle name prefix
8390 dnl ========================================================
8391 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8392 [ --with-macbundlename-prefix=prefix
8393 Prefix for MOZ_MACBUNDLE_NAME],
8394 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8396 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8397 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8398 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8401 if test "$MOZ_DEBUG"; then
8402 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8404 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8406 AC_SUBST(MOZ_MACBUNDLE_NAME)
8408 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8409 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8410 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8411 if test "$MOZ_DEBUG"; then
8412 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8415 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8416 AC_SUBST(MOZ_MACBUNDLE_ID)
8418 # The following variables are available to branding and application
8419 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8420 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8421 # impacts profile location and user-visible fields.
8422 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8423 # versions of a given application (e.g. Aurora and Firefox both use
8424 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8425 # for application.ini's "Name" field, which controls profile location in
8426 # the absence of a "Profile" field (see below), and various system
8427 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8428 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8429 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8430 # builds (e.g. Aurora for Firefox).
8431 # - MOZ_APP_VERSION: Defines the application version number.
8432 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8433 # defaults to a lowercase form of MOZ_APP_BASENAME.
8434 # - MOZ_APP_PROFILE: When set, used for application.ini's
8435 # "Profile" field, which controls profile location.
8436 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8437 # crash reporter server url.
8438 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8439 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8441 if test -z "$MOZ_APP_NAME"; then
8442 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8445 # For extensions and langpacks, we require a max version that is compatible
8446 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8447 # 10.0a1 and 10.0a2 aren't affected
8448 # 10.0 becomes 10.0.*
8449 # 10.0.1 becomes 10.0.*
8450 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8451 if test -z "$IS_ALPHA"; then
8453 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8456 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8459 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8460 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8462 AC_SUBST(MOZ_APP_NAME)
8463 AC_SUBST(MOZ_APP_DISPLAYNAME)
8464 AC_SUBST(MOZ_APP_BASENAME)
8465 AC_SUBST(MOZ_APP_VENDOR)
8466 AC_SUBST(MOZ_APP_PROFILE)
8467 AC_SUBST(MOZ_APP_ID)
8468 AC_SUBST(MAR_CHANNEL_ID)
8469 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8470 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8471 AC_SUBST(MOZ_EXTENSION_MANAGER)
8472 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8473 AC_SUBST(MOZ_APP_UA_NAME)
8474 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8475 AC_SUBST(MOZ_APP_VERSION)
8476 AC_SUBST(MOZ_APP_MAXVERSION)
8477 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8478 AC_SUBST(FIREFOX_VERSION)
8479 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8480 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8481 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8484 # We can't use the static application.ini data when building against
8486 if test -n "$LIBXUL_SDK"; then
8489 AC_SUBST(MOZ_APP_STATIC_INI)
8491 AC_SUBST(MOZ_PKG_SPECIAL)
8493 AC_SUBST(MOZILLA_OFFICIAL)
8495 if test "$MOZ_TELEMETRY_REPORTING"; then
8496 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8500 AC_SUBST(MOZ_MAPINFO)
8501 AC_SUBST(MOZ_BROWSE_INFO)
8502 AC_SUBST(MOZ_TOOLS_DIR)
8503 AC_SUBST(WIN32_REDIST_DIR)
8506 dnl Echo the CFLAGS to remove extra whitespace.
8512 $_WARNINGS_CXXFLAGS \
8515 COMPILE_CFLAGS=`echo \
8520 COMPILE_CXXFLAGS=`echo \
8521 $_DEFINES_CXXFLAGS \
8525 AC_SUBST(SYSTEM_LIBXUL)
8526 AC_SUBST(MOZ_NATIVE_JPEG)
8527 AC_SUBST(MOZ_NATIVE_PNG)
8528 AC_SUBST(MOZ_NATIVE_BZ2)
8530 AC_SUBST(MOZ_FLEXBOX)
8531 AC_SUBST(MOZ_JPEG_CFLAGS)
8532 AC_SUBST(MOZ_JPEG_LIBS)
8533 AC_SUBST(MOZ_BZ2_CFLAGS)
8534 AC_SUBST(MOZ_BZ2_LIBS)
8535 AC_SUBST(MOZ_PNG_CFLAGS)
8536 AC_SUBST(MOZ_PNG_LIBS)
8538 AC_SUBST(NSPR_CFLAGS)
8540 AC_SUBST(MOZ_NATIVE_NSPR)
8542 AC_SUBST(NSS_CFLAGS)
8544 AC_SUBST(NSS_DEP_LIBS)
8545 AC_SUBST(MOZ_NATIVE_NSS)
8546 AC_SUBST(NSS_DISABLE_DBM)
8549 OS_CXXFLAGS="$CXXFLAGS"
8550 OS_CPPFLAGS="$CPPFLAGS"
8551 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8552 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8553 OS_LDFLAGS="$LDFLAGS"
8556 AC_SUBST(OS_CXXFLAGS)
8557 AC_SUBST(OS_CPPFLAGS)
8558 AC_SUBST(OS_COMPILE_CFLAGS)
8559 AC_SUBST(OS_COMPILE_CXXFLAGS)
8560 AC_SUBST(OS_LDFLAGS)
8562 AC_SUBST(CROSS_COMPILE)
8563 AC_SUBST(WCHAR_CFLAGS)
8567 AC_SUBST(HOST_CFLAGS)
8568 AC_SUBST(HOST_CXXFLAGS)
8569 AC_SUBST(HOST_LDFLAGS)
8570 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8572 AC_SUBST(HOST_AR_FLAGS)
8574 AC_SUBST(HOST_RANLIB)
8575 AC_SUBST(HOST_NSPR_MDCPUCFG)
8576 AC_SUBST(HOST_BIN_SUFFIX)
8577 AC_SUBST(HOST_OS_ARCH)
8579 AC_SUBST(TARGET_CPU)
8580 AC_SUBST(TARGET_VENDOR)
8582 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8583 AC_SUBST(TARGET_MD_ARCH)
8584 AC_SUBST(TARGET_XPCOM_ABI)
8587 AC_SUBST(OS_RELEASE)
8590 AC_SUBST(INTEL_ARCHITECTURE)
8592 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8594 AC_SUBST(WRAP_LDFLAGS)
8597 AC_SUBST(MKSHLIB_FORCE_ALL)
8598 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8599 AC_SUBST(DSO_CFLAGS)
8600 AC_SUBST(DSO_PIC_CFLAGS)
8601 AC_SUBST(DSO_LDOPTS)
8602 AC_SUBST(LIB_PREFIX)
8603 AC_SUBST(DLL_PREFIX)
8604 AC_SUBST(DLL_SUFFIX)
8605 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8606 AC_SUBST(LIB_SUFFIX)
8607 AC_SUBST(OBJ_SUFFIX)
8608 AC_SUBST(BIN_SUFFIX)
8609 AC_SUBST(ASM_SUFFIX)
8610 AC_SUBST(IMPORT_LIB_SUFFIX)
8612 AC_SUBST(CC_VERSION)
8613 AC_SUBST(CXX_VERSION)
8614 AC_SUBST(MSMANIFEST_TOOL)
8615 AC_SUBST(NS_ENABLE_TSF)
8616 AC_SUBST(MOZ_NSS_PATCH)
8617 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8618 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8621 AC_SUBST(MOZ_SYDNEYAUDIO)
8622 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8625 AC_SUBST(MOZ_VORBIS)
8626 AC_SUBST(MOZ_TREMOR)
8630 AC_SUBST(MOZ_MEDIA_PLUGINS)
8631 AC_SUBST(MOZ_OMX_PLUGIN)
8632 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8633 AC_SUBST(MOZ_VP8_ENCODER)
8636 AC_SUBST(MOZ_ALSA_LIBS)
8637 AC_SUBST(MOZ_ALSA_CFLAGS)
8639 AC_SUBST(VPX_ASFLAGS)
8640 AC_SUBST(VPX_DASH_C_FLAG)
8641 AC_SUBST(VPX_AS_CONVERSION)
8642 AC_SUBST(VPX_ASM_SUFFIX)
8643 AC_SUBST(VPX_X86_ASM)
8644 AC_SUBST(VPX_ARM_ASM)
8645 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8646 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8647 AC_SUBST(LIBJPEG_TURBO_AS)
8648 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8649 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8650 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8651 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8653 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8655 AC_MSG_CHECKING([for posix_fallocate])
8656 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8657 #include <fcntl.h>],
8658 [posix_fallocate(0, 0, 0);],
8659 [ac_cv___posix_fallocate=true],
8660 [ac_cv___posix_fallocate=false])
8662 if test "$ac_cv___posix_fallocate" = true ; then
8663 AC_DEFINE(HAVE_POSIX_FALLOCATE)
8669 dnl Check for missing components
8670 if test "$COMPILE_ENVIRONMENT"; then
8671 if test "$MOZ_X11"; then
8672 if test "$WITHOUT_X11"; then
8673 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8675 dnl ====================================================
8676 dnl = Check if X headers exist
8677 dnl ====================================================
8678 _SAVE_CFLAGS=$CFLAGS
8679 CFLAGS="$CFLAGS $XCFLAGS"
8683 #include <X11/Xlib.h>
8684 #include <X11/Intrinsic.h>
8685 #include <X11/extensions/XShm.h>
8689 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8690 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8694 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8695 CFLAGS="$_SAVE_CFLAGS"
8697 if test -n "$MISSING_X"; then
8698 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8703 dnl Check for headers, etc. needed by WebGL.
8704 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8705 MOZ_CHECK_HEADER(GL/glx.h)
8706 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8707 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))])
8709 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8710 fi # COMPILE_ENVIRONMENT
8712 dnl Set various defines and substitutions
8713 dnl ========================================================
8715 if test "$OS_ARCH" = "Darwin"; then
8717 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8721 if test "$MOZ_DEBUG"; then
8722 AC_DEFINE(MOZ_REFLOW_PERF)
8723 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8726 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8727 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8728 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8729 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8730 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8731 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8732 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8733 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8734 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8737 AC_SUBST(MOZILLA_VERSION)
8739 AC_SUBST(ac_configure_args)
8741 dnl Spit out some output
8742 dnl ========================================================
8744 dnl The following defines are used by xpcom
8745 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8747 HAVE_CPP_2BYTE_WCHAR_T
8748 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8750 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8751 HAVE_CPP_PARTIAL_SPECIALIZATION
8752 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8753 NEED_CPP_UNUSED_IMPLEMENTATIONS
8757 HAVE_ICONV_WITH_CONST_INPUT
8771 netwerk/necko-config.h
8772 xpcom/xpcom-config.h
8773 xpcom/xpcom-private.h
8776 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8777 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8778 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8779 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8780 # (apparently) only need this hack when egrep's "pattern" is particularly long
8781 # (as in the following code) and the first egrep on our $PATH is Apple's. See
8785 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8792 dnl Create a virtualenv where we can install local Python packages
8793 AC_MSG_RESULT([Creating Python virtualenv])
8795 mkdir -p _virtualenv
8796 MACOSX_DEPLOYMENT_TARGET= PYTHONDONTWRITEBYTECODE= $PYTHON $_topsrcdir/python/virtualenv/virtualenv.py --system-site-packages ./_virtualenv
8799 PYTHON=$MOZ_BUILD_ROOT/_virtualenv/Scripts/python.exe
8802 PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python
8808 dnl Populate the virtualenv
8810 dnl We always use the version Python was compiled with to ensure that compiled
8811 dnl extensions work properly. This works around a bug in Python. See also
8812 dnl http://bugs.python.org/issue9516 and bug 659881.
8814 dnl Please note that this assumes nothing built during virtualenv population is
8815 dnl shipped as part of a release package. If it does ship, binaries built here
8816 dnl may not be compatible with the minimum supported OS X version.
8817 osx_deployment_target_system=
8819 if test $python_version_major -ne 2; then
8820 AC_MSG_ERROR([Assertion failed: building with Python 2.])
8823 dnl sysconfig is only present on Python 2.7 and above.
8824 if test $python_version_minor -ge 7; then
8825 osx_deployment_target_system=`$PYTHON -c 'import sysconfig; print sysconfig.get_config_var("MACOSX_DEPLOYMENT_TARGET")'`
8828 AC_MSG_RESULT([Populating Python virtualenv])
8829 MACOSX_DEPLOYMENT_TARGET=$osx_deployment_target_system \
8830 LDFLAGS="${HOST_LDFLAGS}" \
8831 CC="${HOST_CC}" CXX="${HOST_CXX}" \
8832 CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" \
8833 $PYTHON $_topsrcdir/build/virtualenv/populate_virtualenv.py \
8834 $_topsrcdir $_topsrcdir/build/virtualenv/packages.txt \
8837 dnl Load the list of Makefiles to generate.
8838 dnl To add new Makefiles, edit allmakefiles.sh.
8839 dnl allmakefiles.sh sets the variable, MAKEFILES.
8840 . ${srcdir}/allmakefiles.sh
8842 echo $MAKEFILES > unallmakefiles
8844 AC_OUTPUT($MAKEFILES)
8846 # Generate Makefiles for WebRTC directly from .gyp files
8847 if test "${OS_TARGET}" = "WINNT"; then
8848 if test "$HAVE_64BIT_OS"; then
8853 EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
8856 if test -n "$MOZ_WEBRTC"; then
8857 AC_MSG_RESULT("generating WebRTC Makefiles...")
8859 WEBRTC_CONFIG="-D build_with_mozilla=1 --include ${srcdir}/media/webrtc/webrtc_config.gypi"
8861 GYP_WEBRTC_OPTIONS="--format=mozmake ${WEBRTC_CONFIG} ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
8863 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8864 $GYP_WEBRTC_OPTIONS \
8865 --generator-output=${_objdir}/media/webrtc/trunk \
8866 ${srcdir}/media/webrtc/trunk/peerconnection.gyp
8867 if test "$?" != 0; then
8868 AC_MSG_ERROR([failed to generate WebRTC Makefiles])
8871 # XXX disable until we land the tranche with signaling
8872 if test -n "$MOZ_WEBRTC_SIGNALING"; then
8873 AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
8874 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8875 $GYP_WEBRTC_OPTIONS \
8876 -D build_for_test=0 \
8877 --generator-output=${_objdir}/media/webrtc/signaling \
8878 ${srcdir}/media/webrtc/signaling/signaling.gyp
8879 if test "$?" != 0; then
8880 AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
8883 AC_MSG_RESULT("generating WebRTC/SignalingTest Makefiles...")
8884 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8885 $GYP_WEBRTC_OPTIONS \
8886 -D build_for_test=1 \
8887 --generator-output=${_objdir}/media/webrtc/signalingtest \
8888 ${srcdir}/media/webrtc/signaling/signaling.gyp
8889 if test "$?" != 0; then
8890 AC_MSG_ERROR([failed to generate WebRTC/SignalingTest Makefiles])
8894 AC_MSG_RESULT("generating gtest Makefiles...")
8895 # Ok to pass some extra -D's that are ignored here
8896 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8897 $GYP_WEBRTC_OPTIONS \
8898 --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
8899 ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
8900 if test "$?" != 0; then
8901 AC_MSG_ERROR([failed to generate gtest Makefiles])
8904 AC_MSG_RESULT("generating nrappkit Makefiles...")
8905 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8906 $GYP_WEBRTC_OPTIONS \
8907 --generator-output=${_objdir}/media/mtransport/third_party/nrappkit \
8908 ${srcdir}/media/mtransport/third_party/nrappkit/nrappkit.gyp
8909 if test "$?" != 0; then
8910 AC_MSG_ERROR([failed to generate nrappkit Makefiles])
8913 AC_MSG_RESULT("generating nICEr Makefiles...")
8914 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8915 $GYP_WEBRTC_OPTIONS \
8916 --generator-output=${_objdir}/media/mtransport/third_party/nICEr \
8917 ${srcdir}/media/mtransport/third_party/nICEr/nicer.gyp
8918 if test "$?" != 0; then
8919 AC_MSG_ERROR([failed to generate nICEr Makefiles])
8923 # Generate a JSON config file for unittest harnesses etc to read
8924 # build configuration details from in a standardized way.
8925 OS_TARGET=${OS_TARGET} \
8926 TARGET_CPU=${TARGET_CPU} \
8927 MOZ_DEBUG=${MOZ_DEBUG} \
8928 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} \
8929 UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
8930 MOZ_CRASHREPORTER=${MOZ_CRASHREPORTER} \
8931 $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
8932 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
8933 rm ./mozinfo.json.tmp
8935 mv -f ./mozinfo.json.tmp ./mozinfo.json
8938 # Run jemalloc configure script
8940 if test "$MOZ_JEMALLOC" -a "$MOZ_MEMORY"; then
8941 ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
8942 if test "$OS_ARCH" = "Linux"; then
8943 MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
8946 if test -n "$_WRAP_MALLOC"; then
8947 JEMALLOC_WRAPPER=__wrap_
8949 for mangle in ${MANGLE}; do
8950 if test -n "$MANGLED"; then
8951 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
8953 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
8956 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
8959 if test -z "$MOZ_TLS"; then
8960 ac_configure_args="$ac_configure_args --disable-tls"
8962 EXTRA_CFLAGS="$CFLAGS"
8963 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
8964 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
8966 if test "$CROSS_COMPILE"; then
8967 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
8969 _save_cache_file="$cache_file"
8970 cache_file=$_objdir/memory/jemalloc/src/config.cache
8971 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
8972 cache_file="$_save_cache_file"
8973 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8976 dnl Build libunwind for Android profiling builds
8977 if test "$OS_TARGET" = "Android" -a "$MOZ_PROFILING"; then
8978 old_ac_configure_arg="$ac_configure_args"
8979 ac_configure_args="--build=${build} --host=${target_alias} --disable-shared --enable-block-signals=no"
8980 if test "$MOZ_DEBUG"; then
8981 ac_configure_args="$ac_configure_args --enable-debug"
8983 if test "$DSO_PIC_CFLAGS"; then
8984 ac_configure_args="$ac_configure_args --with-pic"
8986 ac_configure_args="$ac_configure_args \
8990 CFLAGS=\"$CFLAGS\" \
8991 CXXFLAGS=\"$CXXFLAGS\" \
8992 CPPFLAGS=\"$CPPFLAGS\" \
8994 LDFLAGS=\"$LDFLAGS\" \
8996 RANLIB=\"$RANLIB\" \
9000 # Use a separate cache file for libunwind, since it does not use caching.
9001 mkdir -p $_objdir/tools/profiler/libunwind/src
9002 old_cache_file=$cache_file
9003 cache_file=$_objdir/tools/profiler/libunwind/src/config.cache
9004 old_config_files=$CONFIG_FILES
9006 AC_OUTPUT_SUBDIRS(tools/profiler/libunwind/src)
9007 cache_file=$old_cache_file
9008 ac_configure_args="$old_ac_configure_args"
9009 CONFIG_FILES=$old_config_files
9012 # Run freetype configure script
9014 if test "$MOZ_TREE_FREETYPE"; then
9015 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9016 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9017 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9018 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9019 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9020 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9021 AC_OUTPUT_SUBDIRS(modules/freetype2)
9024 if test -z "$direct_nspr_config"; then
9025 dnl ========================================================
9026 dnl = Setup a nice relatively clean build environment for
9027 dnl = sub-configures.
9028 dnl ========================================================
9031 CFLAGS="$_SUBDIR_CFLAGS"
9032 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9033 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9034 LDFLAGS="$_SUBDIR_LDFLAGS"
9035 HOST_CC="$_SUBDIR_HOST_CC"
9036 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9037 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9044 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9045 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9049 if test -n "$_WRAP_MALLOC"; then
9050 # Avoid doubling wrap malloc arguments
9051 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9054 if test -z "$MOZ_NATIVE_NSPR"; then
9055 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9056 if test -z "$MOZ_DEBUG"; then
9057 ac_configure_args="$ac_configure_args --disable-debug"
9059 ac_configure_args="$ac_configure_args --enable-debug"
9061 if test "$MOZ_OPTIMIZE" = "1"; then
9062 ac_configure_args="$ac_configure_args --enable-optimize"
9063 elif test -z "$MOZ_OPTIMIZE"; then
9064 ac_configure_args="$ac_configure_args --disable-optimize"
9066 if test -n "$HAVE_64BIT_OS"; then
9067 ac_configure_args="$ac_configure_args --enable-64bit"
9069 if test -n "$USE_ARM_KUSER"; then
9070 ac_configure_args="$ac_configure_args --with-arm-kuser"
9072 ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9073 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9074 # dladdr is supported by the new linker, even when the system linker doesn't
9075 # support it. Trick nspr into using dladdr when it's not supported.
9076 _SAVE_CPPFLAGS="$CPPFLAGS"
9077 export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9079 _SAVE_LDFLAGS="$LDFLAGS"
9080 export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9081 AC_OUTPUT_SUBDIRS(nsprpub)
9082 LDFLAGS="$_SAVE_LDFLAGS"
9083 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no; then
9085 CPPFLAGS="$_SAVE_CFLAGS"
9087 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9090 dnl ========================================================
9091 dnl = Setup a nice relatively clean build environment for
9092 dnl = sub-configures.
9093 dnl ========================================================
9096 CFLAGS="$_SUBDIR_CFLAGS"
9097 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9098 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9099 LDFLAGS="$_SUBDIR_LDFLAGS"
9100 HOST_CC="$_SUBDIR_HOST_CC"
9101 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9102 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9105 # Run the SpiderMonkey 'configure' script.
9106 dist=$MOZ_BUILD_ROOT/dist
9107 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9108 ac_configure_args="$ac_configure_args --enable-threadsafe"
9109 if test "$BUILD_CTYPES"; then
9110 # Build js-ctypes on the platforms we can.
9111 ac_configure_args="$ac_configure_args --enable-ctypes"
9113 if test -z "$JS_SHARED_LIBRARY" ; then
9114 ac_configure_args="$ac_configure_args --disable-shared-js"
9116 if test -z "$MOZ_NATIVE_NSPR"; then
9117 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9118 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9120 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9121 ac_configure_args="$ac_configure_args --prefix=$dist"
9122 if test "$MOZ_MEMORY"; then
9123 ac_configure_args="$ac_configure_args --enable-jemalloc"
9125 if test -n "$MOZ_GLUE_LDFLAGS"; then
9126 export MOZ_GLUE_LDFLAGS
9128 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9129 export MOZ_GLUE_PROGRAM_LDFLAGS
9131 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9134 export MOZ_NATIVE_ZLIB
9135 export MOZ_ZLIB_CFLAGS
9136 export MOZ_ZLIB_LIBS
9138 export STLPORT_CPPFLAGS
9139 export STLPORT_LDFLAGS
9141 AC_OUTPUT_SUBDIRS(js/src)
9142 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9144 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR