Bug 865244 - Test for AudioContext.destination.maxChannelCount. r=ehsan
[gecko.git] / configure.in
blobf1111a0781585abc3dac8f2e12c991aa99f43940
2 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
3 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
4 dnl This Source Code Form is subject to the terms of the Mozilla Public
5 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
6 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 dnl Process this file with autoconf to produce a configure script.
9 dnl ========================================================
11 AC_PREREQ(2.13)
12 AC_INIT(config/config.mk)
13 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
14 AC_CANONICAL_SYSTEM
15 TARGET_CPU="${target_cpu}"
16 TARGET_VENDOR="${target_vendor}"
17 TARGET_OS="${target_os}"
19 dnl ========================================================
20 dnl =
21 dnl = Don't change the following two lines.  Doing so breaks:
22 dnl =
23 dnl = CFLAGS="-foo" ./configure
24 dnl =
25 dnl ========================================================
26 CFLAGS="${CFLAGS=}"
27 CPPFLAGS="${CPPFLAGS=}"
28 CXXFLAGS="${CXXFLAGS=}"
29 LDFLAGS="${LDFLAGS=}"
30 HOST_CFLAGS="${HOST_CFLAGS=}"
31 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
32 HOST_LDFLAGS="${HOST_LDFLAGS=}"
34 dnl ========================================================
35 dnl = Preserve certain environment flags passed to configure
36 dnl = We want sub projects to receive the same flags
37 dnl = untainted by this configure script
38 dnl ========================================================
39 _SUBDIR_CC="$CC"
40 _SUBDIR_CXX="$CXX"
41 _SUBDIR_CFLAGS="$CFLAGS"
42 _SUBDIR_CPPFLAGS="$CPPFLAGS"
43 _SUBDIR_CXXFLAGS="$CXXFLAGS"
44 _SUBDIR_LDFLAGS="$LDFLAGS"
45 _SUBDIR_HOST_CC="$HOST_CC"
46 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
47 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
48 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
49 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
51 dnl Set the version number of the libs included with mozilla
52 dnl ========================================================
53 MOZJPEG=62
54 MOZPNG=10513
55 NSPR_VERSION=4
56 NSS_VERSION=3
58 dnl Set the minimum version of toolkit libs used by mozilla
59 dnl ========================================================
60 GLIB_VERSION=1.2.0
61 PERL_VERSION=5.006
62 CAIRO_VERSION=1.10
63 PANGO_VERSION=1.14.0
64 GTK2_VERSION=2.10.0
65 GTK3_VERSION=3.0.0
66 WINDRES_VERSION=2.14.90
67 W32API_VERSION=3.14
68 GNOMEVFS_VERSION=2.0
69 GNOMEUI_VERSION=2.2.0
70 GCONF_VERSION=1.2.1
71 GIO_VERSION=2.20
72 STARTUP_NOTIFICATION_VERSION=0.8
73 DBUS_VERSION=0.60
74 SQLITE_VERSION=3.7.17
76 MSMANIFEST_TOOL=
78 dnl Set various checks
79 dnl ========================================================
80 MISSING_X=
81 AC_PROG_AWK
83 dnl Initialize the Pthread test variables early so they can be
84 dnl  overridden by each platform.
85 dnl ========================================================
86 USE_PTHREADS=
87 _PTHREAD_LDFLAGS=""
89 dnl Do not allow a separate objdir build if a srcdir build exists.
90 dnl ==============================================================
91 _topsrcdir=`cd \`dirname $0\`; pwd`
92 _objdir=`pwd`
94 if test "$_topsrcdir" != "$_objdir"
95 then
96   # Check for a couple representative files in the source tree
97   _conflict_files=
98   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
99     if test -f $file; then
100       _conflict_files="$_conflict_files $file"
101     fi
102   done
103   if test "$_conflict_files"; then
104     echo "***"
105     echo "*   Your source tree contains these files:"
106     for file in $_conflict_files; do
107       echo "*         $file"
108     done
109     cat 1>&2 <<-EOF
110         *   This indicates that you previously built in the source tree.
111         *   A source tree build can confuse the separate objdir build.
112         *
113         *   To clean up the source tree:
114         *     1. cd $_topsrcdir
115         *     2. gmake distclean
116         ***
117         EOF
118     exit 1
119     break
120   fi
122 MOZ_BUILD_ROOT=`pwd`
124 MOZ_PYTHON
126 MOZ_DEFAULT_COMPILER
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`
143     else
144         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
145     fi
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 AC_SUBST(GAIADIR)
156 if test -n "$GAIADIR" ; then
157     AC_DEFINE(PACKAGE_GAIA)
160 MOZ_ARG_WITH_STRING(gonk,
161 [  --with-gonk=DIR
162                location of gonk dir],
163     gonkdir=$withval)
165 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
166 [  --with-gonk-toolchain-prefix=DIR
167                           prefix to gonk toolchain commands],
168     gonk_toolchain_prefix=$withval)
170 if test -n "$gonkdir" ; then
171     kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
172     android_source="$gonkdir"
173     ANDROID_SOURCE="$android_source"
174     ANDROID_NDK="${ANDROID_SOURCE}/ndk"
175     dnl Default to ICS
176     ANDROID_VERSION=15
177     if test -n "${PLATFORM_SDK_VERSION}"; then
178         ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
179     fi
181     dnl set up compilers
182     TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
183     AS="$gonk_toolchain_prefix"as
184     CC="$gonk_toolchain_prefix"gcc
185     CXX="$gonk_toolchain_prefix"g++
186     CPP="$gonk_toolchain_prefix"cpp
187     LD="$gonk_toolchain_prefix"ld
188     AR="$gonk_toolchain_prefix"ar
189     RANLIB="$gonk_toolchain_prefix"ranlib
190     STRIP="$gonk_toolchain_prefix"strip
191     OBJCOPY="$gonk_toolchain_prefix"objcopy
193     STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/ -I$gonkdir/external/stlport/stlport/"
194     STLPORT_LIBS="-lstlport"
196     case "$target_cpu" in
197     arm)
198         ARCH_DIR=arch-arm
199         ;;
200     i?86)
201         ARCH_DIR=arch-x86
202         ;;
203     esac
205     case "$ANDROID_VERSION" in
206     15)
207         GONK_INCLUDES="-I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/frameworks/base/include -I$gonkdir/frameworks/base/services/camera -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib -I$gonkdir/dalvik/libnativehelper/include/nativehelper -I$gonkdir/external/valgrind"
208         MOZ_B2G_BT=1
209         MOZ_B2G_CAMERA=1
210         MOZ_OMX_DECODER=1
211         AC_DEFINE(MOZ_OMX_DECODER)
212         AC_SUBST(MOZ_OMX_DECODER)
213         ;;
214     17)
215         GONK_INCLUDES="-I$gonkdir/frameworks/native/include"
216         ;;
217     *)
218         AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
219         ;;
220     esac
221     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/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/hardware/libhardware/include $GONK_INCLUDES $CPPFLAGS"
222     CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
223     CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
224     dnl Add -llog by default, since we use it all over the place.
225     LIBS="$LIBS -llog $STLPORT_LIBS"
227     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"
229     dnl prevent cross compile section from using these flags as host flags
230     if test -z "$HOST_CPPFLAGS" ; then
231         HOST_CPPFLAGS=" "
232     fi
233     if test -z "$HOST_CFLAGS" ; then
234         HOST_CFLAGS=" "
235     fi
236     if test -z "$HOST_CXXFLAGS" ; then
237         HOST_CXXFLAGS=" "
238     fi
239     if test -z "$HOST_LDFLAGS" ; then
240         HOST_LDFLAGS=" "
241     fi
243     AC_DEFINE(ANDROID)
244     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
245     AC_SUBST(ANDROID_VERSION)
246     AC_DEFINE(HAVE_SYS_UIO_H)
247     AC_DEFINE(HAVE_PTHREADS)
248     CROSS_COMPILE=1
249     MOZ_CHROME_FILE_FORMAT=omni
250     direct_nspr_config=1
251 else
252     MOZ_ANDROID_NDK
254     case "$target" in
255     *-android*|*-linuxandroid*)
256         if test -z "$ANDROID_PACKAGE_NAME" ; then
257             ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
258         fi
259         MOZ_CHROME_FILE_FORMAT=omni
260         ZLIB_DIR=yes
261         ;;
262     *-linux*)
263         AC_PATH_PROG(OBJCOPY,objcopy)
264         ;;
265     esac
268 AC_SUBST(ANDROID_SOURCE)
269 AC_SUBST(ANDROID_PACKAGE_NAME)
270 AC_SUBST(OBJCOPY)
272 dnl ========================================================
273 dnl Checks for compilers.
274 dnl ========================================================
275 dnl Set CROSS_COMPILE in the environment when running configure
276 dnl to use the cross-compile setup for now
277 dnl ========================================================
279 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
280 AR_FLAGS='cr $@'
282 if test "$COMPILE_ENVIRONMENT"; then
284 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
285     echo "cross compiling from $host to $target"
286     cross_compiling=yes
288     _SAVE_CC="$CC"
289     _SAVE_CFLAGS="$CFLAGS"
290     _SAVE_LDFLAGS="$LDFLAGS"
292     AC_MSG_CHECKING([for host c compiler])
293     AC_CHECK_PROGS(HOST_CC, $HOST_CC cc gcc /usr/ucb/cc cl icc, "")
294     if test -z "$HOST_CC"; then
295         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
296     fi
297     AC_MSG_RESULT([$HOST_CC])
298     AC_MSG_CHECKING([for host c++ compiler])
299     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
300     if test -z "$HOST_CXX"; then
301         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
302     fi
303     AC_MSG_RESULT([$HOST_CXX])
305     if test -z "$HOST_CFLAGS"; then
306         HOST_CFLAGS="$CFLAGS"
307     fi
308     if test -z "$HOST_CXXFLAGS"; then
309         HOST_CXXFLAGS="$CXXFLAGS"
310     fi
311     if test -z "$HOST_LDFLAGS"; then
312         HOST_LDFLAGS="$LDFLAGS"
313     fi
314     if test -z "$HOST_AR_FLAGS"; then
315         HOST_AR_FLAGS="$AR_FLAGS"
316     fi
317     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
318     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
319     CC="$HOST_CC"
320     CFLAGS="$HOST_CFLAGS"
321     LDFLAGS="$HOST_LDFLAGS"
323     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
324     AC_TRY_COMPILE([], [return(0);],
325         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
326         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
328     CC="$HOST_CXX"
329     CFLAGS="$HOST_CXXFLAGS"
331     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
332     AC_TRY_COMPILE([], [return(0);],
333         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
334         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
336     CC=$_SAVE_CC
337     CFLAGS=$_SAVE_CFLAGS
338     LDFLAGS=$_SAVE_LDFLAGS
340     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
341     unset ac_cv_prog_CC
342     AC_PROG_CC
343     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
344     unset ac_cv_prog_CXX
345     AC_PROG_CXX
347     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
348     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
349     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
350     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
351     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
352     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
353     AC_DEFINE(CROSS_COMPILE)
354 else
355     AC_PROG_CC
356     case "$target" in
357     *-mingw*)
358       # Work around the conftest.exe access problem on Windows
359       sleep 2
360     esac
361     AC_PROG_CXX
362     AC_PROG_RANLIB
363     MOZ_PATH_PROGS(AS, $AS as, $CC)
364     AC_CHECK_PROGS(AR, ar, :)
365     AC_CHECK_PROGS(LD, ld, :)
366     AC_CHECK_PROGS(STRIP, strip, :)
367     AC_CHECK_PROGS(WINDRES, windres, :)
368     if test -z "$HOST_CC"; then
369         HOST_CC="$CC"
370     fi
371     if test -z "$HOST_CFLAGS"; then
372         HOST_CFLAGS="$CFLAGS"
373     fi
374     if test -z "$HOST_CXX"; then
375         HOST_CXX="$CXX"
376     fi
377     if test -z "$HOST_CXXFLAGS"; then
378         HOST_CXXFLAGS="$CXXFLAGS"
379     fi
380     if test -z "$HOST_LDFLAGS"; then
381         HOST_LDFLAGS="$LDFLAGS"
382     fi
383     if test -z "$HOST_RANLIB"; then
384         HOST_RANLIB="$RANLIB"
385     fi
386     if test -z "$HOST_AR"; then
387         HOST_AR="$AR"
388     fi
389     if test -z "$HOST_AR_FLAGS"; then
390         HOST_AR_FLAGS="$AR_FLAGS"
391     fi
394 if test -n "$MOZ_WINCONSOLE"; then
395     AC_DEFINE(MOZ_WINCONSOLE)
398 MOZ_TOOL_VARIABLES
400 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
401     if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
402        test "$GCC_MAJOR_VERSION" -lt 4; then
403         AC_MSG_ERROR([Only GCC 4.4 or newer supported])
404     fi
407 dnl ========================================================
408 dnl Special win32 checks
409 dnl ========================================================
411 MOZ_ARG_ENABLE_BOOL(metro,
412 [  --enable-metro           Enable Windows Metro build targets],
413     MOZ_METRO=1,
414     MOZ_METRO=)
415 if test -n "$MOZ_METRO"; then
416     AC_DEFINE(MOZ_METRO)
417     # Target the Windows 8 Kit
418     WINSDK_TARGETVER=602
419     WINVER=502
420     # toolkit/library/makefile.in needs these, see nsDllMain.
421     CRTDLLVERSION=110
422     CRTEXPDLLVERSION=1-1-0
423 else
424     # Target the Windows 7 SDK by default
425     WINSDK_TARGETVER=601
426     WINVER=502
429 AC_SUBST(CRTDLLVERSION)
430 AC_SUBST(CRTEXPDLLVERSION)
432 MOZ_ARG_WITH_STRING(windows-version,
433 [  --with-windows-version=WINSDK_TARGETVER
434                           Windows SDK version to target. Lowest version
435                           currently allowed is 601 (Win7), highest is 602 (Win8)],
436   WINSDK_TARGETVER=$withval)
438 # Currently only two sdk versions allowed, 601 and 602
439 case "$WINSDK_TARGETVER" in
440 601|602)
441     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
442     ;;
445     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
446     ;;
447 esac
449 case "$target" in
450 *-mingw*)
451     if test "$GCC" != "yes"; then
452         # Check to see if we are really running in a msvc environemnt
453         _WIN32_MSVC=1
454         AC_CHECK_PROGS(MIDL, midl)
456         # Make sure compilers are valid
457         CFLAGS="$CFLAGS -TC -nologo"
458         CXXFLAGS="$CXXFLAGS -TP -nologo"
459         AC_LANG_SAVE
460         AC_LANG_C
461         AC_TRY_COMPILE([#include <stdio.h>],
462             [ printf("Hello World\n"); ],,
463             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
465         AC_LANG_CPLUSPLUS
466         AC_TRY_COMPILE([#include <new.h>],
467             [ unsigned *test = new unsigned(42); ],,
468             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
469         AC_LANG_RESTORE
471         changequote(,)
472         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
473         changequote([,])
475         # Determine compiler version
476         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
477         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
478         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
479         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
480         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
481         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
483         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
484         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
486         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
487             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
488         fi
490         if test "$_CC_MAJOR_VERSION" = "16"; then
491             _CC_SUITE=10
492             _MSVS_VERSION=2010
493             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
494             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
495         elif test "$_CC_MAJOR_VERSION" = "17"; then
496             _CC_SUITE=11
497             _MSVS_VERSION=2012
498             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
499             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
500         else
501             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
502         fi
504         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
506         if test -n "$WIN32_REDIST_DIR"; then
507           if test ! -d "$WIN32_REDIST_DIR"; then
508             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
509           fi
510           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
511         fi
513         dnl Confirm we have the pri tools on win8 builds
514         if test -n "$MOZ_METRO"; then
515           AC_MSG_CHECKING([for makepri])
516           AC_CHECK_PROGS(MAKEPRI, makepri, "")
517           if test -z "MAKEPRI" ; then
518               AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
519           fi
520           AC_SUBST(MAKEPRI)
521         fi
523         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
524         dnl not something else like "magnetic tape manipulation utility".
525         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
526         if test -z "$MSMT_TOOL"; then
527           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
528         fi
530         changequote(,)
531         _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
532         changequote([,])
533         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
534         if test -z "$MSMANIFEST_TOOL_VERSION"; then
535           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
536         fi
538         MSMANIFEST_TOOL=1
539         unset MSMT_TOOL
541         # Check linker version
542         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
543         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
544         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
545             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
546         fi
548         INCREMENTAL_LINKER=1
550         # Check midl version
551         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
552         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
553         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
554         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
555         # Add flags if necessary
556         AC_MSG_CHECKING([for midl flags])
557         case "$target" in
558         i*86-*)
559             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
560                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
561                 # MIDL version 7.00.0500 or later has no problem.
562                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
563                 AC_MSG_RESULT([need -env win32])
564             else
565                 AC_MSG_RESULT([none needed])
566             fi
567             ;;
568         x86_64-*)
569             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
570             ;;
571         *)
572             AC_MSG_RESULT([none needed])
573             ;;
574         esac
576         # Identify which version of the SDK we're building with
577         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
578         # from there
579         MOZ_CHECK_HEADERS([winsdkver.h])
580         if test "$ac_cv_header_winsdkver_h" = "yes"; then
581             # Get the highest _WIN32_WINNT and NTDDI versions supported
582             # Take the higher of the two
583             # This is done because the Windows 7 beta SDK reports its
584             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
585             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
586                            ac_cv_winsdk_maxver,
587                            [cat > conftest.h <<EOF
588 #include <winsdkver.h>
589 #include <sdkddkver.h>
591 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
592 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
593 #else
594 #define WINSDK_MAXVER NTDDI_MAXVER
595 #endif
597 WINSDK_MAXVER
599                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
600                             rm -f conftest.h
601                            ])
602             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
603         else
604             # Any SDK which doesn't have WinSDKVer.h is too old.
605             AC_MSG_ERROR([Your SDK does not have WinSDKVer.h. It is probably too old. Please upgrade to a newer SDK or try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
606         fi
608         unset _MSVC_VER_FILTER
610         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
611             [
612                 AC_LANG_SAVE
613                 AC_LANG_CPLUSPLUS
614                 _SAVE_CXXFLAGS="$CXXFLAGS"
615                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
616                 AC_TRY_COMPILE([#include <exception>],
617                             [std::_Throw(std::exception()); return 0;],
618                             ac_cv_have_std__Throw="yes",
619                             ac_cv_have_std__Throw="no")
620                 CXXFLAGS="$_SAVE_CXXFLAGS"
621                 AC_LANG_RESTORE
622             ])
624         if test "$ac_cv_have_std__Throw" = "yes"; then
625             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
626                            ac_cv_have_dllimport_exception_bug,
627                 [
628                     AC_LANG_SAVE
629                     AC_LANG_CPLUSPLUS
630                     _SAVE_CXXFLAGS="$CXXFLAGS"
631                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
632                     AC_TRY_LINK([#include <vector>],
633                                 [std::vector<int> v; return v.at(1);],
634                                 ac_cv_have_dllimport_exception_bug="no",
635                                 ac_cv_have_dllimport_exception_bug="yes")
636                     CXXFLAGS="$_SAVE_CXXFLAGS"
637                     AC_LANG_RESTORE
638                 ])
639             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
640                 WRAP_STL_INCLUDES=1
641                 MOZ_MSVC_STL_WRAP__Throw=1
642                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
643             fi
644         else
645             AC_CACHE_CHECK(for overridable _RAISE,
646                            ac_cv_have__RAISE,
647                 [
648                     AC_LANG_SAVE
649                     AC_LANG_CPLUSPLUS
650                     _SAVE_CXXFLAGS="$CXXFLAGS"
651                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
652                     AC_TRY_COMPILE([#include <xstddef>
653                                     #undef _RAISE
654                                     #define _RAISE(x) externallyDefinedFunction((x).what())
655                                     #include <vector>
656                                    ],
657                                    [std::vector<int> v; return v.at(1);],
658                                    ac_cv_have__RAISE="no",
659                                    ac_cv_have__RAISE="yes")
660                     CXXFLAGS="$_SAVE_CXXFLAGS"
661                     AC_LANG_RESTORE
662                 ])
663             if test "$ac_cv_have__RAISE" = "yes"; then
664                 WRAP_STL_INCLUDES=1
665                 MOZ_MSVC_STL_WRAP__RAISE=1
666                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
667             else
668                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
669             fi
670         fi
672         if test "$WRAP_STL_INCLUDES" = "1"; then
673             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
674         fi
675     else
676         # Check w32api version
677         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
678         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
679         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
680         AC_TRY_COMPILE([#include <w32api.h>],
681             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
682                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
683                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
684                 #error "test failed."
685             #endif
686             , [ res=yes ], [ res=no ])
687         AC_MSG_RESULT([$res])
688         if test "$res" != "yes"; then
689             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
690         fi
691         # Check windres version
692         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
693         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
694         AC_MSG_RESULT([$_WINDRES_VERSION])
695         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
696         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
697         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
698         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
699         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
700         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
701         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
702                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
703                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
704                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
705                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
706                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
707         then
708             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
709         fi
711         AC_CHECK_PROGS(MIDL, $target-widl widl)
712         if test -n "$MIDL"; then
713             case "$target" in
714             i*86-*)
715                 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
716                 ;;
717             x86_64-*)
718                 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
719                 ;;
720             esac
721         fi
723         MOZ_WINSDK_MAXVER=0x06020000
724     fi # !GNU_CC
726     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
727     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
728     # Require OS features provided by IE 6.0 SP2 (XP SP2)
729     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
731     # If the maximum version supported by this SDK is lower than the target
732     # version, error out
733     AC_MSG_CHECKING([for Windows SDK being recent enough])
734     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
735         AC_MSG_RESULT("yes")
736     else
737         AC_MSG_RESULT("no")
738         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.])
739     fi
740     
741     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
742     # Definitions matching sdkddkver.h
743     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
744     ;;
745 esac
747 AC_PROG_CPP
748 AC_PROG_CXXCPP
750 if test -n "$_WIN32_MSVC"; then
751     SKIP_PATH_CHECKS=1
752     SKIP_COMPILER_CHECKS=1
753     SKIP_LIBRARY_CHECKS=1
755     # Since we're skipping compiler and library checks, hard-code
756     # some facts here.
757     AC_DEFINE(HAVE_IO_H)
758     AC_DEFINE(HAVE_SETBUF)
759     AC_DEFINE(HAVE_ISATTY)
762 fi # COMPILE_ENVIRONMENT
764 AC_SUBST(MIDL_FLAGS)
765 AC_SUBST(_MSC_VER)
767 AC_SUBST(GNU_AS)
768 AC_SUBST(GNU_LD)
769 AC_SUBST(GNU_CC)
770 AC_SUBST(GNU_CXX)
771 AC_SUBST(INTEL_CC)
772 AC_SUBST(INTEL_CXX)
774 AC_SUBST(STL_FLAGS)
775 AC_SUBST(WRAP_STL_INCLUDES)
776 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
777 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
779 dnl ========================================================
780 dnl Checks for programs.
781 dnl ========================================================
782 AC_PROG_INSTALL
783 AC_PROG_LN_S
785 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
786 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
787 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
788 _perl_res=$?
789 AC_MSG_RESULT([$_perl_version])
791 if test "$_perl_res" != 0; then
792     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
796 AC_MSG_CHECKING([for full perl installation])
797 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
798 _perl_res=$?
799 if test "$_perl_res" != 0; then
800     AC_MSG_RESULT([no])
801     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
802 else
803     AC_MSG_RESULT([yes])
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
809          MOZ_SYSTEM_PLY=1
810      else
811          AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
812      fi])
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, :)
837 AC_SUBST(RPMBUILD)
839 if test "$COMPILE_ENVIRONMENT"; then
841 dnl ========================================================
842 dnl = Mac OS X toolchain support
843 dnl ========================================================
845 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
846 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
847 dnl when we can run target binaries.
848 AC_SUBST(UNIVERSAL_BINARY)
849 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
851 MOZ_ARG_WITH_STRING(unify-dist,
852 [  --with-unify-dist=dir   Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
853     UNIFY_DIST=$withval)
854 if test -n "$UNIVERSAL_BINARY"; then
855     if test -z "$UNIFY_DIST"; then
856         AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
857     fi
858     case "$UNIFY_DIST" in
859     /*)
860         ;;
861     *)
862         UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
863         ;;
864     esac
866 AC_SUBST(UNIFY_DIST)
868 dnl ========================================================
869 dnl Check for MacOS deployment target version
870 dnl ========================================================
872 MOZ_ARG_ENABLE_STRING(macos-target,
873                       [  --enable-macos-target=VER (default=10.6)
874                           Set the minimum MacOS version needed at runtime],
875                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
877 case "$target" in
878 *-darwin*)
879     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
880         dnl Use the specified value
881         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
882     else
883         dnl No value specified on the command line or in the environment,
884         dnl use architecture minimum.
885         export MACOSX_DEPLOYMENT_TARGET=10.6
886     fi
887     ;;
888 esac
890 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
892 dnl ========================================================
893 dnl = Mac OS X SDK support
894 dnl ========================================================
895 MACOS_SDK_DIR=
896 NEXT_ROOT=
897 MOZ_ARG_WITH_STRING(macos-sdk,
898 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
899     MACOS_SDK_DIR=$withval)
901 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
902 dnl NEXT_ROOT will be set and exported only if it's needed.
903 AC_SUBST(MACOS_SDK_DIR)
904 AC_SUBST(NEXT_ROOT)
906 if test "$MACOS_SDK_DIR"; then
907   dnl Sync this section with the ones in NSPR and NSS.
908   dnl Changes to the cross environment here need to be accounted for in
909   dnl the libIDL checks (below) and xpidl build.
911   if test ! -d "$MACOS_SDK_DIR"; then
912     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
913 specify a valid SDK.  SDKs are installed when the optional cross-development
914 tools are selected during the Xcode/Developer Tools installation.])
915   fi
917   CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
918   CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
920   dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
921   CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
922   CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
924   AC_LANG_SAVE
925   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
926   AC_LANG_CPLUSPLUS
927   AC_TRY_COMPILE([#include <new>],[],
928    result=yes,
929    result=no)
930   AC_LANG_RESTORE
931   AC_MSG_RESULT($result)
933   if test "$result" = "no" ; then
934     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
935   fi
938 fi # COMPILE_ENVIRONMENT
940 AC_MSG_CHECKING([compiler version])
941 # Just print it so it shows up in the logs.
942 cc_version=$($CC --version)
943 AC_MSG_RESULT([$cc_version])
945 if test -n "$MAKE"; then
946   if test `echo $MAKE | grep -c make.py` != 1; then
947      NOT_PYMAKE=$MAKE
948   fi
951 case "$host_os" in
952 mingw*)
953     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
954     ;;
956     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
957     ;;
958 esac
959 if test "$GMAKE" = ":"; then
960    AC_MSG_ERROR([GNU make not found])
962 AC_SUBST(GMAKE)
964 if test -z "$MAKE"; then
965   MAKE=$GMAKE
968 if test "$COMPILE_ENVIRONMENT"; then
970 AC_PATH_XTRA
972 XCFLAGS="$X_CFLAGS"
974 fi # COMPILE_ENVIRONMENT
976 dnl ========================================================
977 dnl set the defaults first
978 dnl ========================================================
979 AS_BIN=$AS
980 AR_LIST='$(AR) t'
981 AR_EXTRACT='$(AR) x'
982 AR_DELETE='$(AR) d'
983 AS='$(CC)'
984 AS_DASH_C_FLAG='-c'
985 DLL_PREFIX=lib
986 LIB_PREFIX=lib
987 DLL_SUFFIX=.so
988 OBJ_SUFFIX=o
989 LIB_SUFFIX=a
990 ASM_SUFFIX=s
991 IMPORT_LIB_SUFFIX=
992 TARGET_MD_ARCH=unix
993 DIRENT_INO=d_ino
994 MOZ_USER_DIR=".mozilla"
996 MOZ_JPEG_CFLAGS=
997 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
998 MOZ_BZ2_CFLAGS=
999 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1000 MOZ_PNG_CFLAGS=
1001 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
1003 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1004 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1005 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxul -lxpcom_core -lmozalloc'
1006 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1007 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxul -lmozalloc'
1008 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)'
1009 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1010 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1012 # These are specially defined on Windows only
1013 case "$target" in
1014 *-mingw*)
1015   XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1016   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
1017   ;;
1019   XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
1020   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
1021   ;;
1022 esac
1024 MOZ_FS_LAYOUT=unix
1026 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1028 USE_DEPENDENT_LIBS=1
1030 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1032 if test -n "$CROSS_COMPILE"; then
1033     OS_TARGET="${target_os}"
1034     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1035     OS_RELEASE=
1036     case "${target_os}" in
1037         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1038         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1039         gnu*)         OS_ARCH=GNU ;;
1040         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1041         mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
1042         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1043     esac
1044     case "${target}" in
1045         *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1046     esac
1047 else
1048     OS_TARGET=`uname -s`
1049     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1050     OS_RELEASE=`uname -r`
1053 # Before this used `uname -m` when not cross compiling
1054 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1055 OS_TEST="${target_cpu}"
1057 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1059 #######################################################################
1060 # Master "Core Components" macros for getting the OS target           #
1061 #######################################################################
1064 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1065 # cross-compilation.
1069 # Define and override various archtecture-specific variables, including
1070 # HOST_OS_ARCH
1071 # OS_ARCH
1072 # OS_TEST
1073 # OS_TARGET
1074 # OS_RELEASE
1075 # OS_MINOR_RELEASE
1078 case "$HOST_OS_ARCH" in
1079 mingw*)
1080     HOST_OS_ARCH=WINNT
1081     ;;
1082 darwin*)
1083     HOST_OS_ARCH=Darwin
1084     ;;
1085 linux*)
1086     HOST_OS_ARCH=Linux
1087     ;;
1088 solaris*)
1089     HOST_OS_ARCH=SunOS
1090     SOLARIS_SUNPRO_CC=
1091     SOLARIS_SUNPRO_CXX=
1092     if test -z "$GNU_CC"; then
1093         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1094             SOLARIS_SUNPRO_CC=1
1095        fi
1096     fi
1098     if test -z "$GNU_CXX"; then
1099        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1100            SOLARIS_SUNPRO_CXX=1
1101        fi
1102     fi
1103     AC_SUBST(SOLARIS_SUNPRO_CC)
1104     AC_SUBST(SOLARIS_SUNPRO_CXX)
1105     ;;
1106 OS_2)
1107     HOST_OS_ARCH=OS2
1108     ;;
1109 esac
1111 case "$OS_ARCH" in
1112 WINNT)
1113     if test -z "$CROSS_COMPILE" ; then
1114         OS_TEST=`uname -p`
1115     fi
1116     ;;
1117 Windows_NT)
1119 # If uname -s returns "Windows_NT", we assume that we are using
1120 # the uname.exe in MKS toolkit.
1122 # The -r option of MKS uname only returns the major version number.
1123 # So we need to use its -v option to get the minor version number.
1124 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1126     OS_ARCH=WINNT
1127     OS_TARGET=WINNT
1128     OS_MINOR_RELEASE=`uname -v`
1129     if test "$OS_MINOR_RELEASE" = "00"; then
1130         OS_MINOR_RELEASE=0
1131     fi
1132     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1133     ;;
1134 MINGW*_NT*)
1136 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1137 # the uname.exe in the MSYS tools.
1139     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1140     OS_ARCH=WINNT
1141     OS_TARGET=WINNT
1142     ;;
1143 AIX)
1144     OS_RELEASE=`uname -v`.`uname -r`
1145     OS_TEST=${target_cpu}
1146     ;;
1147 OS_2)
1148     OS_ARCH=OS2
1149     OS_TARGET=OS2
1150     OS_RELEASE=`uname -v`
1151     ;;
1152 Darwin)
1153     case "${target_cpu}" in
1154     powerpc*)
1155         OS_TEST=ppc
1156         ;;
1157     i*86*)
1158         OS_TEST=i386
1159         ;;
1160     x86_64)
1161         OS_TEST=x86_64
1162         ;;
1163     *)
1164         if test -z "$CROSS_COMPILE" ; then
1165             OS_TEST=`uname -p`
1166         fi
1167         ;;
1168     esac
1169     ;;
1170 esac
1172 # Only set CPU_ARCH if we recognize the value of OS_TEST
1174 case "$OS_TEST" in
1175 *86 | i86pc)
1176     CPU_ARCH=x86
1177     ;;
1179 powerpc64 | ppc64)
1180     CPU_ARCH=ppc64
1181     ;;
1183 powerpc | ppc | rs6000)
1184     CPU_ARCH=ppc
1185     ;;
1187 Alpha | alpha | ALPHA)
1188     CPU_ARCH=Alpha
1189     ;;
1191 s390)
1192     CPU_ARCH=s390
1193     ;;
1195 s390x)
1196     CPU_ARCH=s390x
1197     ;;
1199 hppa* | parisc)
1200     CPU_ARCH=hppa
1201     ;;
1203 sun4u | sparc*)
1204     CPU_ARCH=sparc
1205     ;;
1207 x86_64 | ia64)
1208     CPU_ARCH="$OS_TEST"
1209     ;;
1211 arm*)
1212     CPU_ARCH=arm
1213     ;;
1215 mips|mipsel)
1216     CPU_ARCH="mips"
1217     ;;
1218 esac
1220 if test -z "$OS_TARGET"; then
1221     OS_TARGET=$OS_ARCH
1223 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1225 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1226 dnl ===============================================================
1227 INTEL_ARCHITECTURE=
1228 case "$OS_TEST" in
1229     x86_64|i?86)
1230       INTEL_ARCHITECTURE=1
1231 esac
1233 dnl Configure platform-specific CPU architecture compiler options.
1234 dnl ==============================================================
1235 MOZ_ARCH_OPTS
1237 dnl =================================================================
1238 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1239 dnl which is bad when cross compiling.
1240 dnl =================================================================
1241 if test "$COMPILE_ENVIRONMENT"; then
1242 configure_static_assert_macros='
1243 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1244 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1245 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1248 dnl test that the macros actually work:
1249 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1250 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1251  [AC_LANG_SAVE
1252   AC_LANG_C
1253   ac_cv_static_assertion_macros_work="yes"
1254   AC_TRY_COMPILE([$configure_static_assert_macros],
1255                  [CONFIGURE_STATIC_ASSERT(1)],
1256                  ,
1257                  ac_cv_static_assertion_macros_work="no")
1258   AC_TRY_COMPILE([$configure_static_assert_macros],
1259                  [CONFIGURE_STATIC_ASSERT(0)],
1260                  ac_cv_static_assertion_macros_work="no",
1261                  )
1262   AC_LANG_CPLUSPLUS
1263   AC_TRY_COMPILE([$configure_static_assert_macros],
1264                  [CONFIGURE_STATIC_ASSERT(1)],
1265                  ,
1266                  ac_cv_static_assertion_macros_work="no")
1267   AC_TRY_COMPILE([$configure_static_assert_macros],
1268                  [CONFIGURE_STATIC_ASSERT(0)],
1269                  ac_cv_static_assertion_macros_work="no",
1270                  )
1271   AC_LANG_RESTORE
1272  ])
1273 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1274 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1275     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1277 fi # COMPILE_ENVIRONMENT
1279 dnl ========================================================
1280 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1281 dnl computed above.
1282 dnl ========================================================
1284 MOZ_ANDROID_STLPORT
1286 dnl ========================================================
1287 dnl Suppress Clang Argument Warnings
1288 dnl ========================================================
1289 if test -n "$CLANG_CC"; then
1290     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1291     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1293 if test -n "$CLANG_CXX"; then
1294     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1297 dnl ========================================================
1298 dnl = Use Address Sanitizer
1299 dnl ========================================================
1300 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1301 [  --enable-address-sanitizer       Enable Address Sanitizer (default=no)],
1302     MOZ_ASAN=1,
1303     MOZ_ASAN= )
1304 if test -n "$MOZ_ASAN"; then
1305     MOZ_LLVM_HACKS=1
1306     AC_DEFINE(MOZ_ASAN)
1308 AC_SUBST(MOZ_ASAN)
1310 dnl ========================================================
1311 dnl = Enable hacks required for LLVM instrumentations
1312 dnl ========================================================
1313 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1314 [  --enable-llvm-hacks       Enable workarounds required for several LLVM instrumentations (default=no)],
1315     MOZ_LLVM_HACKS=1,
1316     MOZ_LLVM_HACKS= )
1317 if test -n "$MOZ_LLVM_HACKS"; then
1318     MOZ_NO_WLZDEFS=1
1319     MOZ_CFLAGS_NSS=1
1321 AC_SUBST(MOZ_NO_WLZDEFS)
1322 AC_SUBST(MOZ_CFLAGS_NSS)
1324 dnl ========================================================
1325 dnl GNU specific defaults
1326 dnl ========================================================
1327 if test "$GNU_CC"; then
1328     # Per bug 719659 comment 2, some of the headers on ancient build machines
1329     # may require gnu89 inline semantics.  But otherwise, we use C99.
1330     CFLAGS="$CFLAGS -std=gnu99 -fgnu89-inline"
1331     # FIXME: Let us build with strict aliasing. bug 414641.
1332     CFLAGS="$CFLAGS -fno-strict-aliasing"
1333     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1334     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1335     DSO_LDOPTS='-shared'
1336     if test "$GCC_USE_GNU_LD"; then
1337         # Some tools like ASan use a runtime library that is only
1338         # linked against executables, so we must allow undefined
1339         # symbols for shared objects in some cases.
1340         if test -z "$MOZ_NO_WLZDEFS"; then
1341             # Don't allow undefined symbols in libraries
1342             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1343         fi
1344     fi
1345     WARNINGS_AS_ERRORS='-Werror'
1346     # Don't treat -Wuninitialized as error b/c it has lots of false positives.
1347     WARNINGS_AS_ERRORS="$WARNINGS_AS_ERRORS -Wno-error=uninitialized"
1348     # Don't treat -Wdeprecated-declarations as error b/c we don't want our
1349     # builds held hostage when a platform-specific API is suddenly deprecated.
1350     WARNINGS_AS_ERRORS="$WARNINGS_AS_ERRORS -Wno-error=deprecated-declarations"
1351     DSO_CFLAGS=''
1352     DSO_PIC_CFLAGS='-fPIC'
1353     ASFLAGS="$ASFLAGS -fPIC"
1354     AC_MSG_CHECKING([for --noexecstack option to as])
1355     _SAVE_CFLAGS=$CFLAGS
1356     CFLAGS="$CFLAGS -Wa,--noexecstack"
1357     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1358                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1359                      AC_MSG_RESULT([no]))
1360     CFLAGS=$_SAVE_CFLAGS
1361     AC_MSG_CHECKING([for -z noexecstack option to ld])
1362     _SAVE_LDFLAGS=$LDFLAGS
1363     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1364     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1365                   AC_MSG_RESULT([no])
1366                   LDFLAGS=$_SAVE_LDFLAGS)
1367     AC_MSG_CHECKING([for --build-id option to ld])
1368     _SAVE_LDFLAGS=$LDFLAGS
1369     LDFLAGS="$LDFLAGS -Wl,--build-id"
1370     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1371                   [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1372                   AC_MSG_RESULT([no])
1373                   LDFLAGS=$_SAVE_LDFLAGS)
1376     # Check for -mssse3 on $CC
1377     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1378     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1379     _SAVE_CFLAGS=$CFLAGS
1380     CFLAGS="$CFLAGS -mssse3"
1381     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1382                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1383                      AC_MSG_RESULT([no]))
1384     CFLAGS=$_SAVE_CFLAGS
1385     AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
1387     # Check for -msse4.1 on $CC
1388     AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1389     HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1390     _SAVE_CFLAGS=$CFLAGS
1391     CFLAGS="$CFLAGS -msse4.1"
1392     AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1393                      [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1394                      AC_MSG_RESULT([no]))
1395     CFLAGS=$_SAVE_CFLAGS
1396     AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
1398     # Turn on GNU-specific warnings:
1399     # -Wall - turn on a lot of warnings
1400     # -Wpointer-arith - good to have
1401     # -Wdeclaration-after-statement - MSVC doesn't like these
1402     # -Werror=return-type - catches missing returns, zero false positives
1403     # -Wtype-limits - catches overflow bugs, few false positives
1404     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1405     # -Wsign-compare - catches comparison of signed and unsigned types
1406     #
1407     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1408     MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1409     MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1410     MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1411     MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1413     # Turn off the following warnings that -Wall turns on:
1414     # -Wno-unused - lots of violations in third-party code
1415     #
1416     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1418     if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1419        # Don't use -Wcast-align with ICC or clang
1420        case "$CPU_ARCH" in
1421            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1422            hppa | ia64 | sparc | arm)
1423            ;;
1424            *)
1425         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1426            ;;
1427        esac
1428     fi
1430     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1431     _USE_CPP_INCLUDE_FLAG=1
1432     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1434 elif test "$SOLARIS_SUNPRO_CC"; then
1435     DSO_CFLAGS=''
1436     if test "$CPU_ARCH" = "sparc"; then
1437         # for Sun Studio on Solaris/SPARC
1438         DSO_PIC_CFLAGS='-xcode=pic32'
1439     else
1440         DSO_PIC_CFLAGS='-KPIC'
1441     fi
1442     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1443 else
1444     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1445     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1447     DSO_LDOPTS='-shared'
1448     if test "$GNU_LD"; then
1449         # Don't allow undefined symbols in libraries
1450         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1451     fi
1453     DSO_CFLAGS=''
1454     DSO_PIC_CFLAGS='-KPIC'
1455     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1458 if test "$GNU_CXX"; then
1459     # FIXME: Let us build with strict aliasing. bug 414641.
1460     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1462     # Turn on GNU-specific warnings:
1463     # -Wall - turn on a lot of warnings
1464     # -Wpointer-arith - good to have
1465     # -Woverloaded-virtual - ???
1466     # -Werror=return-type - catches missing returns, zero false positives
1467     # -Wtype-limits - catches overflow bugs, few false positives
1468     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1469     # -Wsign-compare - catches comparison of signed and unsigned types
1470     #
1471     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1472     MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1473     MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1474     MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1475     MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1477     # Turn off the following warnings that -Wall turns on:
1478     # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1479     #
1480     MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1482     if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1483        # Don't use -Wcast-align with ICC or clang
1484        case "$CPU_ARCH" in
1485            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1486            hppa | ia64 | sparc | arm)
1487            ;;
1488            *)
1489         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1490            ;;
1491        esac
1492     fi
1494     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1495     _USE_CPP_INCLUDE_FLAG=1
1497     # Recent clang and gcc support C++11 deleted functions without warnings if
1498     # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1499     # versions).  We can't use -std=c++0x yet, so gcc's support must remain
1500     # unused.  But clang's warning can be disabled, so when compiling with clang
1501     # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1502     # deleted function syntax.
1503     if test "$CLANG_CXX"; then
1504         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1505         MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1506     fi
1508 else
1509     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1512 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1513 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1514 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1515 dnl normal behavior.
1516 dnl ========================================================
1517 MKSHLIB_FORCE_ALL=
1518 MKSHLIB_UNFORCE_ALL=
1520 if test "$COMPILE_ENVIRONMENT"; then
1521 if test "$GNU_CC"; then
1522   AC_MSG_CHECKING(whether ld has archive extraction flags)
1523   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1524    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1525     ac_cv_mkshlib_force_and_unforce="no"
1526     exec 3<&0 <<LOOP_INPUT
1527         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1528         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1529         force="-Wl,-all";              unforce="-Wl,-none"
1530 LOOP_INPUT
1531     while read line
1532     do
1533       eval $line
1534       LDFLAGS=$force
1535       LIBS=$unforce
1536       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1537     done
1538     exec 0<&3 3<&-
1539     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1540    ])
1541   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1542     AC_MSG_RESULT(no)
1543   else
1544     AC_MSG_RESULT(yes)
1545     eval $ac_cv_mkshlib_force_and_unforce
1546     MKSHLIB_FORCE_ALL=$force
1547     MKSHLIB_UNFORCE_ALL=$unforce
1548   fi
1549 fi # GNU_CC
1550 fi # COMPILE_ENVIRONMENT
1552 dnl ========================================================
1553 dnl Checking for 64-bit OS
1554 dnl ========================================================
1555 if test "$COMPILE_ENVIRONMENT"; then
1556 AC_LANG_SAVE
1557 AC_LANG_C
1558 AC_MSG_CHECKING(for 64-bit OS)
1559 AC_TRY_COMPILE([$configure_static_assert_macros],
1560                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1561                result="yes", result="no")
1562 AC_MSG_RESULT("$result")
1563 if test "$result" = "yes"; then
1564     AC_DEFINE(HAVE_64BIT_OS)
1565     HAVE_64BIT_OS=1
1567 AC_SUBST(HAVE_64BIT_OS)
1568 AC_LANG_RESTORE
1569 fi # COMPILE_ENVIRONMENT
1571 dnl ========================================================
1572 dnl Enable high-memory support on OS/2 by default.
1573 dnl ========================================================
1574 MOZ_OS2_HIGH_MEMORY=1
1575 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1576 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1577     MOZ_OS2_HIGH_MEMORY=,
1578     MOZ_OS2_HIGH_MEMORY=1 )
1579 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1581 dnl ========================================================
1582 dnl = Use profiling compile flags
1583 dnl ========================================================
1584 MOZ_ARG_ENABLE_BOOL(profiling,
1585 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1586     MOZ_PROFILING=1,
1587     MOZ_PROFILING= )
1589 # For profiling builds keep the symbol information
1590 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1591     case "$OS_TARGET" in
1592     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1593         STRIP_FLAGS="--strip-debug"
1594         ;;
1595     esac
1598 dnl ========================================================
1599 dnl = Use incremental GC
1600 dnl ========================================================
1601 JSGC_INCREMENTAL=1
1602 MOZ_ARG_DISABLE_BOOL(gcincremental,
1603 [  --disable-gcincremental Disable incremental GC],
1604     JSGC_INCREMENTAL= )
1605 if test -n "$JSGC_INCREMENTAL"; then
1606     AC_DEFINE(JSGC_INCREMENTAL)
1609 dnl ========================================================
1610 dnl = Use generational GC
1611 dnl ========================================================
1612 MOZ_ARG_ENABLE_BOOL(gcgenerational,
1613 [  --enable-gcgenerational Enable generational GC],
1614     JSGC_GENERATIONAL=1,
1615     JSGC_GENERATIONAL= )
1616 if test -n "$JSGC_GENERATIONAL"; then
1617     AC_DEFINE(JSGC_GENERATIONAL)
1620 dnl ========================================================
1621 dnl = Perform moving GC stack rooting analysis
1622 dnl ========================================================
1623 MOZ_ARG_ENABLE_BOOL(root-analysis,
1624 [  --enable-root-analysis  Enable moving GC stack root analysis],
1625     JSGC_ROOT_ANALYSIS=1,
1626     JSGC_ROOT_ANALYSIS= )
1627 if test -n "$JSGC_ROOT_ANALYSIS"; then
1628     AC_DEFINE(JSGC_ROOT_ANALYSIS)
1631 dnl ========================================================
1632 dnl = Use exact stack rooting for GC
1633 dnl ========================================================
1634 MOZ_ARG_ENABLE_BOOL(exact-rooting,
1635 [  --enable-exact-rooting  Enable use of exact stack roots for GC],
1636     JSGC_USE_EXACT_ROOTING=1,
1637     JSGC_USE_EXACT_ROOTING= )
1638 if test -n "$JSGC_USE_EXACT_ROOTING"; then
1639     AC_DEFINE(JSGC_USE_EXACT_ROOTING)
1642 dnl ========================================================
1643 dnl = Use Valgrind
1644 dnl ========================================================
1645 MOZ_ARG_ENABLE_BOOL(valgrind,
1646 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
1647     MOZ_VALGRIND=1,
1648     MOZ_VALGRIND= )
1649 if test -n "$MOZ_VALGRIND"; then
1650     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1651         AC_MSG_ERROR(
1652             [--enable-valgrind specified but Valgrind is not installed]))
1653     AC_DEFINE(MOZ_VALGRIND)
1655 AC_SUBST(MOZ_VALGRIND)
1657 dnl ========================================================
1658 dnl jprof
1659 dnl ========================================================
1660 MOZ_ARG_ENABLE_BOOL(jprof,
1661 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1662     MOZ_JPROF=1,
1663     MOZ_JPROF= )
1664 if test -n "$MOZ_JPROF"; then
1665     MOZ_PROFILING=1
1666     AC_DEFINE(MOZ_JPROF)
1669 dnl ========================================================
1670 dnl SPS Profiler
1671 dnl ========================================================
1672 MOZ_ENABLE_PROFILER_SPS=1
1674 case "${OS_TARGET}" in
1675 Android)
1676     case "${CPU_ARCH}" in
1677     x86 | arm) ;;
1678     *)
1679         MOZ_ENABLE_PROFILER_SPS=
1680     esac
1681     ;;
1682 Linux)
1683     case "${CPU_ARCH}" in
1684     x86 | x86_64) ;;
1685     *)
1686         MOZ_ENABLE_PROFILER_SPS=
1687     esac
1688     ;;
1689 WINNT|Darwin) ;;
1691     MOZ_ENABLE_PROFILER_SPS=
1692     ;;
1693 esac
1695 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1696     AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1699 dnl ========================================================
1700 dnl shark
1701 dnl ========================================================
1702 MOZ_ARG_ENABLE_BOOL(shark,
1703 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
1704     MOZ_SHARK=1,
1705     MOZ_SHARK= )
1706 if test -n "$MOZ_SHARK"; then
1707     MOZ_PROFILING=1
1708     AC_DEFINE(MOZ_SHARK)
1711 dnl ========================================================
1712 dnl instruments
1713 dnl ========================================================
1714 MOZ_ARG_ENABLE_BOOL(instruments,
1715 [  --enable-instruments    Enable instruments remote profiling. Implies --enable-profiling.],
1716     MOZ_INSTRUMENTS=1,
1717     MOZ_INSTRUMENTS= )
1718 if test -n "$MOZ_INSTRUMENTS"; then
1719     MOZ_PROFILING=1
1720     AC_DEFINE(MOZ_INSTRUMENTS)
1723 dnl ========================================================
1724 dnl callgrind
1725 dnl ========================================================
1726 MOZ_ARG_ENABLE_BOOL(callgrind,
1727 [  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
1728     MOZ_CALLGRIND=1,
1729     MOZ_CALLGRIND= )
1730 if test -n "$MOZ_CALLGRIND"; then
1731     MOZ_PROFILING=1
1732     AC_DEFINE(MOZ_CALLGRIND)
1735 dnl ========================================================
1736 dnl vtune
1737 dnl ========================================================
1738 MOZ_ARG_ENABLE_BOOL(vtune,
1739 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
1740     MOZ_VTUNE=1,
1741     MOZ_VTUNE= )
1742 if test -n "$MOZ_VTUNE"; then
1743     MOZ_PROFILING=1
1744     AC_DEFINE(MOZ_VTUNE)
1747 dnl ========================================================
1748 dnl Profiling
1749 dnl ========================================================
1750 if test -n "$MOZ_PROFILING"; then
1751     AC_DEFINE(MOZ_PROFILING)
1754 dnl ========================================================
1755 dnl System overrides of the defaults for host
1756 dnl ========================================================
1757 case "$host" in
1758 *mingw*)
1759     if test -n "$_WIN32_MSVC"; then
1760         HOST_AR=lib
1761         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1762         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1763         HOST_RANLIB='echo ranlib'
1764     else
1765         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1766     fi
1767     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1768     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1769     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1770     HOST_BIN_SUFFIX=.exe
1771     case "$host" in
1772     *mingw*)
1773         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1774         ;;
1775     esac
1777     case "${host_cpu}" in
1778     i*86)
1779         if test -n "$_WIN32_MSVC"; then
1780             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1781         fi
1782         ;;
1783     x86_64)
1784         if test -n "$_WIN32_MSVC"; then
1785             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1786         fi
1787         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1788         ;;
1789     esac
1790     ;;
1792 *-darwin*)
1793     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1794     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1795     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1796     ;;
1798 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1799     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1800     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1801     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1802     ;;
1804 *os2*)
1805     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1806     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1807     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1808     HOST_BIN_SUFFIX=.exe
1809     MOZ_FIX_LINK_PATHS=
1810     ;;
1813     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1814     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1815     ;;
1816 esac
1818 dnl Check for using a custom <stdint.h> implementation
1819 dnl ========================================================
1820 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1821 if test "$MOZ_CUSTOM_STDINT_H"; then
1822   AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1823   AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1824 else
1825   AC_MSG_RESULT(none specified)
1828 dnl Get mozilla version from central milestone file
1829 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1830 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1832 dnl Get version of various core apps from the version files.
1833 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1835 if test -z "$FIREFOX_VERSION"; then
1836     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1839 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1840 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1841 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1843 MOZ_DOING_LTO(lto_is_enabled)
1845 dnl ========================================================
1846 dnl System overrides of the defaults for target
1847 dnl ========================================================
1849 case "$target" in
1850 *-aix*)
1851     AC_DEFINE(AIX)
1852     if test ! "$GNU_CC"; then
1853         if test ! "$HAVE_64BIT_OS"; then
1854             # Compiling with Visual Age C++ object model compat is the
1855             # default. To compile with object model ibm, add
1856             # AIX_OBJMODEL=ibm to .mozconfig.
1857             if test "$AIX_OBJMODEL" = "ibm"; then
1858                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1859             else
1860                 AIX_OBJMODEL=compat
1861             fi
1862         else
1863             AIX_OBJMODEL=compat
1864         fi
1865         AC_SUBST(AIX_OBJMODEL)
1866         DSO_LDOPTS='-qmkshrobj=1'
1867         DSO_CFLAGS='-qflag=w:w'
1868         DSO_PIC_CFLAGS=
1869         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1870         MOZ_FIX_LINK_PATHS=
1871         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1872         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1873         if test "$COMPILE_ENVIRONMENT"; then
1874             AC_LANG_SAVE
1875             AC_LANG_CPLUSPLUS
1876             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1877             AC_TRY_COMPILE([],
1878                 [#if (__IBMCPP__ < 900)
1879                  #error "Bad compiler"
1880                  #endif],
1881                 _BAD_COMPILER=,_BAD_COMPILER=1)
1882             if test -n "$_BAD_COMPILER"; then
1883                 AC_MSG_RESULT([no])
1884                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1885             else
1886                 AC_MSG_RESULT([yes])
1887             fi
1888             AC_LANG_RESTORE
1889             TARGET_COMPILER_ABI="ibmc"
1890             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1891             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1892         fi
1893     fi
1894     case "${target_os}" in
1895     aix4.1*)
1896         DLL_SUFFIX='_shr.a'
1897         ;;
1898     esac
1899     if test "$COMPILE_ENVIRONMENT"; then
1900         MOZ_CHECK_HEADERS(sys/inttypes.h)
1901     fi
1902     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1903     ;;
1905 *-darwin*)
1906     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1907     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1908     MOZ_OPTIMIZE_FLAGS="-O3"
1909     # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
1910     if test "$HAVE_64BIT_OS"; then
1911         MOZ_MEMORY=1
1912     fi
1913     DLL_SUFFIX=".dylib"
1914     DSO_LDOPTS=''
1915     STRIP_FLAGS="$STRIP_FLAGS -x -S"
1916     # Check whether we're targeting OS X or iOS
1917     AC_CACHE_CHECK(for iOS target,
1918                    ac_cv_ios_target,
1919                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
1920 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1921 #error not iOS
1922 #endif],
1923                                    [],
1924                                    ac_cv_ios_target="yes",
1925                                    ac_cv_ios_target="no")])
1926     if test "$ac_cv_ios_target" = "yes"; then
1927         AC_DEFINE(XP_IOS)
1928         AC_DEFINE(XP_DARWIN)
1929         _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1930     else
1931         AC_DEFINE(XP_MACOSX)
1932         AC_DEFINE(XP_DARWIN)
1933         _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1934         # The ExceptionHandling framework is needed for Objective-C exception
1935         # logging code in nsObjCExceptions.h. Currently we only use that in debug
1936         # builds.
1937         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1938     fi
1939     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1942     if test "x$lto_is_enabled" = "xyes"; then
1943         echo "Skipping -dead_strip because lto is enabled."
1944     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1945     dnl ===================================================================
1946     elif test "x$enable_dtrace" = "xyes"; then
1947         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1948     else
1949         dnl check for the presence of the -dead_strip linker flag
1950         AC_MSG_CHECKING([for -dead_strip option to ld])
1951         _SAVE_LDFLAGS=$LDFLAGS
1952         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1953         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1954         if test -n "$_HAVE_DEAD_STRIP" ; then
1955             AC_MSG_RESULT([yes])
1956             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1957         else
1958             AC_MSG_RESULT([no])
1959         fi
1961         LDFLAGS=$_SAVE_LDFLAGS
1962     fi
1964     dnl With newer linkers we need to pass -allow_heap_execute because of
1965     dnl Microsoft Silverlight (5.1.10411.0 at least).
1966     AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1967     _SAVE_LDFLAGS=$LDFLAGS
1968     LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1969     AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1970                 _HAVE_ALLOW_HEAP_EXECUTE=)
1971     if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1972         AC_MSG_RESULT([yes])
1973         MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1974     else
1975         AC_MSG_RESULT([no])
1976     fi
1977     LDFLAGS=$_SAVE_LDFLAGS
1979     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1980     ;;
1982 ia64*-hpux*)
1983     DLL_SUFFIX=".so"
1984     if test ! "$GNU_CC"; then
1985        DSO_LDOPTS='-b'
1986        DSO_CFLAGS=""
1987        DSO_PIC_CFLAGS=
1988        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1989        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1990        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1991     else
1992        DSO_LDOPTS='-b -E'
1993        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1994        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1995     fi
1996     MOZ_FIX_LINK_PATHS=
1997     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1998     AC_DEFINE(_LARGEFILE64_SOURCE)
1999     ;;
2001 *-hpux*)
2002     DLL_SUFFIX=".sl"
2003     if test ! "$GNU_CC"; then
2004         DSO_LDOPTS='-b -Wl,+s'
2005         DSO_CFLAGS=""
2006         DSO_PIC_CFLAGS="+Z"
2007         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2008         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2009         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2010     else
2011         DSO_LDOPTS='-b -E +s'
2012         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2013         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2014     fi
2015     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2016     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2017     ;;
2019 *-android*|*-linuxandroid*)
2020     AC_DEFINE(NO_PW_GECOS)
2021     no_x=yes
2022     if test -n "$gonkdir"; then
2023         _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2024         MOZ_B2G_RIL=1
2025         MOZ_B2G_FM=1
2026     else
2027         _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2028         MOZ_LINKER=1
2029     fi
2030     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2032     MOZ_GFX_OPTIMIZE_MOBILE=1
2033     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2034     ;;
2036 *-*linux*)
2037     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2038     # Similarly for GNU_CXX and INTEL_CXX.
2039     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2040         # -Os has been broken on Intel's C/C++ compilers for quite a
2041         # while; Intel recommends against using it.
2042         MOZ_OPTIMIZE_FLAGS="-O2"
2043         MOZ_DEBUG_FLAGS="-g"
2044     elif test "$GNU_CC" -o "$GNU_CXX"; then
2045         case $GCC_VERSION in
2046         4.5.*)
2047             # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
2048             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2049         esac
2050         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2051         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2052         MOZ_DEBUG_FLAGS="-g"
2053     fi
2055     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2057     MOZ_MEMORY=1
2059     case "${target_cpu}" in
2060     alpha*)
2061         CFLAGS="$CFLAGS -mieee"
2062         CXXFLAGS="$CXXFLAGS -mieee"
2063     ;;
2064     i*86)
2065         USE_ELF_DYNSTR_GC=1
2066     ;;
2067     mips*)
2068         MOZ_DEBUG_FLAGS="-g" # We want inlining
2069     ;;
2070     esac
2072     if test -z "$MC"; then
2073         MC=mc.exe
2074     fi
2075     ;;
2076 *-mingw*)
2077     DSO_CFLAGS=
2078     DSO_PIC_CFLAGS=
2079     DLL_SUFFIX=.dll
2080     RC=rc.exe
2081     MC=mc.exe
2082     # certain versions of cygwin's makedepend barf on the
2083     # #include <string> vs -I./dist/include/string issue so don't use it
2084     if test -n "$GNU_CC"; then
2085         CC="$CC -mwindows"
2086         CXX="$CXX -mwindows"
2087         CPP="$CPP -mwindows"
2088         CFLAGS="$CFLAGS -mms-bitfields"
2089         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2090         DSO_LDOPTS='-shared'
2091         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2092         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2093         RC='$(WINDRES)'
2094         # Use static libgcc and libstdc++
2095         LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
2096         NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
2097         # Use temp file for windres (bug 213281)
2098         RCFLAGS='-O coff --use-temp-file'
2099         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2100         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2101         MOZ_FIX_LINK_PATHS=
2102         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxul -lxpcom_core -lmozalloc'
2103         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxul -lmozalloc'
2104         DLL_PREFIX=
2105         IMPORT_LIB_SUFFIX=dll.a
2107         # We use mix of both POSIX and Win32 printf format across the tree, so format
2108         # warnings are useless on mingw.
2109         MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2110         MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2111     else
2112         TARGET_COMPILER_ABI=msvc
2113         HOST_CC='$(CC)'
2114         HOST_CXX='$(CXX)'
2115         HOST_LD='$(LD)'
2116         if test "$AS_BIN"; then
2117             AS="$(basename "$AS_BIN")"
2118         fi
2119         AR='lib'
2120         AR_FLAGS='-NOLOGO -OUT:"$@"'
2121         AR_EXTRACT=
2122         RANLIB='echo not_ranlib'
2123         STRIP='echo not_strip'
2124         PKG_SKIP_STRIP=1
2125         XARGS=xargs
2126         ZIP=zip
2127         UNZIP=unzip
2128         DOXYGEN=:
2129         ASM_SUFFIX=asm
2130         OBJ_SUFFIX=obj
2131         LIB_SUFFIX=lib
2132         DLL_PREFIX=
2133         LIB_PREFIX=
2134         IMPORT_LIB_SUFFIX=lib
2135         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2136         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2137         MKSHLIB_FORCE_ALL=
2138         MKSHLIB_UNFORCE_ALL=
2139         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2140         _USE_CPP_INCLUDE_FLAG=1
2141         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2142         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2143         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2144         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2145         # khuey says we can safely ignore MSVC warning C4251
2146         # MSVC warning C4244 (implicit type conversion may lose data) warns
2147         # and requires workarounds for perfectly valid code.  Also, GCC/clang
2148         # don't warn about it by default. So for consistency/sanity, we turn
2149         # it off on MSVC, too.
2150         # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2151         # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2152         # MSVC warning C4482 warns when an enum value is refered specifing the
2153         # name of the enum itself.  This behavior is allowed in C++11, and the
2154         # warning has been removed in VS2012.
2155         # MSVC warning C4800 warns when a value is implicitly cast to bool,
2156         # because this also forces narrowing to a single byte, which can be a
2157         # perf hit.  But this matters so little in practice (and often we want
2158         # that behavior) that it's better to turn it off.
2159         # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2160         # on non-Western system locales even if it is in a comment.
2161         CFLAGS="$CFLAGS -wd4244 -wd4819"
2162         CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2163         # make 'foo == bar;' error out
2164         CFLAGS="$CFLAGS -we4553"
2165         CXXFLAGS="$CXXFLAGS -we4553"
2166         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2167         MOZ_DEBUG_FLAGS='-Zi'
2168         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2169         WARNINGS_AS_ERRORS='-WX'
2170         MOZ_OPTIMIZE_FLAGS='-O1'
2171         MOZ_FIX_LINK_PATHS=
2172         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2173         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2174         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2175         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2176         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT -RELEASE"
2177         dnl For profile-guided optimization
2178         PROFILE_GEN_CFLAGS="-GL"
2179         PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2180         dnl XXX: PGO builds can fail with warnings treated as errors,
2181         dnl specifically "no profile data available" appears to be
2182         dnl treated as an error sometimes. This might be a consequence
2183         dnl of using WARNINGS_AS_ERRORS in some modules, combined
2184         dnl with the linker doing most of the work in the whole-program
2185         dnl optimization/PGO case. I think it's probably a compiler bug,
2186         dnl but we work around it here.
2187         PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2188         dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2189         dnl Probably also a compiler bug, but what can you do?
2190         PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2191         LDFLAGS="$LDFLAGS -DYNAMICBASE"
2192         if test "$_MSC_VER" -ge 1500; then
2193             dnl VS2008 or later supports SSSE3
2194             HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2195             AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
2196         fi
2197     fi
2198     AC_DEFINE(HAVE_SNPRINTF)
2199     AC_DEFINE(_WINDOWS)
2200     AC_DEFINE(WIN32)
2201     AC_DEFINE(XP_WIN)
2202     AC_DEFINE(XP_WIN32)
2203     AC_DEFINE(HW_THREADS)
2204     AC_DEFINE(STDC_HEADERS)
2205     AC_DEFINE(NEW_H, <new>)
2206     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2207     TARGET_MD_ARCH=win32
2208     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2209     BIN_SUFFIX='.exe'
2210     MOZ_USER_DIR="Mozilla"
2212     dnl Hardcode to win95 for now - cls
2213     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2215     dnl set NO_X11 defines here as the general check is skipped on win32
2216     no_x=yes
2217     AC_DEFINE(NO_X11)
2219     case "$host" in
2220     *-mingw*)
2221         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2222         if test -n "$L10NBASEDIR"; then
2223             L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2224         fi
2225         ;;
2226     esac
2228     case "$host" in
2229     *-mingw*)
2230         if test -z "$MOZ_TOOLS"; then
2231             AC_MSG_ERROR([MOZ_TOOLS is not set])
2232         fi
2233         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2234         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2235             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2236         fi
2237         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2238         if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2239             AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2240         fi
2241         ;;
2242     esac
2244     case "$host_os" in
2245     cygwin*|msvc*|mks*)
2246         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.])
2247         ;;
2248     esac
2250     case "$target" in
2251     i*86-*)
2252         if test "$HAVE_64BIT_OS"; then
2253             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2254         fi
2256         if test -n "$GNU_CC"; then
2257             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2258             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2259             LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2260         else
2261             AC_DEFINE(HAVE_STDCALL)
2262             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2263             LDFLAGS="$LDFLAGS -SAFESEH"
2264         fi
2266         AC_DEFINE(_X86_)
2267         ;;
2268     x86_64-*)
2269         if test -n "$_WIN32_MSVC"; then
2270             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2271         fi
2272         AC_DEFINE(_AMD64_)
2273         ;;
2274     *)
2275         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2276         ;;
2277     esac
2279     if test "$HAVE_64BIT_OS"; then
2280         AC_DEFINE(_WIN64)
2281     fi
2282     ;;
2284 *-netbsd*)
2285     DSO_CFLAGS=''
2286     CFLAGS="$CFLAGS -Dunix"
2287     CXXFLAGS="$CXXFLAGS -Dunix"
2288     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2289         DLL_SUFFIX=".so"
2290         DSO_PIC_CFLAGS='-fPIC -DPIC'
2291         DSO_LDOPTS='-shared'
2292         BIN_FLAGS='-Wl,--export-dynamic'
2293     else
2294         DSO_PIC_CFLAGS='-fPIC -DPIC'
2295         DLL_SUFFIX=".so.1.0"
2296         DSO_LDOPTS='-shared'
2297     fi
2298     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2299     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2300     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2301     if test "$LIBRUNPATH"; then
2302         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2303     fi
2304     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2305     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2306     ;;
2308 *-openbsd*)
2309     if test "$SO_VERSION"; then
2310         DLL_SUFFIX=".so.$SO_VERSION"
2311     else
2312         DLL_SUFFIX=".so.1.0"
2313     fi
2314     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2315     DSO_CFLAGS=''
2316     DSO_PIC_CFLAGS='-fPIC'
2317     DSO_LDOPTS='-shared -fPIC'
2318     if test "$LIBRUNPATH"; then
2319         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2320     fi
2321     ;;
2323 *-os2*)
2324     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2325     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2326     AC_DEFINE(OS2)
2327     AC_DEFINE(XP_OS2)
2328     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2329     AC_DEFINE(TCPV40HDRS)
2330     DLL_PREFIX=
2331     LIB_PREFIX=
2332     LIB_SUFFIX=lib
2333     BIN_SUFFIX=".exe"
2334     DLL_SUFFIX=".dll"
2335     IMPORT_LIB_SUFFIX=lib
2336     DSO_PIC_CFLAGS=
2337     AR=emxomfar
2338     AR_FLAGS='r $@'
2339     CFLAGS="$CFLAGS -Zomf"
2340     CXXFLAGS="$CXXFLAGS -Zomf"
2341     DSO_LDOPTS='-Zdll'
2342     BIN_FLAGS='-Zlinker /ST:0x100000'
2343     IMPLIB='emximp -o'
2344     FILTER='true'
2345     LDFLAGS='-Zmap'
2346     WARNINGS_AS_ERRORS='-Werror'
2347     MOZ_DEBUG_FLAGS="-g -fno-inline"
2348     MOZ_OPTIMIZE_FLAGS="-O2"
2349     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2350     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2351     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2352     TARGET_MD_ARCH=os2
2353     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2354     RC=rc.exe
2355     MC=mc.exe
2356     RCFLAGS='-n'
2357     MOZ_USER_DIR="Mozilla"
2358     ZIP="$ZIP -X"
2359     STRIP=lxlite
2360     STRIP_FLAGS="/yua /ydd /yxd /ynl /anp /b- /cs+ /d /i- /ml1 /mr2 /mf2 /r+ /u+ /x- /zs:0 /zx /zd"
2362     if test "$MOZTOOLS"; then
2363         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2364     else
2365         AC_MSG_ERROR([MOZTOOLS is not set])
2366     fi
2367     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2368         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2369         LDFLAGS="$LDFLAGS -Zhigh-mem"
2370         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2371         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2372     fi
2374     # GCC for OS/2 currently predefines these, but we don't want them
2375     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2376     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2378     AC_CACHE_CHECK(for __declspec(dllexport),
2379         ac_os2_declspec,
2380         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2381                         [return 0;],
2382                         ac_os2_declspec="yes",
2383                         ac_os2_declspec="no")])
2384     if test "$ac_os2_declspec" != "yes"; then
2385         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2386     fi
2387     ;;
2389 *-solaris*)
2390     AC_DEFINE(SOLARIS)
2391     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2392     MOZ_FIX_LINK_PATHS=
2393     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2394     # libraries one level up (e.g. libnspr4.so)
2395     if test "$SOLARIS_SUNPRO_CC"; then
2396        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2397        LIBS="-lCrun -lCstd -lc $LIBS"
2398        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2399        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2400        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2401        LDFLAGS="-xildoff $LDFLAGS"
2402        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2403            _SAVE_LDFLAGS=$LDFLAGS
2404            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2405            AC_TRY_LINK([#include <stdio.h>],
2406                        [printf("Hello World\n");],
2407                        ,
2408                        [LDFLAGS=$_SAVE_LDFLAGS])
2409        fi
2410        MOZ_OPTIMIZE_FLAGS="-xO4"
2411        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2412        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2413        MKSHLIB_FORCE_ALL='-z allextract'
2414        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2415        DSO_LDOPTS='-G'
2416        AR_LIST="$AR t"
2417        AR_EXTRACT="$AR x"
2418        AR_DELETE="$AR d"
2419        AR='$(CXX) -xar'
2420        AR_FLAGS='-o $@'
2421        AS='/usr/ccs/bin/as'
2422        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2423        AS_DASH_C_FLAG=''
2424        TARGET_COMPILER_ABI="sunc"
2425        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2426        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2427        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2428        AC_LANG_SAVE
2429        AC_LANG_CPLUSPLUS
2430        AC_TRY_COMPILE([],
2431            [#if (__SUNPRO_CC < 0x590)
2432            #error "Denied"
2433            #endif],
2434            _BAD_COMPILER=,_BAD_COMPILER=1)
2435        if test -n "$_BAD_COMPILER"; then
2436            _res="no"
2437            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2438        else
2439            _res="yes"
2440        fi
2441        AC_TRY_COMPILE([],
2442            [#if (__SUNPRO_CC >= 0x5100)
2443            #error "Sun C++ 5.10 or above"
2444            #endif],
2445            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2446        if test "$_ABOVE_SS12U1"; then
2447            # disable xannotate
2448            CXXFLAGS="$CXXFLAGS -xannotate=no"
2449        fi
2450        AC_MSG_RESULT([$_res])
2451        AC_LANG_RESTORE
2452     else
2453        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2454        LIBS="-lc $LIBS"
2455        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2456        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2457        ASFLAGS="$ASFLAGS -fPIC"
2458        DSO_LDOPTS='-shared'
2459        WARNINGS_AS_ERRORS='-Werror'
2460        _WARNINGS_CFLAGS=''
2461        _WARNINGS_CXXFLAGS=''
2462        if test "$OS_RELEASE" = "5.3"; then
2463            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2464        fi
2465     fi
2466     if test "$OS_RELEASE" = "5.5.1"; then
2467         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2468     fi
2469     ;;
2471 *-sunos*)
2472     DSO_LDOPTS='-Bdynamic'
2473     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2474     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2475     AC_DEFINE(SUNOS4)
2476     AC_DEFINE(SPRINTF_RETURNS_STRING)
2477     case "$(target_os)" in
2478     sunos4.1*)
2479         DLL_SUFFIX='.so.1.0'
2480         ;;
2481     esac
2482     ;;
2484 *-os2*)
2485     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2486     ;;
2488 esac
2490 AC_SUBST(MOZ_LINKER)
2491 if test -n "$MOZ_LINKER"; then
2492   AC_DEFINE(MOZ_LINKER)
2495 dnl Only one oddball right now (QNX), but this gives us flexibility
2496 dnl if any other platforms need to override this in the future.
2497 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2499 dnl ========================================================
2500 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2501 dnl by now will not have any way to link most binaries (tests
2502 dnl as well as viewer, apprunner, etc.), because some symbols
2503 dnl will be left out of the "composite" .so's by ld as unneeded.
2504 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2505 dnl they can link in the static libs that provide the missing
2506 dnl symbols.
2507 dnl ========================================================
2508 NO_LD_ARCHIVE_FLAGS=
2509 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2510     NO_LD_ARCHIVE_FLAGS=1
2512 case "$target" in
2513 *-os2*)
2514     NO_LD_ARCHIVE_FLAGS=
2515     ;;
2516 *-aix4.3*|*-aix5*)
2517     NO_LD_ARCHIVE_FLAGS=
2518     ;;
2519 *-mingw*)
2520     if test -z "$GNU_CC"; then
2521         NO_LD_ARCHIVE_FLAGS=
2522     fi
2523     ;;
2524 esac
2525 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2527 dnl ========================================================
2528 dnl = Flags to strip unused symbols from .so components and
2529 dnl = to export jemalloc symbols when linking a program
2530 dnl ========================================================
2531 case "$target" in
2532     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2533         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2534         ;;
2535     *-solaris*)
2536         if test -z "$GNU_CC"; then
2537          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2538         else
2539          if test -z "$GCC_USE_GNU_LD"; then
2540           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2541          else
2542           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2543          fi
2544         fi
2545         ;;
2546     *-darwin*)
2547         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2548         ;;
2549     *-mingw*)
2550         if test -n "$GNU_CC"; then
2551            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2552         fi
2553         ;;
2554 esac
2556 if test -z "$COMPILE_ENVIRONMENT"; then
2557     SKIP_COMPILER_CHECKS=1
2558     SKIP_LIBRARY_CHECKS=1
2561 MOZ_COMPILER_OPTS
2562 if test -z "$SKIP_COMPILER_CHECKS"; then
2563 dnl Checks for typedefs, structures, and compiler characteristics.
2564 dnl ========================================================
2565 AC_HEADER_STDC
2566 AC_C_CONST
2567 AC_TYPE_MODE_T
2568 AC_TYPE_OFF_T
2569 AC_TYPE_PID_T
2570 AC_TYPE_SIZE_T
2571 AC_LANG_CPLUSPLUS
2572 AC_MSG_CHECKING(for __stdcall)
2573 AC_CACHE_VAL(ac_cv___stdcall,
2574  [AC_TRY_COMPILE([template <typename Method> struct foo;
2575                   template <> struct foo<void (*)()> {};
2576                   template <> struct foo<void (__stdcall*)()> {};],
2577                  [],
2578                  [ac_cv___stdcall=true],
2579                  [ac_cv___stdcall=false])])
2580 if test "$ac_cv___stdcall" = true ; then
2581   AC_DEFINE(HAVE_STDCALL)
2582   AC_MSG_RESULT(yes)
2583 else
2584   AC_MSG_RESULT(no)
2586 AC_LANG_C
2587 AC_MSG_CHECKING(for ssize_t)
2588 AC_CACHE_VAL(ac_cv_type_ssize_t,
2589  [AC_TRY_COMPILE([#include <stdio.h>
2590                   #include <sys/types.h>],
2591                  [ssize_t foo = 0;],
2592                  [ac_cv_type_ssize_t=true],
2593                  [ac_cv_type_ssize_t=false])])
2594 if test "$ac_cv_type_ssize_t" = true ; then
2595   AC_DEFINE(HAVE_SSIZE_T)
2596   AC_MSG_RESULT(yes)
2597 else
2598   AC_MSG_RESULT(no)
2600 AC_STRUCT_ST_BLKSIZE
2601 AC_MSG_CHECKING(for siginfo_t)
2602 AC_CACHE_VAL(ac_cv_siginfo_t,
2603  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2604                   #include <signal.h>],
2605                  [siginfo_t* info;],
2606                  [ac_cv_siginfo_t=true],
2607                  [ac_cv_siginfo_t=false])])
2608 if test "$ac_cv_siginfo_t" = true ; then
2609   AC_DEFINE(HAVE_SIGINFO_T)
2610   AC_MSG_RESULT(yes)
2611 else
2612   AC_MSG_RESULT(no)
2615 dnl Check for int64, uint, and uint_t.
2616 dnl ========================================================
2617 AC_MSG_CHECKING(for int64)
2618 AC_CACHE_VAL(ac_cv_int64,
2619  [AC_TRY_COMPILE([#include <stdio.h>
2620                   #include <sys/types.h>],
2621                  [int64 foo = 0;],
2622                  [ac_cv_int64=true],
2623                  [ac_cv_int64=false])])
2624 if test "$ac_cv_int64" = true ; then
2625   AC_DEFINE(HAVE_INT64)
2626   AC_MSG_RESULT(yes)
2627 else
2628   AC_MSG_RESULT(no)
2630 AC_MSG_CHECKING(for uint)
2631 AC_CACHE_VAL(ac_cv_uint,
2632  [AC_TRY_COMPILE([#include <stdio.h>
2633                   #include <sys/types.h>],
2634                  [uint foo = 0;],
2635                  [ac_cv_uint=true],
2636                  [ac_cv_uint=false])])
2637 if test "$ac_cv_uint" = true ; then
2638   AC_DEFINE(HAVE_UINT)
2639   AC_MSG_RESULT(yes)
2640 else
2641   AC_MSG_RESULT(no)
2643 AC_MSG_CHECKING(for uint_t)
2644 AC_CACHE_VAL(ac_cv_uint_t,
2645  [AC_TRY_COMPILE([#include <stdio.h>
2646                   #include <sys/types.h>],
2647                  [uint_t foo = 0;],
2648                  [ac_cv_uint_t=true],
2649                  [ac_cv_uint_t=false])])
2650 if test "$ac_cv_uint_t" = true ; then
2651   AC_DEFINE(HAVE_UINT_T)
2652   AC_MSG_RESULT(yes)
2653 else
2654   AC_MSG_RESULT(no)
2657 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2658 dnl are defined when compiling C++ but not C.  Since the result of this
2659 dnl test is used only in C++, do it in C++.
2660 AC_LANG_CPLUSPLUS
2662 AC_MSG_CHECKING(for uname.domainname)
2663 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2664     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2665         [ struct utsname *res; char *domain;
2666             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2667         [ac_cv_have_uname_domainname_field=true],
2668         [ac_cv_have_uname_domainname_field=false])])
2670 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2671     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2672     AC_MSG_RESULT(yes)
2673 else
2674     AC_MSG_RESULT(no)
2677 AC_MSG_CHECKING(for uname.__domainname)
2678 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2679     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2680         [ struct utsname *res; char *domain;
2681             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2682         [ac_cv_have_uname_us_domainname_field=true],
2683         [ac_cv_have_uname_us_domainname_field=false])])
2685 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2686     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2687     AC_MSG_RESULT(yes)
2688 else
2689     AC_MSG_RESULT(no)
2692 dnl Check whether we can use gcc's c++0x mode
2693 AC_LANG_CPLUSPLUS
2695 if test "$GNU_CXX"; then
2696     _SAVE_CXXFLAGS=$CXXFLAGS
2697     CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2699     AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2700         ac_cv_cxx0x_headers_bug,
2701         [AC_TRY_COMPILE([#include <memory>], [],
2702                         ac_cv_cxx0x_headers_bug="no",
2703                         ac_cv_cxx0x_headers_bug="yes")])
2705     if test "$CLANG_CXX" -a "$ac_cv_cxx0x_headers_bug" = "yes"; then
2706         CXXFLAGS="$CXXFLAGS -I$_topsrcdir/build/unix/headers"
2707         AC_CACHE_CHECK(whether workaround for gcc c++0x headers conflict with clang works,
2708             ac_cv_cxx0x_clang_workaround,
2709             [AC_TRY_COMPILE([#include <memory>], [],
2710                             ac_cv_cxx0x_clang_workaround="yes",
2711                             ac_cv_cxx0x_clang_workaround="no")])
2713         if test "ac_cv_cxx0x_clang_workaround" = "no"; then
2714             CXXFLAGS="$_SAVE_CXXFLAGS"
2715         fi
2716     elif test "$ac_cv_cxx0x_headers_bug" = "yes"; then
2717         CXXFLAGS="$_SAVE_CXXFLAGS"
2718     fi
2721 dnl Check for usable char16_t (2 bytes, unsigned)
2722 dnl (we might not need the unsignedness check anymore)
2723 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2724     ac_cv_have_usable_char16_t,
2725     [AC_TRY_COMPILE([$configure_static_assert_macros],
2726                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2727                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2728                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2729                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2730                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2731                     ac_cv_have_usable_char16_t="yes",
2732                     ac_cv_have_usable_char16_t="no")])
2733 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2734     AC_DEFINE(HAVE_CPP_CHAR16_T)
2735     HAVE_CPP_CHAR16_T=1
2736 elif test "$GNU_CXX"; then
2737     CXXFLAGS="$_SAVE_CXXFLAGS"
2740 dnl Check for usable wchar_t (2 bytes, unsigned)
2741 dnl (we really don't need the unsignedness check anymore)
2742 dnl ========================================================
2744 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2745     ac_cv_have_usable_wchar_v2,
2746     [AC_TRY_COMPILE([#include <stddef.h>
2747                      $configure_static_assert_macros],
2748                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2749                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2750                     ac_cv_have_usable_wchar_v2="yes",
2751                     ac_cv_have_usable_wchar_v2="no")])
2752 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2753     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2754     HAVE_CPP_2BYTE_WCHAR_T=1
2755 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2756 dnl This is really gcc-only
2757 dnl Do this test using CXX only since some versions of gcc
2758 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2759 dnl only have short-wchar support for c++.
2760 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2762     _SAVE_CXXFLAGS=$CXXFLAGS
2763     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2765     AC_CACHE_CHECK(for compiler -fshort-wchar option,
2766         ac_cv_have_usable_wchar_option_v2,
2767         [AC_TRY_LINK([#include <stddef.h>
2768                       $configure_static_assert_macros],
2769                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2770                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2771                      ac_cv_have_usable_wchar_option_v2="yes",
2772                      ac_cv_have_usable_wchar_option_v2="no")])
2774     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2775         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2776         HAVE_CPP_2BYTE_WCHAR_T=1
2777         if test "$OS_TARGET" = Android; then
2778             WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
2779             CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
2780             CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
2781             DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
2782         else
2783             WCHAR_CFLAGS="-fshort-wchar"
2784         fi
2785     else
2786         CXXFLAGS=$_SAVE_CXXFLAGS
2787     fi
2790 AC_LANG_C
2792 dnl Check for .hidden assembler directive and visibility attribute.
2793 dnl Borrowed from glibc configure.in
2794 dnl ===============================================================
2795 if test "$GNU_CC"; then
2796   AC_CACHE_CHECK(for visibility(hidden) attribute,
2797                  ac_cv_visibility_hidden,
2798                  [cat > conftest.c <<EOF
2799                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2801                   ac_cv_visibility_hidden=no
2802                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2803                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2804                       ac_cv_visibility_hidden=yes
2805                     fi
2806                   fi
2807                   rm -f conftest.[cs]
2808                  ])
2809   if test "$ac_cv_visibility_hidden" = "yes"; then
2810     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2812     AC_CACHE_CHECK(for visibility(default) attribute,
2813                    ac_cv_visibility_default,
2814                    [cat > conftest.c <<EOF
2815                     int foo __attribute__ ((visibility ("default"))) = 1;
2817                     ac_cv_visibility_default=no
2818                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2819                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2820                         ac_cv_visibility_default=yes
2821                       fi
2822                     fi
2823                     rm -f conftest.[cs]
2824                    ])
2825     if test "$ac_cv_visibility_default" = "yes"; then
2826       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2828       AC_CACHE_CHECK(for visibility pragma support,
2829                      ac_cv_visibility_pragma,
2830                      [cat > conftest.c <<EOF
2831 #pragma GCC visibility push(hidden)
2832                       int foo_hidden = 1;
2833 #pragma GCC visibility push(default)
2834                       int foo_default = 1;
2836                       ac_cv_visibility_pragma=no
2837                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2838                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2839                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2840                             ac_cv_visibility_pragma=yes
2841                           fi
2842                         fi
2843                       fi
2844                       rm -f conftest.[cs]
2845                     ])
2846       if test "$ac_cv_visibility_pragma" = "yes"; then
2847         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2848                        ac_cv_have_visibility_class_bug,
2849                        [cat > conftest.c <<EOF
2850 #pragma GCC visibility push(hidden)
2851 struct __attribute__ ((visibility ("default"))) TestStruct {
2852   static void Init();
2854 __attribute__ ((visibility ("default"))) void TestFunc() {
2855   TestStruct::Init();
2858                        ac_cv_have_visibility_class_bug=no
2859                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2860                          ac_cv_have_visibility_class_bug=yes
2861                        else
2862                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2863                            ac_cv_have_visibility_class_bug=yes
2864                          fi
2865                        fi
2866                        rm -rf conftest.{c,S}
2867                        ])
2869         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2870                        ac_cv_have_visibility_builtin_bug,
2871                        [cat > conftest.c <<EOF
2872 #pragma GCC visibility push(hidden)
2873 #pragma GCC visibility push(default)
2874 #include <string.h>
2875 #pragma GCC visibility pop
2877 __attribute__ ((visibility ("default"))) void Func() {
2878   char c[[100]];
2879   memset(c, 0, sizeof(c));
2882                        ac_cv_have_visibility_builtin_bug=no
2883                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2884                          ac_cv_have_visibility_builtin_bug=yes
2885                        else
2886                          if test `grep -c "@PLT" conftest.S` = 0; then
2887                            ac_cv_visibility_builtin_bug=yes
2888                          fi
2889                        fi
2890                        rm -f conftest.{c,S}
2891                        ])
2892         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2893                 "$ac_cv_have_visibility_class_bug" = "no"; then
2894           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2895           WRAP_SYSTEM_INCLUDES=1
2896           STL_FLAGS='-I$(DIST)/stl_wrappers'
2897           WRAP_STL_INCLUDES=1
2898         else
2899           VISIBILITY_FLAGS='-fvisibility=hidden'
2900         fi # have visibility pragma bug
2901       fi   # have visibility pragma
2902     fi     # have visibility(default) attribute
2903   fi       # have visibility(hidden) attribute
2904 fi         # GNU_CC
2906 # visibility hidden flag for Sun Studio on Solaris
2907 if test "$SOLARIS_SUNPRO_CC"; then
2908 VISIBILITY_FLAGS='-xldscope=hidden'
2909 fi         # Sun Studio on Solaris
2911 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2912 AC_SUBST(VISIBILITY_FLAGS)
2914 MOZ_GCC_PR49911
2915 MOZ_GCC_PR39608
2916 MOZ_LLVM_PR8927
2918 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2919 dnl ========================================================
2920 if test "$GNU_CC"; then
2921   CFLAGS_save="${CFLAGS}"
2922   CFLAGS="${CFLAGS} -Werror"
2923   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2924                  ac_cv_force_align_arg_pointer,
2925                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2926                                  [],
2927                                  ac_cv_force_align_arg_pointer="yes",
2928                                  ac_cv_force_align_arg_pointer="no")])
2929   CFLAGS="${CFLAGS_save}"
2930   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2931     HAVE_GCC_ALIGN_ARG_POINTER=1
2932   else
2933     HAVE_GCC_ALIGN_ARG_POINTER=
2934   fi
2936 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2938 dnl Checks for header files.
2939 dnl ========================================================
2940 AC_HEADER_DIRENT
2941 case "$target_os" in
2942 freebsd*|openbsd*)
2943 # for stuff like -lXshm
2944     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2945     ;;
2946 esac
2947 MOZ_CHECK_COMMON_HEADERS
2949 dnl These are all the places some variant of statfs can be hiding.
2950 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2952 dnl Quota support
2953 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2954 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2956 dnl SCTP support - needs various network include headers
2957 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2959 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2961 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2962 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2963                    ac_cv_sockaddr_in_sin_len,
2964                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2965                                     #include <sys/types.h>
2966                                     #endif
2967                                     #include <netinet/in.h>
2968                                     struct sockaddr_in x;
2969                                     void *foo = (void*) &x.sin_len;],
2970                                    [],
2971                                    [ac_cv_sockaddr_in_sin_len=true],
2972                                    [ac_cv_sockaddr_in_sin_len=false])])
2973 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2974   AC_DEFINE(HAVE_SIN_LEN)
2975 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2976   AC_DEFINE(HAVE_SCONN_LEN)
2979 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2980                ac_cv_sockaddr_in6_sin6_len,
2981                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2982                                 #include <sys/types.h>
2983                                 #endif
2984                                 #include <netinet/in.h>
2985                                 struct sockaddr_in6 x;
2986                                 void *foo = (void*) &x.sin6_len;],
2987                                [],
2988                                [ac_cv_sockaddr_in6_sin6_len=true],
2989                                [ac_cv_sockaddr_in6_sin6_len=false])])
2990 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2991   AC_DEFINE(HAVE_SIN6_LEN)
2994 AC_CACHE_CHECK(for sockaddr.sa_len,
2995                ac_cv_sockaddr_sa_len,
2996                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2997                                 #include <sys/types.h>
2998                                 #endif
2999                                 #include <sys/socket.h>
3000                                 struct sockaddr x;
3001                                 void *foo = (void*) &x.sa_len;],
3002                                [],
3003                                [ac_cv_sockaddr_sa_len=true],
3004                                [ac_cv_sockaddr_sa_len=false])])
3005 if test "$ac_cv_sockaddr_sa_len" = true ; then
3006   AC_DEFINE(HAVE_SA_LEN)
3009 dnl Check whether the compiler supports the new-style C++ standard
3010 dnl library headers (i.e. <new>) or needs the old "new.h"
3011 AC_LANG_CPLUSPLUS
3012 NEW_H=new.h
3013 MOZ_CHECK_HEADER(new, [NEW_H=new])
3014 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3015 AC_LANG_C
3017 AC_ARG_ENABLE(dtrace,
3018               [  --enable-dtrace         build with dtrace support if available (default=no)],
3019               [enable_dtrace="yes"],)
3020 if test "x$enable_dtrace" = "xyes"; then
3021   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3022   if test -n "$HAVE_DTRACE"; then
3023       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3024   else
3025       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3026   fi
3028 AC_SUBST(HAVE_DTRACE)
3030 case $target in
3031 *-aix4.3*|*-aix5*)
3032         ;;
3034         MOZ_CHECK_HEADERS(sys/cdefs.h)
3035         ;;
3036 esac
3038 MOZ_LINUX_PERF_EVENT
3040 dnl Checks for libraries.
3041 dnl ========================================================
3042 case $target in
3043 *-hpux11.*)
3044         ;;
3046         AC_CHECK_LIB(c_r, gethostbyname_r)
3047         ;;
3048 esac
3050 dnl We don't want to link with libdl even if it's present on OS X, since
3051 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3052 dnl in libc.
3053 dnl We don't want to link against libm or libpthread on Darwin since
3054 dnl they both are just symlinks to libSystem and explicitly linking
3055 dnl against libSystem causes issues when debugging (see bug 299601).
3056 case $target in
3057 *-darwin*)
3058     ;;
3059 *-os2*)
3060     ;;
3062     AC_SEARCH_LIBS(dlopen, dl,
3063         MOZ_CHECK_HEADER(dlfcn.h,
3064         AC_DEFINE(HAVE_DLOPEN)))
3065     ;;
3066 esac
3068 _SAVE_CFLAGS="$CFLAGS"
3069 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3070 AC_CHECK_FUNCS(dladdr memmem)
3071 CFLAGS="$_SAVE_CFLAGS"
3073 if test ! "$GNU_CXX"; then
3075     case $target in
3076     *-aix*)
3077         AC_CHECK_LIB(C_r, demangle)
3078         ;;
3079      *)
3080         AC_CHECK_LIB(C, demangle)
3081         ;;
3082      esac
3085 dnl OS/2 has socket in libc.
3086 case $target in
3087 *-os2*)
3088     ;;
3090     AC_CHECK_LIB(socket, socket)
3091 esac
3093 XLDFLAGS="$X_LIBS"
3094 XLIBS="$X_EXTRA_LIBS"
3096 dnl ========================================================
3097 dnl Checks for X libraries.
3098 dnl Ordering is important.
3099 dnl Xt is dependent upon SM as of X11R6
3100 dnl ========================================================
3101 if test "$no_x" = "yes"; then
3102     AC_DEFINE(NO_X11)
3103 else
3104     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3105         XLIBS="-lX11 $XLIBS"
3106         _SAVE_LDFLAGS="$LDFLAGS"
3107         LDFLAGS="$XLDFLAGS $LDFLAGS"
3108         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3109                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3110         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3111                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3113         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3114         unset ac_cv_lib_Xt_XtFree
3115             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3116             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3117         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3118                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3119         ])
3121     # AIX needs the motif library linked before libXt to prevent
3122     # crashes in plugins linked against Motif - Bug #98892
3123     case "${target_os}" in
3124     aix*)
3125         XT_LIBS="-lXm $XT_LIBS"
3126         ;;
3127     esac
3129     dnl ========================================================
3130     dnl = Check for XShm
3131     dnl ========================================================
3132     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3133         $XLIBS $XEXT_LIBS)
3135     dnl ========================================================
3136     dnl = Check for Xss
3137     dnl ========================================================
3138     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3139         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3140             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3141              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3143         LDFLAGS="$_SAVE_LDFLAGS"
3144 fi # $no_x
3146 AC_SUBST(XCFLAGS)
3147 AC_SUBST(XLDFLAGS)
3148 AC_SUBST(XLIBS)
3149 AC_SUBST(XEXT_LIBS)
3150 AC_SUBST(XT_LIBS)
3151 AC_SUBST(XSS_LIBS)
3153 dnl ========================================================
3154 dnl = pthread support
3155 dnl = Start by checking whether the system support pthreads
3156 dnl ========================================================
3157 case "$target_os" in
3158 darwin*)
3159     USE_PTHREADS=1
3160     ;;
3162     MOZ_CHECK_PTHREADS(pthreads,
3163         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3164         MOZ_CHECK_PTHREADS(pthread,
3165             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3166             MOZ_CHECK_PTHREADS(c_r,
3167                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3168                 MOZ_CHECK_PTHREADS(c,
3169                     USE_PTHREADS=1
3170                 )
3171             )
3172         )
3173     )
3174     ;;
3175 esac
3177 dnl ========================================================
3178 dnl Check the command line for --with-pthreads
3179 dnl ========================================================
3180 MOZ_ARG_WITH_BOOL(pthreads,
3181 [  --with-pthreads         Force use of system pthread library with NSPR ],
3182 [ if test "$USE_PTHREADS"x = x; then
3183     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3184 fi],
3185     USE_PTHREADS=
3186     _PTHREAD_LDFLAGS=
3189 dnl ========================================================
3190 dnl Do the platform specific pthread hackery
3191 dnl ========================================================
3192 if test "$USE_PTHREADS"x != x
3193 then
3194         dnl
3195         dnl See if -pthread is supported.
3196         dnl
3197         rm -f conftest*
3198         ac_cv_have_dash_pthread=no
3199         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3200         echo 'int main() { return 0; }' | cat > conftest.c
3201         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3202         if test $? -eq 0; then
3203                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3204                         ac_cv_have_dash_pthread=yes
3205                 case "$target_os" in
3206                 freebsd*)
3207 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3208                 ;;
3209                 *)
3210                             CFLAGS="$CFLAGS -pthread"
3211                             CXXFLAGS="$CXXFLAGS -pthread"
3212                 ;;
3213                 esac
3214                 fi
3215         fi
3216         rm -f conftest*
3217     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3219         dnl
3220         dnl See if -pthreads is supported.
3221         dnl
3222     ac_cv_have_dash_pthreads=no
3223     if test "$ac_cv_have_dash_pthread" = "no"; then
3224             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3225         echo 'int main() { return 0; }' | cat > conftest.c
3226             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3227         if test $? -eq 0; then
3228                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3229                             ac_cv_have_dash_pthreads=yes
3230                             CFLAGS="$CFLAGS -pthreads"
3231                             CXXFLAGS="$CXXFLAGS -pthreads"
3232                     fi
3233             fi
3234             rm -f conftest*
3235         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3236     fi
3238         case "$target" in
3239             *-*-freebsd*)
3240                         AC_DEFINE(_REENTRANT)
3241                         AC_DEFINE(_THREAD_SAFE)
3242                         dnl -pthread links in -lpthread, so don't specify it explicitly.
3243                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3244                                 _PTHREAD_LDFLAGS="-pthread"
3245                         fi
3246                         ;;
3248             *-*-openbsd*|*-*-bsdi*)
3249                         AC_DEFINE(_REENTRANT)
3250                         AC_DEFINE(_THREAD_SAFE)
3251                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3252                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3253                 _PTHREAD_LDFLAGS="-pthread"
3254                         fi
3255                         ;;
3257             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3258                         AC_DEFINE(_REENTRANT)
3259                         ;;
3261             *-aix4.3*|*-aix5*)
3262                         AC_DEFINE(_REENTRANT)
3263                         ;;
3265             *-hpux11.*)
3266                         AC_DEFINE(_REENTRANT)
3267                         ;;
3269             *-*-solaris*)
3270                         AC_DEFINE(_REENTRANT)
3271                         if test "$SOLARIS_SUNPRO_CC"; then
3272                                 CFLAGS="$CFLAGS -mt"
3273                                 CXXFLAGS="$CXXFLAGS -mt"
3274                         fi
3275                         ;;
3276         esac
3277     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3281 dnl Checks for library functions.
3282 dnl ========================================================
3283 AC_PROG_GCC_TRADITIONAL
3284 AC_FUNC_MEMCMP
3285 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf memmove rint stat64 lstat64 truncate64 setbuf isatty)
3286 AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
3287 AC_CHECK_FUNCS(flockfile getpagesize)
3288 AC_CHECK_FUNCS(localtime_r strtok_r)
3290 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3291 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3292                ac_cv_clock_monotonic,
3293                [for libs in "" -lrt; do
3294                     _SAVE_LIBS="$LIBS"
3295                     LIBS="$LIBS $libs"
3296                     AC_TRY_LINK([#include <time.h>],
3297                                  [ struct timespec ts;
3298                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
3299                                  ac_cv_clock_monotonic=$libs
3300                                  LIBS="$_SAVE_LIBS"
3301                                  break,
3302                                  ac_cv_clock_monotonic=no)
3303                     LIBS="$_SAVE_LIBS"
3304                 done])
3305 if test "$ac_cv_clock_monotonic" != "no"; then
3306     HAVE_CLOCK_MONOTONIC=1
3307     REALTIME_LIBS=$ac_cv_clock_monotonic
3308     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3309     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3310     AC_SUBST(REALTIME_LIBS)
3313 dnl check for wcrtomb/mbrtowc
3314 dnl =======================================================================
3315 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3316 AC_LANG_SAVE
3317 AC_LANG_CPLUSPLUS
3318 AC_CACHE_CHECK(for wcrtomb,
3319     ac_cv_have_wcrtomb,
3320     [AC_TRY_LINK([#include <wchar.h>],
3321                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3322                  ac_cv_have_wcrtomb="yes",
3323                  ac_cv_have_wcrtomb="no")])
3324 if test "$ac_cv_have_wcrtomb" = "yes"; then
3325     AC_DEFINE(HAVE_WCRTOMB)
3327 AC_CACHE_CHECK(for mbrtowc,
3328     ac_cv_have_mbrtowc,
3329     [AC_TRY_LINK([#include <wchar.h>],
3330                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3331                  ac_cv_have_mbrtowc="yes",
3332                  ac_cv_have_mbrtowc="no")])
3333 if test "$ac_cv_have_mbrtowc" = "yes"; then
3334     AC_DEFINE(HAVE_MBRTOWC)
3336 AC_LANG_RESTORE
3339 AC_CACHE_CHECK(
3340     [for res_ninit()],
3341     ac_cv_func_res_ninit,
3342     [AC_TRY_LINK([
3343         #ifdef linux
3344         #define _BSD_SOURCE 1
3345         #endif
3346         #include <resolv.h>
3347         ],
3348         [int foo = res_ninit(&_res);],
3349         [ac_cv_func_res_ninit=yes],
3350         [ac_cv_func_res_ninit=no])
3351     ])
3353 if test "$ac_cv_func_res_ninit" = "yes"; then
3354     AC_DEFINE(HAVE_RES_NINIT)
3355 dnl must add the link line we do something as foolish as this... dougt
3356 dnl else
3357 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3358 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3361 AC_LANG_CPLUSPLUS
3362 AC_CACHE_CHECK(
3363     [for gnu_get_libc_version()],
3364     ac_cv_func_gnu_get_libc_version,
3365     [AC_TRY_LINK([
3366         #ifdef HAVE_GNU_LIBC_VERSION_H
3367         #include <gnu/libc-version.h>
3368         #endif
3369         ],
3370         [const char *glibc_version = gnu_get_libc_version();],
3371         [ac_cv_func_gnu_get_libc_version=yes],
3372         [ac_cv_func_gnu_get_libc_version=no]
3373         )]
3374     )
3376 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3377     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3380 case $target_os in
3381     darwin*|mingw*|os2*)
3382         ;;
3383     *)
3385 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3386     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3387         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3388 _SAVE_LIBS=$LIBS
3389 LIBS="$LIBS $_ICONV_LIBS"
3390 AC_CACHE_CHECK(
3391     [for iconv()],
3392     ac_cv_func_iconv,
3393     [AC_TRY_LINK([
3394         #include <stdlib.h>
3395         #include <iconv.h>
3396         ],
3397         [
3398             iconv_t h = iconv_open("", "");
3399             iconv(h, NULL, NULL, NULL, NULL);
3400             iconv_close(h);
3401         ],
3402         [ac_cv_func_iconv=yes],
3403         [ac_cv_func_iconv=no]
3404         )]
3405     )
3406 if test "$ac_cv_func_iconv" = "yes"; then
3407     AC_DEFINE(HAVE_ICONV)
3408     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3409     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3410     LIBICONV="$_ICONV_LIBS"
3411     AC_CACHE_CHECK(
3412         [for iconv() with const input],
3413         ac_cv_func_const_iconv,
3414         [AC_TRY_COMPILE([
3415             #include <stdlib.h>
3416             #include <iconv.h>
3417             ],
3418             [
3419                 const char *input = "testing";
3420                 iconv_t h = iconv_open("", "");
3421                 iconv(h, &input, NULL, NULL, NULL);
3422                 iconv_close(h);
3423             ],
3424             [ac_cv_func_const_iconv=yes],
3425             [ac_cv_func_const_iconv=no]
3426             )]
3427         )
3428     if test "$ac_cv_func_const_iconv" = "yes"; then
3429         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3430     fi
3432 LIBS=$_SAVE_LIBS
3434     ;;
3435 esac
3437 AM_LANGINFO_CODESET
3439 AC_LANG_C
3441 dnl **********************
3442 dnl *** va_copy checks ***
3443 dnl **********************
3444 dnl we currently check for all three va_copy possibilities, so we get
3445 dnl all results in config.log for bug reports.
3446 AC_MSG_CHECKING(for an implementation of va_copy())
3447 AC_CACHE_VAL(ac_cv_va_copy,[
3448     AC_TRY_RUN([
3449         #include <stdarg.h>
3450         void f (int i, ...) {
3451             va_list args1, args2;
3452             va_start (args1, i);
3453             va_copy (args2, args1);
3454             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3455                 exit (1);
3456             va_end (args1); va_end (args2);
3457         }
3458         int main() { f (0, 42); return 0; }],
3459         ac_cv_va_copy=yes,
3460         ac_cv_va_copy=no,
3461         ac_cv_va_copy=no
3462     )
3464 AC_MSG_RESULT($ac_cv_va_copy)
3465 AC_MSG_CHECKING(for an implementation of __va_copy())
3466 AC_CACHE_VAL(ac_cv___va_copy,[
3467     AC_TRY_RUN([
3468         #include <stdarg.h>
3469         void f (int i, ...) {
3470             va_list args1, args2;
3471             va_start (args1, i);
3472             __va_copy (args2, args1);
3473             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3474                 exit (1);
3475             va_end (args1); va_end (args2);
3476         }
3477         int main() { f (0, 42); return 0; }],
3478         ac_cv___va_copy=yes,
3479         ac_cv___va_copy=no,
3480         ac_cv___va_copy=no
3481     )
3483 AC_MSG_RESULT($ac_cv___va_copy)
3484 AC_MSG_CHECKING(whether va_lists can be copied by value)
3485 AC_CACHE_VAL(ac_cv_va_val_copy,[
3486     AC_TRY_RUN([
3487         #include <stdarg.h>
3488         void f (int i, ...) {
3489             va_list args1, args2;
3490             va_start (args1, i);
3491             args2 = args1;
3492             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3493                 exit (1);
3494             va_end (args1); va_end (args2);
3495         }
3496         int main() { f (0, 42); return 0; }],
3497         ac_cv_va_val_copy=yes,
3498         ac_cv_va_val_copy=no,
3499         ac_cv_va_val_copy=yes
3500     )
3502 if test "x$ac_cv_va_copy" = "xyes"; then
3503     AC_DEFINE(VA_COPY, va_copy)
3504     AC_DEFINE(HAVE_VA_COPY)
3505 elif test "x$ac_cv___va_copy" = "xyes"; then
3506     AC_DEFINE(VA_COPY, __va_copy)
3507     AC_DEFINE(HAVE_VA_COPY)
3510 if test "x$ac_cv_va_val_copy" = "xno"; then
3511    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3513 AC_MSG_RESULT($ac_cv_va_val_copy)
3515 dnl ===================================================================
3516 dnl ========================================================
3517 dnl Put your C++ language/feature checks below
3518 dnl ========================================================
3519 AC_LANG_CPLUSPLUS
3521 ARM_ABI_PREFIX=
3522 if test "$GNU_CC"; then
3523   if test "$CPU_ARCH" = "arm" ; then
3524     AC_CACHE_CHECK(for ARM EABI,
3525         ac_cv_gcc_arm_eabi,
3526         [AC_TRY_COMPILE([],
3527                         [
3528 #if defined(__ARM_EABI__)
3529   return 0;
3530 #else
3531 #error Not ARM EABI.
3532 #endif
3533                         ],
3534                         ac_cv_gcc_arm_eabi="yes",
3535                         ac_cv_gcc_arm_eabi="no")])
3536     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3537         HAVE_ARM_EABI=1
3538         ARM_ABI_PREFIX=eabi-
3539     else
3540         ARM_ABI_PREFIX=oabi-
3541     fi
3542   fi
3544   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3547 dnl Check to see if we can resolve ambiguity with |using|.
3548 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3549                ac_cv_cpp_ambiguity_resolving_using,
3550                [AC_TRY_COMPILE(class X {
3551                                  public: int go(const X&) {return 3;}
3552                                          int jo(const X&) {return 3;}
3553                                };
3554                                class Y : public X {
3555                                  public:  int go(int) {return 2;}
3556                                           int jo(int) {return 2;}
3557                                           using X::jo;
3558                                  private: using X::go;
3559                                };,
3560                                X x; Y y; y.jo(x);,
3561                                ac_cv_cpp_ambiguity_resolving_using=yes,
3562                                ac_cv_cpp_ambiguity_resolving_using=no)])
3563 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3564    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3567 dnl See if a dynamic_cast to void* gives the most derived object.
3568 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3569                ac_cv_cpp_dynamic_cast_void_ptr,
3570                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3571                             class Y { int j; public: virtual ~Y() { } };
3572                             class Z : public X, public Y { int k; };
3574                             int main() {
3575                                  Z mdo;
3576                                  X *subx = (X*)&mdo;
3577                                  Y *suby = (Y*)&mdo;
3578                                  return !((((void*)&mdo != (void*)subx) &&
3579                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3580                                           (((void*)&mdo != (void*)suby) &&
3581                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3582                             }],
3583                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3584                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3585                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3586 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3587    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3591 dnl note that this one is reversed - if the test fails, then
3592 dnl we require implementations of unused virtual methods. Which
3593 dnl really blows because it means we'll have useless vtable
3594 dnl bloat.
3595 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3596                ac_cv_cpp_unused_required,
3597                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3598                                X x;,
3599                                ac_cv_cpp_unused_required=no,
3600                                ac_cv_cpp_unused_required=yes)])
3601 if test "$ac_cv_cpp_unused_required" = yes ; then
3602    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3606 dnl Some compilers have trouble comparing a constant reference to a templatized
3607 dnl class to zero, and require an explicit operator==() to be defined that takes
3608 dnl an int. This test separates the strong from the weak.
3610 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3611                ac_cv_trouble_comparing_to_zero,
3612                [AC_TRY_COMPILE([#include <algorithm>
3613                                 template <class T> class Foo {};
3614                                 class T2;
3615                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3616                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3617                                [Foo<int> f; return (0 != f);],
3618                                ac_cv_trouble_comparing_to_zero=no,
3619                                ac_cv_trouble_comparing_to_zero=yes)])
3620 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3621   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3624 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3625 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3626 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3627 # linking XUL.
3628 _SAVE_LDFLAGS=$LDFLAGS
3629 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3630 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3631                ac_cv_thread_keyword,
3632                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3633                             [return tlsIsMainThread;],
3634                             ac_cv_thread_keyword=yes,
3635                             ac_cv_thread_keyword=no)])
3636 LDFLAGS=$_SAVE_LDFLAGS
3637 # The custom dynamic linker doesn't support TLS variables
3638 MOZ_TLS=
3639 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3640   # mips builds fail with TLS variables because of a binutils bug.
3641   # See bug 528687
3642   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3643   case "${target}" in
3644     mips*-*)
3645       :
3646       ;;
3647     *-android*|*-linuxandroid*)
3648       :
3649       ;;
3650     *-openbsd*)
3651       :
3652       ;;
3653     *)
3654       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3655       MOZ_TLS=1
3656       ;;
3657   esac
3660 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3661 if test -n "$MOZ_LINKER"; then
3662   if test "$CPU_ARCH" = arm; then
3663     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3664     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3665       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3666       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3667     fi
3668   fi
3671 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3672 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3673 dnl We however want to avoid these text relocations, and this can be done
3674 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3675 dnl doesn't contain anything at all, beside placeholders for some sections,
3676 dnl and crtbegin only contains a finalizer function that calls
3677 dnl __cxa_finalize. The custom linker actually takes care of calling
3678 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3679 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3680 dnl link crtbegin and crtend at all.
3681 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3682   AC_CACHE_CHECK([whether the CRT objects have text relocations],
3683     ac_cv_crt_has_text_relocations,
3684     [echo 'int foo() { return 0; }' > conftest.cpp
3685      if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3686         test -s conftest${DLL_SUFFIX}; then
3687        if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3688          ac_cv_crt_has_text_relocations=yes
3689        else
3690          ac_cv_crt_has_text_relocations=no
3691        fi
3692      else
3693        AC_ERROR([couldn't compile a simple C file])
3694      fi
3695      rm -rf conftest*])
3696   if test "$ac_cv_crt_has_text_relocations" = yes; then
3697     dnl While we want libraries to skip the CRT files, we don't want
3698     dnl executables to be treated the same way. We thus set the flag
3699     dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3700     dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3701     dnl Using LDFLAGS in nspr is safe, since we only really build
3702     dnl libraries there.
3703     DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3704     NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3705   fi
3708 dnl Check for the existence of various allocation headers/functions
3710 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3711 MALLOC_H=
3713 for file in $MALLOC_HEADERS; do
3714   MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3715   if test "$MALLOC_H" != ""; then
3716     AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3717     break
3718   fi
3719 done
3721 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3722 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3724 AC_CHECK_FUNCS(malloc_usable_size)
3726 dnl See if compiler supports some gcc-style attributes
3728 AC_CACHE_CHECK(for __attribute__((always_inline)),
3729                ac_cv_attribute_always_inline,
3730                [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3731                                [],
3732                                ac_cv_attribute_always_inline=yes,
3733                                ac_cv_attribute_always_inline=no)])
3735 AC_CACHE_CHECK(for __attribute__((malloc)),
3736                ac_cv_attribute_malloc,
3737                [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3738                                [],
3739                                ac_cv_attribute_malloc=yes,
3740                                ac_cv_attribute_malloc=no)])
3742 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3743                ac_cv_attribute_warn_unused,
3744                [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3745                                [],
3746                                ac_cv_attribute_warn_unused=yes,
3747                                ac_cv_attribute_warn_unused=no)])
3749 dnl End of C++ language/feature checks
3750 AC_LANG_C
3752 dnl ========================================================
3753 dnl =  Internationalization checks
3754 dnl ========================================================
3756 dnl Internationalization and Locale support is different
3757 dnl on various UNIX platforms.  Checks for specific i18n
3758 dnl features go here.
3760 dnl check for LC_MESSAGES
3761 AC_CACHE_CHECK(for LC_MESSAGES,
3762                 ac_cv_i18n_lc_messages,
3763                 [AC_TRY_COMPILE([#include <locale.h>],
3764                                 [int category = LC_MESSAGES;],
3765                                 ac_cv_i18n_lc_messages=yes,
3766                                 ac_cv_i18n_lc_messages=no)])
3767 if test "$ac_cv_i18n_lc_messages" = yes; then
3768    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3771 AC_HAVE_FUNCS(localeconv)
3772 fi # ! SKIP_COMPILER_CHECKS
3774 TARGET_XPCOM_ABI=
3775 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3776     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3779 dnl Mozilla specific options
3780 dnl ========================================================
3781 dnl The macros used for command line options
3782 dnl are defined in build/autoconf/altoptions.m4.
3784 dnl If the compiler supports these attributes, define them as
3785 dnl convenience macros.
3786 if test "$ac_cv_attribute_malloc" = yes ; then
3787   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3788 else
3789   AC_DEFINE(NS_ATTR_MALLOC,)
3792 if test "$ac_cv_attribute_warn_unused" = yes ; then
3793   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3794 else
3795   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3798 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3799 dnl features that Windows actually does support.
3801 if test -n "$SKIP_COMPILER_CHECKS"; then
3802    dnl Windows has malloc.h
3803    AC_DEFINE(MALLOC_H, [<malloc.h>])
3804    AC_DEFINE(HAVE_FORCEINLINE)
3805    AC_DEFINE(HAVE_LOCALECONV)
3806 fi # SKIP_COMPILER_CHECKS
3808 dnl ========================================================
3809 dnl =
3810 dnl = Check for external package dependencies
3811 dnl =
3812 dnl ========================================================
3813 MOZ_ARG_HEADER(External Packages)
3815 MOZ_ARG_WITH_STRING(libxul-sdk,
3816 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
3817   LIBXUL_SDK_DIR=$withval)
3819 if test "$LIBXUL_SDK_DIR" = "yes"; then
3820     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3821 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3822     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3824     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3825         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3826     fi
3829 AC_SUBST(LIBXUL_SDK)
3831 if test -n "$LIBXUL_SDK"; then
3832     LIBXUL_DIST="$LIBXUL_SDK"
3833 else
3834     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3836 AC_SUBST(LIBXUL_DIST)
3838 SYSTEM_LIBXUL=
3840 MOZ_ARG_WITH_BOOL(system-libxul,
3841 [  --with-system-libxul    Use system installed libxul SDK],
3842     SYSTEM_LIBXUL=1)
3844 dnl ========================================================
3845 dnl = If NSPR was not detected in the system,
3846 dnl = use the one in the source tree (mozilla/nsprpub)
3847 dnl ========================================================
3848 MOZ_ARG_WITH_BOOL(system-nspr,
3849 [  --with-system-nspr      Use system installed NSPR],
3850     _USE_SYSTEM_NSPR=1 )
3852 if test -n "$_USE_SYSTEM_NSPR"; then
3853     AM_PATH_NSPR(4.9.6, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
3856 if test -n "$MOZ_NATIVE_NSPR"; then
3857     _SAVE_CFLAGS=$CFLAGS
3858     CFLAGS="$CFLAGS $NSPR_CFLAGS"
3859     AC_TRY_COMPILE([#include "prtypes.h"],
3860                 [#ifndef PR_STATIC_ASSERT
3861                  #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3862                  #endif],
3863                 [MOZ_NATIVE_NSPR=1],
3864                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3865     AC_TRY_COMPILE([#include "prtypes.h"],
3866                 [#ifndef PR_UINT64
3867                  #error PR_UINT64 not defined or requires including prtypes.h
3868                  #endif],
3869                 [MOZ_NATIVE_NSPR=1],
3870                 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3871     CFLAGS=$_SAVE_CFLAGS
3872 else
3873     if test -z "$LIBXUL_SDK"; then
3874         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3875         if test -n "$GNU_CC"; then
3876             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3877         else
3878             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3879         fi
3880     else
3881         NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3882         NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3883     fi
3886 dnl set GRE_MILESTONE
3887 dnl ========================================================
3888 if test -n "$LIBXUL_SDK"; then
3889     GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3890 else
3891     GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3893 AC_SUBST(GRE_MILESTONE)
3895 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3896 # The logic works like this:
3897 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3898 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3899 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3900 case "$GRE_MILESTONE" in
3901   *a1*)
3902       NIGHTLY_BUILD=1
3903       AC_DEFINE(NIGHTLY_BUILD)
3904       ;;
3905   *a*)
3906       ;;
3907   *)
3908       RELEASE_BUILD=1
3909       AC_DEFINE(RELEASE_BUILD)
3910       ;;
3911 esac
3912 AC_SUBST(NIGHTLY_BUILD)
3913 AC_SUBST(RELEASE_BUILD)
3915 dnl system libevent Support
3916 dnl ========================================================
3917 MOZ_ARG_WITH_STRING(system-libevent,
3918 [  --with-system-libevent[=PFX]
3919                           Use system libevent [installed at prefix PFX]],
3920     LIBEVENT_DIR=$withval)
3922 _SAVE_CFLAGS=$CFLAGS
3923 _SAVE_LDFLAGS=$LDFLAGS
3924 _SAVE_LIBS=$LIBS
3925 if test "$LIBEVENT_DIR" = yes; then
3926     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3927         MOZ_NATIVE_LIBEVENT=1,
3928         LIBEVENT_DIR=/usr)
3930 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3931     MOZ_NATIVE_LIBEVENT=
3932 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3933     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3934     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3935     MOZ_CHECK_HEADER(event.h,
3936         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3937              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3938          fi],
3939         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3940     AC_CHECK_LIB(event, event_init,
3941                  [MOZ_NATIVE_LIBEVENT=1
3942                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3943                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3944                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3946 CFLAGS=$_SAVE_CFLAGS
3947 LDFLAGS=$_SAVE_LDFLAGS
3948 LIBS=$_SAVE_LIBS
3950 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3951 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
3952 AC_SUBST(MOZ_LIBEVENT_LIBS)
3954 dnl ========================================================
3955 dnl = If NSS was not detected in the system,
3956 dnl = use the one in the source tree (mozilla/security/nss)
3957 dnl ========================================================
3959 MOZ_ARG_WITH_BOOL(system-nss,
3960 [  --with-system-nss       Use system installed NSS],
3961     _USE_SYSTEM_NSS=1 )
3963 if test -n "$_USE_SYSTEM_NSS"; then
3964     AM_PATH_NSS(3.15, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3967 if test -n "$MOZ_NATIVE_NSS"; then
3968    NSS_LIBS="$NSS_LIBS -lcrmf"
3969 else
3970    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3972    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
3973        NSS_LIBS="\
3974         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3975         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3976         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3977         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3978         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3979    else
3980        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3981    fi
3984 dnl ======================
3985 dnl Detect yasm
3986 dnl ======================
3988 AC_MSG_CHECKING([for YASM assembler])
3989 AC_CHECK_PROGS(YASM, yasm, "")
3991 if test -n "$YASM"; then
3992   dnl Pull out yasm's version string
3993   YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3994   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3995   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3996   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3997   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4000 if test -z "$SKIP_LIBRARY_CHECKS"; then
4001 dnl system JPEG support
4002 dnl ========================================================
4003 MOZ_ARG_WITH_STRING(system-jpeg,
4004 [  --with-system-jpeg[=PFX]
4005                           Use system libjpeg [installed at prefix PFX]],
4006     JPEG_DIR=$withval)
4008 _SAVE_CFLAGS=$CFLAGS
4009 _SAVE_LDFLAGS=$LDFLAGS
4010 _SAVE_LIBS=$LIBS
4011 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4012     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4013     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4015 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4016     MOZ_NATIVE_JPEG=
4017 else
4018     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
4021 if test "$MOZ_NATIVE_JPEG" = 1; then
4022     AC_TRY_COMPILE([ #include <stdio.h>
4023                      #include <sys/types.h>
4024                      #include <jpeglib.h> ],
4025                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4026                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4027                      #endif
4028                      #ifndef JCS_EXTENSIONS
4029                      #error "libjpeg-turbo JCS_EXTENSIONS required"
4030                      #endif
4031                      ],
4032                    MOZ_NATIVE_JPEG=1,
4033                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
4035 CFLAGS=$_SAVE_CFLAGS
4036 LDFLAGS=$_SAVE_LDFLAGS
4037 LIBS=$_SAVE_LIBS
4039 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
4040     MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
4041     MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
4043 fi # SKIP_LIBRARY_CHECKS
4045 dnl system ZLIB support
4046 dnl ========================================================
4047 MOZ_ZLIB_CHECK([1.2.3])
4049 if test "$MOZ_NATIVE_ZLIB" != 1; then
4050     MOZ_ZLIB_CFLAGS=
4051     MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
4054 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
4055     AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4058 if test -z "$SKIP_LIBRARY_CHECKS"; then
4059 dnl system BZIP2 Support
4060 dnl ========================================================
4061 MOZ_ARG_WITH_STRING(system-bz2,
4062 [  --with-system-bz2[=PFX]
4063                           Use system libbz2 [installed at prefix PFX]],
4064     BZ2_DIR=$withval)
4066 _SAVE_CFLAGS=$CFLAGS
4067 _SAVE_LDFLAGS=$LDFLAGS
4068 _SAVE_LIBS=$LIBS
4069 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4070     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4071     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4073 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4074     MOZ_NATIVE_BZ2=
4075 else
4076     AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
4077         [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
4079 CFLAGS=$_SAVE_CFLAGS
4080 LDFLAGS=$_SAVE_LDFLAGS
4081 LIBS=$_SAVE_LIBS
4083 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
4084     MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
4085     MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4088 dnl system PNG Support
4089 dnl ========================================================
4090 MOZ_ARG_WITH_STRING(system-png,
4091 [  --with-system-png[=PFX]
4092                           Use system libpng [installed at prefix PFX]],
4093     PNG_DIR=$withval)
4095 _SAVE_CFLAGS=$CFLAGS
4096 _SAVE_LDFLAGS=$LDFLAGS
4097 _SAVE_LIBS=$LIBS
4098 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4099     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4100     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4102 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4103     MOZ_NATIVE_PNG=
4104 else
4105     AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
4106                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4107     AC_CHECK_LIB(png, png_get_acTL, ,
4108                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
4110 if test "$MOZ_NATIVE_PNG" = 1; then
4111     AC_TRY_COMPILE([ #include <stdio.h>
4112                      #include <sys/types.h>
4113                      #include <png.h> ],
4114                    [ #if PNG_LIBPNG_VER < $MOZPNG
4115                      #error "Insufficient libpng version ($MOZPNG required)."
4116                      #endif
4117                      #ifndef PNG_UINT_31_MAX
4118                      #error "Insufficient libpng version."
4119                      #endif ],
4120                    MOZ_NATIVE_PNG=1,
4121                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4123 CFLAGS=$_SAVE_CFLAGS
4124 LDFLAGS=$_SAVE_LDFLAGS
4125 LIBS=$_SAVE_LIBS
4127 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
4128     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
4129     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
4132 fi # SKIP_LIBRARY_CHECKS
4134 dnl system HunSpell Support
4135 dnl ========================================================
4136 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4137 [  --enable-system-hunspell
4138                           Use system hunspell (located with pkgconfig)],
4139     MOZ_NATIVE_HUNSPELL=1 )
4141 if test -n "$MOZ_NATIVE_HUNSPELL"; then
4142     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4145 AC_SUBST(MOZ_NATIVE_HUNSPELL)
4147 dnl ========================================================
4148 dnl system libffi Support
4149 dnl ========================================================
4150 MOZ_ARG_ENABLE_BOOL(system-ffi,
4151 [  --enable-system-ffi       Use system libffi (located with pkgconfig)],
4152     MOZ_NATIVE_FFI=1 )
4154 if test -n "$MOZ_NATIVE_FFI"; then
4155     # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4156     # for non-GCC compilers.
4157     if test -z "$GNU_CC"; then
4158         PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4159     else
4160         PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4161     fi
4162     MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4165 dnl ========================================================
4166 dnl Java SDK support
4167 dnl ========================================================
4169 JAVA_BIN_PATH=
4170 MOZ_ARG_WITH_STRING(java-bin-path,
4171 [  --with-java-bin-path=dir
4172                           Location of Java binaries (java, javac, jar)],
4173     JAVA_BIN_PATH=$withval)
4175 dnl ========================================================
4176 dnl =
4177 dnl = Application
4178 dnl =
4179 dnl ========================================================
4181 MOZ_ARG_HEADER(Application)
4183 ENABLE_TESTS=1
4184 ENABLE_SYSTEM_EXTENSION_DIRS=1
4185 MOZ_BRANDING_DIRECTORY=
4186 MOZ_OFFICIAL_BRANDING=
4187 MOZ_FEEDS=1
4188 MOZ_WEBAPP_RUNTIME=
4189 MOZ_JSDEBUGGER=1
4190 MOZ_AUTH_EXTENSION=1
4191 MOZ_OGG=1
4192 MOZ_RAW=
4193 MOZ_SPEEX_RESAMPLER=1
4194 MOZ_SOUNDTOUCH=1
4195 MOZ_CUBEB=
4196 MOZ_VORBIS=
4197 MOZ_TREMOR=
4198 MOZ_WAVE=1
4199 MOZ_SAMPLE_TYPE_FLOAT32=
4200 MOZ_SAMPLE_TYPE_S16=
4201 MOZ_OPUS=1
4202 MOZ_WEBM=1
4203 MOZ_DASH=
4204 MOZ_WMF=
4205 MOZ_WEBRTC=1
4206 MOZ_PEERCONNECTION=
4207 MOZ_SRTP=
4208 MOZ_WEBRTC_SIGNALING=
4209 MOZ_WEBRTC_IN_LIBXUL=
4210 MOZ_WEBRTC_ASSERT_ALWAYS=1
4211 MOZ_SCTP=
4212 MOZ_MEDIA_PLUGINS=
4213 MOZ_MEDIA_NAVIGATOR=
4214 MOZ_OMX_PLUGIN=
4215 MOZ_VP8=
4216 MOZ_VP8_ERROR_CONCEALMENT=
4217 MOZ_VP8_ENCODER=
4218 MOZ_WEBSPEECH=1
4219 VPX_AS=
4220 VPX_ASFLAGS=
4221 VPX_AS_DASH_C_FLAG=
4222 VPX_AS_CONVERSION=
4223 VPX_ASM_SUFFIX=
4224 VPX_X86_ASM=
4225 VPX_ARM_ASM=
4226 LIBJPEG_TURBO_AS=
4227 LIBJPEG_TURBO_ASFLAGS=
4228 LIBJPEG_TURBO_X86_ASM=
4229 LIBJPEG_TURBO_X64_ASM=
4230 LIBJPEG_TURBO_ARM_ASM=
4231 MOZ_PANGO=1
4232 MOZ_PERMISSIONS=1
4233 MOZ_PLACES=1
4234 MOZ_SOCIAL=1
4235 MOZ_PREF_EXTENSIONS=1
4236 MOZ_PROFILELOCKING=1
4237 MOZ_PSM=1
4238 MOZ_REFLOW_PERF=
4239 MOZ_SAFE_BROWSING=
4240 MOZ_HELP_VIEWER=
4241 MOZ_SPELLCHECK=1
4242 MOZ_ANDROID_OMTC=
4243 MOZ_ONLY_TOUCH_EVENTS=
4244 MOZ_TOOLKIT_SEARCH=1
4245 MOZ_UI_LOCALE=en-US
4246 MOZ_UNIVERSALCHARDET=1
4247 MOZ_URL_CLASSIFIER=
4248 MOZ_XUL=1
4249 MOZ_ZIPWRITER=1
4250 NS_PRINTING=1
4251 MOZ_PDF_PRINTING=
4252 MOZ_DISABLE_CRYPTOLEGACY=
4253 NSS_DISABLE_DBM=
4254 NECKO_WIFI=1
4255 NECKO_COOKIES=1
4256 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4257 USE_ARM_KUSER=
4258 BUILD_CTYPES=1
4259 MOZ_USE_NATIVE_POPUP_WINDOWS=
4260 MOZ_ANDROID_HISTORY=
4261 MOZ_WEBSMS_BACKEND=
4262 MOZ_ANDROID_WALLPAPER=
4263 MOZ_ANDROID_BEAM=
4264 ACCESSIBILITY=1
4265 MOZ_TIME_MANAGER=
4266 MOZ_PAY=
4267 MOZ_AUDIO_CHANNEL_MANAGER=
4268 NSS_NO_LIBPKIX=
4270 case "$target_os" in
4271     mingw*)
4272         NS_ENABLE_TSF=1
4273         AC_DEFINE(NS_ENABLE_TSF)
4274         ;;
4275 esac
4277 case "${target}" in
4278     *-android*|*-linuxandroid*)
4279         if test "$CPU_ARCH" = "arm" ; then
4280           USE_ARM_KUSER=1
4281         fi
4283         NSS_DISABLE_DBM=1
4284         if test -z "$gonkdir"; then
4285           NECKO_WIFI=
4286         else
4287           NECKO_WIFI=1
4288         fi
4289         MOZ_THEME_FASTSTRIPE=1
4290         MOZ_TREE_FREETYPE=1
4291         MOZ_MEMORY=1
4292         MOZ_RAW=1
4293         ;;
4295 esac
4297 MOZ_ARG_WITH_STRING(external-source-dir,
4298 [  --with-external-source-dir=dir
4299                           External directory containing additional build files.],
4300 [ EXTERNAL_SOURCE_DIR=$withval])
4301 AC_SUBST(EXTERNAL_SOURCE_DIR)
4303 MOZ_ARG_ENABLE_STRING(application,
4304 [  --enable-application=APP
4305                           Options include:
4306                             browser (Firefox)
4307                             xulrunner
4308                             tools/update-packaging (AUS-related packaging tools)],
4309 [ MOZ_BUILD_APP=$enableval ] )
4311 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4312 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4313   XULRUNNER_STUB_NAME=$withval)
4315 if test -z "$XULRUNNER_STUB_NAME"; then
4316   case "$target_os" in
4317   darwin*)
4318     XULRUNNER_STUB_NAME=xulrunner
4319     ;;
4320   *)
4321     XULRUNNER_STUB_NAME=xulrunner-stub
4322   esac
4324 AC_SUBST(XULRUNNER_STUB_NAME)
4326 AC_MSG_CHECKING([for application to build])
4327 if test -z "$MOZ_BUILD_APP"; then
4328   AC_MSG_RESULT([browser])
4329   MOZ_BUILD_APP=browser
4330 else
4331   # "mobile" no longer exists.
4332   if test "$MOZ_BUILD_APP" = "mobile" ; then
4333     AC_MSG_RESULT([none])
4334     AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
4335   fi
4336   # We have a valid application only if it has a build.mk file in its top
4337   # directory.
4338   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4339     AC_MSG_RESULT([none])
4340     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4341   else
4342     AC_MSG_RESULT([$MOZ_BUILD_APP])
4343   fi
4346 # The app update channel is 'default' when not supplied. The value is used in
4347 # the application's confvars.sh so it must be set before confvars.sh is called.
4348 MOZ_ARG_ENABLE_STRING([update-channel],
4349 [  --enable-update-channel=CHANNEL
4350                           Select application update channel (default=default)],
4351     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4353 if test -z "$MOZ_UPDATE_CHANNEL"; then
4354     MOZ_UPDATE_CHANNEL=default
4356 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4357 AC_SUBST(MOZ_UPDATE_CHANNEL)
4359 # Allow the application to influence configure with a confvars.sh script.
4360 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4361 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4362   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4363   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4364 else
4365   AC_MSG_RESULT([no])
4368 # Allow influencing configure with a defines.sh script.
4369 . "${srcdir}/build/defines.sh"
4371 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
4372 # set in defines.sh
4373 if test "$BUILDING_RELEASE"; then
4374   # Override value in defines.sh, if any
4375   EARLY_BETA_OR_EARLIER=
4376 elif test "$EARLY_BETA_OR_EARLIER"; then
4377   AC_DEFINE(EARLY_BETA_OR_EARLIER)
4379 AC_SUBST(EARLY_BETA_OR_EARLIER)
4381 # Allow the application to provide a subconfigure script
4382 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4383   do_output_subdirs() {
4384     if test -n "$_subconfigure_subdirs"; then
4385       AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4386      fi
4387     _subconfigure_subdir="$1"
4388     _subconfigure_config_args="$ac_configure_args"
4389   }
4390   tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4391   m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4392      "${srcdir}/build/autoconf/altoptions.m4" \
4393      "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4394   . $tmpscript
4395   rm -f $tmpscript
4398 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4399 MOZ_ARG_WITH_STRING(app-name,
4400 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4401 WITH_APP_NAME=$withval,
4404 if test -n "$WITH_APP_NAME" ; then
4405     MOZ_APP_NAME="$WITH_APP_NAME"
4408 MOZ_ARG_WITH_STRING(app-basename,
4409 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4410 WITH_APP_BASENAME=$withval,
4413 if test -n "$WITH_APP_BASENAME" ; then
4414     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4417 # Now is a good time to test for logic errors, define mismatches, etc.
4418 case "$MOZ_BUILD_APP" in
4419 xulrunner)
4420   if test "$LIBXUL_SDK"; then
4421     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4422   fi
4423   ;;
4424 esac
4426 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4427 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4428 # MOZ_BUILD_APP.
4429 case "$MOZ_BUILD_APP" in
4430 browser)
4431   AC_DEFINE(MOZ_PHOENIX)
4432   ;;
4434 xulrunner)
4435   AC_DEFINE(MOZ_XULRUNNER)
4436   ;;
4437 b2g)
4438   AC_DEFINE(MOZ_B2G)
4439   ;;
4440 esac
4442 AC_SUBST(MOZ_BUILD_APP)
4443 AC_SUBST(MOZ_PHOENIX)
4444 AC_SUBST(MOZ_XULRUNNER)
4445 AC_SUBST(MOZ_B2G)
4447 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4449 dnl ========================================================
4450 dnl Check android sdk version depending on mobile target
4451 dnl ========================================================
4453 if test -z "$gonkdir" ; then
4454     # Minimum Android SDK API Level we require.
4455     case "$MOZ_BUILD_APP" in
4456     mobile/android)
4457         android_min_api_level=16
4458         ;;
4459     esac
4461     MOZ_ANDROID_SDK($android_min_api_level)
4464 dnl ========================================================
4465 dnl =
4466 dnl = Toolkit Options
4467 dnl =
4468 dnl ========================================================
4469 MOZ_ARG_HEADER(Toolkit Options)
4471     dnl ========================================================
4472     dnl = Select the default toolkit
4473     dnl ========================================================
4474         MOZ_ARG_ENABLE_STRING(default-toolkit,
4475         [  --enable-default-toolkit=TK
4476                           Select default toolkit
4477                           Platform specific defaults:
4478                             Mac OS X - cairo-cocoa
4479                             OS/2 - cairo-os2
4480                             Win32 - cairo-windows
4481                             * - cairo-gtk2
4482                             * - cairo-gtk3
4483                             * - cairo-qt],
4484     [ _DEFAULT_TOOLKIT=$enableval ],
4485     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4487     if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4488         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4489         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4490         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4491         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4492         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4493         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4494         -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4495         -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4496         -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4497     then
4498         dnl nglayout only supports building with one toolkit,
4499         dnl so ignore everything after the first comma (",").
4500         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4501     else
4502         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4503     fi
4505 MOZ_ARG_WITHOUT_BOOL(x,
4506 [  --without-x              Build without X11],
4507     WITHOUT_X11=1)
4509 dnl ========================================================
4510 dnl = Enable the toolkit as needed                         =
4511 dnl ========================================================
4513 MOZ_WIDGET_GTK=
4515 case "$MOZ_WIDGET_TOOLKIT" in
4517 cairo-windows)
4518     MOZ_WIDGET_TOOLKIT=windows
4519     MOZ_WEBGL=1
4520     MOZ_PDF_PRINTING=1
4521     MOZ_INSTRUMENT_EVENT_LOOP=1
4522     if test -n "$GNU_CC"; then
4523         MOZ_FOLD_LIBS=
4524     fi
4525     ;;
4527 cairo-gtk3)
4528     MOZ_WIDGET_TOOLKIT=gtk3
4529     MOZ_ENABLE_GTK=1
4530     MOZ_ENABLE_GTK3=1
4531     MOZ_ENABLE_XREMOTE=1
4532     MOZ_WEBGL=1
4533     MOZ_GL_DEFAULT_PROVIDER=GLX
4535     AC_DEFINE(MOZ_X11)
4536     MOZ_X11=1
4537     USE_FC_FREETYPE=1
4539     TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4540     TK_LIBS='$(MOZ_GTK3_LIBS)'
4541     MOZ_WIDGET_GTK=3
4542     AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4543     MOZ_PDF_PRINTING=1
4544     MOZ_INSTRUMENT_EVENT_LOOP=1
4545     ;;
4547 cairo-gtk2|cairo-gtk2-x11)
4548     MOZ_WIDGET_TOOLKIT=gtk2
4549     MOZ_ENABLE_GTK=1
4550     MOZ_ENABLE_GTK2=1
4551     MOZ_ENABLE_XREMOTE=1
4552     MOZ_WEBGL=1
4553     MOZ_GL_DEFAULT_PROVIDER=GLX
4555     AC_DEFINE(MOZ_X11)
4556     MOZ_X11=1
4557     USE_FC_FREETYPE=1
4559     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4560     TK_LIBS='$(MOZ_GTK2_LIBS)'
4561     AC_DEFINE(MOZ_WIDGET_GTK2)
4562     MOZ_WIDGET_GTK=2
4563     AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4564     MOZ_PDF_PRINTING=1
4565     MOZ_INSTRUMENT_EVENT_LOOP=1
4566     ;;
4568 cairo-qt)
4569     MOZ_WIDGET_TOOLKIT=qt
4570     MOZ_ENABLE_QT=1
4571     if test -z "$WITHOUT_X11"; then
4572       MOZ_ENABLE_XREMOTE=1
4573       MOZ_GL_DEFAULT_PROVIDER=GLX
4574       MOZ_X11=1
4575       AC_DEFINE(MOZ_X11)
4576       XT_LIBS=
4577     fi
4579     MOZ_WEBGL=1
4580     USE_ELF_DYNSTR_GC=
4581     USE_FC_FREETYPE=1
4582     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4583     TK_LIBS='$(MOZ_QT_LIBS)'
4584     AC_DEFINE(MOZ_WIDGET_QT)
4585     MOZ_PDF_PRINTING=1
4586     AC_DEFINE(QT_NO_KEYWORDS)
4587     ;;
4589 cairo-os2)
4590     MOZ_WIDGET_TOOLKIT=os2
4591     USE_FC_FREETYPE=1
4592     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4593     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4594     MOZ_PDF_PRINTING=1
4595     ;;
4597 cairo-cocoa)
4598     MOZ_WIDGET_TOOLKIT=cocoa
4599     AC_DEFINE(MOZ_WIDGET_COCOA)
4600     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4601     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4602     TK_CFLAGS="-DNO_X11"
4603     CFLAGS="$CFLAGS $TK_CFLAGS"
4604     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4605     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc'
4606     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc'
4607     MOZ_USER_DIR="Mozilla"
4608     MOZ_FS_LAYOUT=bundle
4609     MOZ_WEBGL=1
4610     MOZ_INSTRUMENT_EVENT_LOOP=1
4611     ;;
4613 cairo-uikit)
4614     MOZ_WIDGET_TOOLKIT=uikit
4615     AC_DEFINE(MOZ_WIDGET_UIKIT)
4616     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4617     TK_CFLAGS="-DNO_X11"
4618     TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4619     CFLAGS="$CFLAGS $TK_CFLAGS"
4620     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4621     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc'
4622     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc'
4623     MOZ_USER_DIR="Mozilla"
4624     MOZ_FS_LAYOUT=bundle
4625     ;;
4627 cairo-android)
4628     AC_DEFINE(MOZ_WIDGET_ANDROID)
4629     MOZ_WIDGET_TOOLKIT=android
4630     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4631     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4632     MOZ_WEBGL=1
4633     MOZ_PDF_PRINTING=1
4634     MOZ_INSTRUMENT_EVENT_LOOP=1
4635     ;;
4637 cairo-gonk)
4638     AC_DEFINE(MOZ_WIDGET_GONK)
4639     AC_DEFINE(MOZ_TOUCH)
4640     MOZ_WIDGET_TOOLKIT=gonk
4641     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4642     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4643     MOZ_WEBGL=1
4644     MOZ_PDF_PRINTING=1
4645     MOZ_TOUCH=1
4646     ;;
4648 esac
4650 AC_SUBST(MOZ_PDF_PRINTING)
4651 if test "$MOZ_PDF_PRINTING"; then
4652    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4653    AC_DEFINE(MOZ_PDF_PRINTING)
4656 if test "$MOZ_ENABLE_XREMOTE"; then
4657     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4660 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4661    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4664 if test "$COMPILE_ENVIRONMENT"; then
4665   if test "$MOZ_ENABLE_GTK3"; then
4666     PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4667   fi
4668   if test "$MOZ_ENABLE_GTK2"; then
4669     if test "$MOZ_X11"; then
4670       GDK_PACKAGES=gdk-x11-2.0
4671     fi
4673     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4674   fi
4676 fi # COMPILE_ENVIRONMENT
4678 AC_SUBST(MOZ_FS_LAYOUT)
4680 dnl ========================================================
4681 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4682 dnl their usage and use them in spidermonkey.
4683 dnl ========================================================
4684 MOZ_ARG_WITH_BOOL(arm-kuser,
4685 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4686     USE_ARM_KUSER=1,)
4687 if test -n "$USE_ARM_KUSER"; then
4688    AC_DEFINE(USE_ARM_KUSER)
4691 dnl ========================================================
4692 dnl = startup-notification support module
4693 dnl ========================================================
4695 if test "$MOZ_ENABLE_GTK"
4696 then
4697     MOZ_ENABLE_STARTUP_NOTIFICATION=
4699     MOZ_ARG_ENABLE_BOOL(startup-notification,
4700     [  --enable-startup-notification
4701                           Enable startup-notification support (default: disabled) ],
4702         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4703         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4704     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4705     then
4706         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4707                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4708         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4709             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4710             then
4711                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4712             fi
4713             MOZ_ENABLE_STARTUP_NOTIFICATION=
4714         ])
4715     fi
4717     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4718         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4719     fi
4721     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4723 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4724 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4725 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4727 dnl ========================================================
4728 dnl = QT support
4729 dnl ========================================================
4730 if test "$MOZ_ENABLE_QT"
4731 then
4732     MOZ_ARG_WITH_STRING(qtdir,
4733     [  --with-qtdir=\$dir       Specify Qt directory ],
4734     [ QTDIR=$withval])
4736     if test -z "$QTDIR"; then
4737         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
4738         PKG_CHECK_MODULES(MOZ_QT5, Qt5Widgets Qt5Multimedia Qt5PrintSupport,
4739                       MOZ_ENABLE_QT5=1,
4740                       MOZ_ENABLE_QT5=)
4741         if test "$MOZ_ENABLE_QT5"; then
4742             echo "Using qt5"
4743             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
4744             MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
4745         fi
4747         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4748         AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4749     else
4750         MOZ_QT_CFLAGS="-DQT_SHARED"
4751         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4752         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4753         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4754         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4755         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4756         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4758         # QtWidgets was introduced only in Qt5
4759         if test -d $QTDIR/include/QtWidgets; then
4760             echo "Using qt5"
4761             MOZ_QT_LIBS="-L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml -lQt5OpenGL"
4762             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/5.0.1/QtGui"
4763             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4764             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4765             MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4766         else
4767             MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4768             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4769         fi
4770         HOST_MOC="$QTDIR/bin/moc"
4771         HOST_RCC="$QTDIR/bin/rcc"
4772     fi
4773     if test -z "$HOST_MOC"; then
4774         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4775 incorrect])
4776     fi
4777     if test -z "$HOST_RCC"; then
4778         AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4779 incorrect])
4780     fi
4782     MOC=$HOST_MOC
4783     RCC=$HOST_RCC
4785     MOZ_ENABLE_QMSYSTEM2=
4786     PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4787                       MOZ_ENABLE_QMSYSTEM2=1,
4788                       MOZ_ENABLE_QMSYSTEM2=)
4790     if test "$MOZ_ENABLE_QMSYSTEM2"; then
4791       MOZ_ENABLE_QMSYSTEM2=1
4792       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4793       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4794       AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4795     fi
4797     MOZ_ENABLE_QTNETWORK=
4798     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4799                       MOZ_ENABLE_QTNETWORK=1,
4800                       MOZ_ENABLE_QTNETWORK=)
4802     if test "$MOZ_ENABLE_QTNETWORK"; then
4803       MOZ_ENABLE_QTNETWORK=1
4804       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4805     fi
4807     MOZ_ENABLE_QTMOBILITY=
4808     PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4809                       MOZ_ENABLE_QTMOBILITY=1,
4810                       MOZ_ENABLE_QTMOBILITY=)
4811     if test "$MOZ_ENABLE_QTMOBILITY"; then
4812        MOZ_ENABLE_QTMOBILITY=1
4813        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4814        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4815     else
4816        AC_CHECK_LIB(QtSensors, main, [
4817           MOZ_ENABLE_QTMOBILITY=1
4818           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4819           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4820           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4821           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4822           MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4823        ])
4824     fi
4825     if test "$MOZ_ENABLE_QTMOBILITY"; then
4826        AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4827     fi
4830 AC_SUBST(GTK_CONFIG)
4831 AC_SUBST(TK_CFLAGS)
4832 AC_SUBST(TK_LIBS)
4834 AC_SUBST(MOZ_ENABLE_GTK2)
4835 AC_SUBST(MOZ_ENABLE_GTK3)
4836 AC_SUBST(MOZ_ENABLE_GTK)
4837 AC_SUBST(MOZ_ENABLE_QT)
4838 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4839 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4840 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4841 AC_SUBST(MOZ_ENABLE_XREMOTE)
4842 AC_SUBST(MOZ_GTK2_CFLAGS)
4843 AC_SUBST(MOZ_GTK2_LIBS)
4844 AC_SUBST(MOZ_GTK3_CFLAGS)
4845 AC_SUBST(MOZ_GTK3_LIBS)
4846 AC_SUBST(MOZ_WIDGET_GTK)
4847 AC_SUBST(MOZ_QT_CFLAGS)
4848 AC_SUBST(MOZ_QT_LIBS)
4850 AC_SUBST(MOC)
4851 AC_SUBST(RCC)
4853 AC_SUBST(MOZ_X11)
4855 dnl ========================================================
4856 dnl =
4857 dnl = Components & Features
4858 dnl =
4859 dnl ========================================================
4860 MOZ_ARG_HEADER(Components and Features)
4862 dnl ========================================================
4863 dnl = Localization
4864 dnl ========================================================
4865 MOZ_ARG_ENABLE_STRING(ui-locale,
4866 [  --enable-ui-locale=ab-CD
4867                           Select the user interface locale (default: en-US)],
4868     MOZ_UI_LOCALE=$enableval )
4869 AC_SUBST(MOZ_UI_LOCALE)
4871 dnl ========================================================
4872 dnl = Trademarked Branding
4873 dnl ========================================================
4874 MOZ_ARG_ENABLE_BOOL(official-branding,
4875 [  --enable-official-branding
4876                           Enable Official mozilla.org Branding
4877                           Do not distribute builds with
4878                           --enable-official-branding unless you have
4879                           permission to use trademarks per
4880                           http://www.mozilla.org/foundation/trademarks/ .],
4882   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4883     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4884   else
4885     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4886     MOZ_OFFICIAL_BRANDING=1
4887   fi
4888 ], MOZ_OFFICIAL_BRANDING=)
4890 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4891 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4892   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4895 MOZ_ARG_WITH_STRING(branding,
4896 [  --with-branding=dir     Use branding from the specified directory.],
4897     MOZ_BRANDING_DIRECTORY=$withval)
4899 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4900 if test -z "$REAL_BRANDING_DIRECTORY"; then
4901   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4904 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4905   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4908 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4910 dnl ========================================================
4911 dnl = Distribution ID
4912 dnl ========================================================
4913 MOZ_ARG_WITH_STRING(distribution-id,
4914 [  --with-distribution-id=ID
4915                           Set distribution-specific id (default=org.mozilla)],
4916 [ val=`echo $withval`
4917     MOZ_DISTRIBUTION_ID="$val"])
4919 if test -z "$MOZ_DISTRIBUTION_ID"; then
4920    MOZ_DISTRIBUTION_ID="org.mozilla"
4923 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4924 AC_SUBST(MOZ_DISTRIBUTION_ID)
4927 dnl ========================================================
4928 dnl complex text support off by default
4929 dnl ========================================================
4930 MOZ_ARG_DISABLE_BOOL(pango,
4931 [  --disable-pango         Disable usage of Pango ],
4932     MOZ_PANGO=,
4933     MOZ_PANGO=1)
4935 dnl ========================================================
4936 dnl = Pango
4937 dnl ========================================================
4938 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4939 then
4940     AC_SUBST(MOZ_PANGO)
4942     if test "$MOZ_PANGO"
4943     then
4944         PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4946         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4947         AC_SUBST(MOZ_PANGO_CFLAGS)
4948         AC_SUBST(MOZ_PANGO_LIBS)
4949         AC_DEFINE(MOZ_PANGO)
4950     else
4951         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
4952         AC_SUBST(FT2_CFLAGS)
4953         AC_SUBST(FT2_LIBS)
4954     fi
4957 dnl ========================================================
4958 dnl = GnomeVFS, GIO and GConf support module
4959 dnl ========================================================
4961 if test "$MOZ_X11"
4962 then
4963     dnl build the GIO extension by default only when the
4964     dnl GTK2 toolkit is in use.
4965     if test "$MOZ_ENABLE_GTK"
4966     then
4967         MOZ_ENABLE_GIO=1
4968         MOZ_ENABLE_GCONF=1
4969     fi
4971     dnl ========================================================
4972     dnl = GnomeVFS support module
4973     dnl ========================================================
4974     MOZ_ARG_ENABLE_BOOL(gnomevfs,
4975     [  --enable-gnomevfs       Enable GnomeVFS support (default: disabled)],
4976         MOZ_ENABLE_GNOMEVFS=force,
4977         MOZ_ENABLE_GNOMEVFS=)
4979     if test "$MOZ_ENABLE_GNOMEVFS"
4980     then
4981         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4982             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4983             MOZ_ENABLE_GNOMEVFS=1
4984             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4985         ],[
4986             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4987             then
4988                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4989             fi
4990             MOZ_ENABLE_GNOMEVFS=
4991         ])
4992     fi
4994     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4995     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4996     AC_SUBST(MOZ_GNOMEVFS_LIBS)
4998     dnl ========================================================
4999     dnl = GIO support module
5000     dnl ========================================================
5001     MOZ_ARG_DISABLE_BOOL(gio,
5002     [  --disable-gio           Disable GIO support],
5003         MOZ_ENABLE_GIO=,
5004         MOZ_ENABLE_GIO=force)
5006     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
5007     then
5008         PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
5009                           [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
5010         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5011             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5012             MOZ_ENABLE_GIO=1
5013             AC_DEFINE(MOZ_ENABLE_GIO)
5014         ],[
5015             if test "$MOZ_ENABLE_GIO" = "force"
5016             then
5017                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5018             fi
5019             MOZ_ENABLE_GIO=
5020         ])
5021     fi
5023     AC_SUBST(MOZ_ENABLE_GIO)
5024     AC_SUBST(MOZ_GIO_CFLAGS)
5025     AC_SUBST(MOZ_GIO_LIBS)
5027     dnl ========================================================
5028     dnl = GConf support module
5029     dnl ========================================================
5030     MOZ_ARG_DISABLE_BOOL(gconf,
5031     [  --disable-gconf      Disable Gconf support ],
5032         MOZ_ENABLE_GCONF=,
5033         MOZ_ENABLE_GCONF=force)
5035     if test "$MOZ_ENABLE_GCONF"
5036     then
5037         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5038             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
5039             MOZ_ENABLE_GCONF=1
5040         ],[
5041             if test "$MOZ_ENABLE_GCONF" = "force"
5042             then
5043                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5044             fi
5045             MOZ_ENABLE_GCONF=
5046         ])
5047     fi
5049     if test "$MOZ_ENABLE_GCONF"; then
5050         AC_DEFINE(MOZ_ENABLE_GCONF)
5051     fi
5053     AC_SUBST(MOZ_ENABLE_GCONF)
5054     AC_SUBST(MOZ_GCONF_CFLAGS)
5055     AC_SUBST(MOZ_GCONF_LIBS)
5058 dnl ========================================================
5059 dnl = libproxy support
5060 dnl ========================================================
5062 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
5063 then
5064     MOZ_ENABLE_LIBPROXY=
5066     MOZ_ARG_ENABLE_BOOL(libproxy,
5067     [  --enable-libproxy         Enable libproxy support ],
5068     MOZ_ENABLE_LIBPROXY=1,
5069     MOZ_ENABLE_LIBPROXY=)
5071     if test "$MOZ_ENABLE_LIBPROXY"
5072     then
5073         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5074         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5075     fi
5077 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5078 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5079 AC_SUBST(MOZ_LIBPROXY_LIBS)
5081 dnl ========================================================
5082 dnl = GNOME component (mozgnome)
5083 dnl ========================================================
5085 if test "$MOZ_ENABLE_GTK2"
5086 then
5087     MOZ_ENABLE_GNOME_COMPONENT=1
5089 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5091 dnl ========================================================
5092 dnl = libgnomeui support module
5093 dnl ========================================================
5095 if test "$MOZ_ENABLE_GTK"
5096 then
5097     MOZ_ARG_ENABLE_BOOL(gnomeui,
5098     [  --enable-gnomeui        Enable libgnomeui instead of GIO & GTK for icon theme support ],
5099         MOZ_ENABLE_GNOMEUI=force,
5100         MOZ_ENABLE_GNOMEUI=)
5102     if test "$MOZ_ENABLE_GNOMEUI"
5103     then
5104         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5105         [
5106             MOZ_ENABLE_GNOMEUI=1
5107         ],[
5108             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5109             then
5110                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5111             fi
5112             MOZ_ENABLE_GNOMEUI=
5113         ])
5114     fi
5116     if test "$MOZ_ENABLE_GNOMEUI"; then
5117         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5118     fi
5121 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5122 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5124 dnl ========================================================
5125 dnl = dbus support
5126 dnl ========================================================
5128 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
5129 then
5130     MOZ_ENABLE_DBUS=1
5132     MOZ_ARG_DISABLE_BOOL(dbus,
5133     [  --disable-dbus          Disable dbus support ],
5134         MOZ_ENABLE_DBUS=,
5135         MOZ_ENABLE_DBUS=1)
5137     if test "$MOZ_ENABLE_DBUS"
5138     then
5139         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5140         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5141         AC_DEFINE(MOZ_ENABLE_DBUS)
5142     fi
5144 AC_SUBST(MOZ_ENABLE_DBUS)
5145 AC_SUBST(MOZ_DBUS_CFLAGS)
5146 AC_SUBST(MOZ_DBUS_LIBS)
5147 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5148 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5150 dnl ========================================================
5151 dnl = Enable Android History instead of Places
5152 dnl ========================================================
5153 if test -n "$MOZ_ANDROID_HISTORY"; then
5154     if test -z "$MOZ_PLACES"; then
5155         AC_DEFINE(MOZ_ANDROID_HISTORY)
5156     else
5157         AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
5158     fi
5161 dnl ========================================================
5162 dnl = Build with the Android compositor
5163 dnl ========================================================
5164 if test -n "$MOZ_ANDROID_OMTC"; then
5165      dnl Do this if defined in confvars.sh
5166      AC_DEFINE(MOZ_ANDROID_OMTC)
5169 dnl ========================================================
5170 dnl = Disable WebSMS backend
5171 dnl ========================================================
5172 MOZ_ARG_DISABLE_BOOL(websms-backend,
5173 [  --disable-websms-backend
5174                            Disable WebSMS backend],
5175     MOZ_WEBSMS_BACKEND=,
5176     MOZ_WEBSMS_BACKEND=1)
5178 if test -n "$MOZ_WEBSMS_BACKEND"; then
5179     AC_DEFINE(MOZ_WEBSMS_BACKEND)
5182 dnl ========================================================
5183 dnl = Enable SET_WALLPAPER permission on Android
5184 dnl ========================================================
5185 if test -n "$MOZ_ANDROID_WALLPAPER"; then
5186     AC_DEFINE(MOZ_ANDROID_WALLPAPER)
5189 dnl ========================================================
5190 dnl = Enable NFC permission on Android
5191 dnl ========================================================
5192 if test -n "$MOZ_ANDROID_BEAM"; then
5193     AC_DEFINE(MOZ_ANDROID_BEAM)
5196 dnl ========================================================
5197 dnl = Build Personal Security Manager
5198 dnl ========================================================
5199 MOZ_ARG_DISABLE_BOOL(crypto,
5200 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5201     MOZ_PSM=,
5202     MOZ_PSM=1 )
5204 dnl ========================================================
5205 dnl = JS Debugger XPCOM component (js/jsd)
5206 dnl ========================================================
5207 MOZ_ARG_DISABLE_BOOL(jsd,
5208 [  --disable-jsd           Disable JavaScript debug library],
5209     MOZ_JSDEBUGGER=,
5210     MOZ_JSDEBUGGER=1)
5213 dnl ========================================================
5214 dnl = Enable IPDL's "expensive" unit tests
5215 dnl ========================================================
5216 MOZ_IPDL_TESTS=
5218 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5219 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5220     MOZ_IPDL_TESTS=1,
5221     MOZ_IPDL_TESTS=)
5223 if test -n "$MOZ_IPDL_TESTS"; then
5224     AC_DEFINE(MOZ_IPDL_TESTS)
5227 AC_SUBST(MOZ_IPDL_TESTS)
5229 dnl ========================================================
5230 dnl = Disable building dbm
5231 dnl ========================================================
5232 MOZ_ARG_DISABLE_BOOL(dbm,
5233 [  --disable-dbm           Disable building dbm],
5234     NSS_DISABLE_DBM=1,
5235     NSS_DISABLE_DBM=)
5237 dnl bi-directional support always on
5238 IBMBIDI=1
5239 AC_DEFINE(IBMBIDI)
5241 dnl ========================================================
5242 dnl accessibility support on by default on all platforms
5243 dnl ========================================================
5244 MOZ_ARG_DISABLE_BOOL(accessibility,
5245 [  --disable-accessibility Disable accessibility support],
5246     ACCESSIBILITY=,
5247     ACCESSIBILITY=1 )
5248 if test "$ACCESSIBILITY"; then
5249     case "$target" in
5250     *-mingw*)
5251         if test -z "$MIDL"; then
5252             if test "$GCC" != "yes"; then
5253                 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5254             else
5255                 AC_MSG_ERROR([You have accessibility enabled, but widl could not be found. Add --disable-accessibility to your mozconfig or install widl. See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details.])
5256             fi
5257         fi
5258     esac
5259     AC_DEFINE(ACCESSIBILITY)
5262 dnl ========================================================
5263 dnl Accessibility is required for the linuxgl widget
5264 dnl backend
5265 dnl ========================================================
5266 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5267     AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5270 dnl ========================================================
5271 dnl Disable printing
5272 dnl ========================================================
5273 MOZ_ARG_DISABLE_BOOL(printing,
5274 [  --disable-printing      Disable printing support],
5275     NS_PRINTING=,
5276     NS_PRINTING=1)
5278 if test "$NS_PRINTING"; then
5279     AC_DEFINE(NS_PRINTING)
5280     AC_DEFINE(NS_PRINT_PREVIEW)
5283 dnl Turn off webrtc for OS's we don't handle yet, but allow 
5284 dnl --enable-webrtc to override.  Can disable for everything in
5285 dnl the master list above.
5286 if test -n "$MOZ_WEBRTC"; then
5287     case "$target" in
5288     *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*)
5289         dnl Leave enabled
5290         ;;
5291     *)
5292         dnl default to disabled for all others
5293         MOZ_WEBRTC=
5294         ;;
5295     esac
5298 # target_arch is from {ia32|x64|arm|ppc}
5299 case "$CPU_ARCH" in
5300 x86_64 | ia64)
5301     WEBRTC_TARGET_ARCH=x64
5302     ;;
5304 arm*)
5305     WEBRTC_TARGET_ARCH=arm
5306     ;;
5308 x86)
5309     WEBRTC_TARGET_ARCH=ia32
5310     ;;
5312 ppc*)
5313     WEBRTC_TARGET_ARCH=ppc
5314     ;;
5316 # unsupported arch for webrtc
5317     WEBRTC_TARGET_ARCH=unknown
5318     MOZ_WEBRTC=
5319     ;;
5321 esac
5323 dnl ========================================================
5324 dnl = Disable WebRTC code
5325 dnl ========================================================
5326 MOZ_ARG_DISABLE_BOOL(webrtc,
5327 [  --disable-webrtc        Disable support for WebRTC],
5328     MOZ_WEBRTC=,
5329     MOZ_WEBRTC=1)
5331 if test -n "$MOZ_WEBRTC"; then
5332     AC_DEFINE(MOZ_WEBRTC)
5333     dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
5334     dnl opt/production builds (via MOZ_CRASH())
5335     AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
5336     MOZ_RAW=1
5337     MOZ_VP8=1
5338     MOZ_VP8_ENCODER=1
5339     MOZ_VP8_ERROR_CONCEALMENT=1
5341 dnl enable once Signaling lands
5342     MOZ_WEBRTC_SIGNALING=1
5343     AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5344     if test "${OS_TARGET}" = "WINNT"; then
5345         MOZ_WEBRTC_IN_LIBXUL=1
5346     fi
5347 dnl enable once PeerConnection lands
5348     MOZ_PEERCONNECTION=1
5349     AC_DEFINE(MOZ_PEERCONNECTION)
5350     MOZ_SCTP=1
5351     MOZ_SRTP=1
5352     AC_DEFINE(MOZ_SCTP)
5353     AC_DEFINE(MOZ_SRTP)
5356 AC_SUBST(MOZ_WEBRTC)
5357 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5358 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5359 AC_SUBST(MOZ_PEERCONNECTION)
5360 AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
5361 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5362 AC_SUBST(MOZ_SCTP)
5363 AC_SUBST(MOZ_SRTP)
5365 case "$target_cpu" in
5366 arm*)
5367     MOZ_SAMPLE_TYPE_S16=1
5368     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5369     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5372     MOZ_SAMPLE_TYPE_FLOAT32=1
5373     AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5374     AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5376 esac
5378 dnl ========================================================
5379 dnl = Disable Speech API code
5380 dnl ========================================================
5381 MOZ_ARG_DISABLE_BOOL(webspeech,
5382 [  --disable-webspeech        Disable support for HTML Speech API],
5383     MOZ_WEBSPEECH=,
5384     MOZ_WEBSPEECH=1)
5386 if test -n "$MOZ_WEBSPEECH"; then
5387     AC_DEFINE(MOZ_WEBSPEECH)
5390 AC_SUBST(MOZ_WEBSPEECH)
5392 dnl ========================================================
5393 dnl = Enable Raw Codecs
5394 dnl ========================================================
5395 MOZ_ARG_ENABLE_BOOL(raw,
5396 [  --enable-raw           Enable support for RAW media],
5397     MOZ_RAW=1,
5398     MOZ_RAW=)
5400 if test -n "$MOZ_RAW"; then
5401     AC_DEFINE(MOZ_RAW)
5404 AC_SUBST(MOZ_RAW)
5406 dnl ========================================================
5407 dnl = Disable Ogg Codecs
5408 dnl ========================================================
5409 MOZ_ARG_DISABLE_BOOL(ogg,
5410 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5411     MOZ_OGG=,
5412     MOZ_OGG=1)
5414 if test -n "$MOZ_OGG"; then
5415     AC_DEFINE(MOZ_OGG)
5416     MOZ_CUBEB=1
5418     dnl Checks for __attribute__(aligned()) directive
5419     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5420         [ac_cv_c_attribute_aligned],
5421         [ac_cv_c_attribute_aligned=0
5422          CFLAGS_save="${CFLAGS}"
5423          CFLAGS="${CFLAGS} -Werror"
5424          for ac_cv_c_attr_align_try in 64 32 16 8; do
5425            echo "trying $ac_cv_c_attr_align_try"
5426            AC_TRY_COMPILE([],
5427                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5428                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5429            if test "$ac_cv_c_attribute_aligned" != 0; then
5430              break;
5431            fi
5432          done
5433            CFLAGS="${CFLAGS_save}"])
5434     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5435       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5436                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5437     fi
5440 dnl ========================================================
5441 dnl = Disable Opus audio codec support
5442 dnl ========================================================
5443 MOZ_ARG_DISABLE_BOOL(opus,
5444 [  --disable-opus          Disable support for Opus audio],
5445     MOZ_OPUS=,
5446     MOZ_OPUS=1)
5448 dnl ========================================================
5449 dnl = Disable VP8 decoder support
5450 dnl ========================================================
5451 MOZ_ARG_DISABLE_BOOL(webm,
5452 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5453     MOZ_WEBM=,
5454     MOZ_WEBM=1)
5456 if test -n "$MOZ_WEBM"; then
5457     AC_DEFINE(MOZ_WEBM)
5458     MOZ_VP8=1
5461 dnl ========================================================
5462 dnl = Windows Media Foundation support
5463 dnl ========================================================
5464 if test "$OS_ARCH" = "WINNT"; then
5465     dnl Enable Windows Media Foundation support by default.
5466     dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5467     dnl guaranteed to have a recent-enough SDK to build WMF.
5468     MOZ_WMF=1
5471 MOZ_ARG_DISABLE_BOOL(wmf,
5472 [  --disable-wmf  Disable support for Windows Media Foundation],
5473     MOZ_WMF=,
5474     MOZ_WMF=1)
5476 if test -n "$MOZ_WMF"; then
5477     AC_DEFINE(MOZ_WMF)
5478     MOZ_CUBEB=1
5481 dnl ========================================================
5482 dnl = Enable media plugin support
5483 dnl ========================================================
5484 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5485   dnl Enable support on android by default
5486   MOZ_MEDIA_PLUGINS=1
5489 MOZ_ARG_ENABLE_BOOL(media-plugins,
5490 [  --enable-media-plugins  Enable support for media plugins],
5491     MOZ_MEDIA_PLUGINS=1,
5492     MOZ_MEDIA_PLUGINS=)
5494 if test -n "$MOZ_MEDIA_PLUGINS"; then
5495   AC_DEFINE(MOZ_MEDIA_PLUGINS)
5498 dnl ========================================================
5499 dnl = Enable getUserMedia support
5500 dnl ========================================================
5501 MOZ_ARG_ENABLE_BOOL(media-navigator,
5502 [  --enable-media-navigator  Enable support for getUserMedia],
5503     MOZ_MEDIA_NAVIGATOR=1,
5504     MOZ_MEDIA_NAVIGATOR=)
5506 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5507   AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5510 dnl ========================================================
5511 dnl = Enable building OMX media plugin (B2G or Android)
5512 dnl ========================================================
5513 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5514   dnl Enable support on android by default
5515   MOZ_OMX_PLUGIN=1
5518 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5519 [  --enable-omx-plugin      Enable building OMX plugin (B2G)],
5520     MOZ_OMX_PLUGIN=1,
5521     MOZ_OMX_PLUGIN=)
5523 if test -n "$MOZ_OMX_PLUGIN"; then
5524     if test "$OS_TARGET" = "Android"; then
5525         dnl Only allow building OMX plugin on Gonk (B2G) or Android
5526         AC_DEFINE(MOZ_OMX_PLUGIN)
5527     else
5528        dnl fail if we're not building on Gonk or Android
5529        AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5530     fi
5533 dnl system libvpx Support
5534 dnl ========================================================
5535 MOZ_ARG_WITH_BOOL(system-libvpx,
5536 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
5537     MOZ_NATIVE_LIBVPX=1)
5539 MOZ_LIBVPX_CFLAGS=
5540 MOZ_LIBVPX_LIBS=
5542 if test -n "$MOZ_VP8"; then
5543     AC_DEFINE(MOZ_VP8)
5544     if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5545         AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5546     fi
5547     if test -n "$MOZ_VP8_ENCODER" ; then
5548         AC_DEFINE(MOZ_VP8_ENCODER)
5549     fi
5551     if test -n "$MOZ_NATIVE_LIBVPX"; then
5552         dnl ============================
5553         dnl === libvpx Version check ===
5554         dnl ============================
5555         dnl Check to see if we have a system libvpx package.
5556         PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5558         MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [], 
5559          [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.])])
5561         _SAVE_LIBS=$LIBS
5562         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [], 
5563          [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5564         LIBS=$_SAVE_LIBS
5565     fi
5568 AC_SUBST(MOZ_NATIVE_LIBVPX)
5569 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5570 AC_SUBST(MOZ_LIBVPX_LIBS)
5572 if test "$MOZ_WEBM"; then
5573     MOZ_CUBEB=1
5574     if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5575         MOZ_VORBIS=1
5576     else
5577         MOZ_TREMOR=1
5578     fi
5581 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5583     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5584     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5585     dnl We currently require gcc on all arm platforms.
5586     VPX_AS=$YASM
5587     VPX_ASM_SUFFIX=asm
5588     VPX_NEED_OBJ_INT_EXTRACT=
5590     dnl See if we have assembly on this platform.
5591     case "$OS_ARCH:$CPU_ARCH" in
5592     Darwin:x86)
5593       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5594       VPX_X86_ASM=1
5595     ;;
5596     Darwin:x86_64)
5597       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5598       VPX_X86_ASM=1
5599     ;;
5600     WINNT:x86_64)
5601       VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5602       VPX_X86_ASM=1
5603     ;;
5604     WINNT:x86)
5605       dnl Check for yasm 1.1 or greater.
5606       if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5607         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.])
5608       elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5609         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.])
5610       else
5611         VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5612         VPX_X86_ASM=1
5613         dnl The encoder needs obj_int_extract to get asm offsets.
5614       fi
5615     ;;
5616     *:arm*)
5617       if test -n "$GNU_AS" ; then
5618         VPX_AS=$AS
5619         dnl These flags are a lie; they're just used to enable the requisite
5620         dnl opcodes; actual arch detection is done at runtime.
5621         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5622         VPX_DASH_C_FLAG="-c"
5623         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5624         VPX_ASM_SUFFIX="$ASM_SUFFIX"
5625         VPX_ARM_ASM=1
5626       fi
5627     ;;
5628     *:x86)
5629       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5630         VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5631         VPX_X86_ASM=1
5632       fi
5633     ;;
5634     *:x86_64)
5635       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5636         VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5637         VPX_X86_ASM=1
5638       fi
5639     ;;
5640     esac
5642     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5643       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.])
5644     fi
5646     if test -n "$MOZ_VP8_ENCODER" -a \
5647             -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5648       dnl We prefer to get asm offsets using inline assembler, which the above
5649       dnl compilers can do. When we're not using one of those, we have to fall
5650       dnl back to obj_int_extract, which reads them from a compiled object
5651       dnl file. Unfortunately, that only works if we're compiling on a system
5652       dnl with the header files for the appropriate object file format.
5653       VPX_NEED_OBJ_INT_EXTRACT=1
5654     fi
5656     if test -n "$VPX_X86_ASM"; then
5657       AC_DEFINE(VPX_X86_ASM)
5658     elif test -n "$VPX_ARM_ASM"; then
5659       AC_DEFINE(VPX_ARM_ASM)
5660     else
5661       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5662     fi
5665 dnl ========================================================
5666 dnl = Disable Wave decoder support
5667 dnl ========================================================
5668 MOZ_ARG_DISABLE_BOOL(wave,
5669 [  --disable-wave          Disable Wave decoder support],
5670     MOZ_WAVE=,
5671     MOZ_WAVE=1)
5673 if test -n "$MOZ_WAVE"; then
5674     AC_DEFINE(MOZ_WAVE)
5675     MOZ_CUBEB=1
5678 dnl ========================================================
5679 dnl = Handle dependent CUBEB and MEDIA defines
5680 dnl ========================================================
5682 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5683     AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5686 if test -n "$MOZ_SOUNDTOUCH"; then
5687     AC_DEFINE(MOZ_SOUNDTOUCH)
5690 if test -n "$MOZ_CUBEB"; then
5691     AC_DEFINE(MOZ_CUBEB)
5694 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5695     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/])
5698 if test -n "$MOZ_VORBIS"; then
5699     AC_DEFINE(MOZ_VORBIS)
5702 if test -n "$MOZ_TREMOR"; then
5703     AC_DEFINE(MOZ_TREMOR)
5706 if test -n "$MOZ_OPUS"; then
5707     AC_DEFINE(MOZ_OPUS)
5710 dnl ========================================================
5711 dnl = Check alsa availability on Linux if using sydneyaudio
5712 dnl ========================================================
5714 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5715 if test -n "$MOZ_CUBEB" -a "$OS_TARGET" = "Linux"; then
5716     MOZ_ALSA=1
5719 MOZ_ARG_ENABLE_BOOL(alsa,
5720 [  --enable-alsa          Enable Alsa support (default on Linux)],
5721 MOZ_ALSA=1,
5722 MOZ_ALSA=)
5724 if test -n "$MOZ_ALSA"; then
5725     AC_DEFINE(MOZ_CUBEB)
5726     PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5727          [echo "$MOZ_ALSA_PKG_ERRORS"
5728           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.)])])
5731 AC_SUBST(MOZ_ALSA)
5732 AC_SUBST(MOZ_ALSA_CFLAGS)
5733 AC_SUBST(MOZ_ALSA_LIBS)
5735 dnl ========================================================
5736 dnl = Enable PulseAudio
5737 dnl ========================================================
5739 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5740 [  --enable-pulseaudio          Enable PulseAudio support (experimental)],
5741 MOZ_PULSEAUDIO=1,
5742 MOZ_PULSEAUDIO=)
5744 if test -n "$MOZ_PULSEAUDIO"; then
5745     AC_DEFINE(MOZ_CUBEB)
5746     PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5747          [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5748           AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
5751 AC_SUBST(MOZ_PULSEAUDIO)
5752 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5753 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5755 dnl ========================================================
5756 dnl = Enable GStreamer
5757 dnl ========================================================
5758 MOZ_ARG_ENABLE_BOOL(gstreamer,
5759 [  --enable-gstreamer           Enable GStreamer support],
5760 MOZ_GSTREAMER=1,
5761 MOZ_GSTREAMER=)
5763 if test "$MOZ_GSTREAMER"; then
5764     # API version, eg 0.10, 1.0 etc
5765     GST_API_VERSION=0.10
5766     # core/base release number
5767     GST_VERSION=0.10.25
5768     PKG_CHECK_MODULES(GSTREAMER,
5769                       gstreamer-$GST_API_VERSION >= $GST_VERSION
5770                       gstreamer-app-$GST_API_VERSION
5771                       gstreamer-plugins-base-$GST_API_VERSION)
5772     if test -n "$GSTREAMER_LIBS"; then
5773        _SAVE_LDFLAGS=$LDFLAGS
5774        LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5775        AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5776        if test -n "$_HAVE_LIBGSTVIDEO" ; then
5777           GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5778        else
5779           AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
5780        fi
5781        LDFLAGS=$_SAVE_LDFLAGS
5782     else
5783        AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
5784     fi
5786 AC_SUBST(GSTREAMER_CFLAGS)
5787 AC_SUBST(GSTREAMER_LIBS)
5788 AC_SUBST(MOZ_GSTREAMER)
5790 if test -n "$MOZ_GSTREAMER"; then
5791    AC_DEFINE(MOZ_GSTREAMER)
5795 dnl ========================================================
5796 dnl Permissions System
5797 dnl ========================================================
5798 MOZ_ARG_DISABLE_BOOL(permissions,
5799 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5800     MOZ_PERMISSIONS=,
5801     MOZ_PERMISSIONS=1
5804 dnl ========================================================
5805 dnl NegotiateAuth
5806 dnl ========================================================
5807 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5808 [  --disable-negotiateauth Disable GSS-API negotiation ],
5809     MOZ_AUTH_EXTENSION=,
5810     MOZ_AUTH_EXTENSION=1 )
5812 dnl ========================================================
5813 dnl Pref extensions (autoconfig)
5814 dnl ========================================================
5815 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5816 [  --disable-pref-extensions
5817                           Disable pref extensions such as autoconfig],
5818   MOZ_PREF_EXTENSIONS=,
5819   MOZ_PREF_EXTENSIONS=1 )
5821 dnl ========================================================
5822 dnl Searching of system directories for extensions.
5823 dnl Note: this switch is meant to be used for test builds
5824 dnl whose behavior should not depend on what happens to be
5825 dnl installed on the local machine.
5826 dnl ========================================================
5827 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5828 [  --disable-system-extension-dirs
5829                           Disable searching system- and account-global
5830                           directories for extensions of any kind; use
5831                           only profile-specific extension directories],
5832   ENABLE_SYSTEM_EXTENSION_DIRS=,
5833   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5834 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5835   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5838 dnl ========================================================
5839 dnl = Universalchardet
5840 dnl ========================================================
5841 MOZ_ARG_DISABLE_BOOL(universalchardet,
5842 [  --disable-universalchardet
5843                           Disable universal encoding detection],
5844   MOZ_UNIVERSALCHARDET=,
5845   MOZ_UNIVERSALCHARDET=1 )
5847 if test -n "${JAVA_BIN_PATH}"; then
5848   dnl Look for javac and jar in the specified path.
5849   JAVA_PATH="$JAVA_BIN_PATH"
5850 else
5851   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5852   JAVA_PATH="$JAVA_HOME/bin:$PATH"
5855 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5856 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5857 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5858 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5860 if test -n "${JAVA_BIN_PATH}" -o \
5861   \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5862   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAVAH" -o "$JAVAH" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5863     AC_MSG_ERROR([The programs java, javac, javah and jar were not found.  Set \$JAVA_HOME to your java sdk directory or use --with-java-bin-path={java-bin-dir}])
5864   fi
5867 dnl ========================================================
5868 dnl = ANGLE OpenGL->D3D translator for WebGL
5869 dnl = * only applies to win32
5870 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5871 dnl ========================================================
5872 MOZ_ANGLE_RENDERER=
5873 MOZ_DIRECTX_SDK_PATH=
5874 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5875 MOZ_D3DCOMPILER_CAB=
5876 MOZ_D3DCOMPILER_DLL=
5877 case "$target_os" in
5878 *mingw*)
5879     MOZ_ANGLE_RENDERER=1
5880     ;;
5881 esac
5883 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5884 case "${target_cpu}" in
5885 i*86)
5886   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5887   ;;
5888 x86_64)
5889   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5890   ;;
5891 esac
5893 MOZ_ARG_DISABLE_BOOL(webgl,
5894 [  --disable-webgl     Disable building of the WebGL implementation],
5895     MOZ_WEBGL_DISABLED=1,
5896     MOZ_WEBGL_DISABLED=)
5898 if test -n "$MOZ_WEBGL_DISABLED"; then
5899   MOZ_WEBGL=
5900   MOZ_ANGLE_RENDERER=
5903 # Locate a DirectX SDK here so we can use it for both ANGLE and
5904 # Joystick support.
5905 if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
5906   # Get the SDK path from the registry.
5907   # First try to get the June 2010 SDK
5908   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5909   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5910     # Otherwise just take whatever comes first
5911     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5912   fi
5913   MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/' | sed 's,\\\\,/,g'`
5916 if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
5917   if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5918     AC_MSG_ERROR([Found the February 2010 DirectX SDK. Need the June 2010 DirectX SDK, or newer.  Upgrade your SDK or reconfigure with --disable-webgl.])
5919   fi
5921   if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5922      test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5923          test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5924     AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5925   else
5926     AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for WebGL. Either install it (June 2010 version or newer), or reconfigure with --disable-webgl.])
5927   fi
5929   # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5930   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'`
5932   if test -z "$MOZ_D3DX9_VERSION" ; then
5933         AC_MSG_ERROR([Couldn't determine the D3DX9 version, needed for WebGL. Either reinstall the DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5934   fi
5936   MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5938   if test -z "$MOZ_D3DCOMPILER_CAB"; then
5939     AC_MSG_ERROR([Couldn't find the DirectX redistributable files. Either reinstall the DirectX SDK (making sure the "DirectX Redistributable Files" option is selected), or reconfigure with --disable-webgl.])
5940   fi
5942   MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5945 dnl ========================================================
5946 dnl Gamepad support
5947 dnl ========================================================
5948 MOZ_GAMEPAD=
5949 MOZ_GAMEPAD_BACKEND=stub
5951 # Gamepad DOM is built on supported platforms by default.
5952 case "$OS_TARGET" in
5953      Darwin|WINNT|Linux)
5954        MOZ_GAMEPAD=1
5955        ;;
5956      *)
5957        ;;
5958 esac
5960 MOZ_ARG_DISABLE_BOOL(gamepad,
5961 [  --disable-gamepad   Disable gamepad support],
5962     MOZ_GAMEPAD=,
5963     MOZ_GAMEPAD=1)
5965 if test "$MOZ_GAMEPAD"; then
5966     case "$OS_TARGET" in
5967     Darwin)
5968         MOZ_GAMEPAD_BACKEND=cocoa
5969         ;;
5970     WINNT)
5971         if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
5972             if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5973                MOZ_GAMEPAD=
5974             fi
5975         elif test "$GCC" != "yes"; then
5976             MOZ_GAMEPAD=
5977         fi
5978         if test -z "$MOZ_GAMEPAD"; then
5979            AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for gamepad support. Please install it or, reconfigure with --disable-gamepad to disable gamepad support.])
5980         fi
5981         MOZ_GAMEPAD_BACKEND=windows
5982         ;;
5983     Linux)
5984         MOZ_CHECK_HEADER([linux/joystick.h])
5985         if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5986           AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers or reconfigure with --disable-gamepad to disable gamepad support.])
5987         fi
5988         MOZ_GAMEPAD_BACKEND=linux
5989         ;;
5990     *)
5991         ;;
5992    esac
5994   AC_DEFINE(MOZ_GAMEPAD)
5996 AC_SUBST(MOZ_GAMEPAD)
5997 AC_SUBST(MOZ_GAMEPAD_BACKEND)
5999 dnl ========================================================
6000 dnl = Breakpad crash reporting (on by default on supported platforms)
6001 dnl ========================================================
6003 case $target in
6004 i?86-*-mingw*|x86_64-*-mingw*)
6005   MOZ_CRASHREPORTER=1
6006   ;;
6007 i?86-apple-darwin*|x86_64-apple-darwin*)
6008   MOZ_CRASHREPORTER=1
6009   ;;
6010 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6011   if test "$MOZ_ENABLE_GTK"; then
6012     MOZ_CRASHREPORTER=1
6013   fi
6014   ;;
6015 *-android*|*-linuxandroid*)
6016   MOZ_CRASHREPORTER=1
6017   ;;
6018 *solaris*)
6019   MOZ_CRASHREPORTER=1
6020   ;;
6021 esac
6023 MOZ_ARG_DISABLE_BOOL(crashreporter,
6024 [  --disable-crashreporter Disable breakpad crash reporting],
6025     MOZ_CRASHREPORTER=,
6026     MOZ_CRASHREPORTER=1)
6028 if test -n "$MOZ_CRASHREPORTER"; then
6029    AC_DEFINE(MOZ_CRASHREPORTER)
6031   if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
6032     test -z "$SKIP_LIBRARY_CHECKS"; then
6033     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6034     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6035     AC_SUBST(MOZ_GTHREAD_LIBS)
6036   fi
6038   if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
6039     AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.  Use --disable-crashreporter.])
6040   fi
6042   if test "$OS_ARCH" = "WINNT"; then
6043     if test -z "$HAVE_64BIT_OS"; then
6044       MOZ_CRASHREPORTER_INJECTOR=1
6045       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
6046     fi
6047   fi
6049 AC_DEFINE_UNQUOTED(BREAKPAD_CUSTOM_STDINT_H, "mozilla/StandardInteger.h")
6051 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6052 [  --with-crashreporter-enable-percent=NN
6053                           Enable sending crash reports by default on NN% of users. (default=100)],
6054 [ val=`echo $withval | sed 's/[^0-9]//g'`
6055     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6057 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6058    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6060 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6062 dnl ========================================================
6063 dnl = libjpeg-turbo configuration
6064 dnl ========================================================
6065 MOZ_LIBJPEG_TURBO=
6066 if test -z "$MOZ_NATIVE_JPEG"; then
6067     MOZ_LIBJPEG_TURBO=1
6070 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6071 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
6072     MOZ_LIBJPEG_TURBO=,
6073     MOZ_LIBJPEG_TURBO=1)
6075 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6076     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6079 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6080 dnl files.
6082 if test -n "$MOZ_LIBJPEG_TURBO"; then
6084   dnl Do we support libjpeg-turbo on this platform?
6085   case "$OS_ARCH:$OS_TEST" in
6086   Darwin:i?86)
6087     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6088     LIBJPEG_TURBO_X86_ASM=1
6089   ;;
6090   Darwin:x86_64)
6091     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6092     LIBJPEG_TURBO_X64_ASM=1
6093   ;;
6094   WINNT:x86|WINNT:i?86)
6095     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6096     LIBJPEG_TURBO_X86_ASM=1
6097   ;;
6098   WINNT:x86_64)
6099     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6100     LIBJPEG_TURBO_X64_ASM=1
6101   ;;
6102   *:arm*)
6103     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6104     LIBJPEG_TURBO_ARM_ASM=1
6105   ;;
6106   *:x86|*:i?86)
6107     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6108       LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6109       LIBJPEG_TURBO_X86_ASM=1
6110     fi
6111   ;;
6112   *:x86_64)
6113     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6114       LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6115       LIBJPEG_TURBO_X64_ASM=1
6116     fi
6117   ;;
6118   esac
6122 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6123 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6124 dnl it doesn't exist or we have too old of a version.
6125 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6126     LIBJPEG_TURBO_AS=$YASM
6128     if test -z "$LIBJPEG_TURBO_AS" ; then
6129         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.])
6130     fi
6132     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
6133     dnl on Linux and 1.1 or newer everywhere else.
6134     if test "$OS_ARCH" = "Linux" ; then
6135         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
6136             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.])
6137         fi
6138     else
6139         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6140             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.])
6141         fi
6142     fi
6145 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6146 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6147 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6148     echo "Using $AS as the assembler for ARM code."
6149     LIBJPEG_TURBO_AS=$AS
6152 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6153     AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6154 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6155     AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6156 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6157     AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6158 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6159     dnl Warn if we're not building the optimized routines, even though the user
6160     dnl didn't specify --disable-libjpeg-turbo.
6161     AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
6164 dnl ========================================================
6165 dnl = Enable compilation of specific extension modules
6166 dnl ========================================================
6168 MOZ_ARG_ENABLE_STRING(extensions,
6169 [  --enable-extensions     Enable extensions],
6170 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6171     if test "$option" = "yes" -o "$option" = "all"; then
6172         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6173     elif test "$option" = "no" -o "$option" = "none"; then
6174         MOZ_EXTENSIONS=""
6175     elif test "$option" = "default"; then
6176         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6177     elif test `echo "$option" | grep -c \^-` != 0; then
6178         option=`echo $option | sed 's/^-//'`
6179         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6180     else
6181         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6182     fi
6183 done],
6184     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6186 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6187     # Suppress warning on non-X11 platforms
6188     if test -n "$MOZ_X11"; then
6189         AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6190     fi
6191     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6194 dnl Do not build gnomevfs with libxul based apps
6195 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6196     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6199 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6200     # Suppress warning on non-X11 platforms
6201     if test -n "$MOZ_X11"; then
6202         AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6203     fi
6204     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6207 dnl Do not build gio with libxul based apps
6208 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6209     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6212 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6213     MOZ_GIO_COMPONENT=1
6214     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6216 AC_SUBST(MOZ_GIO_COMPONENT)
6218 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6219     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6220     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6223 dnl Remove dupes
6224 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6226 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6227 dnl when trying to build a nonexistent extension.
6228 for extension in $MOZ_EXTENSIONS; do
6229     if test ! -d "${srcdir}/extensions/${extension}"; then
6230         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6231     fi
6232 done
6234 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6235   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6238 dnl ========================================================
6239 dnl Build Freetype in the tree
6240 dnl ========================================================
6241 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6242 [  --enable-tree-freetype  Enable Tree FreeType],
6243     MOZ_TREE_FREETYPE=1,
6244     MOZ_TREE_FREETYPE= )
6245 if test -n "$MOZ_TREE_FREETYPE"; then
6246    if test -n "$_WIN32_MSVC"; then
6247       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6248    fi
6249    AC_DEFINE(MOZ_TREE_FREETYPE)
6250    AC_SUBST(MOZ_TREE_FREETYPE)
6251    MOZ_ENABLE_CAIRO_FT=1
6252    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6253    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6254    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6255    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6256    CAIRO_FT_OSLIBS=''
6257    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6258    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6259    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6260    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6261    AC_SUBST(CAIRO_FT_CFLAGS)
6264 dnl ========================================================
6265 dnl Installer
6266 dnl ========================================================
6267 dnl Abort Windows build if the required major version and
6268 dnl minimum minor version of Unicode NSIS isn't in the path
6269 dnl (unless in case of cross compiling, for which Unicode
6270 dnl is not yet sufficient).
6271 if test "$OS_ARCH" = "WINNT"; then
6272     REQ_NSIS_MAJOR_VER=2
6273     MIN_NSIS_MINOR_VER=46
6274     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensis)
6275     if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6276       AC_MSG_RESULT([yes])
6277       changequote(,)
6278       MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6279       changequote([,])
6280       if test ! "$MAKENSISU_VER" = ""; then
6281           MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6282           MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6283       fi
6284       AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6285       if test "$MAKENSISU_VER" = "" || \
6286          test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6287               ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6288           AC_MSG_RESULT([no])
6289           if test -z "$CROSS_COMPILE"; then
6290             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.])
6291           else
6292             MAKENSISU=
6293           fi
6294       fi
6295     elif test -z "$CROSS_COMPILE"; then
6296       AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path.])
6297     else
6298       MAKENSISU=
6299     fi
6302 dnl ========================================================
6303 dnl Web App Runtime
6304 dnl ========================================================
6305 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6306 [  --disable-webapp-runtime  Disable Web App Runtime],
6307     MOZ_WEBAPP_RUNTIME=,
6308     MOZ_WEBAPP_RUNTIME=1)
6309 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6310     MOZ_WEBAPP_RUNTIME=
6312 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6313     MOZ_WEBAPP_RUNTIME=
6315 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6316 if test "$MOZ_WEBAPP_RUNTIME"; then
6317     AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6320 AC_MSG_CHECKING([for tar archiver])
6321 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6322 if test -z "$TAR"; then
6323     AC_MSG_ERROR([no tar archiver found in \$PATH])
6325 AC_MSG_RESULT([$TAR])
6326 AC_SUBST(TAR)
6328 AC_MSG_CHECKING([for wget])
6329 AC_CHECK_PROGS(WGET, wget, "")
6330 AC_MSG_RESULT([$WGET])
6331 AC_SUBST(WGET)
6333 dnl ========================================================
6334 dnl Signing
6335 dnl ========================================================
6337 if test -n "$MOZ_SIGN_CMD"; then
6338     AC_DEFINE(MOZ_SIGNING)
6341 dnl ========================================================
6342 dnl Maintenance Service
6343 dnl ========================================================
6345 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6346 [  --enable-maintenance-service       Enable building of maintenanceservice],
6347     MOZ_MAINTENANCE_SERVICE=1,
6348     MOZ_MAINTENANCE_SERVICE= )
6350 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6351   if test "$OS_ARCH" = "WINNT"; then
6352     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6353   else
6354     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6355   fi
6358 dnl ========================================================
6359 dnl Verify MAR signatures
6360 dnl ========================================================
6362 MOZ_ARG_ENABLE_BOOL(verify-mar,
6363 [  --enable-verify-mar     Enable verifying MAR signatures],
6364     MOZ_VERIFY_MAR_SIGNATURE=1,
6365     MOZ_VERIFY_MAR_SIGNATURE= )
6367 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6368   if test "$OS_ARCH" = "WINNT"; then
6369     AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6370   else
6371     AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6372   fi
6375 dnl ========================================================
6376 dnl Enable building the signmar program.
6377 dnl This option is much different than the --enable-verify-mar option.
6378 dnl --enable-verify-mar is for enabling the verification check on MAR
6379 dnl files in the updater.  The --enable-signmar option is for building
6380 dnl the signmar program.
6381 dnl ========================================================
6383 MOZ_ARG_ENABLE_BOOL(signmar,
6384 [  --enable-signmar     Enable building the signmar program],
6385     MOZ_ENABLE_SIGNMAR=1,
6386     MOZ_ENABLE_SIGNMAR= )
6388 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6389   AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6392 dnl ========================================================
6393 dnl Updater
6394 dnl ========================================================
6396 MOZ_ARG_DISABLE_BOOL(updater,
6397 [  --disable-updater       Disable building of updater],
6398     MOZ_UPDATER=,
6399     MOZ_UPDATER=1 )
6401 if test -n "$MOZ_UPDATER"; then
6402     AC_DEFINE(MOZ_UPDATER)
6405 # tools/update-packaging is not checked out by default.
6406 MOZ_ARG_ENABLE_BOOL(update-packaging,
6407 [  --enable-update-packaging
6408                           Enable tools/update-packaging],
6409     MOZ_UPDATE_PACKAGING=1,
6410     MOZ_UPDATE_PACKAGING= )
6411 AC_SUBST(MOZ_UPDATE_PACKAGING)
6413 dnl ========================================================
6414 dnl build the tests by default
6415 dnl ========================================================
6416 MOZ_ARG_DISABLE_BOOL(tests,
6417 [  --disable-tests         Do not build test libraries & programs],
6418     ENABLE_TESTS=,
6419     ENABLE_TESTS=1 )
6421 # Currently GTest is linked into libxul. This means it must be off by default.
6422 # Follow up will be to generate libxul.so and libxul-test.so to let GTest
6423 # be compiled along with ENABLE_TESTS
6424 MOZ_ARG_ENABLE_BOOL(gtest,
6425 [  --enable-gtest
6426                           Enable GTest libxul unit test.],
6427     MOZ_ENABLE_GTEST=1,
6428     MOZ_ENABLE_GTEST= )
6430 if test -n "$MOZ_ENABLE_GTEST"; then
6431     if test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "Linux" -o "${OS_TARGET}" = "Android"; then
6432         MOZ_ENABLE_GTEST=1
6433         GTEST_HAS_RTTI=0
6434         AC_DEFINE(MOZ_ENABLE_GTEST)
6435         AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6436         AC_SUBST(MOZ_ENABLE_GTEST)
6437         AC_SUBST(GTEST_HAS_RTTI)
6438     else
6439         AC_MSG_ERROR([Cannot build with --enable-gtest on this platform.])
6440     fi
6441     if test "${OS_TARGET}" = "Android"; then
6442         AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6443         AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6444         AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6445         AC_SUBST(GTEST_OS_LINUX_ANDROID)
6446         AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6447         AC_SUBST(GTEST_HAS_CLONE)
6448     fi
6451 dnl ========================================================
6452 dnl parental controls (for Windows Vista)
6453 dnl ========================================================
6454 MOZ_ARG_DISABLE_BOOL(parental-controls,
6455 [  --disable-parental-controls
6456                           Do not build parental controls],
6457    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6458    MOZ_DISABLE_PARENTAL_CONTROLS=)
6459 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6460     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6463 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6465 dnl ========================================================
6466 dnl = Disable DOMCrypto
6467 dnl ========================================================
6468 if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
6469     AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
6471 AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
6473 dnl ========================================================
6474 dnl = Disable libpkix
6475 dnl ========================================================
6476 if test -n "$NSS_NO_LIBPKIX"; then
6477     AC_DEFINE(NSS_NO_LIBPKIX)
6479 AC_SUBST(NSS_NO_LIBPKIX)
6482 dnl ========================================================
6483 dnl =
6484 dnl = Module specific options
6485 dnl =
6486 dnl ========================================================
6487 MOZ_ARG_HEADER(Individual module options)
6489 dnl ========================================================
6490 dnl = Disable feed handling components
6491 dnl ========================================================
6492 MOZ_ARG_DISABLE_BOOL(feeds,
6493 [  --disable-feeds         Disable feed handling and processing components],
6494     MOZ_FEEDS=,
6495     MOZ_FEEDS=1 )
6496 if test -n "$MOZ_FEEDS"; then
6497     AC_DEFINE(MOZ_FEEDS)
6498 else
6499     if test "$MOZ_BUILD_APP" = "browser"; then
6500         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6501     fi
6504 dnl ========================================================
6505 dnl Check for sqlite
6506 dnl ========================================================
6508 MOZ_NATIVE_SQLITE=
6509 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6510 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6511 MOZ_NATIVE_SQLITE=1,
6512 MOZ_NATIVE_SQLITE= )
6514 if test -z "$MOZ_NATIVE_SQLITE"
6515 then
6516     SQLITE_CFLAGS=
6517     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6518 else
6519     dnl ============================
6520     dnl === SQLite Version check ===
6521     dnl ============================
6522     dnl Check to see if the system SQLite package is new enough.
6523     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6525     dnl ==================================
6526     dnl === SQLITE_SECURE_DELETE check ===
6527     dnl ==================================
6528     dnl Check to see if the system SQLite package is compiled with
6529     dnl SQLITE_SECURE_DELETE enabled.
6530     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6531     _SAVE_CFLAGS="$CFLAGS"
6532     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6533     _SAVE_LIBS="$LIBS"
6534     LIBS="$LIBS $SQLITE_LIBS"
6535     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6536         AC_TRY_RUN([
6537             #include "sqlite3.h"
6539             int main(int argc, char **argv){
6540               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6541             }],
6542             ac_cv_sqlite_secure_delete=yes,
6543             ac_cv_sqlite_secure_delete=no,
6544             ac_cv_sqlite_secure_delete=no
6545         )
6546     ])
6547     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6548     CFLAGS="$_SAVE_CFLAGS"
6549     LIBS="$_SAVE_LIBS"
6550     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6551         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6552     fi
6554     dnl ===============================
6555     dnl === SQLITE_THREADSAFE check ===
6556     dnl ===============================
6557     dnl Check to see if the system SQLite package is compiled with
6558     dnl SQLITE_THREADSAFE enabled.
6559     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6560     _SAVE_CFLAGS="$CFLAGS"
6561     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6562     _SAVE_LIBS="$LIBS"
6563     LIBS="$LIBS $SQLITE_LIBS"
6564     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6565         AC_TRY_RUN([
6566             #include "sqlite3.h"
6568             int main(int argc, char **argv){
6569               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6570             }],
6571             ac_cv_sqlite_threadsafe=yes,
6572             ac_cv_sqlite_threadsafe=no,
6573             ac_cv_sqlite_threadsafe=no
6574         )
6575     ])
6576     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6577     CFLAGS="$_SAVE_CFLAGS"
6578     LIBS="$_SAVE_LIBS"
6579     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6580         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6581     fi
6583     dnl ================================
6584     dnl === SQLITE_ENABLE_FTS3 check ===
6585     dnl ================================
6586     dnl check to see if the system SQLite package is compiled with
6587     dnl SQLITE_ENABLE_FTS3 enabled.
6588     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6589     _SAVE_CFLAGS="$CFLAGS"
6590     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6591     _SAVE_LIBS="$LIBS"
6592     LIBS="$LIBS $SQLITE_LIBS"
6593     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6594         AC_TRY_RUN([
6595             #include "sqlite3.h"
6597             int main(int argc, char **argv){
6598               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6599             }],
6600             ac_cv_sqlite_enable_fts3=yes,
6601             ac_cv_sqlite_enable_fts3=no,
6602             ac_cv_sqlite_enable_fts3=no
6603         )
6604     ])
6605     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6606     CFLAGS="$_SAVE_CFLAGS"
6607     LIBS="$_SAVE_LIBS"
6608     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6609         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6610     fi
6612     dnl =========================================
6613     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6614     dnl =========================================
6615     dnl check to see if the system SQLite package is compiled with
6616     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6617     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6618     _SAVE_CFLAGS="$CFLAGS"
6619     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6620     _SAVE_LIBS="$LIBS"
6621     LIBS="$LIBS $SQLITE_LIBS"
6622     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6623         AC_TRY_RUN([
6624             #include "sqlite3.h"
6626             int main(int argc, char **argv){
6627               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6628             }],
6629             ac_cv_sqlite_enable_unlock_notify=yes,
6630             ac_cv_sqlite_enable_unlock_notify=no,
6631             ac_cv_sqlite_enable_unlock_notify=no
6632         )
6633     ])
6634     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6635     CFLAGS="$_SAVE_CFLAGS"
6636     LIBS="$_SAVE_LIBS"
6637     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6638         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6639     fi
6642 if test -n "$MOZ_NATIVE_SQLITE"; then
6643     AC_DEFINE(MOZ_NATIVE_SQLITE)
6645 AC_SUBST(MOZ_NATIVE_SQLITE)
6647 dnl ========================================================
6648 dnl = Enable help viewer (off by default)
6649 dnl ========================================================
6650 if test -n "$MOZ_HELP_VIEWER"; then
6651      dnl Do this if defined in confvars.sh
6652      AC_DEFINE(MOZ_HELP_VIEWER)
6655 dnl ========================================================
6656 dnl = Enable safe browsing (anti-phishing)
6657 dnl ========================================================
6658 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6659 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6660     MOZ_SAFE_BROWSING=1,
6661     MOZ_SAFE_BROWSING= )
6662 if test -n "$MOZ_SAFE_BROWSING"; then
6663     AC_DEFINE(MOZ_SAFE_BROWSING)
6665 AC_SUBST(MOZ_SAFE_BROWSING)
6667 dnl ========================================================
6668 dnl = Enable url-classifier
6669 dnl ========================================================
6670 dnl Implicitly enabled by default if building with safe-browsing
6671 if test -n "$MOZ_SAFE_BROWSING"; then
6672     MOZ_URL_CLASSIFIER=1
6674 MOZ_ARG_ENABLE_BOOL(url-classifier,
6675 [  --enable-url-classifier Enable url classifier module],
6676     MOZ_URL_CLASSIFIER=1,
6677     MOZ_URL_CLASSIFIER= )
6678 if test -n "$MOZ_URL_CLASSIFIER"; then
6679     AC_DEFINE(MOZ_URL_CLASSIFIER)
6681 AC_SUBST(MOZ_URL_CLASSIFIER)
6683 dnl ========================================================
6684 dnl = Disable zipwriter
6685 dnl ========================================================
6686 MOZ_ARG_DISABLE_BOOL(zipwriter,
6687 [  --disable-zipwriter     Disable zipwriter component],
6688     MOZ_ZIPWRITER=,
6689     MOZ_ZIPWRITER=1 )
6690 AC_SUBST(MOZ_ZIPWRITER)
6692 dnl ========================================================
6693 dnl = libconic
6694 dnl ========================================================
6695 dnl superseded by QtNetwork starting from 4.7
6696 MOZ_ENABLE_LIBCONIC=1
6698 if test -n "$MOZ_ENABLE_QT"; then
6699   if test "$MOZ_ENABLE_QTNETWORK"; then
6700     MOZ_ENABLE_LIBCONIC=
6701   fi
6704 MOZ_ARG_DISABLE_BOOL(libconic,
6705 [  --disable-libconic      Disable libconic],
6706     MOZ_ENABLE_LIBCONIC=,
6707     MOZ_ENABLE_LIBCONIC=1 )
6709 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6710     PKG_CHECK_MODULES(LIBCONIC, conic,
6711                       MOZ_ENABLE_LIBCONIC=1,
6712                       MOZ_ENABLE_LIBCONIC=)
6714 if test "$MOZ_ENABLE_LIBCONIC"; then
6715     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6718 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6719 AC_SUBST(LIBCONIC_CFLAGS)
6720 AC_SUBST(LIBCONIC_LIBS)
6722 dnl ========================================================
6723 dnl = Maemo checks
6724 dnl ========================================================
6726 MAEMO_SDK_TARGET_VER=-1
6728 MOZ_ARG_WITH_STRING(maemo-version,
6729 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6730                           Maemo SDK Version],
6731   MAEMO_SDK_TARGET_VER=$withval)
6733 case "$MAEMO_SDK_TARGET_VER" in
6735     MOZ_PLATFORM_MAEMO=5
6736     ;;
6739     MOZ_PLATFORM_MAEMO=6
6740     ;;
6743     dnl We aren't compiling for Maemo, move on.
6744     ;;
6746     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6747     ;;
6748 esac
6750 if test $MOZ_PLATFORM_MAEMO; then
6751    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6753    if test -z "$MOZ_ENABLE_DBUS"; then
6754        AC_MSG_ERROR([DBus is required when building for Maemo])
6755    fi
6757    MOZ_GFX_OPTIMIZE_MOBILE=1
6758    MOZ_GL_DEFAULT_PROVIDER=EGL
6759    MOZ_MAEMO_LIBLOCATION=
6761    if test $MOZ_PLATFORM_MAEMO = 5; then
6762       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6763       MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6764           [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6765       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6766                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6768       AC_SUBST(XCOMPOSITE_LIBS)
6770       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6771       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6772       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6773       if test -z "$_LIB_FOUND"; then
6774          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6775       fi
6778       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6779       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6780       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6781       if test -z "$_LIB_FOUND"; then
6782          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6783       fi
6785       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6786       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6787       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6788       if test -z "$_LIB_FOUND"; then
6789          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6790       fi
6792    fi
6793    if test $MOZ_PLATFORM_MAEMO = 6; then
6795       PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6796                         _LIB_FOUND=1,
6797                         _LIB_FOUND=)
6798       if test "$_LIB_FOUND"; then
6799          MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6800          MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6801          MOZ_ENABLE_CONTENTMANAGER=1
6802          AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6803       else
6804          AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6805       fi
6806       AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6808       dnl ========================================================
6809       dnl = Enable meego libcontentaction
6810       dnl ========================================================
6811       MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6812       [  --enable-meegocontentaction           Enable meegocontentaction support],
6813          MOZ_MEEGOCONTENTACTION=1,
6814          MOZ_MEEGOCONTENTACTION=)
6816       if test -n "$MOZ_MEEGOCONTENTACTION"; then
6818          PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6819          if test "$_LIB_FOUND"; then
6820             MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6821             MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6822             MOZ_ENABLE_CONTENTACTION=1
6823             AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6824             AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6825          fi
6826       fi
6828       MOZ_ARG_ENABLE_BOOL(meegotouch,
6829       [  --enable-meegotouch  Enable meegotouch support],
6830          MOZ_MEEGOTOUCHENABLED=1,
6831          MOZ_MEEGOTOUCHENABLED=)
6833       if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6834           PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6835           if test "$_LIB_FOUND"; then
6836               MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6837               MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6838               AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6839           else
6840               AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6841           fi
6842       fi
6843    fi
6845    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6846    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6847    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6848    if test "$_LIB_FOUND"; then
6849       MOZ_MAEMO_LIBLOCATION=1
6850       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6851    else
6852       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6853    fi
6854    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6856    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6857    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6858    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6859    if test "$_LIB_FOUND"; then
6860       MOZ_ENABLE_MEEGOTOUCHSHARE=1
6861       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6862    else
6863       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6864    fi
6865    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6867    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6868    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6871 dnl ========================================================
6872 dnl GL provider
6873 dnl ========================================================
6874 MOZ_GL_PROVIDER=
6875 MOZ_ARG_WITH_STRING(gl-provider,
6876 [  --with-gl-provider=ID
6877                           Set GL provider backend type],
6878 [ val=`echo $withval`
6879     MOZ_GL_PROVIDER="$val"])
6881 if test -n "$MOZ_GL_PROVIDER"; then
6882 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6883 AC_SUBST(MOZ_GL_PROVIDER)
6884 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6886 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6887 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6889 dnl ========================================================
6890 dnl = faststripe theme
6891 dnl ========================================================
6892 MOZ_ARG_ENABLE_BOOL(faststripe,
6893 [  --enable-faststripe     Use faststripe theme],
6894     MOZ_THEME_FASTSTRIPE=1,
6895     MOZ_THEME_FASTSTRIPE= )
6896 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6898 dnl ========================================================
6899 dnl =
6900 dnl = Feature options that require extra sources to be pulled
6901 dnl =
6902 dnl ========================================================
6903 dnl MOZ_ARG_HEADER(Features that require extra sources)
6905 dnl ========================================================
6906 dnl =
6907 dnl = Debugging Options
6908 dnl =
6909 dnl ========================================================
6910 MOZ_ARG_HEADER(Debugging and Optimizations)
6912 dnl ========================================================
6913 dnl = Disable building with debug info.
6914 dnl = Debugging is OFF by default
6915 dnl ========================================================
6916 if test -z "$MOZ_DEBUG_FLAGS"; then
6917   MOZ_DEBUG_FLAGS="-g"
6920 MOZ_ARG_ENABLE_STRING(debug,
6921 [  --enable-debug[=DBG]    Enable building with developer debug info
6922                            (using compiler flags DBG)],
6923 [ if test "$enableval" != "no"; then
6924     MOZ_DEBUG=1
6925     if test -n "$enableval" -a "$enableval" != "yes"; then
6926         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6927         _MOZ_DEBUG_FLAGS_SET=1
6928     fi
6929   else
6930     MOZ_DEBUG=
6931   fi ],
6932   MOZ_DEBUG=)
6934 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6935 MOZ_ARG_WITH_STRING(debug-label,
6936 [  --with-debug-label=LABELS
6937                           Define DEBUG_<value> for each comma-separated
6938                           value given.],
6939 [ for option in `echo $withval | sed 's/,/ /g'`; do
6940     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6941 done])
6943 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6945 if test -n "$MOZ_DEBUG"; then
6946     AC_MSG_CHECKING([for valid debug flags])
6947     _SAVE_CFLAGS=$CFLAGS
6948     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6949     AC_TRY_COMPILE([#include <stdio.h>],
6950         [printf("Hello World\n");],
6951         _results=yes,
6952         _results=no)
6953     AC_MSG_RESULT([$_results])
6954     if test "$_results" = "no"; then
6955         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6956     fi
6957     CFLAGS=$_SAVE_CFLAGS
6960 dnl ========================================================
6961 dnl enable mobile optimizations
6962 dnl ========================================================
6963 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6964 [  --enable-mobile-optimize
6965                           Enable mobile optimizations],
6966     MOZ_GFX_OPTIMIZE_MOBILE=1)
6968 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6970 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6971     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6974 dnl ========================================================
6975 dnl = Enable code optimization. ON by default.
6976 dnl ========================================================
6977 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6978         MOZ_OPTIMIZE_FLAGS="-O"
6981 MOZ_ARG_ENABLE_STRING(optimize,
6982 [  --disable-optimize      Disable compiler optimization
6983   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6984 [ if test "$enableval" != "no"; then
6985     MOZ_OPTIMIZE=1
6986     if test -n "$enableval" -a "$enableval" != "yes"; then
6987         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6988         MOZ_OPTIMIZE=2
6989     fi
6990 else
6991     MOZ_OPTIMIZE=
6992 fi ], MOZ_OPTIMIZE=1)
6994 MOZ_SET_FRAMEPTR_FLAGS
6996 if test "$COMPILE_ENVIRONMENT"; then
6997 if test -n "$MOZ_OPTIMIZE"; then
6998     AC_MSG_CHECKING([for valid optimization flags])
6999     _SAVE_CFLAGS=$CFLAGS
7000     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7001     AC_TRY_COMPILE([#include <stdio.h>],
7002         [printf("Hello World\n");],
7003         _results=yes,
7004         _results=no)
7005     AC_MSG_RESULT([$_results])
7006     if test "$_results" = "no"; then
7007         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7008     fi
7009     CFLAGS=$_SAVE_CFLAGS
7011 fi # COMPILE_ENVIRONMENT
7013 AC_SUBST(MOZ_OPTIMIZE)
7014 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
7015 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7016 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7017 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
7018 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7019 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
7021 dnl ========================================================
7022 dnl = Enable generation of debug symbols
7023 dnl ========================================================
7024 MOZ_ARG_ENABLE_STRING(debug-symbols,
7025 [  --enable-debug-symbols[=DBG]
7026                           Enable debugging symbols (using compiler flags DBG)],
7027 [ if test "$enableval" != "no"; then
7028       MOZ_DEBUG_SYMBOLS=1
7029       if test -n "$enableval" -a "$enableval" != "yes"; then
7030           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7031               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7032           else
7033               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7034           fi
7035       fi
7036   else
7037       MOZ_DEBUG_SYMBOLS=
7038   fi ],
7039   MOZ_DEBUG_SYMBOLS=1)
7041 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7042     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7043     export MOZ_DEBUG_SYMBOLS
7046 dnl ========================================================
7047 dnl = Enable any treating of compile warnings as errors
7048 dnl ========================================================
7049 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
7050 [  --enable-warnings-as-errors
7051                           Enable treating of warnings as errors],
7052     MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
7053     MOZ_ENABLE_WARNINGS_AS_ERRORS=)
7054 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
7055    WARNINGS_AS_ERRORS=''
7058 dnl ========================================================
7059 dnl = Disable runtime logging checks
7060 dnl ========================================================
7061 MOZ_ARG_DISABLE_BOOL(logging,
7062 [  --disable-logging       Disable logging facilities],
7063     NS_DISABLE_LOGGING=1,
7064     NS_DISABLE_LOGGING= )
7065 if test "$NS_DISABLE_LOGGING"; then
7066     AC_DEFINE(NS_DISABLE_LOGGING)
7067 else
7068     AC_DEFINE(MOZ_LOGGING)
7071 dnl ========================================================
7072 dnl = This will enable logging of addref, release, ctor, dtor.
7073 dnl ========================================================
7074 _ENABLE_LOGREFCNT=42
7075 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7076 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7077     _ENABLE_LOGREFCNT=1,
7078     _ENABLE_LOGREFCNT= )
7079 if test "$_ENABLE_LOGREFCNT" = "1"; then
7080     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7081 elif test -z "$_ENABLE_LOGREFCNT"; then
7082     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7085 dnl ========================================================
7086 dnl moz_dump_painting
7087 dnl ========================================================
7088 MOZ_ARG_ENABLE_BOOL(dump-painting,
7089 [  --enable-dump-painting          Enable paint debugging.],
7090     MOZ_DUMP_PAINTING=1,
7091     MOZ_DUMP_PAINTING= )
7092 if test -n "$MOZ_DUMP_PAINTING"; then
7093     AC_DEFINE(MOZ_DUMP_PAINTING)
7094     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
7096 if test -n "$MOZ_DEBUG"; then
7097     AC_DEFINE(MOZ_DUMP_PAINTING)
7100 dnl ========================================================
7101 dnl = Enable trace malloc
7102 dnl ========================================================
7103 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7104 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7105 [  --enable-trace-malloc   Enable malloc tracing; also disables DMD and jemalloc],
7106     NS_TRACE_MALLOC=1,
7107     NS_TRACE_MALLOC= )
7108 if test "$NS_TRACE_MALLOC"; then
7109   # Please, Mr. Linker Man, don't take away our symbol names
7110   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7111   USE_ELF_DYNSTR_GC=
7112   AC_DEFINE(NS_TRACE_MALLOC)
7114 AC_SUBST(NS_TRACE_MALLOC)
7116 dnl ========================================================
7117 dnl = Enable DMD
7118 dnl ========================================================
7120 MOZ_ARG_ENABLE_BOOL(dmd,
7121 [  --enable-dmd            Enable DMD; also enables jemalloc and replace-malloc],
7122     MOZ_DMD=1,
7123     MOZ_DMD= )
7125 if test "$NS_TRACE_MALLOC"; then        # trace-malloc disables DMD
7126     MOZ_DMD=
7128 if test "$MOZ_DMD"; then
7129     USE_ELF_DYNSTR_GC=
7130     AC_DEFINE(MOZ_DMD)
7132     if test "${CPU_ARCH}" = "arm"; then
7133         CFLAGS="$CFLAGS -funwind-tables"
7134         CXXFLAGS="$CXXFLAGS -funwind-tables"
7135     fi
7137     MOZ_MEMORY=1                        # DMD enables jemalloc
7138     MOZ_REPLACE_MALLOC=1                # DMD enables replace-malloc
7140 AC_SUBST(MOZ_DMD)
7142 dnl ========================================================
7143 dnl = Enable jemalloc
7144 dnl ========================================================
7145 MOZ_ARG_ENABLE_BOOL(jemalloc,
7146 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7147     MOZ_MEMORY=1,
7148     MOZ_MEMORY=)
7150 if test "$NS_TRACE_MALLOC"; then
7151     MOZ_MEMORY=
7154 if test "${OS_TARGET}" = "Android"; then
7155   dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
7156   :
7157 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
7158   dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
7159   if test -z "$GNU_CC"; then
7160     MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7161   else
7162     MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
7163   fi
7164 else
7165   dnl On other Unix systems, we only want to link executables against mozglue
7166   MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7167   dnl On other Unix systems, where mozglue is a static library, jemalloc is
7168   dnl separated for the SDK, so we need to add it here.
7169   if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
7170     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
7171   fi
7172   MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
7173   if test -n "$GNU_CC"; then
7174     dnl And we need mozglue symbols to be exported.
7175     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
7176   fi
7177   if test "$MOZ_LINKER" = 1; then
7178     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
7179   fi
7182 dnl ========================================================
7183 dnl = Enable dynamic replacement of malloc implementation
7184 dnl ========================================================
7185 MOZ_ARG_ENABLE_BOOL(replace-malloc,
7186 [  --enable-replace-malloc   Enable ability to dynamically replace the malloc implementation],
7187     MOZ_REPLACE_MALLOC=1,
7188     MOZ_REPLACE_MALLOC= )
7190 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
7191     dnl We don't want to enable jemalloc unconditionally because it may be a
7192     dnl deliberate choice not to enable it (bug 702250, for instance)
7193     AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
7194 elif test -n "$MOZ_REPLACE_MALLOC"; then
7195     MOZ_NATIVE_JEMALLOC=
7197     dnl Replace-malloc Mac linkage quirks
7198     if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
7199         AC_CACHE_CHECK([how to do weak dynamic linking],
7200             ac_cv_weak_dynamic_linking,
7201             [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
7202              if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
7203                 test -s conftest${DLL_SUFFIX}; then
7204                  dnl There are several ways the linker can put link edit rules in a binary:
7205                  dnl - classic info only (for OSX < 10.6)
7206                  dnl - dyld info only
7207                  dnl - both
7208                  if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
7209                      _CLASSIC_INFO=
7210                  else
7211                      _CLASSIC_INFO=1
7212                  fi
7213                  if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
7214                      _DYLD_INFO=1
7215                  else
7216                      _DYLD_INFO=
7217                  fi
7218                  dnl With classic info, we need to build with -flat_namespace.
7219                  dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
7220                  dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
7221                  dnl forgets to set the weak flag in the dyld info.
7222                  dnl See http://glandium.org/blog/?p=2764 for more details.
7223                  dnl
7224                  dnl Values for ac_cv_weak_dynamic_linking, and subsequently
7225                  dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
7226                  dnl - "flat namespace" when -flat_namespace alone is needed
7227                  dnl - "dummy library" when a dummy library and -flat_namespace are needed
7228                  dnl - "compiler support" when nothing is needed
7229                  if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
7230                      if test -n "$_CLASSIC_INFO"; then
7231                          ac_cv_weak_dynamic_linking="flat namespace"
7232                      else
7233                          ac_cv_weak_dynamic_linking="compiler support"
7234                      fi
7235                  else
7236                      if test -n "$_DYLD_INFO"; then
7237                          ac_cv_weak_dynamic_linking="dummy library"
7238                      else
7239                          ac_cv_weak_dynamic_linking="flat namespace"
7240                      fi
7241                  fi
7242              else
7243                  AC_ERROR([couldn't compile a simple C file])
7244              fi
7245              rm -rf conftest*])
7246         MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
7247     fi
7249 AC_SUBST(MOZ_REPLACE_MALLOC)
7250 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
7252 dnl ========================================================
7253 dnl = Jemalloc build setup
7254 dnl ========================================================
7255 if test -z "$MOZ_MEMORY"; then
7256   if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
7257     MOZ_NATIVE_JEMALLOC=1
7258     AC_CHECK_FUNCS(mallctl nallocm,,
7259       [MOZ_NATIVE_JEMALLOC=
7260        break])
7261     if test -n "$MOZ_NATIVE_JEMALLOC"; then
7262       MOZ_MEMORY=1
7263       AC_DEFINE(MOZ_MEMORY)
7264       AC_DEFINE(MOZ_JEMALLOC3)
7265       AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7266     fi
7267   fi
7268   case "${target}" in
7269     *-mingw*)
7270       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7271         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.])
7272       fi
7273       ;;
7274   esac
7275 else
7276   dnl Don't try to run compiler tests on Windows
7277   if test "$OS_ARCH" = "WINNT"; then
7278     if test -z "$HAVE_64BIT_OS"; then
7279       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7280     else
7281       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7282     fi
7283   else
7284     AC_CHECK_SIZEOF([int *], [4])
7285     case "${ac_cv_sizeof_int_p}" in
7286     4)
7287       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7288       ;;
7289     8)
7290       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7291       ;;
7292     *)
7293       AC_MSG_ERROR([Unexpected pointer size])
7294       ;;
7295     esac
7296   fi
7298   AC_DEFINE(MOZ_MEMORY)
7299   if test -n "$MOZ_JEMALLOC3"; then
7300     AC_DEFINE(MOZ_JEMALLOC3)
7301   fi
7302   if test "x$MOZ_DEBUG" = "x1"; then
7303     AC_DEFINE(MOZ_MEMORY_DEBUG)
7304   fi
7305   dnl The generic feature tests that determine how to compute ncpus are long and
7306   dnl complicated.  Therefore, simply define special cpp variables for the
7307   dnl platforms we have special knowledge of.
7308   case "${target}" in
7309   *-darwin*)
7310     AC_DEFINE(MOZ_MEMORY_DARWIN)
7311     ;;
7312   *-*freebsd*)
7313     AC_DEFINE(MOZ_MEMORY_BSD)
7314     ;;
7315   *-android*|*-linuxandroid*)
7316     AC_DEFINE(MOZ_MEMORY_LINUX)
7317     AC_DEFINE(MOZ_MEMORY_ANDROID)
7318     if test -z "$gonkdir"; then
7319       _WRAP_MALLOC=1
7320     else
7321       AC_DEFINE(MOZ_MEMORY_GONK)
7322     fi
7323     MOZ_GLUE_LDFLAGS=
7324     ;;
7325   *-*linux*)
7326     AC_DEFINE(MOZ_MEMORY_LINUX)
7327     ;;
7328   *-netbsd*)
7329     AC_DEFINE(MOZ_MEMORY_BSD)
7330     ;;
7331   *-solaris*)
7332     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7333     ;;
7334   *-mingw*)
7335     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7336     if test -z "$MOZ_DEBUG"; then
7337       WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7338     else
7339       WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7340     fi
7341     dnl Look for a broken crtdll.obj
7342     WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7343     lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7344     if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7345       MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7346       dnl Also pass this to NSPR/NSS
7347       DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7348     else
7349       DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7350     fi
7351     rm crtdll.obj
7353     export DLLFLAGS
7354     ;;
7355   *)
7356     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7357     ;;
7358   esac
7359 fi # MOZ_MEMORY
7360 AC_SUBST(MOZ_MEMORY)
7361 AC_SUBST(MOZ_JEMALLOC3)
7362 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7363 AC_SUBST(MOZ_GLUE_LDFLAGS)
7364 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7365 AC_SUBST(WIN32_CRT_LIBS)
7366 dnl Need to set this for make because NSS doesn't have configure
7367 AC_SUBST(DLLFLAGS)
7369 dnl We need to wrap dlopen and related functions on Android because we use
7370 dnl our own linker.
7371 if test "$OS_TARGET" = Android; then
7372     WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7373     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7374     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7375     if test -z "$gonkdir"; then
7376         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7377         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=memccpy,--wrap=memchr,--wrap=memrchr,--wrap=memcmp,--wrap=memcpy,--wrap=memmove,--wrap=memset,--wrap=memmem,--wrap=memswap,--wrap=index,--wrap=strchr,--wrap=strrchr,--wrap=strlen,--wrap=strcmp,--wrap=strcpy,--wrap=strcat,--wrap=strcasecmp,--wrap=strncasecmp,--wrap=strstr,--wrap=strcasestr,--wrap=strtok,--wrap=strtok_r,--wrap=strerror,--wrap=strerror_r,--wrap=strnlen,--wrap=strncat,--wrap=strncmp,--wrap=strncpy,--wrap=strlcat,--wrap=strlcpy,--wrap=strcspn,--wrap=strpbrk,--wrap=strsep,--wrap=strspn,--wrap=strcoll,--wrap=strxfrm"
7378     fi
7381 dnl ========================================================
7382 dnl = Use malloc wrapper lib
7383 dnl ========================================================
7384 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7385 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7386     _WRAP_MALLOC=1,
7387     _WRAP_MALLOC= )
7389 if test -n "$_WRAP_MALLOC"; then
7390     if test -n "$GNU_CC"; then
7391         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7392         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7393         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7394         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7395         dnl Wrap operator new and operator delete on Android.
7396         if test "$OS_TARGET" = "Android"; then
7397             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7398             dnl Wrap the nothrow variants too.
7399             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7400         fi
7401     else
7402         AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7403     fi
7406 dnl ========================================================
7407 dnl = Location of malloc wrapper lib
7408 dnl ========================================================
7409 MOZ_ARG_WITH_STRING(wrap-malloc,
7410 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7411     WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7413 dnl ========================================================
7414 dnl = Use JS Call tracing
7415 dnl ========================================================
7416 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7417 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7418     MOZ_TRACE_JSCALLS=1,
7419     MOZ_TRACE_JSCALLS= )
7420 if test -n "$MOZ_TRACE_JSCALLS"; then
7421     AC_DEFINE(MOZ_TRACE_JSCALLS)
7424 dnl ========================================================
7425 dnl = Use incremental GC
7426 dnl ========================================================
7427 JSGC_INCREMENTAL=1
7428 MOZ_ARG_DISABLE_BOOL(gcincremental,
7429 [  --disable-gcincremental Disable incremental GC],
7430     JSGC_INCREMENTAL= )
7431 if test -n "$JSGC_INCREMENTAL"; then
7432     AC_DEFINE(JSGC_INCREMENTAL)
7435 dnl ========================================================
7436 dnl Zealous JavaScript GC
7437 dnl ========================================================
7438 MOZ_ARG_ENABLE_BOOL(gczeal,
7439 [  --enable-gczeal         Enable zealous JavaScript GCing],
7440     JS_GC_ZEAL=1,
7441     JS_GC_ZEAL= )
7442 if test -n "$JS_GC_ZEAL"; then
7443     AC_DEFINE(JS_GC_ZEAL)
7446 dnl ========================================================
7447 dnl JS opt-mode assertions and minidump instrumentation
7448 dnl ========================================================
7449 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7450 [  --enable-js-diagnostics
7451                           Enable JS diagnostic assertions and breakpad data],
7452     JS_CRASH_DIAGNOSTICS=1,
7453     JS_CRASH_DIAGNOSTICS= )
7454 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7455     AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7458 MOZ_CHECK_CCACHE
7459 MOZ_CHECK_COMPILER_WRAPPER
7461 dnl ========================================================
7462 dnl = Enable static checking using gcc-dehydra
7463 dnl ========================================================
7465 MOZ_ARG_WITH_STRING(static-checking,
7466 [  --with-static-checking=path/to/gcc_dehydra.so
7467                           Enable static checking of code using GCC-dehydra],
7468     DEHYDRA_PATH=$withval,
7469     DEHYDRA_PATH= )
7471 if test -n "$DEHYDRA_PATH"; then
7472     if test ! -f "$DEHYDRA_PATH"; then
7473         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7474     fi
7475     AC_DEFINE(NS_STATIC_CHECKING)
7477 AC_SUBST(DEHYDRA_PATH)
7479 dnl ========================================================
7480 dnl = Enable using the clang plugin to build
7481 dnl ========================================================
7483 MOZ_ARG_ENABLE_BOOL(clang-plugin,
7484 [  --enable-clang-plugin   Enable building with the mozilla clang plugin ],
7485    ENABLE_CLANG_PLUGIN=1,
7486    ENABLE_CLANG_PLUGIN= )
7487 if test -n "$ENABLE_CLANG_PLUGIN"; then
7488     if test -z "$CLANG_CC"; then
7489         AC_MSG_ERROR([Can't use clang plugin without clang.])
7490     fi
7491     AC_DEFINE(MOZ_CLANG_PLUGIN)
7494 AC_SUBST(ENABLE_CLANG_PLUGIN)
7496 dnl ========================================================
7497 dnl = Enable stripping of libs & executables
7498 dnl ========================================================
7499 MOZ_ARG_ENABLE_BOOL(strip,
7500 [  --enable-strip          Enable stripping of libs & executables ],
7501     ENABLE_STRIP=1,
7502     ENABLE_STRIP= )
7504 dnl ========================================================
7505 dnl = Enable stripping of libs & executables when packaging
7506 dnl ========================================================
7507 MOZ_ARG_ENABLE_BOOL(install-strip,
7508 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7509     PKG_SKIP_STRIP= ,
7510     PKG_SKIP_STRIP=1)
7512 dnl ========================================================
7513 dnl = --enable-elf-dynstr-gc
7514 dnl ========================================================
7515 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7516 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7517     USE_ELF_DYNSTR_GC=1,
7518     USE_ELF_DYNSTR_GC= )
7520 dnl ========================================================
7521 dnl = --disable-elf-hack
7522 dnl ========================================================
7524 USE_ELF_HACK=1
7525 MOZ_ARG_DISABLE_BOOL(elf-hack,
7526 [  --disable-elf-hack      Disable elf hacks],
7527     USE_ELF_HACK=,
7528     USE_ELF_HACK=1)
7530 # Disable elf hack for profiling because the built in profiler
7531 # doesn't read the segments properly with elf hack. This is
7532 # temporary and should be fixed soon in the profiler.
7533 if test "$MOZ_PROFILING" = 1; then
7534   USE_ELF_HACK=
7537 # Only enable elfhack where supported
7538 if test "$USE_ELF_HACK" = 1; then
7539     case "${HOST_OS_ARCH},${OS_ARCH}" in
7540     Linux,Linux)
7541         case "${CPU_ARCH}" in
7542         arm | x86 | x86_64)
7543             USE_ELF_HACK=1
7544             ;;
7545         *)
7546             USE_ELF_HACK=
7547             ;;
7548         esac
7549         ;;
7550     *)
7551         USE_ELF_HACK=
7552         ;;
7553     esac
7556 if test "$USE_ELF_HACK" = 1; then
7557     dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7558     dnl memory addresses it maps to. The result is that by the time elfhack
7559     dnl kicks in, it is not possible to apply relocations because of that,
7560     dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7561     dnl segment. It makes elfhack mostly useless, so considering the problems
7562     dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7563     dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7564     dnl the linker creates PT_GNU_RELRO segments.
7565     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7566         LINK_WITH_PT_GNU_RELRO,
7567         [echo "int main() {return 0;}" > conftest.${ac_ext}
7568          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7569             test -s conftest${ac_exeext}; then
7570             if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7571                 LINK_WITH_PT_GNU_RELRO=yes
7572             else
7573                 LINK_WITH_PT_GNU_RELRO=no
7574             fi
7575          else
7576              dnl We really don't expect to get here, but just in case
7577              AC_ERROR([couldn't compile a simple C file])
7578          fi
7579          rm -rf conftest*])
7580     if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7581         AC_MSG_WARN([Disabling elfhack])
7582         USE_ELF_HACK=
7583     fi
7586 dnl ========================================================
7587 dnl = libstdc++ compatibility hacks
7588 dnl ========================================================
7590 STDCXX_COMPAT=
7591 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7592 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
7593     STDCXX_COMPAT=1)
7595 AC_SUBST(STDCXX_COMPAT)
7597 if test -n "$STDCXX_COMPAT"; then
7598    eval $(CXX="$CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7599    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7600    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7603 dnl ========================================================
7604 dnl =
7605 dnl = Profiling and Instrumenting
7606 dnl =
7607 dnl ========================================================
7608 MOZ_ARG_HEADER(Profiling and Instrumenting)
7610 dnl ========================================================
7611 dnl = Enable runtime visual profiling logger
7612 dnl ========================================================
7613 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7614 [  --enable-visual-event-tracer   Enable visual event tracer instrumentation],
7615     MOZ_VISUAL_EVENT_TRACER=1,
7616     MOZ_VISUAL_EVENT_TRACER=)
7617 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7618     AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7621 dnl ========================================================
7622 dnl Turn on reflow counting
7623 dnl ========================================================
7624 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7625 [  --enable-reflow-perf    Enable reflow performance tracing],
7626     MOZ_REFLOW_PERF=1,
7627     MOZ_REFLOW_PERF= )
7628 if test -n "$MOZ_REFLOW_PERF"; then
7629     AC_DEFINE(MOZ_REFLOW_PERF)
7632 dnl ========================================================
7633 dnl Enable code size metrics.
7634 dnl ========================================================
7635 MOZ_ARG_ENABLE_BOOL(codesighs,
7636 [  --enable-codesighs      Enable code size analysis tools],
7637     _ENABLE_CODESIGHS=1,
7638     _ENABLE_CODESIGHS= )
7639 if test -n "$_ENABLE_CODESIGHS"; then
7640     if test -d $srcdir/tools/codesighs; then
7641         MOZ_MAPINFO=1
7642     else
7643         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7644     fi
7647 dnl ========================================================
7648 dnl = Enable Radio Interface for B2G (Gonk usually)
7649 dnl ========================================================
7650 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7651 [  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7652     MOZ_B2G_RIL=1,
7653     MOZ_B2G_RIL= )
7654 if test -n "$MOZ_B2G_RIL"; then
7655     AC_DEFINE(MOZ_B2G_RIL)
7657 AC_SUBST(MOZ_B2G_RIL)
7659 dnl ========================================================
7660 dnl = Enable Radio FM for B2G (Gonk usually)
7661 dnl ========================================================
7662 if test -n "$MOZ_B2G_FM"; then
7663     AC_DEFINE(MOZ_B2G_FM)
7665 AC_SUBST(MOZ_B2G_FM)
7667 dnl ========================================================
7668 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7669 dnl ========================================================
7670 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7671 [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
7672     MOZ_B2G_BT=1,
7673     MOZ_B2G_BT= )
7674 if test -n "$MOZ_B2G_BT"; then
7675     AC_DEFINE(MOZ_B2G_BT)
7677 AC_SUBST(MOZ_B2G_BT)
7679 dnl ========================================================
7680 dnl = Enable Support for Time Manager API
7681 dnl ========================================================
7682 if test -n "$MOZ_TIME_MANAGER"; then
7683     AC_DEFINE(MOZ_TIME_MANAGER)
7685 AC_SUBST(MOZ_TIME_MANAGER)
7687 dnl ========================================================
7688 dnl = Enable Camera Interface for B2G (Gonk usually)
7689 dnl ========================================================
7690 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7691 [  --enable-b2g-camera      Set compile flags necessary for compiling camera API for B2G ],
7692     MOZ_B2G_CAMERA=1,
7693     MOZ_B2G_CAMERA= )
7694 if test -n "$MOZ_B2G_CAMERA"; then
7695    AC_DEFINE(MOZ_B2G_CAMERA)
7697 AC_SUBST(MOZ_B2G_CAMERA)
7699 dnl ========================================================
7700 dnl = Enable Support B2G-specific changes to the NSS
7701 dnl = certificate trust database.
7702 dnl ========================================================
7703 if test -n "$MOZ_B2G_CERTDATA"; then
7704     AC_DEFINE(MOZ_B2G_CERTDATA)
7706 AC_SUBST(MOZ_B2G_CERTDATA)
7708 dnl ========================================================
7709 dnl = Enable Support for Payment API
7710 dnl ========================================================
7711 if test -n "$MOZ_PAY"; then
7712     AC_DEFINE(MOZ_PAY)
7714 AC_SUBST(MOZ_PAY)
7716 dnl ========================================================
7717 dnl = Enable Support for AudioChannelManager API
7718 dnl ========================================================
7719 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7720     AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7722 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7724 dnl ========================================================
7725 dnl = Support for demangling undefined symbols
7726 dnl ========================================================
7727 if test -z "$SKIP_LIBRARY_CHECKS"; then
7728     AC_LANG_SAVE
7729     AC_LANG_CPLUSPLUS
7730     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7731     AC_LANG_RESTORE
7734 # Demangle only for debug or trace-malloc or DMD builds
7735 MOZ_DEMANGLE_SYMBOLS=
7736 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7737     MOZ_DEMANGLE_SYMBOLS=1
7738     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7740 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7742 dnl ========================================================
7743 dnl = Support for gcc stack unwinding (from gcc 3.3)
7744 dnl ========================================================
7745 if test -z "$SKIP_LIBRARY_CHECKS"; then
7746     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7749 dnl ========================================================
7750 dnl JIT observers
7751 dnl ========================================================
7753 MOZ_ARG_WITH_STRING(jitreport-granularity,
7754 [  --jitreport-granularity=N
7755                            Default granularity at which to report JIT code
7756                            to external tools
7757                              0 - no info
7758                              1 - code ranges for whole functions only
7759                              2 - per-line information
7760                              3 - per-op information],
7761   JITREPORT_GRANULARITY=$withval,
7762   JITREPORT_GRANULARITY=3)
7764 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7766 dnl ========================================================
7767 dnl =
7768 dnl = Misc. Options
7769 dnl =
7770 dnl ========================================================
7771 MOZ_ARG_HEADER(Misc. Options)
7773 dnl ========================================================
7774 dnl update xterm title
7775 dnl ========================================================
7776 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7777 [  --enable-xterm-updates  Update XTERM titles with current command.],
7778     MOZ_UPDATE_XTERM=1,
7779     MOZ_UPDATE_XTERM= )
7781 dnl =========================================================
7782 dnl = Chrome format
7783 dnl =========================================================
7784 MOZ_ARG_ENABLE_STRING([chrome-format],
7785 [  --enable-chrome-format=jar|flat|omni
7786                           Select FORMAT of chrome files during packaging],
7787     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7789 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7790     MOZ_CHROME_FILE_FORMAT=jar
7793 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7794     AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7797 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7798     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7799     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7800     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7803 dnl =========================================================
7804 dnl Omnijar packaging (bug 552121)
7805 dnl =========================================================
7806 dnl Omnijar packaging is compatible with flat packaging.
7807 dnl In unpackaged builds, omnijar looks for files as if
7808 dnl things were flat packaged. After packaging, all files
7809 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7810 dnl is set to flat since putting files into jars is only
7811 dnl done during packaging with omnijar.
7812 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7813     MOZ_OMNIJAR=1
7814     AC_DEFINE(MOZ_OMNIJAR)
7816 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7817 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7818     MOZ_CHROME_FILE_FORMAT=flat
7819 else
7820     MOZ_CHROME_FILE_FORMAT=symlink
7823 OMNIJAR_NAME=omni.ja
7824 AC_SUBST(OMNIJAR_NAME)
7825 AC_SUBST(MOZ_OMNIJAR)
7826 AC_SUBST(MOZ_PACKAGER_FORMAT)
7828 dnl ========================================================
7829 dnl = Define default location for MOZILLA_FIVE_HOME
7830 dnl ========================================================
7831 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7832 [  --with-default-mozilla-five-home
7833                           Set the default value for MOZILLA_FIVE_HOME],
7834 [ val=`echo $withval`
7835   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7837 dnl ========================================================
7838 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7839 dnl ========================================================
7840 MOZ_ARG_WITH_STRING(user-appdir,
7841 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7842 [ val=`echo $withval`
7843 if echo "$val" | grep "\/" >/dev/null; then
7844     AC_MSG_ERROR("Homedir must be single relative path.")
7845 else
7846     MOZ_USER_DIR="$val"
7847 fi])
7849 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7851 dnl ========================================================
7852 dnl = Doxygen configuration
7853 dnl ========================================================
7854 dnl Use commas to specify multiple dirs to this arg
7855 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7856 MOZ_ARG_WITH_STRING(doc-input-dirs,
7857 [  --with-doc-input-dirs=DIRS
7858                           Header/idl dirs to create docs from],
7859 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7860 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7862 dnl Use commas to specify multiple dirs to this arg
7863 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7864 MOZ_ARG_WITH_STRING(doc-include-dirs,
7865 [  --with-doc-include-dirs=DIRS
7866                           Include dirs to preprocess doc headers],
7867 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7868 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7870 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7871 MOZ_ARG_WITH_STRING(doc-output-dir,
7872 [  --with-doc-output-dir=DIR
7873                           Dir to generate docs into],
7874 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7875 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7877 if test -z "$SKIP_COMPILER_CHECKS"; then
7878 dnl ========================================================
7879 dnl =
7880 dnl = Compiler Options
7881 dnl =
7882 dnl ========================================================
7883 MOZ_ARG_HEADER(Compiler Options)
7885 dnl ========================================================
7886 dnl Check for gcc -pipe support
7887 dnl ========================================================
7888 AC_MSG_CHECKING([for -pipe support])
7889 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7890     dnl Any gcc that supports firefox supports -pipe.
7891     CFLAGS="$CFLAGS -pipe"
7892     CXXFLAGS="$CXXFLAGS -pipe"
7893     AC_MSG_RESULT([yes])
7894 else
7895     AC_MSG_RESULT([no])
7898 dnl ========================================================
7899 dnl Profile guided optimization (gcc checks)
7900 dnl ========================================================
7901 dnl Test for profiling options
7902 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7904 _SAVE_CFLAGS="$CFLAGS"
7905 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7907 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7908 AC_TRY_COMPILE([], [return 0;],
7909                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7910                  result="yes" ], result="no")
7911 AC_MSG_RESULT([$result])
7913 if test $result = "yes"; then
7914   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7915   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7916   PROFILE_USE_LDFLAGS="-fprofile-use"
7919 CFLAGS="$_SAVE_CFLAGS"
7921 if test -n "$INTEL_CC"; then
7922   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7923   PROFILE_GEN_LDFLAGS=
7924   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7925   PROFILE_USE_LDFLAGS=
7928 dnl Sun Studio on Solaris
7929 if test "$SOLARIS_SUNPRO_CC"; then
7930   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7931   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7932   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7933   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7936 AC_SUBST(PROFILE_GEN_CFLAGS)
7937 AC_SUBST(PROFILE_GEN_LDFLAGS)
7938 AC_SUBST(PROFILE_USE_CFLAGS)
7939 AC_SUBST(PROFILE_USE_LDFLAGS)
7941 AC_LANG_CPLUSPLUS
7943 dnl ========================================================
7944 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7945 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7946 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7947 dnl ========================================================
7948 _SAVE_CXXFLAGS=$CXXFLAGS
7949 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7950 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7951     ac_nscap_nonconst_opeq_bug,
7952     [AC_TRY_COMPILE([
7953                       template <class T>
7954                       class Pointer
7955                         {
7956                         public:
7957                           T* myPtr;
7958                         };
7960                       template <class T, class U>
7961                       int operator==(const Pointer<T>& rhs, U* lhs)
7962                         {
7963                           return rhs.myPtr == lhs;
7964                         }
7966                       template <class T, class U>
7967                       int operator==(const Pointer<T>& rhs, const U* lhs)
7968                         {
7969                           return rhs.myPtr == lhs;
7970                         }
7971                     ],
7972                     [
7973                       Pointer<int> foo;
7974                       const int* bar;
7975                       return foo == bar;
7976                     ],
7977                     ac_nscap_nonconst_opeq_bug="no",
7978                     ac_nscap_nonconst_opeq_bug="yes")])
7979 CXXFLAGS="$_SAVE_CXXFLAGS"
7981 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7982     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7984 fi # ! SKIP_COMPILER_CHECKS
7986 AC_DEFINE(CPP_THROW_NEW, [throw()])
7987 AC_LANG_C
7989 if test "$COMPILE_ENVIRONMENT"; then
7990 MOZ_EXPAND_LIBS
7991 fi # COMPILE_ENVIRONMENT
7993 dnl ========================================================
7994 dnl =
7995 dnl = Build depencency options
7996 dnl =
7997 dnl ========================================================
7998 MOZ_ARG_HEADER(Build dependencies)
8000 if test "$GNU_CC" -a "$GNU_CXX"; then
8001   _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
8002 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
8003 elif test "$SOLARIS_SUNPRO_CC"; then
8004   _DEPEND_CFLAGS=
8005 else
8006   dnl Don't override this for MSVC
8007   if test -z "$_WIN32_MSVC"; then
8008     _USE_CPP_INCLUDE_FLAG=
8009     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8010     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8011   else
8012     echo '#include <stdio.h>' > dummy-hello.c
8013     changequote(,)
8014     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8015     changequote([,])
8016     if test -z "$CL_INCLUDES_PREFIX"; then
8017         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8018     fi
8019     AC_SUBST(CL_INCLUDES_PREFIX)
8020     rm -f dummy-hello.c
8021   fi
8024 dnl ========================================================
8025 dnl =
8026 dnl = Static Build Options
8027 dnl =
8028 dnl ========================================================
8029 MOZ_ARG_HEADER(Static build options)
8031 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8032 if test "$OS_ARCH" = "WINNT"; then
8033   ENABLE_SHARED_JS=1
8036 MOZ_ARG_ENABLE_BOOL(shared-js,
8037 [  --enable-shared-js
8038                           Create a shared JavaScript library.],
8039     ENABLE_SHARED_JS=1,
8040     ENABLE_SHARED_JS=)
8042 if test -n "$ENABLE_SHARED_JS"; then
8043   JS_SHARED_LIBRARY=1
8044   MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
8045 else
8046   MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
8047   AC_DEFINE(MOZ_STATIC_JS)
8049 AC_SUBST(JS_SHARED_LIBRARY)
8051 AC_SUBST(LIBXUL_LIBS)
8052 XPCOM_LIBS="$LIBXUL_LIBS"
8054 dnl ========================================================
8055 dnl =
8056 dnl = Standalone module options
8057 dnl =
8058 dnl ========================================================
8059 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8061 dnl Check for GLib.
8062 dnl ========================================================
8064 if test -z "$SKIP_PATH_CHECKS"; then
8065 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8066     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8067         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8068     fi
8072 if test -z "${GLIB_GMODULE_LIBS}" \
8073    -a -n "${GLIB_CONFIG}"\
8074     -a "${GLIB_CONFIG}" != no\
8075 ; then
8076     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8079 AC_SUBST(GLIB_CFLAGS)
8080 AC_SUBST(GLIB_LIBS)
8081 AC_SUBST(GLIB_GMODULE_LIBS)
8083 dnl ========================================================
8084 dnl Graphics checks.
8085 dnl ========================================================
8087 if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
8088 MOZ_ENABLE_SKIA=1
8089 else
8090 MOZ_ENABLE_SKIA=
8093 MOZ_ARG_ENABLE_BOOL(skia,
8094 [  --enable-skia   Enable use of Skia],
8095 MOZ_ENABLE_SKIA=1,
8096 MOZ_ENABLE_SKIA=)
8098 if test "$USE_FC_FREETYPE"; then
8099     if test "$COMPILE_ENVIRONMENT"; then
8100         dnl ========================================================
8101         dnl = Check for freetype2 and its functionality
8102         dnl ========================================================
8103         PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
8105         if test "$_HAVE_FREETYPE2"; then
8106             _SAVE_LIBS="$LIBS"
8107             _SAVE_CFLAGS="$CFLAGS"
8108             LIBS="$LIBS $FT2_LIBS"
8109             CFLAGS="$CFLAGS $FT2_CFLAGS"
8111             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
8112                 ac_cv_member_FT_Bitmap_Size_y_ppem,
8113                 [AC_TRY_COMPILE([#include <ft2build.h>
8114                                  #include FT_FREETYPE_H],
8115                                 [FT_Bitmap_Size s;
8116                                  if (sizeof s.y_ppem) return 0;
8117                                  return 1],
8118                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
8119                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
8120             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
8121                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
8122             else
8123                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
8124             fi
8125             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
8126                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
8127                                [FT_Bitmap_Size structure includes y_ppem field])
8129             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
8131             LIBS="$_SAVE_LIBS"
8132             CFLAGS="$_SAVE_CFLAGS"
8133         fi
8135         _SAVE_CPPFLAGS="$CPPFLAGS"
8136         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8137         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8138             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8139         CPPFLAGS="$_SAVE_CPPFLAGS"
8140     else
8141         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8142     fi
8144     PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
8145     [
8146         if test "$MOZ_PANGO"; then
8147             MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
8148             MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
8149         else
8150             FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
8151             FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
8152         fi
8153     ])
8156 dnl ========================================================
8157 dnl Check for pixman and cairo
8158 dnl ========================================================
8160 MOZ_TREE_CAIRO=1
8161 MOZ_ARG_ENABLE_BOOL(system-cairo,
8162 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8163 MOZ_TREE_CAIRO=,
8164 MOZ_TREE_CAIRO=1 )
8166 MOZ_TREE_PIXMAN=1
8167 MOZ_ARG_ENABLE_BOOL(system-pixman,
8168 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8169 MOZ_TREE_PIXMAN=,
8170 MOZ_TREE_PIXMAN=force,
8171 MOZ_TREE_PIXMAN=1 )
8173 # System cairo depends on system pixman
8174 if test "$MOZ_TREE_PIXMAN" = "force"; then
8175     if test -z "$MOZ_TREE_CAIRO"; then
8176         AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
8177     else
8178         MOZ_TREE_PIXMAN=1
8179     fi
8180 elif test -z "$MOZ_TREE_CAIRO"; then
8181     MOZ_TREE_PIXMAN=
8184 if test "$MOZ_TREE_PIXMAN"; then
8185     AC_DEFINE(MOZ_TREE_PIXMAN)
8186     MOZ_PIXMAN_CFLAGS=""
8187     MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8188 else
8189     PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8190     MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8191     MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8193 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8194 AC_SUBST(MOZ_PIXMAN_LIBS)
8196 # Check for headers defining standard int types.
8197 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8199 if test "$MOZ_TREE_CAIRO"; then
8200     MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8201     AC_DEFINE(MOZ_TREE_CAIRO)
8203     # For now we assume that we will have a uint64_t available through
8204     # one of the above headers or mozstdint.h.
8205     AC_DEFINE(HAVE_UINT64_T)
8207     # Define macros for cairo-features.h
8208     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8209     if test "$MOZ_X11"; then
8210         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8211         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8212         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8213         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8214         MOZ_ENABLE_CAIRO_FT=1
8215         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8216     fi
8217     case "$MOZ_WIDGET_TOOLKIT" in
8218       qt)
8219         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8220         ;;
8221       cocoa | uikit)
8222         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8223         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8224         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8225         ;;
8226       windows)
8227         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8228         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8229         if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8230             WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8231             WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8232             MOZ_ENABLE_D2D_SURFACE=1
8233             MOZ_ENABLE_DWRITE_FONT=1
8234         else
8235             WIN32_DWRITE_FONT_FEATURE=
8236             WIN32_D2D_SURFACE_FEATURE=
8237         fi
8239         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8241         dnl D3D10 Layers depend on D2D Surfaces.
8242         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8243           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8244         fi
8245         ;;
8246       os2)
8247         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8248         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8249         MOZ_ENABLE_CAIRO_FT=1
8250         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8251         CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8252         CAIRO_FT_LIBS=""
8253         ;;
8254     esac
8255     if test "$USE_FC_FREETYPE"; then
8256         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8257     fi
8258     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8259     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8260     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8261     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8262     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8263     AC_SUBST(CAIRO_FT_CFLAGS)
8265     AC_SUBST(PS_SURFACE_FEATURE)
8266     AC_SUBST(PDF_SURFACE_FEATURE)
8267     AC_SUBST(SVG_SURFACE_FEATURE)
8268     AC_SUBST(XLIB_SURFACE_FEATURE)
8269     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8270     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8271     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8272     AC_SUBST(WIN32_SURFACE_FEATURE)
8273     AC_SUBST(OS2_SURFACE_FEATURE)
8274     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8275     AC_SUBST(FT_FONT_FEATURE)
8276     AC_SUBST(FC_FONT_FEATURE)
8277     AC_SUBST(WIN32_FONT_FEATURE)
8278     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8279     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8280     AC_SUBST(QUARTZ_FONT_FEATURE)
8281     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8282     AC_SUBST(QT_SURFACE_FEATURE)
8283     AC_SUBST(TEE_SURFACE_FEATURE)
8285     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8286     MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8288     if test "$MOZ_X11"; then
8289         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8290     fi
8292     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8293 else
8294     PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8295     MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8296     MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8297     PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8298     if test "$MOZ_X11"; then
8299         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8300         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8301         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8302         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8303     fi
8306 AC_SUBST(MOZ_TREE_CAIRO)
8307 AC_SUBST(MOZ_CAIRO_CFLAGS)
8308 AC_SUBST(MOZ_CAIRO_LIBS)
8309 AC_SUBST(MOZ_CAIRO_OSLIBS)
8310 AC_SUBST(MOZ_TREE_PIXMAN)
8312 dnl ========================================================
8313 dnl qcms
8314 dnl ========================================================
8316 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8317 AC_SUBST(QCMS_LIBS)
8319 dnl ========================================================
8320 dnl HarfBuzz
8321 dnl ========================================================
8322 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8323 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8325 dnl ========================================================
8326 dnl SIL Graphite
8327 dnl ========================================================
8328 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8329 AC_SUBST(MOZ_GRAPHITE_LIBS)
8331 dnl ========================================================
8332 dnl OTS
8333 dnl ========================================================
8334 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8335 AC_SUBST(MOZ_OTS_LIBS)
8337 dnl ========================================================
8338 dnl Skia 
8339 dnl ========================================================
8340 if test "$MOZ_ENABLE_SKIA"; then
8341   MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8342   AC_DEFINE(MOZ_ENABLE_SKIA)
8343   AC_DEFINE(USE_SKIA)
8344   if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8345     AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8346   elif test "$OS_ARCH" = "WINNT"; then
8347     AC_DEFINE(SKIA_DLL)
8348     AC_DEFINE(GR_DLL)
8349   fi
8351   if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64"; then
8352     MOZ_ENABLE_SKIA_GPU=1
8353     AC_DEFINE(USE_SKIA_GPU)
8354     AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8355   fi
8356 else
8357   MOZ_SKIA_LIBS=
8359 AC_SUBST(MOZ_ENABLE_SKIA)
8360 AC_SUBST(MOZ_SKIA_LIBS)
8362 dnl ========================================================
8363 dnl disable xul
8364 dnl ========================================================
8365 MOZ_ARG_DISABLE_BOOL(xul,
8366 [  --disable-xul           Disable XUL],
8367     MOZ_XUL= )
8368 if test "$MOZ_XUL"; then
8369   AC_DEFINE(MOZ_XUL)
8370 else
8371   dnl remove extensions that require XUL
8372   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8375 AC_SUBST(MOZ_XUL)
8377 dnl ========================================================
8378 dnl disable profile locking
8379 dnl   do no use this in applications that can have more than
8380 dnl   one process accessing the profile directory.
8381 dnl ========================================================
8382 MOZ_ARG_DISABLE_BOOL(profilelocking,
8383 [  --disable-profilelocking
8384                           Disable profile locking],
8385     MOZ_PROFILELOCKING=,
8386     MOZ_PROFILELOCKING=1 )
8387 if test "$MOZ_PROFILELOCKING"; then
8388   AC_DEFINE(MOZ_PROFILELOCKING)
8391 dnl ========================================================
8392 dnl necko configuration options
8393 dnl ========================================================
8396 dnl option to disable various necko protocols
8398 MOZ_ARG_ENABLE_STRING(necko-protocols,
8399 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8400                           Enable/disable specific protocol handlers],
8401 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8402     if test "$option" = "yes" -o "$option" = "all"; then
8403         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8404     elif test "$option" = "no" -o "$option" = "none"; then
8405         NECKO_PROTOCOLS=""
8406     elif test "$option" = "default"; then
8407         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8408     elif test `echo "$option" | grep -c \^-` != 0; then
8409         option=`echo $option | sed 's/^-//'`
8410         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8411     else
8412         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8413     fi
8414 done],
8415     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8416 dnl Remove dupes
8417 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8418 AC_SUBST(NECKO_PROTOCOLS)
8419 for p in $NECKO_PROTOCOLS; do
8420     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8421     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8422 done
8425 dnl option to disable necko's wifi scanner
8427 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8428 [  --disable-necko-wifi    Disable necko wifi scanner],
8429     NECKO_WIFI=,
8430     NECKO_WIFI=1)
8432 if test "$OS_ARCH" = "OS2"; then
8433   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8434   NECKO_WIFI=
8436 if test "$NECKO_WIFI" -a \
8437         "$OS_ARCH" != "Linux" -a \
8438         "$OS_ARCH" != "Darwin" -a \
8439         "$OS_ARCH" != "SunOS" -a \
8440         "$OS_ARCH" != "WINNT"; then
8441   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8444 if test "$NECKO_WIFI"; then
8445   AC_DEFINE(NECKO_WIFI)
8446   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8448 AC_SUBST(NECKO_WIFI)
8451 dnl option to disable cookies
8453 MOZ_ARG_DISABLE_BOOL(cookies,
8454 [  --disable-cookies       Disable cookie support],
8455     NECKO_COOKIES=,
8456     NECKO_COOKIES=1)
8457 AC_SUBST(NECKO_COOKIES)
8458 if test "$NECKO_COOKIES"; then
8459     AC_DEFINE(NECKO_COOKIES)
8460     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8464 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8466 MOZ_ARG_DISABLE_BOOL(ctypes,
8467 [  --disable-ctypes        Disable js-ctypes],
8468     BUILD_CTYPES=,
8469     BUILD_CTYPES=1)
8470 AC_SUBST(BUILD_CTYPES)
8471 if test "$BUILD_CTYPES"; then
8472     AC_DEFINE(BUILD_CTYPES)
8475 dnl Build Places if required
8476 if test "$MOZ_PLACES"; then
8477   AC_DEFINE(MOZ_PLACES)
8480 dnl Build SocialAPI if required
8481 if test "$MOZ_SOCIAL"; then
8482   AC_DEFINE(MOZ_SOCIAL)
8485 dnl Build Common JS modules provided by services.
8486 AC_SUBST(MOZ_SERVICES_COMMON)
8487 if test -n "$MOZ_SERVICES_COMMON"; then
8488   AC_DEFINE(MOZ_SERVICES_COMMON)
8491 dnl Build Services crypto component (used by Sync)
8492 AC_SUBST(MOZ_SERVICES_CRYPTO)
8493 if test -n "$MOZ_SERVICES_CRYPTO"; then
8494   AC_DEFINE(MOZ_SERVICES_CRYPTO)
8497 dnl Build Firefox Health Reporter Service
8498 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8499 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8500   AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8503 dnl Build Services metrics component
8504 AC_SUBST(MOZ_SERVICES_METRICS)
8505 if test -n "$MOZ_SERVICES_METRICS"; then
8506   AC_DEFINE(MOZ_SERVICES_METRICS)
8509 dnl Build Notifications if required
8510 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8511 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8512   AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8515 dnl Build Sync Services if required
8516 AC_SUBST(MOZ_SERVICES_SYNC)
8517 if test -n "$MOZ_SERVICES_SYNC"; then
8518   AC_DEFINE(MOZ_SERVICES_SYNC)
8521 dnl Build Captive Portal Detector if required
8522 AC_SUBST(MOZ_CAPTIVEDETECT)
8523 if test -n "$MOZ_CAPTIVEDETECT"; then
8524   AC_DEFINE(MOZ_CAPTIVEDETECT)
8527 dnl Build WBMP decoder if required
8528 AC_SUBST(MOZ_WBMP)
8529 if test -n "$MOZ_WBMP"; then
8530   AC_DEFINE(MOZ_WBMP)
8533 dnl ========================================================
8534 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8535     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8538 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8539   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8542 if test "$MOZ_APP_COMPONENT_MODULES"; then
8543   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8546 dnl ========================================================
8547 dnl =
8548 dnl = Maintainer debug option (no --enable equivalent)
8549 dnl =
8550 dnl ========================================================
8552 AC_SUBST(AR)
8553 AC_SUBST(AR_FLAGS)
8554 AC_SUBST(AR_LIST)
8555 AC_SUBST(AR_EXTRACT)
8556 AC_SUBST(AR_DELETE)
8557 AC_SUBST(AS)
8558 AC_SUBST(ASFLAGS)
8559 AC_SUBST(AS_DASH_C_FLAG)
8560 AC_SUBST(LD)
8561 AC_SUBST(RC)
8562 AC_SUBST(RCFLAGS)
8563 AC_SUBST(MC)
8564 AC_SUBST(WINDRES)
8565 AC_SUBST(IMPLIB)
8566 AC_SUBST(FILTER)
8567 AC_SUBST(BIN_FLAGS)
8568 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8569 AC_SUBST(MOZ_UPDATE_XTERM)
8570 AC_SUBST(MOZ_PLATFORM_MAEMO)
8571 AC_SUBST(MOZ_AUTH_EXTENSION)
8572 AC_SUBST(MOZ_PERMISSIONS)
8573 AC_SUBST(MOZ_PREF_EXTENSIONS)
8574 AC_SUBST(MOZ_JS_LIBS)
8575 AC_SUBST(MOZ_PSM)
8576 AC_SUBST(MOZ_DEBUG)
8577 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8578 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8579 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8580 AC_SUBST(MOZ_DEBUG_FLAGS)
8581 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8582 AC_SUBST(WARNINGS_AS_ERRORS)
8583 AC_SUBST(MOZ_EXTENSIONS)
8584 AC_SUBST(MOZ_JSDEBUGGER)
8585 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8586 AC_SUBST(MOZ_JPROF)
8587 AC_SUBST(MOZ_SHARK)
8588 AC_SUBST(MOZ_INSTRUMENTS)
8589 AC_SUBST(MOZ_CALLGRIND)
8590 AC_SUBST(MOZ_VTUNE)
8591 AC_SUBST(MOZ_PROFILING)
8592 AC_SUBST(LIBICONV)
8593 AC_SUBST(MOZ_PLACES)
8594 AC_SUBST(MOZ_SOCIAL)
8595 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8596 AC_SUBST(MOZ_FEEDS)
8597 AC_SUBST(NS_PRINTING)
8598 AC_SUBST(MOZ_WEBGL)
8599 AC_SUBST(MOZ_HELP_VIEWER)
8600 AC_SUBST(TOOLCHAIN_PREFIX)
8602 AC_SUBST(JAVA)
8603 AC_SUBST(JAVAC)
8604 AC_SUBST(JAVAH)
8605 AC_SUBST(JAR)
8607 AC_SUBST(MOZ_PROFILELOCKING)
8609 AC_SUBST(ENABLE_TESTS)
8610 AC_SUBST(ENABLE_MARIONETTE)
8611 AC_SUBST(IBMBIDI)
8612 AC_SUBST(MOZ_UNIVERSALCHARDET)
8613 AC_SUBST(ACCESSIBILITY)
8614 AC_SUBST(MOZ_SPELLCHECK)
8615 AC_SUBST(MOZ_ANDROID_OMTC)
8616 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8617 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8618 AC_SUBST(MOZ_CRASHREPORTER)
8619 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8620 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8621 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8622 AC_SUBST(MOZ_STUB_INSTALLER)
8623 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8624 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8625 AC_SUBST(MOZ_UPDATER)
8626 AC_SUBST(MOZ_ANGLE_RENDERER)
8627 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8628 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8629 AC_SUBST(MOZ_D3DX9_VERSION)
8630 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8631 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8632 AC_SUBST(MOZ_METRO)
8634 AC_SUBST(MOZ_ANDROID_HISTORY)
8635 AC_SUBST(MOZ_WEBSMS_BACKEND)
8636 AC_SUBST(MOZ_ANDROID_WALLPAPER)
8637 AC_SUBST(MOZ_ANDROID_BEAM)
8638 AC_SUBST(ENABLE_STRIP)
8639 AC_SUBST(PKG_SKIP_STRIP)
8640 AC_SUBST(STRIP_FLAGS)
8641 AC_SUBST(USE_ELF_DYNSTR_GC)
8642 AC_SUBST(USE_ELF_HACK)
8643 AC_SUBST(INCREMENTAL_LINKER)
8644 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8645 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8647 AC_SUBST(MOZ_FIX_LINK_PATHS)
8648 AC_SUBST(XPCOM_LIBS)
8649 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8650 AC_SUBST(XPCOM_GLUE_LDOPTS)
8651 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8652 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8653 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8655 AC_SUBST(USE_DEPENDENT_LIBS)
8657 AC_SUBST(MOZ_BUILD_ROOT)
8658 AC_SUBST(MOZ_OS2_TOOLS)
8660 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8661 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8662 AC_SUBST(MOZ_LINKER_EXTRACT)
8664 dnl ========================================================
8665 dnl = Mac bundle name prefix
8666 dnl ========================================================
8667 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8668 [  --with-macbundlename-prefix=prefix
8669                           Prefix for MOZ_MACBUNDLE_NAME],
8670 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8672 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8673 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8674   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8677 if test "$MOZ_DEBUG"; then
8678   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8679 else
8680   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8682 AC_SUBST(MOZ_MACBUNDLE_NAME)
8684 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8685 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8686 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8687 if test "$MOZ_DEBUG"; then
8688   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8691 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8692 AC_SUBST(MOZ_MACBUNDLE_ID)
8694 dnl ========================================================
8695 dnl = Child Process Name for IPC
8696 dnl ========================================================
8697 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8698   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8699 else
8700   # We want to let Android unpack the file at install time, but it only does
8701   # so if the file is named libsomething.so. The lib/ path is also required
8702   # because the unpacked file will be under the lib/ subdirectory and will
8703   # need to be executed from that path.
8704   MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8706 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8708 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8709 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8711 # The following variables are available to branding and application
8712 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8713 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8714 # impacts profile location and user-visible fields.
8715 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8716 # versions of a given application (e.g. Aurora and Firefox both use
8717 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8718 # for application.ini's "Name" field, which controls profile location in
8719 # the absence of a "Profile" field (see below), and various system
8720 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8721 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8722 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8723 # builds (e.g. Aurora for Firefox).
8724 # - MOZ_APP_VERSION: Defines the application version number.
8725 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8726 # defaults to a lowercase form of MOZ_APP_BASENAME.
8727 # - MOZ_APP_PROFILE: When set, used for application.ini's
8728 # "Profile" field, which controls profile location.
8729 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8730 # crash reporter server url.
8731 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8732 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8734 if test -z "$MOZ_APP_NAME"; then
8735    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8738 # For extensions and langpacks, we require a max version that is compatible
8739 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8740 # 10.0a1 and 10.0a2 aren't affected
8741 # 10.0 becomes 10.0.*
8742 # 10.0.1 becomes 10.0.*
8743 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8744 if test -z "$IS_ALPHA"; then
8745   changequote(,)
8746   MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8747   changequote([,])
8748 else
8749   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8752 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8753 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8754 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8756 AC_SUBST(MOZ_APP_NAME)
8757 AC_SUBST(MOZ_APP_DISPLAYNAME)
8758 AC_SUBST(MOZ_APP_BASENAME)
8759 AC_SUBST(MOZ_APP_VENDOR)
8760 AC_SUBST(MOZ_APP_PROFILE)
8761 AC_SUBST(MOZ_APP_ID)
8762 AC_SUBST(MAR_CHANNEL_ID)
8763 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8764 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8765 AC_SUBST(MOZ_EXTENSION_MANAGER)
8766 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8767 AC_SUBST(MOZ_APP_UA_NAME)
8768 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8769 AC_SUBST(MOZ_APP_VERSION)
8770 AC_SUBST(MOZ_APP_MAXVERSION)
8771 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8772 AC_SUBST(FIREFOX_VERSION)
8773 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8774 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8775   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8777 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8778 AC_SUBST(MOZ_UA_BUILDID)
8780 AC_SUBST(MOZ_APP_STATIC_INI)
8782 AC_SUBST(MOZ_PKG_SPECIAL)
8784 AC_SUBST(MOZILLA_OFFICIAL)
8786 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8787 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8789 if test "$MOZ_TELEMETRY_REPORTING"; then
8790     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8792     # Enable Telemetry by default for nightly and aurora channels
8793     if test "$MOZ_UPDATE_CHANNEL" = "nightly" -o \
8794         "$MOZ_UPDATE_CHANNEL" = "aurora"; then
8795         AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8796     fi
8799 dnl If we have any service that uploads data (and requires data submission
8800 dnl policy alert), set MOZ_DATA_REPORTING.
8801 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8802 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8803   MOZ_DATA_REPORTING=1
8804   AC_DEFINE(MOZ_DATA_REPORTING)
8805   AC_SUBST(MOZ_DATA_REPORTING)
8808 dnl win32 options
8809 AC_SUBST(MOZ_MAPINFO)
8810 AC_SUBST(MOZ_BROWSE_INFO)
8811 AC_SUBST(MOZ_TOOLS_DIR)
8812 AC_SUBST(WIN32_REDIST_DIR)
8813 AC_SUBST(MAKENSISU)
8815 dnl Echo the CFLAGS to remove extra whitespace.
8816 CFLAGS=`echo \
8817         $_WARNINGS_CFLAGS \
8818         $CFLAGS`
8820 CXXFLAGS=`echo \
8821         $_WARNINGS_CXXFLAGS \
8822         $CXXFLAGS`
8824 COMPILE_CFLAGS=`echo \
8825     $_DEFINES_CFLAGS \
8826         $_DEPEND_CFLAGS \
8827     $COMPILE_CFLAGS`
8829 COMPILE_CXXFLAGS=`echo \
8830     $_DEFINES_CXXFLAGS \
8831         $_DEPEND_CFLAGS \
8832     $COMPILE_CXXFLAGS`
8834 AC_SUBST(SYSTEM_LIBXUL)
8835 AC_SUBST(MOZ_NATIVE_JPEG)
8836 AC_SUBST(MOZ_NATIVE_PNG)
8837 AC_SUBST(MOZ_NATIVE_BZ2)
8839 AC_SUBST(MOZ_JPEG_CFLAGS)
8840 AC_SUBST(MOZ_JPEG_LIBS)
8841 AC_SUBST(MOZ_BZ2_CFLAGS)
8842 AC_SUBST(MOZ_BZ2_LIBS)
8843 AC_SUBST(MOZ_PNG_CFLAGS)
8844 AC_SUBST(MOZ_PNG_LIBS)
8846 AC_SUBST(NSPR_CFLAGS)
8847 AC_SUBST(NSPR_LIBS)
8848 AC_SUBST(MOZ_NATIVE_NSPR)
8850 AC_SUBST(NSS_CFLAGS)
8851 AC_SUBST(NSS_LIBS)
8852 AC_SUBST(MOZ_NATIVE_NSS)
8853 AC_SUBST(NSS_DISABLE_DBM)
8855 OS_CFLAGS="$CFLAGS"
8856 OS_CXXFLAGS="$CXXFLAGS"
8857 OS_CPPFLAGS="$CPPFLAGS"
8858 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8859 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8860 OS_LDFLAGS="$LDFLAGS"
8861 OS_LIBS="$LIBS"
8862 AC_SUBST(OS_CFLAGS)
8863 AC_SUBST(OS_CXXFLAGS)
8864 AC_SUBST(OS_CPPFLAGS)
8865 AC_SUBST(OS_COMPILE_CFLAGS)
8866 AC_SUBST(OS_COMPILE_CXXFLAGS)
8867 AC_SUBST(OS_LDFLAGS)
8868 AC_SUBST(OS_LIBS)
8869 AC_SUBST(CROSS_COMPILE)
8870 AC_SUBST(WCHAR_CFLAGS)
8872 AC_SUBST(HOST_CC)
8873 AC_SUBST(HOST_CXX)
8874 AC_SUBST(HOST_CFLAGS)
8875 AC_SUBST(HOST_CXXFLAGS)
8876 AC_SUBST(HOST_LDFLAGS)
8877 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8878 AC_SUBST(HOST_AR)
8879 AC_SUBST(HOST_AR_FLAGS)
8880 AC_SUBST(HOST_LD)
8881 AC_SUBST(HOST_RANLIB)
8882 AC_SUBST(HOST_NSPR_MDCPUCFG)
8883 AC_SUBST(HOST_BIN_SUFFIX)
8884 AC_SUBST(HOST_OS_ARCH)
8886 AC_SUBST(TARGET_CPU)
8887 AC_SUBST(TARGET_VENDOR)
8888 AC_SUBST(TARGET_OS)
8889 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8890 AC_SUBST(TARGET_MD_ARCH)
8891 AC_SUBST(TARGET_XPCOM_ABI)
8892 AC_SUBST(OS_TARGET)
8893 AC_SUBST(OS_ARCH)
8894 AC_SUBST(OS_RELEASE)
8895 AC_SUBST(OS_TEST)
8896 AC_SUBST(CPU_ARCH)
8897 AC_SUBST(INTEL_ARCHITECTURE)
8899 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8901 AC_SUBST(WRAP_LDFLAGS)
8902 AC_SUBST(MKSHLIB)
8903 AC_SUBST(MKCSHLIB)
8904 AC_SUBST(MKSHLIB_FORCE_ALL)
8905 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8906 AC_SUBST(DSO_CFLAGS)
8907 AC_SUBST(DSO_PIC_CFLAGS)
8908 AC_SUBST(DSO_LDOPTS)
8909 AC_SUBST(LIB_PREFIX)
8910 AC_SUBST(DLL_PREFIX)
8911 AC_SUBST(DLL_SUFFIX)
8912 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8913 AC_SUBST(LIB_SUFFIX)
8914 AC_SUBST(OBJ_SUFFIX)
8915 AC_SUBST(BIN_SUFFIX)
8916 AC_SUBST(ASM_SUFFIX)
8917 AC_SUBST(IMPORT_LIB_SUFFIX)
8918 AC_SUBST(USE_N32)
8919 AC_SUBST(CC_VERSION)
8920 AC_SUBST(CXX_VERSION)
8921 AC_SUBST(MSMANIFEST_TOOL)
8922 AC_SUBST(NS_ENABLE_TSF)
8923 AC_SUBST(MOZ_NSS_PATCH)
8924 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8925 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8927 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8928 AC_SUBST(MOZ_SOUNDTOUCH)
8929 AC_SUBST(MOZ_CUBEB)
8930 AC_SUBST(MOZ_WAVE)
8931 AC_SUBST(MOZ_VORBIS)
8932 AC_SUBST(MOZ_TREMOR)
8933 AC_SUBST(MOZ_OPUS)
8934 AC_SUBST(MOZ_WEBM)
8935 AC_SUBST(MOZ_DASH)
8936 AC_SUBST(MOZ_WMF)
8937 AC_SUBST(MOZ_MEDIA_PLUGINS)
8938 AC_SUBST(MOZ_OMX_PLUGIN)
8939 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8940 AC_SUBST(MOZ_VP8_ENCODER)
8941 AC_SUBST(MOZ_VP8)
8942 AC_SUBST(MOZ_OGG)
8943 AC_SUBST(VPX_AS)
8944 AC_SUBST(VPX_ASFLAGS)
8945 AC_SUBST(VPX_DASH_C_FLAG)
8946 AC_SUBST(VPX_AS_CONVERSION)
8947 AC_SUBST(VPX_ASM_SUFFIX)
8948 AC_SUBST(VPX_X86_ASM)
8949 AC_SUBST(VPX_ARM_ASM)
8950 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8951 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8952 AC_SUBST(LIBJPEG_TURBO_AS)
8953 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8954 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8955 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8956 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8958 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8959 AC_SUBST(MOZ_FOLD_LIBS)
8961 AC_SUBST(MOZ_ENABLE_SZIP)
8962 AC_SUBST(MOZ_SZIP_FLAGS)
8964 AC_MSG_CHECKING([for posix_fallocate])
8965 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8966   #include <fcntl.h>],
8967                  [posix_fallocate(0, 0, 0);],
8968                  [ac_cv___posix_fallocate=true],
8969                  [ac_cv___posix_fallocate=false])
8971 if test "$ac_cv___posix_fallocate" = true ; then
8972   AC_DEFINE(HAVE_POSIX_FALLOCATE)
8973   AC_MSG_RESULT(yes)
8974 else
8975   AC_MSG_RESULT(no)
8978 dnl Check for missing components
8979 if test "$COMPILE_ENVIRONMENT"; then
8980 if test "$MOZ_X11"; then
8981     if test "$WITHOUT_X11"; then
8982         AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8983     fi
8984     dnl ====================================================
8985     dnl = Check if X headers exist
8986     dnl ====================================================
8987     _SAVE_CFLAGS=$CFLAGS
8988     CFLAGS="$CFLAGS $XCFLAGS"
8989     AC_TRY_COMPILE([
8990         #include <stdio.h>
8991         #include <stdlib.h>
8992         #include <X11/Xlib.h>
8993         #include <X11/Intrinsic.h>
8994         #include <X11/extensions/XShm.h>
8995     ],
8996     [
8997         Display *dpy = 0;
8998         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8999             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
9000             exit(1);
9001         }
9002     ], [],
9003     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
9004     CFLAGS="$_SAVE_CFLAGS"
9006     if test -n "$MISSING_X"; then
9007         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
9008     fi
9010 fi # MOZ_X11
9012 dnl Check for headers, etc. needed by WebGL.
9013 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
9014     MOZ_CHECK_HEADER(GL/glx.h)
9015     if test "$ac_cv_header_GL_glx_h" != "yes"; then
9016         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))])
9017     fi
9018 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
9019 fi # COMPILE_ENVIRONMENT
9021 dnl Set various defines and substitutions
9022 dnl ========================================================
9024 if test "$OS_ARCH" = "Darwin"; then
9025   AC_DEFINE(XP_UNIX)
9026 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
9027   AC_DEFINE(XP_UNIX)
9030 if test "$MOZ_DEBUG"; then
9031     AC_DEFINE(MOZ_REFLOW_PERF)
9032     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9035 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
9036     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9037     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9038     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9039     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9040     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9041     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9042     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9043     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9046 AC_SUBST(MOZILLA_VERSION)
9048 AC_SUBST(ac_configure_args)
9050 dnl Spit out some output
9051 dnl ========================================================
9053 dnl The following defines are used by xpcom
9054 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9055 CPP_THROW_NEW
9056 HAVE_CPP_2BYTE_WCHAR_T
9057 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9058 HAVE_CPP_CHAR16_T
9059 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9060 HAVE_CPP_PARTIAL_SPECIALIZATION
9061 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9062 NEED_CPP_UNUSED_IMPLEMENTATIONS
9063 NEW_H
9064 HAVE_GETPAGESIZE
9065 HAVE_ICONV
9066 HAVE_ICONV_WITH_CONST_INPUT
9067 HAVE_MBRTOWC
9068 HAVE_WCRTOMB
9069 HAVE_STATVFS64
9070 HAVE_STATVFS
9071 HAVE_STATFS64
9072 HAVE_STATFS
9073 HAVE_SYS_STATVFS_H
9074 HAVE_SYS_STATFS_H
9075 HAVE_SYS_VFS_H
9076 HAVE_SYS_MOUNT_H
9079 # FUTURE? Consider moving all these to moz.build files.
9080 AC_CONFIG_HEADER(
9081 netwerk/necko-config.h
9082 xpcom/xpcom-config.h
9083 xpcom/xpcom-private.h
9086 AC_OUTPUT([mozilla-config.h])
9088 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
9089 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
9090 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
9091 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
9092 # (apparently) only need this hack when egrep's "pattern" is particularly long
9093 # (as in the following code) and the first egrep on our $PATH is Apple's.  See
9094 # bug 655339.
9095 case "$host" in
9096 *-apple-darwin11*)
9097     FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
9098     ;;
9100     FIXED_EGREP="egrep"
9101     ;;
9102 esac
9104 # Generate Makefiles for WebRTC directly from .gyp files
9105 if test "${OS_TARGET}" = "WINNT"; then
9106    if test "$HAVE_64BIT_OS"; then
9107       OS_BITS=64
9108    else
9109       OS_BITS=32
9110    fi
9111    EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
9113 elif test "${OS_TARGET}" = "Android"; then
9114    if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
9115       EXTRA_GYP_DEFINES="-G os=linux "
9116    else
9117       EXTRA_GYP_DEFINES="-D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
9118    fi
9121 if test -n "$ARM_ARCH"; then
9122     if test "$ARM_ARCH" -lt 7; then
9123         EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
9124     else
9125         if test "${OS_TARGET}" = "Android"; then
9126             EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=1 "
9127         else
9128             dnl CPU detection for ARM works on Android only.  armv7 always uses CPU detection, so
9129             dnl we have to set armv7=0 for non-Android target
9130             EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
9131         fi
9132     fi
9135 # Don't try to compile ssse3/sse4.1 code if toolchain doesn't support
9136 if test -z "$HAVE_TOOLCHAIN_SUPPORT_SSSE3" || test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
9137   EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
9140 if test -n "$MOZ_WEBRTC"; then
9141    AC_MSG_RESULT("generating WebRTC Makefiles...")
9143    if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
9144       EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D build_with_gonk=1 -D include_internal_audio_device=0"
9145    fi
9147 dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
9148 dnl so that regeneration via dependencies works correctly
9149    WEBRTC_CONFIG="-D build_with_mozilla=1 -D build_with_chromium=0 --include ${srcdir}/media/webrtc/webrtc_config.gypi -D FORCED_INCLUDE_FILE=${srcdir}/media/webrtc/webrtc_config.gypi"
9151    if test -n HAVE_CLOCK_MONOTONIC; then
9152       WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=1"
9153    else
9154       WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=0"
9155    fi
9157    GYP_WEBRTC_OPTIONS="--format=mozmake ${WEBRTC_CONFIG} -D target_arch=${WEBRTC_TARGET_ARCH} ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
9159    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9160      $GYP_WEBRTC_OPTIONS \
9161      --generator-output=${_objdir}/media/webrtc/trunk \
9162      ${srcdir}/media/webrtc/trunk/peerconnection.gyp
9163    if test "$?" != 0; then
9164       AC_MSG_ERROR([failed to generate WebRTC Makefiles])
9165    fi
9167    # XXX disable until we land the tranche with signaling
9168    if test -n "$MOZ_WEBRTC_SIGNALING"; then
9169      AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
9170      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9171        $GYP_WEBRTC_OPTIONS \
9172        -D build_for_test=0 \
9173        --generator-output=${_objdir}/media/webrtc/signaling \
9174        ${srcdir}/media/webrtc/signaling/signaling.gyp
9175      if test "$?" != 0; then
9176         AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
9177      fi
9179      AC_MSG_RESULT("generating WebRTC/SignalingTest Makefiles...")
9180      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9181        $GYP_WEBRTC_OPTIONS \
9182        -D build_for_test=1 \
9183        --generator-output=${_objdir}/media/webrtc/signalingtest \
9184        ${srcdir}/media/webrtc/signaling/signaling.gyp
9185      if test "$?" != 0; then
9186        AC_MSG_ERROR([failed to generate WebRTC/SignalingTest Makefiles])
9187      fi
9188    fi
9190    AC_MSG_RESULT("generating gtest Makefiles...")
9191    # Ok to pass some extra -D's that are ignored here
9192    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9193      $GYP_WEBRTC_OPTIONS \
9194      --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
9195      ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
9196    if test "$?" != 0; then
9197       AC_MSG_ERROR([failed to generate gtest Makefiles])
9198    fi
9200    AC_MSG_RESULT("generating nrappkit Makefiles...")
9201    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9202      $GYP_WEBRTC_OPTIONS \
9203      --generator-output=${_objdir}/media/mtransport/third_party/nrappkit \
9204      ${srcdir}/media/mtransport/third_party/nrappkit/nrappkit.gyp
9205    if test "$?" != 0; then
9206       AC_MSG_ERROR([failed to generate nrappkit Makefiles])
9207    fi
9209    AC_MSG_RESULT("generating nICEr Makefiles...")
9210    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9211      $GYP_WEBRTC_OPTIONS \
9212      --generator-output=${_objdir}/media/mtransport/third_party/nICEr \
9213      ${srcdir}/media/mtransport/third_party/nICEr/nicer.gyp
9214    if test "$?" != 0; then
9215       AC_MSG_ERROR([failed to generate nICEr Makefiles])
9216    fi
9219 # Generate a JSON config file for unittest harnesses etc to read
9220 # build configuration details from in a standardized way.
9221 OS_TARGET=${OS_TARGET} \
9222 TARGET_CPU=${TARGET_CPU} \
9223 MOZ_DEBUG=${MOZ_DEBUG} \
9224 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} \
9225 UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
9226 MOZ_CRASHREPORTER=${MOZ_CRASHREPORTER} \
9227 MOZ_APP_NAME=${MOZ_APP_NAME} \
9228 TOPSRCDIR=${_topsrcdir} \
9229 MOZ_ASAN=${MOZ_ASAN} \
9230   $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
9231 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
9232   rm ./mozinfo.json.tmp
9233 else
9234   mv -f ./mozinfo.json.tmp ./mozinfo.json
9237 # Run jemalloc configure script
9239 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
9240   ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
9241   if test -n "$MOZ_REPLACE_MALLOC"; then
9242     # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9243     ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9244     ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9245   fi
9246   if test -n "$MOZ_JEMALLOC3"; then
9247     case "${OS_ARCH}" in
9248       WINNT|Darwin)
9249         # We want jemalloc functions to be kept hidden on both Mac and Windows
9250         # See memory/build/mozmemory_wrap.h for details.
9251         ac_configure_args="$ac_configure_args --without-export"
9252         ;;
9253     esac
9254   elif test "${OS_ARCH}" = Darwin; then
9255     # When building as a replace-malloc lib, disabling the zone allocator
9256     # forces to use pthread_atfork.
9257     ac_configure_args="$ac_configure_args --disable-zone-allocator"
9258   fi
9259   _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9260   JEMALLOC_WRAPPER=
9261   if test -z "$MOZ_REPLACE_MALLOC"; then
9262     case "$OS_ARCH" in
9263       Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9264         MANGLE=$_MANGLE
9265         ;;
9266     esac
9267   elif test -z "$MOZ_JEMALLOC3"; then
9268     MANGLE=$_MANGLE
9269     JEMALLOC_WRAPPER=replace_
9270   fi
9271   if test -n "$MANGLE"; then
9272     MANGLED=
9273     if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
9274       JEMALLOC_WRAPPER=__wrap_
9275     fi
9276     for mangle in ${MANGLE}; do
9277       if test -n "$MANGLED"; then
9278         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9279       else
9280         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9281       fi
9282     done
9283     ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9284   fi
9285   unset CONFIG_FILES
9286   if test -z "$MOZ_TLS"; then
9287     ac_configure_args="$ac_configure_args --disable-tls"
9288   fi
9289   EXTRA_CFLAGS="$CFLAGS"
9290   for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9291     ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9292   done
9293   if test "$CROSS_COMPILE"; then
9294     ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9295   fi
9296   _save_cache_file="$cache_file"
9297   cache_file=$_objdir/memory/jemalloc/src/config.cache
9299   if ! test -e memory/jemalloc; then
9300     mkdir -p memory/jemalloc
9301   fi
9303   AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9304   cache_file="$_save_cache_file"
9305   ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9308 # Run freetype configure script
9310 if test "$MOZ_TREE_FREETYPE"; then
9311    export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9312    export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9313    export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9314    export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9315    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9316    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9318    if ! test -e modules; then
9319      mkdir modules
9320    fi
9322    AC_OUTPUT_SUBDIRS(modules/freetype2)
9325 if test -z "$direct_nspr_config"; then
9326     dnl ========================================================
9327     dnl = Setup a nice relatively clean build environment for
9328     dnl = sub-configures.
9329     dnl ========================================================
9330     CC="$_SUBDIR_CC"
9331     CXX="$_SUBDIR_CXX"
9332     CFLAGS="$_SUBDIR_CFLAGS"
9333     CPPFLAGS="$_SUBDIR_CPPFLAGS"
9334     CXXFLAGS="$_SUBDIR_CXXFLAGS"
9335     LDFLAGS="$_SUBDIR_LDFLAGS"
9336     HOST_CC="$_SUBDIR_HOST_CC"
9337     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9338     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9339     RC=
9342 unset MAKEFILES
9343 unset CONFIG_FILES
9345 # Run all configure scripts specified by a subconfigure
9346 if test -n "$_subconfigure_subdir"; then
9347   _save_ac_configure_args="$ac_configure_args"
9348   ac_configure_args="$_subconfigure_config_args"
9349   AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
9350   ac_configure_args="$_save_ac_configure_args"
9353 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9354 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9356 export WRAP_LDFLAGS
9358 if test -n "$_WRAP_MALLOC"; then
9359     # Avoid doubling wrap malloc arguments
9360     _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9363 if test -z "$MOZ_NATIVE_NSPR"; then
9364     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9365     if test -z "$MOZ_DEBUG"; then
9366         ac_configure_args="$ac_configure_args --disable-debug"
9367     else
9368         ac_configure_args="$ac_configure_args --enable-debug"
9369     fi
9370     if test "$MOZ_OPTIMIZE" = "1"; then
9371         ac_configure_args="$ac_configure_args --enable-optimize"
9372     elif test -z "$MOZ_OPTIMIZE"; then
9373         ac_configure_args="$ac_configure_args --disable-optimize"
9374     fi
9375     if test -n "$HAVE_64BIT_OS"; then
9376         ac_configure_args="$ac_configure_args --enable-64bit"
9377     fi
9378     if test -n "$USE_ARM_KUSER"; then
9379         ac_configure_args="$ac_configure_args --with-arm-kuser"
9380     fi
9381     ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9383     # Save these, so we can mess with them for the subconfigure ..
9384     _SAVE_CFLAGS="$CFLAGS"
9385     _SAVE_CPPFLAGS="$CPPFLAGS"
9386     _SAVE_LDFLAGS="$LDFLAGS"
9388     if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9389       # dladdr is supported by the new linker, even when the system linker doesn't
9390       # support it. Trick nspr into using dladdr when it's not supported.
9391       export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9392     fi
9393     export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9394     export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
9396     AC_OUTPUT_SUBDIRS(nsprpub)
9398     # .. and restore them
9399     unset CFLAGS
9400     unset CPPFLAGS
9401     unset LDFLAGS
9402     CFLAGS="$_SAVE_CFLAGS"
9403     CPPFLAGS="$_SAVE_CPPFLAGS"
9404     LDFLAGS="$_SAVE_LDFLAGS"
9406     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9409 dnl ========================================================
9410 dnl = Setup a nice relatively clean build environment for
9411 dnl = sub-configures.
9412 dnl ========================================================
9413 CC="$_SUBDIR_CC"
9414 CXX="$_SUBDIR_CXX"
9415 CFLAGS="$_SUBDIR_CFLAGS"
9416 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9417 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9418 LDFLAGS="$_SUBDIR_LDFLAGS"
9419 HOST_CC="$_SUBDIR_HOST_CC"
9420 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9421 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9424 if test -n "$ENABLE_CLANG_PLUGIN"; then
9425     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9426     AC_OUTPUT_SUBDIRS(build/clang-plugin)
9430 # Run the SpiderMonkey 'configure' script.
9431 dist=$MOZ_BUILD_ROOT/dist
9432 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9433 ac_configure_args="$ac_configure_args --enable-threadsafe"
9434 if test "$BUILD_CTYPES"; then
9435     # Build js-ctypes on the platforms we can.
9436     ac_configure_args="$ac_configure_args --enable-ctypes"
9438 if test -z "$JS_SHARED_LIBRARY" ; then
9439     ac_configure_args="$ac_configure_args --disable-shared-js"
9441 if test -z "$MOZ_NATIVE_NSPR"; then
9442     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9443     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9445 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9446 ac_configure_args="$ac_configure_args --prefix=$dist"
9447 if test "$MOZ_MEMORY"; then
9448    ac_configure_args="$ac_configure_args --enable-jemalloc"
9450 if test -n "$MOZ_GLUE_LDFLAGS"; then
9451    export MOZ_GLUE_LDFLAGS
9453 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9454    export MOZ_GLUE_PROGRAM_LDFLAGS
9456 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9457    MOZ_ZLIB_LIBS=
9459 export MOZ_NATIVE_ZLIB
9460 export MOZ_ZLIB_CFLAGS
9461 export MOZ_ZLIB_LIBS
9462 export MOZ_APP_NAME
9463 export DONT_POPULATE_VIRTUALENV=1
9464 export PYTHON
9465 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9466 export STLPORT_CPPFLAGS
9467 export STLPORT_LDFLAGS
9468 export STLPORT_LIBS
9469 export JS_STANDALONE=no
9471 if ! test -e js; then
9472     mkdir js
9475 AC_OUTPUT_SUBDIRS(js/src)
9476 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9478 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR