2 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
3 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
4 dnl This Source Code Form is subject to the terms of the Mozilla Public
5 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
6 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 dnl Process this file with autoconf to produce a configure script.
9 dnl ========================================================
12 AC_INIT(config/config.mk)
13 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
15 TARGET_CPU="${target_cpu}"
16 TARGET_VENDOR="${target_vendor}"
17 TARGET_OS="${target_os}"
19 dnl ========================================================
21 dnl = Don't change the following two lines. Doing so breaks:
23 dnl = CFLAGS="-foo" ./configure
25 dnl ========================================================
27 CPPFLAGS="${CPPFLAGS=}"
28 CXXFLAGS="${CXXFLAGS=}"
30 HOST_CFLAGS="${HOST_CFLAGS=}"
31 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
32 HOST_LDFLAGS="${HOST_LDFLAGS=}"
34 dnl ========================================================
35 dnl = Preserve certain environment flags passed to configure
36 dnl = We want sub projects to receive the same flags
37 dnl = untainted by this configure script
38 dnl ========================================================
41 _SUBDIR_CFLAGS="$CFLAGS"
42 _SUBDIR_CPPFLAGS="$CPPFLAGS"
43 _SUBDIR_CXXFLAGS="$CXXFLAGS"
44 _SUBDIR_LDFLAGS="$LDFLAGS"
45 _SUBDIR_HOST_CC="$HOST_CC"
46 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
47 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
48 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
49 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
51 dnl Set the version number of the libs included with mozilla
52 dnl ========================================================
58 dnl Set the minimum version of toolkit libs used by mozilla
59 dnl ========================================================
65 WINDRES_VERSION=2.14.90
71 STARTUP_NOTIFICATION_VERSION=0.8
73 SQLITE_VERSION=3.7.15.2
77 dnl Set various checks
78 dnl ========================================================
82 dnl Initialize the Pthread test variables early so they can be
83 dnl overridden by each platform.
84 dnl ========================================================
88 dnl Do not allow a separate objdir build if a srcdir build exists.
89 dnl ==============================================================
90 _topsrcdir=`cd \`dirname $0\`; pwd`
93 if test "$_topsrcdir" != "$_objdir"
95 # Check for a couple representative files in the source tree
97 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
98 if test -f $file; then
99 _conflict_files="$_conflict_files $file"
102 if test "$_conflict_files"; then
104 echo "* Your source tree contains these files:"
105 for file in $_conflict_files; do
109 * This indicates that you previously built in the source tree.
110 * A source tree build can confuse the separate objdir build.
112 * To clean up the source tree:
123 dnl Do not allow building if a clobber is required
124 dnl ==============================================================
125 dnl TODO Make this better, ideally this would clobber automaticially
126 if test -e $_objdir/CLOBBER; then
127 if test $_topsrcdir/CLOBBER -nt $_objdir/CLOBBER; then
129 echo " * The CLOBBER file has been updated, indicating that an incremental build"
130 echo " * since your last build will probably not work. A full build is required."
131 echo " * The change that caused this is:"
132 cat $_topsrcdir/CLOBBER | sed '/^#/d' | sed 's/^/ * /'
134 echo " * The easiest way to fix this is to manually delete your objdir:"
135 echo " * rm -rf $_objdir"
137 echo " * Or, if you know this clobber doesn't apply to you, it can be ignored with:"
138 echo " * cp '$_topsrcdir/CLOBBER' $_objdir"
144 touch $_objdir/CLOBBER
151 COMPILE_ENVIRONMENT=1
152 MOZ_ARG_DISABLE_BOOL(compile-environment,
153 [ --disable-compile-environment
154 Disable compiler/library checks.],
155 COMPILE_ENVIRONMENT= )
156 AC_SUBST(COMPILE_ENVIRONMENT)
158 MOZ_ARG_WITH_STRING(l10n-base,
159 [ --with-l10n-base=DIR path to l10n repositories],
160 L10NBASEDIR=$withval)
161 if test -n "$L10NBASEDIR"; then
162 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
163 AC_MSG_ERROR([--with-l10n-base must specify a path])
164 elif test -d "$L10NBASEDIR"; then
165 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
167 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
170 AC_SUBST(L10NBASEDIR)
172 dnl Check for Perl first -- needed for win32 SDK checks
173 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
174 if test -z "$PERL" -o "$PERL" = ":"; then
175 AC_MSG_ERROR([perl not found in \$PATH])
179 if test -n "$GAIADIR" ; then
180 AC_DEFINE(PACKAGE_GAIA)
183 MOZ_ARG_WITH_STRING(gonk,
185 location of gonk dir],
188 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
189 [ --with-gonk-toolchain-prefix=DIR
190 prefix to gonk toolchain commands],
191 gonk_toolchain_prefix=$withval)
193 if test -n "$gonkdir" ; then
194 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
195 android_source="$gonkdir"
196 ANDROID_SOURCE="$android_source"
197 ANDROID_NDK="${ANDROID_SOURCE}/ndk"
200 TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
201 AS="$gonk_toolchain_prefix"as
202 CC="$gonk_toolchain_prefix"gcc
203 CXX="$gonk_toolchain_prefix"g++
204 CPP="$gonk_toolchain_prefix"cpp
205 LD="$gonk_toolchain_prefix"ld
206 AR="$gonk_toolchain_prefix"ar
207 RANLIB="$gonk_toolchain_prefix"ranlib
208 STRIP="$gonk_toolchain_prefix"strip
209 OBJCOPY="$gonk_toolchain_prefix"objcopy
211 STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/ -I$gonkdir/external/stlport/stlport/"
212 STLPORT_LIBS="-lstlport"
214 case "$target_cpu" in
223 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"
224 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
225 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
226 dnl Add -llog by default, since we use it all over the place.
227 LIBS="$LIBS -llog $STLPORT_LIBS"
229 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"
231 dnl prevent cross compile section from using these flags as host flags
232 if test -z "$HOST_CPPFLAGS" ; then
235 if test -z "$HOST_CFLAGS" ; then
238 if test -z "$HOST_CXXFLAGS" ; then
241 if test -z "$HOST_LDFLAGS" ; then
246 AC_DEFINE(HAVE_SYS_UIO_H)
247 AC_DEFINE(HAVE_PTHREADS)
249 MOZ_CHROME_FILE_FORMAT=omni
255 *-android*|*-linuxandroid*)
256 if test -z "$ANDROID_PACKAGE_NAME" ; then
257 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
259 MOZ_CHROME_FILE_FORMAT=omni
263 AC_PATH_PROG(OBJCOPY,objcopy)
268 AC_SUBST(ANDROID_SOURCE)
269 AC_SUBST(ANDROID_PACKAGE_NAME)
272 dnl ========================================================
273 dnl Checks for compilers.
274 dnl ========================================================
275 dnl Set CROSS_COMPILE in the environment when running configure
276 dnl to use the cross-compile setup for now
277 dnl ========================================================
279 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
282 if test "$COMPILE_ENVIRONMENT"; then
284 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
285 echo "cross compiling from $host to $target"
289 _SAVE_CFLAGS="$CFLAGS"
290 _SAVE_LDFLAGS="$LDFLAGS"
292 AC_MSG_CHECKING([for host c compiler])
293 AC_CHECK_PROGS(HOST_CC, $HOST_CC cc gcc /usr/ucb/cc cl icc, "")
294 if test -z "$HOST_CC"; then
295 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
297 AC_MSG_RESULT([$HOST_CC])
298 AC_MSG_CHECKING([for host c++ compiler])
299 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
300 if test -z "$HOST_CXX"; then
301 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
303 AC_MSG_RESULT([$HOST_CXX])
305 if test -z "$HOST_CFLAGS"; then
306 HOST_CFLAGS="$CFLAGS"
308 if test -z "$HOST_CXXFLAGS"; then
309 HOST_CXXFLAGS="$CXXFLAGS"
311 if test -z "$HOST_LDFLAGS"; then
312 HOST_LDFLAGS="$LDFLAGS"
314 if test -z "$HOST_AR_FLAGS"; then
315 HOST_AR_FLAGS="$AR_FLAGS"
317 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
318 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
320 CFLAGS="$HOST_CFLAGS"
321 LDFLAGS="$HOST_LDFLAGS"
323 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
324 AC_TRY_COMPILE([], [return(0);],
325 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
326 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
329 CFLAGS="$HOST_CXXFLAGS"
331 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
332 AC_TRY_COMPILE([], [return(0);],
333 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
334 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
338 LDFLAGS=$_SAVE_LDFLAGS
340 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
343 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
347 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
348 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
349 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
350 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
351 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
352 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
353 AC_DEFINE(CROSS_COMPILE)
358 # Work around the conftest.exe access problem on Windows
363 MOZ_PATH_PROGS(AS, $AS as, $CC)
364 AC_CHECK_PROGS(AR, ar, :)
365 AC_CHECK_PROGS(LD, ld, :)
366 AC_CHECK_PROGS(STRIP, strip, :)
367 AC_CHECK_PROGS(WINDRES, windres, :)
368 if test -z "$HOST_CC"; then
371 if test -z "$HOST_CFLAGS"; then
372 HOST_CFLAGS="$CFLAGS"
374 if test -z "$HOST_CXX"; then
377 if test -z "$HOST_CXXFLAGS"; then
378 HOST_CXXFLAGS="$CXXFLAGS"
380 if test -z "$HOST_LDFLAGS"; then
381 HOST_LDFLAGS="$LDFLAGS"
383 if test -z "$HOST_RANLIB"; then
384 HOST_RANLIB="$RANLIB"
386 if test -z "$HOST_AR"; then
389 if test -z "$HOST_AR_FLAGS"; then
390 HOST_AR_FLAGS="$AR_FLAGS"
394 if test -n "$MOZ_WINCONSOLE"; then
395 AC_DEFINE(MOZ_WINCONSOLE)
400 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
401 if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
402 test "$GCC_MAJOR_VERSION" -lt 4; then
403 AC_MSG_ERROR([Only GCC 4.4 or newer supported])
407 dnl ========================================================
408 dnl Special win32 checks
409 dnl ========================================================
411 MOZ_ARG_ENABLE_BOOL(metro,
412 [ --enable-metro Enable Windows Metro build targets],
415 if test -n "$MOZ_METRO"; then
417 # Target the Windows 8 Kit
420 # toolkit/library/makefile.in needs these, see nsDllMain.
422 CRTEXPDLLVERSION=1-1-0
424 # Target the Windows 7 SDK by default
429 AC_SUBST(CRTDLLVERSION)
430 AC_SUBST(CRTEXPDLLVERSION)
432 MOZ_ARG_WITH_STRING(windows-version,
433 [ --with-windows-version=WINSDK_TARGETVER
434 Windows SDK version to target. Lowest version
435 currently allowed is 601 (Win7), highest is 602 (Win8)],
436 WINSDK_TARGETVER=$withval)
438 # Currently only two sdk versions allowed, 601 and 602
439 case "$WINSDK_TARGETVER" in
441 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
445 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
451 if test "$GCC" != "yes"; then
452 # Check to see if we are really running in a msvc environemnt
454 AC_CHECK_PROGS(MIDL, midl)
456 # Make sure compilers are valid
457 CFLAGS="$CFLAGS -TC -nologo"
458 CXXFLAGS="$CXXFLAGS -TP -nologo"
461 AC_TRY_COMPILE([#include <stdio.h>],
462 [ printf("Hello World\n"); ],,
463 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
466 AC_TRY_COMPILE([#include <new.h>],
467 [ unsigned *test = new unsigned(42); ],,
468 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
472 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
475 # Determine compiler version
476 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
477 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
478 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
479 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
480 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
481 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
483 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
484 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
486 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
487 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
490 if test "$_CC_MAJOR_VERSION" = "14"; then
491 dnl Require VC8SP1 or newer.
492 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
493 if test "$_CC_RELEASE" -lt 50727 -o \
494 \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
495 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.])
500 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
501 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
502 elif test "$_CC_MAJOR_VERSION" = "15"; then
505 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
506 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
507 elif test "$_CC_MAJOR_VERSION" = "16"; then
510 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
511 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
512 elif test "$_CC_MAJOR_VERSION" = "17"; then
515 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
516 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
518 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
521 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
523 if test -n "$WIN32_REDIST_DIR"; then
524 if test ! -d "$WIN32_REDIST_DIR"; then
525 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
527 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
530 dnl Confirm we have the pri tools on win8 builds
531 if test -n "$MOZ_METRO"; then
532 AC_MSG_CHECKING([for makepri])
533 AC_CHECK_PROGS(MAKEPRI, makepri, "")
534 if test -z "MAKEPRI" ; then
535 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
540 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
541 dnl not something else like "magnetic tape manipulation utility".
542 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
543 if test -z "$MSMT_TOOL"; then
544 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
548 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
550 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
551 if test -z "$MSMANIFEST_TOOL_VERSION"; then
552 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
558 # Check linker version
559 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
560 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
561 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
562 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
568 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
569 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
570 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
571 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
572 # Add flags if necessary
573 AC_MSG_CHECKING([for midl flags])
576 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
577 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
578 # MIDL version 7.00.0500 or later has no problem.
579 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
580 AC_MSG_RESULT([need -env win32])
582 AC_MSG_RESULT([none needed])
586 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
589 AC_MSG_RESULT([none needed])
593 # Identify which version of the SDK we're building with
594 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
596 MOZ_CHECK_HEADERS([winsdkver.h])
597 if test "$ac_cv_header_winsdkver_h" = "yes"; then
598 # Get the highest _WIN32_WINNT and NTDDI versions supported
599 # Take the higher of the two
600 # This is done because the Windows 7 beta SDK reports its
601 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
602 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
604 [cat > conftest.h <<EOF
605 #include <winsdkver.h>
606 #include <sdkddkver.h>
608 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
609 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
611 #define WINSDK_MAXVER NTDDI_MAXVER
616 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
619 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
621 # Any SDK which doesn't have WinSDKVer.h is too old.
622 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.])
625 unset _MSVC_VER_FILTER
627 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
631 _SAVE_CXXFLAGS="$CXXFLAGS"
632 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
633 AC_TRY_COMPILE([#include <exception>],
634 [std::_Throw(std::exception()); return 0;],
635 ac_cv_have_std__Throw="yes",
636 ac_cv_have_std__Throw="no")
637 CXXFLAGS="$_SAVE_CXXFLAGS"
641 if test "$ac_cv_have_std__Throw" = "yes"; then
642 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
643 ac_cv_have_dllimport_exception_bug,
647 _SAVE_CXXFLAGS="$CXXFLAGS"
648 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
649 AC_TRY_LINK([#include <vector>],
650 [std::vector<int> v; return v.at(1);],
651 ac_cv_have_dllimport_exception_bug="no",
652 ac_cv_have_dllimport_exception_bug="yes")
653 CXXFLAGS="$_SAVE_CXXFLAGS"
656 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
658 MOZ_MSVC_STL_WRAP__Throw=1
659 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
662 AC_CACHE_CHECK(for overridable _RAISE,
667 _SAVE_CXXFLAGS="$CXXFLAGS"
668 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
669 AC_TRY_COMPILE([#include <xstddef>
671 #define _RAISE(x) externallyDefinedFunction((x).what())
674 [std::vector<int> v; return v.at(1);],
675 ac_cv_have__RAISE="no",
676 ac_cv_have__RAISE="yes")
677 CXXFLAGS="$_SAVE_CXXFLAGS"
680 if test "$ac_cv_have__RAISE" = "yes"; then
682 MOZ_MSVC_STL_WRAP__RAISE=1
683 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
685 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
689 if test "$WRAP_STL_INCLUDES" = "1"; then
690 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
693 # Check w32api version
694 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
695 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
696 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
697 AC_TRY_COMPILE([#include <w32api.h>],
698 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
699 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
700 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
701 #error "test failed."
703 , [ res=yes ], [ res=no ])
704 AC_MSG_RESULT([$res])
705 if test "$res" != "yes"; then
706 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
708 # Check windres version
709 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
710 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
711 AC_MSG_RESULT([$_WINDRES_VERSION])
712 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
713 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
714 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
715 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
716 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
717 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
718 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
719 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
720 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
721 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
722 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
723 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
725 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
728 AC_CHECK_PROGS(MIDL, $target-widl widl)
729 if test -n "$MIDL"; then
732 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
735 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
740 MOZ_WINSDK_MAXVER=0x06020000
743 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
744 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
745 # Require OS features provided by IE 6.0 SP2 (XP SP2)
746 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
748 # If the maximum version supported by this SDK is lower than the target
750 AC_MSG_CHECKING([for Windows SDK being recent enough])
751 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
755 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.])
758 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
759 # Definitions matching sdkddkver.h
760 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
767 if test -n "$_WIN32_MSVC"; then
769 SKIP_COMPILER_CHECKS=1
770 SKIP_LIBRARY_CHECKS=1
772 # Since we're skipping compiler and library checks, hard-code
775 AC_DEFINE(HAVE_SETBUF)
776 AC_DEFINE(HAVE_ISATTY)
779 fi # COMPILE_ENVIRONMENT
792 AC_SUBST(WRAP_STL_INCLUDES)
793 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
794 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
796 dnl ========================================================
797 dnl Checks for programs.
798 dnl ========================================================
802 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
803 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
804 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
806 AC_MSG_RESULT([$_perl_version])
808 if test "$_perl_res" != 0; then
809 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
813 AC_MSG_CHECKING([for full perl installation])
814 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
816 if test "$_perl_res" != 0; then
818 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
823 MOZ_ARG_WITH_BOOL(system-ply,
824 [ --with-system-ply Use system installed python ply library],
825 [if $PYTHON -c 'import ply' 2>&5; then
828 AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
831 AC_SUBST(MOZ_SYSTEM_PLY)
833 if test -z "$COMPILE_ENVIRONMENT"; then
834 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
836 AC_SUBST(NSINSTALL_BIN)
838 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
839 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
840 MOZ_PATH_PROGS(UNZIP, unzip)
841 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
842 AC_MSG_ERROR([unzip not found in \$PATH])
844 MOZ_PATH_PROGS(ZIP, zip)
845 if test -z "$ZIP" -o "$ZIP" = ":"; then
846 AC_MSG_ERROR([zip not found in \$PATH])
848 MOZ_PATH_PROG(XARGS, xargs)
849 if test -z "$XARGS" -o "$XARGS" = ":"; then
850 AC_MSG_ERROR([xargs not found in \$PATH .])
853 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
856 if test "$COMPILE_ENVIRONMENT"; then
858 dnl ========================================================
859 dnl = Mac OS X toolchain support
860 dnl ========================================================
862 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
863 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
864 dnl when we can run target binaries.
865 AC_SUBST(UNIVERSAL_BINARY)
866 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
868 MOZ_ARG_WITH_STRING(unify-dist,
869 [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
871 if test -n "$UNIVERSAL_BINARY"; then
872 if test -z "$UNIFY_DIST"; then
873 AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
875 case "$UNIFY_DIST" in
879 UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
885 dnl ========================================================
886 dnl Check for MacOS deployment target version
887 dnl ========================================================
889 MOZ_ARG_ENABLE_STRING(macos-target,
890 [ --enable-macos-target=VER (default=10.6)
891 Set the minimum MacOS version needed at runtime],
892 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
896 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
897 dnl Use the specified value
898 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
900 dnl No value specified on the command line or in the environment,
901 dnl use architecture minimum.
902 export MACOSX_DEPLOYMENT_TARGET=10.6
907 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
909 dnl ========================================================
910 dnl = Mac OS X SDK support
911 dnl ========================================================
914 MOZ_ARG_WITH_STRING(macos-sdk,
915 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
916 MACOS_SDK_DIR=$withval)
918 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
919 dnl NEXT_ROOT will be set and exported only if it's needed.
920 AC_SUBST(MACOS_SDK_DIR)
923 if test "$MACOS_SDK_DIR"; then
924 dnl Sync this section with the ones in NSPR and NSS.
925 dnl Changes to the cross environment here need to be accounted for in
926 dnl the libIDL checks (below) and xpidl build.
928 if test ! -d "$MACOS_SDK_DIR"; then
929 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
930 specify a valid SDK. SDKs are installed when the optional cross-development
931 tools are selected during the Xcode/Developer Tools installation.])
934 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
935 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
937 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
938 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
939 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
942 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
944 AC_TRY_COMPILE([#include <new>],[],
948 AC_MSG_RESULT($result)
950 if test "$result" = "no" ; then
951 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
955 fi # COMPILE_ENVIRONMENT
957 AC_MSG_CHECKING([compiler version])
958 # Just print it so it shows up in the logs.
959 cc_version=$($CC --version)
960 AC_MSG_RESULT([$cc_version])
962 if test -n "$MAKE"; then
963 if test `echo $MAKE | grep -c make.py` != 1; then
970 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
973 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
976 if test "$GMAKE" = ":"; then
977 AC_MSG_ERROR([GNU make not found])
981 if test -z "$MAKE"; then
985 if test "$COMPILE_ENVIRONMENT"; then
991 fi # COMPILE_ENVIRONMENT
993 dnl ========================================================
994 dnl set the defaults first
995 dnl ========================================================
1011 MOZ_USER_DIR=".mozilla"
1014 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
1016 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1018 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
1020 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1021 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1022 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1023 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1024 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1025 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1026 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1027 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1029 # These are specially defined on Windows only
1032 XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1033 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
1036 XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
1037 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
1043 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1045 USE_DEPENDENT_LIBS=1
1047 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1049 if test -n "$CROSS_COMPILE"; then
1050 OS_TARGET="${target_os}"
1051 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1053 case "${target_os}" in
1054 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1055 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1056 gnu*) OS_ARCH=GNU ;;
1057 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1058 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
1059 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1062 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1065 OS_TARGET=`uname -s`
1066 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1067 OS_RELEASE=`uname -r`
1070 # Before this used `uname -m` when not cross compiling
1071 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1072 OS_TEST="${target_cpu}"
1074 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1076 #######################################################################
1077 # Master "Core Components" macros for getting the OS target #
1078 #######################################################################
1081 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1082 # cross-compilation.
1086 # Define and override various archtecture-specific variables, including
1095 case "$HOST_OS_ARCH" in
1109 if test -z "$GNU_CC"; then
1110 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1115 if test -z "$GNU_CXX"; then
1116 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1117 SOLARIS_SUNPRO_CXX=1
1120 AC_SUBST(SOLARIS_SUNPRO_CC)
1121 AC_SUBST(SOLARIS_SUNPRO_CXX)
1130 if test -z "$CROSS_COMPILE" ; then
1136 # If uname -s returns "Windows_NT", we assume that we are using
1137 # the uname.exe in MKS toolkit.
1139 # The -r option of MKS uname only returns the major version number.
1140 # So we need to use its -v option to get the minor version number.
1141 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1145 OS_MINOR_RELEASE=`uname -v`
1146 if test "$OS_MINOR_RELEASE" = "00"; then
1149 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1153 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1154 # the uname.exe in the MSYS tools.
1156 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1161 OS_RELEASE=`uname -v`.`uname -r`
1162 OS_TEST=${target_cpu}
1167 OS_RELEASE=`uname -v`
1170 case "${target_cpu}" in
1181 if test -z "$CROSS_COMPILE" ; then
1189 # Only set CPU_ARCH if we recognize the value of OS_TEST
1200 powerpc | ppc | rs6000)
1204 Alpha | alpha | ALPHA)
1237 if test -z "$OS_TARGET"; then
1240 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1242 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1243 dnl ===============================================================
1247 INTEL_ARCHITECTURE=1
1250 dnl Configure platform-specific CPU architecture compiler options.
1251 dnl ==============================================================
1254 dnl =================================================================
1255 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1256 dnl which is bad when cross compiling.
1257 dnl =================================================================
1258 if test "$COMPILE_ENVIRONMENT"; then
1259 configure_static_assert_macros='
1260 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1261 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1262 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1265 dnl test that the macros actually work:
1266 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1267 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1270 ac_cv_static_assertion_macros_work="yes"
1271 AC_TRY_COMPILE([$configure_static_assert_macros],
1272 [CONFIGURE_STATIC_ASSERT(1)],
1274 ac_cv_static_assertion_macros_work="no")
1275 AC_TRY_COMPILE([$configure_static_assert_macros],
1276 [CONFIGURE_STATIC_ASSERT(0)],
1277 ac_cv_static_assertion_macros_work="no",
1280 AC_TRY_COMPILE([$configure_static_assert_macros],
1281 [CONFIGURE_STATIC_ASSERT(1)],
1283 ac_cv_static_assertion_macros_work="no")
1284 AC_TRY_COMPILE([$configure_static_assert_macros],
1285 [CONFIGURE_STATIC_ASSERT(0)],
1286 ac_cv_static_assertion_macros_work="no",
1290 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1291 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1292 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1294 fi # COMPILE_ENVIRONMENT
1296 dnl ========================================================
1297 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1299 dnl ========================================================
1303 dnl ========================================================
1304 dnl Suppress Clang Argument Warnings
1305 dnl ========================================================
1306 if test -n "$CLANG_CC"; then
1307 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1308 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1310 if test -n "$CLANG_CXX"; then
1311 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1314 dnl ========================================================
1315 dnl = Use Address Sanitizer
1316 dnl ========================================================
1317 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1318 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1321 if test -n "$MOZ_ASAN"; then
1327 dnl ========================================================
1328 dnl = Enable hacks required for LLVM instrumentations
1329 dnl ========================================================
1330 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1331 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1334 if test -n "$MOZ_LLVM_HACKS"; then
1338 AC_SUBST(MOZ_NO_WLZDEFS)
1339 AC_SUBST(MOZ_CFLAGS_NSS)
1341 dnl ========================================================
1342 dnl GNU specific defaults
1343 dnl ========================================================
1344 if test "$GNU_CC"; then
1345 # Per bug 719659 comment 2, some of the headers on ancient build machines
1346 # may require gnu89 inline semantics. But otherwise, we use C99.
1347 CFLAGS="$CFLAGS -std=gnu99 -fgnu89-inline"
1348 # FIXME: Let us build with strict aliasing. bug 414641.
1349 CFLAGS="$CFLAGS -fno-strict-aliasing"
1350 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1351 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1352 DSO_LDOPTS='-shared'
1353 if test "$GCC_USE_GNU_LD"; then
1354 # Some tools like ASan use a runtime library that is only
1355 # linked against executables, so we must allow undefined
1356 # symbols for shared objects in some cases.
1357 if test -z "$MOZ_NO_WLZDEFS"; then
1358 # Don't allow undefined symbols in libraries
1359 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1362 WARNINGS_AS_ERRORS='-Werror'
1363 # Don't treat -Wuninitialized as error b/c it has lots of false positives.
1364 WARNINGS_AS_ERRORS="$WARNINGS_AS_ERRORS -Wno-error=uninitialized"
1365 # Don't treat -Wdeprecated-declarations as error b/c we don't want our
1366 # builds held hostage when a platform-specific API is suddenly deprecated.
1367 WARNINGS_AS_ERRORS="$WARNINGS_AS_ERRORS -Wno-error=deprecated-declarations"
1369 DSO_PIC_CFLAGS='-fPIC'
1370 ASFLAGS="$ASFLAGS -fPIC"
1371 AC_MSG_CHECKING([for --noexecstack option to as])
1372 _SAVE_CFLAGS=$CFLAGS
1373 CFLAGS="$CFLAGS -Wa,--noexecstack"
1374 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1375 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1376 AC_MSG_RESULT([no]))
1377 CFLAGS=$_SAVE_CFLAGS
1378 AC_MSG_CHECKING([for -z noexecstack option to ld])
1379 _SAVE_LDFLAGS=$LDFLAGS
1380 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1381 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1383 LDFLAGS=$_SAVE_LDFLAGS)
1384 AC_MSG_CHECKING([for --build-id option to ld])
1385 _SAVE_LDFLAGS=$LDFLAGS
1386 LDFLAGS="$LDFLAGS -Wl,--build-id"
1387 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1388 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1390 LDFLAGS=$_SAVE_LDFLAGS)
1393 # Check for -mssse3 on $CC
1394 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1395 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1396 _SAVE_CFLAGS=$CFLAGS
1397 CFLAGS="$CFLAGS -mssse3"
1398 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1399 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1400 AC_MSG_RESULT([no]))
1401 CFLAGS=$_SAVE_CFLAGS
1402 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
1404 # Check for -msse4.1 on $CC
1405 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1406 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1407 _SAVE_CFLAGS=$CFLAGS
1408 CFLAGS="$CFLAGS -msse4.1"
1409 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1410 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1411 AC_MSG_RESULT([no]))
1412 CFLAGS=$_SAVE_CFLAGS
1413 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
1415 # Turn on GNU-specific warnings:
1416 # -Wall - turn on a lot of warnings
1417 # -Wpointer-arith - good to have
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
1422 # -Wsign-compare - catches comparison of signed and unsigned types
1424 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1425 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1426 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1427 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1428 MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1430 # Turn off the following warnings that -Wall turns on:
1431 # -Wno-unused - lots of violations in third-party code
1433 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
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 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1448 _USE_CPP_INCLUDE_FLAG=1
1449 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1451 elif test "$SOLARIS_SUNPRO_CC"; then
1453 if test "$CPU_ARCH" = "sparc"; then
1454 # for Sun Studio on Solaris/SPARC
1455 DSO_PIC_CFLAGS='-xcode=pic32'
1457 DSO_PIC_CFLAGS='-KPIC'
1459 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1461 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1462 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1464 DSO_LDOPTS='-shared'
1465 if test "$GNU_LD"; then
1466 # Don't allow undefined symbols in libraries
1467 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1471 DSO_PIC_CFLAGS='-KPIC'
1472 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1475 if test "$GNU_CXX"; then
1476 # FIXME: Let us build with strict aliasing. bug 414641.
1477 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1479 # Turn on GNU-specific warnings:
1480 # -Wall - turn on a lot of warnings
1481 # -Wpointer-arith - good to have
1482 # -Woverloaded-virtual - ???
1483 # -Werror=return-type - catches missing returns, zero false positives
1484 # -Wtype-limits - catches overflow bugs, few false positives
1485 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1486 # -Wsign-compare - catches comparison of signed and unsigned types
1488 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1489 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1490 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1491 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1492 MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1494 # Turn off the following warnings that -Wall turns on:
1495 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1497 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1499 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1500 # Don't use -Wcast-align with ICC or clang
1502 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1503 hppa | ia64 | sparc | arm)
1506 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1511 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1512 _USE_CPP_INCLUDE_FLAG=1
1514 # Recent clang and gcc support C++11 deleted functions without warnings if
1515 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1516 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1517 # unused. But clang's warning can be disabled, so when compiling with clang
1518 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1519 # deleted function syntax.
1520 if test "$CLANG_CXX"; then
1521 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1522 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1526 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1529 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1530 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1531 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1532 dnl normal behavior.
1533 dnl ========================================================
1535 MKSHLIB_UNFORCE_ALL=
1537 if test "$COMPILE_ENVIRONMENT"; then
1538 if test "$GNU_CC"; then
1539 AC_MSG_CHECKING(whether ld has archive extraction flags)
1540 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1541 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1542 ac_cv_mkshlib_force_and_unforce="no"
1543 exec 3<&0 <<LOOP_INPUT
1544 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1545 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1546 force="-Wl,-all"; unforce="-Wl,-none"
1553 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1556 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1558 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1562 eval $ac_cv_mkshlib_force_and_unforce
1563 MKSHLIB_FORCE_ALL=$force
1564 MKSHLIB_UNFORCE_ALL=$unforce
1567 fi # COMPILE_ENVIRONMENT
1569 dnl ========================================================
1570 dnl Checking for 64-bit OS
1571 dnl ========================================================
1572 if test "$COMPILE_ENVIRONMENT"; then
1575 AC_MSG_CHECKING(for 64-bit OS)
1576 AC_TRY_COMPILE([$configure_static_assert_macros],
1577 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1578 result="yes", result="no")
1579 AC_MSG_RESULT("$result")
1580 if test "$result" = "yes"; then
1581 AC_DEFINE(HAVE_64BIT_OS)
1584 AC_SUBST(HAVE_64BIT_OS)
1586 fi # COMPILE_ENVIRONMENT
1588 dnl ========================================================
1589 dnl Enable high-memory support on OS/2 by default.
1590 dnl ========================================================
1591 MOZ_OS2_HIGH_MEMORY=1
1592 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1593 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1594 MOZ_OS2_HIGH_MEMORY=,
1595 MOZ_OS2_HIGH_MEMORY=1 )
1596 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1598 dnl ========================================================
1599 dnl = Use profiling compile flags
1600 dnl ========================================================
1601 MOZ_ARG_ENABLE_BOOL(profiling,
1602 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1606 # For profiling builds keep the symbol information
1607 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1608 case "$OS_TARGET" in
1609 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1610 STRIP_FLAGS="--strip-debug"
1615 dnl ========================================================
1616 dnl = Use incremental GC
1617 dnl ========================================================
1619 MOZ_ARG_DISABLE_BOOL(gcincremental,
1620 [ --disable-gcincremental Disable incremental GC],
1622 if test -n "$JSGC_INCREMENTAL"; then
1623 AC_DEFINE(JSGC_INCREMENTAL)
1626 dnl ========================================================
1627 dnl = Use generational GC
1628 dnl ========================================================
1629 MOZ_ARG_ENABLE_BOOL(gcgenerational,
1630 [ --enable-gcgenerational Enable generational GC],
1631 JSGC_GENERATIONAL=1,
1632 JSGC_GENERATIONAL= )
1633 if test -n "$JSGC_GENERATIONAL"; then
1634 AC_DEFINE(JSGC_GENERATIONAL)
1637 dnl ========================================================
1638 dnl = Perform moving GC stack rooting analysis
1639 dnl ========================================================
1640 MOZ_ARG_ENABLE_BOOL(root-analysis,
1641 [ --enable-root-analysis Enable moving GC stack root analysis],
1642 JSGC_ROOT_ANALYSIS=1,
1643 JSGC_ROOT_ANALYSIS= )
1644 if test -n "$JSGC_ROOT_ANALYSIS"; then
1645 AC_DEFINE(JSGC_ROOT_ANALYSIS)
1648 dnl ========================================================
1649 dnl = Use exact stack rooting for GC
1650 dnl ========================================================
1651 MOZ_ARG_ENABLE_BOOL(exact-rooting,
1652 [ --enable-exact-rooting Enable use of exact stack roots for GC],
1653 JSGC_USE_EXACT_ROOTING=1,
1654 JSGC_USE_EXACT_ROOTING= )
1655 if test -n "$JSGC_USE_EXACT_ROOTING"; then
1656 AC_DEFINE(JSGC_USE_EXACT_ROOTING)
1659 dnl ========================================================
1661 dnl ========================================================
1662 MOZ_ARG_ENABLE_BOOL(valgrind,
1663 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1666 if test -n "$MOZ_VALGRIND"; then
1667 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1669 [--enable-valgrind specified but Valgrind is not installed]))
1670 AC_DEFINE(MOZ_VALGRIND)
1672 AC_SUBST(MOZ_VALGRIND)
1674 dnl ========================================================
1676 dnl ========================================================
1677 MOZ_ARG_ENABLE_BOOL(jprof,
1678 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1681 if test -n "$MOZ_JPROF"; then
1683 AC_DEFINE(MOZ_JPROF)
1686 dnl ========================================================
1688 dnl ========================================================
1689 MOZ_ENABLE_PROFILER_SPS=1
1691 case "${OS_TARGET}" in
1693 case "${CPU_ARCH}" in
1696 MOZ_ENABLE_PROFILER_SPS=
1700 case "${CPU_ARCH}" in
1703 MOZ_ENABLE_PROFILER_SPS=
1708 MOZ_ENABLE_PROFILER_SPS=
1712 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1713 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1716 dnl ========================================================
1718 dnl ========================================================
1719 MOZ_ARG_ENABLE_BOOL(shark,
1720 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1723 if test -n "$MOZ_SHARK"; then
1725 AC_DEFINE(MOZ_SHARK)
1728 dnl ========================================================
1730 dnl ========================================================
1731 MOZ_ARG_ENABLE_BOOL(instruments,
1732 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
1735 if test -n "$MOZ_INSTRUMENTS"; then
1737 AC_DEFINE(MOZ_INSTRUMENTS)
1740 dnl ========================================================
1742 dnl ========================================================
1743 MOZ_ARG_ENABLE_BOOL(callgrind,
1744 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1747 if test -n "$MOZ_CALLGRIND"; then
1749 AC_DEFINE(MOZ_CALLGRIND)
1752 dnl ========================================================
1754 dnl ========================================================
1755 MOZ_ARG_ENABLE_BOOL(vtune,
1756 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1759 if test -n "$MOZ_VTUNE"; then
1761 AC_DEFINE(MOZ_VTUNE)
1764 dnl ========================================================
1766 dnl ========================================================
1767 if test -n "$MOZ_PROFILING"; then
1768 AC_DEFINE(MOZ_PROFILING)
1771 dnl ========================================================
1772 dnl System overrides of the defaults for host
1773 dnl ========================================================
1776 if test -n "$_WIN32_MSVC"; then
1778 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1779 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1780 HOST_RANLIB='echo ranlib'
1782 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1784 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1785 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1786 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1787 HOST_BIN_SUFFIX=.exe
1790 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1794 case "${host_cpu}" in
1796 if test -n "$_WIN32_MSVC"; then
1797 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1801 if test -n "$_WIN32_MSVC"; then
1802 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1804 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1810 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1811 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1812 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1815 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1816 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1817 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1818 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1822 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1823 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1824 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1825 HOST_BIN_SUFFIX=.exe
1830 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1831 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1835 dnl Check for using a custom <stdint.h> implementation
1836 dnl ========================================================
1837 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1838 if test "$MOZ_CUSTOM_STDINT_H"; then
1839 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1840 AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1842 AC_MSG_RESULT(none specified)
1845 dnl Get mozilla version from central milestone file
1846 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1847 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1849 dnl Get version of various core apps from the version files.
1850 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1852 if test -z "$FIREFOX_VERSION"; then
1853 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1856 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1857 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1858 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1860 MOZ_DOING_LTO(lto_is_enabled)
1862 dnl ========================================================
1863 dnl System overrides of the defaults for target
1864 dnl ========================================================
1869 if test ! "$GNU_CC"; then
1870 if test ! "$HAVE_64BIT_OS"; then
1871 # Compiling with Visual Age C++ object model compat is the
1872 # default. To compile with object model ibm, add
1873 # AIX_OBJMODEL=ibm to .mozconfig.
1874 if test "$AIX_OBJMODEL" = "ibm"; then
1875 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1882 AC_SUBST(AIX_OBJMODEL)
1883 DSO_LDOPTS='-qmkshrobj=1'
1884 DSO_CFLAGS='-qflag=w:w'
1886 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1888 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1889 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1890 if test "$COMPILE_ENVIRONMENT"; then
1893 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1895 [#if (__IBMCPP__ < 900)
1896 #error "Bad compiler"
1898 _BAD_COMPILER=,_BAD_COMPILER=1)
1899 if test -n "$_BAD_COMPILER"; then
1901 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1903 AC_MSG_RESULT([yes])
1906 TARGET_COMPILER_ABI="ibmc"
1907 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1908 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1911 case "${target_os}" in
1916 if test "$COMPILE_ENVIRONMENT"; then
1917 MOZ_CHECK_HEADERS(sys/inttypes.h)
1919 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1923 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1924 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1925 MOZ_OPTIMIZE_FLAGS="-O3"
1926 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1927 if test "$HAVE_64BIT_OS"; then
1932 STRIP_FLAGS="$STRIP_FLAGS -x -S"
1933 # Check whether we're targeting OS X or iOS
1934 AC_CACHE_CHECK(for iOS target,
1936 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1937 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1941 ac_cv_ios_target="yes",
1942 ac_cv_ios_target="no")])
1943 if test "$ac_cv_ios_target" = "yes"; then
1945 AC_DEFINE(XP_DARWIN)
1946 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1948 AC_DEFINE(XP_MACOSX)
1949 AC_DEFINE(XP_DARWIN)
1950 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1951 # The ExceptionHandling framework is needed for Objective-C exception
1952 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1954 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1956 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1959 if test "x$lto_is_enabled" = "xyes"; then
1960 echo "Skipping -dead_strip because lto is enabled."
1961 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1962 dnl ===================================================================
1963 elif test "x$enable_dtrace" = "xyes"; then
1964 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1966 dnl check for the presence of the -dead_strip linker flag
1967 AC_MSG_CHECKING([for -dead_strip option to ld])
1968 _SAVE_LDFLAGS=$LDFLAGS
1969 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1970 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1971 if test -n "$_HAVE_DEAD_STRIP" ; then
1972 AC_MSG_RESULT([yes])
1973 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1978 LDFLAGS=$_SAVE_LDFLAGS
1981 dnl With newer linkers we need to pass -allow_heap_execute because of
1982 dnl Microsoft Silverlight (5.1.10411.0 at least).
1983 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1984 _SAVE_LDFLAGS=$LDFLAGS
1985 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1986 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1987 _HAVE_ALLOW_HEAP_EXECUTE=)
1988 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1989 AC_MSG_RESULT([yes])
1990 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1994 LDFLAGS=$_SAVE_LDFLAGS
1996 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2001 if test ! "$GNU_CC"; then
2005 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2006 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2007 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2010 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2011 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2014 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2015 AC_DEFINE(_LARGEFILE64_SOURCE)
2020 if test ! "$GNU_CC"; then
2021 DSO_LDOPTS='-b -Wl,+s'
2024 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2025 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2026 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2028 DSO_LDOPTS='-b -E +s'
2029 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2030 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2032 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2033 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2036 *-android*|*-linuxandroid*)
2037 AC_DEFINE(NO_PW_GECOS)
2039 if test -n "$gonkdir"; then
2040 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2045 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2048 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2050 MOZ_GFX_OPTIMIZE_MOBILE=1
2051 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2055 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2056 # Similarly for GNU_CXX and INTEL_CXX.
2057 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2058 # -Os has been broken on Intel's C/C++ compilers for quite a
2059 # while; Intel recommends against using it.
2060 MOZ_OPTIMIZE_FLAGS="-O2"
2061 MOZ_DEBUG_FLAGS="-g"
2062 elif test "$GNU_CC" -o "$GNU_CXX"; then
2063 case $GCC_VERSION in
2065 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
2066 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2068 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2069 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2070 MOZ_DEBUG_FLAGS="-g"
2073 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2077 case "${target_cpu}" in
2079 CFLAGS="$CFLAGS -mieee"
2080 CXXFLAGS="$CXXFLAGS -mieee"
2086 MOZ_DEBUG_FLAGS="-g" # We want inlining
2090 if test -z "$MC"; then
2100 # certain versions of cygwin's makedepend barf on the
2101 # #include <string> vs -I./dist/include/string issue so don't use it
2102 if test -n "$GNU_CC"; then
2104 CXX="$CXX -mwindows"
2105 CPP="$CPP -mwindows"
2106 CFLAGS="$CFLAGS -mms-bitfields"
2107 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2108 DSO_LDOPTS='-shared'
2109 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2110 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2112 # Use static libgcc and libstdc++
2113 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
2114 # Use temp file for windres (bug 213281)
2115 RCFLAGS='-O coff --use-temp-file'
2116 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2117 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2119 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2120 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2122 IMPORT_LIB_SUFFIX=dll.a
2124 # We use mix of both POSIX and Win32 printf format across the tree, so format
2125 # warnings are useless on mingw.
2126 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2127 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2129 TARGET_COMPILER_ABI=msvc
2133 if test "$AS_BIN"; then
2134 AS="$(basename "$AS_BIN")"
2137 AR_FLAGS='-NOLOGO -OUT:"$@"'
2139 RANLIB='echo not_ranlib'
2140 STRIP='echo not_strip'
2151 IMPORT_LIB_SUFFIX=lib
2152 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2153 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2155 MKSHLIB_UNFORCE_ALL=
2156 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2157 _USE_CPP_INCLUDE_FLAG=1
2158 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2159 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2160 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2161 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2162 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2163 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2164 # MSVC warning C4482 warns when an enum value is refered specifing the
2165 # name of the enum itself. This behavior is allowed in C++11, and the
2166 # warning has been removed in VS2012.
2167 # MSVC warning C4800 warns when a value is implicitly cast to bool,
2168 # because this also forces narrowing to a single byte, which can be a
2169 # perf hit. But this matters so little in practice (and often we want
2170 # that behavior) that it's better to turn it off.
2171 # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2172 # on non-Western system locales even if it is in a comment.
2173 # khuey says we can safely ignore MSVC warning C4251
2174 CFLAGS="$CFLAGS -wd4819"
2175 CXXFLAGS="$CXXFLAGS -wd4251 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2176 # make 'foo == bar;' error out
2177 CFLAGS="$CFLAGS -we4553"
2178 CXXFLAGS="$CXXFLAGS -we4553"
2179 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2180 MOZ_DEBUG_FLAGS='-Zi'
2181 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2182 WARNINGS_AS_ERRORS='-WX'
2183 MOZ_OPTIMIZE_FLAGS='-O1'
2185 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2186 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2187 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2188 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2189 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2190 dnl For profile-guided optimization
2191 PROFILE_GEN_CFLAGS="-GL"
2192 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2193 dnl XXX: PGO builds can fail with warnings treated as errors,
2194 dnl specifically "no profile data available" appears to be
2195 dnl treated as an error sometimes. This might be a consequence
2196 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2197 dnl with the linker doing most of the work in the whole-program
2198 dnl optimization/PGO case. I think it's probably a compiler bug,
2199 dnl but we work around it here.
2200 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2201 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2202 dnl Probably also a compiler bug, but what can you do?
2203 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2204 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2205 if test "$_MSC_VER" -ge 1500; then
2206 dnl VS2008 or later supports SSSE3
2207 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2208 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
2211 AC_DEFINE(HAVE_SNPRINTF)
2216 AC_DEFINE(HW_THREADS)
2217 AC_DEFINE(STDC_HEADERS)
2218 AC_DEFINE(NEW_H, <new>)
2219 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2220 TARGET_MD_ARCH=win32
2221 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2223 MOZ_USER_DIR="Mozilla"
2225 dnl Hardcode to win95 for now - cls
2226 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2228 dnl set NO_X11 defines here as the general check is skipped on win32
2234 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2235 if test -n "$L10NBASEDIR"; then
2236 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2243 if test -z "$MOZ_TOOLS"; then
2244 AC_MSG_ERROR([MOZ_TOOLS is not set])
2246 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2247 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2248 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2250 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2251 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2252 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2259 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.])
2265 if test "$HAVE_64BIT_OS"; then
2266 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2269 if test -n "$GNU_CC"; then
2270 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2271 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2272 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup"
2274 AC_DEFINE(HAVE_STDCALL)
2275 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2276 LDFLAGS="$LDFLAGS -SAFESEH"
2282 if test -n "$_WIN32_MSVC"; then
2283 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2288 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2292 if test "$HAVE_64BIT_OS"; then
2299 CFLAGS="$CFLAGS -Dunix"
2300 CXXFLAGS="$CXXFLAGS -Dunix"
2301 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2303 DSO_PIC_CFLAGS='-fPIC -DPIC'
2304 DSO_LDOPTS='-shared'
2305 BIN_FLAGS='-Wl,--export-dynamic'
2307 DSO_PIC_CFLAGS='-fPIC -DPIC'
2308 DLL_SUFFIX=".so.1.0"
2309 DSO_LDOPTS='-shared'
2311 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2312 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2313 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2314 if test "$LIBRUNPATH"; then
2315 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2317 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2318 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2322 if test "$SO_VERSION"; then
2323 DLL_SUFFIX=".so.$SO_VERSION"
2325 DLL_SUFFIX=".so.1.0"
2327 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2329 DSO_PIC_CFLAGS='-fPIC'
2330 DSO_LDOPTS='-shared -fPIC'
2331 if test "$LIBRUNPATH"; then
2332 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2337 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2338 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2341 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2342 AC_DEFINE(TCPV40HDRS)
2348 IMPORT_LIB_SUFFIX=lib
2352 CFLAGS="$CFLAGS -Zomf"
2353 CXXFLAGS="$CXXFLAGS -Zomf"
2355 BIN_FLAGS='-Zlinker /ST:0x100000'
2359 WARNINGS_AS_ERRORS='-Werror'
2360 MOZ_DEBUG_FLAGS="-g -fno-inline"
2361 MOZ_OPTIMIZE_FLAGS="-O2"
2362 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2363 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2364 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2366 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2370 MOZ_USER_DIR="Mozilla"
2373 STRIP_FLAGS="/yua /ydd /yxd /ynl /anp /b- /cs+ /d /i- /ml1 /mr2 /mf2 /r+ /u+ /x- /zs:0 /zx /zd"
2375 if test "$MOZTOOLS"; then
2376 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2378 AC_MSG_ERROR([MOZTOOLS is not set])
2380 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2381 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2382 LDFLAGS="$LDFLAGS -Zhigh-mem"
2383 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2384 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2387 # GCC for OS/2 currently predefines these, but we don't want them
2388 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2389 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2391 AC_CACHE_CHECK(for __declspec(dllexport),
2393 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2395 ac_os2_declspec="yes",
2396 ac_os2_declspec="no")])
2397 if test "$ac_os2_declspec" != "yes"; then
2398 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2404 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2406 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2407 # libraries one level up (e.g. libnspr4.so)
2408 if test "$SOLARIS_SUNPRO_CC"; then
2409 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2410 LIBS="-lCrun -lCstd -lc $LIBS"
2411 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2412 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2413 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2414 LDFLAGS="-xildoff $LDFLAGS"
2415 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2416 _SAVE_LDFLAGS=$LDFLAGS
2417 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2418 AC_TRY_LINK([#include <stdio.h>],
2419 [printf("Hello World\n");],
2421 [LDFLAGS=$_SAVE_LDFLAGS])
2423 MOZ_OPTIMIZE_FLAGS="-xO4"
2424 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2425 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2426 MKSHLIB_FORCE_ALL='-z allextract'
2427 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2434 AS='/usr/ccs/bin/as'
2435 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2437 TARGET_COMPILER_ABI="sunc"
2438 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2439 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2440 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2444 [#if (__SUNPRO_CC < 0x590)
2447 _BAD_COMPILER=,_BAD_COMPILER=1)
2448 if test -n "$_BAD_COMPILER"; then
2450 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2455 [#if (__SUNPRO_CC >= 0x5100)
2456 #error "Sun C++ 5.10 or above"
2458 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2459 if test "$_ABOVE_SS12U1"; then
2461 CXXFLAGS="$CXXFLAGS -xannotate=no"
2463 AC_MSG_RESULT([$_res])
2466 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2468 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2469 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2470 ASFLAGS="$ASFLAGS -fPIC"
2471 DSO_LDOPTS='-shared'
2472 WARNINGS_AS_ERRORS='-Werror'
2474 _WARNINGS_CXXFLAGS=''
2475 if test "$OS_RELEASE" = "5.3"; then
2476 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2479 if test "$OS_RELEASE" = "5.5.1"; then
2480 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2485 DSO_LDOPTS='-Bdynamic'
2486 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2487 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2489 AC_DEFINE(SPRINTF_RETURNS_STRING)
2490 case "$(target_os)" in
2492 DLL_SUFFIX='.so.1.0'
2498 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2503 AC_SUBST(MOZ_LINKER)
2504 if test -n "$MOZ_LINKER"; then
2505 AC_DEFINE(MOZ_LINKER)
2507 AC_SUBST(MOZ_ENABLE_SZIP)
2509 dnl Only one oddball right now (QNX), but this gives us flexibility
2510 dnl if any other platforms need to override this in the future.
2511 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2513 dnl ========================================================
2514 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2515 dnl by now will not have any way to link most binaries (tests
2516 dnl as well as viewer, apprunner, etc.), because some symbols
2517 dnl will be left out of the "composite" .so's by ld as unneeded.
2518 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2519 dnl they can link in the static libs that provide the missing
2521 dnl ========================================================
2522 NO_LD_ARCHIVE_FLAGS=
2523 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2524 NO_LD_ARCHIVE_FLAGS=1
2528 NO_LD_ARCHIVE_FLAGS=
2531 NO_LD_ARCHIVE_FLAGS=
2534 if test -z "$GNU_CC"; then
2535 NO_LD_ARCHIVE_FLAGS=
2539 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2541 dnl ========================================================
2542 dnl = Flags to strip unused symbols from .so components and
2543 dnl = to export jemalloc symbols when linking a program
2544 dnl ========================================================
2546 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2547 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2550 if test -z "$GNU_CC"; then
2551 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2553 if test -z "$GCC_USE_GNU_LD"; then
2554 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2556 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2561 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2564 if test -n "$GNU_CC"; then
2565 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2570 if test -z "$COMPILE_ENVIRONMENT"; then
2571 SKIP_COMPILER_CHECKS=1
2572 SKIP_LIBRARY_CHECKS=1
2576 if test -z "$SKIP_COMPILER_CHECKS"; then
2577 dnl Checks for typedefs, structures, and compiler characteristics.
2578 dnl ========================================================
2586 AC_MSG_CHECKING(for __stdcall)
2587 AC_CACHE_VAL(ac_cv___stdcall,
2588 [AC_TRY_COMPILE([template <typename Method> struct foo;
2589 template <> struct foo<void (*)()> {};
2590 template <> struct foo<void (__stdcall*)()> {};],
2592 [ac_cv___stdcall=true],
2593 [ac_cv___stdcall=false])])
2594 if test "$ac_cv___stdcall" = true ; then
2595 AC_DEFINE(HAVE_STDCALL)
2601 AC_MSG_CHECKING(for ssize_t)
2602 AC_CACHE_VAL(ac_cv_type_ssize_t,
2603 [AC_TRY_COMPILE([#include <stdio.h>
2604 #include <sys/types.h>],
2606 [ac_cv_type_ssize_t=true],
2607 [ac_cv_type_ssize_t=false])])
2608 if test "$ac_cv_type_ssize_t" = true ; then
2609 AC_DEFINE(HAVE_SSIZE_T)
2614 AC_STRUCT_ST_BLKSIZE
2615 AC_MSG_CHECKING(for siginfo_t)
2616 AC_CACHE_VAL(ac_cv_siginfo_t,
2617 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2618 #include <signal.h>],
2620 [ac_cv_siginfo_t=true],
2621 [ac_cv_siginfo_t=false])])
2622 if test "$ac_cv_siginfo_t" = true ; then
2623 AC_DEFINE(HAVE_SIGINFO_T)
2629 dnl Check for int64, uint, and uint_t.
2630 dnl ========================================================
2631 AC_MSG_CHECKING(for int64)
2632 AC_CACHE_VAL(ac_cv_int64,
2633 [AC_TRY_COMPILE([#include <stdio.h>
2634 #include <sys/types.h>],
2637 [ac_cv_int64=false])])
2638 if test "$ac_cv_int64" = true ; then
2639 AC_DEFINE(HAVE_INT64)
2644 AC_MSG_CHECKING(for uint)
2645 AC_CACHE_VAL(ac_cv_uint,
2646 [AC_TRY_COMPILE([#include <stdio.h>
2647 #include <sys/types.h>],
2650 [ac_cv_uint=false])])
2651 if test "$ac_cv_uint" = true ; then
2652 AC_DEFINE(HAVE_UINT)
2657 AC_MSG_CHECKING(for uint_t)
2658 AC_CACHE_VAL(ac_cv_uint_t,
2659 [AC_TRY_COMPILE([#include <stdio.h>
2660 #include <sys/types.h>],
2662 [ac_cv_uint_t=true],
2663 [ac_cv_uint_t=false])])
2664 if test "$ac_cv_uint_t" = true ; then
2665 AC_DEFINE(HAVE_UINT_T)
2671 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2672 dnl are defined when compiling C++ but not C. Since the result of this
2673 dnl test is used only in C++, do it in C++.
2676 AC_MSG_CHECKING(for uname.domainname)
2677 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2678 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2679 [ struct utsname *res; char *domain;
2680 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2681 [ac_cv_have_uname_domainname_field=true],
2682 [ac_cv_have_uname_domainname_field=false])])
2684 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2685 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2691 AC_MSG_CHECKING(for uname.__domainname)
2692 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2693 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2694 [ struct utsname *res; char *domain;
2695 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2696 [ac_cv_have_uname_us_domainname_field=true],
2697 [ac_cv_have_uname_us_domainname_field=false])])
2699 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2700 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2706 dnl Check whether we can use gcc's c++0x mode
2709 if test "$GNU_CXX"; then
2710 _SAVE_CXXFLAGS=$CXXFLAGS
2711 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2713 AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2714 ac_cv_cxx0x_headers_bug,
2715 [AC_TRY_COMPILE([#include <memory>], [],
2716 ac_cv_cxx0x_headers_bug="no",
2717 ac_cv_cxx0x_headers_bug="yes")])
2718 CXXFLAGS="$_SAVE_CXXFLAGS"
2719 if test "$ac_cv_cxx0x_headers_bug" = "no"; then
2720 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2724 dnl Check for usable char16_t (2 bytes, unsigned)
2725 dnl (we might not need the unsignedness check anymore)
2726 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2727 ac_cv_have_usable_char16_t,
2728 [AC_TRY_COMPILE([$configure_static_assert_macros],
2729 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2730 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2731 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2732 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2733 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2734 ac_cv_have_usable_char16_t="yes",
2735 ac_cv_have_usable_char16_t="no")])
2736 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2737 AC_DEFINE(HAVE_CPP_CHAR16_T)
2739 elif test "$GNU_CXX"; then
2740 CXXFLAGS="$_SAVE_CXXFLAGS"
2743 dnl Check for usable wchar_t (2 bytes, unsigned)
2744 dnl (we really don't need the unsignedness check anymore)
2745 dnl ========================================================
2747 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2748 ac_cv_have_usable_wchar_v2,
2749 [AC_TRY_COMPILE([#include <stddef.h>
2750 $configure_static_assert_macros],
2751 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2752 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2753 ac_cv_have_usable_wchar_v2="yes",
2754 ac_cv_have_usable_wchar_v2="no")])
2755 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2756 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2757 HAVE_CPP_2BYTE_WCHAR_T=1
2758 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2759 dnl This is really gcc-only
2760 dnl Do this test using CXX only since some versions of gcc
2761 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2762 dnl only have short-wchar support for c++.
2763 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2765 _SAVE_CXXFLAGS=$CXXFLAGS
2766 CXXFLAGS="$CXXFLAGS -fshort-wchar"
2768 AC_CACHE_CHECK(for compiler -fshort-wchar option,
2769 ac_cv_have_usable_wchar_option_v2,
2770 [AC_TRY_LINK([#include <stddef.h>
2771 $configure_static_assert_macros],
2772 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2773 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2774 ac_cv_have_usable_wchar_option_v2="yes",
2775 ac_cv_have_usable_wchar_option_v2="no")])
2777 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2778 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2779 HAVE_CPP_2BYTE_WCHAR_T=1
2780 if test "$OS_TARGET" = Android; then
2781 WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
2782 CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
2783 CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
2784 DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
2786 WCHAR_CFLAGS="-fshort-wchar"
2789 CXXFLAGS=$_SAVE_CXXFLAGS
2795 dnl Check for .hidden assembler directive and visibility attribute.
2796 dnl Borrowed from glibc configure.in
2797 dnl ===============================================================
2798 if test "$GNU_CC"; then
2799 AC_CACHE_CHECK(for visibility(hidden) attribute,
2800 ac_cv_visibility_hidden,
2801 [cat > conftest.c <<EOF
2802 int foo __attribute__ ((visibility ("hidden"))) = 1;
2804 ac_cv_visibility_hidden=no
2805 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2806 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2807 ac_cv_visibility_hidden=yes
2812 if test "$ac_cv_visibility_hidden" = "yes"; then
2813 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2815 AC_CACHE_CHECK(for visibility(default) attribute,
2816 ac_cv_visibility_default,
2817 [cat > conftest.c <<EOF
2818 int foo __attribute__ ((visibility ("default"))) = 1;
2820 ac_cv_visibility_default=no
2821 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2822 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2823 ac_cv_visibility_default=yes
2828 if test "$ac_cv_visibility_default" = "yes"; then
2829 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2831 AC_CACHE_CHECK(for visibility pragma support,
2832 ac_cv_visibility_pragma,
2833 [cat > conftest.c <<EOF
2834 #pragma GCC visibility push(hidden)
2836 #pragma GCC visibility push(default)
2837 int foo_default = 1;
2839 ac_cv_visibility_pragma=no
2840 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2841 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2842 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2843 ac_cv_visibility_pragma=yes
2849 if test "$ac_cv_visibility_pragma" = "yes"; then
2850 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2851 ac_cv_have_visibility_class_bug,
2852 [cat > conftest.c <<EOF
2853 #pragma GCC visibility push(hidden)
2854 struct __attribute__ ((visibility ("default"))) TestStruct {
2857 __attribute__ ((visibility ("default"))) void TestFunc() {
2861 ac_cv_have_visibility_class_bug=no
2862 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2863 ac_cv_have_visibility_class_bug=yes
2865 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2866 ac_cv_have_visibility_class_bug=yes
2869 rm -rf conftest.{c,S}
2872 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2873 ac_cv_have_visibility_builtin_bug,
2874 [cat > conftest.c <<EOF
2875 #pragma GCC visibility push(hidden)
2876 #pragma GCC visibility push(default)
2878 #pragma GCC visibility pop
2880 __attribute__ ((visibility ("default"))) void Func() {
2882 memset(c, 0, sizeof(c));
2885 ac_cv_have_visibility_builtin_bug=no
2886 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2887 ac_cv_have_visibility_builtin_bug=yes
2889 if test `grep -c "@PLT" conftest.S` = 0; then
2890 ac_cv_visibility_builtin_bug=yes
2893 rm -f conftest.{c,S}
2895 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2896 "$ac_cv_have_visibility_class_bug" = "no"; then
2897 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2898 WRAP_SYSTEM_INCLUDES=1
2899 STL_FLAGS='-I$(DIST)/stl_wrappers'
2902 VISIBILITY_FLAGS='-fvisibility=hidden'
2903 fi # have visibility pragma bug
2904 fi # have visibility pragma
2905 fi # have visibility(default) attribute
2906 fi # have visibility(hidden) attribute
2909 # visibility hidden flag for Sun Studio on Solaris
2910 if test "$SOLARIS_SUNPRO_CC"; then
2911 VISIBILITY_FLAGS='-xldscope=hidden'
2912 fi # Sun Studio on Solaris
2914 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2915 AC_SUBST(VISIBILITY_FLAGS)
2921 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2922 dnl ========================================================
2923 if test "$GNU_CC"; then
2924 CFLAGS_save="${CFLAGS}"
2925 CFLAGS="${CFLAGS} -Werror"
2926 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2927 ac_cv_force_align_arg_pointer,
2928 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2930 ac_cv_force_align_arg_pointer="yes",
2931 ac_cv_force_align_arg_pointer="no")])
2932 CFLAGS="${CFLAGS_save}"
2933 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2934 HAVE_GCC_ALIGN_ARG_POINTER=1
2936 HAVE_GCC_ALIGN_ARG_POINTER=
2939 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2941 dnl Checks for header files.
2942 dnl ========================================================
2944 case "$target_os" in
2946 # for stuff like -lXshm
2947 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2950 MOZ_CHECK_COMMON_HEADERS
2952 dnl These are all the places some variant of statfs can be hiding.
2953 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2956 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2957 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2959 dnl SCTP support - needs various network include headers
2960 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2962 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2964 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2965 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2966 ac_cv_sockaddr_in_sin_len,
2967 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2968 #include <sys/types.h>
2970 #include <netinet/in.h>
2971 struct sockaddr_in x;
2972 void *foo = (void*) &x.sin_len;],
2974 [ac_cv_sockaddr_in_sin_len=true],
2975 [ac_cv_sockaddr_in_sin_len=false])])
2976 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2977 AC_DEFINE(HAVE_SIN_LEN)
2978 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2979 AC_DEFINE(HAVE_SCONN_LEN)
2982 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2983 ac_cv_sockaddr_in6_sin6_len,
2984 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2985 #include <sys/types.h>
2987 #include <netinet/in.h>
2988 struct sockaddr_in6 x;
2989 void *foo = (void*) &x.sin6_len;],
2991 [ac_cv_sockaddr_in6_sin6_len=true],
2992 [ac_cv_sockaddr_in6_sin6_len=false])])
2993 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2994 AC_DEFINE(HAVE_SIN6_LEN)
2997 AC_CACHE_CHECK(for sockaddr.sa_len,
2998 ac_cv_sockaddr_sa_len,
2999 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
3000 #include <sys/types.h>
3002 #include <sys/socket.h>
3004 void *foo = (void*) &x.sa_len;],
3006 [ac_cv_sockaddr_sa_len=true],
3007 [ac_cv_sockaddr_sa_len=false])])
3008 if test "$ac_cv_sockaddr_sa_len" = true ; then
3009 AC_DEFINE(HAVE_SA_LEN)
3012 dnl Check whether the compiler supports the new-style C++ standard
3013 dnl library headers (i.e. <new>) or needs the old "new.h"
3016 MOZ_CHECK_HEADER(new, [NEW_H=new])
3017 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3020 AC_ARG_ENABLE(dtrace,
3021 [ --enable-dtrace build with dtrace support if available (default=no)],
3022 [enable_dtrace="yes"],)
3023 if test "x$enable_dtrace" = "xyes"; then
3024 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3025 if test -n "$HAVE_DTRACE"; then
3026 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3028 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3031 AC_SUBST(HAVE_DTRACE)
3037 MOZ_CHECK_HEADERS(sys/cdefs.h)
3041 MOZ_LINUX_PERF_EVENT
3043 dnl Checks for libraries.
3044 dnl ========================================================
3049 AC_CHECK_LIB(c_r, gethostbyname_r)
3053 dnl We don't want to link with libdl even if it's present on OS X, since
3054 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3056 dnl We don't want to link against libm or libpthread on Darwin since
3057 dnl they both are just symlinks to libSystem and explicitly linking
3058 dnl against libSystem causes issues when debugging (see bug 299601).
3065 AC_SEARCH_LIBS(dlopen, dl,
3066 MOZ_CHECK_HEADER(dlfcn.h,
3067 AC_DEFINE(HAVE_DLOPEN)))
3071 _SAVE_CFLAGS="$CFLAGS"
3072 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3073 AC_CHECK_FUNCS(dladdr memmem)
3074 CFLAGS="$_SAVE_CFLAGS"
3076 if test ! "$GNU_CXX"; then
3080 AC_CHECK_LIB(C_r, demangle)
3083 AC_CHECK_LIB(C, demangle)
3088 dnl OS/2 has socket in libc.
3093 AC_CHECK_LIB(socket, socket)
3097 XLIBS="$X_EXTRA_LIBS"
3099 dnl ========================================================
3100 dnl Checks for X libraries.
3101 dnl Ordering is important.
3102 dnl Xt is dependent upon SM as of X11R6
3103 dnl ========================================================
3104 if test "$no_x" = "yes"; then
3107 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3108 XLIBS="-lX11 $XLIBS"
3109 _SAVE_LDFLAGS="$LDFLAGS"
3110 LDFLAGS="$XLDFLAGS $LDFLAGS"
3111 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3112 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3113 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3114 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3116 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3117 unset ac_cv_lib_Xt_XtFree
3118 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3119 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3120 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3121 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3124 # AIX needs the motif library linked before libXt to prevent
3125 # crashes in plugins linked against Motif - Bug #98892
3126 case "${target_os}" in
3128 XT_LIBS="-lXm $XT_LIBS"
3132 dnl ========================================================
3133 dnl = Check for XShm
3134 dnl ========================================================
3135 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3138 dnl ========================================================
3140 dnl ========================================================
3141 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3142 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3143 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3144 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3146 LDFLAGS="$_SAVE_LDFLAGS"
3156 dnl ========================================================
3157 dnl = pthread support
3158 dnl = Start by checking whether the system support pthreads
3159 dnl ========================================================
3160 case "$target_os" in
3165 MOZ_CHECK_PTHREADS(pthreads,
3166 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3167 MOZ_CHECK_PTHREADS(pthread,
3168 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3169 MOZ_CHECK_PTHREADS(c_r,
3170 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3171 MOZ_CHECK_PTHREADS(c,
3180 dnl ========================================================
3181 dnl Check the command line for --with-pthreads
3182 dnl ========================================================
3183 MOZ_ARG_WITH_BOOL(pthreads,
3184 [ --with-pthreads Force use of system pthread library with NSPR ],
3185 [ if test "$USE_PTHREADS"x = x; then
3186 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3192 dnl ========================================================
3193 dnl Do the platform specific pthread hackery
3194 dnl ========================================================
3195 if test "$USE_PTHREADS"x != x
3198 dnl See if -pthread is supported.
3201 ac_cv_have_dash_pthread=no
3202 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3203 echo 'int main() { return 0; }' | cat > conftest.c
3204 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3205 if test $? -eq 0; then
3206 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3207 ac_cv_have_dash_pthread=yes
3208 case "$target_os" in
3210 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3213 CFLAGS="$CFLAGS -pthread"
3214 CXXFLAGS="$CXXFLAGS -pthread"
3220 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3223 dnl See if -pthreads is supported.
3225 ac_cv_have_dash_pthreads=no
3226 if test "$ac_cv_have_dash_pthread" = "no"; then
3227 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3228 echo 'int main() { return 0; }' | cat > conftest.c
3229 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3230 if test $? -eq 0; then
3231 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3232 ac_cv_have_dash_pthreads=yes
3233 CFLAGS="$CFLAGS -pthreads"
3234 CXXFLAGS="$CXXFLAGS -pthreads"
3238 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3243 AC_DEFINE(_REENTRANT)
3244 AC_DEFINE(_THREAD_SAFE)
3245 dnl -pthread links in -lpthread, so don't specify it explicitly.
3246 if test "$ac_cv_have_dash_pthread" = "yes"; then
3247 _PTHREAD_LDFLAGS="-pthread"
3251 *-*-openbsd*|*-*-bsdi*)
3252 AC_DEFINE(_REENTRANT)
3253 AC_DEFINE(_THREAD_SAFE)
3254 dnl -pthread links in -lc_r, so don't specify it explicitly.
3255 if test "$ac_cv_have_dash_pthread" = "yes"; then
3256 _PTHREAD_LDFLAGS="-pthread"
3260 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3261 AC_DEFINE(_REENTRANT)
3265 AC_DEFINE(_REENTRANT)
3269 AC_DEFINE(_REENTRANT)
3273 AC_DEFINE(_REENTRANT)
3274 if test "$SOLARIS_SUNPRO_CC"; then
3275 CFLAGS="$CFLAGS -mt"
3276 CXXFLAGS="$CXXFLAGS -mt"
3280 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3284 dnl Checks for library functions.
3285 dnl ========================================================
3286 AC_PROG_GCC_TRADITIONAL
3288 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf memmove rint stat64 lstat64 truncate64 setbuf isatty)
3289 AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
3290 AC_CHECK_FUNCS(flockfile getpagesize)
3291 AC_CHECK_FUNCS(localtime_r strtok_r)
3293 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3294 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3295 ac_cv_clock_monotonic,
3296 [for libs in "" -lrt; do
3299 AC_TRY_LINK([#include <time.h>],
3300 [ struct timespec ts;
3301 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3302 ac_cv_clock_monotonic=$libs
3305 ac_cv_clock_monotonic=no)
3308 if test "$ac_cv_clock_monotonic" != "no"; then
3309 HAVE_CLOCK_MONOTONIC=1
3310 REALTIME_LIBS=$ac_cv_clock_monotonic
3311 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3312 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3313 AC_SUBST(REALTIME_LIBS)
3316 dnl check for wcrtomb/mbrtowc
3317 dnl =======================================================================
3318 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3321 AC_CACHE_CHECK(for wcrtomb,
3323 [AC_TRY_LINK([#include <wchar.h>],
3324 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3325 ac_cv_have_wcrtomb="yes",
3326 ac_cv_have_wcrtomb="no")])
3327 if test "$ac_cv_have_wcrtomb" = "yes"; then
3328 AC_DEFINE(HAVE_WCRTOMB)
3330 AC_CACHE_CHECK(for mbrtowc,
3332 [AC_TRY_LINK([#include <wchar.h>],
3333 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3334 ac_cv_have_mbrtowc="yes",
3335 ac_cv_have_mbrtowc="no")])
3336 if test "$ac_cv_have_mbrtowc" = "yes"; then
3337 AC_DEFINE(HAVE_MBRTOWC)
3344 ac_cv_func_res_ninit,
3347 #define _BSD_SOURCE 1
3351 [int foo = res_ninit(&_res);],
3352 [ac_cv_func_res_ninit=yes],
3353 [ac_cv_func_res_ninit=no])
3356 if test "$ac_cv_func_res_ninit" = "yes"; then
3357 AC_DEFINE(HAVE_RES_NINIT)
3358 dnl must add the link line we do something as foolish as this... dougt
3360 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3361 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3366 [for gnu_get_libc_version()],
3367 ac_cv_func_gnu_get_libc_version,
3369 #ifdef HAVE_GNU_LIBC_VERSION_H
3370 #include <gnu/libc-version.h>
3373 [const char *glibc_version = gnu_get_libc_version();],
3374 [ac_cv_func_gnu_get_libc_version=yes],
3375 [ac_cv_func_gnu_get_libc_version=no]
3379 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3380 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3384 darwin*|mingw*|os2*)
3388 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3389 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3390 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3392 LIBS="$LIBS $_ICONV_LIBS"
3401 iconv_t h = iconv_open("", "");
3402 iconv(h, NULL, NULL, NULL, NULL);
3405 [ac_cv_func_iconv=yes],
3406 [ac_cv_func_iconv=no]
3409 if test "$ac_cv_func_iconv" = "yes"; then
3410 AC_DEFINE(HAVE_ICONV)
3411 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3412 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3413 LIBICONV="$_ICONV_LIBS"
3415 [for iconv() with const input],
3416 ac_cv_func_const_iconv,
3422 const char *input = "testing";
3423 iconv_t h = iconv_open("", "");
3424 iconv(h, &input, NULL, NULL, NULL);
3427 [ac_cv_func_const_iconv=yes],
3428 [ac_cv_func_const_iconv=no]
3431 if test "$ac_cv_func_const_iconv" = "yes"; then
3432 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3444 dnl **********************
3445 dnl *** va_copy checks ***
3446 dnl **********************
3447 dnl we currently check for all three va_copy possibilities, so we get
3448 dnl all results in config.log for bug reports.
3449 AC_MSG_CHECKING(for an implementation of va_copy())
3450 AC_CACHE_VAL(ac_cv_va_copy,[
3453 void f (int i, ...) {
3454 va_list args1, args2;
3455 va_start (args1, i);
3456 va_copy (args2, args1);
3457 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3459 va_end (args1); va_end (args2);
3461 int main() { f (0, 42); return 0; }],
3467 AC_MSG_RESULT($ac_cv_va_copy)
3468 AC_MSG_CHECKING(for an implementation of __va_copy())
3469 AC_CACHE_VAL(ac_cv___va_copy,[
3472 void f (int i, ...) {
3473 va_list args1, args2;
3474 va_start (args1, i);
3475 __va_copy (args2, args1);
3476 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3478 va_end (args1); va_end (args2);
3480 int main() { f (0, 42); return 0; }],
3481 ac_cv___va_copy=yes,
3486 AC_MSG_RESULT($ac_cv___va_copy)
3487 AC_MSG_CHECKING(whether va_lists can be copied by value)
3488 AC_CACHE_VAL(ac_cv_va_val_copy,[
3491 void f (int i, ...) {
3492 va_list args1, args2;
3493 va_start (args1, i);
3495 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3497 va_end (args1); va_end (args2);
3499 int main() { f (0, 42); return 0; }],
3500 ac_cv_va_val_copy=yes,
3501 ac_cv_va_val_copy=no,
3502 ac_cv_va_val_copy=yes
3505 if test "x$ac_cv_va_copy" = "xyes"; then
3506 AC_DEFINE(VA_COPY, va_copy)
3507 AC_DEFINE(HAVE_VA_COPY)
3508 elif test "x$ac_cv___va_copy" = "xyes"; then
3509 AC_DEFINE(VA_COPY, __va_copy)
3510 AC_DEFINE(HAVE_VA_COPY)
3513 if test "x$ac_cv_va_val_copy" = "xno"; then
3514 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3516 AC_MSG_RESULT($ac_cv_va_val_copy)
3518 dnl ===================================================================
3519 dnl ========================================================
3520 dnl Put your C++ language/feature checks below
3521 dnl ========================================================
3525 if test "$GNU_CC"; then
3526 if test "$CPU_ARCH" = "arm" ; then
3527 AC_CACHE_CHECK(for ARM EABI,
3531 #if defined(__ARM_EABI__)
3534 #error Not ARM EABI.
3537 ac_cv_gcc_arm_eabi="yes",
3538 ac_cv_gcc_arm_eabi="no")])
3539 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3541 ARM_ABI_PREFIX=eabi-
3543 ARM_ABI_PREFIX=oabi-
3547 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3550 dnl Check for support of modern template specialization syntax
3551 dnl Test code and requirement from scc@netscape.com.
3552 dnl Autoconf cut-and-paste job by waterson@netscape.com
3553 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3554 ac_cv_cpp_modern_specialize_template_syntax,
3555 [AC_TRY_COMPILE(template <class T> struct X { int a; };
3557 template <> struct X<Y> { double a; };,
3560 ac_cv_cpp_modern_specialize_template_syntax=yes,
3561 ac_cv_cpp_modern_specialize_template_syntax=no)])
3562 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
3563 AC_MSG_ERROR([The C++ compiler does not support template specialization])
3566 dnl Some compilers support only full specialization, and some don't.
3567 AC_CACHE_CHECK(whether partial template specialization works,
3568 ac_cv_cpp_partial_specialization,
3569 [AC_TRY_COMPILE(template <class T> class Foo {};
3570 template <class T> class Foo<T*> {};,
3572 ac_cv_cpp_partial_specialization=yes,
3573 ac_cv_cpp_partial_specialization=no)])
3574 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3575 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3578 dnl Check to see if we can resolve ambiguity with |using|.
3579 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3580 ac_cv_cpp_ambiguity_resolving_using,
3581 [AC_TRY_COMPILE(class X {
3582 public: int go(const X&) {return 3;}
3583 int jo(const X&) {return 3;}
3585 class Y : public X {
3586 public: int go(int) {return 2;}
3587 int jo(int) {return 2;}
3589 private: using X::go;
3592 ac_cv_cpp_ambiguity_resolving_using=yes,
3593 ac_cv_cpp_ambiguity_resolving_using=no)])
3594 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3595 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3598 dnl See if a dynamic_cast to void* gives the most derived object.
3599 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3600 ac_cv_cpp_dynamic_cast_void_ptr,
3601 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3602 class Y { int j; public: virtual ~Y() { } };
3603 class Z : public X, public Y { int k; };
3609 return !((((void*)&mdo != (void*)subx) &&
3610 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3611 (((void*)&mdo != (void*)suby) &&
3612 ((void*)&mdo == dynamic_cast<void*>(suby))));
3614 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3615 ac_cv_cpp_dynamic_cast_void_ptr=no,
3616 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3617 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3618 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3622 dnl note that this one is reversed - if the test fails, then
3623 dnl we require implementations of unused virtual methods. Which
3624 dnl really blows because it means we'll have useless vtable
3626 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3627 ac_cv_cpp_unused_required,
3628 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3630 ac_cv_cpp_unused_required=no,
3631 ac_cv_cpp_unused_required=yes)])
3632 if test "$ac_cv_cpp_unused_required" = yes ; then
3633 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3637 dnl Some compilers have trouble comparing a constant reference to a templatized
3638 dnl class to zero, and require an explicit operator==() to be defined that takes
3639 dnl an int. This test separates the strong from the weak.
3641 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3642 ac_cv_trouble_comparing_to_zero,
3643 [AC_TRY_COMPILE([#include <algorithm>
3644 template <class T> class Foo {};
3646 template <class T> int operator==(const T2*, const T&) { return 0; }
3647 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3648 [Foo<int> f; return (0 != f);],
3649 ac_cv_trouble_comparing_to_zero=no,
3650 ac_cv_trouble_comparing_to_zero=yes)])
3651 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3652 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3655 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3656 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3657 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3659 _SAVE_LDFLAGS=$LDFLAGS
3660 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3661 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3662 ac_cv_thread_keyword,
3663 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3664 [return tlsIsMainThread;],
3665 ac_cv_thread_keyword=yes,
3666 ac_cv_thread_keyword=no)])
3667 LDFLAGS=$_SAVE_LDFLAGS
3668 # The custom dynamic linker doesn't support TLS variables
3670 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3671 # mips builds fail with TLS variables because of a binutils bug.
3673 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3678 *-android*|*-linuxandroid*)
3685 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3691 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3692 if test -n "$MOZ_LINKER"; then
3693 if test "$CPU_ARCH" = arm; then
3694 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3695 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3696 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3697 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3702 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3703 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3704 dnl We however want to avoid these text relocations, and this can be done
3705 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3706 dnl doesn't contain anything at all, beside placeholders for some sections,
3707 dnl and crtbegin only contains a finalizer function that calls
3708 dnl __cxa_finalize. The custom linker actually takes care of calling
3709 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3710 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3711 dnl link crtbegin and crtend at all.
3712 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3713 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3714 ac_cv_crt_has_text_relocations,
3715 [echo 'int foo() { return 0; }' > conftest.cpp
3716 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3717 test -s conftest${DLL_SUFFIX}; then
3718 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3719 ac_cv_crt_has_text_relocations=yes
3721 ac_cv_crt_has_text_relocations=no
3724 AC_ERROR([couldn't compile a simple C file])
3727 if test "$ac_cv_crt_has_text_relocations" = yes; then
3728 dnl While we want libraries to skip the CRT files, we don't want
3729 dnl executables to be treated the same way. We thus set the flag
3730 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3731 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3732 dnl Using LDFLAGS in nspr is safe, since we only really build
3733 dnl libraries there.
3734 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3735 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3739 dnl Check for the existence of various allocation headers/functions
3741 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3744 for file in $MALLOC_HEADERS; do
3745 MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3746 if test "$MALLOC_H" != ""; then
3747 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3752 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3753 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3755 AC_CHECK_FUNCS(malloc_usable_size)
3757 dnl See if compiler supports some gcc-style attributes
3759 AC_CACHE_CHECK(for __attribute__((always_inline)),
3760 ac_cv_attribute_always_inline,
3761 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3763 ac_cv_attribute_always_inline=yes,
3764 ac_cv_attribute_always_inline=no)])
3766 AC_CACHE_CHECK(for __attribute__((malloc)),
3767 ac_cv_attribute_malloc,
3768 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3770 ac_cv_attribute_malloc=yes,
3771 ac_cv_attribute_malloc=no)])
3773 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3774 ac_cv_attribute_warn_unused,
3775 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3777 ac_cv_attribute_warn_unused=yes,
3778 ac_cv_attribute_warn_unused=no)])
3780 dnl End of C++ language/feature checks
3783 dnl ========================================================
3784 dnl = Internationalization checks
3785 dnl ========================================================
3787 dnl Internationalization and Locale support is different
3788 dnl on various UNIX platforms. Checks for specific i18n
3789 dnl features go here.
3791 dnl check for LC_MESSAGES
3792 AC_CACHE_CHECK(for LC_MESSAGES,
3793 ac_cv_i18n_lc_messages,
3794 [AC_TRY_COMPILE([#include <locale.h>],
3795 [int category = LC_MESSAGES;],
3796 ac_cv_i18n_lc_messages=yes,
3797 ac_cv_i18n_lc_messages=no)])
3798 if test "$ac_cv_i18n_lc_messages" = yes; then
3799 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3802 AC_HAVE_FUNCS(localeconv)
3803 fi # ! SKIP_COMPILER_CHECKS
3806 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3807 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3810 dnl Mozilla specific options
3811 dnl ========================================================
3812 dnl The macros used for command line options
3813 dnl are defined in build/autoconf/altoptions.m4.
3815 dnl If the compiler supports these attributes, define them as
3816 dnl convenience macros.
3817 if test "$ac_cv_attribute_malloc" = yes ; then
3818 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3820 AC_DEFINE(NS_ATTR_MALLOC,)
3823 if test "$ac_cv_attribute_warn_unused" = yes ; then
3824 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3826 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3829 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3830 dnl features that Windows actually does support.
3832 if test -n "$SKIP_COMPILER_CHECKS"; then
3833 dnl Windows has malloc.h
3834 AC_DEFINE(MALLOC_H, [<malloc.h>])
3835 AC_DEFINE(HAVE_FORCEINLINE)
3836 AC_DEFINE(HAVE_LOCALECONV)
3837 fi # SKIP_COMPILER_CHECKS
3839 dnl ========================================================
3841 dnl = Check for external package dependencies
3843 dnl ========================================================
3844 MOZ_ARG_HEADER(External Packages)
3846 MOZ_ARG_WITH_STRING(libxul-sdk,
3847 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3848 LIBXUL_SDK_DIR=$withval)
3850 if test "$LIBXUL_SDK_DIR" = "yes"; then
3851 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3852 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3853 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3855 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3856 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3860 AC_SUBST(LIBXUL_SDK)
3862 if test -n "$LIBXUL_SDK"; then
3863 LIBXUL_DIST="$LIBXUL_SDK"
3865 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3867 AC_SUBST(LIBXUL_DIST)
3871 MOZ_ARG_WITH_BOOL(system-libxul,
3872 [ --with-system-libxul Use system installed libxul SDK],
3875 dnl ========================================================
3876 dnl = If NSPR was not detected in the system,
3877 dnl = use the one in the source tree (mozilla/nsprpub)
3878 dnl ========================================================
3879 MOZ_ARG_WITH_BOOL(system-nspr,
3880 [ --with-system-nspr Use system installed NSPR],
3881 _USE_SYSTEM_NSPR=1 )
3883 if test -n "$_USE_SYSTEM_NSPR"; then
3884 AM_PATH_NSPR(4.9.6, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
3887 if test -n "$MOZ_NATIVE_NSPR"; then
3888 _SAVE_CFLAGS=$CFLAGS
3889 CFLAGS="$CFLAGS $NSPR_CFLAGS"
3890 AC_TRY_COMPILE([#include "prtypes.h"],
3891 [#ifndef PR_STATIC_ASSERT
3892 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3894 [MOZ_NATIVE_NSPR=1],
3895 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3896 AC_TRY_COMPILE([#include "prtypes.h"],
3898 #error PR_UINT64 not defined or requires including prtypes.h
3900 [MOZ_NATIVE_NSPR=1],
3901 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3902 CFLAGS=$_SAVE_CFLAGS
3904 if test -z "$LIBXUL_SDK"; then
3905 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3906 if test -n "$GNU_CC"; then
3907 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3909 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3912 NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3913 NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3917 dnl set GRE_MILESTONE
3918 dnl ========================================================
3919 if test -n "$LIBXUL_SDK"; then
3920 GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3922 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3924 AC_SUBST(GRE_MILESTONE)
3926 dnl system libevent Support
3927 dnl ========================================================
3928 MOZ_ARG_WITH_STRING(system-libevent,
3929 [ --with-system-libevent[=PFX]
3930 Use system libevent [installed at prefix PFX]],
3931 LIBEVENT_DIR=$withval)
3933 _SAVE_CFLAGS=$CFLAGS
3934 _SAVE_LDFLAGS=$LDFLAGS
3936 if test "$LIBEVENT_DIR" = yes; then
3937 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3938 MOZ_NATIVE_LIBEVENT=1,
3941 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3942 MOZ_NATIVE_LIBEVENT=
3943 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3944 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3945 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3946 MOZ_CHECK_HEADER(event.h,
3947 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3948 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3950 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3951 AC_CHECK_LIB(event, event_init,
3952 [MOZ_NATIVE_LIBEVENT=1
3953 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3954 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3955 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3957 CFLAGS=$_SAVE_CFLAGS
3958 LDFLAGS=$_SAVE_LDFLAGS
3961 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3962 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
3963 AC_SUBST(MOZ_LIBEVENT_LIBS)
3965 dnl ========================================================
3966 dnl = If NSS was not detected in the system,
3967 dnl = use the one in the source tree (mozilla/security/nss)
3968 dnl ========================================================
3970 MOZ_ARG_WITH_BOOL(system-nss,
3971 [ --with-system-nss Use system installed NSS],
3974 if test -n "$_USE_SYSTEM_NSS"; then
3975 AM_PATH_NSS(3.14.3, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3978 if test -n "$MOZ_NATIVE_NSS"; then
3979 NSS_LIBS="$NSS_LIBS -lcrmf"
3981 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3982 if test -z "$IMPORT_LIB_SUFFIX"; then
3983 DLL_LINK_SUFFIX='$(DLL_SUFFIX)'
3985 DLL_LINK_SUFFIX='.$(IMPORT_LIB_SUFFIX)'
3988 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3989 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION${DLL_LINK_SUFFIX} \
3990 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION${DLL_LINK_SUFFIX} \
3991 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION${DLL_LINK_SUFFIX} \
3992 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION${DLL_LINK_SUFFIX}"
3994 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
3996 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3997 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3998 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3999 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4000 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4002 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4006 dnl ======================
4008 dnl ======================
4010 AC_MSG_CHECKING([for YASM assembler])
4011 AC_CHECK_PROGS(YASM, yasm, "")
4013 if test -n "$YASM"; then
4014 dnl Pull out yasm's version string
4015 YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
4016 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4017 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4018 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4019 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4022 if test -z "$SKIP_LIBRARY_CHECKS"; then
4023 dnl system JPEG support
4024 dnl ========================================================
4025 MOZ_ARG_WITH_STRING(system-jpeg,
4026 [ --with-system-jpeg[=PFX]
4027 Use system libjpeg [installed at prefix PFX]],
4030 _SAVE_CFLAGS=$CFLAGS
4031 _SAVE_LDFLAGS=$LDFLAGS
4033 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4034 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4035 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4037 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4040 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
4043 if test "$MOZ_NATIVE_JPEG" = 1; then
4044 AC_TRY_COMPILE([ #include <stdio.h>
4045 #include <sys/types.h>
4046 #include <jpeglib.h> ],
4047 [ #if JPEG_LIB_VERSION < $MOZJPEG
4048 #error "Insufficient JPEG library version ($MOZJPEG required)."
4050 #ifndef JCS_EXTENSIONS
4051 #error "libjpeg-turbo JCS_EXTENSIONS required"
4055 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
4057 CFLAGS=$_SAVE_CFLAGS
4058 LDFLAGS=$_SAVE_LDFLAGS
4061 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
4062 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
4063 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
4065 fi # SKIP_LIBRARY_CHECKS
4067 dnl system ZLIB support
4068 dnl ========================================================
4069 MOZ_ZLIB_CHECK([1.2.3])
4071 if test "$MOZ_NATIVE_ZLIB" != 1; then
4073 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
4076 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
4077 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4080 if test -z "$SKIP_LIBRARY_CHECKS"; then
4081 dnl system BZIP2 Support
4082 dnl ========================================================
4083 MOZ_ARG_WITH_STRING(system-bz2,
4084 [ --with-system-bz2[=PFX]
4085 Use system libbz2 [installed at prefix PFX]],
4088 _SAVE_CFLAGS=$CFLAGS
4089 _SAVE_LDFLAGS=$LDFLAGS
4091 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4092 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4093 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4095 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4098 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
4099 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
4101 CFLAGS=$_SAVE_CFLAGS
4102 LDFLAGS=$_SAVE_LDFLAGS
4105 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
4106 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
4107 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4110 dnl system PNG Support
4111 dnl ========================================================
4112 MOZ_ARG_WITH_STRING(system-png,
4113 [ --with-system-png[=PFX]
4114 Use system libpng [installed at prefix PFX]],
4117 _SAVE_CFLAGS=$CFLAGS
4118 _SAVE_LDFLAGS=$LDFLAGS
4120 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4121 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4122 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4124 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4127 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
4128 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4129 AC_CHECK_LIB(png, png_get_acTL, ,
4130 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
4132 if test "$MOZ_NATIVE_PNG" = 1; then
4133 AC_TRY_COMPILE([ #include <stdio.h>
4134 #include <sys/types.h>
4136 [ #if PNG_LIBPNG_VER < $MOZPNG
4137 #error "Insufficient libpng version ($MOZPNG required)."
4139 #ifndef PNG_UINT_31_MAX
4140 #error "Insufficient libpng version."
4143 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4145 CFLAGS=$_SAVE_CFLAGS
4146 LDFLAGS=$_SAVE_LDFLAGS
4149 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
4150 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
4151 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
4154 fi # SKIP_LIBRARY_CHECKS
4156 dnl system HunSpell Support
4157 dnl ========================================================
4158 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4159 [ --enable-system-hunspell
4160 Use system hunspell (located with pkgconfig)],
4161 MOZ_NATIVE_HUNSPELL=1 )
4163 if test -n "$MOZ_NATIVE_HUNSPELL"; then
4164 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4167 AC_SUBST(MOZ_NATIVE_HUNSPELL)
4169 dnl ========================================================
4170 dnl system libffi Support
4171 dnl ========================================================
4172 MOZ_ARG_ENABLE_BOOL(system-ffi,
4173 [ --enable-system-ffi Use system libffi (located with pkgconfig)],
4176 if test -n "$MOZ_NATIVE_FFI"; then
4177 # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4178 # for non-GCC compilers.
4179 if test -z "$GNU_CC"; then
4180 PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4182 PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4184 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4187 dnl ========================================================
4188 dnl Java SDK support
4189 dnl ========================================================
4192 MOZ_ARG_WITH_STRING(java-bin-path,
4193 [ --with-java-bin-path=dir
4194 Location of Java binaries (java, javac, jar)],
4195 JAVA_BIN_PATH=$withval)
4197 dnl ========================================================
4201 dnl ========================================================
4203 MOZ_ARG_HEADER(Application)
4206 ENABLE_SYSTEM_EXTENSION_DIRS=1
4207 MOZ_BRANDING_DIRECTORY=
4208 MOZ_OFFICIAL_BRANDING=
4213 MOZ_AUTH_EXTENSION=1
4216 MOZ_SPEEX_RESAMPLER=1
4222 MOZ_SAMPLE_TYPE_FLOAT32=
4223 MOZ_SAMPLE_TYPE_S16=
4232 MOZ_WEBRTC_SIGNALING=
4233 MOZ_WEBRTC_IN_LIBXUL=
4236 MOZ_MEDIA_NAVIGATOR=
4239 MOZ_VP8_ERROR_CONCEALMENT=
4250 LIBJPEG_TURBO_ASFLAGS=
4251 LIBJPEG_TURBO_X86_ASM=
4252 LIBJPEG_TURBO_X64_ASM=
4253 LIBJPEG_TURBO_ARM_ASM=
4257 MOZ_PREF_EXTENSIONS=1
4258 MOZ_PROFILELOCKING=1
4265 MOZ_ONLY_TOUCH_EVENTS=
4266 MOZ_TOOLKIT_SEARCH=1
4268 MOZ_UNIVERSALCHARDET=1
4274 MOZ_DISABLE_CRYPTOLEGACY=
4278 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4281 MOZ_USE_NATIVE_POPUP_WINDOWS=
4282 MOZ_ANDROID_HISTORY=
4284 MOZ_ANDROID_WALLPAPER=
4289 MOZ_AUDIO_CHANNEL_MANAGER=
4291 case "$target_os" in
4294 AC_DEFINE(NS_ENABLE_TSF)
4299 *-android*|*-linuxandroid*)
4300 if test "$CPU_ARCH" = "arm" ; then
4305 if test -z "$gonkdir"; then
4310 MOZ_THEME_FASTSTRIPE=1
4318 MOZ_ARG_WITH_STRING(external-source-dir,
4319 [ --with-external-source-dir=dir
4320 External directory containing additional build files.],
4321 [ EXTERNAL_SOURCE_DIR=$withval])
4322 AC_SUBST(EXTERNAL_SOURCE_DIR)
4324 MOZ_ARG_ENABLE_STRING(application,
4325 [ --enable-application=APP
4329 tools/update-packaging (AUS-related packaging tools)],
4330 [ MOZ_BUILD_APP=$enableval ] )
4332 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4333 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4334 XULRUNNER_STUB_NAME=$withval)
4336 if test -z "$XULRUNNER_STUB_NAME"; then
4337 case "$target_os" in
4339 XULRUNNER_STUB_NAME=xulrunner
4342 XULRUNNER_STUB_NAME=xulrunner-stub
4345 AC_SUBST(XULRUNNER_STUB_NAME)
4347 AC_MSG_CHECKING([for application to build])
4348 if test -z "$MOZ_BUILD_APP"; then
4349 AC_MSG_RESULT([browser])
4350 MOZ_BUILD_APP=browser
4352 # "mobile" no longer exists.
4353 if test "$MOZ_BUILD_APP" = "mobile" ; then
4354 AC_MSG_RESULT([none])
4355 AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
4357 # We have a valid application only if it has a build.mk file in its top
4359 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4360 AC_MSG_RESULT([none])
4361 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4363 AC_MSG_RESULT([$MOZ_BUILD_APP])
4367 # The app update channel is 'default' when not supplied. The value is used in
4368 # the application's confvars.sh so it must be set before confvars.sh is called.
4369 MOZ_ARG_ENABLE_STRING([update-channel],
4370 [ --enable-update-channel=CHANNEL
4371 Select application update channel (default=default)],
4372 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4374 if test -z "$MOZ_UPDATE_CHANNEL"; then
4375 MOZ_UPDATE_CHANNEL=default
4377 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4378 AC_SUBST(MOZ_UPDATE_CHANNEL)
4380 # Allow the application to influence configure with a confvars.sh script.
4382 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4383 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4384 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4385 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4390 # Allow the application to provide a subconfigure script
4391 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4392 do_output_subdirs() {
4393 if test -n "$_subconfigure_subdirs"; then
4394 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4396 _subconfigure_subdir="$1"
4397 _subconfigure_config_args="$ac_configure_args"
4399 tmpscript=`python -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4400 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4401 "${srcdir}/build/autoconf/altoptions.m4" \
4402 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4407 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4408 MOZ_ARG_WITH_STRING(app-name,
4409 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4410 WITH_APP_NAME=$withval,
4413 if test -n "$WITH_APP_NAME" ; then
4414 MOZ_APP_NAME="$WITH_APP_NAME"
4417 MOZ_ARG_WITH_STRING(app-basename,
4418 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4419 WITH_APP_BASENAME=$withval,
4422 if test -n "$WITH_APP_BASENAME" ; then
4423 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4426 # Now is a good time to test for logic errors, define mismatches, etc.
4427 case "$MOZ_BUILD_APP" in
4429 if test "$LIBXUL_SDK"; then
4430 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4435 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4436 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4438 case "$MOZ_BUILD_APP" in
4440 AC_DEFINE(MOZ_PHOENIX)
4444 AC_DEFINE(MOZ_XULRUNNER)
4451 AC_SUBST(MOZ_BUILD_APP)
4452 AC_SUBST(MOZ_PHOENIX)
4453 AC_SUBST(MOZ_XULRUNNER)
4456 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4458 dnl ========================================================
4459 dnl Check android sdk version depending on mobile target
4460 dnl ========================================================
4462 if test -z "$gonkdir" ; then
4463 # Minimum Android SDK API Level we require.
4464 case "$MOZ_BUILD_APP" in
4466 android_min_api_level=16
4470 MOZ_ANDROID_SDK($android_min_api_level)
4473 dnl ========================================================
4475 dnl = Toolkit Options
4477 dnl ========================================================
4478 MOZ_ARG_HEADER(Toolkit Options)
4480 dnl ========================================================
4481 dnl = Select the default toolkit
4482 dnl ========================================================
4483 MOZ_ARG_ENABLE_STRING(default-toolkit,
4484 [ --enable-default-toolkit=TK
4485 Select default toolkit
4486 Platform specific defaults:
4487 Mac OS X - cairo-cocoa
4489 Win32 - cairo-windows
4492 [ _DEFAULT_TOOLKIT=$enableval ],
4493 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4495 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4496 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4497 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4498 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4499 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4500 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4501 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4502 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4503 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4505 dnl nglayout only supports building with one toolkit,
4506 dnl so ignore everything after the first comma (",").
4507 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4509 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4512 MOZ_ARG_WITHOUT_BOOL(x,
4513 [ --without-x Build without X11],
4516 dnl ========================================================
4517 dnl = Enable the toolkit as needed =
4518 dnl ========================================================
4522 case "$MOZ_WIDGET_TOOLKIT" in
4525 MOZ_WIDGET_TOOLKIT=windows
4528 MOZ_INSTRUMENT_EVENT_LOOP=1
4531 cairo-gtk2|cairo-gtk2-x11)
4532 MOZ_WIDGET_TOOLKIT=gtk2
4534 MOZ_ENABLE_XREMOTE=1
4536 MOZ_GL_DEFAULT_PROVIDER=GLX
4542 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4543 TK_LIBS='$(MOZ_GTK2_LIBS)'
4544 AC_DEFINE(MOZ_WIDGET_GTK2)
4546 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4548 MOZ_INSTRUMENT_EVENT_LOOP=1
4552 MOZ_WIDGET_TOOLKIT=qt
4554 if test -z "$WITHOUT_X11"; then
4555 MOZ_ENABLE_XREMOTE=1
4556 MOZ_GL_DEFAULT_PROVIDER=GLX
4565 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4566 TK_LIBS='$(MOZ_QT_LIBS)'
4567 AC_DEFINE(MOZ_WIDGET_QT)
4569 AC_DEFINE(QT_NO_KEYWORDS)
4573 MOZ_WIDGET_TOOLKIT=os2
4575 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4576 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4581 MOZ_WIDGET_TOOLKIT=cocoa
4582 AC_DEFINE(MOZ_WIDGET_COCOA)
4583 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4584 TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4585 TK_CFLAGS="-DNO_X11"
4586 CFLAGS="$CFLAGS $TK_CFLAGS"
4587 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4588 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4589 MOZ_USER_DIR="Mozilla"
4590 MOZ_FS_LAYOUT=bundle
4592 MOZ_INSTRUMENT_EVENT_LOOP=1
4596 MOZ_WIDGET_TOOLKIT=uikit
4597 AC_DEFINE(MOZ_WIDGET_UIKIT)
4598 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4599 TK_CFLAGS="-DNO_X11"
4600 TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4601 CFLAGS="$CFLAGS $TK_CFLAGS"
4602 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4603 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4604 MOZ_USER_DIR="Mozilla"
4605 MOZ_FS_LAYOUT=bundle
4609 AC_DEFINE(MOZ_WIDGET_ANDROID)
4610 MOZ_WIDGET_TOOLKIT=android
4611 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4612 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4615 MOZ_INSTRUMENT_EVENT_LOOP=1
4619 AC_DEFINE(MOZ_WIDGET_GONK)
4620 AC_DEFINE(MOZ_TOUCH)
4621 MOZ_WIDGET_TOOLKIT=gonk
4622 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4623 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4631 AC_SUBST(MOZ_PDF_PRINTING)
4632 if test "$MOZ_PDF_PRINTING"; then
4633 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4634 AC_DEFINE(MOZ_PDF_PRINTING)
4637 if test "$MOZ_ENABLE_XREMOTE"; then
4638 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4641 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4642 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4645 if test "$COMPILE_ENVIRONMENT"; then
4646 if test "$MOZ_ENABLE_GTK2"; then
4647 if test "$MOZ_X11"; then
4648 GDK_PACKAGES=gdk-x11-2.0
4651 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4654 fi # COMPILE_ENVIRONMENT
4656 AC_SUBST(MOZ_FS_LAYOUT)
4658 dnl ========================================================
4659 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4660 dnl their usage and use them in spidermonkey.
4661 dnl ========================================================
4662 MOZ_ARG_WITH_BOOL(arm-kuser,
4663 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4665 if test -n "$USE_ARM_KUSER"; then
4666 AC_DEFINE(USE_ARM_KUSER)
4669 dnl ========================================================
4670 dnl = startup-notification support module
4671 dnl ========================================================
4673 if test "$MOZ_ENABLE_GTK2"
4675 MOZ_ENABLE_STARTUP_NOTIFICATION=
4677 MOZ_ARG_ENABLE_BOOL(startup-notification,
4678 [ --enable-startup-notification
4679 Enable startup-notification support (default: disabled) ],
4680 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4681 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4682 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4684 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4685 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4686 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4687 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4689 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4691 MOZ_ENABLE_STARTUP_NOTIFICATION=
4695 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4696 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4699 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4701 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4702 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4703 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4705 dnl ========================================================
4707 dnl ========================================================
4708 if test "$MOZ_ENABLE_QT"
4710 MOZ_ARG_WITH_STRING(qtdir,
4711 [ --with-qtdir=\$dir Specify Qt directory ],
4714 if test -z "$QTDIR"; then
4715 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
4716 PKG_CHECK_MODULES(MOZ_QT5, Qt5Widgets Qt5Multimedia Qt5PrintSupport,
4719 if test "$MOZ_ENABLE_QT5"; then
4721 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
4722 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
4725 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4726 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4728 MOZ_QT_CFLAGS="-DQT_SHARED"
4729 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4730 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4731 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4732 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4733 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4734 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4736 # QtWidgets was introduced only in Qt5
4737 if test -d $QTDIR/include/QtWidgets; then
4739 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml -lQt5OpenGL"
4740 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/5.0.1/QtGui"
4741 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4742 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4743 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4745 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4746 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4748 HOST_MOC="$QTDIR/bin/moc"
4749 HOST_RCC="$QTDIR/bin/rcc"
4751 if test -z "$HOST_MOC"; then
4752 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4755 if test -z "$HOST_RCC"; then
4756 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4763 MOZ_ENABLE_QMSYSTEM2=
4764 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4765 MOZ_ENABLE_QMSYSTEM2=1,
4766 MOZ_ENABLE_QMSYSTEM2=)
4768 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4769 MOZ_ENABLE_QMSYSTEM2=1
4770 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4771 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4772 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4775 MOZ_ENABLE_QTNETWORK=
4776 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4777 MOZ_ENABLE_QTNETWORK=1,
4778 MOZ_ENABLE_QTNETWORK=)
4780 if test "$MOZ_ENABLE_QTNETWORK"; then
4781 MOZ_ENABLE_QTNETWORK=1
4782 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4785 MOZ_ENABLE_QTMOBILITY=
4786 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4787 MOZ_ENABLE_QTMOBILITY=1,
4788 MOZ_ENABLE_QTMOBILITY=)
4789 if test "$MOZ_ENABLE_QTMOBILITY"; then
4790 MOZ_ENABLE_QTMOBILITY=1
4791 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4792 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4794 AC_CHECK_LIB(QtSensors, main, [
4795 MOZ_ENABLE_QTMOBILITY=1
4796 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4797 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4798 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4799 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4800 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4803 if test "$MOZ_ENABLE_QTMOBILITY"; then
4804 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4808 AC_SUBST(GTK_CONFIG)
4812 AC_SUBST(MOZ_ENABLE_GTK2)
4813 AC_SUBST(MOZ_ENABLE_QT)
4814 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4815 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4816 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4817 AC_SUBST(MOZ_ENABLE_XREMOTE)
4818 AC_SUBST(MOZ_GTK2_CFLAGS)
4819 AC_SUBST(MOZ_GTK2_LIBS)
4820 AC_SUBST(MOZ_WIDGET_GTK)
4821 AC_SUBST(MOZ_QT_CFLAGS)
4822 AC_SUBST(MOZ_QT_LIBS)
4829 dnl ========================================================
4831 dnl = Components & Features
4833 dnl ========================================================
4834 MOZ_ARG_HEADER(Components and Features)
4836 dnl ========================================================
4838 dnl ========================================================
4839 MOZ_ARG_ENABLE_STRING(ui-locale,
4840 [ --enable-ui-locale=ab-CD
4841 Select the user interface locale (default: en-US)],
4842 MOZ_UI_LOCALE=$enableval )
4843 AC_SUBST(MOZ_UI_LOCALE)
4845 dnl ========================================================
4846 dnl = Trademarked Branding
4847 dnl ========================================================
4848 MOZ_ARG_ENABLE_BOOL(official-branding,
4849 [ --enable-official-branding
4850 Enable Official mozilla.org Branding
4851 Do not distribute builds with
4852 --enable-official-branding unless you have
4853 permission to use trademarks per
4854 http://www.mozilla.org/foundation/trademarks/ .],
4856 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4857 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4859 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4860 MOZ_OFFICIAL_BRANDING=1
4862 ], MOZ_OFFICIAL_BRANDING=)
4864 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4865 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4866 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4869 MOZ_ARG_WITH_STRING(branding,
4870 [ --with-branding=dir Use branding from the specified directory.],
4871 MOZ_BRANDING_DIRECTORY=$withval)
4873 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4874 if test -z "$REAL_BRANDING_DIRECTORY"; then
4875 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4878 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4879 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4882 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4884 dnl ========================================================
4885 dnl = Distribution ID
4886 dnl ========================================================
4887 MOZ_ARG_WITH_STRING(distribution-id,
4888 [ --with-distribution-id=ID
4889 Set distribution-specific id (default=org.mozilla)],
4890 [ val=`echo $withval`
4891 MOZ_DISTRIBUTION_ID="$val"])
4893 if test -z "$MOZ_DISTRIBUTION_ID"; then
4894 MOZ_DISTRIBUTION_ID="org.mozilla"
4897 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4898 AC_SUBST(MOZ_DISTRIBUTION_ID)
4901 dnl ========================================================
4902 dnl complex text support off by default
4903 dnl ========================================================
4904 MOZ_ARG_DISABLE_BOOL(pango,
4905 [ --disable-pango Disable usage of Pango ],
4909 dnl ========================================================
4911 dnl ========================================================
4912 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4916 if test "$MOZ_PANGO"
4918 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4920 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4921 AC_SUBST(MOZ_PANGO_CFLAGS)
4922 AC_SUBST(MOZ_PANGO_LIBS)
4923 AC_DEFINE(MOZ_PANGO)
4925 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
4926 AC_SUBST(FT2_CFLAGS)
4931 dnl ========================================================
4932 dnl = GnomeVFS, GIO and GConf support module
4933 dnl ========================================================
4937 dnl build the GIO extension by default only when the
4938 dnl GTK2 toolkit is in use.
4939 if test "$MOZ_ENABLE_GTK2"
4945 dnl ========================================================
4946 dnl = GnomeVFS support module
4947 dnl ========================================================
4948 MOZ_ARG_ENABLE_BOOL(gnomevfs,
4949 [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
4950 MOZ_ENABLE_GNOMEVFS=force,
4951 MOZ_ENABLE_GNOMEVFS=)
4953 if test "$MOZ_ENABLE_GNOMEVFS"
4955 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4956 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4957 MOZ_ENABLE_GNOMEVFS=1
4958 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4960 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4962 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4964 MOZ_ENABLE_GNOMEVFS=
4968 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4969 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4970 AC_SUBST(MOZ_GNOMEVFS_LIBS)
4972 dnl ========================================================
4973 dnl = GIO support module
4974 dnl ========================================================
4975 MOZ_ARG_DISABLE_BOOL(gio,
4976 [ --disable-gio Disable GIO support],
4978 MOZ_ENABLE_GIO=force)
4980 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
4982 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4983 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4984 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4985 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4987 AC_DEFINE(MOZ_ENABLE_GIO)
4989 if test "$MOZ_ENABLE_GIO" = "force"
4991 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4997 AC_SUBST(MOZ_ENABLE_GIO)
4998 AC_SUBST(MOZ_GIO_CFLAGS)
4999 AC_SUBST(MOZ_GIO_LIBS)
5001 dnl ========================================================
5002 dnl = GConf support module
5003 dnl ========================================================
5004 MOZ_ARG_DISABLE_BOOL(gconf,
5005 [ --disable-gconf Disable Gconf support ],
5007 MOZ_ENABLE_GCONF=force)
5009 if test "$MOZ_ENABLE_GCONF"
5011 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5012 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
5015 if test "$MOZ_ENABLE_GCONF" = "force"
5017 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5023 if test "$MOZ_ENABLE_GCONF"; then
5024 AC_DEFINE(MOZ_ENABLE_GCONF)
5027 AC_SUBST(MOZ_ENABLE_GCONF)
5028 AC_SUBST(MOZ_GCONF_CFLAGS)
5029 AC_SUBST(MOZ_GCONF_LIBS)
5032 dnl ========================================================
5033 dnl = libproxy support
5034 dnl ========================================================
5036 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5038 MOZ_ENABLE_LIBPROXY=
5040 MOZ_ARG_ENABLE_BOOL(libproxy,
5041 [ --enable-libproxy Enable libproxy support ],
5042 MOZ_ENABLE_LIBPROXY=1,
5043 MOZ_ENABLE_LIBPROXY=)
5045 if test "$MOZ_ENABLE_LIBPROXY"
5047 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5048 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5051 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5052 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5053 AC_SUBST(MOZ_LIBPROXY_LIBS)
5055 dnl ========================================================
5056 dnl = GNOME component (mozgnome)
5057 dnl ========================================================
5059 if test "$MOZ_ENABLE_GTK2"
5061 MOZ_ENABLE_GNOME_COMPONENT=1
5063 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5065 dnl ========================================================
5066 dnl = libgnomeui support module
5067 dnl ========================================================
5069 if test "$MOZ_ENABLE_GTK2"
5071 MOZ_ARG_ENABLE_BOOL(gnomeui,
5072 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
5073 MOZ_ENABLE_GNOMEUI=force,
5074 MOZ_ENABLE_GNOMEUI=)
5076 if test "$MOZ_ENABLE_GNOMEUI"
5078 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5080 MOZ_ENABLE_GNOMEUI=1
5082 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5084 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5090 if test "$MOZ_ENABLE_GNOMEUI"; then
5091 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5095 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5096 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5098 dnl ========================================================
5100 dnl ========================================================
5102 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5106 MOZ_ARG_DISABLE_BOOL(dbus,
5107 [ --disable-dbus Disable dbus support ],
5111 if test "$MOZ_ENABLE_DBUS"
5113 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5114 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5115 AC_DEFINE(MOZ_ENABLE_DBUS)
5118 AC_SUBST(MOZ_ENABLE_DBUS)
5119 AC_SUBST(MOZ_DBUS_CFLAGS)
5120 AC_SUBST(MOZ_DBUS_LIBS)
5121 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5122 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5124 dnl ========================================================
5125 dnl = Enable Android History instead of Places
5126 dnl ========================================================
5127 if test -n "$MOZ_ANDROID_HISTORY"; then
5128 if test -z "$MOZ_PLACES"; then
5129 AC_DEFINE(MOZ_ANDROID_HISTORY)
5131 AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
5135 dnl ========================================================
5136 dnl = Build with the Android compositor
5137 dnl ========================================================
5138 if test -n "$MOZ_ANDROID_OMTC"; then
5139 dnl Do this if defined in confvars.sh
5140 AC_DEFINE(MOZ_ANDROID_OMTC)
5143 dnl ========================================================
5144 dnl = Disable WebSMS backend
5145 dnl ========================================================
5146 MOZ_ARG_DISABLE_BOOL(websms-backend,
5147 [ --disable-websms-backend
5148 Disable WebSMS backend],
5149 MOZ_WEBSMS_BACKEND=,
5150 MOZ_WEBSMS_BACKEND=1)
5152 if test -n "$MOZ_WEBSMS_BACKEND"; then
5153 AC_DEFINE(MOZ_WEBSMS_BACKEND)
5156 dnl ========================================================
5157 dnl = Enable SET_WALLPAPER permission on Android
5158 dnl ========================================================
5159 if test -n "$MOZ_ANDROID_WALLPAPER"; then
5160 AC_DEFINE(MOZ_ANDROID_WALLPAPER)
5163 dnl ========================================================
5164 dnl = Build Personal Security Manager
5165 dnl ========================================================
5166 MOZ_ARG_DISABLE_BOOL(crypto,
5167 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5171 dnl ========================================================
5172 dnl = JS Debugger XPCOM component (js/jsd)
5173 dnl ========================================================
5174 MOZ_ARG_DISABLE_BOOL(jsd,
5175 [ --disable-jsd Disable JavaScript debug library],
5180 dnl ========================================================
5181 dnl = Enable IPDL's "expensive" unit tests
5182 dnl ========================================================
5185 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5186 [ --enable-ipdl-tests Enable expensive IPDL tests],
5190 if test -n "$MOZ_IPDL_TESTS"; then
5191 AC_DEFINE(MOZ_IPDL_TESTS)
5194 AC_SUBST(MOZ_IPDL_TESTS)
5196 dnl ========================================================
5197 dnl = Turns off code necessary for e10s compatibility
5198 dnl ========================================================
5199 dnl This is a temporary flag to be removed in bug 662601 when
5200 dnl it's no longer needed
5204 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5205 [ --enable-e10s-compat Turns off code for e10s compat],
5209 if test -n "$MOZ_E10S_COMPAT"; then
5210 AC_DEFINE(MOZ_E10S_COMPAT)
5213 dnl ========================================================
5214 dnl = Disable building dbm
5215 dnl ========================================================
5216 MOZ_ARG_DISABLE_BOOL(dbm,
5217 [ --disable-dbm Disable building dbm],
5221 dnl bi-directional support always on
5225 dnl ========================================================
5226 dnl accessibility support on by default on all platforms
5227 dnl ========================================================
5228 MOZ_ARG_DISABLE_BOOL(accessibility,
5229 [ --disable-accessibility Disable accessibility support],
5232 if test "$ACCESSIBILITY"; then
5235 if test -z "$MIDL"; then
5236 if test "$GCC" != "yes"; then
5237 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5239 AC_MSG_ERROR([You have accessibility enabled, but widl could not be found. Add --disable-accessibility to your mozconfig or install widl. See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details.])
5243 AC_DEFINE(ACCESSIBILITY)
5246 dnl ========================================================
5247 dnl Accessibility is required for the linuxgl widget
5249 dnl ========================================================
5250 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5251 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5254 dnl ========================================================
5255 dnl Disable printing
5256 dnl ========================================================
5257 MOZ_ARG_DISABLE_BOOL(printing,
5258 [ --disable-printing Disable printing support],
5262 if test "$NS_PRINTING"; then
5263 AC_DEFINE(NS_PRINTING)
5264 AC_DEFINE(NS_PRINT_PREVIEW)
5267 dnl Turn off webrtc for OS's we don't handle yet, but allow
5268 dnl --enable-webrtc to override. Can disable for everything in
5269 dnl the master list above.
5270 if test -n "$MOZ_WEBRTC"; then
5272 *-android*|*-linuxandroid*)
5273 if test -n "$MOZ_B2G"; then
5276 dnl Make sure doesn't get matched by *-linux*
5280 *-linux*|*-mingw*|*-darwin*)
5284 dnl default to disabled for all others
5290 dnl ========================================================
5291 dnl = Disable WebRTC code
5292 dnl ========================================================
5293 MOZ_ARG_DISABLE_BOOL(webrtc,
5294 [ --disable-webrtc Disable support for WebRTC],
5298 if test -n "$MOZ_WEBRTC"; then
5299 AC_DEFINE(MOZ_WEBRTC)
5304 MOZ_VP8_ERROR_CONCEALMENT=1
5306 if test "$MOZ_WIDGET_TOOLKIT" != "gonk"; then
5307 dnl OpenSLES is only available in Android 2.3 and later; we'll change this
5308 dnl hard dependency to a dynamic load with graceful runtime failure before
5309 dnl we make --enable-webrtc on by default in Android (bug 815905)
5311 if test "$OS_TARGET" = "Android"; then
5312 LDFLAGS="$LDFLAGS -lOpenSLES"
5315 *-android*|*-linuxandroid*)
5316 LDFLAGS="$LDFLAGS -lOpenSLES"
5321 dnl enable once Signaling lands
5322 MOZ_WEBRTC_SIGNALING=1
5323 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5324 if test "${OS_TARGET}" = "WINNT"; then
5325 MOZ_WEBRTC_IN_LIBXUL=1
5327 dnl enable once PeerConnection lands
5328 MOZ_PEERCONNECTION=1
5329 AC_DEFINE(MOZ_PEERCONNECTION)
5336 AC_SUBST(MOZ_WEBRTC)
5337 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5338 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5339 AC_SUBST(MOZ_PEERCONNECTION)
5340 AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
5344 case "$target_cpu" in
5346 MOZ_SAMPLE_TYPE_S16=1
5347 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5348 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5351 MOZ_SAMPLE_TYPE_FLOAT32=1
5352 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5353 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5357 dnl ========================================================
5358 dnl = Enable Raw Codecs
5359 dnl ========================================================
5360 MOZ_ARG_ENABLE_BOOL(raw,
5361 [ --enable-raw Enable support for RAW media],
5365 if test -n "$MOZ_RAW"; then
5372 dnl ========================================================
5373 dnl = Disable Ogg Codecs
5374 dnl ========================================================
5375 MOZ_ARG_DISABLE_BOOL(ogg,
5376 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5380 if test -n "$MOZ_OGG"; then
5385 dnl Checks for __attribute__(aligned()) directive
5386 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5387 [ac_cv_c_attribute_aligned],
5388 [ac_cv_c_attribute_aligned=0
5389 CFLAGS_save="${CFLAGS}"
5390 CFLAGS="${CFLAGS} -Werror"
5391 for ac_cv_c_attr_align_try in 64 32 16 8; do
5392 echo "trying $ac_cv_c_attr_align_try"
5394 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5395 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5396 if test "$ac_cv_c_attribute_aligned" != 0; then
5400 CFLAGS="${CFLAGS_save}"])
5401 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5402 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5403 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5407 dnl ========================================================
5408 dnl = Disable Opus audio codec support
5409 dnl ========================================================
5410 MOZ_ARG_DISABLE_BOOL(opus,
5411 [ --disable-opus Disable support for Opus audio],
5415 dnl ========================================================
5416 dnl = Disable VP8 decoder support
5417 dnl ========================================================
5418 MOZ_ARG_DISABLE_BOOL(webm,
5419 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5423 if test -n "$MOZ_WEBM"; then
5428 dnl ========================================================
5429 dnl = Disable DASH-WebM support
5430 dnl ========================================================
5431 MOZ_ARG_DISABLE_BOOL(dash,
5432 [ --disable-dash Disable support for DASH-WebM],
5436 if test -n "$MOZ_DASH"; then
5437 if test -n "$MOZ_WEBM"; then
5440 dnl Fail if WebM is not enabled as well as DASH.
5441 AC_MSG_ERROR([WebM is currently disabled and must be enabled for DASH
5447 dnl ========================================================
5448 dnl = Windows Media Foundation support
5449 dnl ========================================================
5450 if test "$OS_ARCH" = "WINNT"; then
5451 dnl Enable Windows Media Foundation support by default.
5452 dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5453 dnl guaranteed to have a recent-enough SDK to build WMF.
5457 MOZ_ARG_DISABLE_BOOL(wmf,
5458 [ --disable-wmf Disable support for Windows Media Foundation],
5462 if test -n "$MOZ_WMF"; then
5468 dnl ========================================================
5469 dnl = Enable media plugin support
5470 dnl ========================================================
5471 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5472 dnl Enable support on android by default
5476 MOZ_ARG_ENABLE_BOOL(media-plugins,
5477 [ --enable-media-plugins Enable support for media plugins],
5478 MOZ_MEDIA_PLUGINS=1,
5481 if test -n "$MOZ_MEDIA_PLUGINS"; then
5482 AC_DEFINE(MOZ_MEDIA_PLUGINS)
5485 dnl ========================================================
5486 dnl = Enable getUserMedia support
5487 dnl ========================================================
5488 MOZ_ARG_ENABLE_BOOL(media-navigator,
5489 [ --enable-media-navigator Enable support for getUserMedia],
5490 MOZ_MEDIA_NAVIGATOR=1,
5491 MOZ_MEDIA_NAVIGATOR=)
5493 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5494 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5497 dnl ========================================================
5498 dnl = Enable building OMX media plugin (B2G or Android)
5499 dnl ========================================================
5500 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5501 dnl Enable support on android by default
5505 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5506 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5510 if test -n "$MOZ_OMX_PLUGIN"; then
5511 if test "$OS_TARGET" = "Android"; then
5512 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5513 AC_DEFINE(MOZ_OMX_PLUGIN)
5515 dnl fail if we're not building on Gonk or Android
5516 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5520 dnl system libvpx Support
5521 dnl ========================================================
5522 MOZ_ARG_WITH_BOOL(system-libvpx,
5523 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5524 MOZ_NATIVE_LIBVPX=1)
5529 if test -n "$MOZ_VP8"; then
5531 if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5532 AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5534 if test -n "$MOZ_VP8_ENCODER" ; then
5535 AC_DEFINE(MOZ_VP8_ENCODER)
5538 if test -n "$MOZ_NATIVE_LIBVPX"; then
5539 dnl ============================
5540 dnl === libvpx Version check ===
5541 dnl ============================
5542 dnl Check to see if we have a system libvpx package.
5543 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5545 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5546 [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.])])
5549 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5550 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5555 AC_SUBST(MOZ_NATIVE_LIBVPX)
5556 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5557 AC_SUBST(MOZ_LIBVPX_LIBS)
5559 if test "$MOZ_WEBM"; then
5562 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5569 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5571 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5572 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5573 dnl We currently require gcc on all arm platforms.
5576 VPX_NEED_OBJ_INT_EXTRACT=
5578 dnl See if we have assembly on this platform.
5579 case "$OS_ARCH:$CPU_ARCH" in
5581 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5585 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5589 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5593 dnl Check for yasm 1.1 or greater.
5594 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5595 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.])
5596 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5597 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.])
5599 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5601 dnl The encoder needs obj_int_extract to get asm offsets.
5605 if test -n "$GNU_AS" ; then
5607 dnl These flags are a lie; they're just used to enable the requisite
5608 dnl opcodes; actual arch detection is done at runtime.
5609 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5610 VPX_DASH_C_FLAG="-c"
5611 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5612 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5617 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5618 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5623 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5624 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5630 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5631 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.])
5634 if test -n "$MOZ_VP8_ENCODER" -a \
5635 -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5636 dnl We prefer to get asm offsets using inline assembler, which the above
5637 dnl compilers can do. When we're not using one of those, we have to fall
5638 dnl back to obj_int_extract, which reads them from a compiled object
5639 dnl file. Unfortunately, that only works if we're compiling on a system
5640 dnl with the header files for the appropriate object file format.
5641 VPX_NEED_OBJ_INT_EXTRACT=1
5644 if test -n "$VPX_X86_ASM"; then
5645 AC_DEFINE(VPX_X86_ASM)
5646 elif test -n "$VPX_ARM_ASM"; then
5647 AC_DEFINE(VPX_ARM_ASM)
5649 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5653 dnl ========================================================
5654 dnl = Disable Wave decoder support
5655 dnl ========================================================
5656 MOZ_ARG_DISABLE_BOOL(wave,
5657 [ --disable-wave Disable Wave decoder support],
5661 if test -n "$MOZ_WAVE"; then
5667 dnl ========================================================
5668 dnl = Handle dependent CUBEB and MEDIA defines
5669 dnl ========================================================
5671 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5672 AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5675 if test -n "$MOZ_SOUNDTOUCH"; then
5676 AC_DEFINE(MOZ_SOUNDTOUCH)
5679 if test -n "$MOZ_CUBEB"; then
5680 AC_DEFINE(MOZ_CUBEB)
5683 if test -n "$MOZ_MEDIA"; then
5684 AC_DEFINE(MOZ_MEDIA)
5687 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5688 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/])
5691 if test -n "$MOZ_VORBIS"; then
5692 AC_DEFINE(MOZ_VORBIS)
5695 if test -n "$MOZ_TREMOR"; then
5696 AC_DEFINE(MOZ_TREMOR)
5699 if test -n "$MOZ_OPUS"; then
5703 if test -n "$MOZ_WEBVTT"; then
5704 AC_DEFINE(MOZ_WEBVTT)
5707 dnl ========================================================
5708 dnl = Check alsa availability on Linux if using sydneyaudio
5709 dnl ========================================================
5711 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5712 if test -n "$MOZ_CUBEB" -a "$OS_TARGET" = "Linux"; then
5716 MOZ_ARG_ENABLE_BOOL(alsa,
5717 [ --enable-alsa Enable Alsa support (default on Linux)],
5721 if test -n "$MOZ_ALSA"; then
5722 AC_DEFINE(MOZ_CUBEB)
5723 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5724 [echo "$MOZ_ALSA_PKG_ERRORS"
5725 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.)])])
5729 AC_SUBST(MOZ_ALSA_CFLAGS)
5730 AC_SUBST(MOZ_ALSA_LIBS)
5732 dnl ========================================================
5733 dnl = Enable PulseAudio
5734 dnl ========================================================
5736 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5737 [ --enable-pulseaudio Enable PulseAudio support (experimental)],
5741 if test -n "$MOZ_PULSEAUDIO"; then
5742 AC_DEFINE(MOZ_CUBEB)
5743 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5744 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5745 AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
5748 AC_SUBST(MOZ_PULSEAUDIO)
5749 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5750 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5752 dnl ========================================================
5753 dnl = Enable GStreamer
5754 dnl ========================================================
5755 MOZ_ARG_ENABLE_BOOL(gstreamer,
5756 [ --enable-gstreamer Enable GStreamer support],
5760 if test "$MOZ_GSTREAMER"; then
5761 # API version, eg 0.10, 1.0 etc
5762 GST_API_VERSION=0.10
5763 # core/base release number
5765 PKG_CHECK_MODULES(GSTREAMER,
5766 gstreamer-$GST_API_VERSION >= $GST_VERSION
5767 gstreamer-app-$GST_API_VERSION
5768 gstreamer-plugins-base-$GST_API_VERSION)
5769 if test -n "$GSTREAMER_LIBS"; then
5770 _SAVE_LDFLAGS=$LDFLAGS
5771 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5772 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5773 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5774 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5776 AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
5778 LDFLAGS=$_SAVE_LDFLAGS
5780 AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
5783 AC_SUBST(GSTREAMER_CFLAGS)
5784 AC_SUBST(GSTREAMER_LIBS)
5785 AC_SUBST(MOZ_GSTREAMER)
5787 if test -n "$MOZ_GSTREAMER"; then
5788 AC_DEFINE(MOZ_GSTREAMER)
5793 dnl ========================================================
5794 dnl Permissions System
5795 dnl ========================================================
5796 MOZ_ARG_DISABLE_BOOL(permissions,
5797 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5802 dnl ========================================================
5804 dnl ========================================================
5805 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5806 [ --disable-negotiateauth Disable GSS-API negotiation ],
5807 MOZ_AUTH_EXTENSION=,
5808 MOZ_AUTH_EXTENSION=1 )
5810 dnl ========================================================
5811 dnl Pref extensions (autoconfig)
5812 dnl ========================================================
5813 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5814 [ --disable-pref-extensions
5815 Disable pref extensions such as autoconfig],
5816 MOZ_PREF_EXTENSIONS=,
5817 MOZ_PREF_EXTENSIONS=1 )
5819 dnl ========================================================
5820 dnl Searching of system directories for extensions.
5821 dnl Note: this switch is meant to be used for test builds
5822 dnl whose behavior should not depend on what happens to be
5823 dnl installed on the local machine.
5824 dnl ========================================================
5825 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5826 [ --disable-system-extension-dirs
5827 Disable searching system- and account-global
5828 directories for extensions of any kind; use
5829 only profile-specific extension directories],
5830 ENABLE_SYSTEM_EXTENSION_DIRS=,
5831 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5832 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5833 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5836 dnl ========================================================
5837 dnl = Universalchardet
5838 dnl ========================================================
5839 MOZ_ARG_DISABLE_BOOL(universalchardet,
5840 [ --disable-universalchardet
5841 Disable universal encoding detection],
5842 MOZ_UNIVERSALCHARDET=,
5843 MOZ_UNIVERSALCHARDET=1 )
5845 if test -n "${JAVA_BIN_PATH}"; then
5846 dnl Look for javac and jar in the specified path.
5847 JAVA_PATH="$JAVA_BIN_PATH"
5849 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5850 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5853 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5854 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5855 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5856 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5858 if test -n "${JAVA_BIN_PATH}" -o \
5859 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5860 if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAVAH" -o "$JAVAH" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5861 AC_MSG_ERROR([The programs java, javac, javah and jar were not found. Set \$JAVA_HOME to your java sdk directory or use --with-java-bin-path={java-bin-dir}])
5865 dnl ========================================================
5866 dnl = ANGLE OpenGL->D3D translator for WebGL
5867 dnl = * only applies to win32
5868 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5869 dnl ========================================================
5871 MOZ_DIRECTX_SDK_PATH=
5872 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5873 MOZ_D3DCOMPILER_CAB=
5874 MOZ_D3DCOMPILER_DLL=
5875 case "$target_os" in
5877 MOZ_ANGLE_RENDERER=1
5881 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5882 case "${target_cpu}" in
5884 MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5887 MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5891 MOZ_ARG_DISABLE_BOOL(webgl,
5892 [ --disable-webgl Disable building of the WebGL implementation],
5893 MOZ_WEBGL_DISABLED=1,
5894 MOZ_WEBGL_DISABLED=)
5896 if test -n "$MOZ_WEBGL_DISABLED"; then
5901 # Locate a DirectX SDK here so we can use it for both ANGLE and
5903 if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
5904 # Get the SDK path from the registry.
5905 # First try to get the June 2010 SDK
5906 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5907 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5908 # Otherwise just take whatever comes first
5909 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5911 MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/' | sed 's,\\\\,/,g'`
5914 if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
5915 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5916 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.])
5919 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5920 test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5921 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5922 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5924 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.])
5927 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5928 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'`
5930 if test -z "$MOZ_D3DX9_VERSION" ; then
5931 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.])
5934 MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5936 if test -z "$MOZ_D3DCOMPILER_CAB"; then
5937 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.])
5940 MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5943 dnl ========================================================
5945 dnl ========================================================
5947 MOZ_GAMEPAD_BACKEND=stub
5949 # Gamepad DOM is built on supported platforms by default.
5950 case "$OS_TARGET" in
5958 MOZ_ARG_DISABLE_BOOL(gamepad,
5959 [ --disable-gamepad Disable gamepad support],
5963 if test "$MOZ_GAMEPAD"; then
5964 case "$OS_TARGET" in
5966 MOZ_GAMEPAD_BACKEND=cocoa
5969 if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
5970 if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5976 if test -z "$MOZ_GAMEPAD"; then
5977 AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for gamepad support. Please install it or, reconfigure with --disable-gamepad to disable gamepad support.])
5979 MOZ_GAMEPAD_BACKEND=windows
5982 MOZ_CHECK_HEADER([linux/joystick.h])
5983 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5984 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers or reconfigure with --disable-gamepad to disable gamepad support.])
5986 MOZ_GAMEPAD_BACKEND=linux
5992 AC_DEFINE(MOZ_GAMEPAD)
5994 AC_SUBST(MOZ_GAMEPAD)
5995 AC_SUBST(MOZ_GAMEPAD_BACKEND)
5997 dnl ========================================================
5998 dnl = Breakpad crash reporting (on by default on supported platforms)
5999 dnl ========================================================
6002 i?86-*-mingw*|x86_64-*-mingw*)
6005 i?86-apple-darwin*|x86_64-apple-darwin*)
6008 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6009 if test "$MOZ_ENABLE_GTK2"; then
6013 *-android*|*-linuxandroid*)
6021 MOZ_ARG_DISABLE_BOOL(crashreporter,
6022 [ --disable-crashreporter Disable breakpad crash reporting],
6024 MOZ_CRASHREPORTER=1)
6026 if test -n "$MOZ_CRASHREPORTER"; then
6027 AC_DEFINE(MOZ_CRASHREPORTER)
6029 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
6030 test -z "$SKIP_LIBRARY_CHECKS"; then
6031 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6032 AC_SUBST(MOZ_GTHREAD_CFLAGS)
6033 AC_SUBST(MOZ_GTHREAD_LIBS)
6036 if test "$OS_ARCH" != "$HOST_OS_ARCH"; then
6037 AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH. Use --disable-crashreporter.])
6040 if test "$OS_ARCH" = "WINNT"; then
6041 AC_DEFINE_UNQUOTED(BREAKPAD_CUSTOM_STDINT_H, "mozilla/StandardInteger.h")
6042 if test -z "$HAVE_64BIT_OS"; then
6043 MOZ_CRASHREPORTER_INJECTOR=1
6044 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
6049 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6050 [ --with-crashreporter-enable-percent=NN
6051 Enable sending crash reports by default on NN% of users. (default=100)],
6052 [ val=`echo $withval | sed 's/[^0-9]//g'`
6053 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6055 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6056 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6058 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6060 dnl ========================================================
6061 dnl = libjpeg-turbo configuration
6062 dnl ========================================================
6064 if test -z "$MOZ_NATIVE_JPEG"; then
6068 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6069 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
6071 MOZ_LIBJPEG_TURBO=1)
6073 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6074 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6077 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6080 if test -n "$MOZ_LIBJPEG_TURBO"; then
6082 dnl Do we support libjpeg-turbo on this platform?
6083 case "$OS_ARCH:$OS_TEST" in
6085 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6086 LIBJPEG_TURBO_X86_ASM=1
6089 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6090 LIBJPEG_TURBO_X64_ASM=1
6092 WINNT:x86|WINNT:i?86)
6093 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6094 LIBJPEG_TURBO_X86_ASM=1
6097 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6098 LIBJPEG_TURBO_X64_ASM=1
6101 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6102 LIBJPEG_TURBO_ARM_ASM=1
6105 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6106 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6107 LIBJPEG_TURBO_X86_ASM=1
6111 if $CC -E -dM -</dev/null | grep -q __ELF__; then
6112 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6113 LIBJPEG_TURBO_X64_ASM=1
6120 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6121 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6122 dnl it doesn't exist or we have too old of a version.
6123 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6124 AC_MSG_CHECKING([for Yasm assembler])
6125 AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
6127 if test -z "$LIBJPEG_TURBO_AS" ; then
6128 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.])
6131 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6132 dnl on Linux and 1.1 or newer everywhere else.
6133 if test "$OS_ARCH" = "Linux" ; then
6134 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
6135 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.])
6138 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6139 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.])
6144 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6145 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6146 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6147 echo "Using $AS as the assembler for ARM code."
6148 LIBJPEG_TURBO_AS=$AS
6151 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6152 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6153 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6154 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6155 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6156 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6157 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6158 dnl Warn if we're not building the optimized routines, even though the user
6159 dnl didn't specify --disable-libjpeg-turbo.
6160 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6163 dnl ========================================================
6164 dnl = Enable compilation of specific extension modules
6165 dnl ========================================================
6167 MOZ_ARG_ENABLE_STRING(extensions,
6168 [ --enable-extensions Enable extensions],
6169 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6170 if test "$option" = "yes" -o "$option" = "all"; then
6171 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6172 elif test "$option" = "no" -o "$option" = "none"; then
6174 elif test "$option" = "default"; then
6175 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6176 elif test `echo "$option" | grep -c \^-` != 0; then
6177 option=`echo $option | sed 's/^-//'`
6178 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6180 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6183 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6185 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6186 # Suppress warning on non-X11 platforms
6187 if test -n "$MOZ_X11"; then
6188 AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6190 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6193 dnl Do not build gnomevfs with libxul based apps
6194 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6195 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6198 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6199 # Suppress warning on non-X11 platforms
6200 if test -n "$MOZ_X11"; then
6201 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6203 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6206 dnl Do not build gio with libxul based apps
6207 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6208 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6211 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6213 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6215 AC_SUBST(MOZ_GIO_COMPONENT)
6217 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6218 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6219 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6223 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6225 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6226 dnl when trying to build a nonexistent extension.
6227 for extension in $MOZ_EXTENSIONS; do
6228 if test ! -d "${srcdir}/extensions/${extension}"; then
6229 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6233 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6234 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6237 dnl ========================================================
6238 dnl CSS3 Flexbox Support
6239 dnl ========================================================
6240 if test -n "$MOZ_FLEXBOX"; then
6241 AC_DEFINE(MOZ_FLEXBOX)
6244 dnl ========================================================
6245 dnl Build Freetype in the tree
6246 dnl ========================================================
6247 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6248 [ --enable-tree-freetype Enable Tree FreeType],
6249 MOZ_TREE_FREETYPE=1,
6250 MOZ_TREE_FREETYPE= )
6251 if test -n "$MOZ_TREE_FREETYPE"; then
6252 if test -n "$_WIN32_MSVC"; then
6253 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6255 AC_DEFINE(MOZ_TREE_FREETYPE)
6256 AC_SUBST(MOZ_TREE_FREETYPE)
6257 MOZ_ENABLE_CAIRO_FT=1
6258 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6259 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6260 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6261 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6263 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6264 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6265 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6266 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6267 AC_SUBST(CAIRO_FT_CFLAGS)
6270 dnl ========================================================
6272 dnl ========================================================
6273 dnl Abort Windows build if the required major version and
6274 dnl minimum minor version of Unicode NSIS isn't in the path
6275 dnl (unless in case of cross compiling, for which Unicode
6276 dnl is not yet sufficient).
6277 if test "$OS_ARCH" = "WINNT"; then
6278 REQ_NSIS_MAJOR_VER=2
6279 MIN_NSIS_MINOR_VER=46
6280 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensis)
6281 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6282 AC_MSG_RESULT([yes])
6284 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6286 if test ! "$MAKENSISU_VER" = ""; then
6287 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6288 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6290 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6291 if test "$MAKENSISU_VER" = "" || \
6292 test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6293 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6295 if test -z "$CROSS_COMPILE"; then
6296 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.])
6301 elif test -z "$CROSS_COMPILE"; then
6302 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.])
6308 dnl ========================================================
6310 dnl ========================================================
6311 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6312 [ --disable-webapp-runtime Disable Web App Runtime],
6313 MOZ_WEBAPP_RUNTIME=,
6314 MOZ_WEBAPP_RUNTIME=1)
6315 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6318 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6321 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6322 if test "$MOZ_WEBAPP_RUNTIME"; then
6323 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6326 AC_MSG_CHECKING([for tar archiver])
6327 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6328 if test -z "$TAR"; then
6329 AC_MSG_ERROR([no tar archiver found in \$PATH])
6331 AC_MSG_RESULT([$TAR])
6334 AC_MSG_CHECKING([for wget])
6335 AC_CHECK_PROGS(WGET, wget, "")
6336 AC_MSG_RESULT([$WGET])
6339 dnl ========================================================
6341 dnl ========================================================
6343 if test -n "$MOZ_SIGN_CMD"; then
6344 AC_DEFINE(MOZ_SIGNING)
6347 dnl ========================================================
6348 dnl Maintenance Service
6349 dnl ========================================================
6351 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6352 [ --enable-maintenance-service Enable building of maintenanceservice],
6353 MOZ_MAINTENANCE_SERVICE=1,
6354 MOZ_MAINTENANCE_SERVICE= )
6356 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6357 if test "$OS_ARCH" = "WINNT"; then
6358 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6360 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6364 dnl ========================================================
6365 dnl Verify MAR signatures
6366 dnl ========================================================
6368 MOZ_ARG_ENABLE_BOOL(verify-mar,
6369 [ --enable-verify-mar Enable verifying MAR signatures],
6370 MOZ_VERIFY_MAR_SIGNATURE=1,
6371 MOZ_VERIFY_MAR_SIGNATURE= )
6373 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6374 if test "$OS_ARCH" = "WINNT"; then
6375 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6377 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6381 dnl ========================================================
6382 dnl Enable building the signmar program.
6383 dnl This option is much different than the --enable-verify-mar option.
6384 dnl --enable-verify-mar is for enabling the verification check on MAR
6385 dnl files in the updater. The --enable-signmar option is for building
6386 dnl the signmar program.
6387 dnl ========================================================
6389 MOZ_ARG_ENABLE_BOOL(signmar,
6390 [ --enable-signmar Enable building the signmar program],
6391 MOZ_ENABLE_SIGNMAR=1,
6392 MOZ_ENABLE_SIGNMAR= )
6394 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6395 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6398 dnl ========================================================
6400 dnl ========================================================
6402 MOZ_ARG_DISABLE_BOOL(updater,
6403 [ --disable-updater Disable building of updater],
6407 if test -n "$MOZ_UPDATER"; then
6408 AC_DEFINE(MOZ_UPDATER)
6411 # tools/update-packaging is not checked out by default.
6412 MOZ_ARG_ENABLE_BOOL(update-packaging,
6413 [ --enable-update-packaging
6414 Enable tools/update-packaging],
6415 MOZ_UPDATE_PACKAGING=1,
6416 MOZ_UPDATE_PACKAGING= )
6417 AC_SUBST(MOZ_UPDATE_PACKAGING)
6419 dnl ========================================================
6420 dnl build the tests by default
6421 dnl ========================================================
6422 MOZ_ARG_DISABLE_BOOL(tests,
6423 [ --disable-tests Do not build test libraries & programs],
6427 # Currently GTest is linked into libxul. This means it must be off by default.
6428 # Follow up will be to generate libxul.so and libxul-test.so to let GTest
6429 # be compiled along with ENABLE_TESTS
6430 MOZ_ARG_ENABLE_BOOL(gtest,
6432 Enable GTest libxul unit test.],
6436 if test -n "$MOZ_ENABLE_GTEST"; then
6437 if test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "Linux"; then
6440 AC_DEFINE(MOZ_ENABLE_GTEST)
6441 AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6442 AC_SUBST(MOZ_ENABLE_GTEST)
6443 AC_SUBST(GTEST_HAS_RTTI)
6445 AC_MSG_ERROR([Cannot build with --enable-gtest on this platform.])
6449 dnl ========================================================
6450 dnl parental controls (for Windows Vista)
6451 dnl ========================================================
6452 MOZ_ARG_DISABLE_BOOL(parental-controls,
6453 [ --disable-parental-controls
6454 Do not build parental controls],
6455 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6456 MOZ_DISABLE_PARENTAL_CONTROLS=)
6457 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6458 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6461 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6463 dnl ========================================================
6464 dnl = Disable DOMCrypto
6465 dnl ========================================================
6466 if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
6467 AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
6469 AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
6471 dnl ========================================================
6473 dnl = Module specific options
6475 dnl ========================================================
6476 MOZ_ARG_HEADER(Individual module options)
6478 dnl ========================================================
6479 dnl = Disable feed handling components
6480 dnl ========================================================
6481 MOZ_ARG_DISABLE_BOOL(feeds,
6482 [ --disable-feeds Disable feed handling and processing components],
6485 if test -n "$MOZ_FEEDS"; then
6486 AC_DEFINE(MOZ_FEEDS)
6488 if test "$MOZ_BUILD_APP" = "browser"; then
6489 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6493 dnl ========================================================
6494 dnl Check for sqlite
6495 dnl ========================================================
6498 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6499 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6500 MOZ_NATIVE_SQLITE=1,
6501 MOZ_NATIVE_SQLITE= )
6503 if test -z "$MOZ_NATIVE_SQLITE"
6506 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6508 dnl ============================
6509 dnl === SQLite Version check ===
6510 dnl ============================
6511 dnl Check to see if the system SQLite package is new enough.
6512 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6514 dnl ==================================
6515 dnl === SQLITE_SECURE_DELETE check ===
6516 dnl ==================================
6517 dnl Check to see if the system SQLite package is compiled with
6518 dnl SQLITE_SECURE_DELETE enabled.
6519 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6520 _SAVE_CFLAGS="$CFLAGS"
6521 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6523 LIBS="$LIBS $SQLITE_LIBS"
6524 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6526 #include "sqlite3.h"
6528 int main(int argc, char **argv){
6529 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6531 ac_cv_sqlite_secure_delete=yes,
6532 ac_cv_sqlite_secure_delete=no,
6533 ac_cv_sqlite_secure_delete=no
6536 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6537 CFLAGS="$_SAVE_CFLAGS"
6539 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6540 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6543 dnl ===============================
6544 dnl === SQLITE_THREADSAFE check ===
6545 dnl ===============================
6546 dnl Check to see if the system SQLite package is compiled with
6547 dnl SQLITE_THREADSAFE enabled.
6548 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6549 _SAVE_CFLAGS="$CFLAGS"
6550 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6552 LIBS="$LIBS $SQLITE_LIBS"
6553 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6555 #include "sqlite3.h"
6557 int main(int argc, char **argv){
6558 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6560 ac_cv_sqlite_threadsafe=yes,
6561 ac_cv_sqlite_threadsafe=no,
6562 ac_cv_sqlite_threadsafe=no
6565 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6566 CFLAGS="$_SAVE_CFLAGS"
6568 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6569 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6572 dnl ================================
6573 dnl === SQLITE_ENABLE_FTS3 check ===
6574 dnl ================================
6575 dnl check to see if the system SQLite package is compiled with
6576 dnl SQLITE_ENABLE_FTS3 enabled.
6577 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6578 _SAVE_CFLAGS="$CFLAGS"
6579 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6581 LIBS="$LIBS $SQLITE_LIBS"
6582 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6584 #include "sqlite3.h"
6586 int main(int argc, char **argv){
6587 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6589 ac_cv_sqlite_enable_fts3=yes,
6590 ac_cv_sqlite_enable_fts3=no,
6591 ac_cv_sqlite_enable_fts3=no
6594 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6595 CFLAGS="$_SAVE_CFLAGS"
6597 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6598 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6601 dnl =========================================
6602 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6603 dnl =========================================
6604 dnl check to see if the system SQLite package is compiled with
6605 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6606 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6607 _SAVE_CFLAGS="$CFLAGS"
6608 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6610 LIBS="$LIBS $SQLITE_LIBS"
6611 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6613 #include "sqlite3.h"
6615 int main(int argc, char **argv){
6616 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6618 ac_cv_sqlite_enable_unlock_notify=yes,
6619 ac_cv_sqlite_enable_unlock_notify=no,
6620 ac_cv_sqlite_enable_unlock_notify=no
6623 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6624 CFLAGS="$_SAVE_CFLAGS"
6626 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6627 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6631 if test -n "$MOZ_NATIVE_SQLITE"; then
6632 AC_DEFINE(MOZ_NATIVE_SQLITE)
6634 AC_SUBST(MOZ_NATIVE_SQLITE)
6636 dnl ========================================================
6637 dnl = Enable help viewer (off by default)
6638 dnl ========================================================
6639 if test -n "$MOZ_HELP_VIEWER"; then
6640 dnl Do this if defined in confvars.sh
6641 AC_DEFINE(MOZ_HELP_VIEWER)
6644 dnl ========================================================
6645 dnl = Enable safe browsing (anti-phishing)
6646 dnl ========================================================
6647 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6648 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6649 MOZ_SAFE_BROWSING=1,
6650 MOZ_SAFE_BROWSING= )
6651 if test -n "$MOZ_SAFE_BROWSING"; then
6652 AC_DEFINE(MOZ_SAFE_BROWSING)
6654 AC_SUBST(MOZ_SAFE_BROWSING)
6656 dnl ========================================================
6657 dnl = Enable url-classifier
6658 dnl ========================================================
6659 dnl Implicitly enabled by default if building with safe-browsing
6660 if test -n "$MOZ_SAFE_BROWSING"; then
6661 MOZ_URL_CLASSIFIER=1
6663 MOZ_ARG_ENABLE_BOOL(url-classifier,
6664 [ --enable-url-classifier Enable url classifier module],
6665 MOZ_URL_CLASSIFIER=1,
6666 MOZ_URL_CLASSIFIER= )
6667 if test -n "$MOZ_URL_CLASSIFIER"; then
6668 AC_DEFINE(MOZ_URL_CLASSIFIER)
6670 AC_SUBST(MOZ_URL_CLASSIFIER)
6672 dnl ========================================================
6673 dnl = Disable zipwriter
6674 dnl ========================================================
6675 MOZ_ARG_DISABLE_BOOL(zipwriter,
6676 [ --disable-zipwriter Disable zipwriter component],
6679 AC_SUBST(MOZ_ZIPWRITER)
6681 dnl ========================================================
6683 dnl ========================================================
6684 dnl superseded by QtNetwork starting from 4.7
6685 MOZ_ENABLE_LIBCONIC=1
6687 if test -n "$MOZ_ENABLE_QT"; then
6688 if test "$MOZ_ENABLE_QTNETWORK"; then
6689 MOZ_ENABLE_LIBCONIC=
6693 MOZ_ARG_DISABLE_BOOL(libconic,
6694 [ --disable-libconic Disable libconic],
6695 MOZ_ENABLE_LIBCONIC=,
6696 MOZ_ENABLE_LIBCONIC=1 )
6698 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6699 PKG_CHECK_MODULES(LIBCONIC, conic,
6700 MOZ_ENABLE_LIBCONIC=1,
6701 MOZ_ENABLE_LIBCONIC=)
6703 if test "$MOZ_ENABLE_LIBCONIC"; then
6704 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6707 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6708 AC_SUBST(LIBCONIC_CFLAGS)
6709 AC_SUBST(LIBCONIC_LIBS)
6711 dnl ========================================================
6713 dnl ========================================================
6715 MAEMO_SDK_TARGET_VER=-1
6717 MOZ_ARG_WITH_STRING(maemo-version,
6718 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6720 MAEMO_SDK_TARGET_VER=$withval)
6722 case "$MAEMO_SDK_TARGET_VER" in
6724 MOZ_PLATFORM_MAEMO=5
6728 MOZ_PLATFORM_MAEMO=6
6732 dnl We aren't compiling for Maemo, move on.
6735 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6739 if test $MOZ_PLATFORM_MAEMO; then
6740 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6742 if test -z "$MOZ_ENABLE_DBUS"; then
6743 AC_MSG_ERROR([DBus is required when building for Maemo])
6746 MOZ_GFX_OPTIMIZE_MOBILE=1
6747 MOZ_GL_DEFAULT_PROVIDER=EGL
6748 MOZ_MAEMO_LIBLOCATION=
6750 if test $MOZ_PLATFORM_MAEMO = 5; then
6751 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6752 MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6753 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6754 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6755 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6757 AC_SUBST(XCOMPOSITE_LIBS)
6759 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6760 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6761 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6762 if test -z "$_LIB_FOUND"; then
6763 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6767 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6768 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6769 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6770 if test -z "$_LIB_FOUND"; then
6771 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6774 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6775 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6776 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6777 if test -z "$_LIB_FOUND"; then
6778 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6782 if test $MOZ_PLATFORM_MAEMO = 6; then
6784 PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6787 if test "$_LIB_FOUND"; then
6788 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6789 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6790 MOZ_ENABLE_CONTENTMANAGER=1
6791 AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6793 AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6795 AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6797 dnl ========================================================
6798 dnl = Enable meego libcontentaction
6799 dnl ========================================================
6800 MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6801 [ --enable-meegocontentaction Enable meegocontentaction support],
6802 MOZ_MEEGOCONTENTACTION=1,
6803 MOZ_MEEGOCONTENTACTION=)
6805 if test -n "$MOZ_MEEGOCONTENTACTION"; then
6807 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6808 if test "$_LIB_FOUND"; then
6809 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6810 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6811 MOZ_ENABLE_CONTENTACTION=1
6812 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6813 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6817 MOZ_ARG_ENABLE_BOOL(meegotouch,
6818 [ --enable-meegotouch Enable meegotouch support],
6819 MOZ_MEEGOTOUCHENABLED=1,
6820 MOZ_MEEGOTOUCHENABLED=)
6822 if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6823 PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6824 if test "$_LIB_FOUND"; then
6825 MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6826 MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6827 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6829 AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6834 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6835 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6836 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6837 if test "$_LIB_FOUND"; then
6838 MOZ_MAEMO_LIBLOCATION=1
6839 AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6841 AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6843 AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6845 PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6846 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6847 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6848 if test "$_LIB_FOUND"; then
6849 MOZ_ENABLE_MEEGOTOUCHSHARE=1
6850 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6852 AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6854 AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6856 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6857 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6860 dnl ========================================================
6862 dnl ========================================================
6864 MOZ_ARG_WITH_STRING(gl-provider,
6865 [ --with-gl-provider=ID
6866 Set GL provider backend type],
6867 [ val=`echo $withval`
6868 MOZ_GL_PROVIDER="$val"])
6870 if test -n "$MOZ_GL_PROVIDER"; then
6871 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6872 AC_SUBST(MOZ_GL_PROVIDER)
6873 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6875 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6876 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6878 dnl ========================================================
6879 dnl = faststripe theme
6880 dnl ========================================================
6881 MOZ_ARG_ENABLE_BOOL(faststripe,
6882 [ --enable-faststripe Use faststripe theme],
6883 MOZ_THEME_FASTSTRIPE=1,
6884 MOZ_THEME_FASTSTRIPE= )
6885 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6887 dnl ========================================================
6889 dnl = Feature options that require extra sources to be pulled
6891 dnl ========================================================
6892 dnl MOZ_ARG_HEADER(Features that require extra sources)
6894 dnl ========================================================
6896 dnl = Debugging Options
6898 dnl ========================================================
6899 MOZ_ARG_HEADER(Debugging and Optimizations)
6901 dnl ========================================================
6902 dnl = Disable building with debug info.
6903 dnl = Debugging is OFF by default
6904 dnl ========================================================
6905 if test -z "$MOZ_DEBUG_FLAGS"; then
6906 MOZ_DEBUG_FLAGS="-g"
6909 MOZ_ARG_ENABLE_STRING(debug,
6910 [ --enable-debug[=DBG] Enable building with developer debug info
6911 (using compiler flags DBG)],
6912 [ if test "$enableval" != "no"; then
6914 if test -n "$enableval" -a "$enableval" != "yes"; then
6915 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6916 _MOZ_DEBUG_FLAGS_SET=1
6923 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6924 MOZ_ARG_WITH_STRING(debug-label,
6925 [ --with-debug-label=LABELS
6926 Define DEBUG_<value> for each comma-separated
6928 [ for option in `echo $withval | sed 's/,/ /g'`; do
6929 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6932 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6934 if test -n "$MOZ_DEBUG"; then
6935 AC_MSG_CHECKING([for valid debug flags])
6936 _SAVE_CFLAGS=$CFLAGS
6937 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6938 AC_TRY_COMPILE([#include <stdio.h>],
6939 [printf("Hello World\n");],
6942 AC_MSG_RESULT([$_results])
6943 if test "$_results" = "no"; then
6944 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6946 CFLAGS=$_SAVE_CFLAGS
6949 dnl ========================================================
6950 dnl enable mobile optimizations
6951 dnl ========================================================
6952 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6953 [ --enable-mobile-optimize
6954 Enable mobile optimizations],
6955 MOZ_GFX_OPTIMIZE_MOBILE=1)
6957 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6959 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6960 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6963 dnl ========================================================
6964 dnl = Enable code optimization. ON by default.
6965 dnl ========================================================
6966 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6967 MOZ_OPTIMIZE_FLAGS="-O"
6970 MOZ_ARG_ENABLE_STRING(optimize,
6971 [ --disable-optimize Disable compiler optimization
6972 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6973 [ if test "$enableval" != "no"; then
6975 if test -n "$enableval" -a "$enableval" != "yes"; then
6976 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6981 fi ], MOZ_OPTIMIZE=1)
6983 MOZ_SET_FRAMEPTR_FLAGS
6985 if test "$COMPILE_ENVIRONMENT"; then
6986 if test -n "$MOZ_OPTIMIZE"; then
6987 AC_MSG_CHECKING([for valid optimization flags])
6988 _SAVE_CFLAGS=$CFLAGS
6989 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6990 AC_TRY_COMPILE([#include <stdio.h>],
6991 [printf("Hello World\n");],
6994 AC_MSG_RESULT([$_results])
6995 if test "$_results" = "no"; then
6996 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6998 CFLAGS=$_SAVE_CFLAGS
7000 fi # COMPILE_ENVIRONMENT
7002 AC_SUBST(MOZ_OPTIMIZE)
7003 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
7004 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7005 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7006 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
7007 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7008 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
7010 dnl ========================================================
7011 dnl = Enable generation of debug symbols
7012 dnl ========================================================
7013 MOZ_ARG_ENABLE_STRING(debug-symbols,
7014 [ --enable-debug-symbols[=DBG]
7015 Enable debugging symbols (using compiler flags DBG)],
7016 [ if test "$enableval" != "no"; then
7018 if test -n "$enableval" -a "$enableval" != "yes"; then
7019 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7020 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7022 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7028 MOZ_DEBUG_SYMBOLS=1)
7030 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7031 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7032 export MOZ_DEBUG_SYMBOLS
7035 dnl ========================================================
7036 dnl = Enable any treating of compile warnings as errors
7037 dnl ========================================================
7038 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
7039 [ --enable-warnings-as-errors
7040 Enable treating of warnings as errors],
7041 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
7042 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
7043 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
7044 WARNINGS_AS_ERRORS=''
7047 dnl ========================================================
7048 dnl = Disable runtime logging checks
7049 dnl ========================================================
7050 MOZ_ARG_DISABLE_BOOL(logging,
7051 [ --disable-logging Disable logging facilities],
7052 NS_DISABLE_LOGGING=1,
7053 NS_DISABLE_LOGGING= )
7054 if test "$NS_DISABLE_LOGGING"; then
7055 AC_DEFINE(NS_DISABLE_LOGGING)
7057 AC_DEFINE(MOZ_LOGGING)
7060 dnl ========================================================
7061 dnl = This will enable logging of addref, release, ctor, dtor.
7062 dnl ========================================================
7063 _ENABLE_LOGREFCNT=42
7064 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7065 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
7066 _ENABLE_LOGREFCNT=1,
7067 _ENABLE_LOGREFCNT= )
7068 if test "$_ENABLE_LOGREFCNT" = "1"; then
7069 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7070 elif test -z "$_ENABLE_LOGREFCNT"; then
7071 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7074 dnl ========================================================
7075 dnl moz_dump_painting
7076 dnl ========================================================
7077 MOZ_ARG_ENABLE_BOOL(dump-painting,
7078 [ --enable-dump-painting Enable paint debugging.],
7079 MOZ_DUMP_PAINTING=1,
7080 MOZ_DUMP_PAINTING= )
7081 if test -n "$MOZ_DUMP_PAINTING"; then
7082 AC_DEFINE(MOZ_DUMP_PAINTING)
7083 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
7085 if test -n "$MOZ_DEBUG"; then
7086 AC_DEFINE(MOZ_DUMP_PAINTING)
7089 dnl ========================================================
7090 dnl = Enable trace malloc
7091 dnl ========================================================
7092 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7093 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7094 [ --enable-trace-malloc Enable malloc tracing; also disables DMD and jemalloc],
7097 if test "$NS_TRACE_MALLOC"; then
7098 # Please, Mr. Linker Man, don't take away our symbol names
7099 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7101 AC_DEFINE(NS_TRACE_MALLOC)
7103 AC_SUBST(NS_TRACE_MALLOC)
7105 dnl ========================================================
7107 dnl ========================================================
7109 MOZ_ARG_ENABLE_BOOL(dmd,
7110 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
7114 if test "$NS_TRACE_MALLOC"; then # trace-malloc disables DMD
7117 if test "$MOZ_DMD"; then
7121 if test "${CPU_ARCH}" = "arm"; then
7122 CFLAGS="$CFLAGS -funwind-tables"
7123 CXXFLAGS="$CXXFLAGS -funwind-tables"
7126 MOZ_MEMORY=1 # DMD enables jemalloc
7127 MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
7131 dnl ========================================================
7132 dnl = Enable jemalloc
7133 dnl ========================================================
7134 MOZ_ARG_ENABLE_BOOL(jemalloc,
7135 [ --enable-jemalloc Replace memory allocator with jemalloc],
7139 if test "$NS_TRACE_MALLOC"; then
7143 if test "${OS_TARGET}" = "Android"; then
7144 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
7146 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
7147 dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
7148 if test -z "$GNU_CC"; then
7149 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7151 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
7154 dnl On other Unix systems, we only want to link executables against mozglue
7155 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7156 dnl On other Unix systems, where mozglue is a static library, jemalloc is
7157 dnl separated for the SDK, so we need to add it here.
7158 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
7159 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
7161 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
7162 if test -n "$GNU_CC"; then
7163 dnl And we need mozglue symbols to be exported.
7164 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
7166 if test "$MOZ_LINKER" = 1; then
7167 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
7171 dnl ========================================================
7172 dnl = Enable dynamic replacement of malloc implementation
7173 dnl ========================================================
7174 MOZ_ARG_ENABLE_BOOL(replace-malloc,
7175 [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
7176 MOZ_REPLACE_MALLOC=1,
7177 MOZ_REPLACE_MALLOC= )
7179 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
7180 dnl We don't want to enable jemalloc unconditionally because it may be a
7181 dnl deliberate choice not to enable it (bug 702250, for instance)
7182 AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
7183 elif test -n "$MOZ_REPLACE_MALLOC"; then
7184 MOZ_NATIVE_JEMALLOC=
7186 dnl Replace-malloc Mac linkage quirks
7187 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
7188 AC_CACHE_CHECK([how to do weak dynamic linking],
7189 ac_cv_weak_dynamic_linking,
7190 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
7191 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
7192 test -s conftest${DLL_SUFFIX}; then
7193 dnl There are several ways the linker can put link edit rules in a binary:
7194 dnl - classic info only (for OSX < 10.6)
7195 dnl - dyld info only
7197 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
7202 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
7207 dnl With classic info, we need to build with -flat_namespace.
7208 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
7209 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
7210 dnl forgets to set the weak flag in the dyld info.
7211 dnl See http://glandium.org/blog/?p=2764 for more details.
7213 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
7214 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
7215 dnl - "flat namespace" when -flat_namespace alone is needed
7216 dnl - "dummy library" when a dummy library and -flat_namespace are needed
7217 dnl - "compiler support" when nothing is needed
7218 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
7219 if test -n "$_CLASSIC_INFO"; then
7220 ac_cv_weak_dynamic_linking="flat namespace"
7222 ac_cv_weak_dynamic_linking="compiler support"
7225 if test -n "$_DYLD_INFO"; then
7226 ac_cv_weak_dynamic_linking="dummy library"
7228 ac_cv_weak_dynamic_linking="flat namespace"
7232 AC_ERROR([couldn't compile a simple C file])
7235 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
7238 AC_SUBST(MOZ_REPLACE_MALLOC)
7239 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
7241 dnl ========================================================
7242 dnl = Jemalloc build setup
7243 dnl ========================================================
7244 if test -z "$MOZ_MEMORY"; then
7245 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
7246 MOZ_NATIVE_JEMALLOC=1
7247 AC_CHECK_FUNCS(mallctl nallocm,,
7248 [MOZ_NATIVE_JEMALLOC=
7250 if test -n "$MOZ_NATIVE_JEMALLOC"; then
7252 AC_DEFINE(MOZ_MEMORY)
7253 AC_DEFINE(MOZ_JEMALLOC3)
7254 AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7259 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7260 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.])
7265 dnl Don't try to run compiler tests on Windows
7266 if test "$OS_ARCH" = "WINNT"; then
7267 if test -z "$HAVE_64BIT_OS"; then
7268 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7270 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7273 AC_CHECK_SIZEOF([int *], [4])
7274 case "${ac_cv_sizeof_int_p}" in
7276 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7279 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7282 AC_MSG_ERROR([Unexpected pointer size])
7287 AC_DEFINE(MOZ_MEMORY)
7288 if test -n "$MOZ_JEMALLOC3"; then
7289 AC_DEFINE(MOZ_JEMALLOC3)
7291 if test "x$MOZ_DEBUG" = "x1"; then
7292 AC_DEFINE(MOZ_MEMORY_DEBUG)
7294 dnl The generic feature tests that determine how to compute ncpus are long and
7295 dnl complicated. Therefore, simply define special cpp variables for the
7296 dnl platforms we have special knowledge of.
7299 AC_DEFINE(MOZ_MEMORY_DARWIN)
7302 AC_DEFINE(MOZ_MEMORY_BSD)
7304 *-android*|*-linuxandroid*)
7305 AC_DEFINE(MOZ_MEMORY_LINUX)
7306 AC_DEFINE(MOZ_MEMORY_ANDROID)
7307 if test -z "$gonkdir"; then
7310 AC_DEFINE(MOZ_MEMORY_GONK)
7315 AC_DEFINE(MOZ_MEMORY_LINUX)
7318 AC_DEFINE(MOZ_MEMORY_BSD)
7321 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7324 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7325 if test -z "$MOZ_DEBUG"; then
7326 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7328 WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7330 dnl Look for a broken crtdll.obj
7331 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7332 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7333 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7334 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7335 dnl Also pass this to NSPR/NSS
7336 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7338 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7345 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7349 AC_SUBST(MOZ_MEMORY)
7350 AC_SUBST(MOZ_JEMALLOC3)
7351 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7352 AC_SUBST(MOZ_GLUE_LDFLAGS)
7353 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7354 AC_SUBST(WIN32_CRT_LIBS)
7355 dnl Need to set this for make because NSS doesn't have configure
7358 dnl We need to wrap dlopen and related functions on Android because we use
7360 if test "$OS_TARGET" = Android; then
7361 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7362 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7363 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7364 if test -z "$gonkdir"; then
7365 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7366 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=memccpy,--wrap=memchr,--wrap=memrchr,--wrap=memcmp,--wrap=memcpy,--wrap=memmove,--wrap=memset,--wrap=memmem,--wrap=memswap,--wrap=index,--wrap=strchr,--wrap=strrchr,--wrap=strlen,--wrap=strcmp,--wrap=strcpy,--wrap=strcat,--wrap=strcasecmp,--wrap=strncasecmp,--wrap=strstr,--wrap=strcasestr,--wrap=strtok,--wrap=strtok_r,--wrap=strerror,--wrap=strerror_r,--wrap=strnlen,--wrap=strncat,--wrap=strncmp,--wrap=strncpy,--wrap=strlcat,--wrap=strlcpy,--wrap=strcspn,--wrap=strpbrk,--wrap=strsep,--wrap=strspn,--wrap=strcoll,--wrap=strxfrm"
7370 dnl ========================================================
7371 dnl = Use malloc wrapper lib
7372 dnl ========================================================
7373 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7374 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7378 if test -n "$_WRAP_MALLOC"; then
7379 if test -n "$GNU_CC"; then
7380 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7381 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7382 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7383 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7384 dnl Wrap operator new and operator delete on Android.
7385 if test "$OS_TARGET" = "Android"; then
7386 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7387 dnl Wrap the nothrow variants too.
7388 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7391 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7395 dnl ========================================================
7396 dnl = Location of malloc wrapper lib
7397 dnl ========================================================
7398 MOZ_ARG_WITH_STRING(wrap-malloc,
7399 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7400 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7402 dnl ========================================================
7403 dnl = Use JS Call tracing
7404 dnl ========================================================
7405 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7406 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7407 MOZ_TRACE_JSCALLS=1,
7408 MOZ_TRACE_JSCALLS= )
7409 if test -n "$MOZ_TRACE_JSCALLS"; then
7410 AC_DEFINE(MOZ_TRACE_JSCALLS)
7413 dnl ========================================================
7414 dnl = Use incremental GC
7415 dnl ========================================================
7417 MOZ_ARG_DISABLE_BOOL(gcincremental,
7418 [ --disable-gcincremental Disable incremental GC],
7420 if test -n "$JSGC_INCREMENTAL"; then
7421 AC_DEFINE(JSGC_INCREMENTAL)
7424 dnl ========================================================
7425 dnl ETW - Event Tracing for Windows
7426 dnl ========================================================
7427 MOZ_ARG_ENABLE_BOOL(ETW,
7428 [ --enable-ETW Enable ETW (Event Tracing for Windows) event reporting],
7431 if test -n "$MOZ_ETW"; then
7435 if test -n "$MOZ_ETW"; then
7436 if test -z "$MOZ_WINSDK_TARGETVER"; then
7437 AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7441 dnl ========================================================
7442 dnl Zealous JavaScript GC
7443 dnl ========================================================
7444 MOZ_ARG_ENABLE_BOOL(gczeal,
7445 [ --enable-gczeal Enable zealous JavaScript GCing],
7448 if test -n "$JS_GC_ZEAL"; then
7449 AC_DEFINE(JS_GC_ZEAL)
7452 dnl ========================================================
7453 dnl JS opt-mode assertions and minidump instrumentation
7454 dnl ========================================================
7455 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7456 [ --enable-js-diagnostics
7457 Enable JS diagnostic assertions and breakpad data],
7458 JS_CRASH_DIAGNOSTICS=1,
7459 JS_CRASH_DIAGNOSTICS= )
7460 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7461 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7466 dnl ========================================================
7467 dnl = Enable static checking using gcc-dehydra
7468 dnl ========================================================
7470 MOZ_ARG_WITH_STRING(static-checking,
7471 [ --with-static-checking=path/to/gcc_dehydra.so
7472 Enable static checking of code using GCC-dehydra],
7473 DEHYDRA_PATH=$withval,
7476 if test -n "$DEHYDRA_PATH"; then
7477 if test ! -f "$DEHYDRA_PATH"; then
7478 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7480 AC_DEFINE(NS_STATIC_CHECKING)
7482 AC_SUBST(DEHYDRA_PATH)
7484 dnl ========================================================
7485 dnl = Enable stripping of libs & executables
7486 dnl ========================================================
7487 MOZ_ARG_ENABLE_BOOL(strip,
7488 [ --enable-strip Enable stripping of libs & executables ],
7492 dnl ========================================================
7493 dnl = Enable stripping of libs & executables when packaging
7494 dnl ========================================================
7495 MOZ_ARG_ENABLE_BOOL(install-strip,
7496 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7500 dnl ========================================================
7501 dnl = --enable-elf-dynstr-gc
7502 dnl ========================================================
7503 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7504 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7505 USE_ELF_DYNSTR_GC=1,
7506 USE_ELF_DYNSTR_GC= )
7508 dnl ========================================================
7509 dnl = --disable-elf-hack
7510 dnl ========================================================
7513 MOZ_ARG_DISABLE_BOOL(elf-hack,
7514 [ --disable-elf-hack Disable elf hacks],
7518 # Disable elf hack for profiling because the built in profiler
7519 # doesn't read the segments properly with elf hack. This is
7520 # temporary and should be fixed soon in the profiler.
7521 if test "$MOZ_PROFILING" = 1; then
7525 # Only enable elfhack where supported
7526 if test "$USE_ELF_HACK" = 1; then
7527 case "${HOST_OS_ARCH},${OS_ARCH}" in
7529 case "${CPU_ARCH}" in
7544 if test "$USE_ELF_HACK" = 1; then
7545 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7546 dnl memory addresses it maps to. The result is that by the time elfhack
7547 dnl kicks in, it is not possible to apply relocations because of that,
7548 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7549 dnl segment. It makes elfhack mostly useless, so considering the problems
7550 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7551 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7552 dnl the linker creates PT_GNU_RELRO segments.
7553 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7554 LINK_WITH_PT_GNU_RELRO,
7555 [echo "int main() {return 0;}" > conftest.${ac_ext}
7556 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7557 test -s conftest${ac_exeext}; then
7558 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7559 LINK_WITH_PT_GNU_RELRO=yes
7561 LINK_WITH_PT_GNU_RELRO=no
7564 dnl We really don't expect to get here, but just in case
7565 AC_ERROR([couldn't compile a simple C file])
7568 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7569 AC_MSG_WARN([Disabling elfhack])
7574 dnl ========================================================
7575 dnl = libstdc++ compatibility hacks
7576 dnl ========================================================
7579 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7580 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7583 AC_SUBST(STDCXX_COMPAT)
7585 if test -n "$STDCXX_COMPAT"; then
7586 eval $(CXX="$CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7587 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7588 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7591 dnl ========================================================
7593 dnl = Profiling and Instrumenting
7595 dnl ========================================================
7596 MOZ_ARG_HEADER(Profiling and Instrumenting)
7598 dnl ========================================================
7599 dnl = Enable runtime visual profiling logger
7600 dnl ========================================================
7601 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7602 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7603 MOZ_VISUAL_EVENT_TRACER=1,
7604 MOZ_VISUAL_EVENT_TRACER=)
7605 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7606 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7609 dnl ========================================================
7610 dnl Turn on reflow counting
7611 dnl ========================================================
7612 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7613 [ --enable-reflow-perf Enable reflow performance tracing],
7616 if test -n "$MOZ_REFLOW_PERF"; then
7617 AC_DEFINE(MOZ_REFLOW_PERF)
7620 dnl ========================================================
7621 dnl Enable code size metrics.
7622 dnl ========================================================
7623 MOZ_ARG_ENABLE_BOOL(codesighs,
7624 [ --enable-codesighs Enable code size analysis tools],
7625 _ENABLE_CODESIGHS=1,
7626 _ENABLE_CODESIGHS= )
7627 if test -n "$_ENABLE_CODESIGHS"; then
7628 if test -d $srcdir/tools/codesighs; then
7631 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7635 dnl ========================================================
7636 dnl = Enable Radio Interface for B2G (Gonk usually)
7637 dnl ========================================================
7638 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7639 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7642 if test -n "$MOZ_B2G_RIL"; then
7643 AC_DEFINE(MOZ_B2G_RIL)
7645 AC_SUBST(MOZ_B2G_RIL)
7647 dnl ========================================================
7648 dnl = Enable Radio FM for B2G (Gonk usually)
7649 dnl ========================================================
7650 if test -n "$MOZ_B2G_FM"; then
7651 AC_DEFINE(MOZ_B2G_FM)
7653 AC_SUBST(MOZ_B2G_FM)
7655 dnl ========================================================
7656 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7657 dnl ========================================================
7658 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7659 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7662 if test -n "$MOZ_B2G_BT"; then
7663 AC_DEFINE(MOZ_B2G_BT)
7665 AC_SUBST(MOZ_B2G_BT)
7667 dnl ========================================================
7668 dnl = Enable Support for System Messages API
7669 dnl ========================================================
7670 if test -n "$MOZ_SYS_MSG"; then
7671 AC_DEFINE(MOZ_SYS_MSG)
7673 AC_SUBST(MOZ_SYS_MSG)
7675 dnl ========================================================
7676 dnl = Enable Support for Time Manager API
7677 dnl ========================================================
7678 if test -n "$MOZ_TIME_MANAGER"; then
7679 AC_DEFINE(MOZ_TIME_MANAGER)
7681 AC_SUBST(MOZ_TIME_MANAGER)
7683 dnl ========================================================
7684 dnl = Enable Camera Interface for B2G (Gonk usually)
7685 dnl ========================================================
7686 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7687 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7690 if test -n "$MOZ_B2G_CAMERA"; then
7691 AC_DEFINE(MOZ_B2G_CAMERA)
7693 AC_SUBST(MOZ_B2G_CAMERA)
7695 dnl ========================================================
7696 dnl = Enable Support B2G-specific changes to the NSS
7697 dnl = certificate trust database.
7698 dnl ========================================================
7699 if test -n "$MOZ_B2G_CERTDATA"; then
7700 AC_DEFINE(MOZ_B2G_CERTDATA)
7702 AC_SUBST(MOZ_B2G_CERTDATA)
7704 dnl ========================================================
7705 dnl = Enable Support for Payment API
7706 dnl ========================================================
7707 if test -n "$MOZ_PAY"; then
7712 dnl ========================================================
7713 dnl = Enable Support for AudioChannelManager API
7714 dnl ========================================================
7715 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7716 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7718 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7720 dnl ========================================================
7721 dnl = Support for demangling undefined symbols
7722 dnl ========================================================
7723 if test -z "$SKIP_LIBRARY_CHECKS"; then
7726 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7730 # Demangle only for debug or trace-malloc or DMD builds
7731 MOZ_DEMANGLE_SYMBOLS=
7732 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7733 MOZ_DEMANGLE_SYMBOLS=1
7734 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7736 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7738 dnl ========================================================
7739 dnl = Support for gcc stack unwinding (from gcc 3.3)
7740 dnl ========================================================
7741 if test -z "$SKIP_LIBRARY_CHECKS"; then
7742 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7745 dnl ========================================================
7747 dnl ========================================================
7749 MOZ_ARG_WITH_STRING(jitreport-granularity,
7750 [ --jitreport-granularity=N
7751 Default granularity at which to report JIT code
7754 1 - code ranges for whole functions only
7755 2 - per-line information
7756 3 - per-op information],
7757 JITREPORT_GRANULARITY=$withval,
7758 JITREPORT_GRANULARITY=3)
7760 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7762 dnl ========================================================
7766 dnl ========================================================
7767 MOZ_ARG_HEADER(Misc. Options)
7769 dnl ========================================================
7770 dnl update xterm title
7771 dnl ========================================================
7772 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7773 [ --enable-xterm-updates Update XTERM titles with current command.],
7777 dnl =========================================================
7779 dnl =========================================================
7780 MOZ_ARG_ENABLE_STRING([chrome-format],
7781 [ --enable-chrome-format=jar|flat|both|symlink|omni
7782 Select FORMAT of chrome files (default=jar)],
7783 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7785 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7786 MOZ_CHROME_FILE_FORMAT=jar
7789 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7790 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7791 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7792 test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7793 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7794 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7797 dnl =========================================================
7798 dnl Omnijar packaging (bug 552121)
7799 dnl =========================================================
7800 dnl Omnijar packaging is compatible with flat packaging.
7801 dnl In unpackaged builds, omnijar looks for files as if
7802 dnl things were flat packaged. After packaging, all files
7803 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7804 dnl is set to flat since putting files into jars is only
7805 dnl done during packaging with omnijar.
7806 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7808 AC_DEFINE(MOZ_OMNIJAR)
7810 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7811 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7812 MOZ_CHROME_FILE_FORMAT=flat
7814 MOZ_CHROME_FILE_FORMAT=symlink
7817 OMNIJAR_NAME=omni.ja
7818 AC_SUBST(OMNIJAR_NAME)
7819 AC_SUBST(MOZ_OMNIJAR)
7820 AC_SUBST(MOZ_PACKAGER_FORMAT)
7822 dnl ========================================================
7823 dnl = Define default location for MOZILLA_FIVE_HOME
7824 dnl ========================================================
7825 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7826 [ --with-default-mozilla-five-home
7827 Set the default value for MOZILLA_FIVE_HOME],
7828 [ val=`echo $withval`
7829 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7831 dnl ========================================================
7832 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7833 dnl ========================================================
7834 MOZ_ARG_WITH_STRING(user-appdir,
7835 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7836 [ val=`echo $withval`
7837 if echo "$val" | grep "\/" >/dev/null; then
7838 AC_MSG_ERROR("Homedir must be single relative path.")
7843 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7845 dnl ========================================================
7846 dnl = Doxygen configuration
7847 dnl ========================================================
7848 dnl Use commas to specify multiple dirs to this arg
7849 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7850 MOZ_ARG_WITH_STRING(doc-input-dirs,
7851 [ --with-doc-input-dirs=DIRS
7852 Header/idl dirs to create docs from],
7853 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7854 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7856 dnl Use commas to specify multiple dirs to this arg
7857 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7858 MOZ_ARG_WITH_STRING(doc-include-dirs,
7859 [ --with-doc-include-dirs=DIRS
7860 Include dirs to preprocess doc headers],
7861 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7862 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7864 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7865 MOZ_ARG_WITH_STRING(doc-output-dir,
7866 [ --with-doc-output-dir=DIR
7867 Dir to generate docs into],
7868 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7869 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7871 if test -z "$SKIP_COMPILER_CHECKS"; then
7872 dnl ========================================================
7874 dnl = Compiler Options
7876 dnl ========================================================
7877 MOZ_ARG_HEADER(Compiler Options)
7879 dnl ========================================================
7880 dnl Check for gcc -pipe support
7881 dnl ========================================================
7882 AC_MSG_CHECKING([for -pipe support])
7883 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7884 dnl Any gcc that supports firefox supports -pipe.
7885 CFLAGS="$CFLAGS -pipe"
7886 CXXFLAGS="$CXXFLAGS -pipe"
7887 AC_MSG_RESULT([yes])
7892 dnl ========================================================
7893 dnl Profile guided optimization (gcc checks)
7894 dnl ========================================================
7895 dnl Test for profiling options
7896 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7898 _SAVE_CFLAGS="$CFLAGS"
7899 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7901 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7902 AC_TRY_COMPILE([], [return 0;],
7903 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7904 result="yes" ], result="no")
7905 AC_MSG_RESULT([$result])
7907 if test $result = "yes"; then
7908 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7909 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7910 PROFILE_USE_LDFLAGS="-fprofile-use"
7913 CFLAGS="$_SAVE_CFLAGS"
7915 if test -n "$INTEL_CC"; then
7916 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7917 PROFILE_GEN_LDFLAGS=
7918 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7919 PROFILE_USE_LDFLAGS=
7922 dnl Sun Studio on Solaris
7923 if test "$SOLARIS_SUNPRO_CC"; then
7924 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7925 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7926 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7927 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7930 AC_SUBST(PROFILE_GEN_CFLAGS)
7931 AC_SUBST(PROFILE_GEN_LDFLAGS)
7932 AC_SUBST(PROFILE_USE_CFLAGS)
7933 AC_SUBST(PROFILE_USE_LDFLAGS)
7937 dnl ========================================================
7938 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7939 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7940 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7941 dnl ========================================================
7942 _SAVE_CXXFLAGS=$CXXFLAGS
7943 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7944 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7945 ac_nscap_nonconst_opeq_bug,
7954 template <class T, class U>
7955 int operator==(const Pointer<T>& rhs, U* lhs)
7957 return rhs.myPtr == lhs;
7960 template <class T, class U>
7961 int operator==(const Pointer<T>& rhs, const U* lhs)
7963 return rhs.myPtr == lhs;
7971 ac_nscap_nonconst_opeq_bug="no",
7972 ac_nscap_nonconst_opeq_bug="yes")])
7973 CXXFLAGS="$_SAVE_CXXFLAGS"
7975 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7976 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7978 fi # ! SKIP_COMPILER_CHECKS
7980 AC_DEFINE(CPP_THROW_NEW, [throw()])
7983 if test "$COMPILE_ENVIRONMENT"; then
7985 fi # COMPILE_ENVIRONMENT
7987 dnl ========================================================
7989 dnl = Build depencency options
7991 dnl ========================================================
7992 MOZ_ARG_HEADER(Build dependencies)
7994 if test "$GNU_CC" -a "$GNU_CXX"; then
7995 _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
7996 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7997 elif test "$SOLARIS_SUNPRO_CC"; then
8000 dnl Don't override this for MSVC
8001 if test -z "$_WIN32_MSVC"; then
8002 _USE_CPP_INCLUDE_FLAG=
8003 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8004 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8006 echo '#include <stdio.h>' > dummy-hello.c
8008 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8010 if test -z "$CL_INCLUDES_PREFIX"; then
8011 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8013 AC_SUBST(CL_INCLUDES_PREFIX)
8018 dnl ========================================================
8020 dnl = Static Build Options
8022 dnl ========================================================
8023 MOZ_ARG_HEADER(Static build options)
8025 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8026 if test "$OS_ARCH" = "WINNT"; then
8030 MOZ_ARG_ENABLE_BOOL(shared-js,
8031 [ --enable-shared-js
8032 Create a shared JavaScript library.],
8036 if test -n "$ENABLE_SHARED_JS"; then
8038 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
8040 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
8041 AC_DEFINE(MOZ_STATIC_JS)
8043 AC_SUBST(JS_SHARED_LIBRARY)
8045 AC_SUBST(LIBXUL_LIBS)
8046 XPCOM_LIBS="$LIBXUL_LIBS"
8048 dnl ========================================================
8050 dnl = Standalone module options
8052 dnl ========================================================
8053 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8056 dnl ========================================================
8058 if test -z "$SKIP_PATH_CHECKS"; then
8059 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8060 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8061 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8066 if test -z "${GLIB_GMODULE_LIBS}" \
8067 -a -n "${GLIB_CONFIG}"\
8068 -a "${GLIB_CONFIG}" != no\
8070 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8073 AC_SUBST(GLIB_CFLAGS)
8075 AC_SUBST(GLIB_GMODULE_LIBS)
8077 dnl ========================================================
8078 dnl Graphics checks.
8079 dnl ========================================================
8081 if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
8087 MOZ_ARG_ENABLE_BOOL(skia,
8088 [ --enable-skia Enable use of Skia],
8092 if test "$USE_FC_FREETYPE"; then
8093 if test "$COMPILE_ENVIRONMENT"; then
8094 dnl ========================================================
8095 dnl = Check for freetype2 and its functionality
8096 dnl ========================================================
8097 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
8099 if test "$_HAVE_FREETYPE2"; then
8101 _SAVE_CFLAGS="$CFLAGS"
8102 LIBS="$LIBS $FT2_LIBS"
8103 CFLAGS="$CFLAGS $FT2_CFLAGS"
8105 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
8106 ac_cv_member_FT_Bitmap_Size_y_ppem,
8107 [AC_TRY_COMPILE([#include <ft2build.h>
8108 #include FT_FREETYPE_H],
8110 if (sizeof s.y_ppem) return 0;
8112 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
8113 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
8114 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
8115 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
8117 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
8119 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
8120 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
8121 [FT_Bitmap_Size structure includes y_ppem field])
8123 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
8126 CFLAGS="$_SAVE_CFLAGS"
8129 _SAVE_CPPFLAGS="$CPPFLAGS"
8130 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8131 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8132 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8133 CPPFLAGS="$_SAVE_CPPFLAGS"
8135 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8138 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
8140 if test "$MOZ_PANGO"; then
8141 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
8142 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
8144 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
8145 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
8150 dnl ========================================================
8151 dnl Check for pixman and cairo
8152 dnl ========================================================
8155 MOZ_ARG_ENABLE_BOOL(system-cairo,
8156 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8161 MOZ_ARG_ENABLE_BOOL(system-pixman,
8162 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8164 MOZ_TREE_PIXMAN=force,
8167 # System cairo depends on system pixman
8168 if test "$MOZ_TREE_PIXMAN" = "force"; then
8169 if test -z "$MOZ_TREE_CAIRO"; then
8170 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
8174 elif test -z "$MOZ_TREE_CAIRO"; then
8178 if test "$MOZ_TREE_PIXMAN"; then
8179 AC_DEFINE(MOZ_TREE_PIXMAN)
8180 MOZ_PIXMAN_CFLAGS=""
8181 MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8183 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8184 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8185 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8187 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8188 AC_SUBST(MOZ_PIXMAN_LIBS)
8190 # Check for headers defining standard int types.
8191 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8193 if test "$MOZ_TREE_CAIRO"; then
8194 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8195 AC_DEFINE(MOZ_TREE_CAIRO)
8197 # For now we assume that we will have a uint64_t available through
8198 # one of the above headers or mozstdint.h.
8199 AC_DEFINE(HAVE_UINT64_T)
8201 # Define macros for cairo-features.h
8202 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8203 if test "$MOZ_X11"; then
8204 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8205 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8206 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8207 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8208 MOZ_ENABLE_CAIRO_FT=1
8209 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8211 case "$MOZ_WIDGET_TOOLKIT" in
8213 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8216 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8217 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8218 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8221 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8222 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8223 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8224 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8225 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8226 MOZ_ENABLE_D2D_SURFACE=1
8227 MOZ_ENABLE_DWRITE_FONT=1
8229 WIN32_DWRITE_FONT_FEATURE=
8230 WIN32_D2D_SURFACE_FEATURE=
8233 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8235 dnl D3D10 Layers depend on D2D Surfaces.
8236 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8237 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8241 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8242 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8243 MOZ_ENABLE_CAIRO_FT=1
8244 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8245 CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8249 if test "$USE_FC_FREETYPE"; then
8250 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8252 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8253 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8254 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8255 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8256 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8257 AC_SUBST(CAIRO_FT_CFLAGS)
8259 AC_SUBST(PS_SURFACE_FEATURE)
8260 AC_SUBST(PDF_SURFACE_FEATURE)
8261 AC_SUBST(SVG_SURFACE_FEATURE)
8262 AC_SUBST(XLIB_SURFACE_FEATURE)
8263 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8264 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8265 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8266 AC_SUBST(WIN32_SURFACE_FEATURE)
8267 AC_SUBST(OS2_SURFACE_FEATURE)
8268 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8269 AC_SUBST(FT_FONT_FEATURE)
8270 AC_SUBST(FC_FONT_FEATURE)
8271 AC_SUBST(WIN32_FONT_FEATURE)
8272 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8273 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8274 AC_SUBST(QUARTZ_FONT_FEATURE)
8275 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8276 AC_SUBST(QT_SURFACE_FEATURE)
8277 AC_SUBST(TEE_SURFACE_FEATURE)
8279 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8280 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8282 if test "$MOZ_X11"; then
8283 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8286 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8288 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8289 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8290 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8291 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8292 if test "$MOZ_X11"; then
8293 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8294 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8295 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8296 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8300 AC_SUBST(MOZ_TREE_CAIRO)
8301 AC_SUBST(MOZ_CAIRO_CFLAGS)
8302 AC_SUBST(MOZ_CAIRO_LIBS)
8303 AC_SUBST(MOZ_CAIRO_OSLIBS)
8304 AC_SUBST(MOZ_TREE_PIXMAN)
8306 dnl ========================================================
8308 dnl ========================================================
8310 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8313 dnl ========================================================
8315 dnl ========================================================
8316 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8317 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8319 dnl ========================================================
8321 dnl ========================================================
8322 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8323 AC_SUBST(MOZ_GRAPHITE_LIBS)
8325 dnl ========================================================
8327 dnl ========================================================
8328 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8329 AC_SUBST(MOZ_OTS_LIBS)
8331 dnl ========================================================
8333 dnl ========================================================
8334 if test "$MOZ_ENABLE_SKIA"; then
8335 MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8336 AC_DEFINE(MOZ_ENABLE_SKIA)
8338 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8339 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8340 elif test "$OS_ARCH" = "WINNT"; then
8347 AC_SUBST(MOZ_ENABLE_SKIA)
8348 AC_SUBST(MOZ_SKIA_LIBS)
8350 dnl ========================================================
8352 dnl ========================================================
8353 MOZ_ARG_DISABLE_BOOL(xul,
8354 [ --disable-xul Disable XUL],
8356 if test "$MOZ_XUL"; then
8359 dnl remove extensions that require XUL
8360 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8365 dnl ========================================================
8366 dnl disable profile locking
8367 dnl do no use this in applications that can have more than
8368 dnl one process accessing the profile directory.
8369 dnl ========================================================
8370 MOZ_ARG_DISABLE_BOOL(profilelocking,
8371 [ --disable-profilelocking
8372 Disable profile locking],
8373 MOZ_PROFILELOCKING=,
8374 MOZ_PROFILELOCKING=1 )
8375 if test "$MOZ_PROFILELOCKING"; then
8376 AC_DEFINE(MOZ_PROFILELOCKING)
8379 dnl ========================================================
8380 dnl necko configuration options
8381 dnl ========================================================
8384 dnl option to disable various necko protocols
8386 MOZ_ARG_ENABLE_STRING(necko-protocols,
8387 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8388 Enable/disable specific protocol handlers],
8389 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8390 if test "$option" = "yes" -o "$option" = "all"; then
8391 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8392 elif test "$option" = "no" -o "$option" = "none"; then
8394 elif test "$option" = "default"; then
8395 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8396 elif test `echo "$option" | grep -c \^-` != 0; then
8397 option=`echo $option | sed 's/^-//'`
8398 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8400 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8403 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8405 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8406 AC_SUBST(NECKO_PROTOCOLS)
8407 for p in $NECKO_PROTOCOLS; do
8408 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8409 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8413 dnl option to disable necko's wifi scanner
8415 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8416 [ --disable-necko-wifi Disable necko wifi scanner],
8420 if test "$OS_ARCH" = "OS2"; then
8421 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8424 if test "$NECKO_WIFI" -a \
8425 "$OS_ARCH" != "Linux" -a \
8426 "$OS_ARCH" != "Darwin" -a \
8427 "$OS_ARCH" != "SunOS" -a \
8428 "$OS_ARCH" != "WINNT"; then
8429 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8432 if test "$NECKO_WIFI"; then
8433 AC_DEFINE(NECKO_WIFI)
8434 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8436 AC_SUBST(NECKO_WIFI)
8439 dnl option to disable cookies
8441 MOZ_ARG_DISABLE_BOOL(cookies,
8442 [ --disable-cookies Disable cookie support],
8445 AC_SUBST(NECKO_COOKIES)
8446 if test "$NECKO_COOKIES"; then
8447 AC_DEFINE(NECKO_COOKIES)
8448 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8452 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8454 MOZ_ARG_DISABLE_BOOL(ctypes,
8455 [ --disable-ctypes Disable js-ctypes],
8458 AC_SUBST(BUILD_CTYPES)
8459 if test "$BUILD_CTYPES"; then
8460 AC_DEFINE(BUILD_CTYPES)
8463 dnl Build Places if required
8464 if test "$MOZ_PLACES"; then
8465 AC_DEFINE(MOZ_PLACES)
8468 dnl Build Common JS modules provided by services.
8469 AC_SUBST(MOZ_SERVICES_COMMON)
8470 if test -n "$MOZ_SERVICES_COMMON"; then
8471 AC_DEFINE(MOZ_SERVICES_COMMON)
8474 dnl Build Services crypto component (used by Sync)
8475 AC_SUBST(MOZ_SERVICES_CRYPTO)
8476 if test -n "$MOZ_SERVICES_CRYPTO"; then
8477 AC_DEFINE(MOZ_SERVICES_CRYPTO)
8480 dnl Build Firefox Health Reporter Service
8481 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8482 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8483 AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8486 dnl Build Services metrics component
8487 AC_SUBST(MOZ_SERVICES_METRICS)
8488 if test -n "$MOZ_SERVICES_METRICS"; then
8489 AC_DEFINE(MOZ_SERVICES_METRICS)
8492 dnl Build Notifications if required
8493 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8494 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8495 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8498 dnl Build Sync Services if required
8499 AC_SUBST(MOZ_SERVICES_SYNC)
8500 if test -n "$MOZ_SERVICES_SYNC"; then
8501 AC_DEFINE(MOZ_SERVICES_SYNC)
8504 dnl Build Captive Portal Detector if required
8505 AC_SUBST(MOZ_CAPTIVEDETECT)
8506 if test -n "$MOZ_CAPTIVEDETECT"; then
8507 AC_DEFINE(MOZ_CAPTIVEDETECT)
8510 dnl ========================================================
8511 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8512 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8515 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8516 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8519 if test "$MOZ_APP_COMPONENT_MODULES"; then
8520 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8523 dnl ========================================================
8525 dnl = Maintainer debug option (no --enable equivalent)
8527 dnl ========================================================
8532 AC_SUBST(AR_EXTRACT)
8536 AC_SUBST(AS_DASH_C_FLAG)
8545 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8546 AC_SUBST(MOZ_UPDATE_XTERM)
8547 AC_SUBST(MOZ_PLATFORM_MAEMO)
8548 AC_SUBST(MOZ_AUTH_EXTENSION)
8549 AC_SUBST(MOZ_PERMISSIONS)
8550 AC_SUBST(MOZ_PREF_EXTENSIONS)
8551 AC_SUBST(MOZ_JS_LIBS)
8554 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8555 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8556 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8557 AC_SUBST(MOZ_DEBUG_FLAGS)
8558 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8559 AC_SUBST(WARNINGS_AS_ERRORS)
8560 AC_SUBST(MOZ_EXTENSIONS)
8561 AC_SUBST(MOZ_JSDEBUGGER)
8562 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8565 AC_SUBST(MOZ_INSTRUMENTS)
8566 AC_SUBST(MOZ_CALLGRIND)
8569 AC_SUBST(MOZ_PROFILING)
8571 AC_SUBST(MOZ_PLACES)
8572 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8574 AC_SUBST(NS_PRINTING)
8576 AC_SUBST(MOZ_HELP_VIEWER)
8577 AC_SUBST(TOOLCHAIN_PREFIX)
8584 AC_SUBST(MOZ_PROFILELOCKING)
8586 AC_SUBST(ENABLE_TESTS)
8587 AC_SUBST(ENABLE_MARIONETTE)
8589 AC_SUBST(MOZ_UNIVERSALCHARDET)
8590 AC_SUBST(ACCESSIBILITY)
8591 AC_SUBST(MOZ_SPELLCHECK)
8592 AC_SUBST(MOZ_ANDROID_OMTC)
8593 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8594 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8595 AC_SUBST(MOZ_CRASHREPORTER)
8596 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8597 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8598 AC_SUBST(MOZ_STUB_INSTALLER)
8599 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8600 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8601 AC_SUBST(MOZ_UPDATER)
8602 AC_SUBST(MOZ_ANGLE_RENDERER)
8603 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8604 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8605 AC_SUBST(MOZ_D3DX9_VERSION)
8606 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8607 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8610 AC_SUBST(MOZ_ANDROID_HISTORY)
8611 AC_SUBST(MOZ_WEBSMS_BACKEND)
8612 AC_SUBST(MOZ_ANDROID_WALLPAPER)
8613 AC_SUBST(ENABLE_STRIP)
8614 AC_SUBST(PKG_SKIP_STRIP)
8615 AC_SUBST(STRIP_FLAGS)
8616 AC_SUBST(USE_ELF_DYNSTR_GC)
8617 AC_SUBST(USE_ELF_HACK)
8618 AC_SUBST(INCREMENTAL_LINKER)
8619 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8620 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8622 AC_SUBST(MOZ_FIX_LINK_PATHS)
8623 AC_SUBST(XPCOM_LIBS)
8624 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8625 AC_SUBST(XPCOM_GLUE_LDOPTS)
8626 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8627 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8628 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8630 AC_SUBST(USE_DEPENDENT_LIBS)
8632 AC_SUBST(MOZ_BUILD_ROOT)
8633 AC_SUBST(MOZ_OS2_TOOLS)
8635 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8636 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8637 AC_SUBST(MOZ_LINKER_EXTRACT)
8639 AC_SUBST(MOZ_JSDOWNLOADS)
8641 if test -n "$MOZ_JSDOWNLOADS" ; then
8642 AC_DEFINE(MOZ_JSDOWNLOADS)
8645 dnl ========================================================
8646 dnl = Mac bundle name prefix
8647 dnl ========================================================
8648 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8649 [ --with-macbundlename-prefix=prefix
8650 Prefix for MOZ_MACBUNDLE_NAME],
8651 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8653 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8654 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8655 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8658 if test "$MOZ_DEBUG"; then
8659 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8661 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8663 AC_SUBST(MOZ_MACBUNDLE_NAME)
8665 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8666 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8667 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8668 if test "$MOZ_DEBUG"; then
8669 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8672 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8673 AC_SUBST(MOZ_MACBUNDLE_ID)
8675 # The following variables are available to branding and application
8676 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8677 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8678 # impacts profile location and user-visible fields.
8679 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8680 # versions of a given application (e.g. Aurora and Firefox both use
8681 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8682 # for application.ini's "Name" field, which controls profile location in
8683 # the absence of a "Profile" field (see below), and various system
8684 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8685 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8686 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8687 # builds (e.g. Aurora for Firefox).
8688 # - MOZ_APP_VERSION: Defines the application version number.
8689 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8690 # defaults to a lowercase form of MOZ_APP_BASENAME.
8691 # - MOZ_APP_PROFILE: When set, used for application.ini's
8692 # "Profile" field, which controls profile location.
8693 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8694 # crash reporter server url.
8695 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8696 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8698 if test -z "$MOZ_APP_NAME"; then
8699 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8702 # For extensions and langpacks, we require a max version that is compatible
8703 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8704 # 10.0a1 and 10.0a2 aren't affected
8705 # 10.0 becomes 10.0.*
8706 # 10.0.1 becomes 10.0.*
8707 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8708 if test -z "$IS_ALPHA"; then
8710 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8713 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8716 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8717 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8718 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8720 AC_SUBST(MOZ_APP_NAME)
8721 AC_SUBST(MOZ_APP_DISPLAYNAME)
8722 AC_SUBST(MOZ_APP_BASENAME)
8723 AC_SUBST(MOZ_APP_VENDOR)
8724 AC_SUBST(MOZ_APP_PROFILE)
8725 AC_SUBST(MOZ_APP_ID)
8726 AC_SUBST(MAR_CHANNEL_ID)
8727 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8728 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8729 AC_SUBST(MOZ_EXTENSION_MANAGER)
8730 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8731 AC_SUBST(MOZ_APP_UA_NAME)
8732 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8733 AC_SUBST(MOZ_APP_VERSION)
8734 AC_SUBST(MOZ_APP_MAXVERSION)
8735 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8736 AC_SUBST(FIREFOX_VERSION)
8737 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8738 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8739 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8741 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8742 AC_SUBST(MOZ_UA_BUILDID)
8744 AC_SUBST(MOZ_APP_STATIC_INI)
8746 AC_SUBST(MOZ_PKG_SPECIAL)
8748 AC_SUBST(MOZILLA_OFFICIAL)
8750 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8751 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8753 if test "$MOZ_TELEMETRY_REPORTING"; then
8754 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8756 # Enable Telemetry by default for nightly and aurora channels
8757 if test "$MOZ_UPDATE_CHANNEL" = "nightly" -o \
8758 "$MOZ_UPDATE_CHANNEL" = "aurora"; then
8759 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8763 dnl If we have any service that uploads data (and requires data submission
8764 dnl policy alert), set MOZ_DATA_REPORTING.
8765 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8766 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8767 MOZ_DATA_REPORTING=1
8768 AC_DEFINE(MOZ_DATA_REPORTING)
8769 AC_SUBST(MOZ_DATA_REPORTING)
8773 AC_SUBST(MOZ_MAPINFO)
8774 AC_SUBST(MOZ_BROWSE_INFO)
8775 AC_SUBST(MOZ_TOOLS_DIR)
8776 AC_SUBST(WIN32_REDIST_DIR)
8779 dnl Echo the CFLAGS to remove extra whitespace.
8785 $_WARNINGS_CXXFLAGS \
8788 COMPILE_CFLAGS=`echo \
8793 COMPILE_CXXFLAGS=`echo \
8794 $_DEFINES_CXXFLAGS \
8798 AC_SUBST(SYSTEM_LIBXUL)
8799 AC_SUBST(MOZ_NATIVE_JPEG)
8800 AC_SUBST(MOZ_NATIVE_PNG)
8801 AC_SUBST(MOZ_NATIVE_BZ2)
8803 AC_SUBST(MOZ_FLEXBOX)
8804 AC_SUBST(MOZ_JPEG_CFLAGS)
8805 AC_SUBST(MOZ_JPEG_LIBS)
8806 AC_SUBST(MOZ_BZ2_CFLAGS)
8807 AC_SUBST(MOZ_BZ2_LIBS)
8808 AC_SUBST(MOZ_PNG_CFLAGS)
8809 AC_SUBST(MOZ_PNG_LIBS)
8811 AC_SUBST(NSPR_CFLAGS)
8813 AC_SUBST(MOZ_NATIVE_NSPR)
8815 AC_SUBST(NSS_CFLAGS)
8817 AC_SUBST(NSS_DEP_LIBS)
8818 AC_SUBST(MOZ_NATIVE_NSS)
8819 AC_SUBST(NSS_DISABLE_DBM)
8822 OS_CXXFLAGS="$CXXFLAGS"
8823 OS_CPPFLAGS="$CPPFLAGS"
8824 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8825 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8826 OS_LDFLAGS="$LDFLAGS"
8829 AC_SUBST(OS_CXXFLAGS)
8830 AC_SUBST(OS_CPPFLAGS)
8831 AC_SUBST(OS_COMPILE_CFLAGS)
8832 AC_SUBST(OS_COMPILE_CXXFLAGS)
8833 AC_SUBST(OS_LDFLAGS)
8835 AC_SUBST(CROSS_COMPILE)
8836 AC_SUBST(WCHAR_CFLAGS)
8840 AC_SUBST(HOST_CFLAGS)
8841 AC_SUBST(HOST_CXXFLAGS)
8842 AC_SUBST(HOST_LDFLAGS)
8843 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8845 AC_SUBST(HOST_AR_FLAGS)
8847 AC_SUBST(HOST_RANLIB)
8848 AC_SUBST(HOST_NSPR_MDCPUCFG)
8849 AC_SUBST(HOST_BIN_SUFFIX)
8850 AC_SUBST(HOST_OS_ARCH)
8852 AC_SUBST(TARGET_CPU)
8853 AC_SUBST(TARGET_VENDOR)
8855 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8856 AC_SUBST(TARGET_MD_ARCH)
8857 AC_SUBST(TARGET_XPCOM_ABI)
8860 AC_SUBST(OS_RELEASE)
8863 AC_SUBST(INTEL_ARCHITECTURE)
8865 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8867 AC_SUBST(WRAP_LDFLAGS)
8870 AC_SUBST(MKSHLIB_FORCE_ALL)
8871 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8872 AC_SUBST(DSO_CFLAGS)
8873 AC_SUBST(DSO_PIC_CFLAGS)
8874 AC_SUBST(DSO_LDOPTS)
8875 AC_SUBST(LIB_PREFIX)
8876 AC_SUBST(DLL_PREFIX)
8877 AC_SUBST(DLL_SUFFIX)
8878 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8879 AC_SUBST(LIB_SUFFIX)
8880 AC_SUBST(OBJ_SUFFIX)
8881 AC_SUBST(BIN_SUFFIX)
8882 AC_SUBST(ASM_SUFFIX)
8883 AC_SUBST(IMPORT_LIB_SUFFIX)
8885 AC_SUBST(CC_VERSION)
8886 AC_SUBST(CXX_VERSION)
8887 AC_SUBST(MSMANIFEST_TOOL)
8888 AC_SUBST(NS_ENABLE_TSF)
8889 AC_SUBST(MOZ_NSS_PATCH)
8890 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8891 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8894 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8895 AC_SUBST(MOZ_SOUNDTOUCH)
8898 AC_SUBST(MOZ_VORBIS)
8899 AC_SUBST(MOZ_TREMOR)
8902 AC_SUBST(MOZ_WEBVTT)
8905 AC_SUBST(MOZ_MEDIA_PLUGINS)
8906 AC_SUBST(MOZ_OMX_PLUGIN)
8907 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8908 AC_SUBST(MOZ_VP8_ENCODER)
8912 AC_SUBST(VPX_ASFLAGS)
8913 AC_SUBST(VPX_DASH_C_FLAG)
8914 AC_SUBST(VPX_AS_CONVERSION)
8915 AC_SUBST(VPX_ASM_SUFFIX)
8916 AC_SUBST(VPX_X86_ASM)
8917 AC_SUBST(VPX_ARM_ASM)
8918 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8919 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8920 AC_SUBST(LIBJPEG_TURBO_AS)
8921 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8922 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8923 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8924 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8926 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8927 AC_SUBST(MOZ_FOLD_LIBS)
8929 AC_MSG_CHECKING([for posix_fallocate])
8930 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8931 #include <fcntl.h>],
8932 [posix_fallocate(0, 0, 0);],
8933 [ac_cv___posix_fallocate=true],
8934 [ac_cv___posix_fallocate=false])
8936 if test "$ac_cv___posix_fallocate" = true ; then
8937 AC_DEFINE(HAVE_POSIX_FALLOCATE)
8943 dnl Check for missing components
8944 if test "$COMPILE_ENVIRONMENT"; then
8945 if test "$MOZ_X11"; then
8946 if test "$WITHOUT_X11"; then
8947 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8949 dnl ====================================================
8950 dnl = Check if X headers exist
8951 dnl ====================================================
8952 _SAVE_CFLAGS=$CFLAGS
8953 CFLAGS="$CFLAGS $XCFLAGS"
8957 #include <X11/Xlib.h>
8958 #include <X11/Intrinsic.h>
8959 #include <X11/extensions/XShm.h>
8963 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8964 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8968 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8969 CFLAGS="$_SAVE_CFLAGS"
8971 if test -n "$MISSING_X"; then
8972 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8977 dnl Check for headers, etc. needed by WebGL.
8978 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8979 MOZ_CHECK_HEADER(GL/glx.h)
8980 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8981 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))])
8983 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8984 fi # COMPILE_ENVIRONMENT
8986 dnl Set various defines and substitutions
8987 dnl ========================================================
8989 if test "$OS_ARCH" = "Darwin"; then
8991 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8995 if test "$MOZ_DEBUG"; then
8996 AC_DEFINE(MOZ_REFLOW_PERF)
8997 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9000 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
9001 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9002 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9003 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9004 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9005 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9006 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9007 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9008 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9011 AC_SUBST(MOZILLA_VERSION)
9013 AC_SUBST(ac_configure_args)
9015 dnl Spit out some output
9016 dnl ========================================================
9018 dnl The following defines are used by xpcom
9019 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9021 HAVE_CPP_2BYTE_WCHAR_T
9022 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9024 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9025 HAVE_CPP_PARTIAL_SPECIALIZATION
9026 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9027 NEED_CPP_UNUSED_IMPLEMENTATIONS
9031 HAVE_ICONV_WITH_CONST_INPUT
9044 # FUTURE? Consider moving all these to moz.build files.
9046 netwerk/necko-config.h
9047 xpcom/xpcom-config.h
9048 xpcom/xpcom-private.h
9051 AC_OUTPUT([mozilla-config.h])
9053 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
9054 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
9055 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
9056 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
9057 # (apparently) only need this hack when egrep's "pattern" is particularly long
9058 # (as in the following code) and the first egrep on our $PATH is Apple's. See
9062 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
9069 # target_arch is from {ia32|x64|arm|ppc}
9072 WEBRTC_TARGET_ARCH=x64
9076 WEBRTC_TARGET_ARCH=arm
9080 WEBRTC_TARGET_ARCH=ia32
9084 WEBRTC_TARGET_ARCH=ppc
9087 # unsupported arch for webrtc
9088 WEBRTC_TARGET_ARCH=unknown
9094 # Generate Makefiles for WebRTC directly from .gyp files
9095 if test "${OS_TARGET}" = "WINNT"; then
9096 if test "$HAVE_64BIT_OS"; then
9101 EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
9103 elif test "${OS_TARGET}" = "Android"; then
9104 if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
9105 EXTRA_GYP_DEFINES="-G os=linux "
9107 EXTRA_GYP_DEFINES="-D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
9111 if test -n "$ARM_ARCH"; then
9112 if test "$ARM_ARCH" -lt 7; then
9113 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
9115 if test "${OS_TARGET}" = "Android"; then
9116 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=1 "
9118 dnl CPU detection for ARM works on Android only. armv7 always uses CPU detection, so
9119 dnl we have to set armv7=0 for non-Android target
9120 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
9125 # Don't try to compile sse4.1 code if toolchain doesn't support
9126 if test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
9127 EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
9130 if test -n "$MOZ_WEBRTC"; then
9131 AC_MSG_RESULT("generating WebRTC Makefiles...")
9133 if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
9134 EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D build_with_gonk=1 -D include_internal_audio_device=0"
9137 dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
9138 dnl so that regeneration via dependencies works correctly
9139 WEBRTC_CONFIG="-D build_with_mozilla=1 -D build_with_chromium=0 --include ${srcdir}/media/webrtc/webrtc_config.gypi -D FORCED_INCLUDE_FILE=${srcdir}/media/webrtc/webrtc_config.gypi"
9141 if test -n HAVE_CLOCK_MONOTONIC; then
9142 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=1"
9144 WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=0"
9147 GYP_WEBRTC_OPTIONS="--format=mozmake ${WEBRTC_CONFIG} -D target_arch=${WEBRTC_TARGET_ARCH} ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
9149 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9150 $GYP_WEBRTC_OPTIONS \
9151 --generator-output=${_objdir}/media/webrtc/trunk \
9152 ${srcdir}/media/webrtc/trunk/peerconnection.gyp
9153 if test "$?" != 0; then
9154 AC_MSG_ERROR([failed to generate WebRTC Makefiles])
9157 # XXX disable until we land the tranche with signaling
9158 if test -n "$MOZ_WEBRTC_SIGNALING"; then
9159 AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
9160 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9161 $GYP_WEBRTC_OPTIONS \
9162 -D build_for_test=0 \
9163 --generator-output=${_objdir}/media/webrtc/signaling \
9164 ${srcdir}/media/webrtc/signaling/signaling.gyp
9165 if test "$?" != 0; then
9166 AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
9169 AC_MSG_RESULT("generating WebRTC/SignalingTest Makefiles...")
9170 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9171 $GYP_WEBRTC_OPTIONS \
9172 -D build_for_test=1 \
9173 --generator-output=${_objdir}/media/webrtc/signalingtest \
9174 ${srcdir}/media/webrtc/signaling/signaling.gyp
9175 if test "$?" != 0; then
9176 AC_MSG_ERROR([failed to generate WebRTC/SignalingTest Makefiles])
9180 AC_MSG_RESULT("generating gtest Makefiles...")
9181 # Ok to pass some extra -D's that are ignored here
9182 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9183 $GYP_WEBRTC_OPTIONS \
9184 --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
9185 ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
9186 if test "$?" != 0; then
9187 AC_MSG_ERROR([failed to generate gtest Makefiles])
9190 AC_MSG_RESULT("generating nrappkit Makefiles...")
9191 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9192 $GYP_WEBRTC_OPTIONS \
9193 --generator-output=${_objdir}/media/mtransport/third_party/nrappkit \
9194 ${srcdir}/media/mtransport/third_party/nrappkit/nrappkit.gyp
9195 if test "$?" != 0; then
9196 AC_MSG_ERROR([failed to generate nrappkit Makefiles])
9199 AC_MSG_RESULT("generating nICEr Makefiles...")
9200 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9201 $GYP_WEBRTC_OPTIONS \
9202 --generator-output=${_objdir}/media/mtransport/third_party/nICEr \
9203 ${srcdir}/media/mtransport/third_party/nICEr/nicer.gyp
9204 if test "$?" != 0; then
9205 AC_MSG_ERROR([failed to generate nICEr Makefiles])
9209 # Generate a JSON config file for unittest harnesses etc to read
9210 # build configuration details from in a standardized way.
9211 OS_TARGET=${OS_TARGET} \
9212 TARGET_CPU=${TARGET_CPU} \
9213 MOZ_DEBUG=${MOZ_DEBUG} \
9214 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} \
9215 UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
9216 MOZ_CRASHREPORTER=${MOZ_CRASHREPORTER} \
9217 MOZ_APP_NAME=${MOZ_APP_NAME} \
9218 TOPSRCDIR=${_topsrcdir} \
9219 $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
9220 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
9221 rm ./mozinfo.json.tmp
9223 mv -f ./mozinfo.json.tmp ./mozinfo.json
9226 # Run jemalloc configure script
9228 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
9229 ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
9230 if test -n "$MOZ_REPLACE_MALLOC"; then
9231 # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9232 ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9233 ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9235 if test -n "$MOZ_JEMALLOC3"; then
9236 case "${OS_ARCH}" in
9238 # We want jemalloc functions to be kept hidden on both Mac and Windows
9239 # See memory/build/mozmemory_wrap.h for details.
9240 ac_configure_args="$ac_configure_args --without-export"
9243 elif test "${OS_ARCH}" = Darwin; then
9244 # When building as a replace-malloc lib, disabling the zone allocator
9245 # forces to use pthread_atfork.
9246 ac_configure_args="$ac_configure_args --disable-zone-allocator"
9248 _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9250 if test -z "$MOZ_REPLACE_MALLOC"; then
9252 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9256 elif test -z "$MOZ_JEMALLOC3"; then
9258 JEMALLOC_WRAPPER=replace_
9260 if test -n "$MANGLE"; then
9262 if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
9263 JEMALLOC_WRAPPER=__wrap_
9265 for mangle in ${MANGLE}; do
9266 if test -n "$MANGLED"; then
9267 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9269 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9272 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9275 if test -z "$MOZ_TLS"; then
9276 ac_configure_args="$ac_configure_args --disable-tls"
9278 EXTRA_CFLAGS="$CFLAGS"
9279 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9280 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9282 if test "$CROSS_COMPILE"; then
9283 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9285 _save_cache_file="$cache_file"
9286 cache_file=$_objdir/memory/jemalloc/src/config.cache
9288 if ! test -e memory/jemalloc; then
9289 mkdir -p memory/jemalloc
9292 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9293 cache_file="$_save_cache_file"
9294 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9297 # Run freetype configure script
9299 if test "$MOZ_TREE_FREETYPE"; then
9300 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9301 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9302 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9303 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9304 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9305 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9307 if ! test -e modules; then
9311 AC_OUTPUT_SUBDIRS(modules/freetype2)
9314 if test -z "$direct_nspr_config"; then
9315 dnl ========================================================
9316 dnl = Setup a nice relatively clean build environment for
9317 dnl = sub-configures.
9318 dnl ========================================================
9321 CFLAGS="$_SUBDIR_CFLAGS"
9322 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9323 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9324 LDFLAGS="$_SUBDIR_LDFLAGS"
9325 HOST_CC="$_SUBDIR_HOST_CC"
9326 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9327 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9334 # Run all configure scripts specified by a subconfigure
9335 if test -n "$_subconfigure_subdir"; then
9336 _save_ac_configure_args="$ac_configure_args"
9337 ac_configure_args="$_subconfigure_config_args"
9338 AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
9339 ac_configure_args="$_save_ac_configure_args"
9342 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9343 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9347 if test -n "$_WRAP_MALLOC"; then
9348 # Avoid doubling wrap malloc arguments
9349 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9352 if test -z "$MOZ_NATIVE_NSPR"; then
9353 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla --with-android-version=$ANDROID_VERSION"
9354 if test -z "$MOZ_DEBUG"; then
9355 ac_configure_args="$ac_configure_args --disable-debug"
9357 ac_configure_args="$ac_configure_args --enable-debug"
9359 if test "$MOZ_OPTIMIZE" = "1"; then
9360 ac_configure_args="$ac_configure_args --enable-optimize"
9361 elif test -z "$MOZ_OPTIMIZE"; then
9362 ac_configure_args="$ac_configure_args --disable-optimize"
9364 if test -n "$HAVE_64BIT_OS"; then
9365 ac_configure_args="$ac_configure_args --enable-64bit"
9367 if test -n "$USE_ARM_KUSER"; then
9368 ac_configure_args="$ac_configure_args --with-arm-kuser"
9370 ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9371 if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9372 # dladdr is supported by the new linker, even when the system linker doesn't
9373 # support it. Trick nspr into using dladdr when it's not supported.
9374 _SAVE_CPPFLAGS="$CPPFLAGS"
9375 export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9377 _SAVE_LDFLAGS="$LDFLAGS"
9378 export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9379 AC_OUTPUT_SUBDIRS(nsprpub)
9380 LDFLAGS="$_SAVE_LDFLAGS"
9381 if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no; then
9383 CPPFLAGS="$_SAVE_CFLAGS"
9385 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9388 dnl ========================================================
9389 dnl = Setup a nice relatively clean build environment for
9390 dnl = sub-configures.
9391 dnl ========================================================
9394 CFLAGS="$_SUBDIR_CFLAGS"
9395 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9396 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9397 LDFLAGS="$_SUBDIR_LDFLAGS"
9398 HOST_CC="$_SUBDIR_HOST_CC"
9399 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9400 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9403 # Run the SpiderMonkey 'configure' script.
9404 dist=$MOZ_BUILD_ROOT/dist
9405 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9406 ac_configure_args="$ac_configure_args --enable-threadsafe"
9407 if test "$BUILD_CTYPES"; then
9408 # Build js-ctypes on the platforms we can.
9409 ac_configure_args="$ac_configure_args --enable-ctypes"
9411 if test -z "$JS_SHARED_LIBRARY" ; then
9412 ac_configure_args="$ac_configure_args --disable-shared-js"
9414 if test -z "$MOZ_NATIVE_NSPR"; then
9415 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9416 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9418 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9419 ac_configure_args="$ac_configure_args --prefix=$dist"
9420 if test "$MOZ_MEMORY"; then
9421 ac_configure_args="$ac_configure_args --enable-jemalloc"
9423 if test -n "$MOZ_GLUE_LDFLAGS"; then
9424 export MOZ_GLUE_LDFLAGS
9426 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9427 export MOZ_GLUE_PROGRAM_LDFLAGS
9429 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9432 export MOZ_NATIVE_ZLIB
9433 export MOZ_ZLIB_CFLAGS
9434 export MOZ_ZLIB_LIBS
9436 export DONT_POPULATE_VIRTUALENV=1
9438 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9439 export STLPORT_CPPFLAGS
9440 export STLPORT_LDFLAGS
9442 export JS_STANDALONE=no
9444 if ! test -e js; then
9448 AC_OUTPUT_SUBDIRS(js/src)
9449 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9451 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR