1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl This Source Code Form is subject to the terms of the Mozilla Public
4 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
5 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 dnl Process this file with autoconf to produce a configure script.
8 dnl ========================================================
11 AC_INIT(config/config.mk)
12 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
14 TARGET_CPU="${target_cpu}"
15 TARGET_VENDOR="${target_vendor}"
16 TARGET_OS="${target_os}"
18 MOZ_DEB_TIMESTAMP=`date +"%a, %d %b %Y %T %z" 2>&1`
19 AC_SUBST(MOZ_DEB_TIMESTAMP)
21 dnl ========================================================
23 dnl = Don't change the following two lines. Doing so breaks:
25 dnl = CFLAGS="-foo" ./configure
27 dnl ========================================================
29 CPPFLAGS="${CPPFLAGS=}"
30 CXXFLAGS="${CXXFLAGS=}"
32 HOST_CFLAGS="${HOST_CFLAGS=}"
33 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
34 HOST_LDFLAGS="${HOST_LDFLAGS=}"
36 dnl ========================================================
37 dnl = Preserve certain environment flags passed to configure
38 dnl = We want sub projects to receive the same flags
39 dnl = untainted by this configure script
40 dnl ========================================================
43 _SUBDIR_CFLAGS="$CFLAGS"
44 _SUBDIR_CPPFLAGS="$CPPFLAGS"
45 _SUBDIR_CXXFLAGS="$CXXFLAGS"
46 _SUBDIR_LDFLAGS="$LDFLAGS"
47 _SUBDIR_HOST_CC="$HOST_CC"
48 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
49 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
50 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
51 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
53 dnl Set the version number of the libs included with mozilla
54 dnl ========================================================
60 dnl Set the minimum version of toolkit libs used by mozilla
61 dnl ========================================================
68 WINDRES_VERSION=2.14.90
74 STARTUP_NOTIFICATION_VERSION=0.8
80 dnl Set various checks
81 dnl ========================================================
85 dnl Initialize the Pthread test variables early so they can be
86 dnl overridden by each platform.
87 dnl ========================================================
91 dnl Do not allow a separate objdir build if a srcdir build exists.
92 dnl ==============================================================
93 _topsrcdir=`cd \`dirname $0\`; pwd`
96 if test "$_topsrcdir" != "$_objdir"
98 # Check for a couple representative files in the source tree
100 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
101 if test -f $file; then
102 _conflict_files="$_conflict_files $file"
105 if test "$_conflict_files"; then
107 echo "* Your source tree contains these files:"
108 for file in $_conflict_files; do
112 * This indicates that you previously built in the source tree.
113 * A source tree build can confuse the separate objdir build.
115 * To clean up the source tree:
128 COMPILE_ENVIRONMENT=1
129 MOZ_ARG_DISABLE_BOOL(compile-environment,
130 [ --disable-compile-environment
131 Disable compiler/library checks.],
132 COMPILE_ENVIRONMENT= )
133 AC_SUBST(COMPILE_ENVIRONMENT)
135 MOZ_ARG_WITH_STRING(l10n-base,
136 [ --with-l10n-base=DIR path to l10n repositories],
137 L10NBASEDIR=$withval)
138 if test -n "$L10NBASEDIR"; then
139 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
140 AC_MSG_ERROR([--with-l10n-base must specify a path])
141 elif test -d "$L10NBASEDIR"; then
142 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
144 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
147 AC_SUBST(L10NBASEDIR)
149 dnl Check for Perl first -- needed for win32 SDK checks
150 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
151 if test -z "$PERL" -o "$PERL" = ":"; then
152 AC_MSG_ERROR([perl not found in \$PATH])
155 MOZ_ARG_WITH_STRING(gonk,
157 location of gonk dir],
160 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
161 [ --with-gonk-toolchain-prefix=DIR
162 prefix to gonk toolchain commands],
163 gonk_toolchain_prefix=$withval)
165 if test -n "$gonkdir" ; then
166 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
167 android_source="$gonkdir"
168 ANDROID_SOURCE="$android_source"
169 ANDROID_NDK="${ANDROID_SOURCE}/ndk"
172 TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
173 AS="$gonk_toolchain_prefix"as
174 CC="$gonk_toolchain_prefix"gcc
175 CXX="$gonk_toolchain_prefix"g++
176 CPP="$gonk_toolchain_prefix"cpp
177 LD="$gonk_toolchain_prefix"ld
178 AR="$gonk_toolchain_prefix"ar
179 RANLIB="$gonk_toolchain_prefix"ranlib
180 STRIP="$gonk_toolchain_prefix"strip
182 STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/"
183 STLPORT_LIBS="-lstlport"
185 case "$target_cpu" in
194 CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice -I$gonkdir/frameworks/base/services/camera"
195 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
196 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
197 dnl Add -llog by default, since we use it all over the place.
198 LIBS="$LIBS -llog $STLPORT_LIBS"
200 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"
202 dnl prevent cross compile section from using these flags as host flags
203 if test -z "$HOST_CPPFLAGS" ; then
206 if test -z "$HOST_CFLAGS" ; then
209 if test -z "$HOST_CXXFLAGS" ; then
212 if test -z "$HOST_LDFLAGS" ; then
217 AC_DEFINE(HAVE_SYS_UIO_H)
218 AC_DEFINE(HAVE_PTHREADS)
220 MOZ_CHROME_FILE_FORMAT=omni
226 *-android*|*-linuxandroid*)
227 if test -z "$ANDROID_PACKAGE_NAME" ; then
228 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
230 MOZ_CHROME_FILE_FORMAT=omni
234 AC_PATH_PROG(OBJCOPY,objcopy)
239 AC_SUBST(ANDROID_SOURCE)
240 AC_SUBST(ANDROID_PACKAGE_NAME)
243 dnl ========================================================
244 dnl Checks for compilers.
245 dnl ========================================================
246 dnl Set CROSS_COMPILE in the environment when running configure
247 dnl to use the cross-compile setup for now
248 dnl ========================================================
250 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
253 if test "$COMPILE_ENVIRONMENT"; then
255 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
256 echo "cross compiling from $host to $target"
260 _SAVE_CFLAGS="$CFLAGS"
261 _SAVE_LDFLAGS="$LDFLAGS"
263 AC_MSG_CHECKING([for host c compiler])
264 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
265 if test -z "$HOST_CC"; then
266 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
268 AC_MSG_RESULT([$HOST_CC])
269 AC_MSG_CHECKING([for host c++ compiler])
270 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
271 if test -z "$HOST_CXX"; then
272 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
274 AC_MSG_RESULT([$HOST_CXX])
276 if test -z "$HOST_CFLAGS"; then
277 HOST_CFLAGS="$CFLAGS"
279 if test -z "$HOST_CXXFLAGS"; then
280 HOST_CXXFLAGS="$CXXFLAGS"
282 if test -z "$HOST_LDFLAGS"; then
283 HOST_LDFLAGS="$LDFLAGS"
285 if test -z "$HOST_AR_FLAGS"; then
286 HOST_AR_FLAGS="$AR_FLAGS"
288 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
289 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
291 CFLAGS="$HOST_CFLAGS"
292 LDFLAGS="$HOST_LDFLAGS"
294 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
295 AC_TRY_COMPILE([], [return(0);],
296 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
297 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
300 CFLAGS="$HOST_CXXFLAGS"
302 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
303 AC_TRY_COMPILE([], [return(0);],
304 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
305 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
309 LDFLAGS=$_SAVE_LDFLAGS
311 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
314 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
318 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
319 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
320 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
321 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
322 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
323 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
324 AC_DEFINE(CROSS_COMPILE)
329 # Work around the conftest.exe access problem on Windows
334 MOZ_PATH_PROGS(AS, $AS as, $CC)
335 AC_CHECK_PROGS(AR, ar, :)
336 AC_CHECK_PROGS(LD, ld, :)
337 AC_CHECK_PROGS(STRIP, strip, :)
338 AC_CHECK_PROGS(WINDRES, windres, :)
339 if test -z "$HOST_CC"; then
342 if test -z "$HOST_CFLAGS"; then
343 HOST_CFLAGS="$CFLAGS"
345 if test -z "$HOST_CXX"; then
348 if test -z "$HOST_CXXFLAGS"; then
349 HOST_CXXFLAGS="$CXXFLAGS"
351 if test -z "$HOST_LDFLAGS"; then
352 HOST_LDFLAGS="$LDFLAGS"
354 if test -z "$HOST_RANLIB"; then
355 HOST_RANLIB="$RANLIB"
357 if test -z "$HOST_AR"; then
360 if test -z "$HOST_AR_FLAGS"; then
361 HOST_AR_FLAGS="$AR_FLAGS"
365 if test -n "$MOZ_WINCONSOLE"; then
366 AC_DEFINE(MOZ_WINCONSOLE)
371 dnl ========================================================
372 dnl Special win32 checks
373 dnl ========================================================
375 # With win8, sdk target=602, WINVER=602
376 MOZ_ARG_ENABLE_BOOL(metro,
377 [ --enable-metro Enable Windows Metro build targets],
380 if test -n "$MOZ_METRO"; then
382 # Target the Windows 8 Kit
384 # Allow a higher api set
386 # toolkit/library/makefile.in needs these, see nsDllMain.
388 CRTEXPDLLVERSION=1-1-0
390 # Target the Windows 7 SDK by default
395 AC_SUBST(CRTDLLVERSION)
396 AC_SUBST(CRTEXPDLLVERSION)
398 if test -n "$MOZ_METRO"; then
403 AC_MSG_ERROR([Metro builds only valid on the windows platform.]);
408 MOZ_ARG_WITH_STRING(windows-version,
409 [ --with-windows-version=WINSDK_TARGETVER
410 Windows SDK version to target. Lowest version
411 currently allowed is 601 (Win7), highest is 602 (Win8)],
412 WINSDK_TARGETVER=$withval)
414 # Currently only two sdk versions allowed, 601 and 602
415 case "$WINSDK_TARGETVER" in
417 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
421 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
427 if test "$GCC" != "yes"; then
428 # Check to see if we are really running in a msvc environemnt
430 AC_CHECK_PROGS(MIDL, midl)
432 # Make sure compilers are valid
433 CFLAGS="$CFLAGS -TC -nologo"
434 CXXFLAGS="$CXXFLAGS -TP -nologo"
437 AC_TRY_COMPILE([#include <stdio.h>],
438 [ printf("Hello World\n"); ],,
439 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
442 AC_TRY_COMPILE([#include <new.h>],
443 [ unsigned *test = new unsigned(42); ],,
444 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
448 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
451 # Determine compiler version
452 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
453 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
454 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
455 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
456 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
457 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
459 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
460 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
462 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
463 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
466 if test "$_CC_MAJOR_VERSION" = "14"; then
467 dnl Require VC8SP1 or newer.
468 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
469 if test "$_CC_RELEASE" -lt 50727 -o \
470 \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
471 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.])
476 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
477 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
478 elif test "$_CC_MAJOR_VERSION" = "15"; then
481 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
482 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
483 elif test "$_CC_MAJOR_VERSION" = "16"; then
486 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
487 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
488 elif test "$_CC_MAJOR_VERSION" = "17"; then
491 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
492 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
494 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
497 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
499 if test -n "$WIN32_REDIST_DIR"; then
500 if test ! -d "$WIN32_REDIST_DIR"; then
501 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
503 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
506 dnl Confirm we have the pri tools on win8 builds
507 if test -n "$MOZ_METRO"; then
508 AC_MSG_CHECKING([for makepri])
509 AC_CHECK_PROGS(MAKEPRI, makepri, "")
510 if test -z "MAKEPRI" ; then
511 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
516 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
517 dnl not something else like "magnetic tape manipulation utility".
518 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
519 if test -z "$MSMT_TOOL"; then
520 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
524 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
526 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
527 if test -z "$MSMANIFEST_TOOL_VERSION"; then
528 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
534 # Check linker version
535 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
536 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
537 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
538 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
544 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
545 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
546 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
547 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
548 # Add flags if necessary
549 AC_MSG_CHECKING([for midl flags])
552 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
553 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
554 # MIDL version 7.00.0500 or later has no problem.
555 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
556 AC_MSG_RESULT([need -env win32])
558 AC_MSG_RESULT([none needed])
562 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
565 AC_MSG_RESULT([none needed])
569 # Identify which version of the SDK we're building with
570 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
572 MOZ_CHECK_HEADERS([winsdkver.h])
573 if test "$ac_cv_header_winsdkver_h" = "yes"; then
574 # Get the highest _WIN32_WINNT and NTDDI versions supported
575 # Take the higher of the two
576 # This is done because the Windows 7 beta SDK reports its
577 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
578 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
580 [cat > conftest.h <<EOF
581 #include <winsdkver.h>
582 #include <sdkddkver.h>
584 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
585 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
587 #define WINSDK_MAXVER NTDDI_MAXVER
592 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
595 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
597 # Any SDK which doesn't have WinSDKVer.h is too old.
598 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.])
601 unset _MSVC_VER_FILTER
603 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
607 _SAVE_CXXFLAGS="$CXXFLAGS"
608 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
609 AC_TRY_COMPILE([#include <exception>],
610 [std::_Throw(std::exception()); return 0;],
611 ac_cv_have_std__Throw="yes",
612 ac_cv_have_std__Throw="no")
613 CXXFLAGS="$_SAVE_CXXFLAGS"
617 if test "$ac_cv_have_std__Throw" = "yes"; then
618 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
619 ac_cv_have_dllimport_exception_bug,
623 _SAVE_CXXFLAGS="$CXXFLAGS"
624 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
625 AC_TRY_LINK([#include <vector>],
626 [std::vector<int> v; return v.at(1);],
627 ac_cv_have_dllimport_exception_bug="no",
628 ac_cv_have_dllimport_exception_bug="yes")
629 CXXFLAGS="$_SAVE_CXXFLAGS"
632 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
634 MOZ_MSVC_STL_WRAP__Throw=1
635 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
638 AC_CACHE_CHECK(for overridable _RAISE,
643 _SAVE_CXXFLAGS="$CXXFLAGS"
644 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
645 AC_TRY_COMPILE([#include <xstddef>
647 #define _RAISE(x) externallyDefinedFunction((x).what())
650 [std::vector<int> v; return v.at(1);],
651 ac_cv_have__RAISE="no",
652 ac_cv_have__RAISE="yes")
653 CXXFLAGS="$_SAVE_CXXFLAGS"
656 if test "$ac_cv_have__RAISE" = "yes"; then
658 MOZ_MSVC_STL_WRAP__RAISE=1
659 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
661 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
665 if test "$WRAP_STL_INCLUDES" = "1"; then
666 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
669 # Check w32api version
670 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
671 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
672 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
673 AC_TRY_COMPILE([#include <w32api.h>],
674 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
675 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
676 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
677 #error "test failed."
679 , [ res=yes ], [ res=no ])
680 AC_MSG_RESULT([$res])
681 if test "$res" != "yes"; then
682 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
684 # Check windres version
685 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
686 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
687 AC_MSG_RESULT([$_WINDRES_VERSION])
688 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
689 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
690 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
691 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
692 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
693 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
694 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
695 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
696 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
697 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
698 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
699 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
701 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
704 MOZ_WINSDK_MAXVER=0x06020000
707 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
708 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
709 # Require OS features provided by IE 6.0 SP2 (XP SP2)
710 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
712 # If the maximum version supported by this SDK is lower than the target
714 AC_MSG_CHECKING([for Windows SDK being recent enough])
715 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
719 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.])
722 # Make sure the sdk / code we're targeting has the right toolset
723 AC_MSG_CHECKING([SDK and tools are in sync])
724 if test -n "$MOZ_METRO"; then
725 if test "$MOZ_MSVCVERSION" -gt "10"; then
729 AC_MSG_ERROR([Your MOZ_MSVCVERSION equals $MOZ_MSVCVERSION and you've enabled metro build support. You can't target metro without msvc 11 or higher. Disable metro support or switch to a newer set of tools.])
733 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
734 # Definitions matching sdkddkver.h
735 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
742 if test -n "$_WIN32_MSVC"; then
744 SKIP_COMPILER_CHECKS=1
745 SKIP_LIBRARY_CHECKS=1
747 # Since we're skipping compiler and library checks, hard-code
750 AC_DEFINE(HAVE_SETBUF)
751 AC_DEFINE(HAVE_ISATTY)
752 if test $_MSC_VER -ge 1600; then
753 AC_DEFINE(HAVE_NULLPTR)
757 fi # COMPILE_ENVIRONMENT
770 AC_SUBST(WRAP_STL_INCLUDES)
771 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
772 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
774 dnl ========================================================
775 dnl Checks for programs.
776 dnl ========================================================
780 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
781 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
782 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
784 AC_MSG_RESULT([$_perl_version])
786 if test "$_perl_res" != 0; then
787 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
791 AC_MSG_CHECKING([for full perl installation])
792 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
794 if test "$_perl_res" != 0; then
796 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
801 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
802 if test -z "$PYTHON"; then
803 AC_MSG_ERROR([python was not found in \$PATH])
806 MOZ_ARG_WITH_BOOL(system-ply,
807 [ --with-system-ply Use system installed python ply library],
808 [if $PYTHON -c 'import ply' 2>&5; then
811 AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
814 AC_SUBST(MOZ_SYSTEM_PLY)
816 if test -z "$COMPILE_ENVIRONMENT"; then
817 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
819 AC_SUBST(NSINSTALL_BIN)
821 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
822 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
823 MOZ_PATH_PROGS(UNZIP, unzip)
824 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
825 AC_MSG_ERROR([unzip not found in \$PATH])
827 MOZ_PATH_PROGS(ZIP, zip)
828 if test -z "$ZIP" -o "$ZIP" = ":"; then
829 AC_MSG_ERROR([zip not found in \$PATH])
831 MOZ_PATH_PROG(XARGS, xargs)
832 if test -z "$XARGS" -o "$XARGS" = ":"; then
833 AC_MSG_ERROR([xargs not found in \$PATH .])
836 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
839 if test "$COMPILE_ENVIRONMENT"; then
841 dnl ========================================================
842 dnl = Mac OS X toolchain support
843 dnl ========================================================
847 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
848 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
849 dnl the environment and includedir purposes (when using an SDK, below),
850 dnl but remember the full version number for the libdir (SDK).
852 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
853 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
855 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
856 dnl Bug 280479, but this keeps popping up in bug 292530 too because
857 dnl 4.0.0/4061 is the default compiler in Tiger.
859 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
861 if test "$GCC_BUILD" = "4061" ; then
862 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
863 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
864 from building Mozilla. Upgrade to Xcode 2.1 or later.])
868 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
869 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
870 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
871 MOZ_PATH_PROGS(PBBUILD_BIN, pbbuild xcodebuild pbxbuild)
873 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
874 dnl it has moved into /usr/bin.
875 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
879 AC_SUBST(GCC_VERSION)
881 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
882 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
883 dnl when we can run target binaries.
884 AC_SUBST(UNIVERSAL_BINARY)
885 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
887 dnl ========================================================
888 dnl Check for MacOS deployment target version
889 dnl ========================================================
891 MOZ_ARG_ENABLE_STRING(macos-target,
892 [ --enable-macos-target=VER (default=10.6)
893 Set the minimum MacOS version needed at runtime],
894 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
898 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
899 dnl Use the specified value
900 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
902 dnl No value specified on the command line or in the environment,
903 dnl use architecture minimum.
904 export MACOSX_DEPLOYMENT_TARGET=10.6
909 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
911 dnl ========================================================
912 dnl = Mac OS X SDK support
913 dnl ========================================================
916 MOZ_ARG_WITH_STRING(macos-sdk,
917 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
918 MACOS_SDK_DIR=$withval)
920 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
921 dnl NEXT_ROOT will be set and exported only if it's needed.
922 AC_SUBST(MACOS_SDK_DIR)
925 if test "$MACOS_SDK_DIR"; then
926 dnl Sync this section with the ones in NSPR and NSS.
927 dnl Changes to the cross environment here need to be accounted for in
928 dnl the libIDL checks (below) and xpidl build.
930 if test ! -d "$MACOS_SDK_DIR"; then
931 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
932 specify a valid SDK. SDKs are installed when the optional cross-development
933 tools are selected during the Xcode/Developer Tools installation.])
936 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
937 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
938 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
940 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
941 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
943 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
944 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
945 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
947 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
948 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
949 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
950 dnl be ignored and cause warnings when -syslibroot is specified.
951 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
952 dnl the -isysroot it receives, so this is only needed with 4.0.0.
953 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
958 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
960 AC_TRY_COMPILE([#include <new>],[],
964 AC_MSG_RESULT($result)
966 if test "$result" = "no" ; then
967 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
971 fi # COMPILE_ENVIRONMENT
973 AC_MSG_CHECKING([compiler version])
974 # Just print it so it shows up in the logs.
975 cc_version=$($CC --version)
976 AC_MSG_RESULT([$cc_version])
978 if test -n "$MAKE"; then
979 if test `echo $MAKE | grep -c make.py` != 1; then
986 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
989 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
992 if test "$GMAKE" = ":"; then
993 AC_MSG_ERROR([GNU make not found])
997 if test -z "$MAKE"; then
1001 if test "$COMPILE_ENVIRONMENT"; then
1007 fi # COMPILE_ENVIRONMENT
1009 dnl ========================================================
1010 dnl set the defaults first
1011 dnl ========================================================
1014 AR_EXTRACT='$(AR) x'
1027 MOZ_USER_DIR=".mozilla"
1030 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
1032 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1034 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
1036 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1037 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1038 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1039 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1040 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1041 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1042 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1043 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1045 # These are specially defined on Windows only
1048 XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1049 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
1052 XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
1053 XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
1059 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1061 USE_DEPENDENT_LIBS=1
1063 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1065 if test -n "$CROSS_COMPILE"; then
1066 OS_TARGET="${target_os}"
1067 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1069 case "${target_os}" in
1070 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1071 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1072 gnu*) OS_ARCH=GNU ;;
1073 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1074 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
1075 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1078 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1081 OS_TARGET=`uname -s`
1082 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1083 OS_RELEASE=`uname -r`
1086 # Before this used `uname -m` when not cross compiling
1087 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1088 OS_TEST="${target_cpu}"
1090 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1092 #######################################################################
1093 # Master "Core Components" macros for getting the OS target #
1094 #######################################################################
1097 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1098 # cross-compilation.
1102 # Define and override various archtecture-specific variables, including
1111 case "$HOST_OS_ARCH" in
1125 if test -z "$GNU_CC"; then
1126 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1131 if test -z "$GNU_CXX"; then
1132 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1133 SOLARIS_SUNPRO_CXX=1
1136 AC_SUBST(SOLARIS_SUNPRO_CC)
1137 AC_SUBST(SOLARIS_SUNPRO_CXX)
1149 if test -z "$CROSS_COMPILE" ; then
1155 # If uname -s returns "Windows_NT", we assume that we are using
1156 # the uname.exe in MKS toolkit.
1158 # The -r option of MKS uname only returns the major version number.
1159 # So we need to use its -v option to get the minor version number.
1160 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1164 OS_MINOR_RELEASE=`uname -v`
1165 if test "$OS_MINOR_RELEASE" = "00"; then
1168 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1172 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1173 # the uname.exe in the MSYS tools.
1175 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1180 OS_RELEASE=`uname -v`.`uname -r`
1181 OS_TEST=${target_cpu}
1189 OS_RELEASE=`uname -v`
1192 case "${target_cpu}" in
1203 if test -z "$CROSS_COMPILE" ; then
1211 # Only set CPU_ARCH if we recognize the value of OS_TEST
1222 powerpc | ppc | rs6000)
1226 Alpha | alpha | ALPHA)
1259 if test -z "$OS_TARGET"; then
1262 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1264 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1265 dnl ===============================================================
1269 INTEL_ARCHITECTURE=1
1272 dnl Configure platform-specific CPU architecture compiler options.
1273 dnl ==============================================================
1276 dnl =================================================================
1277 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1278 dnl which is bad when cross compiling.
1279 dnl =================================================================
1280 if test "$COMPILE_ENVIRONMENT"; then
1281 configure_static_assert_macros='
1282 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1283 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1284 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1287 dnl test that the macros actually work:
1288 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1289 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1292 ac_cv_static_assertion_macros_work="yes"
1293 AC_TRY_COMPILE([$configure_static_assert_macros],
1294 [CONFIGURE_STATIC_ASSERT(1)],
1296 ac_cv_static_assertion_macros_work="no")
1297 AC_TRY_COMPILE([$configure_static_assert_macros],
1298 [CONFIGURE_STATIC_ASSERT(0)],
1299 ac_cv_static_assertion_macros_work="no",
1302 AC_TRY_COMPILE([$configure_static_assert_macros],
1303 [CONFIGURE_STATIC_ASSERT(1)],
1305 ac_cv_static_assertion_macros_work="no")
1306 AC_TRY_COMPILE([$configure_static_assert_macros],
1307 [CONFIGURE_STATIC_ASSERT(0)],
1308 ac_cv_static_assertion_macros_work="no",
1312 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1313 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1314 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1316 fi # COMPILE_ENVIRONMENT
1318 dnl ========================================================
1319 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1321 dnl ========================================================
1325 dnl ========================================================
1326 dnl Suppress Clang Argument Warnings
1327 dnl ========================================================
1328 if test -n "$CLANG_CC"; then
1329 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1330 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1332 if test -n "$CLANG_CXX"; then
1333 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1336 dnl ========================================================
1337 dnl = Use Address Sanitizer
1338 dnl ========================================================
1339 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1340 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1343 if test -n "$MOZ_ASAN"; then
1349 dnl ========================================================
1350 dnl = Enable hacks required for LLVM instrumentations
1351 dnl ========================================================
1352 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1353 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1356 if test -n "$MOZ_LLVM_HACKS"; then
1360 AC_SUBST(MOZ_NO_WLZDEFS)
1361 AC_SUBST(MOZ_CFLAGS_NSS)
1363 dnl ========================================================
1364 dnl GNU specific defaults
1365 dnl ========================================================
1366 if test "$GNU_CC"; then
1367 # FIXME: Let us build with strict aliasing. bug 414641.
1368 CFLAGS="$CFLAGS -fno-strict-aliasing"
1369 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1370 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1371 DSO_LDOPTS='-shared'
1372 if test "$GCC_USE_GNU_LD"; then
1373 # Some tools like ASan use a runtime library that is only
1374 # linked against executables, so we must allow undefined
1375 # symbols for shared objects in some cases.
1376 if test -z "$MOZ_NO_WLZDEFS"; then
1377 # Don't allow undefined symbols in libraries
1378 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1381 WARNINGS_AS_ERRORS='-Werror -Wno-error=uninitialized'
1383 DSO_PIC_CFLAGS='-fPIC'
1384 ASFLAGS="$ASFLAGS -fPIC"
1385 AC_MSG_CHECKING([for --noexecstack option to as])
1386 _SAVE_CFLAGS=$CFLAGS
1387 CFLAGS="$CFLAGS -Wa,--noexecstack"
1388 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1389 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1390 AC_MSG_RESULT([no]))
1391 CFLAGS=$_SAVE_CFLAGS
1392 AC_MSG_CHECKING([for -z noexecstack option to ld])
1393 _SAVE_LDFLAGS=$LDFLAGS
1394 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1395 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1397 LDFLAGS=$_SAVE_LDFLAGS)
1399 # Check for -mssse3 on $CC
1400 AC_MSG_CHECKING([for -mssse3 option to $CC])
1401 HAVE_COMPILER_FLAG_MSSSE3=
1402 _SAVE_CFLAGS=$CFLAGS
1403 CFLAGS="$CFLAGS -mssse3"
1404 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1405 [HAVE_COMPILER_FLAG_MSSSE3=1],
1406 AC_MSG_RESULT([no]))
1407 CFLAGS=$_SAVE_CFLAGS
1408 AC_SUBST(HAVE_COMPILER_FLAG_MSSSE3)
1410 # Turn on GNU-specific warnings:
1411 # -Wall - turn on a lot of warnings
1412 # -pedantic - this is turned on below
1413 # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1414 # -Wdeclaration-after-statement - MSVC doesn't like these
1415 # -Werror=return-type - catches missing returns, zero false positives
1416 # -Wtype-limits - catches overflow bugs, few false positives
1417 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1419 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1420 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1421 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1422 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1424 # Turn off the following warnings that -Wall/-pedantic turn on:
1425 # -Wno-unused - lots of violations in third-party code
1426 # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1428 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1429 MOZ_C_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_c_has_wno_overlength_strings)
1431 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1432 # Don't use -Wcast-align with ICC or clang
1434 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1435 hppa | ia64 | sparc | arm)
1438 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1443 dnl Turn pedantic on but disable the warnings for long long
1446 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1447 _USE_CPP_INCLUDE_FLAG=1
1449 elif test "$SOLARIS_SUNPRO_CC"; then
1451 if test "$CPU_ARCH" = "sparc"; then
1452 # for Sun Studio on Solaris/SPARC
1453 DSO_PIC_CFLAGS='-xcode=pic32'
1455 DSO_PIC_CFLAGS='-KPIC'
1457 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1459 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1460 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1462 DSO_LDOPTS='-shared'
1463 if test "$GNU_LD"; then
1464 # Don't allow undefined symbols in libraries
1465 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1469 DSO_PIC_CFLAGS='-KPIC'
1470 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1473 if test "$GNU_CXX"; then
1474 # FIXME: Let us build with strict aliasing. bug 414641.
1475 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1477 # Turn on GNU-specific warnings:
1478 # -Wall - turn on a lot of warnings
1479 # -pedantic - this is turned on below
1480 # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1481 # -Woverloaded-virtual - ???
1482 # -Werror=return-type - catches missing returns, zero false positives
1483 # -Wtype-limits - catches overflow bugs, few false positives
1484 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1486 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1487 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1488 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1489 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1491 # Turn off the following warnings that -Wall/-pedantic turn on:
1492 # -Wno-ctor-dtor-privacy - ???
1493 # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1494 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1495 # -Wno-variadic-macros - ???
1497 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-ctor-dtor-privacy"
1498 MOZ_CXX_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_cxx_has_wno_overlength_strings)
1499 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1500 MOZ_CXX_SUPPORTS_WARNING(-Wno-, variadic-macros, ac_cxx_has_wno_variadic_macros)
1502 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1503 # Don't use -Wcast-align with ICC or clang
1505 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1506 hppa | ia64 | sparc | arm)
1509 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1514 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1515 _USE_CPP_INCLUDE_FLAG=1
1517 # Recent clang and gcc support C++11 deleted functions without warnings if
1518 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1519 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1520 # unused. But clang's warning can be disabled, so when compiling with clang
1521 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1522 # deleted function syntax.
1523 if test "$CLANG_CXX"; then
1524 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1525 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1529 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1532 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1533 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1534 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1535 dnl normal behavior.
1536 dnl ========================================================
1538 MKSHLIB_UNFORCE_ALL=
1540 if test "$COMPILE_ENVIRONMENT"; then
1541 if test "$GNU_CC"; then
1542 AC_MSG_CHECKING(whether ld has archive extraction flags)
1543 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1544 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1545 ac_cv_mkshlib_force_and_unforce="no"
1546 exec 3<&0 <<LOOP_INPUT
1547 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1548 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1549 force="-Wl,-all"; unforce="-Wl,-none"
1556 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1559 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1561 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1565 eval $ac_cv_mkshlib_force_and_unforce
1566 MKSHLIB_FORCE_ALL=$force
1567 MKSHLIB_UNFORCE_ALL=$unforce
1570 fi # COMPILE_ENVIRONMENT
1572 dnl ========================================================
1573 dnl Checking for 64-bit OS
1574 dnl ========================================================
1575 if test "$COMPILE_ENVIRONMENT"; then
1578 AC_MSG_CHECKING(for 64-bit OS)
1579 AC_TRY_COMPILE([$configure_static_assert_macros],
1580 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1581 result="yes", result="no")
1582 AC_MSG_RESULT("$result")
1583 if test "$result" = "yes"; then
1584 AC_DEFINE(HAVE_64BIT_OS)
1587 AC_SUBST(HAVE_64BIT_OS)
1589 fi # COMPILE_ENVIRONMENT
1591 dnl ========================================================
1592 dnl Enable high-memory support on OS/2 by default.
1593 dnl ========================================================
1594 MOZ_OS2_HIGH_MEMORY=1
1595 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1596 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1597 MOZ_OS2_HIGH_MEMORY=,
1598 MOZ_OS2_HIGH_MEMORY=1 )
1599 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1601 dnl ========================================================
1602 dnl = Use profiling compile flags
1603 dnl ========================================================
1604 MOZ_ARG_ENABLE_BOOL(profiling,
1605 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1609 # For profiling builds keep the symbol information
1610 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1611 STRIP_FLAGS="--strip-debug"
1614 dnl ========================================================
1616 dnl ========================================================
1617 MOZ_ARG_ENABLE_BOOL(valgrind,
1618 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1621 if test -n "$MOZ_VALGRIND"; then
1622 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1624 [--enable-valgrind specified but Valgrind is not installed]))
1625 AC_DEFINE(MOZ_VALGRIND)
1627 AC_SUBST(MOZ_VALGRIND)
1629 dnl ========================================================
1631 dnl ========================================================
1632 MOZ_ARG_ENABLE_BOOL(dmd,
1633 [ --enable-dmd Enable DMD; also disables jemalloc (default=no)],
1636 if test -n "$MOZ_DMD"; then
1637 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1639 [--enable-dmd specified but Valgrind is not installed]))
1643 dnl ========================================================
1645 dnl ========================================================
1646 MOZ_ARG_ENABLE_BOOL(jprof,
1647 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1650 if test -n "$MOZ_JPROF"; then
1652 AC_DEFINE(MOZ_JPROF)
1655 dnl ========================================================
1657 dnl ========================================================
1658 MOZ_ENABLE_PROFILER_SPS=1
1660 case "${OS_TARGET}" in
1662 case "${CPU_ARCH}" in
1665 MOZ_ENABLE_PROFILER_SPS=
1669 case "${CPU_ARCH}" in
1672 MOZ_ENABLE_PROFILER_SPS=
1677 MOZ_ENABLE_PROFILER_SPS=
1681 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1682 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1685 dnl ========================================================
1687 dnl ========================================================
1688 MOZ_ARG_ENABLE_BOOL(shark,
1689 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1692 if test -n "$MOZ_SHARK"; then
1694 AC_DEFINE(MOZ_SHARK)
1697 dnl ========================================================
1699 dnl ========================================================
1700 MOZ_ARG_ENABLE_BOOL(callgrind,
1701 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1704 if test -n "$MOZ_CALLGRIND"; then
1706 AC_DEFINE(MOZ_CALLGRIND)
1709 dnl ========================================================
1711 dnl ========================================================
1712 MOZ_ARG_ENABLE_BOOL(vtune,
1713 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1716 if test -n "$MOZ_VTUNE"; then
1718 AC_DEFINE(MOZ_VTUNE)
1721 dnl ========================================================
1723 dnl ========================================================
1724 if test -n "$MOZ_PROFILING"; then
1725 AC_DEFINE(MOZ_PROFILING)
1728 dnl ========================================================
1729 dnl System overrides of the defaults for host
1730 dnl ========================================================
1733 if test -n "$_WIN32_MSVC"; then
1735 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1736 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1737 HOST_RANLIB='echo ranlib'
1739 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1741 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1742 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1743 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1744 HOST_BIN_SUFFIX=.exe
1747 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1751 case "${host_cpu}" in
1753 if test -n "$_WIN32_MSVC"; then
1754 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1758 if test -n "$_WIN32_MSVC"; then
1759 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1761 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1767 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1768 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1769 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1772 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1773 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1774 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1775 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1779 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1780 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1781 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1782 HOST_BIN_SUFFIX=.exe
1787 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1788 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1792 dnl We require version 2.5 or newer of Python to build.
1793 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
1795 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
1798 if test "$_python_res" != 0; then
1799 AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
1801 AC_MSG_RESULT([yes])
1803 dnl Check for using a custom <stdint.h> implementation
1804 dnl ========================================================
1805 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1806 if test "$MOZ_CUSTOM_STDINT_H"; then
1807 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1808 AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1810 AC_MSG_RESULT(none specified)
1813 dnl Get mozilla version from central milestone file
1814 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1815 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1817 dnl Get version of various core apps from the version files.
1818 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1820 if test -z "$FIREFOX_VERSION"; then
1821 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1824 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1825 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1826 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1828 MOZ_DOING_LTO(lto_is_enabled)
1830 dnl ========================================================
1831 dnl System overrides of the defaults for target
1832 dnl ========================================================
1837 if test ! "$GNU_CC"; then
1838 if test ! "$HAVE_64BIT_OS"; then
1839 # Compiling with Visual Age C++ object model compat is the
1840 # default. To compile with object model ibm, add
1841 # AIX_OBJMODEL=ibm to .mozconfig.
1842 if test "$AIX_OBJMODEL" = "ibm"; then
1843 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1850 AC_SUBST(AIX_OBJMODEL)
1851 DSO_LDOPTS='-qmkshrobj=1'
1852 DSO_CFLAGS='-qflag=w:w'
1854 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1856 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1857 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1858 if test "$COMPILE_ENVIRONMENT"; then
1861 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1863 [#if (__IBMCPP__ < 900)
1864 #error "Bad compiler"
1866 _BAD_COMPILER=,_BAD_COMPILER=1)
1867 if test -n "$_BAD_COMPILER"; then
1869 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1871 AC_MSG_RESULT([yes])
1874 TARGET_COMPILER_ABI="ibmc"
1875 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1876 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1879 case "${target_os}" in
1884 if test "$COMPILE_ENVIRONMENT"; then
1885 MOZ_CHECK_HEADERS(sys/inttypes.h)
1887 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1891 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1900 _WARNINGS_CFLAGS="-Wall"
1901 _WARNINGS_CXXFLAGS="-Wall"
1902 # The test above doesn't work properly, at least on 3.1.
1903 MKSHLIB_FORCE_ALL=''
1904 MKSHLIB_UNFORCE_ALL=''
1910 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1911 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1912 MOZ_OPTIMIZE_FLAGS="-O3"
1914 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1915 if test "$HAVE_64BIT_OS"; then
1920 STRIP="$STRIP -x -S"
1921 # Check whether we're targeting OS X or iOS
1922 AC_CACHE_CHECK(for iOS target,
1924 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1925 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1929 ac_cv_ios_target="yes",
1930 ac_cv_ios_target="no")])
1931 if test "$ac_cv_ios_target" = "yes"; then
1933 AC_DEFINE(XP_DARWIN)
1934 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1936 AC_DEFINE(XP_MACOSX)
1937 AC_DEFINE(XP_DARWIN)
1938 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1939 # The ExceptionHandling framework is needed for Objective-C exception
1940 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1942 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1944 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1947 if test "x$lto_is_enabled" = "xyes"; then
1948 echo "Skipping -dead_strip because lto is enabled."
1949 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1950 dnl ===================================================================
1951 elif test "x$enable_dtrace" = "xyes"; then
1952 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1954 dnl check for the presence of the -dead_strip linker flag
1955 AC_MSG_CHECKING([for -dead_strip option to ld])
1956 _SAVE_LDFLAGS=$LDFLAGS
1957 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1958 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1959 if test -n "$_HAVE_DEAD_STRIP" ; then
1960 AC_MSG_RESULT([yes])
1961 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1966 LDFLAGS=$_SAVE_LDFLAGS
1969 dnl With newer linkers we need to pass -allow_heap_execute because of
1970 dnl Microsoft Silverlight (5.1.10411.0 at least).
1971 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1972 _SAVE_LDFLAGS=$LDFLAGS
1973 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1974 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1975 _HAVE_ALLOW_HEAP_EXECUTE=)
1976 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1977 AC_MSG_RESULT([yes])
1978 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1982 LDFLAGS=$_SAVE_LDFLAGS
1984 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1989 if test ! "$GNU_CC"; then
1993 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1994 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1995 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1998 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1999 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2002 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2003 AC_DEFINE(_LARGEFILE64_SOURCE)
2008 if test ! "$GNU_CC"; then
2009 DSO_LDOPTS='-b -Wl,+s'
2012 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2013 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2014 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2016 DSO_LDOPTS='-b -E +s'
2017 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2018 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2020 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2021 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2024 *-android*|*-linuxandroid*)
2025 AC_DEFINE(NO_PW_GECOS)
2027 if test -n "$gonkdir"; then
2028 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2032 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2035 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2037 MOZ_GFX_OPTIMIZE_MOBILE=1
2038 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2042 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2043 # Similarly for GNU_CXX and INTEL_CXX.
2044 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2045 # -Os has been broken on Intel's C/C++ compilers for quite a
2046 # while; Intel recommends against using it.
2047 MOZ_OPTIMIZE_FLAGS="-O2"
2048 MOZ_DEBUG_FLAGS="-g"
2049 elif test "$GNU_CC" -o "$GNU_CXX"; then
2050 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2051 case $GCC_VERSION in
2053 # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2054 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2056 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2057 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2058 MOZ_DEBUG_FLAGS="-g"
2061 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2065 case "${target_cpu}" in
2067 CFLAGS="$CFLAGS -mieee"
2068 CXXFLAGS="$CXXFLAGS -mieee"
2074 MOZ_DEBUG_FLAGS="-g" # We want inlining
2078 if test -z "$MC"; then
2088 # certain versions of cygwin's makedepend barf on the
2089 # #include <string> vs -I./dist/include/string issue so don't use it
2090 if test -n "$GNU_CC"; then
2092 CXX="$CXX -mwindows"
2093 CPP="$CPP -mwindows"
2094 CFLAGS="$CFLAGS -mms-bitfields"
2095 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2096 DSO_LDOPTS='-shared'
2097 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2098 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2100 # Use temp file for windres (bug 213281)
2101 RCFLAGS='-O coff --use-temp-file'
2102 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2103 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv"
2105 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2106 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2108 IMPORT_LIB_SUFFIX=dll.a
2109 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2111 TARGET_COMPILER_ABI=msvc
2115 if test "$AS_BIN"; then
2116 AS="$(basename "$AS_BIN")"
2119 AR_FLAGS='-NOLOGO -OUT:"$@"'
2121 RANLIB='echo not_ranlib'
2122 STRIP='echo not_strip'
2133 IMPORT_LIB_SUFFIX=lib
2134 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2135 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2137 MKSHLIB_UNFORCE_ALL=
2138 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2139 _USE_CPP_INCLUDE_FLAG=1
2140 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2141 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2142 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2143 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2144 CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2145 # make 'foo == bar;' error out
2146 CFLAGS="$CFLAGS -we4553"
2147 CXXFLAGS="$CXXFLAGS -we4553"
2148 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2149 MOZ_DEBUG_FLAGS='-Zi'
2150 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2151 WARNINGS_AS_ERRORS='-WX'
2152 MOZ_OPTIMIZE_FLAGS='-O1'
2154 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2155 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2156 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2157 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2158 if test $_MSC_VER -ge 1400; then
2159 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2160 dnl For profile-guided optimization
2161 PROFILE_GEN_CFLAGS="-GL"
2162 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2163 dnl XXX: PGO builds can fail with warnings treated as errors,
2164 dnl specifically "no profile data available" appears to be
2165 dnl treated as an error sometimes. This might be a consequence
2166 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2167 dnl with the linker doing most of the work in the whole-program
2168 dnl optimization/PGO case. I think it's probably a compiler bug,
2169 dnl but we work around it here.
2170 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2171 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2172 dnl Probably also a compiler bug, but what can you do?
2173 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2174 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2177 AC_DEFINE(HAVE_SNPRINTF)
2182 AC_DEFINE(HW_THREADS)
2183 AC_DEFINE(STDC_HEADERS)
2184 AC_DEFINE(NEW_H, <new>)
2185 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2186 TARGET_MD_ARCH=win32
2187 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2189 MOZ_USER_DIR="Mozilla"
2191 dnl Hardcode to win95 for now - cls
2192 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2194 dnl set NO_X11 defines here as the general check is skipped on win32
2200 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2201 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2207 if test -z "$MOZ_TOOLS"; then
2208 AC_MSG_ERROR([MOZ_TOOLS is not set])
2210 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2211 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2212 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2214 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2215 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2216 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2223 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.])
2229 if test "$HAVE_64BIT_OS"; then
2230 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2233 if test $_MSC_VER -ge 1400; then
2234 LDFLAGS="$LDFLAGS -SAFESEH"
2237 if test -n "$GNU_CC"; then
2238 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2239 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2241 AC_DEFINE(HAVE_STDCALL)
2242 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2245 MOZ_CHECK_HEADERS(mmintrin.h)
2249 if test -n "$_WIN32_MSVC"; then
2250 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2255 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2259 if test "$HAVE_64BIT_OS"; then
2266 CFLAGS="$CFLAGS -Dunix"
2267 CXXFLAGS="$CXXFLAGS -Dunix"
2268 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2270 DSO_PIC_CFLAGS='-fPIC -DPIC'
2271 DSO_LDOPTS='-shared'
2272 BIN_FLAGS='-Wl,--export-dynamic'
2274 DSO_PIC_CFLAGS='-fPIC -DPIC'
2275 DLL_SUFFIX=".so.1.0"
2276 DSO_LDOPTS='-shared'
2278 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2279 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2280 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2281 if test "$LIBRUNPATH"; then
2282 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2284 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2285 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2289 if test "$SO_VERSION"; then
2290 DLL_SUFFIX=".so.$SO_VERSION"
2292 DLL_SUFFIX=".so.1.0"
2294 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2296 DSO_PIC_CFLAGS='-fPIC'
2297 DSO_LDOPTS='-shared -fPIC'
2298 if test "$LIBRUNPATH"; then
2299 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2304 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2305 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2308 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2309 AC_DEFINE(TCPV40HDRS)
2315 IMPORT_LIB_SUFFIX=lib
2319 CFLAGS="$CFLAGS -Zomf"
2320 CXXFLAGS="$CXXFLAGS -Zomf"
2322 BIN_FLAGS='-Zlinker /ST:0x100000'
2326 WARNINGS_AS_ERRORS='-Werror'
2327 MOZ_DEBUG_FLAGS="-g -fno-inline"
2328 MOZ_OPTIMIZE_FLAGS="-O2"
2329 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2330 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2331 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2333 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2337 MOZ_USER_DIR="Mozilla"
2340 if test "$MOZTOOLS"; then
2341 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2343 AC_MSG_ERROR([MOZTOOLS is not set])
2345 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2346 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2347 LDFLAGS="$LDFLAGS -Zhigh-mem"
2348 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2349 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2352 # GCC for OS/2 currently predefines these, but we don't want them
2353 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2354 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2356 AC_CACHE_CHECK(for __declspec(dllexport),
2358 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2360 ac_os2_declspec="yes",
2361 ac_os2_declspec="no")])
2362 if test "$ac_os2_declspec" != "yes"; then
2363 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2369 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2371 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2372 # libraries one level up (e.g. libnspr4.so)
2373 if test "$SOLARIS_SUNPRO_CC"; then
2374 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2375 LIBS="-lCrun -lCstd -lc $LIBS"
2376 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2377 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2378 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2379 LDFLAGS="-xildoff $LDFLAGS"
2380 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2381 _SAVE_LDFLAGS=$LDFLAGS
2382 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2383 AC_TRY_LINK([#include <stdio.h>],
2384 [printf("Hello World\n");],
2386 [LDFLAGS=$_SAVE_LDFLAGS])
2388 MOZ_OPTIMIZE_FLAGS="-xO4"
2389 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2390 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2391 MKSHLIB_FORCE_ALL='-z allextract'
2392 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2399 AS='/usr/ccs/bin/as'
2400 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2402 TARGET_COMPILER_ABI="sunc"
2403 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2404 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2405 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2409 [#if (__SUNPRO_CC < 0x590)
2412 _BAD_COMPILER=,_BAD_COMPILER=1)
2413 if test -n "$_BAD_COMPILER"; then
2415 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2420 [#if (__SUNPRO_CC >= 0x5100)
2421 #error "Sun C++ 5.10 or above"
2423 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2424 if test "$_ABOVE_SS12U1"; then
2426 CXXFLAGS="$CXXFLAGS -xannotate=no"
2428 AC_MSG_RESULT([$_res])
2431 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2433 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2434 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2435 ASFLAGS="$ASFLAGS -fPIC"
2436 DSO_LDOPTS='-shared'
2437 WARNINGS_AS_ERRORS='-Werror'
2439 _WARNINGS_CXXFLAGS=''
2440 if test "$OS_RELEASE" = "5.3"; then
2441 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2444 if test "$OS_RELEASE" = "5.5.1"; then
2445 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2450 DSO_LDOPTS='-Bdynamic'
2451 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2452 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2454 AC_DEFINE(SPRINTF_RETURNS_STRING)
2455 case "$(target_os)" in
2457 DLL_SUFFIX='.so.1.0'
2463 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2468 AC_SUBST(MOZ_LINKER)
2469 if test -n "$MOZ_LINKER"; then
2470 AC_DEFINE(MOZ_LINKER)
2472 AC_SUBST(MOZ_ENABLE_SZIP)
2474 dnl Only one oddball right now (QNX), but this gives us flexibility
2475 dnl if any other platforms need to override this in the future.
2476 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2478 dnl ========================================================
2479 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2480 dnl by now will not have any way to link most binaries (tests
2481 dnl as well as viewer, apprunner, etc.), because some symbols
2482 dnl will be left out of the "composite" .so's by ld as unneeded.
2483 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2484 dnl they can link in the static libs that provide the missing
2486 dnl ========================================================
2487 NO_LD_ARCHIVE_FLAGS=
2488 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2489 NO_LD_ARCHIVE_FLAGS=1
2493 NO_LD_ARCHIVE_FLAGS=
2496 NO_LD_ARCHIVE_FLAGS=
2499 if test -z "$GNU_CC"; then
2500 NO_LD_ARCHIVE_FLAGS=
2504 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2506 dnl ========================================================
2507 dnl = Flags to strip unused symbols from .so components and
2508 dnl = to export jemalloc symbols when linking a program
2509 dnl ========================================================
2511 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2512 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2515 if test -z "$GNU_CC"; then
2516 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2518 if test -z "$GCC_USE_GNU_LD"; then
2519 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2521 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2526 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2529 if test -n "$GNU_CC"; then
2530 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2535 if test -z "$COMPILE_ENVIRONMENT"; then
2536 SKIP_COMPILER_CHECKS=1
2537 SKIP_LIBRARY_CHECKS=1
2541 if test -z "$SKIP_COMPILER_CHECKS"; then
2542 dnl Checks for typedefs, structures, and compiler characteristics.
2543 dnl ========================================================
2551 AC_MSG_CHECKING(for __stdcall)
2552 AC_CACHE_VAL(ac_cv___stdcall,
2553 [AC_TRY_COMPILE([template <typename Method> struct foo;
2554 template <> struct foo<void (*)()> {};
2555 template <> struct foo<void (__stdcall*)()> {};],
2557 [ac_cv___stdcall=true],
2558 [ac_cv___stdcall=false])])
2559 if test "$ac_cv___stdcall" = true ; then
2560 AC_DEFINE(HAVE_STDCALL)
2566 AC_MSG_CHECKING(for ssize_t)
2567 AC_CACHE_VAL(ac_cv_type_ssize_t,
2568 [AC_TRY_COMPILE([#include <stdio.h>
2569 #include <sys/types.h>],
2571 [ac_cv_type_ssize_t=true],
2572 [ac_cv_type_ssize_t=false])])
2573 if test "$ac_cv_type_ssize_t" = true ; then
2574 AC_DEFINE(HAVE_SSIZE_T)
2579 AC_STRUCT_ST_BLKSIZE
2580 AC_MSG_CHECKING(for siginfo_t)
2581 AC_CACHE_VAL(ac_cv_siginfo_t,
2582 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2583 #include <signal.h>],
2585 [ac_cv_siginfo_t=true],
2586 [ac_cv_siginfo_t=false])])
2587 if test "$ac_cv_siginfo_t" = true ; then
2588 AC_DEFINE(HAVE_SIGINFO_T)
2594 dnl Check for int64, uint, and uint_t.
2595 dnl ========================================================
2596 AC_MSG_CHECKING(for int64)
2597 AC_CACHE_VAL(ac_cv_int64,
2598 [AC_TRY_COMPILE([#include <stdio.h>
2599 #include <sys/types.h>],
2602 [ac_cv_int64=false])])
2603 if test "$ac_cv_int64" = true ; then
2604 AC_DEFINE(HAVE_INT64)
2609 AC_MSG_CHECKING(for uint)
2610 AC_CACHE_VAL(ac_cv_uint,
2611 [AC_TRY_COMPILE([#include <stdio.h>
2612 #include <sys/types.h>],
2615 [ac_cv_uint=false])])
2616 if test "$ac_cv_uint" = true ; then
2617 AC_DEFINE(HAVE_UINT)
2622 AC_MSG_CHECKING(for uint_t)
2623 AC_CACHE_VAL(ac_cv_uint_t,
2624 [AC_TRY_COMPILE([#include <stdio.h>
2625 #include <sys/types.h>],
2627 [ac_cv_uint_t=true],
2628 [ac_cv_uint_t=false])])
2629 if test "$ac_cv_uint_t" = true ; then
2630 AC_DEFINE(HAVE_UINT_T)
2636 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2637 dnl are defined when compiling C++ but not C. Since the result of this
2638 dnl test is used only in C++, do it in C++.
2641 AC_MSG_CHECKING(for uname.domainname)
2642 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2643 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2644 [ struct utsname *res; char *domain;
2645 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2646 [ac_cv_have_uname_domainname_field=true],
2647 [ac_cv_have_uname_domainname_field=false])])
2649 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2650 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2656 AC_MSG_CHECKING(for uname.__domainname)
2657 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2658 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2659 [ struct utsname *res; char *domain;
2660 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2661 [ac_cv_have_uname_us_domainname_field=true],
2662 [ac_cv_have_uname_us_domainname_field=false])])
2664 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2665 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2671 dnl Check whether we can use gcc's c++0x mode
2674 if test "$GNU_CXX"; then
2675 _SAVE_CXXFLAGS=$CXXFLAGS
2676 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2678 AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2679 ac_cv_cxx0x_headers_bug,
2680 [AC_TRY_COMPILE([#include <memory>], [],
2681 ac_cv_cxx0x_headers_bug="no",
2682 ac_cv_cxx0x_headers_bug="yes")])
2683 CXXFLAGS="$_SAVE_CXXFLAGS"
2684 if test "$ac_cv_cxx0x_headers_bug" = "no"; then
2685 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2689 dnl Check for usable char16_t (2 bytes, unsigned)
2690 dnl (we might not need the unsignedness check anymore)
2691 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2692 ac_cv_have_usable_char16_t,
2693 [AC_TRY_COMPILE([$configure_static_assert_macros],
2694 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2695 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2696 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2697 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2698 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2699 ac_cv_have_usable_char16_t="yes",
2700 ac_cv_have_usable_char16_t="no")])
2701 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2702 AC_DEFINE(HAVE_CPP_CHAR16_T)
2704 elif test "$GNU_CXX"; then
2705 CXXFLAGS="$_SAVE_CXXFLAGS"
2708 dnl Check for usable wchar_t (2 bytes, unsigned)
2709 dnl (we really don't need the unsignedness check anymore)
2710 dnl ========================================================
2712 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2713 ac_cv_have_usable_wchar_v2,
2714 [AC_TRY_COMPILE([#include <stddef.h>
2715 $configure_static_assert_macros],
2716 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2717 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2718 ac_cv_have_usable_wchar_v2="yes",
2719 ac_cv_have_usable_wchar_v2="no")])
2720 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2721 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2722 HAVE_CPP_2BYTE_WCHAR_T=1
2723 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2724 dnl This is really gcc-only
2725 dnl Do this test using CXX only since some versions of gcc
2726 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2727 dnl only have short-wchar support for c++.
2728 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2730 _SAVE_CXXFLAGS=$CXXFLAGS
2731 CXXFLAGS="$CXXFLAGS -fshort-wchar"
2733 AC_CACHE_CHECK(for compiler -fshort-wchar option,
2734 ac_cv_have_usable_wchar_option_v2,
2735 [AC_TRY_LINK([#include <stddef.h>
2736 $configure_static_assert_macros],
2737 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2738 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2739 ac_cv_have_usable_wchar_option_v2="yes",
2740 ac_cv_have_usable_wchar_option_v2="no")])
2742 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2743 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2744 HAVE_CPP_2BYTE_WCHAR_T=1
2745 if test "$OS_TARGET" = Android; then
2746 WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
2747 CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
2748 CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
2749 DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
2751 WCHAR_CFLAGS="-fshort-wchar"
2754 CXXFLAGS=$_SAVE_CXXFLAGS
2758 dnl Check for nullptr (bug 626472)
2760 AC_MSG_CHECKING(for nullptr)
2761 AC_CACHE_VAL(ac_cv_nullptr,
2763 [int* foo = nullptr;],
2764 [ac_cv_nullptr=true],
2765 [ac_cv_nullptr=false])])
2766 if test "$ac_cv_nullptr" = true ; then
2767 AC_DEFINE(HAVE_NULLPTR)
2775 dnl Check for .hidden assembler directive and visibility attribute.
2776 dnl Borrowed from glibc configure.in
2777 dnl ===============================================================
2778 if test "$GNU_CC"; then
2779 AC_CACHE_CHECK(for visibility(hidden) attribute,
2780 ac_cv_visibility_hidden,
2781 [cat > conftest.c <<EOF
2782 int foo __attribute__ ((visibility ("hidden"))) = 1;
2784 ac_cv_visibility_hidden=no
2785 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2786 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2787 ac_cv_visibility_hidden=yes
2792 if test "$ac_cv_visibility_hidden" = "yes"; then
2793 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2795 AC_CACHE_CHECK(for visibility(default) attribute,
2796 ac_cv_visibility_default,
2797 [cat > conftest.c <<EOF
2798 int foo __attribute__ ((visibility ("default"))) = 1;
2800 ac_cv_visibility_default=no
2801 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2802 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2803 ac_cv_visibility_default=yes
2808 if test "$ac_cv_visibility_default" = "yes"; then
2809 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2811 AC_CACHE_CHECK(for visibility pragma support,
2812 ac_cv_visibility_pragma,
2813 [cat > conftest.c <<EOF
2814 #pragma GCC visibility push(hidden)
2816 #pragma GCC visibility push(default)
2817 int foo_default = 1;
2819 ac_cv_visibility_pragma=no
2820 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2821 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2822 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2823 ac_cv_visibility_pragma=yes
2829 if test "$ac_cv_visibility_pragma" = "yes"; then
2830 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2831 ac_cv_have_visibility_class_bug,
2832 [cat > conftest.c <<EOF
2833 #pragma GCC visibility push(hidden)
2834 struct __attribute__ ((visibility ("default"))) TestStruct {
2837 __attribute__ ((visibility ("default"))) void TestFunc() {
2841 ac_cv_have_visibility_class_bug=no
2842 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2843 ac_cv_have_visibility_class_bug=yes
2845 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2846 ac_cv_have_visibility_class_bug=yes
2849 rm -rf conftest.{c,S}
2852 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2853 ac_cv_have_visibility_builtin_bug,
2854 [cat > conftest.c <<EOF
2855 #pragma GCC visibility push(hidden)
2856 #pragma GCC visibility push(default)
2858 #pragma GCC visibility pop
2860 __attribute__ ((visibility ("default"))) void Func() {
2862 memset(c, 0, sizeof(c));
2865 ac_cv_have_visibility_builtin_bug=no
2866 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2867 ac_cv_have_visibility_builtin_bug=yes
2869 if test `grep -c "@PLT" conftest.S` = 0; then
2870 ac_cv_visibility_builtin_bug=yes
2873 rm -f conftest.{c,S}
2875 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2876 "$ac_cv_have_visibility_class_bug" = "no"; then
2877 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2878 WRAP_SYSTEM_INCLUDES=1
2879 STL_FLAGS='-I$(DIST)/stl_wrappers'
2882 VISIBILITY_FLAGS='-fvisibility=hidden'
2883 fi # have visibility pragma bug
2884 fi # have visibility pragma
2885 fi # have visibility(default) attribute
2886 fi # have visibility(hidden) attribute
2889 # visibility hidden flag for Sun Studio on Solaris
2890 if test "$SOLARIS_SUNPRO_CC"; then
2891 VISIBILITY_FLAGS='-xldscope=hidden'
2892 fi # Sun Studio on Solaris
2894 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2895 AC_SUBST(VISIBILITY_FLAGS)
2899 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2900 dnl ========================================================
2901 if test "$GNU_CC"; then
2902 CFLAGS_save="${CFLAGS}"
2903 CFLAGS="${CFLAGS} -Werror"
2904 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2905 ac_cv_force_align_arg_pointer,
2906 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2908 ac_cv_force_align_arg_pointer="yes",
2909 ac_cv_force_align_arg_pointer="no")])
2910 CFLAGS="${CFLAGS_save}"
2911 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2912 HAVE_GCC_ALIGN_ARG_POINTER=1
2914 HAVE_GCC_ALIGN_ARG_POINTER=
2917 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2919 dnl Checks for header files.
2920 dnl ========================================================
2922 case "$target_os" in
2924 # for stuff like -lXshm
2925 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2928 MOZ_CHECK_COMMON_HEADERS
2930 dnl These are all the places some variant of statfs can be hiding.
2931 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2934 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2935 MOZ_CHECK_HEADERS(linux/quota.h)
2937 dnl Try for MMX support
2938 dnl NB - later gcc versions require -mmmx for this header to be successfully
2939 dnl included (or another option which implies it, such as -march=pentium-mmx)
2940 MOZ_CHECK_HEADERS(mmintrin.h)
2942 dnl Check whether the compiler supports the new-style C++ standard
2943 dnl library headers (i.e. <new>) or needs the old "new.h"
2946 MOZ_CHECK_HEADER(new, [NEW_H=new])
2947 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2950 AC_ARG_ENABLE(dtrace,
2951 [ --enable-dtrace build with dtrace support if available (default=no)],
2952 [enable_dtrace="yes"],)
2953 if test "x$enable_dtrace" = "xyes"; then
2954 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2955 if test -n "$HAVE_DTRACE"; then
2956 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2958 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2961 AC_SUBST(HAVE_DTRACE)
2967 MOZ_CHECK_HEADERS(sys/cdefs.h)
2971 MOZ_LINUX_PERF_EVENT
2973 dnl Checks for libraries.
2974 dnl ========================================================
2979 AC_CHECK_LIB(c_r, gethostbyname_r)
2983 dnl We don't want to link with libdl even if it's present on OS X, since
2984 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2986 dnl We don't want to link against libm or libpthread on Darwin since
2987 dnl they both are just symlinks to libSystem and explicitly linking
2988 dnl against libSystem causes issues when debugging (see bug 299601).
2995 AC_SEARCH_LIBS(dlopen, dl,
2996 MOZ_CHECK_HEADER(dlfcn.h,
2997 AC_DEFINE(HAVE_DLOPEN)))
3001 _SAVE_CFLAGS="$CFLAGS"
3002 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3003 AC_CHECK_FUNCS(dladdr memmem)
3004 CFLAGS="$_SAVE_CFLAGS"
3006 if test ! "$GNU_CXX"; then
3010 AC_CHECK_LIB(C_r, demangle)
3013 AC_CHECK_LIB(C, demangle)
3018 dnl OS/2 has socket in libc.
3023 AC_CHECK_LIB(socket, socket)
3027 XLIBS="$X_EXTRA_LIBS"
3029 dnl ========================================================
3030 dnl Checks for X libraries.
3031 dnl Ordering is important.
3032 dnl Xt is dependent upon SM as of X11R6
3033 dnl ========================================================
3034 if test "$no_x" = "yes"; then
3037 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3038 XLIBS="-lX11 $XLIBS"
3039 _SAVE_LDFLAGS="$LDFLAGS"
3040 LDFLAGS="$XLDFLAGS $LDFLAGS"
3041 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3042 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3043 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3044 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3046 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3047 unset ac_cv_lib_Xt_XtFree
3048 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3049 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3050 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3051 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3054 # AIX needs the motif library linked before libXt to prevent
3055 # crashes in plugins linked against Motif - Bug #98892
3056 case "${target_os}" in
3058 XT_LIBS="-lXm $XT_LIBS"
3062 dnl ========================================================
3063 dnl = Check for XShm
3064 dnl ========================================================
3065 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3068 dnl ========================================================
3070 dnl ========================================================
3071 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3072 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3073 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3074 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3076 LDFLAGS="$_SAVE_LDFLAGS"
3086 dnl ========================================================
3087 dnl = pthread support
3088 dnl = Start by checking whether the system support pthreads
3089 dnl ========================================================
3090 case "$target_os" in
3095 MOZ_CHECK_PTHREADS(pthreads,
3096 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3097 MOZ_CHECK_PTHREADS(pthread,
3098 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3099 MOZ_CHECK_PTHREADS(c_r,
3100 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3101 MOZ_CHECK_PTHREADS(c,
3110 dnl ========================================================
3111 dnl Check the command line for --with-pthreads
3112 dnl ========================================================
3113 MOZ_ARG_WITH_BOOL(pthreads,
3114 [ --with-pthreads Force use of system pthread library with NSPR ],
3115 [ if test "$USE_PTHREADS"x = x; then
3116 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3122 dnl ========================================================
3123 dnl Do the platform specific pthread hackery
3124 dnl ========================================================
3125 if test "$USE_PTHREADS"x != x
3128 dnl See if -pthread is supported.
3131 ac_cv_have_dash_pthread=no
3132 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3133 echo 'int main() { return 0; }' | cat > conftest.c
3134 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3135 if test $? -eq 0; then
3136 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3137 ac_cv_have_dash_pthread=yes
3138 case "$target_os" in
3140 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3143 CFLAGS="$CFLAGS -pthread"
3144 CXXFLAGS="$CXXFLAGS -pthread"
3150 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3153 dnl See if -pthreads is supported.
3155 ac_cv_have_dash_pthreads=no
3156 if test "$ac_cv_have_dash_pthread" = "no"; then
3157 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3158 echo 'int main() { return 0; }' | cat > conftest.c
3159 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3160 if test $? -eq 0; then
3161 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3162 ac_cv_have_dash_pthreads=yes
3163 CFLAGS="$CFLAGS -pthreads"
3164 CXXFLAGS="$CXXFLAGS -pthreads"
3168 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3173 AC_DEFINE(_REENTRANT)
3174 AC_DEFINE(_THREAD_SAFE)
3175 dnl -pthread links in -lpthread, so don't specify it explicitly.
3176 if test "$ac_cv_have_dash_pthread" = "yes"; then
3177 _PTHREAD_LDFLAGS="-pthread"
3181 *-*-openbsd*|*-*-bsdi*)
3182 AC_DEFINE(_REENTRANT)
3183 AC_DEFINE(_THREAD_SAFE)
3184 dnl -pthread links in -lc_r, so don't specify it explicitly.
3185 if test "$ac_cv_have_dash_pthread" = "yes"; then
3186 _PTHREAD_LDFLAGS="-pthread"
3190 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3191 AC_DEFINE(_REENTRANT)
3195 AC_DEFINE(_REENTRANT)
3199 AC_DEFINE(_REENTRANT)
3203 AC_DEFINE(_REENTRANT)
3204 if test "$SOLARIS_SUNPRO_CC"; then
3205 CFLAGS="$CFLAGS -mt"
3206 CXXFLAGS="$CXXFLAGS -mt"
3210 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3214 dnl Checks for library functions.
3215 dnl ========================================================
3216 AC_PROG_GCC_TRADITIONAL
3218 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf memmove rint stat64 lstat64 truncate64 setbuf isatty)
3219 AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
3220 AC_CHECK_FUNCS(flockfile getpagesize)
3221 AC_CHECK_FUNCS(localtime_r strtok_r)
3223 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3224 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3225 ac_cv_clock_monotonic,
3226 [for libs in "" -lrt; do
3229 AC_TRY_LINK([#include <time.h>],
3230 [ struct timespec ts;
3231 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3232 ac_cv_clock_monotonic=$libs
3235 ac_cv_clock_monotonic=no)
3238 if test "$ac_cv_clock_monotonic" != "no"; then
3239 HAVE_CLOCK_MONOTONIC=1
3240 REALTIME_LIBS=$ac_cv_clock_monotonic
3241 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3242 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3243 AC_SUBST(REALTIME_LIBS)
3246 dnl check for wcrtomb/mbrtowc
3247 dnl =======================================================================
3248 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3251 AC_CACHE_CHECK(for wcrtomb,
3253 [AC_TRY_LINK([#include <wchar.h>],
3254 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3255 ac_cv_have_wcrtomb="yes",
3256 ac_cv_have_wcrtomb="no")])
3257 if test "$ac_cv_have_wcrtomb" = "yes"; then
3258 AC_DEFINE(HAVE_WCRTOMB)
3260 AC_CACHE_CHECK(for mbrtowc,
3262 [AC_TRY_LINK([#include <wchar.h>],
3263 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3264 ac_cv_have_mbrtowc="yes",
3265 ac_cv_have_mbrtowc="no")])
3266 if test "$ac_cv_have_mbrtowc" = "yes"; then
3267 AC_DEFINE(HAVE_MBRTOWC)
3274 ac_cv_func_res_ninit,
3277 #define _BSD_SOURCE 1
3281 [int foo = res_ninit(&_res);],
3282 [ac_cv_func_res_ninit=yes],
3283 [ac_cv_func_res_ninit=no])
3286 if test "$ac_cv_func_res_ninit" = "yes"; then
3287 AC_DEFINE(HAVE_RES_NINIT)
3288 dnl must add the link line we do something as foolish as this... dougt
3290 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3291 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3296 [for gnu_get_libc_version()],
3297 ac_cv_func_gnu_get_libc_version,
3299 #ifdef HAVE_GNU_LIBC_VERSION_H
3300 #include <gnu/libc-version.h>
3303 [const char *glibc_version = gnu_get_libc_version();],
3304 [ac_cv_func_gnu_get_libc_version=yes],
3305 [ac_cv_func_gnu_get_libc_version=no]
3309 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3310 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3314 darwin*|mingw*|os2*)
3318 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3319 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3320 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3322 LIBS="$LIBS $_ICONV_LIBS"
3331 iconv_t h = iconv_open("", "");
3332 iconv(h, NULL, NULL, NULL, NULL);
3335 [ac_cv_func_iconv=yes],
3336 [ac_cv_func_iconv=no]
3339 if test "$ac_cv_func_iconv" = "yes"; then
3340 AC_DEFINE(HAVE_ICONV)
3341 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3342 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3343 LIBICONV="$_ICONV_LIBS"
3345 [for iconv() with const input],
3346 ac_cv_func_const_iconv,
3352 const char *input = "testing";
3353 iconv_t h = iconv_open("", "");
3354 iconv(h, &input, NULL, NULL, NULL);
3357 [ac_cv_func_const_iconv=yes],
3358 [ac_cv_func_const_iconv=no]
3361 if test "$ac_cv_func_const_iconv" = "yes"; then
3362 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3374 dnl **********************
3375 dnl *** va_copy checks ***
3376 dnl **********************
3377 dnl we currently check for all three va_copy possibilities, so we get
3378 dnl all results in config.log for bug reports.
3379 AC_MSG_CHECKING(for an implementation of va_copy())
3380 AC_CACHE_VAL(ac_cv_va_copy,[
3383 void f (int i, ...) {
3384 va_list args1, args2;
3385 va_start (args1, i);
3386 va_copy (args2, args1);
3387 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3389 va_end (args1); va_end (args2);
3391 int main() { f (0, 42); return 0; }],
3397 AC_MSG_RESULT($ac_cv_va_copy)
3398 AC_MSG_CHECKING(for an implementation of __va_copy())
3399 AC_CACHE_VAL(ac_cv___va_copy,[
3402 void f (int i, ...) {
3403 va_list args1, args2;
3404 va_start (args1, i);
3405 __va_copy (args2, args1);
3406 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3408 va_end (args1); va_end (args2);
3410 int main() { f (0, 42); return 0; }],
3411 ac_cv___va_copy=yes,
3416 AC_MSG_RESULT($ac_cv___va_copy)
3417 AC_MSG_CHECKING(whether va_lists can be copied by value)
3418 AC_CACHE_VAL(ac_cv_va_val_copy,[
3421 void f (int i, ...) {
3422 va_list args1, args2;
3423 va_start (args1, i);
3425 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3427 va_end (args1); va_end (args2);
3429 int main() { f (0, 42); return 0; }],
3430 ac_cv_va_val_copy=yes,
3431 ac_cv_va_val_copy=no,
3432 ac_cv_va_val_copy=yes
3435 if test "x$ac_cv_va_copy" = "xyes"; then
3436 AC_DEFINE(VA_COPY, va_copy)
3437 AC_DEFINE(HAVE_VA_COPY)
3438 elif test "x$ac_cv___va_copy" = "xyes"; then
3439 AC_DEFINE(VA_COPY, __va_copy)
3440 AC_DEFINE(HAVE_VA_COPY)
3443 if test "x$ac_cv_va_val_copy" = "xno"; then
3444 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3446 AC_MSG_RESULT($ac_cv_va_val_copy)
3448 dnl ===================================================================
3449 dnl ========================================================
3450 dnl Put your C++ language/feature checks below
3451 dnl ========================================================
3455 if test "$GNU_CC"; then
3456 if test "$CPU_ARCH" = "arm" ; then
3457 AC_CACHE_CHECK(for ARM EABI,
3461 #if defined(__ARM_EABI__)
3464 #error Not ARM EABI.
3467 ac_cv_gcc_arm_eabi="yes",
3468 ac_cv_gcc_arm_eabi="no")])
3469 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3471 ARM_ABI_PREFIX=eabi-
3473 ARM_ABI_PREFIX=oabi-
3477 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3480 dnl Check for support of modern template specialization syntax
3481 dnl Test code and requirement from scc@netscape.com.
3482 dnl Autoconf cut-and-paste job by waterson@netscape.com
3483 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3484 ac_cv_cpp_modern_specialize_template_syntax,
3485 [AC_TRY_COMPILE(template <class T> struct X { int a; };
3487 template <> struct X<Y> { double a; };,
3490 ac_cv_cpp_modern_specialize_template_syntax=yes,
3491 ac_cv_cpp_modern_specialize_template_syntax=no)])
3492 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
3493 AC_MSG_ERROR([The C++ compiler does not support template specialization])
3496 dnl Some compilers support only full specialization, and some don't.
3497 AC_CACHE_CHECK(whether partial template specialization works,
3498 ac_cv_cpp_partial_specialization,
3499 [AC_TRY_COMPILE(template <class T> class Foo {};
3500 template <class T> class Foo<T*> {};,
3502 ac_cv_cpp_partial_specialization=yes,
3503 ac_cv_cpp_partial_specialization=no)])
3504 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3505 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3508 dnl Check to see if we can resolve ambiguity with |using|.
3509 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3510 ac_cv_cpp_ambiguity_resolving_using,
3511 [AC_TRY_COMPILE(class X {
3512 public: int go(const X&) {return 3;}
3513 int jo(const X&) {return 3;}
3515 class Y : public X {
3516 public: int go(int) {return 2;}
3517 int jo(int) {return 2;}
3519 private: using X::go;
3522 ac_cv_cpp_ambiguity_resolving_using=yes,
3523 ac_cv_cpp_ambiguity_resolving_using=no)])
3524 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3525 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3528 dnl See if a dynamic_cast to void* gives the most derived object.
3529 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3530 ac_cv_cpp_dynamic_cast_void_ptr,
3531 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3532 class Y { int j; public: virtual ~Y() { } };
3533 class Z : public X, public Y { int k; };
3539 return !((((void*)&mdo != (void*)subx) &&
3540 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3541 (((void*)&mdo != (void*)suby) &&
3542 ((void*)&mdo == dynamic_cast<void*>(suby))));
3544 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3545 ac_cv_cpp_dynamic_cast_void_ptr=no,
3546 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3547 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3548 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3552 dnl note that this one is reversed - if the test fails, then
3553 dnl we require implementations of unused virtual methods. Which
3554 dnl really blows because it means we'll have useless vtable
3556 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3557 ac_cv_cpp_unused_required,
3558 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3560 ac_cv_cpp_unused_required=no,
3561 ac_cv_cpp_unused_required=yes)])
3562 if test "$ac_cv_cpp_unused_required" = yes ; then
3563 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3567 dnl Some compilers have trouble comparing a constant reference to a templatized
3568 dnl class to zero, and require an explicit operator==() to be defined that takes
3569 dnl an int. This test separates the strong from the weak.
3571 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3572 ac_cv_trouble_comparing_to_zero,
3573 [AC_TRY_COMPILE([#include <algorithm>
3574 template <class T> class Foo {};
3576 template <class T> int operator==(const T2*, const T&) { return 0; }
3577 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3578 [Foo<int> f; return (0 != f);],
3579 ac_cv_trouble_comparing_to_zero=no,
3580 ac_cv_trouble_comparing_to_zero=yes)])
3581 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3582 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3585 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3586 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3587 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3589 _SAVE_LDFLAGS=$LDFLAGS
3590 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3591 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3592 ac_cv_thread_keyword,
3593 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3594 [return tlsIsMainThread;],
3595 ac_cv_thread_keyword=yes,
3596 ac_cv_thread_keyword=no)])
3597 LDFLAGS=$_SAVE_LDFLAGS
3598 # The custom dynamic linker doesn't support TLS variables
3600 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3601 # mips builds fail with TLS variables because of a binutils bug.
3603 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3608 *-android*|*-linuxandroid*)
3615 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3621 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3622 if test -n "$MOZ_LINKER"; then
3623 if test "$CPU_ARCH" = arm; then
3624 dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
3625 ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
3626 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3627 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3628 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000"
3629 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000"
3634 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3635 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3636 dnl We however want to avoid these text relocations, and this can be done
3637 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3638 dnl doesn't contain anything at all, beside placeholders for some sections,
3639 dnl and crtbegin only contains a finalizer function that calls
3640 dnl __cxa_finalize. The custom linker actually takes care of calling
3641 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3642 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3643 dnl link crtbegin and crtend at all.
3644 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$OS_TARGET" = "Android"; then
3645 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3646 ac_cv_crt_has_text_relocations,
3647 [echo 'int foo() { return 0; }' > conftest.cpp
3648 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3649 test -s conftest${DLL_SUFFIX}; then
3650 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3651 ac_cv_crt_has_text_relocations=yes
3653 ac_cv_crt_has_text_relocations=no
3656 AC_ERROR([couldn't compile a simple C file])
3659 if test "$ac_cv_crt_has_text_relocations" = yes; then
3660 dnl While we want libraries to skip the CRT files, we don't want
3661 dnl executables to be treated the same way. We thus set the flag
3662 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3663 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3664 dnl Using LDFLAGS in nspr is safe, since we only really build
3665 dnl libraries there.
3666 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3667 NSPR_LDFLAGS=-nostartfiles
3671 dnl Check for the existence of various allocation headers/functions
3674 MOZ_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
3675 if test "$MALLOC_H" = ""; then
3676 MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
3677 if test "$MALLOC_H" = ""; then
3678 MOZ_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
3681 if test "$MALLOC_H" != ""; then
3682 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3685 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3686 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3688 dnl See if compiler supports some gcc-style attributes
3690 AC_CACHE_CHECK(for __attribute__((always_inline)),
3691 ac_cv_attribute_always_inline,
3692 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3694 ac_cv_attribute_always_inline=yes,
3695 ac_cv_attribute_always_inline=no)])
3697 AC_CACHE_CHECK(for __attribute__((malloc)),
3698 ac_cv_attribute_malloc,
3699 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3701 ac_cv_attribute_malloc=yes,
3702 ac_cv_attribute_malloc=no)])
3704 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3705 ac_cv_attribute_warn_unused,
3706 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3708 ac_cv_attribute_warn_unused=yes,
3709 ac_cv_attribute_warn_unused=no)])
3711 dnl End of C++ language/feature checks
3714 dnl ========================================================
3715 dnl = Internationalization checks
3716 dnl ========================================================
3718 dnl Internationalization and Locale support is different
3719 dnl on various UNIX platforms. Checks for specific i18n
3720 dnl features go here.
3722 dnl check for LC_MESSAGES
3723 AC_CACHE_CHECK(for LC_MESSAGES,
3724 ac_cv_i18n_lc_messages,
3725 [AC_TRY_COMPILE([#include <locale.h>],
3726 [int category = LC_MESSAGES;],
3727 ac_cv_i18n_lc_messages=yes,
3728 ac_cv_i18n_lc_messages=no)])
3729 if test "$ac_cv_i18n_lc_messages" = yes; then
3730 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3733 AC_HAVE_FUNCS(localeconv)
3734 fi # ! SKIP_COMPILER_CHECKS
3737 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3738 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3741 dnl Mozilla specific options
3742 dnl ========================================================
3743 dnl The macros used for command line options
3744 dnl are defined in build/autoconf/altoptions.m4.
3746 dnl If the compiler supports these attributes, define them as
3747 dnl convenience macros.
3748 if test "$ac_cv_attribute_always_inline" = yes ; then
3749 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
3751 AC_DEFINE(NS_ALWAYS_INLINE,)
3754 if test "$ac_cv_attribute_malloc" = yes ; then
3755 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3757 AC_DEFINE(NS_ATTR_MALLOC,)
3760 if test "$ac_cv_attribute_warn_unused" = yes ; then
3761 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3763 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3766 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3767 dnl features that Windows actually does support.
3769 if test -n "$SKIP_COMPILER_CHECKS"; then
3770 dnl Windows has malloc.h
3771 AC_DEFINE(MALLOC_H, [<malloc.h>])
3772 AC_DEFINE(HAVE_FORCEINLINE)
3773 AC_DEFINE(HAVE_LOCALECONV)
3774 fi # SKIP_COMPILER_CHECKS
3776 dnl ========================================================
3778 dnl = Check for external package dependencies
3780 dnl ========================================================
3781 MOZ_ARG_HEADER(External Packages)
3783 MOZ_ARG_WITH_STRING(libxul-sdk,
3784 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3785 LIBXUL_SDK_DIR=$withval)
3787 if test "$LIBXUL_SDK_DIR" = "yes"; then
3788 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3789 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3790 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3792 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3793 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3797 AC_SUBST(LIBXUL_SDK)
3799 if test -n "$LIBXUL_SDK"; then
3800 LIBXUL_DIST="$LIBXUL_SDK"
3802 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3804 AC_SUBST(LIBXUL_DIST)
3808 MOZ_ARG_WITH_BOOL(system-libxul,
3809 [ --with-system-libxul Use system installed libxul SDK],
3812 dnl ========================================================
3813 dnl = If NSPR was not detected in the system,
3814 dnl = use the one in the source tree (mozilla/nsprpub)
3815 dnl ========================================================
3816 MOZ_ARG_WITH_BOOL(system-nspr,
3817 [ --with-system-nspr Use system installed NSPR],
3818 _USE_SYSTEM_NSPR=1 )
3820 if test -n "$_USE_SYSTEM_NSPR"; then
3821 AM_PATH_NSPR(4.9.0, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
3824 if test -n "$MOZ_NATIVE_NSPR"; then
3825 _SAVE_CFLAGS=$CFLAGS
3826 CFLAGS="$CFLAGS $NSPR_CFLAGS"
3827 AC_TRY_COMPILE([#include "prtypes.h"],
3828 [#ifndef PR_STATIC_ASSERT
3829 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3831 [MOZ_NATIVE_NSPR=1],
3832 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3833 AC_TRY_COMPILE([#include "prtypes.h"],
3835 #error PR_UINT64 not defined or requires including prtypes.h
3837 [MOZ_NATIVE_NSPR=1],
3838 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3839 CFLAGS=$_SAVE_CFLAGS
3841 if test -z "$LIBXUL_SDK"; then
3842 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3843 if test -n "$GNU_CC"; then
3844 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3846 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3849 NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3850 NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3854 dnl system libevent Support
3855 dnl ========================================================
3856 MOZ_ARG_WITH_STRING(system-libevent,
3857 [ --with-system-libevent=[PFX]
3858 Use system libevent [installed at prefix PFX]],
3859 LIBEVENT_DIR=$withval)
3861 _SAVE_CFLAGS=$CFLAGS
3862 _SAVE_LDFLAGS=$LDFLAGS
3864 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3865 MOZ_NATIVE_LIBEVENT=
3867 if test "${LIBEVENT_DIR}" = "yes"; then
3870 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3871 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3872 MOZ_CHECK_HEADER(event.h,
3873 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3874 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3876 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3877 AC_CHECK_LIB(event, event_init,
3878 [MOZ_NATIVE_LIBEVENT=1
3879 MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
3880 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3881 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
3883 CFLAGS=$_SAVE_CFLAGS
3884 LDFLAGS=$_SAVE_LDFLAGS
3887 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3888 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
3889 AC_SUBST(MOZ_LIBEVENT_LIBS)
3891 dnl ========================================================
3892 dnl = If NSS was not detected in the system,
3893 dnl = use the one in the source tree (mozilla/security/nss)
3894 dnl ========================================================
3896 MOZ_ARG_WITH_BOOL(system-nss,
3897 [ --with-system-nss Use system installed NSS],
3900 if test -n "$_USE_SYSTEM_NSS"; then
3901 AM_PATH_NSS(3.13.2, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3904 if test -n "$MOZ_NATIVE_NSS"; then
3905 NSS_LIBS="$NSS_LIBS -lcrmf"
3907 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3909 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3910 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
3911 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
3912 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
3913 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
3915 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
3917 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3918 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3919 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3920 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3921 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3923 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3927 dnl ======================
3929 dnl ======================
3931 AC_MSG_CHECKING([for YASM assembler])
3932 AC_CHECK_PROGS(YASM, yasm, "")
3934 if test -n "$YASM"; then
3935 dnl Pull out yasm's version string
3937 _YASM_VER_FILTER='s|.* \([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*|\1|p'
3940 YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
3941 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3942 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3943 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3944 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3947 if test -z "$SKIP_LIBRARY_CHECKS"; then
3948 dnl system JPEG support
3949 dnl ========================================================
3950 MOZ_ARG_WITH_STRING(system-jpeg,
3951 [ --with-system-jpeg[=PFX]
3952 Use system libjpeg [installed at prefix PFX]],
3955 _SAVE_CFLAGS=$CFLAGS
3956 _SAVE_LDFLAGS=$LDFLAGS
3958 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3959 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3960 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3962 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3965 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3968 if test "$MOZ_NATIVE_JPEG" = 1; then
3969 AC_TRY_COMPILE([ #include <stdio.h>
3970 #include <sys/types.h>
3971 #include <jpeglib.h> ],
3972 [ #if JPEG_LIB_VERSION < $MOZJPEG
3973 #error "Insufficient JPEG library version ($MOZJPEG required)."
3976 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3978 CFLAGS=$_SAVE_CFLAGS
3979 LDFLAGS=$_SAVE_LDFLAGS
3982 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3983 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3984 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3986 fi # SKIP_LIBRARY_CHECKS
3988 dnl system ZLIB support
3989 dnl ========================================================
3990 MOZ_ZLIB_CHECK([1.2.3])
3992 if test "$MOZ_NATIVE_ZLIB" != 1; then
3994 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
3997 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
3998 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4001 if test -z "$SKIP_LIBRARY_CHECKS"; then
4002 dnl system BZIP2 Support
4003 dnl ========================================================
4004 MOZ_ARG_WITH_STRING(system-bz2,
4005 [ --with-system-bz2[=PFX]
4006 Use system libbz2 [installed at prefix PFX]],
4009 _SAVE_CFLAGS=$CFLAGS
4010 _SAVE_LDFLAGS=$LDFLAGS
4012 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4013 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4014 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4016 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4019 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
4020 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
4022 CFLAGS=$_SAVE_CFLAGS
4023 LDFLAGS=$_SAVE_LDFLAGS
4026 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
4027 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
4028 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4031 dnl system PNG Support
4032 dnl ========================================================
4033 MOZ_ARG_WITH_STRING(system-png,
4034 [ --with-system-png[=PFX]
4035 Use system libpng [installed at prefix PFX]],
4038 _SAVE_CFLAGS=$CFLAGS
4039 _SAVE_LDFLAGS=$LDFLAGS
4041 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4042 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4043 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4045 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4048 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
4049 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4050 AC_CHECK_LIB(png, png_get_acTL, ,
4051 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
4053 if test "$MOZ_NATIVE_PNG" = 1; then
4054 AC_TRY_COMPILE([ #include <stdio.h>
4055 #include <sys/types.h>
4057 [ #if PNG_LIBPNG_VER < $MOZPNG
4058 #error "Insufficient libpng version ($MOZPNG required)."
4060 #ifndef PNG_UINT_31_MAX
4061 #error "Insufficient libpng version."
4064 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4066 CFLAGS=$_SAVE_CFLAGS
4067 LDFLAGS=$_SAVE_LDFLAGS
4070 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
4071 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
4072 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
4075 fi # SKIP_LIBRARY_CHECKS
4077 dnl system HunSpell Support
4078 dnl ========================================================
4079 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4080 [ --enable-system-hunspell
4081 Use system hunspell (located with pkgconfig)],
4082 MOZ_NATIVE_HUNSPELL=1 )
4084 if test -n "$MOZ_NATIVE_HUNSPELL"; then
4085 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4088 AC_SUBST(MOZ_NATIVE_HUNSPELL)
4090 dnl ========================================================
4091 dnl system libffi Support
4092 dnl ========================================================
4093 MOZ_ARG_ENABLE_BOOL(system-ffi,
4094 [ --enable-system-ffi Use system libffi (located with pkgconfig)],
4097 if test -n "$MOZ_NATIVE_FFI"; then
4098 # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4099 # for non-GCC compilers.
4100 if test -z "$GNU_CC"; then
4101 PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4103 PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4105 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4108 dnl ========================================================
4109 dnl Java SDK support
4110 dnl ========================================================
4113 MOZ_ARG_WITH_STRING(java-bin-path,
4114 [ --with-java-bin-path=dir
4115 Location of Java binaries (java, javac, jar)],
4116 JAVA_BIN_PATH=$withval)
4118 dnl ========================================================
4122 dnl ========================================================
4124 MOZ_ARG_HEADER(Application)
4127 ENABLE_SYSTEM_EXTENSION_DIRS=1
4128 MOZ_BRANDING_DIRECTORY=
4129 MOZ_OFFICIAL_BRANDING=
4134 MOZ_AUTH_EXTENSION=1
4138 MOZ_SPEEX_RESAMPLER=1
4143 MOZ_SAMPLE_TYPE_FLOAT32=
4144 MOZ_SAMPLE_TYPE_S16=
4149 MOZ_WEBRTC_SIGNALING=
4151 MOZ_MEDIA_NAVIGATOR=
4154 MOZ_VP8_ERROR_CONCEALMENT=
4164 LIBJPEG_TURBO_ASFLAGS=
4165 LIBJPEG_TURBO_X86_ASM=
4166 LIBJPEG_TURBO_X64_ASM=
4167 LIBJPEG_TURBO_ARM_ASM=
4171 MOZ_PREF_EXTENSIONS=1
4172 MOZ_PROFILELOCKING=1
4178 MOZ_JAVA_COMPOSITOR=
4179 MOZ_ONLY_TOUCH_EVENTS=
4180 MOZ_TOOLKIT_SEARCH=1
4182 MOZ_UNIVERSALCHARDET=1
4189 MOZ_DISABLE_DOMCRYPTO=
4193 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4196 MOZ_USE_NATIVE_POPUP_WINDOWS=
4197 MOZ_ANDROID_HISTORY=
4204 case "$target_os" in
4207 AC_DEFINE(NS_ENABLE_TSF)
4212 *-android*|*-linuxandroid*)
4213 if test "$CPU_ARCH" = "arm" ; then
4219 MOZ_THEME_FASTSTRIPE=1
4227 MOZ_ARG_ENABLE_STRING(application,
4228 [ --enable-application=APP
4232 tools/update-packaging (AUS-related packaging tools)],
4233 [ MOZ_BUILD_APP=$enableval ] )
4235 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4236 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4237 XULRUNNER_STUB_NAME=$withval)
4239 if test -z "$XULRUNNER_STUB_NAME"; then
4240 case "$target_os" in
4242 XULRUNNER_STUB_NAME=xulrunner
4245 XULRUNNER_STUB_NAME=xulrunner-stub
4248 AC_SUBST(XULRUNNER_STUB_NAME)
4250 AC_MSG_CHECKING([for application to build])
4251 if test -z "$MOZ_BUILD_APP"; then
4252 AC_MSG_RESULT([browser])
4253 MOZ_BUILD_APP=browser
4255 # default mobile to be mobile/xul
4256 if test "$MOZ_BUILD_APP" = "mobile" ; then
4257 MOZ_BUILD_APP=mobile/xul
4259 # We have a valid application only if it has a build.mk file in its top
4261 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4262 AC_MSG_RESULT([none])
4263 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4265 AC_MSG_RESULT([$MOZ_BUILD_APP])
4269 # Allow the application to influence configure with a confvars.sh script.
4271 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4272 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4273 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4274 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4279 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4280 MOZ_ARG_WITH_STRING(app-name,
4281 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4282 WITH_APP_NAME=$withval,
4285 if test -n "$WITH_APP_NAME" ; then
4286 MOZ_APP_NAME="$WITH_APP_NAME"
4289 MOZ_ARG_WITH_STRING(app-basename,
4290 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4291 WITH_APP_BASENAME=$withval,
4294 if test -n "$WITH_APP_BASENAME" ; then
4295 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4298 # Now is a good time to test for logic errors, define mismatches, etc.
4299 case "$MOZ_BUILD_APP" in
4301 if test "$LIBXUL_SDK"; then
4302 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4307 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4308 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4310 case "$MOZ_BUILD_APP" in
4312 AC_DEFINE(MOZ_PHOENIX)
4316 AC_DEFINE(MOZ_XULRUNNER)
4320 AC_SUBST(MOZ_BUILD_APP)
4321 AC_SUBST(MOZ_PHOENIX)
4322 AC_SUBST(MOZ_XULRUNNER)
4324 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4326 dnl ========================================================
4327 dnl Check android sdk version depending on mobile target
4328 dnl ========================================================
4330 if test -z "$gonkdir" ; then
4331 # Minimum Android SDK API Level we require.
4332 case "$MOZ_BUILD_APP" in
4334 android_min_api_level=13
4337 android_min_api_level=16
4341 MOZ_ANDROID_SDK($android_min_api_level)
4344 dnl ========================================================
4346 dnl = Toolkit Options
4348 dnl ========================================================
4349 MOZ_ARG_HEADER(Toolkit Options)
4351 dnl ========================================================
4352 dnl = Select the default toolkit
4353 dnl ========================================================
4354 MOZ_ARG_ENABLE_STRING(default-toolkit,
4355 [ --enable-default-toolkit=TK
4356 Select default toolkit
4357 Platform specific defaults:
4358 Mac OS X - cairo-cocoa
4360 Win32 - cairo-windows
4363 [ _DEFAULT_TOOLKIT=$enableval ],
4364 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4366 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4367 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4368 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4369 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4370 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4371 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4372 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4373 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4374 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4376 dnl nglayout only supports building with one toolkit,
4377 dnl so ignore everything after the first comma (",").
4378 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4380 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4383 MOZ_ARG_WITHOUT_BOOL(x,
4384 [ --without-x Build without X11],
4387 dnl ========================================================
4388 dnl = Enable the toolkit as needed =
4389 dnl ========================================================
4391 case "$MOZ_WIDGET_TOOLKIT" in
4394 MOZ_WIDGET_TOOLKIT=windows
4397 MOZ_INSTRUMENT_EVENT_LOOP=1
4400 cairo-gtk2|cairo-gtk2-x11)
4401 MOZ_WIDGET_TOOLKIT=gtk2
4403 MOZ_ENABLE_XREMOTE=1
4405 MOZ_GL_DEFAULT_PROVIDER=GLX
4411 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4412 TK_LIBS='$(MOZ_GTK2_LIBS)'
4413 AC_DEFINE(MOZ_WIDGET_GTK2)
4414 AC_DEFINE(MOZ_WIDGET_GTK,2)
4416 MOZ_INSTRUMENT_EVENT_LOOP=1
4420 MOZ_WIDGET_TOOLKIT=qt
4422 if test -z "$WITHOUT_X11"; then
4423 MOZ_ENABLE_XREMOTE=1
4424 MOZ_GL_DEFAULT_PROVIDER=GLX
4433 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4434 TK_LIBS='$(MOZ_QT_LIBS)'
4435 AC_DEFINE(MOZ_WIDGET_QT)
4440 MOZ_WIDGET_TOOLKIT=os2
4442 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4443 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4448 MOZ_WIDGET_TOOLKIT=cocoa
4449 AC_DEFINE(MOZ_WIDGET_COCOA)
4450 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4451 TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4452 TK_CFLAGS="-DNO_X11"
4453 CFLAGS="$CFLAGS $TK_CFLAGS"
4454 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4455 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4456 MOZ_USER_DIR="Mozilla"
4457 MOZ_FS_LAYOUT=bundle
4459 MOZ_INSTRUMENT_EVENT_LOOP=1
4463 MOZ_WIDGET_TOOLKIT=uikit
4464 AC_DEFINE(MOZ_WIDGET_UIKIT)
4465 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4466 TK_CFLAGS="-DNO_X11"
4467 TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4468 CFLAGS="$CFLAGS $TK_CFLAGS"
4469 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4470 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4471 MOZ_USER_DIR="Mozilla"
4472 MOZ_FS_LAYOUT=bundle
4476 AC_DEFINE(MOZ_WIDGET_ANDROID)
4477 MOZ_WIDGET_TOOLKIT=android
4478 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4479 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4482 MOZ_INSTRUMENT_EVENT_LOOP=1
4483 if test "$MOZ_BUILD_APP" = "mobile/xul"; then
4489 AC_DEFINE(MOZ_WIDGET_GONK)
4490 AC_DEFINE(MOZ_TOUCH)
4491 MOZ_WIDGET_TOOLKIT=gonk
4492 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4493 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4501 AC_SUBST(MOZ_OLD_LINKER)
4502 AC_SUBST(MOZ_PDF_PRINTING)
4503 if test "$MOZ_PDF_PRINTING"; then
4504 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4505 AC_DEFINE(MOZ_PDF_PRINTING)
4508 if test "$MOZ_ENABLE_XREMOTE"; then
4509 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4512 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4513 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4516 if test "$COMPILE_ENVIRONMENT"; then
4517 if test "$MOZ_ENABLE_GTK2"; then
4518 if test "$MOZ_X11"; then
4519 GDK_PACKAGES=gdk-x11-2.0
4522 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4525 fi # COMPILE_ENVIRONMENT
4527 AC_SUBST(MOZ_FS_LAYOUT)
4529 dnl ========================================================
4530 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4531 dnl their usage and use them in spidermonkey.
4532 dnl ========================================================
4533 MOZ_ARG_WITH_BOOL(arm-kuser,
4534 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4536 if test -n "$USE_ARM_KUSER"; then
4537 AC_DEFINE(USE_ARM_KUSER)
4540 dnl ========================================================
4541 dnl = startup-notification support module
4542 dnl ========================================================
4544 if test "$MOZ_ENABLE_GTK2"
4546 MOZ_ENABLE_STARTUP_NOTIFICATION=
4548 MOZ_ARG_ENABLE_BOOL(startup-notification,
4549 [ --enable-startup-notification
4550 Enable startup-notification support (default: disabled) ],
4551 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4552 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4553 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4555 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4556 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4557 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4558 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4560 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4562 MOZ_ENABLE_STARTUP_NOTIFICATION=
4566 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4567 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4570 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4572 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4573 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4574 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4576 dnl ========================================================
4578 dnl ========================================================
4579 if test "$MOZ_ENABLE_QT"
4581 MOZ_ARG_WITH_STRING(qtdir,
4582 [ --with-qtdir=\$dir Specify Qt directory ],
4585 if test -z "$QTDIR"; then
4586 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
4587 PKG_CHECK_MODULES(MOZ_QT5, QtWidgets QtMultimedia QtPrintSupport,
4590 if test "$MOZ_ENABLE_QT5"; then
4592 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
4593 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
4596 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4597 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4599 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4601 MOZ_QT_CFLAGS="-DQT_SHARED"
4602 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4603 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4604 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4605 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4606 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4607 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4608 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4609 HOST_MOC="$QTDIR/bin/moc"
4610 HOST_RCC="$QTDIR/bin/rcc"
4612 # QtWidgets was introduced only in Qt5
4613 if test -d $QTDIR/include/QtWidgets; then
4614 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4615 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4616 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtWidgets -lQtPrintSupport"
4619 if test -z "$HOST_MOC"; then
4620 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4623 if test -z "$HOST_RCC"; then
4624 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4631 MOZ_ENABLE_QMSYSTEM2=
4632 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4633 MOZ_ENABLE_QMSYSTEM2=1,
4634 MOZ_ENABLE_QMSYSTEM2=)
4636 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4637 MOZ_ENABLE_QMSYSTEM2=1
4638 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4639 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4640 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4643 MOZ_ENABLE_QTNETWORK=
4644 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4645 MOZ_ENABLE_QTNETWORK=1,
4646 MOZ_ENABLE_QTNETWORK=)
4648 if test "$MOZ_ENABLE_QTNETWORK"; then
4649 MOZ_ENABLE_QTNETWORK=1
4650 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4653 MOZ_ENABLE_QTMOBILITY=
4654 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4655 MOZ_ENABLE_QTMOBILITY=1,
4656 MOZ_ENABLE_QTMOBILITY=)
4657 if test "$MOZ_ENABLE_QTMOBILITY"; then
4658 MOZ_ENABLE_QTMOBILITY=1
4659 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4660 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4662 AC_CHECK_LIB(QtSensors, main, [
4663 MOZ_ENABLE_QTMOBILITY=1
4664 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4665 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4666 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4667 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4668 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4671 if test "$MOZ_ENABLE_QTMOBILITY"; then
4672 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4676 AC_SUBST(GTK_CONFIG)
4680 AC_SUBST(MOZ_ENABLE_GTK2)
4681 AC_SUBST(MOZ_ENABLE_QT)
4682 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4683 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4684 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4685 AC_SUBST(MOZ_ENABLE_XREMOTE)
4686 AC_SUBST(MOZ_GTK2_CFLAGS)
4687 AC_SUBST(MOZ_GTK2_LIBS)
4688 AC_SUBST(MOZ_QT_CFLAGS)
4689 AC_SUBST(MOZ_QT_LIBS)
4696 dnl ========================================================
4698 dnl = Components & Features
4700 dnl ========================================================
4701 MOZ_ARG_HEADER(Components and Features)
4703 dnl ========================================================
4705 dnl ========================================================
4706 MOZ_ARG_ENABLE_STRING(ui-locale,
4707 [ --enable-ui-locale=ab-CD
4708 Select the user interface locale (default: en-US)],
4709 MOZ_UI_LOCALE=$enableval )
4710 AC_SUBST(MOZ_UI_LOCALE)
4712 dnl ========================================================
4713 dnl = Trademarked Branding
4714 dnl ========================================================
4715 MOZ_ARG_ENABLE_BOOL(official-branding,
4716 [ --enable-official-branding
4717 Enable Official mozilla.org Branding
4718 Do not distribute builds with
4719 --enable-official-branding unless you have
4720 permission to use trademarks per
4721 http://www.mozilla.org/foundation/trademarks/ .],
4723 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4724 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4726 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4727 MOZ_OFFICIAL_BRANDING=1
4729 ], MOZ_OFFICIAL_BRANDING=)
4731 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4732 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4733 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4736 MOZ_ARG_WITH_STRING(branding,
4737 [ --with-branding=dir Use branding from the specified directory.],
4738 MOZ_BRANDING_DIRECTORY=$withval)
4740 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4741 if test -z "$REAL_BRANDING_DIRECTORY"; then
4742 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4745 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4746 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4749 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4751 dnl ========================================================
4752 dnl = Distribution ID
4753 dnl ========================================================
4754 MOZ_ARG_WITH_STRING(distribution-id,
4755 [ --with-distribution-id=ID
4756 Set distribution-specific id (default=org.mozilla)],
4757 [ val=`echo $withval`
4758 MOZ_DISTRIBUTION_ID="$val"])
4760 if test -z "$MOZ_DISTRIBUTION_ID"; then
4761 MOZ_DISTRIBUTION_ID="org.mozilla"
4764 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4765 AC_SUBST(MOZ_DISTRIBUTION_ID)
4768 dnl ========================================================
4769 dnl complex text support off by default
4770 dnl ========================================================
4771 MOZ_ARG_DISABLE_BOOL(pango,
4772 [ --disable-pango Disable usage of Pango ],
4776 dnl ========================================================
4778 dnl ========================================================
4779 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4783 if test "$MOZ_PANGO"
4785 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4787 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4788 AC_SUBST(MOZ_PANGO_CFLAGS)
4789 AC_SUBST(MOZ_PANGO_LIBS)
4790 AC_DEFINE(MOZ_PANGO)
4792 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
4793 AC_SUBST(FT2_CFLAGS)
4798 dnl ========================================================
4799 dnl = GnomeVFS, GIO and GConf support module
4800 dnl ========================================================
4804 dnl build the gnomevfs extension by default only when the
4805 dnl GTK2 toolkit is in use.
4806 if test "$MOZ_ENABLE_GTK2"
4808 MOZ_ENABLE_GNOMEVFS=1
4812 dnl ========================================================
4813 dnl = GnomeVFS support module
4814 dnl ========================================================
4815 MOZ_ARG_DISABLE_BOOL(gnomevfs,
4816 [ --disable-gnomevfs Disable GnomeVFS support ],
4817 MOZ_ENABLE_GNOMEVFS=,
4818 MOZ_ENABLE_GNOMEVFS=force)
4820 if test "$MOZ_ENABLE_GNOMEVFS"
4822 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4823 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4824 MOZ_ENABLE_GNOMEVFS=1
4825 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4827 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4829 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4831 MOZ_ENABLE_GNOMEVFS=
4834 if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
4835 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4836 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4841 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4842 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4843 AC_SUBST(MOZ_GNOMEVFS_LIBS)
4845 dnl ========================================================
4846 dnl = GIO support module
4847 dnl ========================================================
4848 MOZ_ARG_ENABLE_BOOL(gio,
4849 [ --enable-gio Enable GIO support (default: disabled)],
4850 MOZ_ENABLE_GIO=force,
4853 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
4855 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4856 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4857 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4858 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4860 AC_DEFINE(MOZ_ENABLE_GIO)
4862 if test "$MOZ_ENABLE_GIO" = "force"
4864 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4870 AC_SUBST(MOZ_ENABLE_GIO)
4871 AC_SUBST(MOZ_GIO_CFLAGS)
4872 AC_SUBST(MOZ_GIO_LIBS)
4874 dnl ========================================================
4875 dnl = GConf support module
4876 dnl ========================================================
4877 MOZ_ARG_DISABLE_BOOL(gconf,
4878 [ --disable-gconf Disable Gconf support ],
4880 MOZ_ENABLE_GCONF=force)
4882 if test "$MOZ_ENABLE_GCONF"
4884 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4885 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4888 if test "$MOZ_ENABLE_GCONF" = "force"
4890 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4896 if test "$MOZ_ENABLE_GCONF"; then
4897 AC_DEFINE(MOZ_ENABLE_GCONF)
4900 AC_SUBST(MOZ_ENABLE_GCONF)
4901 AC_SUBST(MOZ_GCONF_CFLAGS)
4902 AC_SUBST(MOZ_GCONF_LIBS)
4905 dnl ========================================================
4906 dnl = libproxy support
4907 dnl ========================================================
4909 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4911 MOZ_ENABLE_LIBPROXY=
4913 MOZ_ARG_ENABLE_BOOL(libproxy,
4914 [ --enable-libproxy Enable libproxy support ],
4915 MOZ_ENABLE_LIBPROXY=1,
4916 MOZ_ENABLE_LIBPROXY=)
4918 if test "$MOZ_ENABLE_LIBPROXY"
4920 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4921 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4924 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4925 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
4926 AC_SUBST(MOZ_LIBPROXY_LIBS)
4928 dnl ========================================================
4929 dnl = GNOME component (mozgnome)
4930 dnl ========================================================
4932 if test "$MOZ_ENABLE_GTK2"
4934 MOZ_ENABLE_GNOME_COMPONENT=1
4936 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4938 dnl ========================================================
4939 dnl = libgnomeui support module
4940 dnl ========================================================
4942 if test "$MOZ_ENABLE_GTK2"
4944 MOZ_ENABLE_GNOMEUI=1
4946 MOZ_ARG_DISABLE_BOOL(gnomeui,
4947 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
4948 MOZ_ENABLE_GNOMEUI=,
4949 MOZ_ENABLE_GNOMEUI=force)
4951 if test "$MOZ_ENABLE_GNOMEUI"
4953 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4955 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
4956 MOZ_ENABLE_GNOMEUI=1
4958 if test "$MOZ_ENABLE_GNOMEUI" = "force"
4960 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4966 if test "$MOZ_ENABLE_GNOMEUI"; then
4967 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4971 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4972 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
4973 AC_SUBST(MOZ_GNOMEUI_LIBS)
4975 dnl ========================================================
4977 dnl ========================================================
4979 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4983 MOZ_ARG_DISABLE_BOOL(dbus,
4984 [ --disable-dbus Disable dbus support ],
4988 if test "$MOZ_ENABLE_DBUS"
4990 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
4991 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
4992 AC_DEFINE(MOZ_ENABLE_DBUS)
4995 AC_SUBST(MOZ_ENABLE_DBUS)
4996 AC_SUBST(MOZ_DBUS_CFLAGS)
4997 AC_SUBST(MOZ_DBUS_LIBS)
4998 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
4999 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5001 dnl ========================================================
5002 dnl = Enable Android History instead of Places
5003 dnl ========================================================
5004 if test -n "$MOZ_ANDROID_HISTORY"; then
5005 dnl Do this if defined in confvars.sh
5006 AC_DEFINE(MOZ_ANDROID_HISTORY)
5010 dnl ========================================================
5011 dnl = Build with the Android Java compositor
5012 dnl ========================================================
5013 if test -n "$MOZ_JAVA_COMPOSITOR"; then
5014 dnl Do this if defined in confvars.sh
5015 AC_DEFINE(MOZ_JAVA_COMPOSITOR)
5018 dnl ========================================================
5019 dnl = Disable WebSMS backend
5020 dnl ========================================================
5021 MOZ_ARG_DISABLE_BOOL(websms-backend,
5022 [ --disable-websms-backend
5023 Disable WebSMS backend],
5024 MOZ_WEBSMS_BACKEND=,
5025 MOZ_WEBSMS_BACKEND=1)
5027 if test -n "$MOZ_WEBSMS_BACKEND"; then
5028 AC_DEFINE(MOZ_WEBSMS_BACKEND)
5031 dnl ========================================================
5032 dnl = Build Personal Security Manager
5033 dnl ========================================================
5034 MOZ_ARG_DISABLE_BOOL(crypto,
5035 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5039 dnl ========================================================
5040 dnl = JS Debugger XPCOM component (js/jsd)
5041 dnl ========================================================
5042 MOZ_ARG_DISABLE_BOOL(jsd,
5043 [ --disable-jsd Disable JavaScript debug library],
5048 dnl ========================================================
5049 dnl = Enable IPDL's "expensive" unit tests
5050 dnl ========================================================
5053 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5054 [ --enable-ipdl-tests Enable expensive IPDL tests],
5058 if test -n "$MOZ_IPDL_TESTS"; then
5059 AC_DEFINE(MOZ_IPDL_TESTS)
5062 AC_SUBST(MOZ_IPDL_TESTS)
5064 dnl ========================================================
5065 dnl = Turns off code necessary for e10s compatibility
5066 dnl ========================================================
5067 dnl This is a temporary flag to be removed in bug 662601 when
5068 dnl it's no longer needed
5072 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5073 [ --enable-e10s-compat Turns off code for e10s compat],
5077 if test -n "$MOZ_E10S_COMPAT"; then
5078 AC_DEFINE(MOZ_E10S_COMPAT)
5081 dnl ========================================================
5082 dnl = Disable building dbm
5083 dnl ========================================================
5084 MOZ_ARG_DISABLE_BOOL(dbm,
5085 [ --disable-dbm Disable building dbm],
5089 dnl bi-directional support always on
5093 dnl ========================================================
5094 dnl accessibility support on by default on all platforms
5095 dnl ========================================================
5096 MOZ_ARG_DISABLE_BOOL(accessibility,
5097 [ --disable-accessibility Disable accessibility support],
5100 if test "$ACCESSIBILITY"; then
5101 AC_DEFINE(ACCESSIBILITY)
5104 dnl ========================================================
5105 dnl Disable printing
5106 dnl ========================================================
5107 MOZ_ARG_DISABLE_BOOL(printing,
5108 [ --disable-printing Disable printing support],
5112 if test "$NS_PRINTING"; then
5113 AC_DEFINE(NS_PRINTING)
5114 AC_DEFINE(NS_PRINT_PREVIEW)
5117 dnl Turn off webrtc for OS's we don't handle yet, but allow
5118 dnl --enable-webrtc to override. Can disable for everything in
5119 dnl the master list above.
5120 if test -n "$MOZ_WEBRTC"; then
5122 *-android*|*-linuxandroid*)
5123 dnl Make sure doesn't get matched by *-linux*
5126 *-linux*|*-mingw*|*-darwin*)
5130 dnl default to disabled for all others
5136 dnl ========================================================
5137 dnl = Disable WebRTC code
5138 dnl ========================================================
5139 MOZ_ARG_DISABLE_BOOL(webrtc,
5140 [ --disable-webrtc Disable support for WebRTC],
5144 if test -n "$MOZ_WEBRTC"; then
5145 AC_DEFINE(MOZ_WEBRTC)
5150 MOZ_VP8_ERROR_CONCEALMENT=1
5153 AC_SUBST(MOZ_WEBRTC)
5155 case "$target_cpu" in
5157 MOZ_SAMPLE_TYPE_S16=1
5158 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5159 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5162 MOZ_SAMPLE_TYPE_FLOAT32=1
5163 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5164 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5168 dnl ========================================================
5169 dnl = Enable Raw Codecs
5170 dnl ========================================================
5171 MOZ_ARG_ENABLE_BOOL(raw,
5172 [ --enable-raw Enable support for RAW media],
5176 if test -n "$MOZ_RAW"; then
5183 dnl ========================================================
5184 dnl = Disable Ogg Codecs
5185 dnl ========================================================
5186 MOZ_ARG_DISABLE_BOOL(ogg,
5187 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5191 if test -n "$MOZ_OGG"; then
5197 dnl Checks for __attribute__(aligned()) directive
5198 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5199 [ac_cv_c_attribute_aligned],
5200 [ac_cv_c_attribute_aligned=0
5201 CFLAGS_save="${CFLAGS}"
5202 CFLAGS="${CFLAGS} -Werror"
5203 for ac_cv_c_attr_align_try in 64 32 16 8; do
5204 echo "trying $ac_cv_c_attr_align_try"
5206 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5207 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5208 if test "$ac_cv_c_attribute_aligned" != 0; then
5212 CFLAGS="${CFLAGS_save}"])
5213 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5214 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5215 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5219 dnl ========================================================
5220 dnl = Disable Opus audio codec support
5221 dnl ========================================================
5222 MOZ_ARG_DISABLE_BOOL(opus,
5223 [ --disable-opus Disable support for Opus audio],
5227 dnl ========================================================
5228 dnl = Disable VP8 decoder support
5229 dnl ========================================================
5230 MOZ_ARG_DISABLE_BOOL(webm,
5231 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5235 if test -n "$MOZ_WEBM"; then
5240 dnl ========================================================
5241 dnl = Enable media plugin support
5242 dnl ========================================================
5243 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5244 dnl Enable support on android by default
5248 MOZ_ARG_ENABLE_BOOL(media-plugins,
5249 [ --enable-media-plugins Enable support for media plugins],
5250 MOZ_MEDIA_PLUGINS=1,
5253 if test -n "$MOZ_MEDIA_PLUGINS"; then
5254 AC_DEFINE(MOZ_MEDIA_PLUGINS)
5257 dnl ========================================================
5258 dnl = Enable getUserMedia support
5259 dnl ========================================================
5260 MOZ_ARG_ENABLE_BOOL(media-navigator,
5261 [ --enable-media-navigator Enable support for getUserMedia],
5262 MOZ_MEDIA_NAVIGATOR=1,
5263 MOZ_MEDIA_NAVIGATOR=)
5265 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5266 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5269 dnl ========================================================
5270 dnl = Enable building OMX media plugin (B2G or Android)
5271 dnl ========================================================
5272 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5273 dnl Enable support on android by default
5277 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5278 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5282 if test -n "$MOZ_OMX_PLUGIN"; then
5283 if test "$OS_TARGET" = "Android"; then
5284 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5285 AC_DEFINE(MOZ_OMX_PLUGIN)
5287 dnl fail if we're not building on Gonk or Android
5288 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5292 dnl system libvpx Support
5293 dnl ========================================================
5294 MOZ_ARG_WITH_BOOL(system-libvpx,
5295 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5296 MOZ_NATIVE_LIBVPX=1)
5301 if test -n "$MOZ_VP8"; then
5303 if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5304 AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5306 if test -n "$MOZ_VP8_ENCODER" ; then
5307 AC_DEFINE(MOZ_VP8_ENCODER)
5310 if test -n "$MOZ_NATIVE_LIBVPX"; then
5311 dnl ============================
5312 dnl === libvpx Version check ===
5313 dnl ============================
5314 dnl Check to see if we have a system libvpx package.
5315 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5317 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5318 [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.])])
5321 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5322 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5327 AC_SUBST(MOZ_NATIVE_LIBVPX)
5328 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5329 AC_SUBST(MOZ_LIBVPX_LIBS)
5331 if test "$MOZ_WEBM"; then
5335 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5342 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5344 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5345 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5346 dnl We currently require gcc on all arm platforms.
5349 VPX_NEED_OBJ_INT_EXTRACT=
5351 dnl See if we have assembly on this platform.
5352 case "$OS_ARCH:$CPU_ARCH" in
5354 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5358 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5362 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5366 dnl Check for yasm 1.1 or greater.
5367 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5368 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.])
5369 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5370 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.])
5372 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5374 dnl The encoder needs obj_int_extract to get asm offsets.
5378 if test -n "$GNU_AS" ; then
5380 dnl These flags are a lie; they're just used to enable the requisite
5381 dnl opcodes; actual arch detection is done at runtime.
5382 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5383 VPX_DASH_C_FLAG="-c"
5384 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5385 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5390 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5391 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5396 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5397 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5403 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5404 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.])
5407 if test -n "$MOZ_VP8_ENCODER" -a \
5408 -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5409 dnl We prefer to get asm offsets using inline assembler, which the above
5410 dnl compilers can do. When we're not using one of those, we have to fall
5411 dnl back to obj_int_extract, which reads them from a compiled object
5412 dnl file. Unfortunately, that only works if we're compiling on a system
5413 dnl with the header files for the appropriate object file format.
5414 VPX_NEED_OBJ_INT_EXTRACT=1
5417 if test -n "$VPX_X86_ASM"; then
5418 AC_DEFINE(VPX_X86_ASM)
5419 elif test -n "$VPX_ARM_ASM"; then
5420 AC_DEFINE(VPX_ARM_ASM)
5422 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5426 dnl ========================================================
5427 dnl = Disable Wave decoder support
5428 dnl ========================================================
5429 MOZ_ARG_DISABLE_BOOL(wave,
5430 [ --disable-wave Disable Wave decoder support],
5434 if test -n "$MOZ_WAVE"; then
5441 dnl ========================================================
5442 dnl = Handle dependent SYDNEYAUDIO, CUBEB, and MEDIA defines
5443 dnl ========================================================
5445 if test -n "$MOZ_SYDNEYAUDIO"; then
5446 AC_DEFINE(MOZ_SYDNEYAUDIO)
5449 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5450 AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5453 if test -n "$MOZ_CUBEB"; then
5455 *-android*|*-linuxandroid*)
5456 dnl No Android implementation of libcubeb yet.
5459 AC_DEFINE(MOZ_CUBEB)
5462 AC_DEFINE(MOZ_CUBEB)
5465 AC_DEFINE(MOZ_CUBEB)
5468 AC_DEFINE(MOZ_CUBEB)
5471 dnl Other targets will be enabled soon.
5476 if test -n "$MOZ_MEDIA"; then
5477 AC_DEFINE(MOZ_MEDIA)
5480 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5481 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/])
5484 if test -n "$MOZ_VORBIS"; then
5485 AC_DEFINE(MOZ_VORBIS)
5488 if test -n "$MOZ_TREMOR"; then
5489 AC_DEFINE(MOZ_TREMOR)
5492 if test -n "$MOZ_OPUS"; then
5496 dnl ========================================================
5497 dnl = Check alsa availability on Linux if using sydneyaudio
5498 dnl ========================================================
5500 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5501 if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
5502 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5503 [echo "$MOZ_ALSA_PKG_ERRORS"
5504 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.)])])
5507 dnl ========================================================
5508 dnl = Enable PulseAudio
5509 dnl ========================================================
5511 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5512 [ --enable-pulseaudio Enable PulseAudio support (experimental)],
5516 if test -n "$MOZ_PULSEAUDIO"; then
5517 AC_DEFINE(MOZ_CUBEB)
5518 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5519 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5520 AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
5523 AC_SUBST(MOZ_PULSEAUDIO)
5524 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5525 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5527 dnl ========================================================
5528 dnl = Enable GStreamer
5529 dnl ========================================================
5530 MOZ_ARG_ENABLE_BOOL(gstreamer,
5531 [ --enable-gstreamer Enable GStreamer support],
5535 if test "$MOZ_GSTREAMER"; then
5536 # API version, eg 0.10, 1.0 etc
5537 GST_API_VERSION=0.10
5538 # core/base release number
5539 # depend on >= 0.10.33 as that's when the playbin2 source-setup signal was
5542 PKG_CHECK_MODULES(GSTREAMER,
5543 gstreamer-$GST_API_VERSION >= $GST_VERSION
5544 gstreamer-app-$GST_API_VERSION
5545 gstreamer-plugins-base-$GST_API_VERSION)
5546 if test -n "$GSTREAMER_LIBS"; then
5547 _SAVE_LDFLAGS=$LDFLAGS
5548 LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5549 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5550 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5551 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5553 AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
5555 LDFLAGS=$_SAVE_LDFLAGS
5557 AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
5560 AC_SUBST(GSTREAMER_CFLAGS)
5561 AC_SUBST(GSTREAMER_LIBS)
5562 AC_SUBST(MOZ_GSTREAMER)
5564 if test -n "$MOZ_GSTREAMER"; then
5565 AC_DEFINE(MOZ_GSTREAMER)
5570 dnl ========================================================
5571 dnl Permissions System
5572 dnl ========================================================
5573 MOZ_ARG_DISABLE_BOOL(permissions,
5574 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5579 dnl ========================================================
5581 dnl ========================================================
5582 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5583 [ --disable-negotiateauth Disable GSS-API negotiation ],
5584 MOZ_AUTH_EXTENSION=,
5585 MOZ_AUTH_EXTENSION=1 )
5587 dnl ========================================================
5589 dnl ========================================================
5590 MOZ_ARG_DISABLE_BOOL(xtf,
5591 [ --disable-xtf Disable XTF (pluggable xml tags) support],
5594 if test "$MOZ_XTF"; then
5598 dnl ========================================================
5599 dnl Pref extensions (autoconfig)
5600 dnl ========================================================
5601 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5602 [ --disable-pref-extensions
5603 Disable pref extensions such as autoconfig],
5604 MOZ_PREF_EXTENSIONS=,
5605 MOZ_PREF_EXTENSIONS=1 )
5607 dnl ========================================================
5608 dnl Searching of system directories for extensions.
5609 dnl Note: this switch is meant to be used for test builds
5610 dnl whose behavior should not depend on what happens to be
5611 dnl installed on the local machine.
5612 dnl ========================================================
5613 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5614 [ --disable-system-extension-dirs
5615 Disable searching system- and account-global
5616 directories for extensions of any kind; use
5617 only profile-specific extension directories],
5618 ENABLE_SYSTEM_EXTENSION_DIRS=,
5619 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5620 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5621 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5624 dnl ========================================================
5625 dnl = Universalchardet
5626 dnl ========================================================
5627 MOZ_ARG_DISABLE_BOOL(universalchardet,
5628 [ --disable-universalchardet
5629 Disable universal encoding detection],
5630 MOZ_UNIVERSALCHARDET=,
5631 MOZ_UNIVERSALCHARDET=1 )
5633 if test -n "${JAVA_BIN_PATH}"; then
5634 dnl Look for javac and jar in the specified path.
5635 JAVA_PATH="$JAVA_BIN_PATH"
5637 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5638 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5641 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5642 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5643 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5645 if test -n "${JAVA_BIN_PATH}" -o \
5646 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5647 if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5648 AC_MSG_ERROR([The programs java, javac and jar were not found. Set \$JAVA_HOME to your java sdk directory or use --with-java-bin-path={java-bin-dir}])
5652 dnl ========================================================
5653 dnl = ANGLE OpenGL->D3D translator for WebGL
5654 dnl = * only applies to win32
5655 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5656 dnl ========================================================
5658 MOZ_DIRECTX_SDK_PATH=
5659 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5662 MOZ_D3DCOMPILER_CAB=
5664 MOZ_D3DCOMPILER_DLL=
5665 case "$target_os" in
5667 MOZ_ANGLE_RENDERER=1
5671 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5672 case "${target_cpu}" in
5674 MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5677 MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5681 MOZ_ARG_DISABLE_BOOL(webgl,
5682 [ --disable-webgl Disable building of the WebGL implementation],
5683 MOZ_WEBGL_DISABLED=1,
5684 MOZ_WEBGL_DISABLED=)
5686 if test -n "$MOZ_WEBGL_DISABLED"; then
5691 if test -n "$MOZ_ANGLE_RENDERER"; then
5692 # Get the SDK path from the registry.
5693 # First try to get the June 2010 SDK
5694 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5695 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5696 # Otherwise just take whatever comes first
5697 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5700 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5701 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.])
5703 MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/'`
5706 if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5707 test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5708 test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5709 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5711 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.])
5714 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5715 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'`
5717 if test -z "$MOZ_D3DX9_VERSION" ; then
5718 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.])
5721 MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5722 MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5724 if test -z "$MOZ_D3DX9_CAB" -o -z "$MOZ_D3DCOMPILER_CAB"; then
5725 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.])
5728 MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
5729 MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5732 dnl ========================================================
5733 dnl = Breakpad crash reporting (on by default on supported platforms)
5734 dnl ========================================================
5737 i?86-*-mingw*|x86_64-*-mingw*)
5740 i?86-apple-darwin*|x86_64-apple-darwin*)
5743 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5744 if test "$MOZ_ENABLE_GTK2"; then
5748 *-android*|*-linuxandroid*)
5756 MOZ_ARG_DISABLE_BOOL(crashreporter,
5757 [ --disable-crashreporter Disable breakpad crash reporting],
5759 MOZ_CRASHREPORTER=1)
5761 if test -n "$MOZ_CRASHREPORTER"; then
5762 AC_DEFINE(MOZ_CRASHREPORTER)
5764 if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5765 test -z "$SKIP_LIBRARY_CHECKS"; then
5766 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5767 AC_SUBST(MOZ_GTHREAD_CFLAGS)
5768 AC_SUBST(MOZ_GTHREAD_LIBS)
5770 MOZ_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter. Use --disable-crashreporter to disable the crash reporter.])])
5773 if test "$OS_ARCH" != "$HOST_OS_ARCH"; then
5774 AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH. Use --disable-crashreporter.])
5777 if test "$OS_ARCH" = "WINNT" -a -z "$HAVE_64BIT_OS"; then
5778 MOZ_CRASHREPORTER_INJECTOR=1
5779 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5783 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5784 [ --with-crashreporter-enable-percent=NN
5785 Enable sending crash reports by default on NN% of users. (default=100)],
5786 [ val=`echo $withval | sed 's/[^0-9]//g'`
5787 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5789 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5790 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5792 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5794 dnl ========================================================
5795 dnl = libjpeg-turbo configuration
5796 dnl ========================================================
5798 if test -z "$MOZ_NATIVE_JPEG"; then
5802 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5803 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
5805 MOZ_LIBJPEG_TURBO=1)
5807 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
5808 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
5811 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
5814 if test -n "$MOZ_LIBJPEG_TURBO"; then
5816 dnl Do we support libjpeg-turbo on this platform?
5817 case "$OS_ARCH:$OS_TEST" in
5819 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
5820 LIBJPEG_TURBO_X86_ASM=1
5823 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
5824 LIBJPEG_TURBO_X64_ASM=1
5826 WINNT:x86|WINNT:i?86)
5827 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
5828 LIBJPEG_TURBO_X86_ASM=1
5831 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
5832 LIBJPEG_TURBO_X64_ASM=1
5835 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
5836 LIBJPEG_TURBO_ARM_ASM=1
5839 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5840 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
5841 LIBJPEG_TURBO_X86_ASM=1
5845 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5846 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
5847 LIBJPEG_TURBO_X64_ASM=1
5854 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
5855 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
5856 dnl it doesn't exist or we have too old of a version.
5857 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
5858 AC_MSG_CHECKING([for Yasm assembler])
5859 AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
5861 if test -z "$LIBJPEG_TURBO_AS" ; then
5862 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.])
5865 dnl Check that we have the right yasm version. We require 1.0.1 or newer
5866 dnl on Linux and 1.1 or newer everywhere else.
5867 if test "$OS_ARCH" = "Linux" ; then
5868 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
5869 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.])
5872 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5873 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.])
5878 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
5879 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
5880 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
5881 echo "Using $AS as the assembler for ARM code."
5882 LIBJPEG_TURBO_AS=$AS
5885 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
5886 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
5887 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
5888 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
5889 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
5890 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
5891 elif test -n "$MOZ_LIBJPEG_TURBO"; then
5892 dnl Warn if we're not building the optimized routines, even though the user
5893 dnl didn't specify --disable-libjpeg-turbo.
5894 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
5897 dnl ========================================================
5898 dnl = Enable compilation of specific extension modules
5899 dnl ========================================================
5901 MOZ_ARG_ENABLE_STRING(extensions,
5902 [ --enable-extensions Enable extensions],
5903 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5904 if test "$option" = "yes" -o "$option" = "all"; then
5905 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5906 elif test "$option" = "no" -o "$option" = "none"; then
5908 elif test "$option" = "default"; then
5909 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5910 elif test `echo "$option" | grep -c \^-` != 0; then
5911 option=`echo $option | sed 's/^-//'`
5912 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5914 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5917 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5919 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5920 # Suppress warning on non-X11 platforms
5921 if test -n "$MOZ_X11"; then
5922 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5924 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5927 dnl Do not build gnomevfs with libxul based apps
5928 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5929 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5932 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5933 # Suppress warning on non-X11 platforms
5934 if test -n "$MOZ_X11"; then
5935 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
5937 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5940 dnl Do not build gio with libxul based apps
5941 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5942 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5945 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5946 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5947 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5950 dnl xforms requires xtf
5951 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5952 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
5953 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5957 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5959 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5960 dnl when trying to build a nonexistent extension.
5961 for extension in $MOZ_EXTENSIONS; do
5962 if test ! -d "${srcdir}/extensions/${extension}"; then
5963 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5967 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
5968 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
5971 dnl ========================================================
5972 dnl CSS3 Flexbox Support
5973 dnl ========================================================
5974 if test -n "$MOZ_FLEXBOX"; then
5975 AC_DEFINE(MOZ_FLEXBOX)
5978 dnl ========================================================
5979 dnl Build Freetype in the tree
5980 dnl ========================================================
5981 MOZ_ARG_ENABLE_BOOL(tree-freetype,
5982 [ --enable-tree-freetype Enable Tree FreeType],
5983 MOZ_TREE_FREETYPE=1,
5984 MOZ_TREE_FREETYPE= )
5985 if test -n "$MOZ_TREE_FREETYPE"; then
5986 if test -n "$_WIN32_MSVC"; then
5987 AC_ERROR("building with in-tree freetype is not supported on MSVC")
5989 AC_DEFINE(MOZ_TREE_FREETYPE)
5990 AC_SUBST(MOZ_TREE_FREETYPE)
5991 MOZ_ENABLE_CAIRO_FT=1
5992 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
5993 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
5994 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
5995 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
5997 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
5998 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
5999 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6000 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6001 AC_SUBST(CAIRO_FT_CFLAGS)
6004 dnl ========================================================
6006 dnl ========================================================
6007 dnl Abort Windows build if the required major version and
6008 dnl minimum minor version of Unicode NSIS isn't in the path
6009 dnl (unless in case of cross compiling, for which Unicode
6010 dnl is not yet sufficient).
6011 if test "$OS_ARCH" = "WINNT"; then
6012 REQ_NSIS_MAJOR_VER=2
6013 MIN_NSIS_MINOR_VER=33
6014 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6015 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6016 AC_MSG_RESULT([yes])
6018 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6020 if test ! "$MAKENSISU_VER" = ""; then
6021 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6022 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6024 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6025 if test "$MAKENSISU_VER" = "" || \
6026 test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6027 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6029 if test -z "$CROSS_COMPILE"; then
6030 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.])
6035 elif test -z "$CROSS_COMPILE"; then
6036 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.])
6042 dnl ========================================================
6044 dnl ========================================================
6045 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6046 [ --disable-webapp-runtime Disable Web App Runtime],
6047 MOZ_WEBAPP_RUNTIME=,
6048 MOZ_WEBAPP_RUNTIME=1)
6049 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6052 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6055 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6056 if test "$MOZ_WEBAPP_RUNTIME"; then
6057 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6060 AC_MSG_CHECKING([for tar archiver])
6061 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6062 if test -z "$TAR"; then
6063 AC_MSG_ERROR([no tar archiver found in \$PATH])
6065 AC_MSG_RESULT([$TAR])
6068 AC_MSG_CHECKING([for wget])
6069 AC_CHECK_PROGS(WGET, wget, "")
6070 AC_MSG_RESULT([$WGET])
6073 dnl ========================================================
6075 dnl ========================================================
6077 if test -n "$MOZ_SIGN_CMD"; then
6078 AC_DEFINE(MOZ_SIGNING)
6081 dnl ========================================================
6082 dnl Maintenance Service
6083 dnl ========================================================
6085 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6086 [ --enable-maintenance-service Enable building of maintenanceservice],
6087 MOZ_MAINTENANCE_SERVICE=1,
6088 MOZ_MAINTENANCE_SERVICE= )
6090 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6091 if test "$OS_ARCH" = "WINNT"; then
6092 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6094 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6098 dnl ========================================================
6099 dnl Verify MAR signatures
6100 dnl ========================================================
6102 MOZ_ARG_ENABLE_BOOL(verify-mar,
6103 [ --enable-verify-mar Enable verifying MAR signatures],
6104 MOZ_VERIFY_MAR_SIGNATURE=1,
6105 MOZ_VERIFY_MAR_SIGNATURE= )
6107 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6108 if test "$OS_ARCH" = "WINNT"; then
6109 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6111 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6115 dnl ========================================================
6116 dnl Enable building the signmar program.
6117 dnl This option is much different than the --enable-verify-mar option.
6118 dnl --enable-verify-mar is for enabling the verification check on MAR
6119 dnl files in the updater. The --enable-signmar option is for building
6120 dnl the signmar program.
6121 dnl ========================================================
6123 MOZ_ARG_ENABLE_BOOL(signmar,
6124 [ --enable-signmar Enable building the signmar program],
6125 MOZ_ENABLE_SIGNMAR=1,
6126 MOZ_ENABLE_SIGNMAR= )
6128 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6129 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6132 dnl ========================================================
6134 dnl ========================================================
6136 MOZ_ARG_DISABLE_BOOL(updater,
6137 [ --disable-updater Disable building of updater],
6141 if test -n "$MOZ_UPDATER"; then
6142 AC_DEFINE(MOZ_UPDATER)
6145 # app update channel is 'default' when not supplied.
6146 MOZ_ARG_ENABLE_STRING([update-channel],
6147 [ --enable-update-channel=CHANNEL
6148 Select application update channel (default=default)],
6149 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6151 if test -z "$MOZ_UPDATE_CHANNEL"; then
6152 MOZ_UPDATE_CHANNEL=default
6154 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6155 AC_SUBST(MOZ_UPDATE_CHANNEL)
6157 # tools/update-packaging is not checked out by default.
6158 MOZ_ARG_ENABLE_BOOL(update-packaging,
6159 [ --enable-update-packaging
6160 Enable tools/update-packaging],
6161 MOZ_UPDATE_PACKAGING=1,
6162 MOZ_UPDATE_PACKAGING= )
6163 AC_SUBST(MOZ_UPDATE_PACKAGING)
6165 dnl ========================================================
6166 dnl build the tests by default
6167 dnl ========================================================
6168 MOZ_ARG_DISABLE_BOOL(tests,
6169 [ --disable-tests Do not build test libraries & programs],
6173 dnl ========================================================
6174 dnl parental controls (for Windows Vista)
6175 dnl ========================================================
6176 MOZ_ARG_DISABLE_BOOL(parental-controls,
6177 [ --disable-parental-controls
6178 Do not build parental controls],
6179 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6180 MOZ_DISABLE_PARENTAL_CONTROLS=)
6181 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6182 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6185 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6187 dnl ========================================================
6188 dnl = Disable DOMCrypto
6189 dnl ========================================================
6190 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6191 AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6194 dnl ========================================================
6196 dnl = Module specific options
6198 dnl ========================================================
6199 MOZ_ARG_HEADER(Individual module options)
6201 dnl ========================================================
6202 dnl = Disable feed handling components
6203 dnl ========================================================
6204 MOZ_ARG_DISABLE_BOOL(feeds,
6205 [ --disable-feeds Disable feed handling and processing components],
6208 if test -n "$MOZ_FEEDS"; then
6209 AC_DEFINE(MOZ_FEEDS)
6211 if test "$MOZ_BUILD_APP" = "browser"; then
6212 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6216 dnl ========================================================
6217 dnl Check for sqlite
6218 dnl ========================================================
6221 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6222 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6223 MOZ_NATIVE_SQLITE=1,
6224 MOZ_NATIVE_SQLITE= )
6226 if test -z "$MOZ_NATIVE_SQLITE"
6229 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6231 dnl ============================
6232 dnl === SQLite Version check ===
6233 dnl ============================
6234 dnl Check to see if the system SQLite package is new enough.
6235 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6237 dnl ==================================
6238 dnl === SQLITE_SECURE_DELETE check ===
6239 dnl ==================================
6240 dnl Check to see if the system SQLite package is compiled with
6241 dnl SQLITE_SECURE_DELETE enabled.
6242 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6243 _SAVE_CFLAGS="$CFLAGS"
6244 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6246 LIBS="$LIBS $SQLITE_LIBS"
6247 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6249 #include "sqlite3.h"
6251 int main(int argc, char **argv){
6252 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6254 ac_cv_sqlite_secure_delete=yes,
6255 ac_cv_sqlite_secure_delete=no,
6256 ac_cv_sqlite_secure_delete=no
6259 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6260 CFLAGS="$_SAVE_CFLAGS"
6262 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6263 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6266 dnl ===============================
6267 dnl === SQLITE_THREADSAFE check ===
6268 dnl ===============================
6269 dnl Check to see if the system SQLite package is compiled with
6270 dnl SQLITE_THREADSAFE enabled.
6271 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6272 _SAVE_CFLAGS="$CFLAGS"
6273 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6275 LIBS="$LIBS $SQLITE_LIBS"
6276 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6278 #include "sqlite3.h"
6280 int main(int argc, char **argv){
6281 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6283 ac_cv_sqlite_threadsafe=yes,
6284 ac_cv_sqlite_threadsafe=no,
6285 ac_cv_sqlite_threadsafe=no
6288 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6289 CFLAGS="$_SAVE_CFLAGS"
6291 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6292 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6295 dnl ================================
6296 dnl === SQLITE_ENABLE_FTS3 check ===
6297 dnl ================================
6298 dnl check to see if the system SQLite package is compiled with
6299 dnl SQLITE_ENABLE_FTS3 enabled.
6300 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6301 _SAVE_CFLAGS="$CFLAGS"
6302 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6304 LIBS="$LIBS $SQLITE_LIBS"
6305 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6307 #include "sqlite3.h"
6309 int main(int argc, char **argv){
6310 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6312 ac_cv_sqlite_enable_fts3=yes,
6313 ac_cv_sqlite_enable_fts3=no,
6314 ac_cv_sqlite_enable_fts3=no
6317 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6318 CFLAGS="$_SAVE_CFLAGS"
6320 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6321 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6324 dnl =========================================
6325 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6326 dnl =========================================
6327 dnl check to see if the system SQLite package is compiled with
6328 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6329 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6330 _SAVE_CFLAGS="$CFLAGS"
6331 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6333 LIBS="$LIBS $SQLITE_LIBS"
6334 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6336 #include "sqlite3.h"
6338 int main(int argc, char **argv){
6339 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6341 ac_cv_sqlite_enable_unlock_notify=yes,
6342 ac_cv_sqlite_enable_unlock_notify=no,
6343 ac_cv_sqlite_enable_unlock_notify=no
6346 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6347 CFLAGS="$_SAVE_CFLAGS"
6349 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6350 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6354 if test -n "$MOZ_NATIVE_SQLITE"; then
6355 AC_DEFINE(MOZ_NATIVE_SQLITE)
6357 AC_SUBST(MOZ_NATIVE_SQLITE)
6359 dnl ========================================================
6360 dnl = Enable help viewer (off by default)
6361 dnl ========================================================
6362 if test -n "$MOZ_HELP_VIEWER"; then
6363 dnl Do this if defined in confvars.sh
6364 AC_DEFINE(MOZ_HELP_VIEWER)
6367 dnl ========================================================
6368 dnl = Enable safe browsing (anti-phishing)
6369 dnl ========================================================
6370 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6371 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6372 MOZ_SAFE_BROWSING=1,
6373 MOZ_SAFE_BROWSING= )
6374 if test -n "$MOZ_SAFE_BROWSING"; then
6375 AC_DEFINE(MOZ_SAFE_BROWSING)
6377 AC_SUBST(MOZ_SAFE_BROWSING)
6379 dnl ========================================================
6380 dnl = Enable url-classifier
6381 dnl ========================================================
6382 dnl Implicitly enabled by default if building with safe-browsing
6383 if test -n "$MOZ_SAFE_BROWSING"; then
6384 MOZ_URL_CLASSIFIER=1
6386 MOZ_ARG_ENABLE_BOOL(url-classifier,
6387 [ --enable-url-classifier Enable url classifier module],
6388 MOZ_URL_CLASSIFIER=1,
6389 MOZ_URL_CLASSIFIER= )
6390 if test -n "$MOZ_URL_CLASSIFIER"; then
6391 AC_DEFINE(MOZ_URL_CLASSIFIER)
6393 AC_SUBST(MOZ_URL_CLASSIFIER)
6395 dnl ========================================================
6396 dnl = Disable zipwriter
6397 dnl ========================================================
6398 MOZ_ARG_DISABLE_BOOL(zipwriter,
6399 [ --disable-zipwriter Disable zipwriter component],
6402 AC_SUBST(MOZ_ZIPWRITER)
6404 dnl ========================================================
6406 dnl ========================================================
6407 dnl superseded by QtNetwork starting from 4.7
6408 MOZ_ENABLE_LIBCONIC=1
6410 if test -n "$MOZ_ENABLE_QT"; then
6411 if test "$MOZ_ENABLE_QTNETWORK"; then
6412 MOZ_ENABLE_LIBCONIC=
6416 MOZ_ARG_DISABLE_BOOL(libconic,
6417 [ --disable-libconic Disable libconic],
6418 MOZ_ENABLE_LIBCONIC=,
6419 MOZ_ENABLE_LIBCONIC=1 )
6421 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6422 PKG_CHECK_MODULES(LIBCONIC, conic,
6423 MOZ_ENABLE_LIBCONIC=1,
6424 MOZ_ENABLE_LIBCONIC=)
6426 if test "$MOZ_ENABLE_LIBCONIC"; then
6427 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6430 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6431 AC_SUBST(LIBCONIC_CFLAGS)
6432 AC_SUBST(LIBCONIC_LIBS)
6434 dnl ========================================================
6436 dnl ========================================================
6438 MAEMO_SDK_TARGET_VER=-1
6440 MOZ_ARG_WITH_STRING(maemo-version,
6441 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6443 MAEMO_SDK_TARGET_VER=$withval)
6445 case "$MAEMO_SDK_TARGET_VER" in
6447 MOZ_PLATFORM_MAEMO=5
6451 MOZ_PLATFORM_MAEMO=6
6455 dnl We aren't compiling for Maemo, move on.
6458 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6462 if test $MOZ_PLATFORM_MAEMO; then
6463 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6465 if test -z "$MOZ_ENABLE_DBUS"; then
6466 AC_MSG_ERROR([DBus is required when building for Maemo])
6469 MOZ_GFX_OPTIMIZE_MOBILE=1
6470 MOZ_GL_DEFAULT_PROVIDER=EGL
6471 MOZ_MAEMO_LIBLOCATION=
6473 if test $MOZ_PLATFORM_MAEMO = 5; then
6474 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6475 MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6476 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6477 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6478 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6480 AC_SUBST(XCOMPOSITE_LIBS)
6482 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6483 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6484 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6485 if test -z "$_LIB_FOUND"; then
6486 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6490 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6491 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6492 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6493 if test -z "$_LIB_FOUND"; then
6494 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6497 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6498 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6499 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6500 if test -z "$_LIB_FOUND"; then
6501 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6505 if test $MOZ_PLATFORM_MAEMO = 6; then
6507 PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6510 if test "$_LIB_FOUND"; then
6511 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6512 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6513 MOZ_ENABLE_CONTENTMANAGER=1
6514 AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6516 AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6518 AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6520 dnl ========================================================
6521 dnl = Enable meego libcontentaction
6522 dnl ========================================================
6523 MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6524 [ --enable-meegocontentaction Enable meegocontentaction support],
6525 MOZ_MEEGOCONTENTACTION=1,
6526 MOZ_MEEGOCONTENTACTION=)
6528 if test -n "$MOZ_MEEGOCONTENTACTION"; then
6530 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6531 if test "$_LIB_FOUND"; then
6532 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6533 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6534 MOZ_ENABLE_CONTENTACTION=1
6535 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6536 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6540 MOZ_ARG_ENABLE_BOOL(meegotouch,
6541 [ --enable-meegotouch Enable meegotouch support],
6542 MOZ_MEEGOTOUCHENABLED=1,
6543 MOZ_MEEGOTOUCHENABLED=)
6545 if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6546 PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6547 if test "$_LIB_FOUND"; then
6548 MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6549 MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6550 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6552 AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6557 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6558 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6559 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6560 if test "$_LIB_FOUND"; then
6561 MOZ_MAEMO_LIBLOCATION=1
6562 AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6564 AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6566 AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6568 PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6569 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6570 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6571 if test "$_LIB_FOUND"; then
6572 MOZ_ENABLE_MEEGOTOUCHSHARE=1
6573 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6575 AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6577 AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6579 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6580 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6583 dnl ========================================================
6584 dnl = XRender Composite
6585 dnl ========================================================
6586 MOZ_ARG_ENABLE_BOOL(egl-xrender-composite,
6587 [ --enable-egl-xrender-composite
6588 Enable EGL xrender composite optimizations],
6589 MOZ_EGL_XRENDER_COMPOSITE=1)
6591 if test -n "$MOZ_EGL_XRENDER_COMPOSITE"; then
6592 AC_DEFINE(MOZ_EGL_XRENDER_COMPOSITE)
6595 AC_SUBST(MOZ_EGL_XRENDER_COMPOSITE)
6597 dnl ========================================================
6599 dnl ========================================================
6601 MOZ_ARG_WITH_STRING(gl-provider,
6602 [ --with-gl-provider=ID
6603 Set GL provider backend type],
6604 [ val=`echo $withval`
6605 MOZ_GL_PROVIDER="$val"])
6607 if test -n "$MOZ_GL_PROVIDER"; then
6608 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6609 AC_SUBST(MOZ_GL_PROVIDER)
6610 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6612 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6614 dnl ========================================================
6615 dnl = faststripe theme
6616 dnl ========================================================
6617 MOZ_ARG_ENABLE_BOOL(faststripe,
6618 [ --enable-faststripe Use faststripe theme],
6619 MOZ_THEME_FASTSTRIPE=1,
6620 MOZ_THEME_FASTSTRIPE= )
6621 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6623 dnl ========================================================
6625 dnl = Feature options that require extra sources to be pulled
6627 dnl ========================================================
6628 dnl MOZ_ARG_HEADER(Features that require extra sources)
6630 dnl ========================================================
6632 dnl = Debugging Options
6634 dnl ========================================================
6635 MOZ_ARG_HEADER(Debugging and Optimizations)
6637 dnl ========================================================
6638 dnl = Disable building with debug info.
6639 dnl = Debugging is OFF by default
6640 dnl ========================================================
6641 if test -z "$MOZ_DEBUG_FLAGS"; then
6642 MOZ_DEBUG_FLAGS="-g"
6645 MOZ_ARG_ENABLE_STRING(debug,
6646 [ --enable-debug[=DBG] Enable building with developer debug info
6647 (using compiler flags DBG)],
6648 [ if test "$enableval" != "no"; then
6650 if test -n "$enableval" -a "$enableval" != "yes"; then
6651 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6652 _MOZ_DEBUG_FLAGS_SET=1
6659 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6660 MOZ_ARG_WITH_STRING(debug-label,
6661 [ --with-debug-label=LABELS
6662 Define DEBUG_<value> for each comma-separated
6664 [ for option in `echo $withval | sed 's/,/ /g'`; do
6665 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6668 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6670 if test -n "$MOZ_DEBUG"; then
6671 AC_MSG_CHECKING([for valid debug flags])
6672 _SAVE_CFLAGS=$CFLAGS
6673 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6674 AC_TRY_COMPILE([#include <stdio.h>],
6675 [printf("Hello World\n");],
6678 AC_MSG_RESULT([$_results])
6679 if test "$_results" = "no"; then
6680 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6682 CFLAGS=$_SAVE_CFLAGS
6685 dnl ========================================================
6686 dnl enable mobile optimizations
6687 dnl ========================================================
6688 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6689 [ --enable-mobile-optimize
6690 Enable mobile optimizations],
6691 MOZ_GFX_OPTIMIZE_MOBILE=1)
6693 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6695 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6696 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6699 dnl ========================================================
6700 dnl = Enable code optimization. ON by default.
6701 dnl ========================================================
6702 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6703 MOZ_OPTIMIZE_FLAGS="-O"
6706 MOZ_ARG_ENABLE_STRING(optimize,
6707 [ --disable-optimize Disable compiler optimization
6708 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6709 [ if test "$enableval" != "no"; then
6711 if test -n "$enableval" -a "$enableval" != "yes"; then
6712 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6717 fi ], MOZ_OPTIMIZE=1)
6719 MOZ_SET_FRAMEPTR_FLAGS
6721 if test "$COMPILE_ENVIRONMENT"; then
6722 if test -n "$MOZ_OPTIMIZE"; then
6723 AC_MSG_CHECKING([for valid optimization flags])
6724 _SAVE_CFLAGS=$CFLAGS
6725 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6726 AC_TRY_COMPILE([#include <stdio.h>],
6727 [printf("Hello World\n");],
6730 AC_MSG_RESULT([$_results])
6731 if test "$_results" = "no"; then
6732 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6734 CFLAGS=$_SAVE_CFLAGS
6736 fi # COMPILE_ENVIRONMENT
6738 AC_SUBST(MOZ_OPTIMIZE)
6739 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6740 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6741 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6742 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6743 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6744 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6746 dnl ========================================================
6747 dnl = Enable generation of debug symbols
6748 dnl ========================================================
6749 MOZ_ARG_ENABLE_STRING(debug-symbols,
6750 [ --enable-debug-symbols[=DBG]
6751 Enable debugging symbols (using compiler flags DBG)],
6752 [ if test "$enableval" != "no"; then
6754 if test -n "$enableval" -a "$enableval" != "yes"; then
6755 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6756 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6758 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6764 MOZ_DEBUG_SYMBOLS=1)
6766 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6767 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6768 export MOZ_DEBUG_SYMBOLS
6771 dnl ========================================================
6772 dnl = Enable any treating of compile warnings as errors
6773 dnl ========================================================
6774 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6775 [ --enable-warnings-as-errors
6776 Enable treating of warnings as errors],
6777 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6778 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6779 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6780 WARNINGS_AS_ERRORS=''
6783 dnl ========================================================
6784 dnl = Disable runtime logging checks
6785 dnl ========================================================
6786 MOZ_ARG_DISABLE_BOOL(logging,
6787 [ --disable-logging Disable logging facilities],
6788 NS_DISABLE_LOGGING=1,
6789 NS_DISABLE_LOGGING= )
6790 if test "$NS_DISABLE_LOGGING"; then
6791 AC_DEFINE(NS_DISABLE_LOGGING)
6793 AC_DEFINE(MOZ_LOGGING)
6796 dnl ========================================================
6797 dnl = This will enable logging of addref, release, ctor, dtor.
6798 dnl ========================================================
6799 _ENABLE_LOGREFCNT=42
6800 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6801 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6802 _ENABLE_LOGREFCNT=1,
6803 _ENABLE_LOGREFCNT= )
6804 if test "$_ENABLE_LOGREFCNT" = "1"; then
6805 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6806 elif test -z "$_ENABLE_LOGREFCNT"; then
6807 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6810 dnl ========================================================
6811 dnl moz_dump_painting
6812 dnl ========================================================
6813 MOZ_ARG_ENABLE_BOOL(dump-painting,
6814 [ --enable-dump-painting Enable paint debugging.],
6815 MOZ_DUMP_PAINTING=1,
6816 MOZ_DUMP_PAINTING= )
6817 if test -n "$MOZ_DUMP_PAINTING"; then
6818 AC_DEFINE(MOZ_DUMP_PAINTING)
6819 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6821 if test -n "$MOZ_DEBUG"; then
6822 AC_DEFINE(MOZ_DUMP_PAINTING)
6825 dnl ========================================================
6826 dnl = Enable trace malloc
6827 dnl ========================================================
6828 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6829 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6830 [ --enable-trace-malloc Enable malloc tracing; also disables jemalloc],
6833 if test "$NS_TRACE_MALLOC"; then
6834 # Please, Mr. Linker Man, don't take away our symbol names
6835 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6837 AC_DEFINE(NS_TRACE_MALLOC)
6839 AC_SUBST(NS_TRACE_MALLOC)
6841 dnl ========================================================
6842 dnl = Enable jemalloc
6843 dnl ========================================================
6844 MOZ_ARG_ENABLE_BOOL(jemalloc,
6845 [ --enable-jemalloc Replace memory allocator with jemalloc],
6849 if test "$NS_TRACE_MALLOC"; then
6852 if test "$MOZ_DMD"; then
6856 if test "${OS_TARGET}" = "Android"; then
6857 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6859 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
6860 dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
6861 if test -z "$GNU_CC"; then
6862 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6864 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6867 dnl On other Unix systems, we only want to link executables against mozglue
6868 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6869 dnl On other Unix systems, where mozglue is a static library, jemalloc is
6870 dnl separated for the SDK, so we need to add it here.
6871 if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6872 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6874 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6875 if test -n "$GNU_CC"; then
6876 dnl And we need mozglue symbols to be exported.
6877 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6879 if test "$MOZ_LINKER" = 1; then
6880 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $ZLIB_LIBS"
6884 if test -z "$MOZ_MEMORY"; then
6887 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
6888 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.])
6893 dnl Don't try to run compiler tests on Windows
6894 if test "$OS_ARCH" = "WINNT"; then
6895 if test -z "$HAVE_64BIT_OS"; then
6896 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6898 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6901 AC_CHECK_SIZEOF([int *], [4])
6902 case "${ac_cv_sizeof_int_p}" in
6904 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6907 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6910 AC_MSG_ERROR([Unexpected pointer size])
6915 AC_DEFINE(MOZ_MEMORY)
6916 if test -n "$MOZ_JEMALLOC"; then
6917 AC_DEFINE(MOZ_JEMALLOC)
6919 if test "x$MOZ_DEBUG" = "x1"; then
6920 AC_DEFINE(MOZ_MEMORY_DEBUG)
6922 dnl The generic feature tests that determine how to compute ncpus are long and
6923 dnl complicated. Therefore, simply define special cpp variables for the
6924 dnl platforms we have special knowledge of.
6927 AC_DEFINE(MOZ_MEMORY_DARWIN)
6930 AC_DEFINE(MOZ_MEMORY_BSD)
6932 *-android*|*-linuxandroid*)
6933 AC_DEFINE(MOZ_MEMORY_LINUX)
6934 AC_DEFINE(MOZ_MEMORY_ANDROID)
6935 if test -z "$gonkdir"; then
6938 AC_DEFINE(MOZ_MEMORY_GONK)
6943 AC_DEFINE(MOZ_MEMORY_LINUX)
6946 AC_DEFINE(MOZ_MEMORY_BSD)
6949 AC_DEFINE(MOZ_MEMORY_SOLARIS)
6952 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6953 if test -z "$MOZ_DEBUG"; then
6954 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
6956 WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
6958 dnl Look for a broken crtdll.obj
6959 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
6960 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
6961 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
6962 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
6963 dnl Also pass this to NSPR/NSS
6964 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
6966 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
6973 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6977 AC_SUBST(MOZ_MEMORY)
6978 AC_SUBST(MOZ_JEMALLOC)
6979 AC_SUBST(MOZ_GLUE_LDFLAGS)
6980 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
6981 AC_SUBST(WIN32_CRT_LIBS)
6982 dnl Need to set this for make because NSS doesn't have configure
6985 dnl We need to wrap dlopen and related functions on Android because we use
6987 if test "$OS_TARGET" = Android; then
6988 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
6989 if test -n "$MOZ_OLD_LINKER"; then
6990 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
6992 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
6993 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
6996 dnl ========================================================
6997 dnl = Use malloc wrapper lib
6998 dnl ========================================================
6999 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7000 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7004 if test -n "$_WRAP_MALLOC"; then
7005 if test -n "$GNU_CC"; then
7006 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7007 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7008 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7009 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7010 dnl Wrap operator new and operator delete on Android.
7011 if test "$OS_TARGET" = "Android"; then
7012 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7015 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7019 dnl ========================================================
7020 dnl = Location of malloc wrapper lib
7021 dnl ========================================================
7022 MOZ_ARG_WITH_STRING(wrap-malloc,
7023 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7024 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7026 dnl ========================================================
7027 dnl = Use JS Call tracing
7028 dnl ========================================================
7029 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7030 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7031 MOZ_TRACE_JSCALLS=1,
7032 MOZ_TRACE_JSCALLS= )
7033 if test -n "$MOZ_TRACE_JSCALLS"; then
7034 AC_DEFINE(MOZ_TRACE_JSCALLS)
7037 dnl ========================================================
7038 dnl = Use incremental GC
7039 dnl ========================================================
7041 MOZ_ARG_DISABLE_BOOL(gcincremental,
7042 [ --disable-gcincremental Disable incremental GC],
7044 if test -n "$JSGC_INCREMENTAL"; then
7045 AC_DEFINE(JSGC_INCREMENTAL)
7048 dnl ========================================================
7049 dnl ETW - Event Tracing for Windows
7050 dnl ========================================================
7051 MOZ_ARG_ENABLE_BOOL(ETW,
7052 [ --enable-ETW Enable ETW (Event Tracing for Windows) event reporting],
7055 if test -n "$MOZ_ETW"; then
7059 if test -n "$MOZ_ETW"; then
7060 if test -z "$MOZ_WINSDK_TARGETVER"; then
7061 AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7065 dnl ========================================================
7066 dnl Zealous JavaScript GC
7067 dnl ========================================================
7068 MOZ_ARG_ENABLE_BOOL(gczeal,
7069 [ --enable-gczeal Enable zealous JavaScript GCing],
7072 if test -n "$JS_GC_ZEAL"; then
7073 AC_DEFINE(JS_GC_ZEAL)
7076 dnl ========================================================
7077 dnl JS opt-mode assertions and minidump instrumentation
7078 dnl ========================================================
7079 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7080 [ --enable-js-diagnostics
7081 Enable JS diagnostic assertions and breakpad data],
7082 JS_CRASH_DIAGNOSTICS=1,
7083 JS_CRASH_DIAGNOSTICS= )
7084 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7085 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7090 dnl ========================================================
7091 dnl = Enable static checking using gcc-dehydra
7092 dnl ========================================================
7094 MOZ_ARG_WITH_STRING(static-checking,
7095 [ --with-static-checking=path/to/gcc_dehydra.so
7096 Enable static checking of code using GCC-dehydra],
7097 DEHYDRA_PATH=$withval,
7100 if test -n "$DEHYDRA_PATH"; then
7101 if test ! -f "$DEHYDRA_PATH"; then
7102 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7104 AC_DEFINE(NS_STATIC_CHECKING)
7106 AC_SUBST(DEHYDRA_PATH)
7108 dnl ========================================================
7109 dnl = Enable stripping of libs & executables
7110 dnl ========================================================
7111 MOZ_ARG_ENABLE_BOOL(strip,
7112 [ --enable-strip Enable stripping of libs & executables ],
7116 dnl ========================================================
7117 dnl = Enable stripping of libs & executables when packaging
7118 dnl ========================================================
7119 MOZ_ARG_ENABLE_BOOL(install-strip,
7120 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7124 dnl ========================================================
7125 dnl = --enable-elf-dynstr-gc
7126 dnl ========================================================
7127 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7128 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7129 USE_ELF_DYNSTR_GC=1,
7130 USE_ELF_DYNSTR_GC= )
7132 dnl ========================================================
7133 dnl = --disable-elf-hack
7134 dnl ========================================================
7137 MOZ_ARG_DISABLE_BOOL(elf-hack,
7138 [ --disable-elf-hack Disable elf hacks],
7142 # Disable elf hack for profiling because the built in profiler
7143 # doesn't read the segments properly with elf hack. This is
7144 # temporary and should be fixed soon in the profiler.
7145 if test "$MOZ_PROFILING" = 1; then
7149 # Only enable elfhack where supported
7150 if test "$USE_ELF_HACK" = 1; then
7151 case "${HOST_OS_ARCH},${OS_ARCH}" in
7153 case "${CPU_ARCH}" in
7168 if test "$USE_ELF_HACK" = 1; then
7169 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7170 dnl memory addresses it maps to. The result is that by the time elfhack
7171 dnl kicks in, it is not possible to apply relocations because of that,
7172 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7173 dnl segment. It makes elfhack mostly useless, so considering the problems
7174 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7175 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7176 dnl the linker creates PT_GNU_RELRO segments.
7177 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7178 LINK_WITH_PT_GNU_RELRO,
7179 [echo "int main() {return 0;}" > conftest.${ac_ext}
7180 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7181 test -s conftest${ac_exeext}; then
7182 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7183 LINK_WITH_PT_GNU_RELRO=yes
7185 LINK_WITH_PT_GNU_RELRO=no
7188 dnl We really don't expect to get here, but just in case
7189 AC_ERROR([couldn't compile a simple C file])
7192 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7193 AC_MSG_WARN([Disabling elfhack])
7198 dnl ========================================================
7199 dnl = libstdc++ compatibility hacks
7200 dnl ========================================================
7203 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7204 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7207 AC_SUBST(STDCXX_COMPAT)
7209 if test -n "$STDCXX_COMPAT"; then
7210 eval $(CXX="$CXX" MACOS_SDK_DIR="$MACOS_SDK_DIR" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7211 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7212 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7215 dnl ========================================================
7217 dnl = Profiling and Instrumenting
7219 dnl ========================================================
7220 MOZ_ARG_HEADER(Profiling and Instrumenting)
7222 dnl ========================================================
7223 dnl = Enable NS_FUNCTION_TIMER, which provides Function
7224 dnl = timing for identifying code bottlenecks
7225 dnl = NS_FUNCTION_TIMER is off by default.
7226 dnl ========================================================
7227 MOZ_ARG_ENABLE_BOOL(functiontimer,
7228 [ --enable-functiontimer Enable NS_FUNCTION_TIMER ],
7229 NS_FUNCTION_TIMER=1,
7230 NS_FUNCTION_TIMER= )
7231 if test -n "$NS_FUNCTION_TIMER"; then
7232 AC_DEFINE(NS_FUNCTION_TIMER)
7235 dnl ========================================================
7236 dnl = Enable runtime visual profiling logger
7237 dnl ========================================================
7238 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7239 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7240 MOZ_VISUAL_EVENT_TRACER=1,
7241 MOZ_VISUAL_EVENT_TRACER=)
7242 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7243 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7246 dnl ========================================================
7247 dnl Turn on reflow counting
7248 dnl ========================================================
7249 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7250 [ --enable-reflow-perf Enable reflow performance tracing],
7253 if test -n "$MOZ_REFLOW_PERF"; then
7254 AC_DEFINE(MOZ_REFLOW_PERF)
7257 dnl ========================================================
7258 dnl Enable code size metrics.
7259 dnl ========================================================
7260 MOZ_ARG_ENABLE_BOOL(codesighs,
7261 [ --enable-codesighs Enable code size analysis tools],
7262 _ENABLE_CODESIGHS=1,
7263 _ENABLE_CODESIGHS= )
7264 if test -n "$_ENABLE_CODESIGHS"; then
7265 if test -d $srcdir/tools/codesighs; then
7268 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7272 dnl ========================================================
7273 dnl = Enable Radio Interface for B2G (Gonk usually)
7274 dnl ========================================================
7275 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7276 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7279 if test -n "$MOZ_B2G_RIL"; then
7280 AC_DEFINE(MOZ_B2G_RIL)
7282 AC_SUBST(MOZ_B2G_RIL)
7284 dnl ========================================================
7285 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7286 dnl ========================================================
7287 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7288 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7291 if test -n "$MOZ_B2G_BT"; then
7292 AC_DEFINE(MOZ_B2G_BT)
7294 AC_SUBST(MOZ_B2G_BT)
7296 dnl ========================================================
7297 dnl = Enable Support for System Messages API
7298 dnl ========================================================
7299 if test -n "$MOZ_SYS_MSG"; then
7300 AC_DEFINE(MOZ_SYS_MSG)
7302 AC_SUBST(MOZ_SYS_MSG)
7304 dnl ========================================================
7305 dnl = Enable Camera Interface for B2G (Gonk usually)
7306 dnl ========================================================
7307 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7308 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7311 if test -n "$MOZ_B2G_CAMERA"; then
7312 AC_DEFINE(MOZ_B2G_CAMERA)
7314 AC_SUBST(MOZ_B2G_CAMERA)
7316 dnl ========================================================
7317 dnl = Enable Support for Payment API
7318 dnl ========================================================
7319 if test -n "$MOZ_PAY"; then
7324 dnl ========================================================
7325 dnl = Support for demangling undefined symbols
7326 dnl ========================================================
7327 if test -z "$SKIP_LIBRARY_CHECKS"; then
7330 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7334 # Demangle only for debug or trace-malloc builds
7335 MOZ_DEMANGLE_SYMBOLS=
7336 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7337 MOZ_DEMANGLE_SYMBOLS=1
7338 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7340 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7342 dnl ========================================================
7343 dnl = Support for gcc stack unwinding (from gcc 3.3)
7344 dnl ========================================================
7345 if test -z "$SKIP_LIBRARY_CHECKS"; then
7346 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7349 dnl ========================================================
7351 dnl ========================================================
7353 MOZ_ARG_WITH_STRING(jitreport-granularity,
7354 [ --jitreport-granularity=N
7355 Default granularity at which to report JIT code
7358 1 - code ranges for whole functions only
7359 2 - per-line information
7360 3 - per-op information],
7361 JITREPORT_GRANULARITY=$withval,
7362 JITREPORT_GRANULARITY=3)
7364 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7366 dnl ========================================================
7370 dnl ========================================================
7371 MOZ_ARG_HEADER(Misc. Options)
7373 dnl ========================================================
7374 dnl update xterm title
7375 dnl ========================================================
7376 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7377 [ --enable-xterm-updates Update XTERM titles with current command.],
7381 dnl =========================================================
7383 dnl =========================================================
7384 MOZ_ARG_ENABLE_STRING([chrome-format],
7385 [ --enable-chrome-format=jar|flat|both|symlink|omni
7386 Select FORMAT of chrome files (default=jar)],
7387 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7389 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7390 MOZ_CHROME_FILE_FORMAT=jar
7393 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7394 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7395 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7396 test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7397 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7398 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7401 dnl =========================================================
7402 dnl Omnijar packaging (bug 552121)
7403 dnl =========================================================
7404 dnl Omnijar packaging is compatible with flat packaging.
7405 dnl In unpackaged builds, omnijar looks for files as if
7406 dnl things were flat packaged. After packaging, all files
7407 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7408 dnl is set to flat since putting files into jars is only
7409 dnl done during packaging with omnijar.
7410 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7412 AC_DEFINE(MOZ_OMNIJAR)
7413 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$OS_TARGET" = "Android"; then
7414 MOZ_CHROME_FILE_FORMAT=flat
7416 MOZ_CHROME_FILE_FORMAT=symlink
7418 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7419 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7422 OMNIJAR_NAME=omni.ja
7423 AC_SUBST(OMNIJAR_NAME)
7424 AC_SUBST(MOZ_OMNIJAR)
7426 dnl ========================================================
7427 dnl = Define default location for MOZILLA_FIVE_HOME
7428 dnl ========================================================
7429 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7430 [ --with-default-mozilla-five-home
7431 Set the default value for MOZILLA_FIVE_HOME],
7432 [ val=`echo $withval`
7433 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7435 dnl ========================================================
7436 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7437 dnl ========================================================
7438 MOZ_ARG_WITH_STRING(user-appdir,
7439 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7440 [ val=`echo $withval`
7441 if echo "$val" | grep "\/" >/dev/null; then
7442 AC_MSG_ERROR("Homedir must be single relative path.")
7447 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7449 dnl ========================================================
7450 dnl = Doxygen configuration
7451 dnl ========================================================
7452 dnl Use commas to specify multiple dirs to this arg
7453 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7454 MOZ_ARG_WITH_STRING(doc-input-dirs,
7455 [ --with-doc-input-dirs=DIRS
7456 Header/idl dirs to create docs from],
7457 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7458 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7460 dnl Use commas to specify multiple dirs to this arg
7461 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7462 MOZ_ARG_WITH_STRING(doc-include-dirs,
7463 [ --with-doc-include-dirs=DIRS
7464 Include dirs to preprocess doc headers],
7465 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7466 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7468 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7469 MOZ_ARG_WITH_STRING(doc-output-dir,
7470 [ --with-doc-output-dir=DIR
7471 Dir to generate docs into],
7472 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7473 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7475 if test -z "$SKIP_COMPILER_CHECKS"; then
7476 dnl ========================================================
7478 dnl = Compiler Options
7480 dnl ========================================================
7481 MOZ_ARG_HEADER(Compiler Options)
7483 dnl ========================================================
7484 dnl Check for gcc -pipe support
7485 dnl ========================================================
7486 AC_MSG_CHECKING([for -pipe support])
7487 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7488 dnl Any gcc that supports firefox supports -pipe.
7489 CFLAGS="$CFLAGS -pipe"
7490 CXXFLAGS="$CXXFLAGS -pipe"
7491 AC_MSG_RESULT([yes])
7496 dnl ========================================================
7497 dnl Profile guided optimization (gcc checks)
7498 dnl ========================================================
7499 dnl Test for profiling options
7500 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7502 _SAVE_CFLAGS="$CFLAGS"
7503 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7505 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7506 AC_TRY_COMPILE([], [return 0;],
7507 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7508 result="yes" ], result="no")
7509 AC_MSG_RESULT([$result])
7511 if test $result = "yes"; then
7512 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7513 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7514 PROFILE_USE_LDFLAGS="-fprofile-use"
7517 CFLAGS="$_SAVE_CFLAGS"
7519 if test -n "$INTEL_CC"; then
7520 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7521 PROFILE_GEN_LDFLAGS=
7522 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7523 PROFILE_USE_LDFLAGS=
7526 dnl Sun Studio on Solaris
7527 if test "$SOLARIS_SUNPRO_CC"; then
7528 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7529 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7530 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7531 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7534 AC_SUBST(PROFILE_GEN_CFLAGS)
7535 AC_SUBST(PROFILE_GEN_LDFLAGS)
7536 AC_SUBST(PROFILE_USE_CFLAGS)
7537 AC_SUBST(PROFILE_USE_LDFLAGS)
7541 dnl ========================================================
7542 dnl Test for -pedantic bustage
7543 dnl ========================================================
7544 MOZ_ARG_DISABLE_BOOL(pedantic,
7545 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
7547 if test "$_PEDANTIC"; then
7548 _SAVE_CXXFLAGS=$CXXFLAGS
7549 CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7550 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7551 AC_TRY_COMPILE([$configure_static_assert_macros],
7552 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7553 result="no", result="yes" )
7554 AC_MSG_RESULT([$result])
7555 CXXFLAGS="$_SAVE_CXXFLAGS"
7559 _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
7560 _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7563 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
7568 dnl ========================================================
7569 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7570 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7571 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7572 dnl ========================================================
7573 _SAVE_CXXFLAGS=$CXXFLAGS
7574 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7575 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7576 ac_nscap_nonconst_opeq_bug,
7585 template <class T, class U>
7586 int operator==(const Pointer<T>& rhs, U* lhs)
7588 return rhs.myPtr == lhs;
7591 template <class T, class U>
7592 int operator==(const Pointer<T>& rhs, const U* lhs)
7594 return rhs.myPtr == lhs;
7602 ac_nscap_nonconst_opeq_bug="no",
7603 ac_nscap_nonconst_opeq_bug="yes")])
7604 CXXFLAGS="$_SAVE_CXXFLAGS"
7606 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7607 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7609 fi # ! SKIP_COMPILER_CHECKS
7611 AC_DEFINE(CPP_THROW_NEW, [throw()])
7614 if test "$COMPILE_ENVIRONMENT"; then
7616 fi # COMPILE_ENVIRONMENT
7618 dnl ========================================================
7620 dnl = Build depencency options
7622 dnl ========================================================
7623 MOZ_ARG_HEADER(Build dependencies)
7625 if test "$GNU_CC" -a "$GNU_CXX"; then
7626 _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
7627 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7628 elif test "$SOLARIS_SUNPRO_CC"; then
7631 dnl Don't override this for MSVC
7632 if test -z "$_WIN32_MSVC"; then
7633 _USE_CPP_INCLUDE_FLAG=
7634 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7635 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7637 echo '#include <stdio.h>' > dummy-hello.c
7639 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7641 if test -z "$CL_INCLUDES_PREFIX"; then
7642 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7644 AC_SUBST(CL_INCLUDES_PREFIX)
7649 dnl ========================================================
7651 dnl = Static Build Options
7653 dnl ========================================================
7654 MOZ_ARG_HEADER(Static build options)
7656 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7657 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
7661 MOZ_ARG_ENABLE_BOOL(shared-js,
7662 [ --enable-shared-js
7663 Create a shared JavaScript library.],
7667 if test -n "$ENABLE_SHARED_JS"; then
7669 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7671 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7672 AC_DEFINE(MOZ_STATIC_JS)
7674 AC_SUBST(JS_SHARED_LIBRARY)
7676 AC_SUBST(LIBXUL_LIBS)
7677 XPCOM_LIBS="$LIBXUL_LIBS"
7679 dnl ========================================================
7681 dnl = Standalone module options
7683 dnl ========================================================
7684 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7687 dnl ========================================================
7689 if test -z "$SKIP_PATH_CHECKS"; then
7690 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7691 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7692 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7697 if test -z "${GLIB_GMODULE_LIBS}" \
7698 -a -n "${GLIB_CONFIG}"\
7699 -a "${GLIB_CONFIG}" != no\
7701 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7704 AC_SUBST(GLIB_CFLAGS)
7706 AC_SUBST(GLIB_GMODULE_LIBS)
7708 dnl ========================================================
7709 dnl Graphics checks.
7710 dnl ========================================================
7712 if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
7718 MOZ_ARG_ENABLE_BOOL(skia,
7719 [ --enable-skia Enable use of Skia],
7723 if test "$USE_FC_FREETYPE"; then
7724 if test "$COMPILE_ENVIRONMENT"; then
7725 dnl ========================================================
7726 dnl = Check for freetype2 and its functionality
7727 dnl ========================================================
7728 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7730 if test "$_HAVE_FREETYPE2"; then
7732 _SAVE_CFLAGS="$CFLAGS"
7733 LIBS="$LIBS $FT2_LIBS"
7734 CFLAGS="$CFLAGS $FT2_CFLAGS"
7736 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7737 ac_cv_member_FT_Bitmap_Size_y_ppem,
7738 [AC_TRY_COMPILE([#include <ft2build.h>
7739 #include FT_FREETYPE_H],
7741 if (sizeof s.y_ppem) return 0;
7743 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7744 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7745 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7746 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7748 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7750 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7751 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7752 [FT_Bitmap_Size structure includes y_ppem field])
7754 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
7757 CFLAGS="$_SAVE_CFLAGS"
7760 _SAVE_CPPFLAGS="$CPPFLAGS"
7761 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7762 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7763 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7764 CPPFLAGS="$_SAVE_CPPFLAGS"
7766 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7769 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
7771 if test "$MOZ_PANGO"; then
7772 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
7773 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
7775 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
7776 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
7781 dnl ========================================================
7782 dnl Check for pixman and cairo
7783 dnl ========================================================
7786 MOZ_ARG_ENABLE_BOOL(system-cairo,
7787 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7792 MOZ_ARG_ENABLE_BOOL(system-pixman,
7793 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7795 MOZ_TREE_PIXMAN=force,
7798 # System cairo depends on system pixman
7799 if test "$MOZ_TREE_PIXMAN" = "force"; then
7800 if test -z "$MOZ_TREE_CAIRO"; then
7801 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7805 elif test -z "$MOZ_TREE_CAIRO"; then
7809 if test "$MOZ_TREE_PIXMAN"; then
7810 AC_DEFINE(MOZ_TREE_PIXMAN)
7811 MOZ_PIXMAN_CFLAGS=""
7812 MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
7814 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
7815 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
7816 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
7818 AC_SUBST(MOZ_PIXMAN_CFLAGS)
7819 AC_SUBST(MOZ_PIXMAN_LIBS)
7821 # Check for headers defining standard int types.
7822 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7824 if test "$MOZ_TREE_CAIRO"; then
7825 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7826 AC_DEFINE(MOZ_TREE_CAIRO)
7828 # For now we assume that we will have a uint64_t available through
7829 # one of the above headers or mozstdint.h.
7830 AC_DEFINE(HAVE_UINT64_T)
7832 # Define macros for cairo-features.h
7833 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
7834 if test "$MOZ_X11"; then
7835 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7836 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7837 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7838 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7839 MOZ_ENABLE_CAIRO_FT=1
7840 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7842 case "$MOZ_WIDGET_TOOLKIT" in
7844 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7847 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7848 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7849 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7852 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7853 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7854 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7855 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7856 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7857 MOZ_ENABLE_D2D_SURFACE=1
7858 MOZ_ENABLE_DWRITE_FONT=1
7860 WIN32_DWRITE_FONT_FEATURE=
7861 WIN32_D2D_SURFACE_FEATURE=
7864 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
7866 dnl D3D10 Layers depend on D2D Surfaces.
7867 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
7868 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
7872 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7873 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7874 MOZ_ENABLE_CAIRO_FT=1
7875 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7876 CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7880 if test "$USE_FC_FREETYPE"; then
7881 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7883 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7884 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
7885 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
7886 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
7887 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
7888 AC_SUBST(CAIRO_FT_CFLAGS)
7890 AC_SUBST(PS_SURFACE_FEATURE)
7891 AC_SUBST(PDF_SURFACE_FEATURE)
7892 AC_SUBST(SVG_SURFACE_FEATURE)
7893 AC_SUBST(XLIB_SURFACE_FEATURE)
7894 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7895 AC_SUBST(QUARTZ_SURFACE_FEATURE)
7896 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7897 AC_SUBST(WIN32_SURFACE_FEATURE)
7898 AC_SUBST(OS2_SURFACE_FEATURE)
7899 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7900 AC_SUBST(FT_FONT_FEATURE)
7901 AC_SUBST(FC_FONT_FEATURE)
7902 AC_SUBST(WIN32_FONT_FEATURE)
7903 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
7904 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
7905 AC_SUBST(QUARTZ_FONT_FEATURE)
7906 AC_SUBST(PNG_FUNCTIONS_FEATURE)
7907 AC_SUBST(QT_SURFACE_FEATURE)
7908 AC_SUBST(TEE_SURFACE_FEATURE)
7910 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
7911 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
7913 if test "$MOZ_X11"; then
7914 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
7917 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7919 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
7920 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
7921 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
7922 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
7923 if test "$MOZ_X11"; then
7924 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7925 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7926 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
7927 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7931 AC_SUBST(MOZ_TREE_CAIRO)
7932 AC_SUBST(MOZ_CAIRO_CFLAGS)
7933 AC_SUBST(MOZ_CAIRO_LIBS)
7934 AC_SUBST(MOZ_CAIRO_OSLIBS)
7935 AC_SUBST(MOZ_TREE_PIXMAN)
7937 dnl ========================================================
7939 dnl ========================================================
7941 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
7944 dnl ========================================================
7946 dnl ========================================================
7947 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
7948 AC_SUBST(MOZ_HARFBUZZ_LIBS)
7950 dnl ========================================================
7952 dnl ========================================================
7953 if test "$MOZ_GRAPHITE"; then
7954 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
7955 AC_DEFINE(MOZ_GRAPHITE)
7959 AC_SUBST(MOZ_GRAPHITE)
7960 AC_SUBST(MOZ_GRAPHITE_LIBS)
7962 dnl ========================================================
7964 dnl ========================================================
7965 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
7966 AC_SUBST(MOZ_OTS_LIBS)
7968 dnl ========================================================
7970 dnl ========================================================
7971 if test "$MOZ_ENABLE_SKIA"; then
7972 MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
7973 AC_DEFINE(MOZ_ENABLE_SKIA)
7977 AC_SUBST(MOZ_ENABLE_SKIA)
7978 AC_SUBST(MOZ_SKIA_LIBS)
7980 dnl ========================================================
7982 dnl ========================================================
7983 MOZ_ARG_DISABLE_BOOL(xul,
7984 [ --disable-xul Disable XUL],
7986 if test "$MOZ_XUL"; then
7989 dnl remove extensions that require XUL
7990 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7995 dnl ========================================================
7996 dnl disable profile locking
7997 dnl do no use this in applications that can have more than
7998 dnl one process accessing the profile directory.
7999 dnl ========================================================
8000 MOZ_ARG_DISABLE_BOOL(profilelocking,
8001 [ --disable-profilelocking
8002 Disable profile locking],
8003 MOZ_PROFILELOCKING=,
8004 MOZ_PROFILELOCKING=1 )
8005 if test "$MOZ_PROFILELOCKING"; then
8006 AC_DEFINE(MOZ_PROFILELOCKING)
8009 dnl ========================================================
8010 dnl necko configuration options
8011 dnl ========================================================
8014 dnl option to disable various necko protocols
8016 MOZ_ARG_ENABLE_STRING(necko-protocols,
8017 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8018 Enable/disable specific protocol handlers],
8019 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8020 if test "$option" = "yes" -o "$option" = "all"; then
8021 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8022 elif test "$option" = "no" -o "$option" = "none"; then
8024 elif test "$option" = "default"; then
8025 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8026 elif test `echo "$option" | grep -c \^-` != 0; then
8027 option=`echo $option | sed 's/^-//'`
8028 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8030 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8033 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8035 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8036 AC_SUBST(NECKO_PROTOCOLS)
8037 for p in $NECKO_PROTOCOLS; do
8038 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8039 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8043 dnl option to disable necko's wifi scanner
8045 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8046 [ --disable-necko-wifi Disable necko wifi scanner],
8050 if test "$OS_ARCH" = "OS2"; then
8051 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8054 if test "$NECKO_WIFI" -a \
8055 "$OS_ARCH" != "Linux" -a \
8056 "$OS_ARCH" != "Darwin" -a \
8057 "$OS_ARCH" != "SunOS" -a \
8058 "$OS_ARCH" != "WINNT"; then
8059 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8062 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8064 MOZ_CHECK_HEADER([iwlib.h])
8065 if test "$ac_cv_header_iwlib_h" != "yes"; then
8066 AC_MSG_ERROR([Can't find header iwlib.h for Necko WiFi scanning (might be in package libiw-dev (Ubuntu) or wireless-tools-devel (Fedora) or libiw-devel (openSUSE)); use --disable-necko-wifi to disable])
8070 if test "$NECKO_WIFI"; then
8071 AC_DEFINE(NECKO_WIFI)
8072 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8074 AC_SUBST(NECKO_WIFI)
8077 dnl option to disable cookies
8079 MOZ_ARG_DISABLE_BOOL(cookies,
8080 [ --disable-cookies Disable cookie support],
8083 AC_SUBST(NECKO_COOKIES)
8084 if test "$NECKO_COOKIES"; then
8085 AC_DEFINE(NECKO_COOKIES)
8086 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8090 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8092 MOZ_ARG_DISABLE_BOOL(ctypes,
8093 [ --disable-ctypes Disable js-ctypes],
8096 AC_SUBST(BUILD_CTYPES)
8097 if test "$BUILD_CTYPES"; then
8098 AC_DEFINE(BUILD_CTYPES)
8101 dnl Build Places if required
8102 if test "$MOZ_PLACES"; then
8103 AC_DEFINE(MOZ_PLACES)
8106 dnl Build Apps in the Cloud (AITC) if required
8107 AC_SUBST(MOZ_SERVICES_AITC)
8108 if test -n "$MOZ_SERVICES_AITC"; then
8109 AC_DEFINE(MOZ_SERVICES_AITC)
8112 dnl Build Notifications if required
8113 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8114 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8115 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8118 dnl Build Sync Services if required
8119 AC_SUBST(MOZ_SERVICES_SYNC)
8120 if test -n "$MOZ_SERVICES_SYNC"; then
8121 AC_DEFINE(MOZ_SERVICES_SYNC)
8124 dnl ========================================================
8125 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8126 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8129 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8130 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8133 if test "$MOZ_APP_COMPONENT_MODULES"; then
8134 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8137 dnl ========================================================
8139 dnl = Maintainer debug option (no --enable equivalent)
8141 dnl ========================================================
8146 AC_SUBST(AR_EXTRACT)
8150 AC_SUBST(AS_DASH_C_FLAG)
8159 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8160 AC_SUBST(MOZ_UPDATE_XTERM)
8161 AC_SUBST(MOZ_PLATFORM_MAEMO)
8162 AC_SUBST(MOZ_AUTH_EXTENSION)
8163 AC_SUBST(MOZ_PERMISSIONS)
8165 AC_SUBST(MOZ_PREF_EXTENSIONS)
8166 AC_SUBST(MOZ_JS_LIBS)
8169 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8170 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8171 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8172 AC_SUBST(MOZ_DEBUG_FLAGS)
8173 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8174 AC_SUBST(WARNINGS_AS_ERRORS)
8175 AC_SUBST(MOZ_EXTENSIONS)
8176 AC_SUBST(MOZ_JSDEBUGGER)
8177 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8180 AC_SUBST(MOZ_CALLGRIND)
8183 AC_SUBST(MOZ_PROFILING)
8185 AC_SUBST(MOZ_PLACES)
8186 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8188 AC_SUBST(NS_PRINTING)
8190 AC_SUBST(MOZ_HELP_VIEWER)
8191 AC_SUBST(TOOLCHAIN_PREFIX)
8197 AC_SUBST(MOZ_PROFILELOCKING)
8199 AC_SUBST(ENABLE_TESTS)
8200 AC_SUBST(ENABLE_MARIONETTE)
8202 AC_SUBST(MOZ_UNIVERSALCHARDET)
8203 AC_SUBST(ACCESSIBILITY)
8204 AC_SUBST(MOZ_SPELLCHECK)
8205 AC_SUBST(MOZ_JAVA_COMPOSITOR)
8206 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8207 AC_SUBST(MOZ_CRASHREPORTER)
8208 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8209 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8210 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8211 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8212 AC_SUBST(MOZ_UPDATER)
8213 AC_SUBST(MOZ_ANGLE_RENDERER)
8214 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8215 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8216 AC_SUBST(MOZ_D3DX9_VERSION)
8217 AC_SUBST(MOZ_D3DX9_CAB)
8218 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8219 AC_SUBST(MOZ_D3DX9_DLL)
8220 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8223 AC_SUBST(MOZ_ANDROID_HISTORY)
8224 AC_SUBST(MOZ_WEBSMS_BACKEND)
8225 AC_SUBST(ENABLE_STRIP)
8226 AC_SUBST(PKG_SKIP_STRIP)
8227 AC_SUBST(STRIP_FLAGS)
8228 AC_SUBST(USE_ELF_DYNSTR_GC)
8229 AC_SUBST(USE_ELF_HACK)
8230 AC_SUBST(INCREMENTAL_LINKER)
8231 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8232 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8234 AC_SUBST(MOZ_FIX_LINK_PATHS)
8235 AC_SUBST(XPCOM_LIBS)
8236 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8237 AC_SUBST(XPCOM_GLUE_LDOPTS)
8238 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8239 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8240 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8242 AC_SUBST(USE_DEPENDENT_LIBS)
8244 AC_SUBST(MOZ_BUILD_ROOT)
8245 AC_SUBST(MOZ_OS2_TOOLS)
8247 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8248 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8249 AC_SUBST(MOZ_LINKER_EXTRACT)
8250 AC_SUBST(MOZ_PER_WINDOW_PRIVATE_BROWSING)
8252 dnl ========================================================
8253 dnl = Mac bundle name prefix
8254 dnl ========================================================
8255 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8256 [ --with-macbundlename-prefix=prefix
8257 Prefix for MOZ_MACBUNDLE_NAME],
8258 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8260 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8261 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8262 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8265 if test "$MOZ_DEBUG"; then
8266 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8268 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8270 AC_SUBST(MOZ_MACBUNDLE_NAME)
8272 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8273 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8274 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8275 if test "$MOZ_DEBUG"; then
8276 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8279 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8280 AC_SUBST(MOZ_MACBUNDLE_ID)
8282 # The following variables are available to branding and application
8283 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8284 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8285 # impacts profile location and user-visible fields.
8286 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8287 # versions of a given application (e.g. Aurora and Firefox both use
8288 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8289 # for application.ini's "Name" field, which controls profile location in
8290 # the absence of a "Profile" field (see below), and various system
8291 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8292 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8293 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8294 # builds (e.g. Aurora for Firefox).
8295 # - MOZ_APP_VERSION: Defines the application version number.
8296 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8297 # defaults to a lowercase form of MOZ_APP_BASENAME.
8298 # - MOZ_APP_PROFILE: When set, used for application.ini's
8299 # "Profile" field, which controls profile location.
8300 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8301 # crash reporter server url.
8302 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8303 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8305 if test -z "$MOZ_APP_NAME"; then
8306 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8309 # For extensions and langpacks, we require a max version that is compatible
8310 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8311 # 10.0a1 and 10.0a2 aren't affected
8312 # 10.0 becomes 10.0.*
8313 # 10.0.1 becomes 10.0.*
8314 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8315 if test -z "$IS_ALPHA"; then
8317 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8320 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8323 AC_SUBST(MOZ_APP_NAME)
8324 AC_SUBST(MOZ_APP_DISPLAYNAME)
8325 AC_SUBST(MOZ_APP_BASENAME)
8326 AC_SUBST(MOZ_APP_VENDOR)
8327 AC_SUBST(MOZ_APP_PROFILE)
8328 AC_SUBST(MOZ_APP_ID)
8329 AC_SUBST(MAR_CHANNEL_ID)
8330 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8331 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8332 AC_SUBST(MOZ_EXTENSION_MANAGER)
8333 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8334 AC_SUBST(MOZ_APP_UA_NAME)
8335 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8336 AC_SUBST(MOZ_APP_VERSION)
8337 AC_SUBST(MOZ_APP_MAXVERSION)
8338 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8339 AC_SUBST(FIREFOX_VERSION)
8340 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8341 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8342 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8345 # We can't use the static application.ini data when building against
8347 if test -n "$LIBXUL_SDK"; then
8350 AC_SUBST(MOZ_APP_STATIC_INI)
8352 AC_SUBST(MOZ_PKG_SPECIAL)
8354 AC_SUBST(MOZILLA_OFFICIAL)
8356 if test "$MOZ_TELEMETRY_REPORTING"; then
8357 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8361 AC_SUBST(MOZ_MAPINFO)
8362 AC_SUBST(MOZ_BROWSE_INFO)
8363 AC_SUBST(MOZ_TOOLS_DIR)
8364 AC_SUBST(WIN32_REDIST_DIR)
8367 dnl Echo the CFLAGS to remove extra whitespace.
8373 $_WARNINGS_CXXFLAGS \
8376 COMPILE_CFLAGS=`echo \
8381 COMPILE_CXXFLAGS=`echo \
8382 $_DEFINES_CXXFLAGS \
8386 AC_SUBST(SYSTEM_LIBXUL)
8387 AC_SUBST(MOZ_NATIVE_JPEG)
8388 AC_SUBST(MOZ_NATIVE_PNG)
8389 AC_SUBST(MOZ_NATIVE_BZ2)
8391 AC_SUBST(MOZ_FLEXBOX)
8392 AC_SUBST(MOZ_JPEG_CFLAGS)
8393 AC_SUBST(MOZ_JPEG_LIBS)
8394 AC_SUBST(MOZ_BZ2_CFLAGS)
8395 AC_SUBST(MOZ_BZ2_LIBS)
8396 AC_SUBST(MOZ_PNG_CFLAGS)
8397 AC_SUBST(MOZ_PNG_LIBS)
8399 AC_SUBST(NSPR_CFLAGS)
8401 AC_SUBST(MOZ_NATIVE_NSPR)
8403 AC_SUBST(NSS_CFLAGS)
8405 AC_SUBST(NSS_DEP_LIBS)
8406 AC_SUBST(MOZ_NATIVE_NSS)
8407 AC_SUBST(NSS_DISABLE_DBM)
8410 OS_CXXFLAGS="$CXXFLAGS"
8411 OS_CPPFLAGS="$CPPFLAGS"
8412 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8413 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8414 OS_LDFLAGS="$LDFLAGS"
8417 AC_SUBST(OS_CXXFLAGS)
8418 AC_SUBST(OS_CPPFLAGS)
8419 AC_SUBST(OS_COMPILE_CFLAGS)
8420 AC_SUBST(OS_COMPILE_CXXFLAGS)
8421 AC_SUBST(OS_LDFLAGS)
8423 AC_SUBST(CROSS_COMPILE)
8424 AC_SUBST(WCHAR_CFLAGS)
8428 AC_SUBST(HOST_CFLAGS)
8429 AC_SUBST(HOST_CXXFLAGS)
8430 AC_SUBST(HOST_LDFLAGS)
8431 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8433 AC_SUBST(HOST_AR_FLAGS)
8435 AC_SUBST(HOST_RANLIB)
8436 AC_SUBST(HOST_NSPR_MDCPUCFG)
8437 AC_SUBST(HOST_BIN_SUFFIX)
8438 AC_SUBST(HOST_OS_ARCH)
8440 AC_SUBST(TARGET_CPU)
8441 AC_SUBST(TARGET_VENDOR)
8443 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8444 AC_SUBST(TARGET_MD_ARCH)
8445 AC_SUBST(TARGET_XPCOM_ABI)
8448 AC_SUBST(OS_RELEASE)
8451 AC_SUBST(INTEL_ARCHITECTURE)
8453 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8455 AC_SUBST(WRAP_LDFLAGS)
8458 AC_SUBST(MKSHLIB_FORCE_ALL)
8459 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8460 AC_SUBST(DSO_CFLAGS)
8461 AC_SUBST(DSO_PIC_CFLAGS)
8462 AC_SUBST(DSO_LDOPTS)
8463 AC_SUBST(LIB_PREFIX)
8464 AC_SUBST(DLL_PREFIX)
8465 AC_SUBST(DLL_SUFFIX)
8466 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8467 AC_SUBST(LIB_SUFFIX)
8468 AC_SUBST(OBJ_SUFFIX)
8469 AC_SUBST(BIN_SUFFIX)
8470 AC_SUBST(ASM_SUFFIX)
8471 AC_SUBST(IMPORT_LIB_SUFFIX)
8473 AC_SUBST(CC_VERSION)
8474 AC_SUBST(CXX_VERSION)
8475 AC_SUBST(MSMANIFEST_TOOL)
8476 AC_SUBST(NS_ENABLE_TSF)
8477 AC_SUBST(MOZ_NSS_PATCH)
8478 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8479 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8482 AC_SUBST(MOZ_SYDNEYAUDIO)
8483 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8486 AC_SUBST(MOZ_VORBIS)
8487 AC_SUBST(MOZ_TREMOR)
8490 AC_SUBST(MOZ_MEDIA_PLUGINS)
8491 AC_SUBST(MOZ_OMX_PLUGIN)
8492 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8493 AC_SUBST(MOZ_VP8_ENCODER)
8496 AC_SUBST(MOZ_ALSA_LIBS)
8497 AC_SUBST(MOZ_ALSA_CFLAGS)
8499 AC_SUBST(VPX_ASFLAGS)
8500 AC_SUBST(VPX_DASH_C_FLAG)
8501 AC_SUBST(VPX_AS_CONVERSION)
8502 AC_SUBST(VPX_ASM_SUFFIX)
8503 AC_SUBST(VPX_X86_ASM)
8504 AC_SUBST(VPX_ARM_ASM)
8505 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8506 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8507 AC_SUBST(LIBJPEG_TURBO_AS)
8508 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8509 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8510 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8511 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8513 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8515 AC_MSG_CHECKING([for posix_fallocate])
8516 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8517 #include <fcntl.h>],
8518 [posix_fallocate(0, 0, 0);],
8519 [ac_cv___posix_fallocate=true],
8520 [ac_cv___posix_fallocate=false])
8522 if test "$ac_cv___posix_fallocate" = true ; then
8523 AC_DEFINE(HAVE_POSIX_FALLOCATE)
8529 dnl Check for missing components
8530 if test "$COMPILE_ENVIRONMENT"; then
8531 if test "$MOZ_X11"; then
8532 if test "$WITHOUT_X11"; then
8533 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8535 dnl ====================================================
8536 dnl = Check if X headers exist
8537 dnl ====================================================
8538 _SAVE_CFLAGS=$CFLAGS
8539 CFLAGS="$CFLAGS $XCFLAGS"
8543 #include <X11/Xlib.h>
8544 #include <X11/Intrinsic.h>
8545 #include <X11/extensions/XShm.h>
8549 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8550 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8554 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8555 CFLAGS="$_SAVE_CFLAGS"
8557 if test -n "$MISSING_X"; then
8558 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8563 dnl Check for headers, etc. needed by WebGL.
8564 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8565 MOZ_CHECK_HEADER(GL/glx.h)
8566 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8567 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))])
8569 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8570 fi # COMPILE_ENVIRONMENT
8572 dnl Set various defines and substitutions
8573 dnl ========================================================
8575 if test "$OS_ARCH" = "Darwin"; then
8577 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8581 if test "$MOZ_DEBUG"; then
8582 AC_DEFINE(MOZ_REFLOW_PERF)
8583 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8586 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8587 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8588 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8589 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8590 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8591 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8592 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8593 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8594 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8597 AC_SUBST(MOZILLA_VERSION)
8599 AC_SUBST(ac_configure_args)
8601 dnl Spit out some output
8602 dnl ========================================================
8604 dnl The following defines are used by xpcom
8605 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8607 HAVE_CPP_2BYTE_WCHAR_T
8608 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8610 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8611 HAVE_CPP_PARTIAL_SPECIALIZATION
8612 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8613 NEED_CPP_UNUSED_IMPLEMENTATIONS
8617 HAVE_ICONV_WITH_CONST_INPUT
8631 netwerk/necko-config.h
8632 xpcom/xpcom-config.h
8633 xpcom/xpcom-private.h
8636 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8637 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8638 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8639 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8640 # (apparently) only need this hack when egrep's "pattern" is particularly long
8641 # (as in the following code) and the first egrep on our $PATH is Apple's. See
8645 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8652 dnl Create a virtualenv where we can install local Python packages
8653 AC_MSG_RESULT([Creating Python virtualenv])
8655 mkdir -p _virtualenv
8656 MACOSX_DEPLOYMENT_TARGET= PYTHONDONTWRITEBYTECODE= $PYTHON $_topsrcdir/python/virtualenv/virtualenv.py --system-site-packages ./_virtualenv
8659 PYTHON=$MOZ_BUILD_ROOT/_virtualenv/Scripts/python.exe
8662 PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python
8668 # Populate the virtualenv
8669 AC_MSG_RESULT([Populating Python virtualenv])
8670 MACOSX_DEPLOYMENT_TARGET= LDFLAGS="${HOST_LDFLAGS}" \
8671 CC="${HOST_CC}" CXX="${HOST_CXX}" \
8672 CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" \
8673 $PYTHON $_topsrcdir/build/virtualenv/populate_virtualenv.py \
8674 $_topsrcdir $_topsrcdir/build/virtualenv/packages.txt \
8677 dnl Load the list of Makefiles to generate.
8678 dnl To add new Makefiles, edit allmakefiles.sh.
8679 dnl allmakefiles.sh sets the variable, MAKEFILES.
8680 . ${srcdir}/allmakefiles.sh
8682 echo $MAKEFILES > unallmakefiles
8684 AC_OUTPUT($MAKEFILES)
8686 # Generate Makefiles for WebRTC directly from .gyp files
8687 if test "${OS_TARGET}" = "WINNT"; then
8688 if test "$HAVE_64BIT_OS"; then
8693 EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
8696 if test -n "$MOZ_WEBRTC"; then
8697 AC_MSG_RESULT("generating WebRTC Makefiles...")
8699 GYP_WEBRTC_OPTIONS="--format=mozmake -D build_with_mozilla=1 -D enable_protobuf=0 -D include_internal_video_render=0 ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
8701 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8702 $GYP_WEBRTC_OPTIONS \
8703 --generator-output=${_objdir}/media/webrtc/trunk \
8704 ${srcdir}/media/webrtc/trunk/peerconnection.gyp
8705 if test "$?" != 0; then
8706 AC_MSG_ERROR([failed to generate WebRTC Makefiles])
8709 # XXX disable until we land the tranche with signaling
8710 if test -n "$MOZ_WEBRTC_SIGNALING"; then
8711 AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
8712 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8713 $GYP_WEBRTC_OPTIONS \
8714 --generator-output=${_objdir}/media/webrtc/signaling \
8715 ${srcdir}/media/webrtc/signaling/signaling.gyp
8716 if test "$?" != 0; then
8717 AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
8721 AC_MSG_RESULT("generating gtest Makefiles...")
8722 # Ok to pass some extra -D's that are ignored here
8723 $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8724 $GYP_WEBRTC_OPTIONS \
8725 --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
8726 ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
8727 if test "$?" != 0; then
8728 AC_MSG_ERROR([failed to generate gtest Makefiles])
8732 # Generate a JSON config file for unittest harnesses etc to read
8733 # build configuration details from in a standardized way.
8734 OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
8735 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
8736 $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
8737 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
8738 rm ./mozinfo.json.tmp
8740 mv -f ./mozinfo.json.tmp ./mozinfo.json
8743 # Run jemalloc configure script
8745 if test "$MOZ_JEMALLOC" -a "$MOZ_MEMORY"; then
8746 ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
8747 if test "$OS_ARCH" = "Linux"; then
8748 MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
8751 if test -n "$_WRAP_MALLOC"; then
8752 JEMALLOC_WRAPPER=__wrap_
8754 for mangle in ${MANGLE}; do
8755 if test -n "$MANGLED"; then
8756 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
8758 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
8761 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
8764 if test -z "$MOZ_TLS"; then
8765 ac_configure_args="$ac_configure_args --disable-tls"
8767 EXTRA_CFLAGS="$CFLAGS"
8768 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
8769 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
8771 if test "$CROSS_COMPILE"; then
8772 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
8774 _save_cache_file="$cache_file"
8775 cache_file=$_objdir/memory/jemalloc/src/config.cache
8776 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
8777 cache_file="$_save_cache_file"
8778 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8781 dnl Build libunwind for Android profiling builds
8782 if test "$OS_TARGET" = "Android" -a "$MOZ_PROFILING"; then
8783 old_ac_configure_arg="$ac_configure_args"
8784 ac_configure_args="--build=${build} --host=${target_alias} --disable-shared --enable-block-signals=no"
8785 if test "$MOZ_DEBUG"; then
8786 ac_configure_args="$ac_configure_args --enable-debug"
8788 if test "$DSO_PIC_CFLAGS"; then
8789 ac_configure_args="$ac_configure_args --with-pic"
8791 ac_configure_args="$ac_configure_args \
8795 CFLAGS=\"$CFLAGS\" \
8796 CXXFLAGS=\"$CXXFLAGS\" \
8797 CPPFLAGS=\"$CPPFLAGS\" \
8799 LDFLAGS=\"$LDFLAGS\" \
8801 RANLIB=\"$RANLIB\" \
8805 # Use a separate cache file for libunwind, since it does not use caching.
8806 mkdir -p $_objdir/tools/profiler/libunwind/src
8807 old_cache_file=$cache_file
8808 cache_file=$_objdir/tools/profiler/libunwind/src/config.cache
8809 old_config_files=$CONFIG_FILES
8811 AC_OUTPUT_SUBDIRS(tools/profiler/libunwind/src)
8812 cache_file=$old_cache_file
8813 ac_configure_args="$old_ac_configure_args"
8814 CONFIG_FILES=$old_config_files
8817 # Run freetype configure script
8819 if test "$MOZ_TREE_FREETYPE"; then
8820 export CFLAGS="$CFLAGS -std=c99"
8821 export CPPFLAGS="$CPPFLAGS"
8822 export CXXFLAGS="$CXXFLAGS"
8823 export LDFLAGS="$LDFLAGS"
8824 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
8825 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
8826 AC_OUTPUT_SUBDIRS(modules/freetype2)
8829 if test -z "$direct_nspr_config"; then
8830 dnl ========================================================
8831 dnl = Setup a nice relatively clean build environment for
8832 dnl = sub-configures.
8833 dnl ========================================================
8836 CFLAGS="$_SUBDIR_CFLAGS"
8837 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8838 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8839 LDFLAGS="$_SUBDIR_LDFLAGS"
8840 HOST_CC="$_SUBDIR_HOST_CC"
8841 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8842 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8849 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8850 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8854 if test -n "$_WRAP_MALLOC"; then
8855 # Avoid doubling wrap malloc arguments
8856 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
8859 if test -z "$MOZ_NATIVE_NSPR"; then
8860 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8861 if test -z "$MOZ_DEBUG"; then
8862 ac_configure_args="$ac_configure_args --disable-debug"
8864 ac_configure_args="$ac_configure_args --enable-debug"
8866 if test "$MOZ_OPTIMIZE" = "1"; then
8867 ac_configure_args="$ac_configure_args --enable-optimize"
8868 elif test -z "$MOZ_OPTIMIZE"; then
8869 ac_configure_args="$ac_configure_args --disable-optimize"
8871 if test -n "$HAVE_64BIT_OS"; then
8872 ac_configure_args="$ac_configure_args --enable-64bit"
8874 if test -n "$USE_ARM_KUSER"; then
8875 ac_configure_args="$ac_configure_args --with-arm-kuser"
8877 ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
8878 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no ; then
8879 # dladdr is supported by the new linker, even when the system linker doesn't
8880 # support it. Trick nspr into using dladdr when it's not supported.
8881 _SAVE_CPPFLAGS="$CPPFLAGS"
8882 export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
8884 _SAVE_LDFLAGS="$LDFLAGS"
8885 export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
8886 AC_OUTPUT_SUBDIRS(nsprpub)
8887 LDFLAGS="$_SAVE_LDFLAGS"
8888 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no; then
8890 CPPFLAGS="$_SAVE_CFLAGS"
8892 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8895 dnl ========================================================
8896 dnl = Setup a nice relatively clean build environment for
8897 dnl = sub-configures.
8898 dnl ========================================================
8901 CFLAGS="$_SUBDIR_CFLAGS"
8902 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8903 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8904 LDFLAGS="$_SUBDIR_LDFLAGS"
8905 HOST_CC="$_SUBDIR_HOST_CC"
8906 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8907 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8910 # Run the SpiderMonkey 'configure' script.
8911 dist=$MOZ_BUILD_ROOT/dist
8912 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8913 ac_configure_args="$ac_configure_args --enable-threadsafe"
8914 if test "$BUILD_CTYPES"; then
8915 # Build js-ctypes on the platforms we can.
8916 ac_configure_args="$ac_configure_args --enable-ctypes"
8918 if test -z "$JS_SHARED_LIBRARY" ; then
8919 ac_configure_args="$ac_configure_args --disable-shared-js"
8921 if test -z "$MOZ_NATIVE_NSPR"; then
8922 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8923 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8925 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8926 ac_configure_args="$ac_configure_args --prefix=$dist"
8927 if test "$MOZ_MEMORY"; then
8928 ac_configure_args="$ac_configure_args --enable-jemalloc"
8930 if test -n "$MOZ_GLUE_LDFLAGS"; then
8931 export MOZ_GLUE_LDFLAGS
8933 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
8934 export MOZ_GLUE_PROGRAM_LDFLAGS
8936 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
8939 export MOZ_NATIVE_ZLIB
8940 export MOZ_ZLIB_CFLAGS
8941 export MOZ_ZLIB_LIBS
8943 export STLPORT_CPPFLAGS
8944 export STLPORT_LDFLAGS
8946 AC_OUTPUT_SUBDIRS(js/src)
8947 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8949 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR