bug 812562 - click-to-play: reshow notification for blocklisted plugins r=jaws
[gecko.git] / configure.in
blobec1694770bef5fe3b53a859b6cf9e6f852bcc2d5
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 MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1`
20 AC_SUBST(MOZ_DEB_TIMESTAMP)
22 dnl ========================================================
23 dnl =
24 dnl = Don't change the following two lines.  Doing so breaks:
25 dnl =
26 dnl = CFLAGS="-foo" ./configure
27 dnl =
28 dnl ========================================================
29 CFLAGS="${CFLAGS=}"
30 CPPFLAGS="${CPPFLAGS=}"
31 CXXFLAGS="${CXXFLAGS=}"
32 LDFLAGS="${LDFLAGS=}"
33 HOST_CFLAGS="${HOST_CFLAGS=}"
34 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
35 HOST_LDFLAGS="${HOST_LDFLAGS=}"
37 dnl ========================================================
38 dnl = Preserve certain environment flags passed to configure
39 dnl = We want sub projects to receive the same flags
40 dnl = untainted by this configure script
41 dnl ========================================================
42 _SUBDIR_CC="$CC"
43 _SUBDIR_CXX="$CXX"
44 _SUBDIR_CFLAGS="$CFLAGS"
45 _SUBDIR_CPPFLAGS="$CPPFLAGS"
46 _SUBDIR_CXXFLAGS="$CXXFLAGS"
47 _SUBDIR_LDFLAGS="$LDFLAGS"
48 _SUBDIR_HOST_CC="$HOST_CC"
49 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
50 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
51 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
52 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
54 dnl Set the version number of the libs included with mozilla
55 dnl ========================================================
56 MOZJPEG=62
57 MOZPNG=10513
58 NSPR_VERSION=4
59 NSS_VERSION=3
61 dnl Set the minimum version of toolkit libs used by mozilla
62 dnl ========================================================
63 GLIB_VERSION=1.2.0
64 PERL_VERSION=5.006
65 CAIRO_VERSION=1.10
66 PANGO_VERSION=1.14.0
67 GTK2_VERSION=2.10.0
68 WINDRES_VERSION=2.14.90
69 W32API_VERSION=3.14
70 GNOMEVFS_VERSION=2.0
71 GNOMEUI_VERSION=2.2.0
72 GCONF_VERSION=1.2.1
73 GIO_VERSION=2.20
74 STARTUP_NOTIFICATION_VERSION=0.8
75 DBUS_VERSION=0.60
76 SQLITE_VERSION=3.7.14.1
78 MSMANIFEST_TOOL=
80 dnl Set various checks
81 dnl ========================================================
82 MISSING_X=
83 AC_PROG_AWK
85 dnl Initialize the Pthread test variables early so they can be
86 dnl  overridden by each platform.
87 dnl ========================================================
88 USE_PTHREADS=
89 _PTHREAD_LDFLAGS=""
91 dnl Do not allow a separate objdir build if a srcdir build exists.
92 dnl ==============================================================
93 _topsrcdir=`cd \`dirname $0\`; pwd`
94 _objdir=`pwd`
96 if test "$_topsrcdir" != "$_objdir"
97 then
98   # Check for a couple representative files in the source tree
99   _conflict_files=
100   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
101     if test -f $file; then
102       _conflict_files="$_conflict_files $file"
103     fi
104   done
105   if test "$_conflict_files"; then
106     echo "***"
107     echo "*   Your source tree contains these files:"
108     for file in $_conflict_files; do
109       echo "*         $file"
110     done
111     cat 1>&2 <<-EOF
112         *   This indicates that you previously built in the source tree.
113         *   A source tree build can confuse the separate objdir build.
114         *
115         *   To clean up the source tree:
116         *     1. cd $_topsrcdir
117         *     2. gmake distclean
118         ***
119         EOF
120     exit 1
121     break
122   fi
124 MOZ_BUILD_ROOT=`pwd`
126 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
127 if test -z "$PYTHON"; then
128     AC_MSG_ERROR([python was not found in \$PATH])
131 AC_MSG_RESULT([Creating Python environment])
132 dnl This verifies our Python version is sane and ensures the Python
133 dnl virtualenv is present and up to date. It sanitizes the environment
134 dnl for us, so we don't need to clean anything out.
135 $PYTHON $_topsrcdir/build/virtualenv/populate_virtualenv.py \
136     $_topsrcdir $MOZ_BUILD_ROOT/_virtualenv || exit 1
138 dnl Create a virtualenv where we can install local Python packages
139 case "$host_os" in
140 mingw*)
141     PYTHON=`cd $MOZ_BUILD_ROOT && pwd -W`/_virtualenv/Scripts/python.exe
142     ;;
144     PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python
145     ;;
146 esac
148 AC_SUBST(PYTHON)
150 MOZ_DEFAULT_COMPILER
152 COMPILE_ENVIRONMENT=1
153 MOZ_ARG_DISABLE_BOOL(compile-environment,
154 [  --disable-compile-environment
155                           Disable compiler/library checks.],
156     COMPILE_ENVIRONMENT= )
157 AC_SUBST(COMPILE_ENVIRONMENT)
159 MOZ_ARG_WITH_STRING(l10n-base,
160 [  --with-l10n-base=DIR    path to l10n repositories],
161     L10NBASEDIR=$withval)
162 if test -n "$L10NBASEDIR"; then
163     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
164         AC_MSG_ERROR([--with-l10n-base must specify a path])
165     elif test -d "$L10NBASEDIR"; then
166         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
167     else
168         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
169     fi
171 AC_SUBST(L10NBASEDIR)
173 dnl Check for Perl first -- needed for win32 SDK checks
174 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
175 if test -z "$PERL" -o "$PERL" = ":"; then
176     AC_MSG_ERROR([perl not found in \$PATH])
179 AC_SUBST(GAIADIR)
180 if test -n "$GAIADIR" ; then
181     AC_DEFINE(PACKAGE_GAIA)
184 MOZ_ARG_WITH_STRING(gonk,
185 [  --with-gonk=DIR
186                location of gonk dir],
187     gonkdir=$withval)
189 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
190 [  --with-gonk-toolchain-prefix=DIR
191                           prefix to gonk toolchain commands],
192     gonk_toolchain_prefix=$withval)
194 if test -n "$gonkdir" ; then
195     kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
196     android_source="$gonkdir"
197     ANDROID_SOURCE="$android_source"
198     ANDROID_NDK="${ANDROID_SOURCE}/ndk"
200     dnl set up compilers
201     TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
202     AS="$gonk_toolchain_prefix"as
203     CC="$gonk_toolchain_prefix"gcc
204     CXX="$gonk_toolchain_prefix"g++
205     CPP="$gonk_toolchain_prefix"cpp
206     LD="$gonk_toolchain_prefix"ld
207     AR="$gonk_toolchain_prefix"ar
208     RANLIB="$gonk_toolchain_prefix"ranlib
209     STRIP="$gonk_toolchain_prefix"strip
210     OBJCOPY="$gonk_toolchain_prefix"objcopy
212     STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/ -I$gonkdir/external/stlport/stlport/"
213     STLPORT_LIBS="-lstlport"
215     case "$target_cpu" in
216     arm)
217         ARCH_DIR=arch-arm
218         ;;
219     i?86)
220         ARCH_DIR=arch-x86
221         ;;
222     esac
224     CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice -I$gonkdir/frameworks/base/services/camera -I$gonkdir/system/media/wilhelm/include -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/dalvik/libnativehelper/include/nativehelper"
225     CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
226     CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
227     dnl Add -llog by default, since we use it all over the place.
228     LIBS="$LIBS -llog $STLPORT_LIBS"
230     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"
232     dnl prevent cross compile section from using these flags as host flags
233     if test -z "$HOST_CPPFLAGS" ; then
234         HOST_CPPFLAGS=" "
235     fi
236     if test -z "$HOST_CFLAGS" ; then
237         HOST_CFLAGS=" "
238     fi
239     if test -z "$HOST_CXXFLAGS" ; then
240         HOST_CXXFLAGS=" "
241     fi
242     if test -z "$HOST_LDFLAGS" ; then
243         HOST_LDFLAGS=" "
244     fi
246     AC_DEFINE(ANDROID)
247     AC_DEFINE(HAVE_SYS_UIO_H)
248     AC_DEFINE(HAVE_PTHREADS)
249     CROSS_COMPILE=1
250     MOZ_CHROME_FILE_FORMAT=omni
251     direct_nspr_config=1
252 else
253     MOZ_ANDROID_NDK
255     case "$target" in
256     *-android*|*-linuxandroid*)
257         if test -z "$ANDROID_PACKAGE_NAME" ; then
258             ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
259         fi
260         MOZ_CHROME_FILE_FORMAT=omni
261         ZLIB_DIR=yes
262         ;;
263     *-linux*)
264         AC_PATH_PROG(OBJCOPY,objcopy)
265         ;;
266     esac
269 AC_SUBST(ANDROID_SOURCE)
270 AC_SUBST(ANDROID_PACKAGE_NAME)
271 AC_SUBST(OBJCOPY)
273 dnl ========================================================
274 dnl Checks for compilers.
275 dnl ========================================================
276 dnl Set CROSS_COMPILE in the environment when running configure
277 dnl to use the cross-compile setup for now
278 dnl ========================================================
280 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
281 AR_FLAGS='cr $@'
283 if test "$COMPILE_ENVIRONMENT"; then
285 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
286     echo "cross compiling from $host to $target"
287     cross_compiling=yes
289     _SAVE_CC="$CC"
290     _SAVE_CFLAGS="$CFLAGS"
291     _SAVE_LDFLAGS="$LDFLAGS"
293     AC_MSG_CHECKING([for host c compiler])
294     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
295     if test -z "$HOST_CC"; then
296         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
297     fi
298     AC_MSG_RESULT([$HOST_CC])
299     AC_MSG_CHECKING([for host c++ compiler])
300     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
301     if test -z "$HOST_CXX"; then
302         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
303     fi
304     AC_MSG_RESULT([$HOST_CXX])
306     if test -z "$HOST_CFLAGS"; then
307         HOST_CFLAGS="$CFLAGS"
308     fi
309     if test -z "$HOST_CXXFLAGS"; then
310         HOST_CXXFLAGS="$CXXFLAGS"
311     fi
312     if test -z "$HOST_LDFLAGS"; then
313         HOST_LDFLAGS="$LDFLAGS"
314     fi
315     if test -z "$HOST_AR_FLAGS"; then
316         HOST_AR_FLAGS="$AR_FLAGS"
317     fi
318     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
319     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
320     CC="$HOST_CC"
321     CFLAGS="$HOST_CFLAGS"
322     LDFLAGS="$HOST_LDFLAGS"
324     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
325     AC_TRY_COMPILE([], [return(0);],
326         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
327         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
329     CC="$HOST_CXX"
330     CFLAGS="$HOST_CXXFLAGS"
332     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
333     AC_TRY_COMPILE([], [return(0);],
334         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
335         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
337     CC=$_SAVE_CC
338     CFLAGS=$_SAVE_CFLAGS
339     LDFLAGS=$_SAVE_LDFLAGS
341     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
342     unset ac_cv_prog_CC
343     AC_PROG_CC
344     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
345     unset ac_cv_prog_CXX
346     AC_PROG_CXX
348     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
349     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
350     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
351     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
352     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
353     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
354     AC_DEFINE(CROSS_COMPILE)
355 else
356     AC_PROG_CC
357     case "$target" in
358     *-mingw*)
359       # Work around the conftest.exe access problem on Windows
360       sleep 2
361     esac
362     AC_PROG_CXX
363     AC_PROG_RANLIB
364     MOZ_PATH_PROGS(AS, $AS as, $CC)
365     AC_CHECK_PROGS(AR, ar, :)
366     AC_CHECK_PROGS(LD, ld, :)
367     AC_CHECK_PROGS(STRIP, strip, :)
368     AC_CHECK_PROGS(WINDRES, windres, :)
369     if test -z "$HOST_CC"; then
370         HOST_CC="$CC"
371     fi
372     if test -z "$HOST_CFLAGS"; then
373         HOST_CFLAGS="$CFLAGS"
374     fi
375     if test -z "$HOST_CXX"; then
376         HOST_CXX="$CXX"
377     fi
378     if test -z "$HOST_CXXFLAGS"; then
379         HOST_CXXFLAGS="$CXXFLAGS"
380     fi
381     if test -z "$HOST_LDFLAGS"; then
382         HOST_LDFLAGS="$LDFLAGS"
383     fi
384     if test -z "$HOST_RANLIB"; then
385         HOST_RANLIB="$RANLIB"
386     fi
387     if test -z "$HOST_AR"; then
388         HOST_AR="$AR"
389     fi
390     if test -z "$HOST_AR_FLAGS"; then
391         HOST_AR_FLAGS="$AR_FLAGS"
392     fi
395 if test -n "$MOZ_WINCONSOLE"; then
396     AC_DEFINE(MOZ_WINCONSOLE)
399 MOZ_TOOL_VARIABLES
401 dnl ========================================================
402 dnl Special win32 checks
403 dnl ========================================================
405 MOZ_ARG_ENABLE_BOOL(metro,
406 [  --enable-metro           Enable Windows Metro build targets],
407     MOZ_METRO=1,
408     MOZ_METRO=)
409 if test -n "$MOZ_METRO"; then
410     AC_DEFINE(MOZ_METRO)
411     # Target the Windows 8 Kit
412     WINSDK_TARGETVER=602
413     WINVER=502
414     # toolkit/library/makefile.in needs these, see nsDllMain.
415     CRTDLLVERSION=110
416     CRTEXPDLLVERSION=1-1-0
417 else
418     # Target the Windows 7 SDK by default
419     WINSDK_TARGETVER=601
420     WINVER=502
423 AC_SUBST(CRTDLLVERSION)
424 AC_SUBST(CRTEXPDLLVERSION)
426 if test -n "$MOZ_METRO"; then
427   case "$target" in
428   *-mingw*)
429     ;;
430   *)
431     AC_MSG_ERROR([Metro builds only valid on the windows platform.]);
432     ;;
433   esac
436 MOZ_ARG_WITH_STRING(windows-version,
437 [  --with-windows-version=WINSDK_TARGETVER
438                           Windows SDK version to target. Lowest version
439                           currently allowed is 601 (Win7), highest is 602 (Win8)],
440   WINSDK_TARGETVER=$withval)
442 # Currently only two sdk versions allowed, 601 and 602
443 case "$WINSDK_TARGETVER" in
444 601|602)
445     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
446     ;;
449     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
450     ;;
451 esac
453 case "$target" in
454 *-mingw*)
455     if test "$GCC" != "yes"; then
456         # Check to see if we are really running in a msvc environemnt
457         _WIN32_MSVC=1
458         AC_CHECK_PROGS(MIDL, midl)
460         # Make sure compilers are valid
461         CFLAGS="$CFLAGS -TC -nologo"
462         CXXFLAGS="$CXXFLAGS -TP -nologo"
463         AC_LANG_SAVE
464         AC_LANG_C
465         AC_TRY_COMPILE([#include <stdio.h>],
466             [ printf("Hello World\n"); ],,
467             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
469         AC_LANG_CPLUSPLUS
470         AC_TRY_COMPILE([#include <new.h>],
471             [ unsigned *test = new unsigned(42); ],,
472             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
473         AC_LANG_RESTORE
475         changequote(,)
476         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
477         changequote([,])
479         # Determine compiler version
480         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
481         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
482         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
483         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
484         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
485         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
487         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
488         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
490         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
491             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
492         fi
494         if test "$_CC_MAJOR_VERSION" = "14"; then
495             dnl Require VC8SP1 or newer.
496             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
497             if test "$_CC_RELEASE" -lt 50727 -o \
498                     \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
499               AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
500             fi
502             _CC_SUITE=8
503             _MSVS_VERSION=2005
504             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
505             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
506         elif test "$_CC_MAJOR_VERSION" = "15"; then
507             _CC_SUITE=9
508             _MSVS_VERSION=2008
509             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
510             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
511         elif test "$_CC_MAJOR_VERSION" = "16"; then
512             _CC_SUITE=10
513             _MSVS_VERSION=2010
514             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
515             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
516         elif test "$_CC_MAJOR_VERSION" = "17"; then
517             _CC_SUITE=11
518             _MSVS_VERSION=2012
519             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
520             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
521         else
522             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
523         fi
525         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
527         if test -n "$WIN32_REDIST_DIR"; then
528           if test ! -d "$WIN32_REDIST_DIR"; then
529             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
530           fi
531           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
532         fi
534         dnl Confirm we have the pri tools on win8 builds
535         if test -n "$MOZ_METRO"; then
536           AC_MSG_CHECKING([for makepri])
537           AC_CHECK_PROGS(MAKEPRI, makepri, "")
538           if test -z "MAKEPRI" ; then
539               AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
540           fi
541           AC_SUBST(MAKEPRI)
542         fi
544         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
545         dnl not something else like "magnetic tape manipulation utility".
546         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
547         if test -z "$MSMT_TOOL"; then
548           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
549         fi
551         changequote(,)
552         _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
553         changequote([,])
554         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
555         if test -z "$MSMANIFEST_TOOL_VERSION"; then
556           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
557         fi
559         MSMANIFEST_TOOL=1
560         unset MSMT_TOOL
562         # Check linker version
563         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
564         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
565         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
566             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
567         fi
569         INCREMENTAL_LINKER=1
571         # Check midl version
572         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
573         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
574         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
575         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
576         # Add flags if necessary
577         AC_MSG_CHECKING([for midl flags])
578         case "$target" in
579         i*86-*)
580             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
581                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
582                 # MIDL version 7.00.0500 or later has no problem.
583                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
584                 AC_MSG_RESULT([need -env win32])
585             else
586                 AC_MSG_RESULT([none needed])
587             fi
588             ;;
589         x86_64-*)
590             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
591             ;;
592         *)
593             AC_MSG_RESULT([none needed])
594             ;;
595         esac
597         # Identify which version of the SDK we're building with
598         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
599         # from there
600         MOZ_CHECK_HEADERS([winsdkver.h])
601         if test "$ac_cv_header_winsdkver_h" = "yes"; then
602             # Get the highest _WIN32_WINNT and NTDDI versions supported
603             # Take the higher of the two
604             # This is done because the Windows 7 beta SDK reports its
605             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
606             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
607                            ac_cv_winsdk_maxver,
608                            [cat > conftest.h <<EOF
609 #include <winsdkver.h>
610 #include <sdkddkver.h>
612 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
613 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
614 #else
615 #define WINSDK_MAXVER NTDDI_MAXVER
616 #endif
618 WINSDK_MAXVER
620                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
621                             rm -f conftest.h
622                            ])
623             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
624         else
625             # Any SDK which doesn't have WinSDKVer.h is too old.
626             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.])
627         fi
629         unset _MSVC_VER_FILTER
631         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
632             [
633                 AC_LANG_SAVE
634                 AC_LANG_CPLUSPLUS
635                 _SAVE_CXXFLAGS="$CXXFLAGS"
636                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
637                 AC_TRY_COMPILE([#include <exception>],
638                             [std::_Throw(std::exception()); return 0;],
639                             ac_cv_have_std__Throw="yes",
640                             ac_cv_have_std__Throw="no")
641                 CXXFLAGS="$_SAVE_CXXFLAGS"
642                 AC_LANG_RESTORE
643             ])
645         if test "$ac_cv_have_std__Throw" = "yes"; then
646             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
647                            ac_cv_have_dllimport_exception_bug,
648                 [
649                     AC_LANG_SAVE
650                     AC_LANG_CPLUSPLUS
651                     _SAVE_CXXFLAGS="$CXXFLAGS"
652                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
653                     AC_TRY_LINK([#include <vector>],
654                                 [std::vector<int> v; return v.at(1);],
655                                 ac_cv_have_dllimport_exception_bug="no",
656                                 ac_cv_have_dllimport_exception_bug="yes")
657                     CXXFLAGS="$_SAVE_CXXFLAGS"
658                     AC_LANG_RESTORE
659                 ])
660             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
661                 WRAP_STL_INCLUDES=1
662                 MOZ_MSVC_STL_WRAP__Throw=1
663                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
664             fi
665         else
666             AC_CACHE_CHECK(for overridable _RAISE,
667                            ac_cv_have__RAISE,
668                 [
669                     AC_LANG_SAVE
670                     AC_LANG_CPLUSPLUS
671                     _SAVE_CXXFLAGS="$CXXFLAGS"
672                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
673                     AC_TRY_COMPILE([#include <xstddef>
674                                     #undef _RAISE
675                                     #define _RAISE(x) externallyDefinedFunction((x).what())
676                                     #include <vector>
677                                    ],
678                                    [std::vector<int> v; return v.at(1);],
679                                    ac_cv_have__RAISE="no",
680                                    ac_cv_have__RAISE="yes")
681                     CXXFLAGS="$_SAVE_CXXFLAGS"
682                     AC_LANG_RESTORE
683                 ])
684             if test "$ac_cv_have__RAISE" = "yes"; then
685                 WRAP_STL_INCLUDES=1
686                 MOZ_MSVC_STL_WRAP__RAISE=1
687                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
688             else
689                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
690             fi
691         fi
693         if test "$WRAP_STL_INCLUDES" = "1"; then
694             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
695         fi
696     else
697         # Check w32api version
698         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
699         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
700         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
701         AC_TRY_COMPILE([#include <w32api.h>],
702             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
703                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
704                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
705                 #error "test failed."
706             #endif
707             , [ res=yes ], [ res=no ])
708         AC_MSG_RESULT([$res])
709         if test "$res" != "yes"; then
710             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
711         fi
712         # Check windres version
713         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
714         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
715         AC_MSG_RESULT([$_WINDRES_VERSION])
716         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
717         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
718         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
719         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
720         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
721         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
722         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
723                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
724                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
725                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
726                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
727                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
728         then
729             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
730         fi
732         MOZ_WINSDK_MAXVER=0x06020000
733     fi # !GNU_CC
735     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
736     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
737     # Require OS features provided by IE 6.0 SP2 (XP SP2)
738     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
740     # If the maximum version supported by this SDK is lower than the target
741     # version, error out
742     AC_MSG_CHECKING([for Windows SDK being recent enough])
743     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
744         AC_MSG_RESULT("yes")
745     else
746         AC_MSG_RESULT("no")
747         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.])
748     fi
749     
750     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
751     # Definitions matching sdkddkver.h
752     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
753     ;;
754 esac
756 AC_PROG_CPP
757 AC_PROG_CXXCPP
759 if test -n "$_WIN32_MSVC"; then
760     SKIP_PATH_CHECKS=1
761     SKIP_COMPILER_CHECKS=1
762     SKIP_LIBRARY_CHECKS=1
764     # Since we're skipping compiler and library checks, hard-code
765     # some facts here.
766     AC_DEFINE(HAVE_IO_H)
767     AC_DEFINE(HAVE_SETBUF)
768     AC_DEFINE(HAVE_ISATTY)
771 fi # COMPILE_ENVIRONMENT
773 AC_SUBST(MIDL_FLAGS)
774 AC_SUBST(_MSC_VER)
776 AC_SUBST(GNU_AS)
777 AC_SUBST(GNU_LD)
778 AC_SUBST(GNU_CC)
779 AC_SUBST(GNU_CXX)
780 AC_SUBST(INTEL_CC)
781 AC_SUBST(INTEL_CXX)
783 AC_SUBST(STL_FLAGS)
784 AC_SUBST(WRAP_STL_INCLUDES)
785 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
786 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
788 dnl ========================================================
789 dnl Checks for programs.
790 dnl ========================================================
791 AC_PROG_INSTALL
792 AC_PROG_LN_S
794 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
795 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
796 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
797 _perl_res=$?
798 AC_MSG_RESULT([$_perl_version])
800 if test "$_perl_res" != 0; then
801     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
805 AC_MSG_CHECKING([for full perl installation])
806 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
807 _perl_res=$?
808 if test "$_perl_res" != 0; then
809     AC_MSG_RESULT([no])
810     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
811 else
812     AC_MSG_RESULT([yes])
815 MOZ_ARG_WITH_BOOL(system-ply,
816 [  --with-system-ply       Use system installed python ply library],
817     [if $PYTHON -c 'import ply' 2>&5; then
818          MOZ_SYSTEM_PLY=1
819      else
820          AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
821      fi])
823 AC_SUBST(MOZ_SYSTEM_PLY)
825 if test -z "$COMPILE_ENVIRONMENT"; then
826     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
828 AC_SUBST(NSINSTALL_BIN)
830 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
831 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
832 MOZ_PATH_PROGS(UNZIP, unzip)
833 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
834     AC_MSG_ERROR([unzip not found in \$PATH])
836 MOZ_PATH_PROGS(ZIP, zip)
837 if test -z "$ZIP" -o "$ZIP" = ":"; then
838     AC_MSG_ERROR([zip not found in \$PATH])
840 MOZ_PATH_PROG(XARGS, xargs)
841 if test -z "$XARGS" -o "$XARGS" = ":"; then
842     AC_MSG_ERROR([xargs not found in \$PATH .])
845 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
846 AC_SUBST(RPMBUILD)
848 if test "$COMPILE_ENVIRONMENT"; then
850 dnl ========================================================
851 dnl = Mac OS X toolchain support
852 dnl ========================================================
854 case "$target_os" in
855 darwin*)
856     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
857     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
858     dnl the environment and includedir purposes (when using an SDK, below),
859     dnl but remember the full version number for the libdir (SDK).
860     changequote(,)
861     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
862     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
863     changequote([,])
864     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
865         dnl Bug 280479, but this keeps popping up in bug 292530 too because
866         dnl 4.0.0/4061 is the default compiler in Tiger.
867         changequote(,)
868         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
869         changequote([,])
870         if test "$GCC_BUILD" = "4061" ; then
871             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
872 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
873 from building Mozilla. Upgrade to Xcode 2.1 or later.])
874         fi
875     fi
877     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
878     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
879     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
880     MOZ_PATH_PROGS(PBBUILD_BIN, pbbuild xcodebuild pbxbuild)
882     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
883     dnl it has moved into /usr/bin.
884     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
885     ;;
886 esac
888 AC_SUBST(GCC_VERSION)
890 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
891 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
892 dnl when we can run target binaries.
893 AC_SUBST(UNIVERSAL_BINARY)
894 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
896 dnl ========================================================
897 dnl Check for MacOS deployment target version
898 dnl ========================================================
900 MOZ_ARG_ENABLE_STRING(macos-target,
901                       [  --enable-macos-target=VER (default=10.6)
902                           Set the minimum MacOS version needed at runtime],
903                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
905 case "$target" in
906 *-darwin*)
907     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
908         dnl Use the specified value
909         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
910     else
911         dnl No value specified on the command line or in the environment,
912         dnl use architecture minimum.
913         export MACOSX_DEPLOYMENT_TARGET=10.6
914     fi
915     ;;
916 esac
918 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
920 dnl ========================================================
921 dnl = Mac OS X SDK support
922 dnl ========================================================
923 MACOS_SDK_DIR=
924 NEXT_ROOT=
925 MOZ_ARG_WITH_STRING(macos-sdk,
926 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
927     MACOS_SDK_DIR=$withval)
929 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
930 dnl NEXT_ROOT will be set and exported only if it's needed.
931 AC_SUBST(MACOS_SDK_DIR)
932 AC_SUBST(NEXT_ROOT)
934 if test "$MACOS_SDK_DIR"; then
935   dnl Sync this section with the ones in NSPR and NSS.
936   dnl Changes to the cross environment here need to be accounted for in
937   dnl the libIDL checks (below) and xpidl build.
939   if test ! -d "$MACOS_SDK_DIR"; then
940     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
941 specify a valid SDK.  SDKs are installed when the optional cross-development
942 tools are selected during the Xcode/Developer Tools installation.])
943   fi
945   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
946   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
947     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
948   else
949     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
950     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
952     dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
953     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
954     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
956     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
957       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
958       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
959       dnl be ignored and cause warnings when -syslibroot is specified.
960       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
961       dnl the -isysroot it receives, so this is only needed with 4.0.0.
962       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
963     fi
964   fi
966   AC_LANG_SAVE
967   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
968   AC_LANG_CPLUSPLUS
969   AC_TRY_COMPILE([#include <new>],[],
970    result=yes,
971    result=no)
972   AC_LANG_RESTORE
973   AC_MSG_RESULT($result)
975   if test "$result" = "no" ; then
976     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
977   fi
980 fi # COMPILE_ENVIRONMENT
982 AC_MSG_CHECKING([compiler version])
983 # Just print it so it shows up in the logs.
984 cc_version=$($CC --version)
985 AC_MSG_RESULT([$cc_version])
987 if test -n "$MAKE"; then
988   if test `echo $MAKE | grep -c make.py` != 1; then
989      NOT_PYMAKE=$MAKE
990   fi
993 case "$host_os" in
994 mingw*)
995     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
996     ;;
998     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
999     ;;
1000 esac
1001 if test "$GMAKE" = ":"; then
1002    AC_MSG_ERROR([GNU make not found])
1004 AC_SUBST(GMAKE)
1006 if test -z "$MAKE"; then
1007   MAKE=$GMAKE
1010 if test "$COMPILE_ENVIRONMENT"; then
1012 AC_PATH_XTRA
1014 XCFLAGS="$X_CFLAGS"
1016 fi # COMPILE_ENVIRONMENT
1018 dnl ========================================================
1019 dnl set the defaults first
1020 dnl ========================================================
1021 AS_BIN=$AS
1022 AR_LIST='$(AR) t'
1023 AR_EXTRACT='$(AR) x'
1024 AR_DELETE='$(AR) d'
1025 AS='$(CC)'
1026 AS_DASH_C_FLAG='-c'
1027 DLL_PREFIX=lib
1028 LIB_PREFIX=lib
1029 DLL_SUFFIX=.so
1030 OBJ_SUFFIX=o
1031 LIB_SUFFIX=a
1032 ASM_SUFFIX=s
1033 IMPORT_LIB_SUFFIX=
1034 TARGET_MD_ARCH=unix
1035 DIRENT_INO=d_ino
1036 MOZ_USER_DIR=".mozilla"
1038 MOZ_JPEG_CFLAGS=
1039 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
1040 MOZ_BZ2_CFLAGS=
1041 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1042 MOZ_PNG_CFLAGS=
1043 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
1045 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1046 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1047 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1048 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1049 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1050 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1051 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1052 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1054 # These are specially defined on Windows only
1055 case "$target" in
1056 *-mingw*)
1057   XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1058   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
1059   ;;
1061   XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
1062   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
1063   ;;
1064 esac
1066 MOZ_FS_LAYOUT=unix
1068 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1070 USE_DEPENDENT_LIBS=1
1072 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1074 if test -n "$CROSS_COMPILE"; then
1075     OS_TARGET="${target_os}"
1076     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1077     OS_RELEASE=
1078     case "${target_os}" in
1079         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1080         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1081         gnu*)         OS_ARCH=GNU ;;
1082         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1083         mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
1084         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1085     esac
1086     case "${target}" in
1087         *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1088     esac
1089 else
1090     OS_TARGET=`uname -s`
1091     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1092     OS_RELEASE=`uname -r`
1095 # Before this used `uname -m` when not cross compiling
1096 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1097 OS_TEST="${target_cpu}"
1099 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1101 #######################################################################
1102 # Master "Core Components" macros for getting the OS target           #
1103 #######################################################################
1106 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1107 # cross-compilation.
1111 # Define and override various archtecture-specific variables, including
1112 # HOST_OS_ARCH
1113 # OS_ARCH
1114 # OS_TEST
1115 # OS_TARGET
1116 # OS_RELEASE
1117 # OS_MINOR_RELEASE
1120 case "$HOST_OS_ARCH" in
1121 mingw*)
1122     HOST_OS_ARCH=WINNT
1123     ;;
1124 darwin*)
1125     HOST_OS_ARCH=Darwin
1126     ;;
1127 linux*)
1128     HOST_OS_ARCH=Linux
1129     ;;
1130 solaris*)
1131     HOST_OS_ARCH=SunOS
1132     SOLARIS_SUNPRO_CC=
1133     SOLARIS_SUNPRO_CXX=
1134     if test -z "$GNU_CC"; then
1135         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1136             SOLARIS_SUNPRO_CC=1
1137        fi
1138     fi
1140     if test -z "$GNU_CXX"; then
1141        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1142            SOLARIS_SUNPRO_CXX=1
1143        fi
1144     fi
1145     AC_SUBST(SOLARIS_SUNPRO_CC)
1146     AC_SUBST(SOLARIS_SUNPRO_CXX)
1147     ;;
1148 OS_2)
1149     HOST_OS_ARCH=OS2
1150     ;;
1151 esac
1153 case "$OS_ARCH" in
1154 WINNT)
1155     if test -z "$CROSS_COMPILE" ; then
1156         OS_TEST=`uname -p`
1157     fi
1158     ;;
1159 Windows_NT)
1161 # If uname -s returns "Windows_NT", we assume that we are using
1162 # the uname.exe in MKS toolkit.
1164 # The -r option of MKS uname only returns the major version number.
1165 # So we need to use its -v option to get the minor version number.
1166 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1168     OS_ARCH=WINNT
1169     OS_TARGET=WINNT
1170     OS_MINOR_RELEASE=`uname -v`
1171     if test "$OS_MINOR_RELEASE" = "00"; then
1172         OS_MINOR_RELEASE=0
1173     fi
1174     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1175     ;;
1176 MINGW*_NT*)
1178 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1179 # the uname.exe in the MSYS tools.
1181     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1182     OS_ARCH=WINNT
1183     OS_TARGET=WINNT
1184     ;;
1185 AIX)
1186     OS_RELEASE=`uname -v`.`uname -r`
1187     OS_TEST=${target_cpu}
1188     ;;
1189 OS_2)
1190     OS_ARCH=OS2
1191     OS_TARGET=OS2
1192     OS_RELEASE=`uname -v`
1193     ;;
1194 Darwin)
1195     case "${target_cpu}" in
1196     powerpc*)
1197         OS_TEST=ppc
1198         ;;
1199     i*86*)
1200         OS_TEST=i386
1201         ;;
1202     x86_64)
1203         OS_TEST=x86_64
1204         ;;
1205     *)
1206         if test -z "$CROSS_COMPILE" ; then
1207             OS_TEST=`uname -p`
1208         fi
1209         ;;
1210     esac
1211     ;;
1212 esac
1214 # Only set CPU_ARCH if we recognize the value of OS_TEST
1216 case "$OS_TEST" in
1217 *86 | i86pc)
1218     CPU_ARCH=x86
1219     ;;
1221 powerpc64 | ppc64)
1222     CPU_ARCH=ppc64
1223     ;;
1225 powerpc | ppc | rs6000)
1226     CPU_ARCH=ppc
1227     ;;
1229 Alpha | alpha | ALPHA)
1230     CPU_ARCH=Alpha
1231     ;;
1233 s390)
1234     CPU_ARCH=s390
1235     ;;
1237 s390x)
1238     CPU_ARCH=s390x
1239     ;;
1241 hppa* | parisc)
1242     CPU_ARCH=hppa
1243     ;;
1245 sun4u | sparc*)
1246     CPU_ARCH=sparc
1247     ;;
1249 x86_64 | ia64)
1250     CPU_ARCH="$OS_TEST"
1251     ;;
1253 arm*)
1254     CPU_ARCH=arm
1255     ;;
1257 mips|mipsel)
1258     CPU_ARCH="mips"
1259     ;;
1260 esac
1262 if test -z "$OS_TARGET"; then
1263     OS_TARGET=$OS_ARCH
1265 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1267 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1268 dnl ===============================================================
1269 INTEL_ARCHITECTURE=
1270 case "$OS_TEST" in
1271     x86_64|i?86)
1272       INTEL_ARCHITECTURE=1
1273 esac
1275 dnl Configure platform-specific CPU architecture compiler options.
1276 dnl ==============================================================
1277 MOZ_ARCH_OPTS
1279 dnl =================================================================
1280 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1281 dnl which is bad when cross compiling.
1282 dnl =================================================================
1283 if test "$COMPILE_ENVIRONMENT"; then
1284 configure_static_assert_macros='
1285 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1286 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1287 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1290 dnl test that the macros actually work:
1291 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1292 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1293  [AC_LANG_SAVE
1294   AC_LANG_C
1295   ac_cv_static_assertion_macros_work="yes"
1296   AC_TRY_COMPILE([$configure_static_assert_macros],
1297                  [CONFIGURE_STATIC_ASSERT(1)],
1298                  ,
1299                  ac_cv_static_assertion_macros_work="no")
1300   AC_TRY_COMPILE([$configure_static_assert_macros],
1301                  [CONFIGURE_STATIC_ASSERT(0)],
1302                  ac_cv_static_assertion_macros_work="no",
1303                  )
1304   AC_LANG_CPLUSPLUS
1305   AC_TRY_COMPILE([$configure_static_assert_macros],
1306                  [CONFIGURE_STATIC_ASSERT(1)],
1307                  ,
1308                  ac_cv_static_assertion_macros_work="no")
1309   AC_TRY_COMPILE([$configure_static_assert_macros],
1310                  [CONFIGURE_STATIC_ASSERT(0)],
1311                  ac_cv_static_assertion_macros_work="no",
1312                  )
1313   AC_LANG_RESTORE
1314  ])
1315 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1316 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1317     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1319 fi # COMPILE_ENVIRONMENT
1321 dnl ========================================================
1322 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1323 dnl computed above.
1324 dnl ========================================================
1326 MOZ_ANDROID_STLPORT
1328 dnl ========================================================
1329 dnl Suppress Clang Argument Warnings
1330 dnl ========================================================
1331 if test -n "$CLANG_CC"; then
1332     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1333     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1335 if test -n "$CLANG_CXX"; then
1336     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1339 dnl ========================================================
1340 dnl = Use Address Sanitizer
1341 dnl ========================================================
1342 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1343 [  --enable-address-sanitizer       Enable Address Sanitizer (default=no)],
1344     MOZ_ASAN=1,
1345     MOZ_ASAN= )
1346 if test -n "$MOZ_ASAN"; then
1347     MOZ_LLVM_HACKS=1
1348     AC_DEFINE(MOZ_ASAN)
1350 AC_SUBST(MOZ_ASAN)
1352 dnl ========================================================
1353 dnl = Enable hacks required for LLVM instrumentations
1354 dnl ========================================================
1355 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1356 [  --enable-llvm-hacks       Enable workarounds required for several LLVM instrumentations (default=no)],
1357     MOZ_LLVM_HACKS=1,
1358     MOZ_LLVM_HACKS= )
1359 if test -n "$MOZ_LLVM_HACKS"; then
1360     MOZ_NO_WLZDEFS=1
1361     MOZ_CFLAGS_NSS=1
1363 AC_SUBST(MOZ_NO_WLZDEFS)
1364 AC_SUBST(MOZ_CFLAGS_NSS)
1366 dnl ========================================================
1367 dnl GNU specific defaults
1368 dnl ========================================================
1369 if test "$GNU_CC"; then
1370     # FIXME: Let us build with strict aliasing. bug 414641.
1371     CFLAGS="$CFLAGS -fno-strict-aliasing"
1372     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1373     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1374     DSO_LDOPTS='-shared'
1375     if test "$GCC_USE_GNU_LD"; then
1376         # Some tools like ASan use a runtime library that is only
1377         # linked against executables, so we must allow undefined
1378         # symbols for shared objects in some cases.
1379         if test -z "$MOZ_NO_WLZDEFS"; then
1380             # Don't allow undefined symbols in libraries
1381             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1382         fi
1383     fi
1384     WARNINGS_AS_ERRORS='-Werror -Wno-error=uninitialized'
1385     DSO_CFLAGS=''
1386     DSO_PIC_CFLAGS='-fPIC'
1387     ASFLAGS="$ASFLAGS -fPIC"
1388     AC_MSG_CHECKING([for --noexecstack option to as])
1389     _SAVE_CFLAGS=$CFLAGS
1390     CFLAGS="$CFLAGS -Wa,--noexecstack"
1391     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1392                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1393                      AC_MSG_RESULT([no]))
1394     CFLAGS=$_SAVE_CFLAGS
1395     AC_MSG_CHECKING([for -z noexecstack option to ld])
1396     _SAVE_LDFLAGS=$LDFLAGS
1397     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1398     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1399                   AC_MSG_RESULT([no])
1400                   LDFLAGS=$_SAVE_LDFLAGS)
1402     # Check for -mssse3 on $CC
1403     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1404     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1405     _SAVE_CFLAGS=$CFLAGS
1406     CFLAGS="$CFLAGS -mssse3"
1407     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1408                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1409                      AC_MSG_RESULT([no]))
1410     CFLAGS=$_SAVE_CFLAGS
1411     AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
1413     # Turn on GNU-specific warnings:
1414     # -Wall - turn on a lot of warnings
1415     # -pedantic - this is turned on below
1416     # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1417     # -Wdeclaration-after-statement - MSVC doesn't like these
1418     # -Werror=return-type - catches missing returns, zero false positives
1419     # -Wtype-limits - catches overflow bugs, few false positives
1420     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1421     #
1422     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1423     MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1424     MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1425     MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1426     
1427     # Turn off the following warnings that -Wall/-pedantic turn on:
1428     # -Wno-unused - lots of violations in third-party code
1429     # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1430     #
1431     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1432     MOZ_C_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_c_has_wno_overlength_strings)
1434     if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1435        # Don't use -Wcast-align with ICC or clang
1436        case "$CPU_ARCH" in
1437            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1438            hppa | ia64 | sparc | arm)
1439            ;;
1440            *)
1441         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1442            ;;
1443        esac
1444     fi
1446     dnl Turn pedantic on but disable the warnings for long long
1447     _PEDANTIC=1
1449     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1450     _USE_CPP_INCLUDE_FLAG=1
1452 elif test "$SOLARIS_SUNPRO_CC"; then
1453     DSO_CFLAGS=''
1454     if test "$CPU_ARCH" = "sparc"; then
1455         # for Sun Studio on Solaris/SPARC
1456         DSO_PIC_CFLAGS='-xcode=pic32'
1457     else
1458         DSO_PIC_CFLAGS='-KPIC'
1459     fi
1460     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1461 else
1462     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1463     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1465     DSO_LDOPTS='-shared'
1466     if test "$GNU_LD"; then
1467         # Don't allow undefined symbols in libraries
1468         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1469     fi
1471     DSO_CFLAGS=''
1472     DSO_PIC_CFLAGS='-KPIC'
1473     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1476 if test "$GNU_CXX"; then
1477     # FIXME: Let us build with strict aliasing. bug 414641.
1478     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1480     # Turn on GNU-specific warnings:
1481     # -Wall - turn on a lot of warnings
1482     # -pedantic - this is turned on below
1483     # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1484     # -Woverloaded-virtual - ???
1485     # -Werror=return-type - catches missing returns, zero false positives
1486     # -Wtype-limits - catches overflow bugs, few false positives
1487     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1488     #
1489     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1490     MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1491     MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1492     MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1494     # Turn off the following warnings that -Wall/-pedantic turn on:
1495     # -Wno-ctor-dtor-privacy - ???
1496     # -Wno-overlength-strings - we exceed the minimum maximum length frequently 
1497     # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1498     # -Wno-variadic-macros - ???
1499     #
1500     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-ctor-dtor-privacy"
1501     MOZ_CXX_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_cxx_has_wno_overlength_strings)
1502     MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1503     MOZ_CXX_SUPPORTS_WARNING(-Wno-, variadic-macros, ac_cxx_has_wno_variadic_macros)
1505     if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1506        # Don't use -Wcast-align with ICC or clang
1507        case "$CPU_ARCH" in
1508            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1509            hppa | ia64 | sparc | arm)
1510            ;;
1511            *)
1512         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1513            ;;
1514        esac
1515     fi
1517     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1518     _USE_CPP_INCLUDE_FLAG=1
1520     # Recent clang and gcc support C++11 deleted functions without warnings if
1521     # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1522     # versions).  We can't use -std=c++0x yet, so gcc's support must remain
1523     # unused.  But clang's warning can be disabled, so when compiling with clang
1524     # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1525     # deleted function syntax.
1526     if test "$CLANG_CXX"; then
1527         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1528         MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1529     fi
1531 else
1532     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1535 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1536 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1537 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1538 dnl normal behavior.
1539 dnl ========================================================
1540 MKSHLIB_FORCE_ALL=
1541 MKSHLIB_UNFORCE_ALL=
1543 if test "$COMPILE_ENVIRONMENT"; then
1544 if test "$GNU_CC"; then
1545   AC_MSG_CHECKING(whether ld has archive extraction flags)
1546   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1547    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1548     ac_cv_mkshlib_force_and_unforce="no"
1549     exec 3<&0 <<LOOP_INPUT
1550         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1551         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1552         force="-Wl,-all";              unforce="-Wl,-none"
1553 LOOP_INPUT
1554     while read line
1555     do
1556       eval $line
1557       LDFLAGS=$force
1558       LIBS=$unforce
1559       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1560     done
1561     exec 0<&3 3<&-
1562     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1563    ])
1564   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1565     AC_MSG_RESULT(no)
1566   else
1567     AC_MSG_RESULT(yes)
1568     eval $ac_cv_mkshlib_force_and_unforce
1569     MKSHLIB_FORCE_ALL=$force
1570     MKSHLIB_UNFORCE_ALL=$unforce
1571   fi
1572 fi # GNU_CC
1573 fi # COMPILE_ENVIRONMENT
1575 dnl ========================================================
1576 dnl Checking for 64-bit OS
1577 dnl ========================================================
1578 if test "$COMPILE_ENVIRONMENT"; then
1579 AC_LANG_SAVE
1580 AC_LANG_C
1581 AC_MSG_CHECKING(for 64-bit OS)
1582 AC_TRY_COMPILE([$configure_static_assert_macros],
1583                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1584                result="yes", result="no")
1585 AC_MSG_RESULT("$result")
1586 if test "$result" = "yes"; then
1587     AC_DEFINE(HAVE_64BIT_OS)
1588     HAVE_64BIT_OS=1
1590 AC_SUBST(HAVE_64BIT_OS)
1591 AC_LANG_RESTORE
1592 fi # COMPILE_ENVIRONMENT
1594 dnl ========================================================
1595 dnl Enable high-memory support on OS/2 by default.
1596 dnl ========================================================
1597 MOZ_OS2_HIGH_MEMORY=1
1598 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1599 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1600     MOZ_OS2_HIGH_MEMORY=,
1601     MOZ_OS2_HIGH_MEMORY=1 )
1602 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1604 dnl ========================================================
1605 dnl = Use profiling compile flags
1606 dnl ========================================================
1607 MOZ_ARG_ENABLE_BOOL(profiling,
1608 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1609     MOZ_PROFILING=1,
1610     MOZ_PROFILING= )
1612 # For profiling builds keep the symbol information
1613 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1614     STRIP_FLAGS="--strip-debug"
1617 dnl ========================================================
1618 dnl = Use incremental GC
1619 dnl ========================================================
1620 JSGC_INCREMENTAL=1
1621 MOZ_ARG_DISABLE_BOOL(gcincremental,
1622 [  --disable-gcincremental Disable incremental GC],
1623     JSGC_INCREMENTAL= )
1624 if test -n "$JSGC_INCREMENTAL"; then
1625     AC_DEFINE(JSGC_INCREMENTAL)
1628 dnl ========================================================
1629 dnl = Use generational GC
1630 dnl ========================================================
1631 MOZ_ARG_ENABLE_BOOL(gcgenerational,
1632 [  --enable-gcgenerational Enable generational GC],
1633     JSGC_GENERATIONAL=1,
1634     JSGC_GENERATIONAL= )
1635 if test -n "$JSGC_GENERATIONAL"; then
1636     AC_DEFINE(JSGC_GENERATIONAL)
1639 dnl ========================================================
1640 dnl = Perform moving GC stack rooting analysis
1641 dnl ========================================================
1642 MOZ_ARG_ENABLE_BOOL(root-analysis,
1643 [  --enable-root-analysis  Enable moving GC stack root analysis],
1644     JSGC_ROOT_ANALYSIS=1,
1645     JSGC_ROOT_ANALYSIS= )
1646 if test -n "$JSGC_ROOT_ANALYSIS"; then
1647     AC_DEFINE(JSGC_ROOT_ANALYSIS)
1650 dnl ========================================================
1651 dnl = Use exact stack rooting for GC
1652 dnl ========================================================
1653 MOZ_ARG_ENABLE_BOOL(exact-rooting,
1654 [  --enable-exact-rooting  Enable use of exact stack roots for GC],
1655     JSGC_USE_EXACT_ROOTING=1,
1656     JSGC_USE_EXACT_ROOTING= )
1657 if test -n "$JSGC_USE_EXACT_ROOTING"; then
1658     AC_DEFINE(JSGC_USE_EXACT_ROOTING)
1661 dnl ========================================================
1662 dnl = Use Valgrind
1663 dnl ========================================================
1664 MOZ_ARG_ENABLE_BOOL(valgrind,
1665 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
1666     MOZ_VALGRIND=1,
1667     MOZ_VALGRIND= )
1668 if test -n "$MOZ_VALGRIND"; then
1669     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1670         AC_MSG_ERROR(
1671             [--enable-valgrind specified but Valgrind is not installed]))
1672     AC_DEFINE(MOZ_VALGRIND)
1674 AC_SUBST(MOZ_VALGRIND)
1676 dnl ========================================================
1677 dnl = Enable DMDV
1678 dnl ========================================================
1679 MOZ_ARG_ENABLE_BOOL(dmdv,
1680 [  --enable-dmdv           Enable DMDV; also disables jemalloc (default=no)],
1681     MOZ_DMDV=1,
1682     MOZ_DMDV= )
1683 if test -n "$MOZ_DMDV"; then
1684     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1685         AC_MSG_ERROR(
1686             [--enable-dmdv specified but Valgrind is not installed]))
1687     AC_DEFINE(MOZ_DMDV)
1689 AC_SUBST(MOZ_DMDV)
1691 dnl ========================================================
1692 dnl jprof
1693 dnl ========================================================
1694 MOZ_ARG_ENABLE_BOOL(jprof,
1695 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1696     MOZ_JPROF=1,
1697     MOZ_JPROF= )
1698 if test -n "$MOZ_JPROF"; then
1699     MOZ_PROFILING=1
1700     AC_DEFINE(MOZ_JPROF)
1703 dnl ========================================================
1704 dnl SPS Profiler
1705 dnl ========================================================
1706 MOZ_ENABLE_PROFILER_SPS=1
1708 case "${OS_TARGET}" in
1709 Android)
1710     case "${CPU_ARCH}" in
1711     x86 | arm) ;;
1712     *)
1713         MOZ_ENABLE_PROFILER_SPS=
1714     esac
1715     ;;
1716 Linux)
1717     case "${CPU_ARCH}" in
1718     x86 | x86_64) ;;
1719     *)
1720         MOZ_ENABLE_PROFILER_SPS=
1721     esac
1722     ;;
1723 WINNT|Darwin) ;;
1725     MOZ_ENABLE_PROFILER_SPS=
1726     ;;
1727 esac
1729 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1730     AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1733 dnl ========================================================
1734 dnl shark
1735 dnl ========================================================
1736 MOZ_ARG_ENABLE_BOOL(shark,
1737 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
1738     MOZ_SHARK=1,
1739     MOZ_SHARK= )
1740 if test -n "$MOZ_SHARK"; then
1741     MOZ_PROFILING=1
1742     AC_DEFINE(MOZ_SHARK)
1745 dnl ========================================================
1746 dnl callgrind
1747 dnl ========================================================
1748 MOZ_ARG_ENABLE_BOOL(callgrind,
1749 [  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
1750     MOZ_CALLGRIND=1,
1751     MOZ_CALLGRIND= )
1752 if test -n "$MOZ_CALLGRIND"; then
1753     MOZ_PROFILING=1
1754     AC_DEFINE(MOZ_CALLGRIND)
1757 dnl ========================================================
1758 dnl vtune
1759 dnl ========================================================
1760 MOZ_ARG_ENABLE_BOOL(vtune,
1761 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
1762     MOZ_VTUNE=1,
1763     MOZ_VTUNE= )
1764 if test -n "$MOZ_VTUNE"; then
1765     MOZ_PROFILING=1
1766     AC_DEFINE(MOZ_VTUNE)
1769 dnl ========================================================
1770 dnl Profiling
1771 dnl ========================================================
1772 if test -n "$MOZ_PROFILING"; then
1773     AC_DEFINE(MOZ_PROFILING)
1776 dnl ========================================================
1777 dnl System overrides of the defaults for host
1778 dnl ========================================================
1779 case "$host" in
1780 *mingw*)
1781     if test -n "$_WIN32_MSVC"; then
1782         HOST_AR=lib
1783         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1784         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1785         HOST_RANLIB='echo ranlib'
1786     else
1787         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1788     fi
1789     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1790     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1791     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1792     HOST_BIN_SUFFIX=.exe
1793     case "$host" in
1794     *mingw*)
1795         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1796         ;;
1797     esac
1799     case "${host_cpu}" in
1800     i*86)
1801         if test -n "$_WIN32_MSVC"; then
1802             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1803         fi
1804         ;;
1805     x86_64)
1806         if test -n "$_WIN32_MSVC"; then
1807             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1808         fi
1809         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1810         ;;
1811     esac
1812     ;;
1814 *-darwin*)
1815     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1816     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1817     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1818     ;;
1820 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1821     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1822     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1823     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1824     ;;
1826 *os2*)
1827     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1828     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1829     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1830     HOST_BIN_SUFFIX=.exe
1831     MOZ_FIX_LINK_PATHS=
1832     ;;
1835     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1836     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1837     ;;
1838 esac
1840 dnl Check for using a custom <stdint.h> implementation
1841 dnl ========================================================
1842 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1843 if test "$MOZ_CUSTOM_STDINT_H"; then
1844   AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1845   AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1846 else
1847   AC_MSG_RESULT(none specified)
1850 dnl Get mozilla version from central milestone file
1851 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1852 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1854 dnl Get version of various core apps from the version files.
1855 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1857 if test -z "$FIREFOX_VERSION"; then
1858     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1861 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1862 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1863 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1865 MOZ_DOING_LTO(lto_is_enabled)
1867 dnl ========================================================
1868 dnl System overrides of the defaults for target
1869 dnl ========================================================
1871 case "$target" in
1872 *-aix*)
1873     AC_DEFINE(AIX)
1874     if test ! "$GNU_CC"; then
1875         if test ! "$HAVE_64BIT_OS"; then
1876             # Compiling with Visual Age C++ object model compat is the
1877             # default. To compile with object model ibm, add
1878             # AIX_OBJMODEL=ibm to .mozconfig.
1879             if test "$AIX_OBJMODEL" = "ibm"; then
1880                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1881             else
1882                 AIX_OBJMODEL=compat
1883             fi
1884         else
1885             AIX_OBJMODEL=compat
1886         fi
1887         AC_SUBST(AIX_OBJMODEL)
1888         DSO_LDOPTS='-qmkshrobj=1'
1889         DSO_CFLAGS='-qflag=w:w'
1890         DSO_PIC_CFLAGS=
1891         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1892         MOZ_FIX_LINK_PATHS=
1893         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1894         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1895         if test "$COMPILE_ENVIRONMENT"; then
1896             AC_LANG_SAVE
1897             AC_LANG_CPLUSPLUS
1898             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1899             AC_TRY_COMPILE([],
1900                 [#if (__IBMCPP__ < 900)
1901                  #error "Bad compiler"
1902                  #endif],
1903                 _BAD_COMPILER=,_BAD_COMPILER=1)
1904             if test -n "$_BAD_COMPILER"; then
1905                 AC_MSG_RESULT([no])
1906                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1907             else
1908                 AC_MSG_RESULT([yes])
1909             fi
1910             AC_LANG_RESTORE
1911             TARGET_COMPILER_ABI="ibmc"
1912             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1913             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1914         fi
1915     fi
1916     case "${target_os}" in
1917     aix4.1*)
1918         DLL_SUFFIX='_shr.a'
1919         ;;
1920     esac
1921     if test "$COMPILE_ENVIRONMENT"; then
1922         MOZ_CHECK_HEADERS(sys/inttypes.h)
1923     fi
1924     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1925     ;;
1927 *-darwin*)
1928     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1929     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1930     MOZ_OPTIMIZE_FLAGS="-O3"
1931     _PEDANTIC=
1932     # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
1933     if test "$HAVE_64BIT_OS"; then
1934         MOZ_MEMORY=1
1935     fi
1936     DLL_SUFFIX=".dylib"
1937     DSO_LDOPTS=''
1938     STRIP_FLAGS="$STRIP_FLAGS -x -S"
1939     # Check whether we're targeting OS X or iOS
1940     AC_CACHE_CHECK(for iOS target,
1941                    ac_cv_ios_target,
1942                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
1943 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1944 #error not iOS
1945 #endif],
1946                                    [],
1947                                    ac_cv_ios_target="yes",
1948                                    ac_cv_ios_target="no")])
1949     if test "$ac_cv_ios_target" = "yes"; then
1950         AC_DEFINE(XP_IOS)
1951         AC_DEFINE(XP_DARWIN)
1952         _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1953     else
1954         AC_DEFINE(XP_MACOSX)
1955         AC_DEFINE(XP_DARWIN)
1956         _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1957         # The ExceptionHandling framework is needed for Objective-C exception
1958         # logging code in nsObjCExceptions.h. Currently we only use that in debug
1959         # builds.
1960         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1961     fi
1962     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1965     if test "x$lto_is_enabled" = "xyes"; then
1966         echo "Skipping -dead_strip because lto is enabled."
1967     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1968     dnl ===================================================================
1969     elif test "x$enable_dtrace" = "xyes"; then
1970         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1971     else
1972         dnl check for the presence of the -dead_strip linker flag
1973         AC_MSG_CHECKING([for -dead_strip option to ld])
1974         _SAVE_LDFLAGS=$LDFLAGS
1975         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1976         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1977         if test -n "$_HAVE_DEAD_STRIP" ; then
1978             AC_MSG_RESULT([yes])
1979             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1980         else
1981             AC_MSG_RESULT([no])
1982         fi
1984         LDFLAGS=$_SAVE_LDFLAGS
1985     fi
1987     dnl With newer linkers we need to pass -allow_heap_execute because of
1988     dnl Microsoft Silverlight (5.1.10411.0 at least).
1989     AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1990     _SAVE_LDFLAGS=$LDFLAGS
1991     LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1992     AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1993                 _HAVE_ALLOW_HEAP_EXECUTE=)
1994     if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1995         AC_MSG_RESULT([yes])
1996         MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1997     else
1998         AC_MSG_RESULT([no])
1999     fi
2000     LDFLAGS=$_SAVE_LDFLAGS
2002     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2003     ;;
2005 ia64*-hpux*)
2006     DLL_SUFFIX=".so"
2007     if test ! "$GNU_CC"; then
2008        DSO_LDOPTS='-b'
2009        DSO_CFLAGS=""
2010        DSO_PIC_CFLAGS=
2011        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2012        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2013        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2014     else
2015        DSO_LDOPTS='-b -E'
2016        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2017        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2018     fi
2019     MOZ_FIX_LINK_PATHS=
2020     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2021     AC_DEFINE(_LARGEFILE64_SOURCE)
2022     ;;
2024 *-hpux*)
2025     DLL_SUFFIX=".sl"
2026     if test ! "$GNU_CC"; then
2027         DSO_LDOPTS='-b -Wl,+s'
2028         DSO_CFLAGS=""
2029         DSO_PIC_CFLAGS="+Z"
2030         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2031         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2032         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2033     else
2034         DSO_LDOPTS='-b -E +s'
2035         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2036         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2037     fi
2038     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2039     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2040     ;;
2042 *-android*|*-linuxandroid*)
2043     AC_DEFINE(NO_PW_GECOS)
2044     no_x=yes
2045     if test -n "$gonkdir"; then
2046         _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2047         MOZ_B2G_RIL=1
2048         MOZ_B2G_BT=1
2049         MOZ_B2G_FM=1
2050     else
2051         _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2052         MOZ_LINKER=1
2053     fi
2054     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2056     MOZ_GFX_OPTIMIZE_MOBILE=1
2057     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2058     ;;
2060 *-*linux*)
2061     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2062     # Similarly for GNU_CXX and INTEL_CXX.
2063     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2064         # -Os has been broken on Intel's C/C++ compilers for quite a
2065         # while; Intel recommends against using it.
2066         MOZ_OPTIMIZE_FLAGS="-O2"
2067         MOZ_DEBUG_FLAGS="-g"
2068     elif test "$GNU_CC" -o "$GNU_CXX"; then
2069         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2070         case $GCC_VERSION in
2071         4.1.*|4.2.*|4.5.*)
2072             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2073             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2074         esac
2075         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2076         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2077         MOZ_DEBUG_FLAGS="-g"
2078     fi
2080     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2082     MOZ_MEMORY=1
2084     case "${target_cpu}" in
2085     alpha*)
2086         CFLAGS="$CFLAGS -mieee"
2087         CXXFLAGS="$CXXFLAGS -mieee"
2088     ;;
2089     i*86)
2090         USE_ELF_DYNSTR_GC=1
2091     ;;
2092     mips*)
2093         MOZ_DEBUG_FLAGS="-g" # We want inlining
2094     ;;
2095     esac
2097     if test -z "$MC"; then
2098         MC=mc.exe
2099     fi
2100     ;;
2101 *-mingw*)
2102     DSO_CFLAGS=
2103     DSO_PIC_CFLAGS=
2104     DLL_SUFFIX=.dll
2105     RC=rc.exe
2106     MC=mc.exe
2107     # certain versions of cygwin's makedepend barf on the
2108     # #include <string> vs -I./dist/include/string issue so don't use it
2109     if test -n "$GNU_CC"; then
2110         CC="$CC -mwindows"
2111         CXX="$CXX -mwindows"
2112         CPP="$CPP -mwindows"
2113         CFLAGS="$CFLAGS -mms-bitfields"
2114         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2115         DSO_LDOPTS='-shared'
2116         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2117         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2118         RC='$(WINDRES)'
2119         # Use temp file for windres (bug 213281)
2120         RCFLAGS='-O coff --use-temp-file'
2121         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2122         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2123         MOZ_FIX_LINK_PATHS=
2124         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2125         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2126         DLL_PREFIX=
2127         IMPORT_LIB_SUFFIX=dll.a
2128         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2130         # We use mix of both POSIX and Win32 printf format across the tree, so format
2131         # warnings are useless on mingw.
2132         MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2133         MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2134     else
2135         TARGET_COMPILER_ABI=msvc
2136         HOST_CC='$(CC)'
2137         HOST_CXX='$(CXX)'
2138         HOST_LD='$(LD)'
2139         if test "$AS_BIN"; then
2140             AS="$(basename "$AS_BIN")"
2141         fi
2142         AR='lib'
2143         AR_FLAGS='-NOLOGO -OUT:"$@"'
2144         AR_EXTRACT=
2145         RANLIB='echo not_ranlib'
2146         STRIP='echo not_strip'
2147         PKG_SKIP_STRIP=1
2148         XARGS=xargs
2149         ZIP=zip
2150         UNZIP=unzip
2151         DOXYGEN=:
2152         ASM_SUFFIX=asm
2153         OBJ_SUFFIX=obj
2154         LIB_SUFFIX=lib
2155         DLL_PREFIX=
2156         LIB_PREFIX=
2157         IMPORT_LIB_SUFFIX=lib
2158         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2159         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2160         MKSHLIB_FORCE_ALL=
2161         MKSHLIB_UNFORCE_ALL=
2162         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2163         _USE_CPP_INCLUDE_FLAG=1
2164         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2165         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2166         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2167         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2168         # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2169         # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2170         # MSVC warning C4800 warns when a value is implicitly cast to bool,
2171         # because this also forces narrowing to a single byte, which can be a
2172         # perf hit.  But this matters so little in practice (and often we want
2173         # that behavior) that it's better to turn it off.
2174         CXXFLAGS="$CXXFLAGS -wd4345 -wd4351 -wd4800"
2175         # make 'foo == bar;' error out
2176         CFLAGS="$CFLAGS -we4553"
2177         CXXFLAGS="$CXXFLAGS -we4553"
2178         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2179         MOZ_DEBUG_FLAGS='-Zi'
2180         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2181         WARNINGS_AS_ERRORS='-WX'
2182         MOZ_OPTIMIZE_FLAGS='-O1'
2183         MOZ_FIX_LINK_PATHS=
2184         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2185         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2186         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2187         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2188         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2189         dnl For profile-guided optimization
2190         PROFILE_GEN_CFLAGS="-GL"
2191         PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2192         dnl XXX: PGO builds can fail with warnings treated as errors,
2193         dnl specifically "no profile data available" appears to be
2194         dnl treated as an error sometimes. This might be a consequence
2195         dnl of using WARNINGS_AS_ERRORS in some modules, combined
2196         dnl with the linker doing most of the work in the whole-program
2197         dnl optimization/PGO case. I think it's probably a compiler bug,
2198         dnl but we work around it here.
2199         PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2200         dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2201         dnl Probably also a compiler bug, but what can you do?
2202         PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2203         LDFLAGS="$LDFLAGS -DYNAMICBASE"
2204     fi
2205     AC_DEFINE(HAVE_SNPRINTF)
2206     AC_DEFINE(_WINDOWS)
2207     AC_DEFINE(WIN32)
2208     AC_DEFINE(XP_WIN)
2209     AC_DEFINE(XP_WIN32)
2210     AC_DEFINE(HW_THREADS)
2211     AC_DEFINE(STDC_HEADERS)
2212     AC_DEFINE(NEW_H, <new>)
2213     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2214     TARGET_MD_ARCH=win32
2215     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2216     BIN_SUFFIX='.exe'
2217     MOZ_USER_DIR="Mozilla"
2219     dnl Hardcode to win95 for now - cls
2220     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2222     dnl set NO_X11 defines here as the general check is skipped on win32
2223     no_x=yes
2224     AC_DEFINE(NO_X11)
2226     case "$host" in
2227     *-mingw*)
2228         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2229         L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2230         ;;
2231     esac
2233     case "$host" in
2234     *-mingw*)
2235         if test -z "$MOZ_TOOLS"; then
2236             AC_MSG_ERROR([MOZ_TOOLS is not set])
2237         fi
2238         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2239         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2240             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2241         fi
2242         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2243         if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2244             AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2245         fi
2246         ;;
2247     esac
2249     case "$host_os" in
2250     cygwin*|msvc*|mks*)
2251         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.])
2252         ;;
2253     esac
2255     case "$target" in
2256     i*86-*)
2257         if test "$HAVE_64BIT_OS"; then
2258             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2259         fi
2261         if test -n "$GNU_CC"; then
2262             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2263             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2264             LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup"
2265         else
2266             AC_DEFINE(HAVE_STDCALL)
2267             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2268             LDFLAGS="$LDFLAGS -SAFESEH"
2269         fi
2271         AC_DEFINE(_X86_)
2272         ;;
2273     x86_64-*)
2274         if test -n "$_WIN32_MSVC"; then
2275             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2276         fi
2277         AC_DEFINE(_AMD64_)
2278         ;;
2279     *)
2280         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2281         ;;
2282     esac
2284     if test "$HAVE_64BIT_OS"; then
2285         AC_DEFINE(_WIN64)
2286     fi
2287     ;;
2289 *-netbsd*)
2290     DSO_CFLAGS=''
2291     CFLAGS="$CFLAGS -Dunix"
2292     CXXFLAGS="$CXXFLAGS -Dunix"
2293     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2294         DLL_SUFFIX=".so"
2295         DSO_PIC_CFLAGS='-fPIC -DPIC'
2296         DSO_LDOPTS='-shared'
2297         BIN_FLAGS='-Wl,--export-dynamic'
2298     else
2299         DSO_PIC_CFLAGS='-fPIC -DPIC'
2300         DLL_SUFFIX=".so.1.0"
2301         DSO_LDOPTS='-shared'
2302     fi
2303     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2304     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2305     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2306     if test "$LIBRUNPATH"; then
2307         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2308     fi
2309     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2310     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2311     ;;
2313 *-openbsd*)
2314     if test "$SO_VERSION"; then
2315         DLL_SUFFIX=".so.$SO_VERSION"
2316     else
2317         DLL_SUFFIX=".so.1.0"
2318     fi
2319     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2320     DSO_CFLAGS=''
2321     DSO_PIC_CFLAGS='-fPIC'
2322     DSO_LDOPTS='-shared -fPIC'
2323     if test "$LIBRUNPATH"; then
2324         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2325     fi
2326     ;;
2328 *-os2*)
2329     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2330     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2331     AC_DEFINE(OS2)
2332     AC_DEFINE(XP_OS2)
2333     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2334     AC_DEFINE(TCPV40HDRS)
2335     DLL_PREFIX=
2336     LIB_PREFIX=
2337     LIB_SUFFIX=lib
2338     BIN_SUFFIX=".exe"
2339     DLL_SUFFIX=".dll"
2340     IMPORT_LIB_SUFFIX=lib
2341     DSO_PIC_CFLAGS=
2342     AR=emxomfar
2343     AR_FLAGS='r $@'
2344     CFLAGS="$CFLAGS -Zomf"
2345     CXXFLAGS="$CXXFLAGS -Zomf"
2346     DSO_LDOPTS='-Zdll'
2347     BIN_FLAGS='-Zlinker /ST:0x100000'
2348     IMPLIB='emximp -o'
2349     FILTER='true'
2350     LDFLAGS='-Zmap'
2351     WARNINGS_AS_ERRORS='-Werror'
2352     MOZ_DEBUG_FLAGS="-g -fno-inline"
2353     MOZ_OPTIMIZE_FLAGS="-O2"
2354     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2355     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2356     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2357     TARGET_MD_ARCH=os2
2358     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2359     RC=rc.exe
2360     MC=mc.exe
2361     RCFLAGS='-n'
2362     MOZ_USER_DIR="Mozilla"
2363     ZIP="$ZIP -X"
2365     if test "$MOZTOOLS"; then
2366         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2367     else
2368         AC_MSG_ERROR([MOZTOOLS is not set])
2369     fi
2370     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2371         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2372         LDFLAGS="$LDFLAGS -Zhigh-mem"
2373         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2374         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2375     fi
2377     # GCC for OS/2 currently predefines these, but we don't want them
2378     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2379     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2381     AC_CACHE_CHECK(for __declspec(dllexport),
2382         ac_os2_declspec,
2383         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2384                         [return 0;],
2385                         ac_os2_declspec="yes",
2386                         ac_os2_declspec="no")])
2387     if test "$ac_os2_declspec" != "yes"; then
2388         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2389     fi
2390     ;;
2392 *-solaris*)
2393     AC_DEFINE(SOLARIS)
2394     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2395     MOZ_FIX_LINK_PATHS=
2396     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2397     # libraries one level up (e.g. libnspr4.so)
2398     if test "$SOLARIS_SUNPRO_CC"; then
2399        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2400        LIBS="-lCrun -lCstd -lc $LIBS"
2401        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2402        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2403        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2404        LDFLAGS="-xildoff $LDFLAGS"
2405        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2406            _SAVE_LDFLAGS=$LDFLAGS
2407            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2408            AC_TRY_LINK([#include <stdio.h>],
2409                        [printf("Hello World\n");],
2410                        ,
2411                        [LDFLAGS=$_SAVE_LDFLAGS])
2412        fi
2413        MOZ_OPTIMIZE_FLAGS="-xO4"
2414        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2415        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2416        MKSHLIB_FORCE_ALL='-z allextract'
2417        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2418        DSO_LDOPTS='-G'
2419        AR_LIST="$AR t"
2420        AR_EXTRACT="$AR x"
2421        AR_DELETE="$AR d"
2422        AR='$(CXX) -xar'
2423        AR_FLAGS='-o $@'
2424        AS='/usr/ccs/bin/as'
2425        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2426        AS_DASH_C_FLAG=''
2427        TARGET_COMPILER_ABI="sunc"
2428        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2429        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2430        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2431        AC_LANG_SAVE
2432        AC_LANG_CPLUSPLUS
2433        AC_TRY_COMPILE([],
2434            [#if (__SUNPRO_CC < 0x590)
2435            #error "Denied"
2436            #endif],
2437            _BAD_COMPILER=,_BAD_COMPILER=1)
2438        if test -n "$_BAD_COMPILER"; then
2439            _res="no"
2440            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2441        else
2442            _res="yes"
2443        fi
2444        AC_TRY_COMPILE([],
2445            [#if (__SUNPRO_CC >= 0x5100)
2446            #error "Sun C++ 5.10 or above"
2447            #endif],
2448            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2449        if test "$_ABOVE_SS12U1"; then
2450            # disable xannotate
2451            CXXFLAGS="$CXXFLAGS -xannotate=no"
2452        fi
2453        AC_MSG_RESULT([$_res])
2454        AC_LANG_RESTORE
2455     else
2456        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2457        LIBS="-lc $LIBS"
2458        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2459        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2460        ASFLAGS="$ASFLAGS -fPIC"
2461        DSO_LDOPTS='-shared'
2462        WARNINGS_AS_ERRORS='-Werror'
2463        _WARNINGS_CFLAGS=''
2464        _WARNINGS_CXXFLAGS=''
2465        if test "$OS_RELEASE" = "5.3"; then
2466            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2467        fi
2468     fi
2469     if test "$OS_RELEASE" = "5.5.1"; then
2470         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2471     fi
2472     ;;
2474 *-sunos*)
2475     DSO_LDOPTS='-Bdynamic'
2476     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2477     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2478     AC_DEFINE(SUNOS4)
2479     AC_DEFINE(SPRINTF_RETURNS_STRING)
2480     case "$(target_os)" in
2481     sunos4.1*)
2482         DLL_SUFFIX='.so.1.0'
2483         ;;
2484     esac
2485     ;;
2487 *-os2*)
2488     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2489     ;;
2491 esac
2493 AC_SUBST(MOZ_LINKER)
2494 if test -n "$MOZ_LINKER"; then
2495   AC_DEFINE(MOZ_LINKER)
2497 AC_SUBST(MOZ_ENABLE_SZIP)
2499 dnl Only one oddball right now (QNX), but this gives us flexibility
2500 dnl if any other platforms need to override this in the future.
2501 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2503 dnl ========================================================
2504 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2505 dnl by now will not have any way to link most binaries (tests
2506 dnl as well as viewer, apprunner, etc.), because some symbols
2507 dnl will be left out of the "composite" .so's by ld as unneeded.
2508 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2509 dnl they can link in the static libs that provide the missing
2510 dnl symbols.
2511 dnl ========================================================
2512 NO_LD_ARCHIVE_FLAGS=
2513 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2514     NO_LD_ARCHIVE_FLAGS=1
2516 case "$target" in
2517 *-os2*)
2518     NO_LD_ARCHIVE_FLAGS=
2519     ;;
2520 *-aix4.3*|*-aix5*)
2521     NO_LD_ARCHIVE_FLAGS=
2522     ;;
2523 *-mingw*)
2524     if test -z "$GNU_CC"; then
2525         NO_LD_ARCHIVE_FLAGS=
2526     fi
2527     ;;
2528 esac
2529 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2531 dnl ========================================================
2532 dnl = Flags to strip unused symbols from .so components and
2533 dnl = to export jemalloc symbols when linking a program
2534 dnl ========================================================
2535 case "$target" in
2536     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2537         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2538         ;;
2539     *-solaris*)
2540         if test -z "$GNU_CC"; then
2541          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2542         else
2543          if test -z "$GCC_USE_GNU_LD"; then
2544           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2545          else
2546           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2547          fi
2548         fi
2549         ;;
2550     *-darwin*)
2551         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2552         ;;
2553     *-mingw*)
2554         if test -n "$GNU_CC"; then
2555            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2556         fi
2557         ;;
2558 esac
2560 if test -z "$COMPILE_ENVIRONMENT"; then
2561     SKIP_COMPILER_CHECKS=1
2562     SKIP_LIBRARY_CHECKS=1
2565 MOZ_COMPILER_OPTS
2566 if test -z "$SKIP_COMPILER_CHECKS"; then
2567 dnl Checks for typedefs, structures, and compiler characteristics.
2568 dnl ========================================================
2569 AC_HEADER_STDC
2570 AC_C_CONST
2571 AC_TYPE_MODE_T
2572 AC_TYPE_OFF_T
2573 AC_TYPE_PID_T
2574 AC_TYPE_SIZE_T
2575 AC_LANG_CPLUSPLUS
2576 AC_MSG_CHECKING(for __stdcall)
2577 AC_CACHE_VAL(ac_cv___stdcall,
2578  [AC_TRY_COMPILE([template <typename Method> struct foo;
2579                   template <> struct foo<void (*)()> {};
2580                   template <> struct foo<void (__stdcall*)()> {};],
2581                  [],
2582                  [ac_cv___stdcall=true],
2583                  [ac_cv___stdcall=false])])
2584 if test "$ac_cv___stdcall" = true ; then
2585   AC_DEFINE(HAVE_STDCALL)
2586   AC_MSG_RESULT(yes)
2587 else
2588   AC_MSG_RESULT(no)
2590 AC_LANG_C
2591 AC_MSG_CHECKING(for ssize_t)
2592 AC_CACHE_VAL(ac_cv_type_ssize_t,
2593  [AC_TRY_COMPILE([#include <stdio.h>
2594                   #include <sys/types.h>],
2595                  [ssize_t foo = 0;],
2596                  [ac_cv_type_ssize_t=true],
2597                  [ac_cv_type_ssize_t=false])])
2598 if test "$ac_cv_type_ssize_t" = true ; then
2599   AC_DEFINE(HAVE_SSIZE_T)
2600   AC_MSG_RESULT(yes)
2601 else
2602   AC_MSG_RESULT(no)
2604 AC_STRUCT_ST_BLKSIZE
2605 AC_MSG_CHECKING(for siginfo_t)
2606 AC_CACHE_VAL(ac_cv_siginfo_t,
2607  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2608                   #include <signal.h>],
2609                  [siginfo_t* info;],
2610                  [ac_cv_siginfo_t=true],
2611                  [ac_cv_siginfo_t=false])])
2612 if test "$ac_cv_siginfo_t" = true ; then
2613   AC_DEFINE(HAVE_SIGINFO_T)
2614   AC_MSG_RESULT(yes)
2615 else
2616   AC_MSG_RESULT(no)
2619 dnl Check for int64, uint, and uint_t.
2620 dnl ========================================================
2621 AC_MSG_CHECKING(for int64)
2622 AC_CACHE_VAL(ac_cv_int64,
2623  [AC_TRY_COMPILE([#include <stdio.h>
2624                   #include <sys/types.h>],
2625                  [int64 foo = 0;],
2626                  [ac_cv_int64=true],
2627                  [ac_cv_int64=false])])
2628 if test "$ac_cv_int64" = true ; then
2629   AC_DEFINE(HAVE_INT64)
2630   AC_MSG_RESULT(yes)
2631 else
2632   AC_MSG_RESULT(no)
2634 AC_MSG_CHECKING(for uint)
2635 AC_CACHE_VAL(ac_cv_uint,
2636  [AC_TRY_COMPILE([#include <stdio.h>
2637                   #include <sys/types.h>],
2638                  [uint foo = 0;],
2639                  [ac_cv_uint=true],
2640                  [ac_cv_uint=false])])
2641 if test "$ac_cv_uint" = true ; then
2642   AC_DEFINE(HAVE_UINT)
2643   AC_MSG_RESULT(yes)
2644 else
2645   AC_MSG_RESULT(no)
2647 AC_MSG_CHECKING(for uint_t)
2648 AC_CACHE_VAL(ac_cv_uint_t,
2649  [AC_TRY_COMPILE([#include <stdio.h>
2650                   #include <sys/types.h>],
2651                  [uint_t foo = 0;],
2652                  [ac_cv_uint_t=true],
2653                  [ac_cv_uint_t=false])])
2654 if test "$ac_cv_uint_t" = true ; then
2655   AC_DEFINE(HAVE_UINT_T)
2656   AC_MSG_RESULT(yes)
2657 else
2658   AC_MSG_RESULT(no)
2661 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2662 dnl are defined when compiling C++ but not C.  Since the result of this
2663 dnl test is used only in C++, do it in C++.
2664 AC_LANG_CPLUSPLUS
2666 AC_MSG_CHECKING(for uname.domainname)
2667 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2668     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2669         [ struct utsname *res; char *domain;
2670             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2671         [ac_cv_have_uname_domainname_field=true],
2672         [ac_cv_have_uname_domainname_field=false])])
2674 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2675     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2676     AC_MSG_RESULT(yes)
2677 else
2678     AC_MSG_RESULT(no)
2681 AC_MSG_CHECKING(for uname.__domainname)
2682 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2683     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2684         [ struct utsname *res; char *domain;
2685             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2686         [ac_cv_have_uname_us_domainname_field=true],
2687         [ac_cv_have_uname_us_domainname_field=false])])
2689 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2690     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2691     AC_MSG_RESULT(yes)
2692 else
2693     AC_MSG_RESULT(no)
2696 dnl Check whether we can use gcc's c++0x mode
2697 AC_LANG_CPLUSPLUS
2699 if test "$GNU_CXX"; then
2700     _SAVE_CXXFLAGS=$CXXFLAGS
2701     CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2703     AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2704         ac_cv_cxx0x_headers_bug,
2705         [AC_TRY_COMPILE([#include <memory>], [],
2706                         ac_cv_cxx0x_headers_bug="no",
2707                         ac_cv_cxx0x_headers_bug="yes")])
2708     CXXFLAGS="$_SAVE_CXXFLAGS"
2709     if test "$ac_cv_cxx0x_headers_bug" = "no"; then
2710         CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2711     fi
2714 dnl Check for usable char16_t (2 bytes, unsigned)
2715 dnl (we might not need the unsignedness check anymore)
2716 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2717     ac_cv_have_usable_char16_t,
2718     [AC_TRY_COMPILE([$configure_static_assert_macros],
2719                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2720                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2721                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2722                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2723                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2724                     ac_cv_have_usable_char16_t="yes",
2725                     ac_cv_have_usable_char16_t="no")])
2726 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2727     AC_DEFINE(HAVE_CPP_CHAR16_T)
2728     HAVE_CPP_CHAR16_T=1
2729 elif test "$GNU_CXX"; then
2730     CXXFLAGS="$_SAVE_CXXFLAGS"
2733 dnl Check for usable wchar_t (2 bytes, unsigned)
2734 dnl (we really don't need the unsignedness check anymore)
2735 dnl ========================================================
2737 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2738     ac_cv_have_usable_wchar_v2,
2739     [AC_TRY_COMPILE([#include <stddef.h>
2740                      $configure_static_assert_macros],
2741                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2742                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2743                     ac_cv_have_usable_wchar_v2="yes",
2744                     ac_cv_have_usable_wchar_v2="no")])
2745 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2746     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2747     HAVE_CPP_2BYTE_WCHAR_T=1
2748 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2749 dnl This is really gcc-only
2750 dnl Do this test using CXX only since some versions of gcc
2751 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2752 dnl only have short-wchar support for c++.
2753 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2755     _SAVE_CXXFLAGS=$CXXFLAGS
2756     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2758     AC_CACHE_CHECK(for compiler -fshort-wchar option,
2759         ac_cv_have_usable_wchar_option_v2,
2760         [AC_TRY_LINK([#include <stddef.h>
2761                       $configure_static_assert_macros],
2762                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2763                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2764                      ac_cv_have_usable_wchar_option_v2="yes",
2765                      ac_cv_have_usable_wchar_option_v2="no")])
2767     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2768         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2769         HAVE_CPP_2BYTE_WCHAR_T=1
2770         if test "$OS_TARGET" = Android; then
2771             WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
2772             CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
2773             CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
2774             DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
2775         else
2776             WCHAR_CFLAGS="-fshort-wchar"
2777         fi
2778     else
2779         CXXFLAGS=$_SAVE_CXXFLAGS
2780     fi
2783 AC_LANG_C
2785 dnl Check for .hidden assembler directive and visibility attribute.
2786 dnl Borrowed from glibc configure.in
2787 dnl ===============================================================
2788 if test "$GNU_CC"; then
2789   AC_CACHE_CHECK(for visibility(hidden) attribute,
2790                  ac_cv_visibility_hidden,
2791                  [cat > conftest.c <<EOF
2792                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2794                   ac_cv_visibility_hidden=no
2795                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2796                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2797                       ac_cv_visibility_hidden=yes
2798                     fi
2799                   fi
2800                   rm -f conftest.[cs]
2801                  ])
2802   if test "$ac_cv_visibility_hidden" = "yes"; then
2803     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2805     AC_CACHE_CHECK(for visibility(default) attribute,
2806                    ac_cv_visibility_default,
2807                    [cat > conftest.c <<EOF
2808                     int foo __attribute__ ((visibility ("default"))) = 1;
2810                     ac_cv_visibility_default=no
2811                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2812                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2813                         ac_cv_visibility_default=yes
2814                       fi
2815                     fi
2816                     rm -f conftest.[cs]
2817                    ])
2818     if test "$ac_cv_visibility_default" = "yes"; then
2819       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2821       AC_CACHE_CHECK(for visibility pragma support,
2822                      ac_cv_visibility_pragma,
2823                      [cat > conftest.c <<EOF
2824 #pragma GCC visibility push(hidden)
2825                       int foo_hidden = 1;
2826 #pragma GCC visibility push(default)
2827                       int foo_default = 1;
2829                       ac_cv_visibility_pragma=no
2830                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2831                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2832                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2833                             ac_cv_visibility_pragma=yes
2834                           fi
2835                         fi
2836                       fi
2837                       rm -f conftest.[cs]
2838                     ])
2839       if test "$ac_cv_visibility_pragma" = "yes"; then
2840         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2841                        ac_cv_have_visibility_class_bug,
2842                        [cat > conftest.c <<EOF
2843 #pragma GCC visibility push(hidden)
2844 struct __attribute__ ((visibility ("default"))) TestStruct {
2845   static void Init();
2847 __attribute__ ((visibility ("default"))) void TestFunc() {
2848   TestStruct::Init();
2851                        ac_cv_have_visibility_class_bug=no
2852                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2853                          ac_cv_have_visibility_class_bug=yes
2854                        else
2855                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2856                            ac_cv_have_visibility_class_bug=yes
2857                          fi
2858                        fi
2859                        rm -rf conftest.{c,S}
2860                        ])
2862         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2863                        ac_cv_have_visibility_builtin_bug,
2864                        [cat > conftest.c <<EOF
2865 #pragma GCC visibility push(hidden)
2866 #pragma GCC visibility push(default)
2867 #include <string.h>
2868 #pragma GCC visibility pop
2870 __attribute__ ((visibility ("default"))) void Func() {
2871   char c[[100]];
2872   memset(c, 0, sizeof(c));
2875                        ac_cv_have_visibility_builtin_bug=no
2876                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2877                          ac_cv_have_visibility_builtin_bug=yes
2878                        else
2879                          if test `grep -c "@PLT" conftest.S` = 0; then
2880                            ac_cv_visibility_builtin_bug=yes
2881                          fi
2882                        fi
2883                        rm -f conftest.{c,S}
2884                        ])
2885         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2886                 "$ac_cv_have_visibility_class_bug" = "no"; then
2887           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2888           WRAP_SYSTEM_INCLUDES=1
2889           STL_FLAGS='-I$(DIST)/stl_wrappers'
2890           WRAP_STL_INCLUDES=1
2891         else
2892           VISIBILITY_FLAGS='-fvisibility=hidden'
2893         fi # have visibility pragma bug
2894       fi   # have visibility pragma
2895     fi     # have visibility(default) attribute
2896   fi       # have visibility(hidden) attribute
2897 fi         # GNU_CC
2899 # visibility hidden flag for Sun Studio on Solaris
2900 if test "$SOLARIS_SUNPRO_CC"; then
2901 VISIBILITY_FLAGS='-xldscope=hidden'
2902 fi         # Sun Studio on Solaris
2904 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2905 AC_SUBST(VISIBILITY_FLAGS)
2907 MOZ_GCC_PR49911
2908 MOZ_GCC_PR39608
2909 MOZ_LLVM_PR8927
2911 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2912 dnl ========================================================
2913 if test "$GNU_CC"; then
2914   CFLAGS_save="${CFLAGS}"
2915   CFLAGS="${CFLAGS} -Werror"
2916   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2917                  ac_cv_force_align_arg_pointer,
2918                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2919                                  [],
2920                                  ac_cv_force_align_arg_pointer="yes",
2921                                  ac_cv_force_align_arg_pointer="no")])
2922   CFLAGS="${CFLAGS_save}"
2923   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2924     HAVE_GCC_ALIGN_ARG_POINTER=1
2925   else
2926     HAVE_GCC_ALIGN_ARG_POINTER=
2927   fi
2929 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2931 dnl Checks for header files.
2932 dnl ========================================================
2933 AC_HEADER_DIRENT
2934 case "$target_os" in
2935 freebsd*|openbsd*)
2936 # for stuff like -lXshm
2937     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2938     ;;
2939 esac
2940 MOZ_CHECK_COMMON_HEADERS
2942 dnl These are all the places some variant of statfs can be hiding.
2943 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2945 dnl Quota support
2946 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2947 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2949 dnl SCTP support - needs various network include headers
2950 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2952 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2954 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2955 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2956                    ac_cv_sockaddr_in_sin_len,
2957                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2958                                     #include <sys/types.h>
2959                                     #endif
2960                                     #include <netinet/in.h>
2961                                     struct sockaddr_in x;
2962                                     void *foo = (void*) &x.sin_len;],
2963                                    [],
2964                                    [ac_cv_sockaddr_in_sin_len=true],
2965                                    [ac_cv_sockaddr_in_sin_len=false])])
2966 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2967   AC_DEFINE(HAVE_SIN_LEN)
2968 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2969   AC_DEFINE(HAVE_SCONN_LEN)
2972 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2973                ac_cv_sockaddr_in6_sin6_len,
2974                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2975                                 #include <sys/types.h>
2976                                 #endif
2977                                 #include <netinet/in.h>
2978                                 struct sockaddr_in6 x;
2979                                 void *foo = (void*) &x.sin6_len;],
2980                                [],
2981                                [ac_cv_sockaddr_in6_sin6_len=true],
2982                                [ac_cv_sockaddr_in6_sin6_len=false])])
2983 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2984   AC_DEFINE(HAVE_SIN6_LEN)
2987 AC_CACHE_CHECK(for sockaddr.sa_len,
2988                ac_cv_sockaddr_sa_len,
2989                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2990                                 #include <sys/types.h>
2991                                 #endif
2992                                 #include <sys/socket.h>
2993                                 struct sockaddr x;
2994                                 void *foo = (void*) &x.sa_len;],
2995                                [],
2996                                [ac_cv_sockaddr_sa_len=true],
2997                                [ac_cv_sockaddr_sa_len=false])])
2998 if test "$ac_cv_sockaddr_sa_len" = true ; then
2999   AC_DEFINE(HAVE_SA_LEN)
3002 dnl Check whether the compiler supports the new-style C++ standard
3003 dnl library headers (i.e. <new>) or needs the old "new.h"
3004 AC_LANG_CPLUSPLUS
3005 NEW_H=new.h
3006 MOZ_CHECK_HEADER(new, [NEW_H=new])
3007 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3008 AC_LANG_C
3010 AC_ARG_ENABLE(dtrace,
3011               [  --enable-dtrace         build with dtrace support if available (default=no)],
3012               [enable_dtrace="yes"],)
3013 if test "x$enable_dtrace" = "xyes"; then
3014   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3015   if test -n "$HAVE_DTRACE"; then
3016       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3017   else
3018       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3019   fi
3021 AC_SUBST(HAVE_DTRACE)
3023 case $target in
3024 *-aix4.3*|*-aix5*)
3025         ;;
3027         MOZ_CHECK_HEADERS(sys/cdefs.h)
3028         ;;
3029 esac
3031 MOZ_LINUX_PERF_EVENT
3033 dnl Checks for libraries.
3034 dnl ========================================================
3035 case $target in
3036 *-hpux11.*)
3037         ;;
3039         AC_CHECK_LIB(c_r, gethostbyname_r)
3040         ;;
3041 esac
3043 dnl We don't want to link with libdl even if it's present on OS X, since
3044 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3045 dnl in libc.
3046 dnl We don't want to link against libm or libpthread on Darwin since
3047 dnl they both are just symlinks to libSystem and explicitly linking
3048 dnl against libSystem causes issues when debugging (see bug 299601).
3049 case $target in
3050 *-darwin*)
3051     ;;
3052 *-os2*)
3053     ;;
3055     AC_SEARCH_LIBS(dlopen, dl,
3056         MOZ_CHECK_HEADER(dlfcn.h,
3057         AC_DEFINE(HAVE_DLOPEN)))
3058     ;;
3059 esac
3061 _SAVE_CFLAGS="$CFLAGS"
3062 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3063 AC_CHECK_FUNCS(dladdr memmem)
3064 CFLAGS="$_SAVE_CFLAGS"
3066 if test ! "$GNU_CXX"; then
3068     case $target in
3069     *-aix*)
3070         AC_CHECK_LIB(C_r, demangle)
3071         ;;
3072      *)
3073         AC_CHECK_LIB(C, demangle)
3074         ;;
3075      esac
3078 dnl OS/2 has socket in libc.
3079 case $target in
3080 *-os2*)
3081     ;;
3083     AC_CHECK_LIB(socket, socket)
3084 esac
3086 XLDFLAGS="$X_LIBS"
3087 XLIBS="$X_EXTRA_LIBS"
3089 dnl ========================================================
3090 dnl Checks for X libraries.
3091 dnl Ordering is important.
3092 dnl Xt is dependent upon SM as of X11R6
3093 dnl ========================================================
3094 if test "$no_x" = "yes"; then
3095     AC_DEFINE(NO_X11)
3096 else
3097     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3098         XLIBS="-lX11 $XLIBS"
3099         _SAVE_LDFLAGS="$LDFLAGS"
3100         LDFLAGS="$XLDFLAGS $LDFLAGS"
3101         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3102                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3103         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3104                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3106         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3107         unset ac_cv_lib_Xt_XtFree
3108             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3109             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3110         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3111                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3112         ])
3114     # AIX needs the motif library linked before libXt to prevent
3115     # crashes in plugins linked against Motif - Bug #98892
3116     case "${target_os}" in
3117     aix*)
3118         XT_LIBS="-lXm $XT_LIBS"
3119         ;;
3120     esac
3122     dnl ========================================================
3123     dnl = Check for XShm
3124     dnl ========================================================
3125     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3126         $XLIBS $XEXT_LIBS)
3128     dnl ========================================================
3129     dnl = Check for Xss
3130     dnl ========================================================
3131     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3132         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3133             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3134              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3136         LDFLAGS="$_SAVE_LDFLAGS"
3137 fi # $no_x
3139 AC_SUBST(XCFLAGS)
3140 AC_SUBST(XLDFLAGS)
3141 AC_SUBST(XLIBS)
3142 AC_SUBST(XEXT_LIBS)
3143 AC_SUBST(XT_LIBS)
3144 AC_SUBST(XSS_LIBS)
3146 dnl ========================================================
3147 dnl = pthread support
3148 dnl = Start by checking whether the system support pthreads
3149 dnl ========================================================
3150 case "$target_os" in
3151 darwin*)
3152     USE_PTHREADS=1
3153     ;;
3155     MOZ_CHECK_PTHREADS(pthreads,
3156         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3157         MOZ_CHECK_PTHREADS(pthread,
3158             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3159             MOZ_CHECK_PTHREADS(c_r,
3160                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3161                 MOZ_CHECK_PTHREADS(c,
3162                     USE_PTHREADS=1
3163                 )
3164             )
3165         )
3166     )
3167     ;;
3168 esac
3170 dnl ========================================================
3171 dnl Check the command line for --with-pthreads
3172 dnl ========================================================
3173 MOZ_ARG_WITH_BOOL(pthreads,
3174 [  --with-pthreads         Force use of system pthread library with NSPR ],
3175 [ if test "$USE_PTHREADS"x = x; then
3176     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3177 fi],
3178     USE_PTHREADS=
3179     _PTHREAD_LDFLAGS=
3182 dnl ========================================================
3183 dnl Do the platform specific pthread hackery
3184 dnl ========================================================
3185 if test "$USE_PTHREADS"x != x
3186 then
3187         dnl
3188         dnl See if -pthread is supported.
3189         dnl
3190         rm -f conftest*
3191         ac_cv_have_dash_pthread=no
3192         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3193         echo 'int main() { return 0; }' | cat > conftest.c
3194         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3195         if test $? -eq 0; then
3196                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3197                         ac_cv_have_dash_pthread=yes
3198                 case "$target_os" in
3199                 freebsd*)
3200 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3201                 ;;
3202                 *)
3203                             CFLAGS="$CFLAGS -pthread"
3204                             CXXFLAGS="$CXXFLAGS -pthread"
3205                 ;;
3206                 esac
3207                 fi
3208         fi
3209         rm -f conftest*
3210     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3212         dnl
3213         dnl See if -pthreads is supported.
3214         dnl
3215     ac_cv_have_dash_pthreads=no
3216     if test "$ac_cv_have_dash_pthread" = "no"; then
3217             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3218         echo 'int main() { return 0; }' | cat > conftest.c
3219             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3220         if test $? -eq 0; then
3221                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3222                             ac_cv_have_dash_pthreads=yes
3223                             CFLAGS="$CFLAGS -pthreads"
3224                             CXXFLAGS="$CXXFLAGS -pthreads"
3225                     fi
3226             fi
3227             rm -f conftest*
3228         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3229     fi
3231         case "$target" in
3232             *-*-freebsd*)
3233                         AC_DEFINE(_REENTRANT)
3234                         AC_DEFINE(_THREAD_SAFE)
3235                         dnl -pthread links in -lpthread, so don't specify it explicitly.
3236                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3237                                 _PTHREAD_LDFLAGS="-pthread"
3238                         fi
3239                         ;;
3241             *-*-openbsd*|*-*-bsdi*)
3242                         AC_DEFINE(_REENTRANT)
3243                         AC_DEFINE(_THREAD_SAFE)
3244                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3245                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3246                 _PTHREAD_LDFLAGS="-pthread"
3247                         fi
3248                         ;;
3250             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3251                         AC_DEFINE(_REENTRANT)
3252                         ;;
3254             *-aix4.3*|*-aix5*)
3255                         AC_DEFINE(_REENTRANT)
3256                         ;;
3258             *-hpux11.*)
3259                         AC_DEFINE(_REENTRANT)
3260                         ;;
3262             *-*-solaris*)
3263                         AC_DEFINE(_REENTRANT)
3264                         if test "$SOLARIS_SUNPRO_CC"; then
3265                                 CFLAGS="$CFLAGS -mt"
3266                                 CXXFLAGS="$CXXFLAGS -mt"
3267                         fi
3268                         ;;
3269         esac
3270     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3274 dnl Checks for library functions.
3275 dnl ========================================================
3276 AC_PROG_GCC_TRADITIONAL
3277 AC_FUNC_MEMCMP
3278 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf memmove rint stat64 lstat64 truncate64 setbuf isatty)
3279 AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
3280 AC_CHECK_FUNCS(flockfile getpagesize)
3281 AC_CHECK_FUNCS(localtime_r strtok_r)
3283 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3284 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3285                ac_cv_clock_monotonic,
3286                [for libs in "" -lrt; do
3287                     _SAVE_LIBS="$LIBS"
3288                     LIBS="$LIBS $libs"
3289                     AC_TRY_LINK([#include <time.h>],
3290                                  [ struct timespec ts;
3291                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
3292                                  ac_cv_clock_monotonic=$libs
3293                                  LIBS="$_SAVE_LIBS"
3294                                  break,
3295                                  ac_cv_clock_monotonic=no)
3296                     LIBS="$_SAVE_LIBS"
3297                 done])
3298 if test "$ac_cv_clock_monotonic" != "no"; then
3299     HAVE_CLOCK_MONOTONIC=1
3300     REALTIME_LIBS=$ac_cv_clock_monotonic
3301     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3302     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3303     AC_SUBST(REALTIME_LIBS)
3306 dnl check for wcrtomb/mbrtowc
3307 dnl =======================================================================
3308 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3309 AC_LANG_SAVE
3310 AC_LANG_CPLUSPLUS
3311 AC_CACHE_CHECK(for wcrtomb,
3312     ac_cv_have_wcrtomb,
3313     [AC_TRY_LINK([#include <wchar.h>],
3314                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3315                  ac_cv_have_wcrtomb="yes",
3316                  ac_cv_have_wcrtomb="no")])
3317 if test "$ac_cv_have_wcrtomb" = "yes"; then
3318     AC_DEFINE(HAVE_WCRTOMB)
3320 AC_CACHE_CHECK(for mbrtowc,
3321     ac_cv_have_mbrtowc,
3322     [AC_TRY_LINK([#include <wchar.h>],
3323                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3324                  ac_cv_have_mbrtowc="yes",
3325                  ac_cv_have_mbrtowc="no")])
3326 if test "$ac_cv_have_mbrtowc" = "yes"; then
3327     AC_DEFINE(HAVE_MBRTOWC)
3329 AC_LANG_RESTORE
3332 AC_CACHE_CHECK(
3333     [for res_ninit()],
3334     ac_cv_func_res_ninit,
3335     [AC_TRY_LINK([
3336         #ifdef linux
3337         #define _BSD_SOURCE 1
3338         #endif
3339         #include <resolv.h>
3340         ],
3341         [int foo = res_ninit(&_res);],
3342         [ac_cv_func_res_ninit=yes],
3343         [ac_cv_func_res_ninit=no])
3344     ])
3346 if test "$ac_cv_func_res_ninit" = "yes"; then
3347     AC_DEFINE(HAVE_RES_NINIT)
3348 dnl must add the link line we do something as foolish as this... dougt
3349 dnl else
3350 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3351 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3354 AC_LANG_CPLUSPLUS
3355 AC_CACHE_CHECK(
3356     [for gnu_get_libc_version()],
3357     ac_cv_func_gnu_get_libc_version,
3358     [AC_TRY_LINK([
3359         #ifdef HAVE_GNU_LIBC_VERSION_H
3360         #include <gnu/libc-version.h>
3361         #endif
3362         ],
3363         [const char *glibc_version = gnu_get_libc_version();],
3364         [ac_cv_func_gnu_get_libc_version=yes],
3365         [ac_cv_func_gnu_get_libc_version=no]
3366         )]
3367     )
3369 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3370     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3373 case $target_os in
3374     darwin*|mingw*|os2*)
3375         ;;
3376     *)
3378 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3379     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3380         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3381 _SAVE_LIBS=$LIBS
3382 LIBS="$LIBS $_ICONV_LIBS"
3383 AC_CACHE_CHECK(
3384     [for iconv()],
3385     ac_cv_func_iconv,
3386     [AC_TRY_LINK([
3387         #include <stdlib.h>
3388         #include <iconv.h>
3389         ],
3390         [
3391             iconv_t h = iconv_open("", "");
3392             iconv(h, NULL, NULL, NULL, NULL);
3393             iconv_close(h);
3394         ],
3395         [ac_cv_func_iconv=yes],
3396         [ac_cv_func_iconv=no]
3397         )]
3398     )
3399 if test "$ac_cv_func_iconv" = "yes"; then
3400     AC_DEFINE(HAVE_ICONV)
3401     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3402     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3403     LIBICONV="$_ICONV_LIBS"
3404     AC_CACHE_CHECK(
3405         [for iconv() with const input],
3406         ac_cv_func_const_iconv,
3407         [AC_TRY_COMPILE([
3408             #include <stdlib.h>
3409             #include <iconv.h>
3410             ],
3411             [
3412                 const char *input = "testing";
3413                 iconv_t h = iconv_open("", "");
3414                 iconv(h, &input, NULL, NULL, NULL);
3415                 iconv_close(h);
3416             ],
3417             [ac_cv_func_const_iconv=yes],
3418             [ac_cv_func_const_iconv=no]
3419             )]
3420         )
3421     if test "$ac_cv_func_const_iconv" = "yes"; then
3422         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3423     fi
3425 LIBS=$_SAVE_LIBS
3427     ;;
3428 esac
3430 AM_LANGINFO_CODESET
3432 AC_LANG_C
3434 dnl **********************
3435 dnl *** va_copy checks ***
3436 dnl **********************
3437 dnl we currently check for all three va_copy possibilities, so we get
3438 dnl all results in config.log for bug reports.
3439 AC_MSG_CHECKING(for an implementation of va_copy())
3440 AC_CACHE_VAL(ac_cv_va_copy,[
3441     AC_TRY_RUN([
3442         #include <stdarg.h>
3443         void f (int i, ...) {
3444             va_list args1, args2;
3445             va_start (args1, i);
3446             va_copy (args2, args1);
3447             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3448                 exit (1);
3449             va_end (args1); va_end (args2);
3450         }
3451         int main() { f (0, 42); return 0; }],
3452         ac_cv_va_copy=yes,
3453         ac_cv_va_copy=no,
3454         ac_cv_va_copy=no
3455     )
3457 AC_MSG_RESULT($ac_cv_va_copy)
3458 AC_MSG_CHECKING(for an implementation of __va_copy())
3459 AC_CACHE_VAL(ac_cv___va_copy,[
3460     AC_TRY_RUN([
3461         #include <stdarg.h>
3462         void f (int i, ...) {
3463             va_list args1, args2;
3464             va_start (args1, i);
3465             __va_copy (args2, args1);
3466             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3467                 exit (1);
3468             va_end (args1); va_end (args2);
3469         }
3470         int main() { f (0, 42); return 0; }],
3471         ac_cv___va_copy=yes,
3472         ac_cv___va_copy=no,
3473         ac_cv___va_copy=no
3474     )
3476 AC_MSG_RESULT($ac_cv___va_copy)
3477 AC_MSG_CHECKING(whether va_lists can be copied by value)
3478 AC_CACHE_VAL(ac_cv_va_val_copy,[
3479     AC_TRY_RUN([
3480         #include <stdarg.h>
3481         void f (int i, ...) {
3482             va_list args1, args2;
3483             va_start (args1, i);
3484             args2 = args1;
3485             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3486                 exit (1);
3487             va_end (args1); va_end (args2);
3488         }
3489         int main() { f (0, 42); return 0; }],
3490         ac_cv_va_val_copy=yes,
3491         ac_cv_va_val_copy=no,
3492         ac_cv_va_val_copy=yes
3493     )
3495 if test "x$ac_cv_va_copy" = "xyes"; then
3496     AC_DEFINE(VA_COPY, va_copy)
3497     AC_DEFINE(HAVE_VA_COPY)
3498 elif test "x$ac_cv___va_copy" = "xyes"; then
3499     AC_DEFINE(VA_COPY, __va_copy)
3500     AC_DEFINE(HAVE_VA_COPY)
3503 if test "x$ac_cv_va_val_copy" = "xno"; then
3504    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3506 AC_MSG_RESULT($ac_cv_va_val_copy)
3508 dnl ===================================================================
3509 dnl ========================================================
3510 dnl Put your C++ language/feature checks below
3511 dnl ========================================================
3512 AC_LANG_CPLUSPLUS
3514 ARM_ABI_PREFIX=
3515 if test "$GNU_CC"; then
3516   if test "$CPU_ARCH" = "arm" ; then
3517     AC_CACHE_CHECK(for ARM EABI,
3518         ac_cv_gcc_arm_eabi,
3519         [AC_TRY_COMPILE([],
3520                         [
3521 #if defined(__ARM_EABI__)
3522   return 0;
3523 #else
3524 #error Not ARM EABI.
3525 #endif
3526                         ],
3527                         ac_cv_gcc_arm_eabi="yes",
3528                         ac_cv_gcc_arm_eabi="no")])
3529     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3530         HAVE_ARM_EABI=1
3531         ARM_ABI_PREFIX=eabi-
3532     else
3533         ARM_ABI_PREFIX=oabi-
3534     fi
3535   fi
3537   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3540 dnl Check for support of modern template specialization syntax
3541 dnl Test code and requirement from scc@netscape.com.
3542 dnl Autoconf cut-and-paste job by waterson@netscape.com
3543 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3544                ac_cv_cpp_modern_specialize_template_syntax,
3545                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3546                                class Y {};
3547                                template <> struct X<Y> { double a; };,
3548                                X<int> int_x;
3549                                X<Y> y_x;,
3550                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3551                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3552 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
3553   AC_MSG_ERROR([The C++ compiler does not support template specialization])
3556 dnl Some compilers support only full specialization, and some don't.
3557 AC_CACHE_CHECK(whether partial template specialization works,
3558                ac_cv_cpp_partial_specialization,
3559                [AC_TRY_COMPILE(template <class T> class Foo {};
3560                                template <class T> class Foo<T*> {};,
3561                                return 0;,
3562                                ac_cv_cpp_partial_specialization=yes,
3563                                ac_cv_cpp_partial_specialization=no)])
3564 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3565   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3568 dnl Check to see if we can resolve ambiguity with |using|.
3569 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3570                ac_cv_cpp_ambiguity_resolving_using,
3571                [AC_TRY_COMPILE(class X {
3572                                  public: int go(const X&) {return 3;}
3573                                          int jo(const X&) {return 3;}
3574                                };
3575                                class Y : public X {
3576                                  public:  int go(int) {return 2;}
3577                                           int jo(int) {return 2;}
3578                                           using X::jo;
3579                                  private: using X::go;
3580                                };,
3581                                X x; Y y; y.jo(x);,
3582                                ac_cv_cpp_ambiguity_resolving_using=yes,
3583                                ac_cv_cpp_ambiguity_resolving_using=no)])
3584 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3585    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3588 dnl See if a dynamic_cast to void* gives the most derived object.
3589 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3590                ac_cv_cpp_dynamic_cast_void_ptr,
3591                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3592                             class Y { int j; public: virtual ~Y() { } };
3593                             class Z : public X, public Y { int k; };
3595                             int main() {
3596                                  Z mdo;
3597                                  X *subx = (X*)&mdo;
3598                                  Y *suby = (Y*)&mdo;
3599                                  return !((((void*)&mdo != (void*)subx) &&
3600                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3601                                           (((void*)&mdo != (void*)suby) &&
3602                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3603                             }],
3604                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3605                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3606                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3607 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3608    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3612 dnl note that this one is reversed - if the test fails, then
3613 dnl we require implementations of unused virtual methods. Which
3614 dnl really blows because it means we'll have useless vtable
3615 dnl bloat.
3616 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3617                ac_cv_cpp_unused_required,
3618                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3619                                X x;,
3620                                ac_cv_cpp_unused_required=no,
3621                                ac_cv_cpp_unused_required=yes)])
3622 if test "$ac_cv_cpp_unused_required" = yes ; then
3623    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3627 dnl Some compilers have trouble comparing a constant reference to a templatized
3628 dnl class to zero, and require an explicit operator==() to be defined that takes
3629 dnl an int. This test separates the strong from the weak.
3631 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3632                ac_cv_trouble_comparing_to_zero,
3633                [AC_TRY_COMPILE([#include <algorithm>
3634                                 template <class T> class Foo {};
3635                                 class T2;
3636                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3637                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3638                                [Foo<int> f; return (0 != f);],
3639                                ac_cv_trouble_comparing_to_zero=no,
3640                                ac_cv_trouble_comparing_to_zero=yes)])
3641 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3642   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3645 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3646 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3647 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3648 # linking XUL.
3649 _SAVE_LDFLAGS=$LDFLAGS
3650 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3651 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3652                ac_cv_thread_keyword,
3653                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3654                             [return tlsIsMainThread;],
3655                             ac_cv_thread_keyword=yes,
3656                             ac_cv_thread_keyword=no)])
3657 LDFLAGS=$_SAVE_LDFLAGS
3658 # The custom dynamic linker doesn't support TLS variables
3659 MOZ_TLS=
3660 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3661   # mips builds fail with TLS variables because of a binutils bug.
3662   # See bug 528687
3663   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3664   case "${target}" in
3665     mips*-*)
3666       :
3667       ;;
3668     *-android*|*-linuxandroid*)
3669       :
3670       ;;
3671     *-openbsd*)
3672       :
3673       ;;
3674     *)
3675       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3676       MOZ_TLS=1
3677       ;;
3678   esac
3681 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3682 if test -n "$MOZ_LINKER"; then
3683   if test "$CPU_ARCH" = arm; then
3684     dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
3685     ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
3686     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3687     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3688       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000"
3689       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000"
3690     fi
3691   fi
3694 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3695 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3696 dnl We however want to avoid these text relocations, and this can be done
3697 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3698 dnl doesn't contain anything at all, beside placeholders for some sections,
3699 dnl and crtbegin only contains a finalizer function that calls
3700 dnl __cxa_finalize. The custom linker actually takes care of calling
3701 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3702 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3703 dnl link crtbegin and crtend at all.
3704 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$OS_TARGET" = "Android"; then
3705   AC_CACHE_CHECK([whether the CRT objects have text relocations],
3706     ac_cv_crt_has_text_relocations,
3707     [echo 'int foo() { return 0; }' > conftest.cpp
3708      if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3709         test -s conftest${DLL_SUFFIX}; then
3710        if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3711          ac_cv_crt_has_text_relocations=yes
3712        else
3713          ac_cv_crt_has_text_relocations=no
3714        fi
3715      else
3716        AC_ERROR([couldn't compile a simple C file])
3717      fi
3718      rm -rf conftest*])
3719   if test "$ac_cv_crt_has_text_relocations" = yes; then
3720     dnl While we want libraries to skip the CRT files, we don't want
3721     dnl executables to be treated the same way. We thus set the flag
3722     dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3723     dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3724     dnl Using LDFLAGS in nspr is safe, since we only really build
3725     dnl libraries there.
3726     DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3727     NSPR_LDFLAGS=-nostartfiles
3728   fi
3731 dnl Check for the existence of various allocation headers/functions
3733 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3734 MALLOC_H=
3736 for file in $MALLOC_HEADERS; do
3737   MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3738   if test "$MALLOC_H" != ""; then
3739     AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3740     break
3741   fi
3742 done
3744 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3745 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3747 AC_CHECK_FUNCS(malloc_usable_size)
3749 dnl See if compiler supports some gcc-style attributes
3751 AC_CACHE_CHECK(for __attribute__((always_inline)),
3752                ac_cv_attribute_always_inline,
3753                [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3754                                [],
3755                                ac_cv_attribute_always_inline=yes,
3756                                ac_cv_attribute_always_inline=no)])
3758 AC_CACHE_CHECK(for __attribute__((malloc)),
3759                ac_cv_attribute_malloc,
3760                [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3761                                [],
3762                                ac_cv_attribute_malloc=yes,
3763                                ac_cv_attribute_malloc=no)])
3765 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3766                ac_cv_attribute_warn_unused,
3767                [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3768                                [],
3769                                ac_cv_attribute_warn_unused=yes,
3770                                ac_cv_attribute_warn_unused=no)])
3772 dnl End of C++ language/feature checks
3773 AC_LANG_C
3775 dnl ========================================================
3776 dnl =  Internationalization checks
3777 dnl ========================================================
3779 dnl Internationalization and Locale support is different
3780 dnl on various UNIX platforms.  Checks for specific i18n
3781 dnl features go here.
3783 dnl check for LC_MESSAGES
3784 AC_CACHE_CHECK(for LC_MESSAGES,
3785                 ac_cv_i18n_lc_messages,
3786                 [AC_TRY_COMPILE([#include <locale.h>],
3787                                 [int category = LC_MESSAGES;],
3788                                 ac_cv_i18n_lc_messages=yes,
3789                                 ac_cv_i18n_lc_messages=no)])
3790 if test "$ac_cv_i18n_lc_messages" = yes; then
3791    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3794 AC_HAVE_FUNCS(localeconv)
3795 fi # ! SKIP_COMPILER_CHECKS
3797 TARGET_XPCOM_ABI=
3798 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3799     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3802 dnl Mozilla specific options
3803 dnl ========================================================
3804 dnl The macros used for command line options
3805 dnl are defined in build/autoconf/altoptions.m4.
3807 dnl If the compiler supports these attributes, define them as
3808 dnl convenience macros.
3809 if test "$ac_cv_attribute_malloc" = yes ; then
3810   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3811 else
3812   AC_DEFINE(NS_ATTR_MALLOC,)
3815 if test "$ac_cv_attribute_warn_unused" = yes ; then
3816   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3817 else
3818   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3821 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3822 dnl features that Windows actually does support.
3824 if test -n "$SKIP_COMPILER_CHECKS"; then
3825    dnl Windows has malloc.h
3826    AC_DEFINE(MALLOC_H, [<malloc.h>])
3827    AC_DEFINE(HAVE_FORCEINLINE)
3828    AC_DEFINE(HAVE_LOCALECONV)
3829 fi # SKIP_COMPILER_CHECKS
3831 dnl ========================================================
3832 dnl =
3833 dnl = Check for external package dependencies
3834 dnl =
3835 dnl ========================================================
3836 MOZ_ARG_HEADER(External Packages)
3838 MOZ_ARG_WITH_STRING(libxul-sdk,
3839 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
3840   LIBXUL_SDK_DIR=$withval)
3842 if test "$LIBXUL_SDK_DIR" = "yes"; then
3843     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3844 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3845     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3847     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3848         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3849     fi
3852 AC_SUBST(LIBXUL_SDK)
3854 if test -n "$LIBXUL_SDK"; then
3855     LIBXUL_DIST="$LIBXUL_SDK"
3856 else
3857     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3859 AC_SUBST(LIBXUL_DIST)
3861 SYSTEM_LIBXUL=
3863 MOZ_ARG_WITH_BOOL(system-libxul,
3864 [  --with-system-libxul    Use system installed libxul SDK],
3865     SYSTEM_LIBXUL=1)
3867 dnl ========================================================
3868 dnl = If NSPR was not detected in the system,
3869 dnl = use the one in the source tree (mozilla/nsprpub)
3870 dnl ========================================================
3871 MOZ_ARG_WITH_BOOL(system-nspr,
3872 [  --with-system-nspr      Use system installed NSPR],
3873     _USE_SYSTEM_NSPR=1 )
3875 if test -n "$_USE_SYSTEM_NSPR"; then
3876     AM_PATH_NSPR(4.9.4, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
3879 if test -n "$MOZ_NATIVE_NSPR"; then
3880     _SAVE_CFLAGS=$CFLAGS
3881     CFLAGS="$CFLAGS $NSPR_CFLAGS"
3882     AC_TRY_COMPILE([#include "prtypes.h"],
3883                 [#ifndef PR_STATIC_ASSERT
3884                  #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3885                  #endif],
3886                 [MOZ_NATIVE_NSPR=1],
3887                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3888     AC_TRY_COMPILE([#include "prtypes.h"],
3889                 [#ifndef PR_UINT64
3890                  #error PR_UINT64 not defined or requires including prtypes.h
3891                  #endif],
3892                 [MOZ_NATIVE_NSPR=1],
3893                 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3894     CFLAGS=$_SAVE_CFLAGS
3895 else
3896     if test -z "$LIBXUL_SDK"; then
3897         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3898         if test -n "$GNU_CC"; then
3899             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3900         else
3901             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3902         fi
3903     else
3904         NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3905         NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3906     fi
3909 dnl system libevent Support
3910 dnl ========================================================
3911 MOZ_ARG_WITH_STRING(system-libevent,
3912 [  --with-system-libevent[=PFX]
3913                           Use system libevent [installed at prefix PFX]],
3914     LIBEVENT_DIR=$withval)
3916 _SAVE_CFLAGS=$CFLAGS
3917 _SAVE_LDFLAGS=$LDFLAGS
3918 _SAVE_LIBS=$LIBS
3919 if test "$LIBEVENT_DIR" = yes; then
3920     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3921         MOZ_NATIVE_LIBEVENT=1,
3922         LIBEVENT_DIR=/usr)
3924 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3925     MOZ_NATIVE_LIBEVENT=
3926 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3927     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3928     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3929     MOZ_CHECK_HEADER(event.h,
3930         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3931              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3932          fi],
3933         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3934     AC_CHECK_LIB(event, event_init,
3935                  [MOZ_NATIVE_LIBEVENT=1
3936                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3937                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3938                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3940 CFLAGS=$_SAVE_CFLAGS
3941 LDFLAGS=$_SAVE_LDFLAGS
3942 LIBS=$_SAVE_LIBS
3944 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3945 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
3946 AC_SUBST(MOZ_LIBEVENT_LIBS)
3948 dnl ========================================================
3949 dnl = If NSS was not detected in the system,
3950 dnl = use the one in the source tree (mozilla/security/nss)
3951 dnl ========================================================
3953 MOZ_ARG_WITH_BOOL(system-nss,
3954 [  --with-system-nss       Use system installed NSS],
3955     _USE_SYSTEM_NSS=1 )
3957 if test -n "$_USE_SYSTEM_NSS"; then
3958     AM_PATH_NSS(3.14, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3961 if test -n "$MOZ_NATIVE_NSS"; then
3962    NSS_LIBS="$NSS_LIBS -lcrmf"
3963 else
3964    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3965    NSS_DEP_LIBS="\
3966         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3967         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
3968         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
3969         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
3970         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
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_FLEXBOX=1
4189 MOZ_WEBAPP_RUNTIME=
4190 MOZ_JSDEBUGGER=1
4191 MOZ_AUTH_EXTENSION=1
4192 MOZ_OGG=1
4193 MOZ_RAW=
4194 MOZ_SYDNEYAUDIO=
4195 MOZ_SPEEX_RESAMPLER=1
4196 MOZ_SOUNDTOUCH=1
4197 MOZ_CUBEB=
4198 MOZ_VORBIS=
4199 MOZ_TREMOR=
4200 MOZ_WAVE=1
4201 MOZ_SAMPLE_TYPE_FLOAT32=
4202 MOZ_SAMPLE_TYPE_S16=
4203 MOZ_MEDIA=
4204 MOZ_OPUS=1
4205 MOZ_WEBM=1
4206 MOZ_DASH=
4207 MOZ_WEBRTC=1
4208 MOZ_PEERCONNECTION=
4209 MOZ_SRTP=
4210 MOZ_WEBRTC_SIGNALING=
4211 MOZ_WEBRTC_IN_LIBXUL=
4212 MOZ_SCTP=
4213 MOZ_MEDIA_PLUGINS=
4214 MOZ_MEDIA_NAVIGATOR=
4215 MOZ_OMX_PLUGIN=
4216 MOZ_VP8=
4217 MOZ_VP8_ERROR_CONCEALMENT=
4218 MOZ_VP8_ENCODER=
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_PREF_EXTENSIONS=1
4235 MOZ_PROFILELOCKING=1
4236 MOZ_PSM=1
4237 MOZ_REFLOW_PERF=
4238 MOZ_SAFE_BROWSING=
4239 MOZ_HELP_VIEWER=
4240 MOZ_SPELLCHECK=1
4241 MOZ_ANDROID_OMTC=
4242 MOZ_ONLY_TOUCH_EVENTS=
4243 MOZ_TOOLKIT_SEARCH=1
4244 MOZ_UI_LOCALE=en-US
4245 MOZ_UNIVERSALCHARDET=1
4246 MOZ_URL_CLASSIFIER=
4247 MOZ_XUL=1
4248 MOZ_ZIPWRITER=1
4249 NS_PRINTING=1
4250 MOZ_PDF_PRINTING=
4251 MOZ_DISABLE_DOMCRYPTO=
4252 NSS_DISABLE_DBM=
4253 NECKO_WIFI=1
4254 NECKO_COOKIES=1
4255 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4256 USE_ARM_KUSER=
4257 BUILD_CTYPES=1
4258 MOZ_USE_NATIVE_POPUP_WINDOWS=
4259 MOZ_ANDROID_HISTORY=
4260 MOZ_WEBSMS_BACKEND=
4261 MOZ_GRAPHITE=1
4262 ACCESSIBILITY=1
4263 MOZ_SYS_MSG=
4264 MOZ_TIME_MANAGER=
4265 MOZ_PAY=
4267 case "$target_os" in
4268     mingw*)
4269         NS_ENABLE_TSF=1
4270         AC_DEFINE(NS_ENABLE_TSF)
4271         ;;
4272 esac
4274 case "${target}" in
4275     *-android*|*-linuxandroid*)
4276         if test "$CPU_ARCH" = "arm" ; then
4277           USE_ARM_KUSER=1
4278         fi
4280         NSS_DISABLE_DBM=1
4281         if test -z "$gonkdir"; then
4282           NECKO_WIFI=
4283         else
4284           NECKO_WIFI=1
4285         fi
4286         MOZ_THEME_FASTSTRIPE=1
4287         MOZ_TREE_FREETYPE=1
4288         MOZ_MEMORY=1
4289         MOZ_RAW=1
4290         ;;
4292 esac
4294 MOZ_ARG_ENABLE_STRING(application,
4295 [  --enable-application=APP
4296                           Options include:
4297                             browser (Firefox)
4298                             xulrunner
4299                             tools/update-packaging (AUS-related packaging tools)],
4300 [ MOZ_BUILD_APP=$enableval ] )
4302 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4303 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4304   XULRUNNER_STUB_NAME=$withval)
4306 if test -z "$XULRUNNER_STUB_NAME"; then
4307   case "$target_os" in
4308   darwin*)
4309     XULRUNNER_STUB_NAME=xulrunner
4310     ;;
4311   *)
4312     XULRUNNER_STUB_NAME=xulrunner-stub
4313   esac
4315 AC_SUBST(XULRUNNER_STUB_NAME)
4317 AC_MSG_CHECKING([for application to build])
4318 if test -z "$MOZ_BUILD_APP"; then
4319   AC_MSG_RESULT([browser])
4320   MOZ_BUILD_APP=browser
4321 else
4322   # default mobile to be mobile/xul
4323   if test "$MOZ_BUILD_APP" = "mobile" ; then
4324     MOZ_BUILD_APP=mobile/xul
4325   fi
4326   # We have a valid application only if it has a build.mk file in its top
4327   # directory.
4328   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4329     AC_MSG_RESULT([none])
4330     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4331   else
4332     AC_MSG_RESULT([$MOZ_BUILD_APP])
4333   fi
4336 # Allow the application to influence configure with a confvars.sh script.
4338 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4339 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4340   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4341   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4342 else
4343   AC_MSG_RESULT([no])
4346 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4347 MOZ_ARG_WITH_STRING(app-name,
4348 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4349 WITH_APP_NAME=$withval,
4352 if test -n "$WITH_APP_NAME" ; then
4353     MOZ_APP_NAME="$WITH_APP_NAME"
4356 MOZ_ARG_WITH_STRING(app-basename,
4357 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4358 WITH_APP_BASENAME=$withval,
4361 if test -n "$WITH_APP_BASENAME" ; then
4362     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4365 # Now is a good time to test for logic errors, define mismatches, etc.
4366 case "$MOZ_BUILD_APP" in
4367 xulrunner)
4368   if test "$LIBXUL_SDK"; then
4369     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4370   fi
4371   ;;
4372 esac
4374 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4375 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4376 # MOZ_BUILD_APP.
4377 case "$MOZ_BUILD_APP" in
4378 browser)
4379   AC_DEFINE(MOZ_PHOENIX)
4380   ;;
4382 xulrunner)
4383   AC_DEFINE(MOZ_XULRUNNER)
4384   ;;
4385 b2g)
4386   AC_DEFINE(MOZ_B2G)
4387   ;;
4388 esac
4390 AC_SUBST(MOZ_BUILD_APP)
4391 AC_SUBST(MOZ_PHOENIX)
4392 AC_SUBST(MOZ_XULRUNNER)
4393 AC_SUBST(MOZ_B2G)
4395 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4397 dnl ========================================================
4398 dnl Check android sdk version depending on mobile target
4399 dnl ========================================================
4401 if test -z "$gonkdir" ; then
4402     # Minimum Android SDK API Level we require.
4403     case "$MOZ_BUILD_APP" in
4404     mobile/xul)
4405         android_min_api_level=13
4406         ;;
4407     mobile/android)
4408         android_min_api_level=16
4409         ;;
4410     esac
4412     MOZ_ANDROID_SDK($android_min_api_level)
4415 dnl ========================================================
4416 dnl =
4417 dnl = Toolkit Options
4418 dnl =
4419 dnl ========================================================
4420 MOZ_ARG_HEADER(Toolkit Options)
4422     dnl ========================================================
4423     dnl = Select the default toolkit
4424     dnl ========================================================
4425         MOZ_ARG_ENABLE_STRING(default-toolkit,
4426         [  --enable-default-toolkit=TK
4427                           Select default toolkit
4428                           Platform specific defaults:
4429                             Mac OS X - cairo-cocoa
4430                             OS/2 - cairo-os2
4431                             Win32 - cairo-windows
4432                             * - cairo-gtk2
4433                             * - cairo-qt],
4434     [ _DEFAULT_TOOLKIT=$enableval ],
4435     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4437     if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4438         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4439         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4440         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4441         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4442         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4443         -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4444         -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4445         -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4446     then
4447         dnl nglayout only supports building with one toolkit,
4448         dnl so ignore everything after the first comma (",").
4449         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4450     else
4451         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4452     fi
4454 MOZ_ARG_WITHOUT_BOOL(x,
4455 [  --without-x              Build without X11],
4456     WITHOUT_X11=1)
4458 dnl ========================================================
4459 dnl = Enable the toolkit as needed                         =
4460 dnl ========================================================
4462 MOZ_WIDGET_GTK=
4464 case "$MOZ_WIDGET_TOOLKIT" in
4466 cairo-windows)
4467     MOZ_WIDGET_TOOLKIT=windows
4468     MOZ_WEBGL=1
4469     MOZ_PDF_PRINTING=1
4470     MOZ_INSTRUMENT_EVENT_LOOP=1
4471     ;;
4473 cairo-gtk2|cairo-gtk2-x11)
4474     MOZ_WIDGET_TOOLKIT=gtk2
4475     MOZ_ENABLE_GTK2=1
4476     MOZ_ENABLE_XREMOTE=1
4477     MOZ_WEBGL=1
4478     MOZ_GL_DEFAULT_PROVIDER=GLX
4480     AC_DEFINE(MOZ_X11)
4481     MOZ_X11=1
4482     USE_FC_FREETYPE=1
4484     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4485     TK_LIBS='$(MOZ_GTK2_LIBS)'
4486     AC_DEFINE(MOZ_WIDGET_GTK2)
4487     MOZ_WIDGET_GTK=2
4488     AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4489     MOZ_PDF_PRINTING=1
4490     MOZ_INSTRUMENT_EVENT_LOOP=1
4491     ;;
4493 cairo-qt)
4494     MOZ_WIDGET_TOOLKIT=qt
4495     MOZ_ENABLE_QT=1
4496     if test -z "$WITHOUT_X11"; then
4497       MOZ_ENABLE_XREMOTE=1
4498       MOZ_GL_DEFAULT_PROVIDER=GLX
4499       MOZ_X11=1
4500       AC_DEFINE(MOZ_X11)
4501       XT_LIBS=
4502     fi
4504     MOZ_WEBGL=1
4505     USE_ELF_DYNSTR_GC=
4506     USE_FC_FREETYPE=1
4507     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4508     TK_LIBS='$(MOZ_QT_LIBS)'
4509     AC_DEFINE(MOZ_WIDGET_QT)
4510     MOZ_PDF_PRINTING=1
4511     ;;
4513 cairo-os2)
4514     MOZ_WIDGET_TOOLKIT=os2
4515     USE_FC_FREETYPE=1
4516     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4517     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4518     MOZ_PDF_PRINTING=1
4519     ;;
4521 cairo-cocoa)
4522     MOZ_WIDGET_TOOLKIT=cocoa
4523     AC_DEFINE(MOZ_WIDGET_COCOA)
4524     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4525     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4526     TK_CFLAGS="-DNO_X11"
4527     CFLAGS="$CFLAGS $TK_CFLAGS"
4528     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4529     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4530     MOZ_USER_DIR="Mozilla"
4531     MOZ_FS_LAYOUT=bundle
4532     MOZ_WEBGL=1
4533     MOZ_INSTRUMENT_EVENT_LOOP=1
4534     ;;
4536 cairo-uikit)
4537     MOZ_WIDGET_TOOLKIT=uikit
4538     AC_DEFINE(MOZ_WIDGET_UIKIT)
4539     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4540     TK_CFLAGS="-DNO_X11"
4541     TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4542     CFLAGS="$CFLAGS $TK_CFLAGS"
4543     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4544     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4545     MOZ_USER_DIR="Mozilla"
4546     MOZ_FS_LAYOUT=bundle
4547     ;;
4549 cairo-android)
4550     AC_DEFINE(MOZ_WIDGET_ANDROID)
4551     MOZ_WIDGET_TOOLKIT=android
4552     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4553     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4554     MOZ_WEBGL=1
4555     MOZ_PDF_PRINTING=1
4556     MOZ_INSTRUMENT_EVENT_LOOP=1
4557     if test "$MOZ_BUILD_APP" = "mobile/xul"; then
4558         MOZ_OLD_LINKER=1
4559     fi
4560     ;;
4562 cairo-gonk)
4563     AC_DEFINE(MOZ_WIDGET_GONK)
4564     AC_DEFINE(MOZ_TOUCH)
4565     MOZ_WIDGET_TOOLKIT=gonk
4566     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4567     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4568     MOZ_WEBGL=1
4569     MOZ_PDF_PRINTING=1
4570     MOZ_TOUCH=1
4571     ;;
4573 esac
4575 AC_SUBST(MOZ_OLD_LINKER)
4576 AC_SUBST(MOZ_PDF_PRINTING)
4577 if test "$MOZ_PDF_PRINTING"; then
4578    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4579    AC_DEFINE(MOZ_PDF_PRINTING)
4582 if test "$MOZ_ENABLE_XREMOTE"; then
4583     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4586 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4587    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4590 if test "$COMPILE_ENVIRONMENT"; then
4591   if test "$MOZ_ENABLE_GTK2"; then
4592     if test "$MOZ_X11"; then
4593       GDK_PACKAGES=gdk-x11-2.0
4594     fi
4596     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4597   fi
4599 fi # COMPILE_ENVIRONMENT
4601 AC_SUBST(MOZ_FS_LAYOUT)
4603 dnl ========================================================
4604 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4605 dnl their usage and use them in spidermonkey.
4606 dnl ========================================================
4607 MOZ_ARG_WITH_BOOL(arm-kuser,
4608 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4609     USE_ARM_KUSER=1,)
4610 if test -n "$USE_ARM_KUSER"; then
4611    AC_DEFINE(USE_ARM_KUSER)
4614 dnl ========================================================
4615 dnl = startup-notification support module
4616 dnl ========================================================
4618 if test "$MOZ_ENABLE_GTK2"
4619 then
4620     MOZ_ENABLE_STARTUP_NOTIFICATION=
4622     MOZ_ARG_ENABLE_BOOL(startup-notification,
4623     [  --enable-startup-notification
4624                           Enable startup-notification support (default: disabled) ],
4625         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4626         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4627     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4628     then
4629         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4630                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4631         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4632             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4633             then
4634                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4635             fi
4636             MOZ_ENABLE_STARTUP_NOTIFICATION=
4637         ])
4638     fi
4640     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4641         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4642     fi
4644     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4646 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4647 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4648 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4650 dnl ========================================================
4651 dnl = QT support
4652 dnl ========================================================
4653 if test "$MOZ_ENABLE_QT"
4654 then
4655     MOZ_ARG_WITH_STRING(qtdir,
4656     [  --with-qtdir=\$dir       Specify Qt directory ],
4657     [ QTDIR=$withval])
4659     if test -z "$QTDIR"; then
4660         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
4661         PKG_CHECK_MODULES(MOZ_QT5, QtWidgets QtMultimedia QtPrintSupport,
4662                       MOZ_ENABLE_QT5=1,
4663                       MOZ_ENABLE_QT5=)
4664         if test "$MOZ_ENABLE_QT5"; then
4665             echo "Using qt5"
4666             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
4667             MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
4668         fi
4670         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4671         AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4672     else
4673         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4675         MOZ_QT_CFLAGS="-DQT_SHARED"
4676         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4677         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4678         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4679         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4680         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4681         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4682         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4683         HOST_MOC="$QTDIR/bin/moc"
4684         HOST_RCC="$QTDIR/bin/rcc"
4686         # QtWidgets was introduced only in Qt5
4687         if test -d $QTDIR/include/QtWidgets; then
4688             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4689             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4690             MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtWidgets -lQtPrintSupport"
4691         fi
4692     fi
4693     if test -z "$HOST_MOC"; then
4694         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4695 incorrect])
4696     fi
4697     if test -z "$HOST_RCC"; then
4698         AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4699 incorrect])
4700     fi
4702     MOC=$HOST_MOC
4703     RCC=$HOST_RCC
4705     MOZ_ENABLE_QMSYSTEM2=
4706     PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4707                       MOZ_ENABLE_QMSYSTEM2=1,
4708                       MOZ_ENABLE_QMSYSTEM2=)
4710     if test "$MOZ_ENABLE_QMSYSTEM2"; then
4711       MOZ_ENABLE_QMSYSTEM2=1
4712       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4713       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4714       AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4715     fi
4717     MOZ_ENABLE_QTNETWORK=
4718     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4719                       MOZ_ENABLE_QTNETWORK=1,
4720                       MOZ_ENABLE_QTNETWORK=)
4722     if test "$MOZ_ENABLE_QTNETWORK"; then
4723       MOZ_ENABLE_QTNETWORK=1
4724       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4725     fi
4727     MOZ_ENABLE_QTMOBILITY=
4728     PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4729                       MOZ_ENABLE_QTMOBILITY=1,
4730                       MOZ_ENABLE_QTMOBILITY=)
4731     if test "$MOZ_ENABLE_QTMOBILITY"; then
4732        MOZ_ENABLE_QTMOBILITY=1
4733        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4734        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4735     else
4736        AC_CHECK_LIB(QtSensors, main, [
4737           MOZ_ENABLE_QTMOBILITY=1
4738           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4739           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4740           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4741           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4742           MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4743        ])
4744     fi
4745     if test "$MOZ_ENABLE_QTMOBILITY"; then
4746        AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4747     fi
4750 AC_SUBST(GTK_CONFIG)
4751 AC_SUBST(TK_CFLAGS)
4752 AC_SUBST(TK_LIBS)
4754 AC_SUBST(MOZ_ENABLE_GTK2)
4755 AC_SUBST(MOZ_ENABLE_QT)
4756 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4757 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4758 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4759 AC_SUBST(MOZ_ENABLE_XREMOTE)
4760 AC_SUBST(MOZ_GTK2_CFLAGS)
4761 AC_SUBST(MOZ_GTK2_LIBS)
4762 AC_SUBST(MOZ_WIDGET_GTK)
4763 AC_SUBST(MOZ_QT_CFLAGS)
4764 AC_SUBST(MOZ_QT_LIBS)
4766 AC_SUBST(MOC)
4767 AC_SUBST(RCC)
4769 AC_SUBST(MOZ_X11)
4771 dnl ========================================================
4772 dnl =
4773 dnl = Components & Features
4774 dnl =
4775 dnl ========================================================
4776 MOZ_ARG_HEADER(Components and Features)
4778 dnl ========================================================
4779 dnl = Localization
4780 dnl ========================================================
4781 MOZ_ARG_ENABLE_STRING(ui-locale,
4782 [  --enable-ui-locale=ab-CD
4783                           Select the user interface locale (default: en-US)],
4784     MOZ_UI_LOCALE=$enableval )
4785 AC_SUBST(MOZ_UI_LOCALE)
4787 dnl ========================================================
4788 dnl = Trademarked Branding
4789 dnl ========================================================
4790 MOZ_ARG_ENABLE_BOOL(official-branding,
4791 [  --enable-official-branding
4792                           Enable Official mozilla.org Branding
4793                           Do not distribute builds with
4794                           --enable-official-branding unless you have
4795                           permission to use trademarks per
4796                           http://www.mozilla.org/foundation/trademarks/ .],
4798   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4799     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4800   else
4801     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4802     MOZ_OFFICIAL_BRANDING=1
4803   fi
4804 ], MOZ_OFFICIAL_BRANDING=)
4806 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4807 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4808   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4811 MOZ_ARG_WITH_STRING(branding,
4812 [  --with-branding=dir     Use branding from the specified directory.],
4813     MOZ_BRANDING_DIRECTORY=$withval)
4815 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4816 if test -z "$REAL_BRANDING_DIRECTORY"; then
4817   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4820 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4821   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4824 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4826 dnl ========================================================
4827 dnl = Distribution ID
4828 dnl ========================================================
4829 MOZ_ARG_WITH_STRING(distribution-id,
4830 [  --with-distribution-id=ID
4831                           Set distribution-specific id (default=org.mozilla)],
4832 [ val=`echo $withval`
4833     MOZ_DISTRIBUTION_ID="$val"])
4835 if test -z "$MOZ_DISTRIBUTION_ID"; then
4836    MOZ_DISTRIBUTION_ID="org.mozilla"
4839 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4840 AC_SUBST(MOZ_DISTRIBUTION_ID)
4843 dnl ========================================================
4844 dnl complex text support off by default
4845 dnl ========================================================
4846 MOZ_ARG_DISABLE_BOOL(pango,
4847 [  --disable-pango         Disable usage of Pango ],
4848     MOZ_PANGO=,
4849     MOZ_PANGO=1)
4851 dnl ========================================================
4852 dnl = Pango
4853 dnl ========================================================
4854 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4855 then
4856     AC_SUBST(MOZ_PANGO)
4858     if test "$MOZ_PANGO"
4859     then
4860         PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4862         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4863         AC_SUBST(MOZ_PANGO_CFLAGS)
4864         AC_SUBST(MOZ_PANGO_LIBS)
4865         AC_DEFINE(MOZ_PANGO)
4866     else
4867         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
4868         AC_SUBST(FT2_CFLAGS)
4869         AC_SUBST(FT2_LIBS)
4870     fi
4873 dnl ========================================================
4874 dnl = GnomeVFS, GIO and GConf support module
4875 dnl ========================================================
4877 if test "$MOZ_X11"
4878 then
4879     dnl build the GIO extension by default only when the
4880     dnl GTK2 toolkit is in use.
4881     if test "$MOZ_ENABLE_GTK2"
4882     then
4883         MOZ_ENABLE_GIO=1
4884         MOZ_ENABLE_GCONF=1
4885     fi
4887     dnl ========================================================
4888     dnl = GnomeVFS support module
4889     dnl ========================================================
4890     MOZ_ARG_ENABLE_BOOL(gnomevfs,
4891     [  --enable-gnomevfs       Enable GnomeVFS support (default: disabled)],
4892         MOZ_ENABLE_GNOMEVFS=force,
4893         MOZ_ENABLE_GNOMEVFS=)
4895     if test "$MOZ_ENABLE_GNOMEVFS"
4896     then
4897         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4898             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4899             MOZ_ENABLE_GNOMEVFS=1
4900             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4901         ],[
4902             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4903             then
4904                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4905             fi
4906             MOZ_ENABLE_GNOMEVFS=
4907         ])
4908     fi
4910     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4911     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4912     AC_SUBST(MOZ_GNOMEVFS_LIBS)
4914     dnl ========================================================
4915     dnl = GIO support module
4916     dnl ========================================================
4917     MOZ_ARG_DISABLE_BOOL(gio,
4918     [  --disable-gio           Disable GIO support],
4919         MOZ_ENABLE_GIO=,
4920         MOZ_ENABLE_GIO=force)
4922     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
4923     then
4924         PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4925                           [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4926         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4927             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4928             MOZ_ENABLE_GIO=1
4929             AC_DEFINE(MOZ_ENABLE_GIO)
4930         ],[
4931             if test "$MOZ_ENABLE_GIO" = "force"
4932             then
4933                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4934             fi
4935             MOZ_ENABLE_GIO=
4936         ])
4937     fi
4939     AC_SUBST(MOZ_ENABLE_GIO)
4940     AC_SUBST(MOZ_GIO_CFLAGS)
4941     AC_SUBST(MOZ_GIO_LIBS)
4943     dnl ========================================================
4944     dnl = GConf support module
4945     dnl ========================================================
4946     MOZ_ARG_DISABLE_BOOL(gconf,
4947     [  --disable-gconf      Disable Gconf support ],
4948         MOZ_ENABLE_GCONF=,
4949         MOZ_ENABLE_GCONF=force)
4951     if test "$MOZ_ENABLE_GCONF"
4952     then
4953         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4954             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4955             MOZ_ENABLE_GCONF=1
4956         ],[
4957             if test "$MOZ_ENABLE_GCONF" = "force"
4958             then
4959                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4960             fi
4961             MOZ_ENABLE_GCONF=
4962         ])
4963     fi
4965     if test "$MOZ_ENABLE_GCONF"; then
4966         AC_DEFINE(MOZ_ENABLE_GCONF)
4967     fi
4969     AC_SUBST(MOZ_ENABLE_GCONF)
4970     AC_SUBST(MOZ_GCONF_CFLAGS)
4971     AC_SUBST(MOZ_GCONF_LIBS)
4974 dnl ========================================================
4975 dnl = libproxy support
4976 dnl ========================================================
4978 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4979 then
4980     MOZ_ENABLE_LIBPROXY=
4982     MOZ_ARG_ENABLE_BOOL(libproxy,
4983     [  --enable-libproxy         Enable libproxy support ],
4984     MOZ_ENABLE_LIBPROXY=1,
4985     MOZ_ENABLE_LIBPROXY=)
4987     if test "$MOZ_ENABLE_LIBPROXY"
4988     then
4989         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4990         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4991     fi
4993 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4994 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
4995 AC_SUBST(MOZ_LIBPROXY_LIBS)
4997 dnl ========================================================
4998 dnl = GNOME component (mozgnome)
4999 dnl ========================================================
5001 if test "$MOZ_ENABLE_GTK2"
5002 then
5003     MOZ_ENABLE_GNOME_COMPONENT=1
5005 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5007 dnl ========================================================
5008 dnl = libgnomeui support module
5009 dnl ========================================================
5011 if test "$MOZ_ENABLE_GTK2"
5012 then
5013     MOZ_ARG_ENABLE_BOOL(gnomeui,
5014     [  --enable-gnomeui        Enable libgnomeui instead of GIO & GTK for icon theme support ],
5015         MOZ_ENABLE_GNOMEUI=force,
5016         MOZ_ENABLE_GNOMEUI=)
5018     if test "$MOZ_ENABLE_GNOMEUI"
5019     then
5020         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5021         [
5022             MOZ_ENABLE_GNOMEUI=1
5023         ],[
5024             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5025             then
5026                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5027             fi
5028             MOZ_ENABLE_GNOMEUI=
5029         ])
5030     fi
5032     if test "$MOZ_ENABLE_GNOMEUI"; then
5033         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5034     fi
5037 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5038 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5040 dnl ========================================================
5041 dnl = dbus support
5042 dnl ========================================================
5044 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5045 then
5046     MOZ_ENABLE_DBUS=1
5048     MOZ_ARG_DISABLE_BOOL(dbus,
5049     [  --disable-dbus          Disable dbus support ],
5050         MOZ_ENABLE_DBUS=,
5051         MOZ_ENABLE_DBUS=1)
5053     if test "$MOZ_ENABLE_DBUS"
5054     then
5055         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5056         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5057         AC_DEFINE(MOZ_ENABLE_DBUS)
5058     fi
5060 AC_SUBST(MOZ_ENABLE_DBUS)
5061 AC_SUBST(MOZ_DBUS_CFLAGS)
5062 AC_SUBST(MOZ_DBUS_LIBS)
5063 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5064 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5066 dnl ========================================================
5067 dnl = Enable Android History instead of Places
5068 dnl ========================================================
5069 if test -n "$MOZ_ANDROID_HISTORY"; then
5070     if test -z "$MOZ_PLACES"; then
5071         AC_DEFINE(MOZ_ANDROID_HISTORY)
5072     else
5073         AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
5074     fi
5077 dnl ========================================================
5078 dnl = Build with the Android compositor
5079 dnl ========================================================
5080 if test -n "$MOZ_ANDROID_OMTC"; then
5081      dnl Do this if defined in confvars.sh
5082      AC_DEFINE(MOZ_ANDROID_OMTC)
5085 dnl ========================================================
5086 dnl = Disable WebSMS backend
5087 dnl ========================================================
5088 MOZ_ARG_DISABLE_BOOL(websms-backend,
5089 [  --disable-websms-backend
5090                            Disable WebSMS backend],
5091     MOZ_WEBSMS_BACKEND=,
5092     MOZ_WEBSMS_BACKEND=1)
5094 if test -n "$MOZ_WEBSMS_BACKEND"; then
5095     AC_DEFINE(MOZ_WEBSMS_BACKEND)
5098 dnl ========================================================
5099 dnl = Build Personal Security Manager
5100 dnl ========================================================
5101 MOZ_ARG_DISABLE_BOOL(crypto,
5102 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5103     MOZ_PSM=,
5104     MOZ_PSM=1 )
5106 dnl ========================================================
5107 dnl = JS Debugger XPCOM component (js/jsd)
5108 dnl ========================================================
5109 MOZ_ARG_DISABLE_BOOL(jsd,
5110 [  --disable-jsd           Disable JavaScript debug library],
5111     MOZ_JSDEBUGGER=,
5112     MOZ_JSDEBUGGER=1)
5115 dnl ========================================================
5116 dnl = Enable IPDL's "expensive" unit tests
5117 dnl ========================================================
5118 MOZ_IPDL_TESTS=
5120 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5121 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5122     MOZ_IPDL_TESTS=1,
5123     MOZ_IPDL_TESTS=)
5125 if test -n "$MOZ_IPDL_TESTS"; then
5126     AC_DEFINE(MOZ_IPDL_TESTS)
5129 AC_SUBST(MOZ_IPDL_TESTS)
5131 dnl ========================================================
5132 dnl = Turns off code necessary for e10s compatibility
5133 dnl ========================================================
5134 dnl This is a temporary flag to be removed in bug 662601 when
5135 dnl it's no longer needed
5137 MOZ_E10S_COMPAT=
5139 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5140 [  --enable-e10s-compat     Turns off code for e10s compat],
5141     MOZ_E10S_COMPAT=1,
5142     MOZ_E10S_COMPAT=)
5144 if test -n "$MOZ_E10S_COMPAT"; then
5145     AC_DEFINE(MOZ_E10S_COMPAT)
5148 dnl ========================================================
5149 dnl = Disable building dbm
5150 dnl ========================================================
5151 MOZ_ARG_DISABLE_BOOL(dbm,
5152 [  --disable-dbm           Disable building dbm],
5153     NSS_DISABLE_DBM=1,
5154     NSS_DISABLE_DBM=)
5156 dnl bi-directional support always on
5157 IBMBIDI=1
5158 AC_DEFINE(IBMBIDI)
5160 dnl ========================================================
5161 dnl accessibility support on by default on all platforms
5162 dnl ========================================================
5163 MOZ_ARG_DISABLE_BOOL(accessibility,
5164 [  --disable-accessibility Disable accessibility support],
5165     ACCESSIBILITY=,
5166     ACCESSIBILITY=1 )
5167 if test "$ACCESSIBILITY"; then
5168     AC_DEFINE(ACCESSIBILITY)
5171 dnl ========================================================
5172 dnl Disable printing
5173 dnl ========================================================
5174 MOZ_ARG_DISABLE_BOOL(printing,
5175 [  --disable-printing      Disable printing support],
5176     NS_PRINTING=,
5177     NS_PRINTING=1)
5179 if test "$NS_PRINTING"; then
5180     AC_DEFINE(NS_PRINTING)
5181     AC_DEFINE(NS_PRINT_PREVIEW)
5184 dnl Turn off webrtc for OS's we don't handle yet, but allow 
5185 dnl --enable-webrtc to override.  Can disable for everything in
5186 dnl the master list above.
5187 if test -n "$MOZ_WEBRTC"; then
5188     case "$target" in
5189     *-android*|*-linuxandroid*)
5190         dnl Make sure doesn't get matched by *-linux*
5191         MOZ_WEBRTC=
5192         ;;
5193     *-linux*|*-mingw*|*-darwin*)
5194         dnl Leave enabled
5195         ;;
5196     *)
5197         dnl default to disabled for all others
5198         MOZ_WEBRTC=
5199         ;;
5200     esac
5203 dnl ========================================================
5204 dnl = Disable WebRTC code
5205 dnl ========================================================
5206 MOZ_ARG_DISABLE_BOOL(webrtc,
5207 [  --disable-webrtc        Disable support for WebRTC],
5208     MOZ_WEBRTC=,
5209     MOZ_WEBRTC=1)
5211 if test -n "$MOZ_WEBRTC"; then
5212     AC_DEFINE(MOZ_WEBRTC)
5213     MOZ_MEDIA=1
5214     MOZ_RAW=1
5215     MOZ_VP8=1
5216     MOZ_VP8_ENCODER=1
5217     MOZ_VP8_ERROR_CONCEALMENT=1
5218 dnl enable once Signaling lands
5219     MOZ_WEBRTC_SIGNALING=1
5220     AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5221     if test "${OS_TARGET}" = "WINNT"; then
5222         MOZ_WEBRTC_IN_LIBXUL=1
5223     fi
5224 dnl enable once PeerConnection lands
5225     MOZ_PEERCONNECTION=1
5226     AC_DEFINE(MOZ_PEERCONNECTION)
5227     MOZ_SCTP=1
5228     MOZ_SRTP=1
5229     AC_DEFINE(MOZ_SCTP)
5230     AC_DEFINE(MOZ_SRTP)
5233 AC_SUBST(MOZ_WEBRTC)
5234 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5235 AC_SUBST(MOZ_PEERCONNECTION)
5236 AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
5237 AC_SUBST(MOZ_SCTP)
5238 AC_SUBST(MOZ_SRTP)
5240 case "$target_cpu" in
5241 arm*)
5242     MOZ_SAMPLE_TYPE_S16=1
5243     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5244     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5247     MOZ_SAMPLE_TYPE_FLOAT32=1
5248     AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5249     AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5251 esac
5253 dnl ========================================================
5254 dnl = Enable Raw Codecs
5255 dnl ========================================================
5256 MOZ_ARG_ENABLE_BOOL(raw,
5257 [  --enable-raw           Enable support for RAW media],
5258     MOZ_RAW=1,
5259     MOZ_RAW=)
5261 if test -n "$MOZ_RAW"; then
5262     AC_DEFINE(MOZ_RAW)
5263     MOZ_MEDIA=1
5266 AC_SUBST(MOZ_RAW)
5268 dnl ========================================================
5269 dnl = Disable Ogg Codecs
5270 dnl ========================================================
5271 MOZ_ARG_DISABLE_BOOL(ogg,
5272 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5273     MOZ_OGG=,
5274     MOZ_OGG=1)
5276 if test -n "$MOZ_OGG"; then
5277     AC_DEFINE(MOZ_OGG)
5278     MOZ_SYDNEYAUDIO=1
5279     MOZ_CUBEB=1
5280     MOZ_MEDIA=1
5282     dnl Checks for __attribute__(aligned()) directive
5283     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5284         [ac_cv_c_attribute_aligned],
5285         [ac_cv_c_attribute_aligned=0
5286          CFLAGS_save="${CFLAGS}"
5287          CFLAGS="${CFLAGS} -Werror"
5288          for ac_cv_c_attr_align_try in 64 32 16 8; do
5289            echo "trying $ac_cv_c_attr_align_try"
5290            AC_TRY_COMPILE([],
5291                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5292                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5293            if test "$ac_cv_c_attribute_aligned" != 0; then
5294              break;
5295            fi
5296          done
5297            CFLAGS="${CFLAGS_save}"])
5298     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5299       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5300                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5301     fi
5304 dnl ========================================================
5305 dnl = Disable Opus audio codec support
5306 dnl ========================================================
5307 MOZ_ARG_DISABLE_BOOL(opus,
5308 [  --disable-opus          Disable support for Opus audio],
5309     MOZ_OPUS=,
5310     MOZ_OPUS=1)
5312 dnl ========================================================
5313 dnl = Disable VP8 decoder support
5314 dnl ========================================================
5315 MOZ_ARG_DISABLE_BOOL(webm,
5316 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5317     MOZ_WEBM=,
5318     MOZ_WEBM=1)
5320 if test -n "$MOZ_WEBM"; then
5321     AC_DEFINE(MOZ_WEBM)
5322     MOZ_VP8=1
5325 dnl ========================================================
5326 dnl = Enable DASH-WebM support
5327 dnl ========================================================
5328 MOZ_ARG_ENABLE_BOOL(dash,
5329 [  --enable-dash          Enable support for DASH-WebM],
5330     MOZ_DASH=1,
5331     MOZ_DASH=)
5333 if test -n "$MOZ_DASH"; then
5334     if test -n "$MOZ_WEBM"; then
5335         AC_DEFINE(MOZ_DASH)
5336     else
5337         dnl Fail if WebM is not enabled as well as DASH.
5338         AC_MSG_ERROR([WebM is currently disabled and must be enabled for DASH
5339                      to work.])
5340     fi
5343 dnl ========================================================
5344 dnl = Enable media plugin support
5345 dnl ========================================================
5346 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5347   dnl Enable support on android by default
5348   MOZ_MEDIA_PLUGINS=1
5351 MOZ_ARG_ENABLE_BOOL(media-plugins,
5352 [  --enable-media-plugins  Enable support for media plugins],
5353     MOZ_MEDIA_PLUGINS=1,
5354     MOZ_MEDIA_PLUGINS=)
5356 if test -n "$MOZ_MEDIA_PLUGINS"; then
5357   AC_DEFINE(MOZ_MEDIA_PLUGINS)
5360 dnl ========================================================
5361 dnl = Enable getUserMedia support
5362 dnl ========================================================
5363 MOZ_ARG_ENABLE_BOOL(media-navigator,
5364 [  --enable-media-navigator  Enable support for getUserMedia],
5365     MOZ_MEDIA_NAVIGATOR=1,
5366     MOZ_MEDIA_NAVIGATOR=)
5368 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5369   AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5372 dnl ========================================================
5373 dnl = Enable building OMX media plugin (B2G or Android)
5374 dnl ========================================================
5375 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5376   dnl Enable support on android by default
5377   MOZ_OMX_PLUGIN=1
5380 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5381 [  --enable-omx-plugin      Enable building OMX plugin (B2G)],
5382     MOZ_OMX_PLUGIN=1,
5383     MOZ_OMX_PLUGIN=)
5385 if test -n "$MOZ_OMX_PLUGIN"; then
5386     if test "$OS_TARGET" = "Android"; then
5387         dnl Only allow building OMX plugin on Gonk (B2G) or Android
5388         AC_DEFINE(MOZ_OMX_PLUGIN)
5389     else
5390        dnl fail if we're not building on Gonk or Android
5391        AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5392     fi
5395 dnl system libvpx Support
5396 dnl ========================================================
5397 MOZ_ARG_WITH_BOOL(system-libvpx,
5398 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
5399     MOZ_NATIVE_LIBVPX=1)
5401 MOZ_LIBVPX_CFLAGS=
5402 MOZ_LIBVPX_LIBS=
5404 if test -n "$MOZ_VP8"; then
5405     AC_DEFINE(MOZ_VP8)
5406     if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5407         AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5408     fi
5409     if test -n "$MOZ_VP8_ENCODER" ; then
5410         AC_DEFINE(MOZ_VP8_ENCODER)
5411     fi
5413     if test -n "$MOZ_NATIVE_LIBVPX"; then
5414         dnl ============================
5415         dnl === libvpx Version check ===
5416         dnl ============================
5417         dnl Check to see if we have a system libvpx package.
5418         PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5420         MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [], 
5421          [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.])])
5423         _SAVE_LIBS=$LIBS
5424         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [], 
5425          [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5426         LIBS=$_SAVE_LIBS
5427     fi
5430 AC_SUBST(MOZ_NATIVE_LIBVPX)
5431 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5432 AC_SUBST(MOZ_LIBVPX_LIBS)
5434 if test "$MOZ_WEBM"; then
5435     MOZ_SYDNEYAUDIO=1
5436     MOZ_CUBEB=1
5437     MOZ_MEDIA=1
5438     if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5439         MOZ_VORBIS=1
5440     else
5441         MOZ_TREMOR=1
5442     fi
5445 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5447     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5448     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5449     dnl We currently require gcc on all arm platforms.
5450     VPX_AS=$YASM
5451     VPX_ASM_SUFFIX=asm
5452     VPX_NEED_OBJ_INT_EXTRACT=
5454     dnl See if we have assembly on this platform.
5455     case "$OS_ARCH:$CPU_ARCH" in
5456     Darwin:x86)
5457       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5458       VPX_X86_ASM=1
5459     ;;
5460     Darwin:x86_64)
5461       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5462       VPX_X86_ASM=1
5463     ;;
5464     WINNT:x86_64)
5465       VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5466       VPX_X86_ASM=1
5467     ;;
5468     WINNT:x86)
5469       dnl Check for yasm 1.1 or greater.
5470       if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5471         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.])
5472       elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5473         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.])
5474       else
5475         VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5476         VPX_X86_ASM=1
5477         dnl The encoder needs obj_int_extract to get asm offsets.
5478       fi
5479     ;;
5480     *:arm*)
5481       if test -n "$GNU_AS" ; then
5482         VPX_AS=$AS
5483         dnl These flags are a lie; they're just used to enable the requisite
5484         dnl opcodes; actual arch detection is done at runtime.
5485         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5486         VPX_DASH_C_FLAG="-c"
5487         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5488         VPX_ASM_SUFFIX="$ASM_SUFFIX"
5489         VPX_ARM_ASM=1
5490       fi
5491     ;;
5492     *:x86)
5493       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5494         VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5495         VPX_X86_ASM=1
5496       fi
5497     ;;
5498     *:x86_64)
5499       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5500         VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5501         VPX_X86_ASM=1
5502       fi
5503     ;;
5504     esac
5506     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5507       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.])
5508     fi
5510     if test -n "$MOZ_VP8_ENCODER" -a \
5511             -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5512       dnl We prefer to get asm offsets using inline assembler, which the above
5513       dnl compilers can do. When we're not using one of those, we have to fall
5514       dnl back to obj_int_extract, which reads them from a compiled object
5515       dnl file. Unfortunately, that only works if we're compiling on a system
5516       dnl with the header files for the appropriate object file format.
5517       VPX_NEED_OBJ_INT_EXTRACT=1
5518     fi
5520     if test -n "$VPX_X86_ASM"; then
5521       AC_DEFINE(VPX_X86_ASM)
5522     elif test -n "$VPX_ARM_ASM"; then
5523       AC_DEFINE(VPX_ARM_ASM)
5524     else
5525       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5526     fi
5529 dnl ========================================================
5530 dnl = Disable Wave decoder support
5531 dnl ========================================================
5532 MOZ_ARG_DISABLE_BOOL(wave,
5533 [  --disable-wave          Disable Wave decoder support],
5534     MOZ_WAVE=,
5535     MOZ_WAVE=1)
5537 if test -n "$MOZ_WAVE"; then
5538     AC_DEFINE(MOZ_WAVE)
5539     MOZ_SYDNEYAUDIO=1
5540     MOZ_CUBEB=1
5541     MOZ_MEDIA=1
5544 dnl ========================================================
5545 dnl = Handle dependent SYDNEYAUDIO, CUBEB, and MEDIA defines
5546 dnl ========================================================
5548 if test -n "$MOZ_SYDNEYAUDIO"; then
5549     AC_DEFINE(MOZ_SYDNEYAUDIO)
5552 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5553     AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5556 if test -n "$MOZ_SOUNDTOUCH"; then
5557     AC_DEFINE(MOZ_SOUNDTOUCH)
5560 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
5561    SOUNDTOUCH_LIBS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)soundtouch.$(LIB_SUFFIX)'
5562 else
5563     SOUNDTOUCH_LIBS='-lsoundtouch'
5565 AC_SUBST(SOUNDTOUCH_CFLAGS)
5566 AC_SUBST(SOUNDTOUCH_LIBS)
5567 AC_SUBST(SOUNDTOUCH_CONFIG)
5569 if test -n "$MOZ_CUBEB"; then
5570     case "$target" in
5571     *-android*|*-linuxandroid*)
5572         if test -n "$gonkdir"; then
5573             AC_DEFINE(MOZ_CUBEB)
5574         fi
5575         dnl No Android implementation of libcubeb yet.
5576         ;;
5577     *-linux*)
5578         AC_DEFINE(MOZ_CUBEB)
5579         ;;
5580     *-mingw*)
5581         AC_DEFINE(MOZ_CUBEB)
5582         ;;
5583     *-darwin*)
5584         AC_DEFINE(MOZ_CUBEB)
5585         ;;
5586     *-openbsd*)
5587         AC_DEFINE(MOZ_CUBEB)
5588         ;;
5589     *)
5590         dnl Other targets will be enabled soon.
5591         ;;
5592     esac
5595 if test -n "$MOZ_MEDIA"; then
5596     AC_DEFINE(MOZ_MEDIA)
5599 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5600     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/])
5603 if test -n "$MOZ_VORBIS"; then
5604     AC_DEFINE(MOZ_VORBIS)
5607 if test -n "$MOZ_TREMOR"; then
5608     AC_DEFINE(MOZ_TREMOR)
5611 if test -n "$MOZ_OPUS"; then
5612     AC_DEFINE(MOZ_OPUS)
5615 dnl ========================================================
5616 dnl = Check alsa availability on Linux if using sydneyaudio
5617 dnl ========================================================
5619 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5620 if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
5621     PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5622          [echo "$MOZ_ALSA_PKG_ERRORS"
5623           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.)])])
5626 dnl ========================================================
5627 dnl = Enable PulseAudio
5628 dnl ========================================================
5630 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5631 [  --enable-pulseaudio          Enable PulseAudio support (experimental)],
5632 MOZ_PULSEAUDIO=1,
5633 MOZ_PULSEAUDIO=)
5635 if test -n "$MOZ_PULSEAUDIO"; then
5636     AC_DEFINE(MOZ_CUBEB)
5637     PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5638          [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5639           AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
5642 AC_SUBST(MOZ_PULSEAUDIO)
5643 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5644 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5646 dnl ========================================================
5647 dnl = Enable GStreamer
5648 dnl ========================================================
5649 MOZ_ARG_ENABLE_BOOL(gstreamer,
5650 [  --enable-gstreamer           Enable GStreamer support],
5651 MOZ_GSTREAMER=1,
5652 MOZ_GSTREAMER=)
5654 if test "$MOZ_GSTREAMER"; then
5655     # API version, eg 0.10, 1.0 etc
5656     GST_API_VERSION=0.10
5657     # core/base release number
5658     # depend on >= 0.10.33 as that's when the playbin2 source-setup signal was
5659     # introduced
5660     GST_VERSION=0.10.33
5661     PKG_CHECK_MODULES(GSTREAMER,
5662                       gstreamer-$GST_API_VERSION >= $GST_VERSION
5663                       gstreamer-app-$GST_API_VERSION
5664                       gstreamer-plugins-base-$GST_API_VERSION)
5665     if test -n "$GSTREAMER_LIBS"; then
5666        _SAVE_LDFLAGS=$LDFLAGS
5667        LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5668        AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5669        if test -n "$_HAVE_LIBGSTVIDEO" ; then
5670           GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5671        else
5672           AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
5673        fi
5674        LDFLAGS=$_SAVE_LDFLAGS
5675     else
5676        AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
5677     fi
5679 AC_SUBST(GSTREAMER_CFLAGS)
5680 AC_SUBST(GSTREAMER_LIBS)
5681 AC_SUBST(MOZ_GSTREAMER)
5683 if test -n "$MOZ_GSTREAMER"; then
5684    AC_DEFINE(MOZ_GSTREAMER)
5685    MOZ_MEDIA=1
5689 dnl ========================================================
5690 dnl Permissions System
5691 dnl ========================================================
5692 MOZ_ARG_DISABLE_BOOL(permissions,
5693 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5694     MOZ_PERMISSIONS=,
5695     MOZ_PERMISSIONS=1
5698 dnl ========================================================
5699 dnl NegotiateAuth
5700 dnl ========================================================
5701 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5702 [  --disable-negotiateauth Disable GSS-API negotiation ],
5703     MOZ_AUTH_EXTENSION=,
5704     MOZ_AUTH_EXTENSION=1 )
5706 dnl ========================================================
5707 dnl Pref extensions (autoconfig)
5708 dnl ========================================================
5709 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5710 [  --disable-pref-extensions
5711                           Disable pref extensions such as autoconfig],
5712   MOZ_PREF_EXTENSIONS=,
5713   MOZ_PREF_EXTENSIONS=1 )
5715 dnl ========================================================
5716 dnl Searching of system directories for extensions.
5717 dnl Note: this switch is meant to be used for test builds
5718 dnl whose behavior should not depend on what happens to be
5719 dnl installed on the local machine.
5720 dnl ========================================================
5721 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5722 [  --disable-system-extension-dirs
5723                           Disable searching system- and account-global
5724                           directories for extensions of any kind; use
5725                           only profile-specific extension directories],
5726   ENABLE_SYSTEM_EXTENSION_DIRS=,
5727   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5728 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5729   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5732 dnl ========================================================
5733 dnl = Universalchardet
5734 dnl ========================================================
5735 MOZ_ARG_DISABLE_BOOL(universalchardet,
5736 [  --disable-universalchardet
5737                           Disable universal encoding detection],
5738   MOZ_UNIVERSALCHARDET=,
5739   MOZ_UNIVERSALCHARDET=1 )
5741 if test -n "${JAVA_BIN_PATH}"; then
5742   dnl Look for javac and jar in the specified path.
5743   JAVA_PATH="$JAVA_BIN_PATH"
5744 else
5745   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5746   JAVA_PATH="$JAVA_HOME/bin:$PATH"
5749 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5750 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5751 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5753 if test -n "${JAVA_BIN_PATH}" -o \
5754   \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5755   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5756     AC_MSG_ERROR([The programs java, javac and jar were not found.  Set \$JAVA_HOME to your java sdk directory or use --with-java-bin-path={java-bin-dir}])
5757   fi
5760 dnl ========================================================
5761 dnl = ANGLE OpenGL->D3D translator for WebGL
5762 dnl = * only applies to win32
5763 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5764 dnl ========================================================
5765 MOZ_ANGLE_RENDERER=
5766 MOZ_DIRECTX_SDK_PATH=
5767 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5768 MOZ_D3DX9_VERSION=
5769 MOZ_D3DX9_CAB=
5770 MOZ_D3DCOMPILER_CAB=
5771 MOZ_D3DX9_DLL=
5772 MOZ_D3DCOMPILER_DLL=
5773 case "$target_os" in
5774 *mingw*)
5775     MOZ_ANGLE_RENDERER=1
5776     ;;
5777 esac
5779 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5780 case "${target_cpu}" in
5781 i*86)
5782   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5783   ;;
5784 x86_64)
5785   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5786   ;;
5787 esac
5789 MOZ_ARG_DISABLE_BOOL(webgl,
5790 [  --disable-webgl     Disable building of the WebGL implementation],
5791     MOZ_WEBGL_DISABLED=1,
5792     MOZ_WEBGL_DISABLED=)
5794 if test -n "$MOZ_WEBGL_DISABLED"; then
5795   MOZ_WEBGL=
5796   MOZ_ANGLE_RENDERER=
5799 if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
5800   # Get the SDK path from the registry.
5801   # First try to get the June 2010 SDK
5802   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5803   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5804     # Otherwise just take whatever comes first
5805     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5806   fi
5808   if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5809     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.])
5810   else
5811     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'`
5812   fi
5814   if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5815      test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5816          test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5817     AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5818   else
5819     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.])
5820   fi
5822   # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5823   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'`
5825   if test -z "$MOZ_D3DX9_VERSION" ; then
5826         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.])
5827   fi
5829   MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5830   MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5832   if test -z "$MOZ_D3DX9_CAB" -o -z "$MOZ_D3DCOMPILER_CAB"; then
5833     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.])
5834   fi
5836   MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
5837   MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5840 dnl ========================================================
5841 dnl = Breakpad crash reporting (on by default on supported platforms)
5842 dnl ========================================================
5844 case $target in
5845 i?86-*-mingw*|x86_64-*-mingw*)
5846   MOZ_CRASHREPORTER=1
5847   ;;
5848 i?86-apple-darwin*|x86_64-apple-darwin*)
5849   MOZ_CRASHREPORTER=1
5850   ;;
5851 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5852   if test "$MOZ_ENABLE_GTK2"; then
5853     MOZ_CRASHREPORTER=1
5854   fi
5855   ;;
5856 *-android*|*-linuxandroid*)
5857   MOZ_CRASHREPORTER=1
5858   ;;
5859 *solaris*)
5860   MOZ_CRASHREPORTER=1
5861   ;;
5862 esac
5864 MOZ_ARG_DISABLE_BOOL(crashreporter,
5865 [  --disable-crashreporter Disable breakpad crash reporting],
5866     MOZ_CRASHREPORTER=,
5867     MOZ_CRASHREPORTER=1)
5869 if test -n "$MOZ_CRASHREPORTER"; then
5870    AC_DEFINE(MOZ_CRASHREPORTER)
5872   if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5873     test -z "$SKIP_LIBRARY_CHECKS"; then
5874     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5875     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5876     AC_SUBST(MOZ_GTHREAD_LIBS)
5878     MOZ_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter.  Use --disable-crashreporter to disable the crash reporter.])])
5879   fi
5881   if test "$OS_ARCH" != "$HOST_OS_ARCH"; then
5882     AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.  Use --disable-crashreporter.])
5883   fi
5885   if test "$OS_ARCH" = "WINNT" -a -z "$HAVE_64BIT_OS"; then
5886     MOZ_CRASHREPORTER_INJECTOR=1
5887     AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5888   fi
5891 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5892 [  --with-crashreporter-enable-percent=NN
5893                           Enable sending crash reports by default on NN% of users. (default=100)],
5894 [ val=`echo $withval | sed 's/[^0-9]//g'`
5895     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5897 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5898    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5900 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5902 dnl ========================================================
5903 dnl = libjpeg-turbo configuration
5904 dnl ========================================================
5905 MOZ_LIBJPEG_TURBO=
5906 if test -z "$MOZ_NATIVE_JPEG"; then
5907     MOZ_LIBJPEG_TURBO=1
5910 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5911 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
5912     MOZ_LIBJPEG_TURBO=,
5913     MOZ_LIBJPEG_TURBO=1)
5915 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
5916     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
5919 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
5920 dnl files.
5922 if test -n "$MOZ_LIBJPEG_TURBO"; then
5924   dnl Do we support libjpeg-turbo on this platform?
5925   case "$OS_ARCH:$OS_TEST" in
5926   Darwin:i?86)
5927     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
5928     LIBJPEG_TURBO_X86_ASM=1
5929   ;;
5930   Darwin:x86_64)
5931     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
5932     LIBJPEG_TURBO_X64_ASM=1
5933   ;;
5934   WINNT:x86|WINNT:i?86)
5935     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
5936     LIBJPEG_TURBO_X86_ASM=1
5937   ;;
5938   WINNT:x86_64)
5939     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
5940     LIBJPEG_TURBO_X64_ASM=1
5941   ;;
5942   *:arm*)
5943     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
5944     LIBJPEG_TURBO_ARM_ASM=1
5945   ;;
5946   *:x86|*:i?86)
5947     if $CC -E -dM -</dev/null | grep -q __ELF__; then
5948       LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
5949       LIBJPEG_TURBO_X86_ASM=1
5950     fi
5951   ;;
5952   *:x86_64)
5953     if $CC -E -dM -</dev/null | grep -q __ELF__; then
5954       LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
5955       LIBJPEG_TURBO_X64_ASM=1
5956     fi
5957   ;;
5958   esac
5962 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
5963 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
5964 dnl it doesn't exist or we have too old of a version.
5965 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
5966     AC_MSG_CHECKING([for Yasm assembler])
5967     AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
5969     if test -z "$LIBJPEG_TURBO_AS" ; then
5970         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.])
5971     fi
5973     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
5974     dnl on Linux and 1.1 or newer everywhere else.
5975     if test "$OS_ARCH" = "Linux" ; then
5976         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
5977             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.])
5978         fi
5979     else
5980         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5981             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.])
5982         fi
5983     fi
5986 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
5987 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
5988 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
5989     echo "Using $AS as the assembler for ARM code."
5990     LIBJPEG_TURBO_AS=$AS
5993 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
5994     AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
5995 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
5996     AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
5997 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
5998     AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
5999 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6000     dnl Warn if we're not building the optimized routines, even though the user
6001     dnl didn't specify --disable-libjpeg-turbo.
6002     AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
6005 dnl ========================================================
6006 dnl = Enable compilation of specific extension modules
6007 dnl ========================================================
6009 MOZ_ARG_ENABLE_STRING(extensions,
6010 [  --enable-extensions     Enable extensions],
6011 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6012     if test "$option" = "yes" -o "$option" = "all"; then
6013         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6014     elif test "$option" = "no" -o "$option" = "none"; then
6015         MOZ_EXTENSIONS=""
6016     elif test "$option" = "default"; then
6017         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6018     elif test `echo "$option" | grep -c \^-` != 0; then
6019         option=`echo $option | sed 's/^-//'`
6020         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6021     else
6022         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6023     fi
6024 done],
6025     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6027 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6028     # Suppress warning on non-X11 platforms
6029     if test -n "$MOZ_X11"; then
6030         AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6031     fi
6032     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6035 dnl Do not build gnomevfs with libxul based apps
6036 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6037     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6040 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6041     # Suppress warning on non-X11 platforms
6042     if test -n "$MOZ_X11"; then
6043         AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6044     fi
6045     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6048 dnl Do not build gio with libxul based apps
6049 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6050     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6053 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6054     MOZ_GIO_COMPONENT=1
6055     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6057 AC_SUBST(MOZ_GIO_COMPONENT)
6059 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6060     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6061     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6064 dnl Remove dupes
6065 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6067 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6068 dnl when trying to build a nonexistent extension.
6069 for extension in $MOZ_EXTENSIONS; do
6070     if test ! -d "${srcdir}/extensions/${extension}"; then
6071         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6072     fi
6073 done
6075 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6076   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6079 dnl ========================================================
6080 dnl CSS3 Flexbox Support
6081 dnl ========================================================
6082 if test -n "$MOZ_FLEXBOX"; then
6083   AC_DEFINE(MOZ_FLEXBOX)
6086 dnl ========================================================
6087 dnl Build Freetype in the tree
6088 dnl ========================================================
6089 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6090 [  --enable-tree-freetype  Enable Tree FreeType],
6091     MOZ_TREE_FREETYPE=1,
6092     MOZ_TREE_FREETYPE= )
6093 if test -n "$MOZ_TREE_FREETYPE"; then
6094    if test -n "$_WIN32_MSVC"; then
6095       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6096    fi
6097    AC_DEFINE(MOZ_TREE_FREETYPE)
6098    AC_SUBST(MOZ_TREE_FREETYPE)
6099    MOZ_ENABLE_CAIRO_FT=1
6100    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6101    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6102    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6103    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6104    CAIRO_FT_OSLIBS=''
6105    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6106    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6107    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6108    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6109    AC_SUBST(CAIRO_FT_CFLAGS)
6112 dnl ========================================================
6113 dnl Installer
6114 dnl ========================================================
6115 dnl Abort Windows build if the required major version and
6116 dnl minimum minor version of Unicode NSIS isn't in the path
6117 dnl (unless in case of cross compiling, for which Unicode
6118 dnl is not yet sufficient).
6119 if test "$OS_ARCH" = "WINNT"; then
6120     REQ_NSIS_MAJOR_VER=2
6121     MIN_NSIS_MINOR_VER=33
6122     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6123     if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6124       AC_MSG_RESULT([yes])
6125       changequote(,)
6126       MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6127       changequote([,])
6128       if test ! "$MAKENSISU_VER" = ""; then
6129           MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6130           MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6131       fi
6132       AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6133       if test "$MAKENSISU_VER" = "" || \
6134          test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6135               ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6136           AC_MSG_RESULT([no])
6137           if test -z "$CROSS_COMPILE"; then
6138             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.])
6139           else
6140             MAKENSISU=
6141           fi
6142       fi
6143     elif test -z "$CROSS_COMPILE"; then
6144       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.])
6145     else
6146       MAKENSISU=
6147     fi
6150 dnl ========================================================
6151 dnl Web App Runtime
6152 dnl ========================================================
6153 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6154 [  --disable-webapp-runtime  Disable Web App Runtime],
6155     MOZ_WEBAPP_RUNTIME=,
6156     MOZ_WEBAPP_RUNTIME=1)
6157 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6158     MOZ_WEBAPP_RUNTIME=
6160 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6161     MOZ_WEBAPP_RUNTIME=
6163 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6164 if test "$MOZ_WEBAPP_RUNTIME"; then
6165     AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6168 AC_MSG_CHECKING([for tar archiver])
6169 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6170 if test -z "$TAR"; then
6171     AC_MSG_ERROR([no tar archiver found in \$PATH])
6173 AC_MSG_RESULT([$TAR])
6174 AC_SUBST(TAR)
6176 AC_MSG_CHECKING([for wget])
6177 AC_CHECK_PROGS(WGET, wget, "")
6178 AC_MSG_RESULT([$WGET])
6179 AC_SUBST(WGET)
6181 dnl ========================================================
6182 dnl Signing
6183 dnl ========================================================
6185 if test -n "$MOZ_SIGN_CMD"; then
6186     AC_DEFINE(MOZ_SIGNING)
6189 dnl ========================================================
6190 dnl Maintenance Service
6191 dnl ========================================================
6193 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6194 [  --enable-maintenance-service       Enable building of maintenanceservice],
6195     MOZ_MAINTENANCE_SERVICE=1,
6196     MOZ_MAINTENANCE_SERVICE= )
6198 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6199   if test "$OS_ARCH" = "WINNT"; then
6200     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6201   else
6202     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6203   fi
6206 dnl ========================================================
6207 dnl Verify MAR signatures
6208 dnl ========================================================
6210 MOZ_ARG_ENABLE_BOOL(verify-mar,
6211 [  --enable-verify-mar     Enable verifying MAR signatures],
6212     MOZ_VERIFY_MAR_SIGNATURE=1,
6213     MOZ_VERIFY_MAR_SIGNATURE= )
6215 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6216   if test "$OS_ARCH" = "WINNT"; then
6217     AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6218   else
6219     AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6220   fi
6223 dnl ========================================================
6224 dnl Enable building the signmar program.
6225 dnl This option is much different than the --enable-verify-mar option.
6226 dnl --enable-verify-mar is for enabling the verification check on MAR
6227 dnl files in the updater.  The --enable-signmar option is for building
6228 dnl the signmar program.
6229 dnl ========================================================
6231 MOZ_ARG_ENABLE_BOOL(signmar,
6232 [  --enable-signmar     Enable building the signmar program],
6233     MOZ_ENABLE_SIGNMAR=1,
6234     MOZ_ENABLE_SIGNMAR= )
6236 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6237   AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6240 dnl ========================================================
6241 dnl Updater
6242 dnl ========================================================
6244 MOZ_ARG_DISABLE_BOOL(updater,
6245 [  --disable-updater       Disable building of updater],
6246     MOZ_UPDATER=,
6247     MOZ_UPDATER=1 )
6249 if test -n "$MOZ_UPDATER"; then
6250     AC_DEFINE(MOZ_UPDATER)
6253 # app update channel is 'default' when not supplied.
6254 MOZ_ARG_ENABLE_STRING([update-channel],
6255 [  --enable-update-channel=CHANNEL
6256                           Select application update channel (default=default)],
6257     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6259 if test -z "$MOZ_UPDATE_CHANNEL"; then
6260     MOZ_UPDATE_CHANNEL=default
6262 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6263 AC_SUBST(MOZ_UPDATE_CHANNEL)
6265 # tools/update-packaging is not checked out by default.
6266 MOZ_ARG_ENABLE_BOOL(update-packaging,
6267 [  --enable-update-packaging
6268                           Enable tools/update-packaging],
6269     MOZ_UPDATE_PACKAGING=1,
6270     MOZ_UPDATE_PACKAGING= )
6271 AC_SUBST(MOZ_UPDATE_PACKAGING)
6273 dnl ========================================================
6274 dnl build the tests by default
6275 dnl ========================================================
6276 MOZ_ARG_DISABLE_BOOL(tests,
6277 [  --disable-tests         Do not build test libraries & programs],
6278     ENABLE_TESTS=,
6279     ENABLE_TESTS=1 )
6281 dnl ========================================================
6282 dnl parental controls (for Windows Vista)
6283 dnl ========================================================
6284 MOZ_ARG_DISABLE_BOOL(parental-controls,
6285 [  --disable-parental-controls
6286                           Do not build parental controls],
6287    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6288    MOZ_DISABLE_PARENTAL_CONTROLS=)
6289 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6290     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6293 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6295 dnl ========================================================
6296 dnl = Disable DOMCrypto
6297 dnl ========================================================
6298 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6299     AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6302 dnl ========================================================
6303 dnl =
6304 dnl = Module specific options
6305 dnl =
6306 dnl ========================================================
6307 MOZ_ARG_HEADER(Individual module options)
6309 dnl ========================================================
6310 dnl = Disable feed handling components
6311 dnl ========================================================
6312 MOZ_ARG_DISABLE_BOOL(feeds,
6313 [  --disable-feeds         Disable feed handling and processing components],
6314     MOZ_FEEDS=,
6315     MOZ_FEEDS=1 )
6316 if test -n "$MOZ_FEEDS"; then
6317     AC_DEFINE(MOZ_FEEDS)
6318 else
6319     if test "$MOZ_BUILD_APP" = "browser"; then
6320         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6321     fi
6324 dnl ========================================================
6325 dnl Check for sqlite
6326 dnl ========================================================
6328 MOZ_NATIVE_SQLITE=
6329 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6330 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6331 MOZ_NATIVE_SQLITE=1,
6332 MOZ_NATIVE_SQLITE= )
6334 if test -z "$MOZ_NATIVE_SQLITE"
6335 then
6336     SQLITE_CFLAGS=
6337     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6338 else
6339     dnl ============================
6340     dnl === SQLite Version check ===
6341     dnl ============================
6342     dnl Check to see if the system SQLite package is new enough.
6343     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6345     dnl ==================================
6346     dnl === SQLITE_SECURE_DELETE check ===
6347     dnl ==================================
6348     dnl Check to see if the system SQLite package is compiled with
6349     dnl SQLITE_SECURE_DELETE enabled.
6350     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6351     _SAVE_CFLAGS="$CFLAGS"
6352     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6353     _SAVE_LIBS="$LIBS"
6354     LIBS="$LIBS $SQLITE_LIBS"
6355     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6356         AC_TRY_RUN([
6357             #include "sqlite3.h"
6359             int main(int argc, char **argv){
6360               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6361             }],
6362             ac_cv_sqlite_secure_delete=yes,
6363             ac_cv_sqlite_secure_delete=no,
6364             ac_cv_sqlite_secure_delete=no
6365         )
6366     ])
6367     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6368     CFLAGS="$_SAVE_CFLAGS"
6369     LIBS="$_SAVE_LIBS"
6370     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6371         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6372     fi
6374     dnl ===============================
6375     dnl === SQLITE_THREADSAFE check ===
6376     dnl ===============================
6377     dnl Check to see if the system SQLite package is compiled with
6378     dnl SQLITE_THREADSAFE enabled.
6379     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6380     _SAVE_CFLAGS="$CFLAGS"
6381     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6382     _SAVE_LIBS="$LIBS"
6383     LIBS="$LIBS $SQLITE_LIBS"
6384     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6385         AC_TRY_RUN([
6386             #include "sqlite3.h"
6388             int main(int argc, char **argv){
6389               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6390             }],
6391             ac_cv_sqlite_threadsafe=yes,
6392             ac_cv_sqlite_threadsafe=no,
6393             ac_cv_sqlite_threadsafe=no
6394         )
6395     ])
6396     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6397     CFLAGS="$_SAVE_CFLAGS"
6398     LIBS="$_SAVE_LIBS"
6399     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6400         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6401     fi
6403     dnl ================================
6404     dnl === SQLITE_ENABLE_FTS3 check ===
6405     dnl ================================
6406     dnl check to see if the system SQLite package is compiled with
6407     dnl SQLITE_ENABLE_FTS3 enabled.
6408     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6409     _SAVE_CFLAGS="$CFLAGS"
6410     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6411     _SAVE_LIBS="$LIBS"
6412     LIBS="$LIBS $SQLITE_LIBS"
6413     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6414         AC_TRY_RUN([
6415             #include "sqlite3.h"
6417             int main(int argc, char **argv){
6418               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6419             }],
6420             ac_cv_sqlite_enable_fts3=yes,
6421             ac_cv_sqlite_enable_fts3=no,
6422             ac_cv_sqlite_enable_fts3=no
6423         )
6424     ])
6425     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6426     CFLAGS="$_SAVE_CFLAGS"
6427     LIBS="$_SAVE_LIBS"
6428     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6429         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6430     fi
6432     dnl =========================================
6433     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6434     dnl =========================================
6435     dnl check to see if the system SQLite package is compiled with
6436     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6437     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6438     _SAVE_CFLAGS="$CFLAGS"
6439     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6440     _SAVE_LIBS="$LIBS"
6441     LIBS="$LIBS $SQLITE_LIBS"
6442     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6443         AC_TRY_RUN([
6444             #include "sqlite3.h"
6446             int main(int argc, char **argv){
6447               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6448             }],
6449             ac_cv_sqlite_enable_unlock_notify=yes,
6450             ac_cv_sqlite_enable_unlock_notify=no,
6451             ac_cv_sqlite_enable_unlock_notify=no
6452         )
6453     ])
6454     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6455     CFLAGS="$_SAVE_CFLAGS"
6456     LIBS="$_SAVE_LIBS"
6457     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6458         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6459     fi
6462 if test -n "$MOZ_NATIVE_SQLITE"; then
6463     AC_DEFINE(MOZ_NATIVE_SQLITE)
6465 AC_SUBST(MOZ_NATIVE_SQLITE)
6467 dnl ========================================================
6468 dnl = Enable help viewer (off by default)
6469 dnl ========================================================
6470 if test -n "$MOZ_HELP_VIEWER"; then
6471      dnl Do this if defined in confvars.sh
6472      AC_DEFINE(MOZ_HELP_VIEWER)
6475 dnl ========================================================
6476 dnl = Enable safe browsing (anti-phishing)
6477 dnl ========================================================
6478 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6479 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6480     MOZ_SAFE_BROWSING=1,
6481     MOZ_SAFE_BROWSING= )
6482 if test -n "$MOZ_SAFE_BROWSING"; then
6483     AC_DEFINE(MOZ_SAFE_BROWSING)
6485 AC_SUBST(MOZ_SAFE_BROWSING)
6487 dnl ========================================================
6488 dnl = Enable url-classifier
6489 dnl ========================================================
6490 dnl Implicitly enabled by default if building with safe-browsing
6491 if test -n "$MOZ_SAFE_BROWSING"; then
6492     MOZ_URL_CLASSIFIER=1
6494 MOZ_ARG_ENABLE_BOOL(url-classifier,
6495 [  --enable-url-classifier Enable url classifier module],
6496     MOZ_URL_CLASSIFIER=1,
6497     MOZ_URL_CLASSIFIER= )
6498 if test -n "$MOZ_URL_CLASSIFIER"; then
6499     AC_DEFINE(MOZ_URL_CLASSIFIER)
6501 AC_SUBST(MOZ_URL_CLASSIFIER)
6503 dnl ========================================================
6504 dnl = Disable zipwriter
6505 dnl ========================================================
6506 MOZ_ARG_DISABLE_BOOL(zipwriter,
6507 [  --disable-zipwriter     Disable zipwriter component],
6508     MOZ_ZIPWRITER=,
6509     MOZ_ZIPWRITER=1 )
6510 AC_SUBST(MOZ_ZIPWRITER)
6512 dnl ========================================================
6513 dnl = libconic
6514 dnl ========================================================
6515 dnl superseded by QtNetwork starting from 4.7
6516 MOZ_ENABLE_LIBCONIC=1
6518 if test -n "$MOZ_ENABLE_QT"; then
6519   if test "$MOZ_ENABLE_QTNETWORK"; then
6520     MOZ_ENABLE_LIBCONIC=
6521   fi
6524 MOZ_ARG_DISABLE_BOOL(libconic,
6525 [  --disable-libconic      Disable libconic],
6526     MOZ_ENABLE_LIBCONIC=,
6527     MOZ_ENABLE_LIBCONIC=1 )
6529 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6530     PKG_CHECK_MODULES(LIBCONIC, conic,
6531                       MOZ_ENABLE_LIBCONIC=1,
6532                       MOZ_ENABLE_LIBCONIC=)
6534 if test "$MOZ_ENABLE_LIBCONIC"; then
6535     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6538 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6539 AC_SUBST(LIBCONIC_CFLAGS)
6540 AC_SUBST(LIBCONIC_LIBS)
6542 dnl ========================================================
6543 dnl = Maemo checks
6544 dnl ========================================================
6546 MAEMO_SDK_TARGET_VER=-1
6548 MOZ_ARG_WITH_STRING(maemo-version,
6549 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6550                           Maemo SDK Version],
6551   MAEMO_SDK_TARGET_VER=$withval)
6553 case "$MAEMO_SDK_TARGET_VER" in
6555     MOZ_PLATFORM_MAEMO=5
6556     ;;
6559     MOZ_PLATFORM_MAEMO=6
6560     ;;
6563     dnl We aren't compiling for Maemo, move on.
6564     ;;
6566     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6567     ;;
6568 esac
6570 if test $MOZ_PLATFORM_MAEMO; then
6571    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6573    if test -z "$MOZ_ENABLE_DBUS"; then
6574        AC_MSG_ERROR([DBus is required when building for Maemo])
6575    fi
6577    MOZ_GFX_OPTIMIZE_MOBILE=1
6578    MOZ_GL_DEFAULT_PROVIDER=EGL
6579    MOZ_MAEMO_LIBLOCATION=
6581    if test $MOZ_PLATFORM_MAEMO = 5; then
6582       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6583       MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6584           [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6585       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6586                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6588       AC_SUBST(XCOMPOSITE_LIBS)
6590       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6591       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6592       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6593       if test -z "$_LIB_FOUND"; then
6594          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6595       fi
6598       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6599       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6600       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6601       if test -z "$_LIB_FOUND"; then
6602          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6603       fi
6605       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6606       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6607       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6608       if test -z "$_LIB_FOUND"; then
6609          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6610       fi
6612    fi
6613    if test $MOZ_PLATFORM_MAEMO = 6; then
6615       PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6616                         _LIB_FOUND=1,
6617                         _LIB_FOUND=)
6618       if test "$_LIB_FOUND"; then
6619          MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6620          MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6621          MOZ_ENABLE_CONTENTMANAGER=1
6622          AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6623       else
6624          AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6625       fi
6626       AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6628       dnl ========================================================
6629       dnl = Enable meego libcontentaction
6630       dnl ========================================================
6631       MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6632       [  --enable-meegocontentaction           Enable meegocontentaction support],
6633          MOZ_MEEGOCONTENTACTION=1,
6634          MOZ_MEEGOCONTENTACTION=)
6636       if test -n "$MOZ_MEEGOCONTENTACTION"; then
6638          PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6639          if test "$_LIB_FOUND"; then
6640             MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6641             MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6642             MOZ_ENABLE_CONTENTACTION=1
6643             AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6644             AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6645          fi
6646       fi
6648       MOZ_ARG_ENABLE_BOOL(meegotouch,
6649       [  --enable-meegotouch  Enable meegotouch support],
6650          MOZ_MEEGOTOUCHENABLED=1,
6651          MOZ_MEEGOTOUCHENABLED=)
6653       if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6654           PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6655           if test "$_LIB_FOUND"; then
6656               MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6657               MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6658               AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6659           else
6660               AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6661           fi
6662       fi
6663    fi
6665    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6666    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6667    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6668    if test "$_LIB_FOUND"; then
6669       MOZ_MAEMO_LIBLOCATION=1
6670       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6671    else
6672       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6673    fi
6674    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6676    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6677    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6678    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6679    if test "$_LIB_FOUND"; then
6680       MOZ_ENABLE_MEEGOTOUCHSHARE=1
6681       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6682    else
6683       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6684    fi
6685    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6687    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6688    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6691 dnl ========================================================
6692 dnl GL provider
6693 dnl ========================================================
6694 MOZ_GL_PROVIDER=
6695 MOZ_ARG_WITH_STRING(gl-provider,
6696 [  --with-gl-provider=ID
6697                           Set GL provider backend type],
6698 [ val=`echo $withval`
6699     MOZ_GL_PROVIDER="$val"])
6701 if test -n "$MOZ_GL_PROVIDER"; then
6702 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6703 AC_SUBST(MOZ_GL_PROVIDER)
6704 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6706 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6707 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6709 dnl ========================================================
6710 dnl = faststripe theme
6711 dnl ========================================================
6712 MOZ_ARG_ENABLE_BOOL(faststripe,
6713 [  --enable-faststripe     Use faststripe theme],
6714     MOZ_THEME_FASTSTRIPE=1,
6715     MOZ_THEME_FASTSTRIPE= )
6716 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6718 dnl ========================================================
6719 dnl =
6720 dnl = Feature options that require extra sources to be pulled
6721 dnl =
6722 dnl ========================================================
6723 dnl MOZ_ARG_HEADER(Features that require extra sources)
6725 dnl ========================================================
6726 dnl =
6727 dnl = Debugging Options
6728 dnl =
6729 dnl ========================================================
6730 MOZ_ARG_HEADER(Debugging and Optimizations)
6732 dnl ========================================================
6733 dnl = Disable building with debug info.
6734 dnl = Debugging is OFF by default
6735 dnl ========================================================
6736 if test -z "$MOZ_DEBUG_FLAGS"; then
6737   MOZ_DEBUG_FLAGS="-g"
6740 MOZ_ARG_ENABLE_STRING(debug,
6741 [  --enable-debug[=DBG]    Enable building with developer debug info
6742                            (using compiler flags DBG)],
6743 [ if test "$enableval" != "no"; then
6744     MOZ_DEBUG=1
6745     if test -n "$enableval" -a "$enableval" != "yes"; then
6746         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6747         _MOZ_DEBUG_FLAGS_SET=1
6748     fi
6749   else
6750     MOZ_DEBUG=
6751   fi ],
6752   MOZ_DEBUG=)
6754 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6755 MOZ_ARG_WITH_STRING(debug-label,
6756 [  --with-debug-label=LABELS
6757                           Define DEBUG_<value> for each comma-separated
6758                           value given.],
6759 [ for option in `echo $withval | sed 's/,/ /g'`; do
6760     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6761 done])
6763 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6765 if test -n "$MOZ_DEBUG"; then
6766     AC_MSG_CHECKING([for valid debug flags])
6767     _SAVE_CFLAGS=$CFLAGS
6768     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6769     AC_TRY_COMPILE([#include <stdio.h>],
6770         [printf("Hello World\n");],
6771         _results=yes,
6772         _results=no)
6773     AC_MSG_RESULT([$_results])
6774     if test "$_results" = "no"; then
6775         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6776     fi
6777     CFLAGS=$_SAVE_CFLAGS
6780 dnl ========================================================
6781 dnl enable mobile optimizations
6782 dnl ========================================================
6783 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6784 [  --enable-mobile-optimize
6785                           Enable mobile optimizations],
6786     MOZ_GFX_OPTIMIZE_MOBILE=1)
6788 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6790 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6791     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6794 dnl ========================================================
6795 dnl = Enable code optimization. ON by default.
6796 dnl ========================================================
6797 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6798         MOZ_OPTIMIZE_FLAGS="-O"
6801 MOZ_ARG_ENABLE_STRING(optimize,
6802 [  --disable-optimize      Disable compiler optimization
6803   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6804 [ if test "$enableval" != "no"; then
6805     MOZ_OPTIMIZE=1
6806     if test -n "$enableval" -a "$enableval" != "yes"; then
6807         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6808         MOZ_OPTIMIZE=2
6809     fi
6810 else
6811     MOZ_OPTIMIZE=
6812 fi ], MOZ_OPTIMIZE=1)
6814 MOZ_SET_FRAMEPTR_FLAGS
6816 if test "$COMPILE_ENVIRONMENT"; then
6817 if test -n "$MOZ_OPTIMIZE"; then
6818     AC_MSG_CHECKING([for valid optimization flags])
6819     _SAVE_CFLAGS=$CFLAGS
6820     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6821     AC_TRY_COMPILE([#include <stdio.h>],
6822         [printf("Hello World\n");],
6823         _results=yes,
6824         _results=no)
6825     AC_MSG_RESULT([$_results])
6826     if test "$_results" = "no"; then
6827         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6828     fi
6829     CFLAGS=$_SAVE_CFLAGS
6831 fi # COMPILE_ENVIRONMENT
6833 AC_SUBST(MOZ_OPTIMIZE)
6834 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6835 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6836 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6837 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6838 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6839 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6841 dnl ========================================================
6842 dnl = Enable generation of debug symbols
6843 dnl ========================================================
6844 MOZ_ARG_ENABLE_STRING(debug-symbols,
6845 [  --enable-debug-symbols[=DBG]
6846                           Enable debugging symbols (using compiler flags DBG)],
6847 [ if test "$enableval" != "no"; then
6848       MOZ_DEBUG_SYMBOLS=1
6849       if test -n "$enableval" -a "$enableval" != "yes"; then
6850           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6851               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6852           else
6853               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6854           fi
6855       fi
6856   else
6857       MOZ_DEBUG_SYMBOLS=
6858   fi ],
6859   MOZ_DEBUG_SYMBOLS=1)
6861 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6862     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6863     export MOZ_DEBUG_SYMBOLS
6866 dnl ========================================================
6867 dnl = Enable any treating of compile warnings as errors
6868 dnl ========================================================
6869 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6870 [  --enable-warnings-as-errors
6871                           Enable treating of warnings as errors],
6872     MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6873     MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6874 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6875    WARNINGS_AS_ERRORS=''
6878 dnl ========================================================
6879 dnl = Disable runtime logging checks
6880 dnl ========================================================
6881 MOZ_ARG_DISABLE_BOOL(logging,
6882 [  --disable-logging       Disable logging facilities],
6883     NS_DISABLE_LOGGING=1,
6884     NS_DISABLE_LOGGING= )
6885 if test "$NS_DISABLE_LOGGING"; then
6886     AC_DEFINE(NS_DISABLE_LOGGING)
6887 else
6888     AC_DEFINE(MOZ_LOGGING)
6891 dnl ========================================================
6892 dnl = This will enable logging of addref, release, ctor, dtor.
6893 dnl ========================================================
6894 _ENABLE_LOGREFCNT=42
6895 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6896 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6897     _ENABLE_LOGREFCNT=1,
6898     _ENABLE_LOGREFCNT= )
6899 if test "$_ENABLE_LOGREFCNT" = "1"; then
6900     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6901 elif test -z "$_ENABLE_LOGREFCNT"; then
6902     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6905 dnl ========================================================
6906 dnl moz_dump_painting
6907 dnl ========================================================
6908 MOZ_ARG_ENABLE_BOOL(dump-painting,
6909 [  --enable-dump-painting          Enable paint debugging.],
6910     MOZ_DUMP_PAINTING=1,
6911     MOZ_DUMP_PAINTING= )
6912 if test -n "$MOZ_DUMP_PAINTING"; then
6913     AC_DEFINE(MOZ_DUMP_PAINTING)
6914     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6916 if test -n "$MOZ_DEBUG"; then
6917     AC_DEFINE(MOZ_DUMP_PAINTING)
6920 dnl ========================================================
6921 dnl = Enable trace malloc
6922 dnl ========================================================
6923 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6924 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6925 [  --enable-trace-malloc   Enable malloc tracing; also disables jemalloc],
6926     NS_TRACE_MALLOC=1,
6927     NS_TRACE_MALLOC= )
6928 if test "$NS_TRACE_MALLOC"; then
6929   # Please, Mr. Linker Man, don't take away our symbol names
6930   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6931   USE_ELF_DYNSTR_GC=
6932   AC_DEFINE(NS_TRACE_MALLOC)
6934 AC_SUBST(NS_TRACE_MALLOC)
6936 dnl ========================================================
6937 dnl = Enable jemalloc
6938 dnl ========================================================
6939 MOZ_ARG_ENABLE_BOOL(jemalloc,
6940 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6941     MOZ_MEMORY=1,
6942     MOZ_MEMORY=)
6944 if test "$NS_TRACE_MALLOC"; then
6945     MOZ_MEMORY=
6947 if test "$MOZ_DMDV"; then
6948     MOZ_MEMORY=
6951 if test "${OS_TARGET}" = "Android"; then
6952   dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6953   :
6954 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
6955   dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
6956   if test -z "$GNU_CC"; then
6957     MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6958   else
6959     MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6960   fi
6961 else
6962   dnl On other Unix systems, we only want to link executables against mozglue
6963   MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6964   dnl On other Unix systems, where mozglue is a static library, jemalloc is
6965   dnl separated for the SDK, so we need to add it here.
6966   if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6967     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6968   fi
6969   MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6970   if test -n "$GNU_CC"; then
6971     dnl And we need mozglue symbols to be exported.
6972     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6973   fi
6974   if test "$MOZ_LINKER" = 1; then
6975     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $ZLIB_LIBS"
6976   fi
6979 if test -z "$MOZ_MEMORY"; then
6980   if test -n "$MOZ_JEMALLOC"; then
6981     MOZ_NATIVE_JEMALLOC=1
6982     AC_CHECK_FUNCS(mallctl nallocm,,
6983       [MOZ_NATIVE_JEMALLOC=
6984        break])
6985     if test -n "$MOZ_NATIVE_JEMALLOC"; then
6986       MOZ_MEMORY=1
6987       AC_DEFINE(MOZ_MEMORY)
6988       AC_DEFINE(MOZ_JEMALLOC)
6989       AC_DEFINE(MOZ_NATIVE_JEMALLOC)
6990     fi
6991   fi
6992   case "${target}" in
6993     *-mingw*)
6994       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
6995         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.])
6996       fi
6997       ;;
6998   esac
6999 else
7000   dnl Don't try to run compiler tests on Windows
7001   if test "$OS_ARCH" = "WINNT"; then
7002     if test -z "$HAVE_64BIT_OS"; then
7003       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7004     else
7005       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7006     fi
7007   else
7008     AC_CHECK_SIZEOF([int *], [4])
7009     case "${ac_cv_sizeof_int_p}" in
7010     4)
7011       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7012       ;;
7013     8)
7014       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7015       ;;
7016     *)
7017       AC_MSG_ERROR([Unexpected pointer size])
7018       ;;
7019     esac
7020   fi
7022   AC_DEFINE(MOZ_MEMORY)
7023   if test -n "$MOZ_JEMALLOC"; then
7024     AC_DEFINE(MOZ_JEMALLOC)
7025   fi
7026   if test "x$MOZ_DEBUG" = "x1"; then
7027     AC_DEFINE(MOZ_MEMORY_DEBUG)
7028   fi
7029   dnl The generic feature tests that determine how to compute ncpus are long and
7030   dnl complicated.  Therefore, simply define special cpp variables for the
7031   dnl platforms we have special knowledge of.
7032   case "${target}" in
7033   *-darwin*)
7034     AC_DEFINE(MOZ_MEMORY_DARWIN)
7035     ;;
7036   *-*freebsd*)
7037     AC_DEFINE(MOZ_MEMORY_BSD)
7038     ;;
7039   *-android*|*-linuxandroid*)
7040     AC_DEFINE(MOZ_MEMORY_LINUX)
7041     AC_DEFINE(MOZ_MEMORY_ANDROID)
7042     if test -z "$gonkdir"; then
7043       _WRAP_MALLOC=1
7044     else
7045       AC_DEFINE(MOZ_MEMORY_GONK)
7046     fi
7047     MOZ_GLUE_LDFLAGS=
7048     ;;
7049   *-*linux*)
7050     AC_DEFINE(MOZ_MEMORY_LINUX)
7051     ;;
7052   *-netbsd*)
7053     AC_DEFINE(MOZ_MEMORY_BSD)
7054     ;;
7055   *-solaris*)
7056     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7057     ;;
7058   *-mingw*)
7059     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7060     if test -z "$MOZ_DEBUG"; then
7061       WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7062     else
7063       WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7064     fi
7065     dnl Look for a broken crtdll.obj
7066     WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7067     lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7068     if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7069       MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7070       dnl Also pass this to NSPR/NSS
7071       DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7072     else
7073       DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7074     fi
7075     rm crtdll.obj
7077     export DLLFLAGS
7078     ;;
7079   *)
7080     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7081     ;;
7082   esac
7083 fi # MOZ_MEMORY
7084 AC_SUBST(MOZ_MEMORY)
7085 AC_SUBST(MOZ_JEMALLOC)
7086 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7087 AC_SUBST(MOZ_GLUE_LDFLAGS)
7088 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7089 AC_SUBST(WIN32_CRT_LIBS)
7090 dnl Need to set this for make because NSS doesn't have configure
7091 AC_SUBST(DLLFLAGS)
7093 dnl We need to wrap dlopen and related functions on Android because we use
7094 dnl our own linker.
7095 if test "$OS_TARGET" = Android; then
7096     WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7097     if test -n "$MOZ_OLD_LINKER"; then
7098         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
7099     fi
7100     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7101     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7102     if test -z "$gonkdir"; then
7103         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7104     fi
7107 dnl ========================================================
7108 dnl = Use malloc wrapper lib
7109 dnl ========================================================
7110 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7111 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7112     _WRAP_MALLOC=1,
7113     _WRAP_MALLOC= )
7115 if test -n "$_WRAP_MALLOC"; then
7116     if test -n "$GNU_CC"; then
7117         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7118         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7119         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7120         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7121         dnl Wrap operator new and operator delete on Android.
7122         if test "$OS_TARGET" = "Android"; then
7123             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7124             dnl Wrap the nothrow variants too.
7125             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7126         fi
7127     else
7128         AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7129     fi
7132 dnl ========================================================
7133 dnl = Location of malloc wrapper lib
7134 dnl ========================================================
7135 MOZ_ARG_WITH_STRING(wrap-malloc,
7136 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7137     WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7139 dnl ========================================================
7140 dnl = Use JS Call tracing
7141 dnl ========================================================
7142 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7143 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7144     MOZ_TRACE_JSCALLS=1,
7145     MOZ_TRACE_JSCALLS= )
7146 if test -n "$MOZ_TRACE_JSCALLS"; then
7147     AC_DEFINE(MOZ_TRACE_JSCALLS)
7150 dnl ========================================================
7151 dnl = Use incremental GC
7152 dnl ========================================================
7153 JSGC_INCREMENTAL=1
7154 MOZ_ARG_DISABLE_BOOL(gcincremental,
7155 [  --disable-gcincremental Disable incremental GC],
7156     JSGC_INCREMENTAL= )
7157 if test -n "$JSGC_INCREMENTAL"; then
7158     AC_DEFINE(JSGC_INCREMENTAL)
7161 dnl ========================================================
7162 dnl ETW - Event Tracing for Windows
7163 dnl ========================================================
7164 MOZ_ARG_ENABLE_BOOL(ETW,
7165 [  --enable-ETW            Enable ETW (Event Tracing for Windows) event reporting],
7166     MOZ_ETW=1,
7167     MOZ_ETW= )
7168 if test -n "$MOZ_ETW"; then
7169     AC_DEFINE(MOZ_ETW)
7172 if test -n "$MOZ_ETW"; then
7173     if test -z "$MOZ_WINSDK_TARGETVER"; then
7174         AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7175     fi
7178 dnl ========================================================
7179 dnl Zealous JavaScript GC
7180 dnl ========================================================
7181 MOZ_ARG_ENABLE_BOOL(gczeal,
7182 [  --enable-gczeal         Enable zealous JavaScript GCing],
7183     JS_GC_ZEAL=1,
7184     JS_GC_ZEAL= )
7185 if test -n "$JS_GC_ZEAL"; then
7186     AC_DEFINE(JS_GC_ZEAL)
7189 dnl ========================================================
7190 dnl JS opt-mode assertions and minidump instrumentation
7191 dnl ========================================================
7192 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7193 [  --enable-js-diagnostics
7194                           Enable JS diagnostic assertions and breakpad data],
7195     JS_CRASH_DIAGNOSTICS=1,
7196     JS_CRASH_DIAGNOSTICS= )
7197 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7198     AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7201 MOZ_CHECK_CCACHE
7203 dnl ========================================================
7204 dnl = Enable static checking using gcc-dehydra
7205 dnl ========================================================
7207 MOZ_ARG_WITH_STRING(static-checking,
7208 [  --with-static-checking=path/to/gcc_dehydra.so
7209                           Enable static checking of code using GCC-dehydra],
7210     DEHYDRA_PATH=$withval,
7211     DEHYDRA_PATH= )
7213 if test -n "$DEHYDRA_PATH"; then
7214     if test ! -f "$DEHYDRA_PATH"; then
7215         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7216     fi
7217     AC_DEFINE(NS_STATIC_CHECKING)
7219 AC_SUBST(DEHYDRA_PATH)
7221 dnl ========================================================
7222 dnl = Enable stripping of libs & executables
7223 dnl ========================================================
7224 MOZ_ARG_ENABLE_BOOL(strip,
7225 [  --enable-strip          Enable stripping of libs & executables ],
7226     ENABLE_STRIP=1,
7227     ENABLE_STRIP= )
7229 dnl ========================================================
7230 dnl = Enable stripping of libs & executables when packaging
7231 dnl ========================================================
7232 MOZ_ARG_ENABLE_BOOL(install-strip,
7233 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7234     PKG_SKIP_STRIP= ,
7235     PKG_SKIP_STRIP=1)
7237 dnl ========================================================
7238 dnl = --enable-elf-dynstr-gc
7239 dnl ========================================================
7240 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7241 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7242     USE_ELF_DYNSTR_GC=1,
7243     USE_ELF_DYNSTR_GC= )
7245 dnl ========================================================
7246 dnl = --disable-elf-hack
7247 dnl ========================================================
7249 USE_ELF_HACK=1
7250 MOZ_ARG_DISABLE_BOOL(elf-hack,
7251 [  --disable-elf-hack      Disable elf hacks],
7252     USE_ELF_HACK=,
7253     USE_ELF_HACK=1)
7255 # Disable elf hack for profiling because the built in profiler
7256 # doesn't read the segments properly with elf hack. This is
7257 # temporary and should be fixed soon in the profiler.
7258 if test "$MOZ_PROFILING" = 1; then
7259   USE_ELF_HACK=
7262 # Only enable elfhack where supported
7263 if test "$USE_ELF_HACK" = 1; then
7264     case "${HOST_OS_ARCH},${OS_ARCH}" in
7265     Linux,Linux)
7266         case "${CPU_ARCH}" in
7267         arm | x86 | x86_64)
7268             USE_ELF_HACK=1
7269             ;;
7270         *)
7271             USE_ELF_HACK=
7272             ;;
7273         esac
7274         ;;
7275     *)
7276         USE_ELF_HACK=
7277         ;;
7278     esac
7281 if test "$USE_ELF_HACK" = 1; then
7282     dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7283     dnl memory addresses it maps to. The result is that by the time elfhack
7284     dnl kicks in, it is not possible to apply relocations because of that,
7285     dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7286     dnl segment. It makes elfhack mostly useless, so considering the problems
7287     dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7288     dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7289     dnl the linker creates PT_GNU_RELRO segments.
7290     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7291         LINK_WITH_PT_GNU_RELRO,
7292         [echo "int main() {return 0;}" > conftest.${ac_ext}
7293          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7294             test -s conftest${ac_exeext}; then
7295             if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7296                 LINK_WITH_PT_GNU_RELRO=yes
7297             else
7298                 LINK_WITH_PT_GNU_RELRO=no
7299             fi
7300          else
7301              dnl We really don't expect to get here, but just in case
7302              AC_ERROR([couldn't compile a simple C file])
7303          fi
7304          rm -rf conftest*])
7305     if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7306         AC_MSG_WARN([Disabling elfhack])
7307         USE_ELF_HACK=
7308     fi
7311 dnl ========================================================
7312 dnl = libstdc++ compatibility hacks
7313 dnl ========================================================
7315 STDCXX_COMPAT=
7316 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7317 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
7318     STDCXX_COMPAT=1)
7320 AC_SUBST(STDCXX_COMPAT)
7322 if test -n "$STDCXX_COMPAT"; then
7323    eval $(CXX="$CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7324    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7325    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7328 dnl ========================================================
7329 dnl =
7330 dnl = Profiling and Instrumenting
7331 dnl =
7332 dnl ========================================================
7333 MOZ_ARG_HEADER(Profiling and Instrumenting)
7335 dnl ========================================================
7336 dnl = Enable runtime visual profiling logger
7337 dnl ========================================================
7338 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7339 [  --enable-visual-event-tracer   Enable visual event tracer instrumentation],
7340     MOZ_VISUAL_EVENT_TRACER=1,
7341     MOZ_VISUAL_EVENT_TRACER=)
7342 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7343     AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7346 dnl ========================================================
7347 dnl Turn on reflow counting
7348 dnl ========================================================
7349 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7350 [  --enable-reflow-perf    Enable reflow performance tracing],
7351     MOZ_REFLOW_PERF=1,
7352     MOZ_REFLOW_PERF= )
7353 if test -n "$MOZ_REFLOW_PERF"; then
7354     AC_DEFINE(MOZ_REFLOW_PERF)
7357 dnl ========================================================
7358 dnl Enable code size metrics.
7359 dnl ========================================================
7360 MOZ_ARG_ENABLE_BOOL(codesighs,
7361 [  --enable-codesighs      Enable code size analysis tools],
7362     _ENABLE_CODESIGHS=1,
7363     _ENABLE_CODESIGHS= )
7364 if test -n "$_ENABLE_CODESIGHS"; then
7365     if test -d $srcdir/tools/codesighs; then
7366         MOZ_MAPINFO=1
7367     else
7368         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7369     fi
7372 dnl ========================================================
7373 dnl = Enable Radio Interface for B2G (Gonk usually)
7374 dnl ========================================================
7375 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7376 [  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7377     MOZ_B2G_RIL=1,
7378     MOZ_B2G_RIL= )
7379 if test -n "$MOZ_B2G_RIL"; then
7380     AC_DEFINE(MOZ_B2G_RIL)
7382 AC_SUBST(MOZ_B2G_RIL)
7384 dnl ========================================================
7385 dnl = Enable Radio FM for B2G (Gonk usually)
7386 dnl ========================================================
7387 if test -n "$MOZ_B2G_FM"; then
7388     AC_DEFINE(MOZ_B2G_FM)
7390 AC_SUBST(MOZ_B2G_FM)
7392 dnl ========================================================
7393 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7394 dnl ========================================================
7395 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7396 [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
7397     MOZ_B2G_BT=1,
7398     MOZ_B2G_BT= )
7399 if test -n "$MOZ_B2G_BT"; then
7400     AC_DEFINE(MOZ_B2G_BT)
7402 AC_SUBST(MOZ_B2G_BT)
7404 dnl ========================================================
7405 dnl = Enable Support for System Messages API
7406 dnl ========================================================
7407 if test -n "$MOZ_SYS_MSG"; then
7408     AC_DEFINE(MOZ_SYS_MSG)
7410 AC_SUBST(MOZ_SYS_MSG)
7412 dnl ========================================================
7413 dnl = Enable Support for Time Manager API
7414 dnl ========================================================
7415 if test -n "$MOZ_TIME_MANAGER"; then
7416     AC_DEFINE(MOZ_TIME_MANAGER)
7418 AC_SUBST(MOZ_TIME_MANAGER)
7420 dnl ========================================================
7421 dnl = Enable Camera Interface for B2G (Gonk usually)
7422 dnl ========================================================
7423 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7424 [  --enable-b2g-camera      Set compile flags necessary for compiling camera API for B2G ],
7425     MOZ_B2G_CAMERA=1,
7426     MOZ_B2G_CAMERA= )
7427 if test -n "$MOZ_B2G_CAMERA"; then
7428    AC_DEFINE(MOZ_B2G_CAMERA)
7430 AC_SUBST(MOZ_B2G_CAMERA)
7432 dnl ========================================================
7433 dnl = Enable Support for Payment API
7434 dnl ========================================================
7435 if test -n "$MOZ_PAY"; then
7436     AC_DEFINE(MOZ_PAY)
7438 AC_SUBST(MOZ_PAY)
7440 dnl ========================================================
7441 dnl = Support for demangling undefined symbols
7442 dnl ========================================================
7443 if test -z "$SKIP_LIBRARY_CHECKS"; then
7444     AC_LANG_SAVE
7445     AC_LANG_CPLUSPLUS
7446     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7447     AC_LANG_RESTORE
7450 # Demangle only for debug or trace-malloc builds
7451 MOZ_DEMANGLE_SYMBOLS=
7452 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7453     MOZ_DEMANGLE_SYMBOLS=1
7454     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7456 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7458 dnl ========================================================
7459 dnl = Support for gcc stack unwinding (from gcc 3.3)
7460 dnl ========================================================
7461 if test -z "$SKIP_LIBRARY_CHECKS"; then
7462     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7465 dnl ========================================================
7466 dnl JIT observers
7467 dnl ========================================================
7469 MOZ_ARG_WITH_STRING(jitreport-granularity,
7470 [  --jitreport-granularity=N
7471                            Default granularity at which to report JIT code
7472                            to external tools
7473                              0 - no info
7474                              1 - code ranges for whole functions only
7475                              2 - per-line information
7476                              3 - per-op information],
7477   JITREPORT_GRANULARITY=$withval,
7478   JITREPORT_GRANULARITY=3)
7480 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7482 dnl ========================================================
7483 dnl =
7484 dnl = Misc. Options
7485 dnl =
7486 dnl ========================================================
7487 MOZ_ARG_HEADER(Misc. Options)
7489 dnl ========================================================
7490 dnl update xterm title
7491 dnl ========================================================
7492 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7493 [  --enable-xterm-updates  Update XTERM titles with current command.],
7494     MOZ_UPDATE_XTERM=1,
7495     MOZ_UPDATE_XTERM= )
7497 dnl =========================================================
7498 dnl = Chrome format
7499 dnl =========================================================
7500 MOZ_ARG_ENABLE_STRING([chrome-format],
7501 [  --enable-chrome-format=jar|flat|both|symlink|omni
7502                           Select FORMAT of chrome files (default=jar)],
7503     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7505 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7506     MOZ_CHROME_FILE_FORMAT=jar
7509 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7510     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7511     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7512     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7513     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7514     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7517 dnl =========================================================
7518 dnl Omnijar packaging (bug 552121)
7519 dnl =========================================================
7520 dnl Omnijar packaging is compatible with flat packaging.
7521 dnl In unpackaged builds, omnijar looks for files as if
7522 dnl things were flat packaged. After packaging, all files
7523 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7524 dnl is set to flat since putting files into jars is only
7525 dnl done during packaging with omnijar.
7526 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7527     MOZ_OMNIJAR=1
7528     AC_DEFINE(MOZ_OMNIJAR)
7529     if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7530         MOZ_CHROME_FILE_FORMAT=flat
7531     else
7532         MOZ_CHROME_FILE_FORMAT=symlink
7533     fi
7534 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7535     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7538 OMNIJAR_NAME=omni.ja
7539 AC_SUBST(OMNIJAR_NAME)
7540 AC_SUBST(MOZ_OMNIJAR)
7542 dnl ========================================================
7543 dnl = Define default location for MOZILLA_FIVE_HOME
7544 dnl ========================================================
7545 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7546 [  --with-default-mozilla-five-home
7547                           Set the default value for MOZILLA_FIVE_HOME],
7548 [ val=`echo $withval`
7549   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7551 dnl ========================================================
7552 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7553 dnl ========================================================
7554 MOZ_ARG_WITH_STRING(user-appdir,
7555 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7556 [ val=`echo $withval`
7557 if echo "$val" | grep "\/" >/dev/null; then
7558     AC_MSG_ERROR("Homedir must be single relative path.")
7559 else
7560     MOZ_USER_DIR="$val"
7561 fi])
7563 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7565 dnl ========================================================
7566 dnl = Doxygen configuration
7567 dnl ========================================================
7568 dnl Use commas to specify multiple dirs to this arg
7569 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7570 MOZ_ARG_WITH_STRING(doc-input-dirs,
7571 [  --with-doc-input-dirs=DIRS
7572                           Header/idl dirs to create docs from],
7573 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7574 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7576 dnl Use commas to specify multiple dirs to this arg
7577 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7578 MOZ_ARG_WITH_STRING(doc-include-dirs,
7579 [  --with-doc-include-dirs=DIRS
7580                           Include dirs to preprocess doc headers],
7581 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7582 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7584 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7585 MOZ_ARG_WITH_STRING(doc-output-dir,
7586 [  --with-doc-output-dir=DIR
7587                           Dir to generate docs into],
7588 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7589 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7591 if test -z "$SKIP_COMPILER_CHECKS"; then
7592 dnl ========================================================
7593 dnl =
7594 dnl = Compiler Options
7595 dnl =
7596 dnl ========================================================
7597 MOZ_ARG_HEADER(Compiler Options)
7599 dnl ========================================================
7600 dnl Check for gcc -pipe support
7601 dnl ========================================================
7602 AC_MSG_CHECKING([for -pipe support])
7603 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7604     dnl Any gcc that supports firefox supports -pipe.
7605     CFLAGS="$CFLAGS -pipe"
7606     CXXFLAGS="$CXXFLAGS -pipe"
7607     AC_MSG_RESULT([yes])
7608 else
7609     AC_MSG_RESULT([no])
7612 dnl ========================================================
7613 dnl Profile guided optimization (gcc checks)
7614 dnl ========================================================
7615 dnl Test for profiling options
7616 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7618 _SAVE_CFLAGS="$CFLAGS"
7619 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7621 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7622 AC_TRY_COMPILE([], [return 0;],
7623                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7624                  result="yes" ], result="no")
7625 AC_MSG_RESULT([$result])
7627 if test $result = "yes"; then
7628   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7629   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7630   PROFILE_USE_LDFLAGS="-fprofile-use"
7633 CFLAGS="$_SAVE_CFLAGS"
7635 if test -n "$INTEL_CC"; then
7636   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7637   PROFILE_GEN_LDFLAGS=
7638   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7639   PROFILE_USE_LDFLAGS=
7642 dnl Sun Studio on Solaris
7643 if test "$SOLARIS_SUNPRO_CC"; then
7644   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7645   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7646   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7647   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7650 AC_SUBST(PROFILE_GEN_CFLAGS)
7651 AC_SUBST(PROFILE_GEN_LDFLAGS)
7652 AC_SUBST(PROFILE_USE_CFLAGS)
7653 AC_SUBST(PROFILE_USE_LDFLAGS)
7655 AC_LANG_CPLUSPLUS
7657 dnl ========================================================
7658 dnl Test for -pedantic bustage
7659 dnl ========================================================
7660 MOZ_ARG_DISABLE_BOOL(pedantic,
7661 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7662 _PEDANTIC= )
7663 if test "$_PEDANTIC"; then
7664     _SAVE_CXXFLAGS=$CXXFLAGS
7665     CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7666     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7667     AC_TRY_COMPILE([$configure_static_assert_macros],
7668                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7669                    result="no", result="yes" )
7670     AC_MSG_RESULT([$result])
7671     CXXFLAGS="$_SAVE_CXXFLAGS"
7673     case "$result" in
7674     no)
7675         _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
7676         _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7677         ;;
7678     yes)
7679         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7680         ;;
7681     esac
7684 dnl ========================================================
7685 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7686 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7687 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7688 dnl ========================================================
7689 _SAVE_CXXFLAGS=$CXXFLAGS
7690 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7691 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7692     ac_nscap_nonconst_opeq_bug,
7693     [AC_TRY_COMPILE([
7694                       template <class T>
7695                       class Pointer
7696                         {
7697                         public:
7698                           T* myPtr;
7699                         };
7701                       template <class T, class U>
7702                       int operator==(const Pointer<T>& rhs, U* lhs)
7703                         {
7704                           return rhs.myPtr == lhs;
7705                         }
7707                       template <class T, class U>
7708                       int operator==(const Pointer<T>& rhs, const U* lhs)
7709                         {
7710                           return rhs.myPtr == lhs;
7711                         }
7712                     ],
7713                     [
7714                       Pointer<int> foo;
7715                       const int* bar;
7716                       return foo == bar;
7717                     ],
7718                     ac_nscap_nonconst_opeq_bug="no",
7719                     ac_nscap_nonconst_opeq_bug="yes")])
7720 CXXFLAGS="$_SAVE_CXXFLAGS"
7722 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7723     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7725 fi # ! SKIP_COMPILER_CHECKS
7727 AC_DEFINE(CPP_THROW_NEW, [throw()])
7728 AC_LANG_C
7730 if test "$COMPILE_ENVIRONMENT"; then
7731 MOZ_EXPAND_LIBS
7732 fi # COMPILE_ENVIRONMENT
7734 dnl ========================================================
7735 dnl =
7736 dnl = Build depencency options
7737 dnl =
7738 dnl ========================================================
7739 MOZ_ARG_HEADER(Build dependencies)
7741 if test "$GNU_CC" -a "$GNU_CXX"; then
7742   _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
7743 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7744 elif test "$SOLARIS_SUNPRO_CC"; then
7745   _DEPEND_CFLAGS=
7746 else
7747   dnl Don't override this for MSVC
7748   if test -z "$_WIN32_MSVC"; then
7749     _USE_CPP_INCLUDE_FLAG=
7750     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7751     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7752   else
7753     echo '#include <stdio.h>' > dummy-hello.c
7754     changequote(,)
7755     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7756     changequote([,])
7757     if test -z "$CL_INCLUDES_PREFIX"; then
7758         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7759     fi
7760     AC_SUBST(CL_INCLUDES_PREFIX)
7761     rm -f dummy-hello.c
7762   fi
7765 dnl ========================================================
7766 dnl =
7767 dnl = Static Build Options
7768 dnl =
7769 dnl ========================================================
7770 MOZ_ARG_HEADER(Static build options)
7772 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7773 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
7774   ENABLE_SHARED_JS=1
7777 MOZ_ARG_ENABLE_BOOL(shared-js,
7778 [  --enable-shared-js
7779                           Create a shared JavaScript library.],
7780     ENABLE_SHARED_JS=1,
7781     ENABLE_SHARED_JS=)
7783 if test -n "$ENABLE_SHARED_JS"; then
7784   JS_SHARED_LIBRARY=1
7785   MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7786 else
7787   MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7788   AC_DEFINE(MOZ_STATIC_JS)
7790 AC_SUBST(JS_SHARED_LIBRARY)
7792 AC_SUBST(LIBXUL_LIBS)
7793 XPCOM_LIBS="$LIBXUL_LIBS"
7795 dnl ========================================================
7796 dnl =
7797 dnl = Standalone module options
7798 dnl =
7799 dnl ========================================================
7800 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7802 dnl Check for GLib.
7803 dnl ========================================================
7805 if test -z "$SKIP_PATH_CHECKS"; then
7806 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7807     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7808         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7809     fi
7813 if test -z "${GLIB_GMODULE_LIBS}" \
7814    -a -n "${GLIB_CONFIG}"\
7815     -a "${GLIB_CONFIG}" != no\
7816 ; then
7817     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7820 AC_SUBST(GLIB_CFLAGS)
7821 AC_SUBST(GLIB_LIBS)
7822 AC_SUBST(GLIB_GMODULE_LIBS)
7824 dnl ========================================================
7825 dnl Graphics checks.
7826 dnl ========================================================
7828 if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
7829 MOZ_ENABLE_SKIA=1
7830 else
7831 MOZ_ENABLE_SKIA=
7834 MOZ_ARG_ENABLE_BOOL(skia,
7835 [  --enable-skia   Enable use of Skia],
7836 MOZ_ENABLE_SKIA=1,
7837 MOZ_ENABLE_SKIA=)
7839 if test "$USE_FC_FREETYPE"; then
7840     if test "$COMPILE_ENVIRONMENT"; then
7841         dnl ========================================================
7842         dnl = Check for freetype2 and its functionality
7843         dnl ========================================================
7844         PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7846         if test "$_HAVE_FREETYPE2"; then
7847             _SAVE_LIBS="$LIBS"
7848             _SAVE_CFLAGS="$CFLAGS"
7849             LIBS="$LIBS $FT2_LIBS"
7850             CFLAGS="$CFLAGS $FT2_CFLAGS"
7852             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7853                 ac_cv_member_FT_Bitmap_Size_y_ppem,
7854                 [AC_TRY_COMPILE([#include <ft2build.h>
7855                                  #include FT_FREETYPE_H],
7856                                 [FT_Bitmap_Size s;
7857                                  if (sizeof s.y_ppem) return 0;
7858                                  return 1],
7859                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7860                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7861             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7862                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7863             else
7864                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7865             fi
7866             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7867                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7868                                [FT_Bitmap_Size structure includes y_ppem field])
7870             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
7872             LIBS="$_SAVE_LIBS"
7873             CFLAGS="$_SAVE_CFLAGS"
7874         fi
7876         _SAVE_CPPFLAGS="$CPPFLAGS"
7877         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7878         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7879             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7880         CPPFLAGS="$_SAVE_CPPFLAGS"
7881     else
7882         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7883     fi
7885     PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
7886     [
7887         if test "$MOZ_PANGO"; then
7888             MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
7889             MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
7890         else
7891             FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
7892             FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
7893         fi
7894     ])
7897 dnl ========================================================
7898 dnl Check for pixman and cairo
7899 dnl ========================================================
7901 MOZ_TREE_CAIRO=1
7902 MOZ_ARG_ENABLE_BOOL(system-cairo,
7903 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
7904 MOZ_TREE_CAIRO=,
7905 MOZ_TREE_CAIRO=1 )
7907 MOZ_TREE_PIXMAN=1
7908 MOZ_ARG_ENABLE_BOOL(system-pixman,
7909 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7910 MOZ_TREE_PIXMAN=,
7911 MOZ_TREE_PIXMAN=force,
7912 MOZ_TREE_PIXMAN=1 )
7914 # System cairo depends on system pixman
7915 if test "$MOZ_TREE_PIXMAN" = "force"; then
7916     if test -z "$MOZ_TREE_CAIRO"; then
7917         AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7918     else
7919         MOZ_TREE_PIXMAN=1
7920     fi
7921 elif test -z "$MOZ_TREE_CAIRO"; then
7922     MOZ_TREE_PIXMAN=
7925 if test "$MOZ_TREE_PIXMAN"; then
7926     AC_DEFINE(MOZ_TREE_PIXMAN)
7927     MOZ_PIXMAN_CFLAGS=""
7928     MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
7929 else
7930     PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
7931     MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
7932     MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
7934 AC_SUBST(MOZ_PIXMAN_CFLAGS)
7935 AC_SUBST(MOZ_PIXMAN_LIBS)
7937 # Check for headers defining standard int types.
7938 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7940 if test "$MOZ_TREE_CAIRO"; then
7941     MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7942     AC_DEFINE(MOZ_TREE_CAIRO)
7944     # For now we assume that we will have a uint64_t available through
7945     # one of the above headers or mozstdint.h.
7946     AC_DEFINE(HAVE_UINT64_T)
7948     # Define macros for cairo-features.h
7949     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
7950     if test "$MOZ_X11"; then
7951         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7952         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7953         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7954         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7955         MOZ_ENABLE_CAIRO_FT=1
7956         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7957     fi
7958     case "$MOZ_WIDGET_TOOLKIT" in
7959       qt)
7960         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7961         ;;
7962       cocoa | uikit)
7963         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7964         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7965         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7966         ;;
7967       windows)
7968         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7969         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7970         if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7971             WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7972             WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7973             MOZ_ENABLE_D2D_SURFACE=1
7974             MOZ_ENABLE_DWRITE_FONT=1
7975         else
7976             WIN32_DWRITE_FONT_FEATURE=
7977             WIN32_D2D_SURFACE_FEATURE=
7978         fi
7980         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
7982         dnl D3D10 Layers depend on D2D Surfaces.
7983         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
7984           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
7985         fi
7986         ;;
7987       os2)
7988         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7989         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7990         MOZ_ENABLE_CAIRO_FT=1
7991         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7992         CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7993         CAIRO_FT_LIBS=""
7994         ;;
7995     esac
7996     if test "$USE_FC_FREETYPE"; then
7997         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7998     fi
7999     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8000     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8001     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8002     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8003     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8004     AC_SUBST(CAIRO_FT_CFLAGS)
8006     AC_SUBST(PS_SURFACE_FEATURE)
8007     AC_SUBST(PDF_SURFACE_FEATURE)
8008     AC_SUBST(SVG_SURFACE_FEATURE)
8009     AC_SUBST(XLIB_SURFACE_FEATURE)
8010     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8011     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8012     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8013     AC_SUBST(WIN32_SURFACE_FEATURE)
8014     AC_SUBST(OS2_SURFACE_FEATURE)
8015     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8016     AC_SUBST(FT_FONT_FEATURE)
8017     AC_SUBST(FC_FONT_FEATURE)
8018     AC_SUBST(WIN32_FONT_FEATURE)
8019     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8020     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8021     AC_SUBST(QUARTZ_FONT_FEATURE)
8022     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8023     AC_SUBST(QT_SURFACE_FEATURE)
8024     AC_SUBST(TEE_SURFACE_FEATURE)
8026     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8027     MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8029     if test "$MOZ_X11"; then
8030         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8031     fi
8033     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8034 else
8035     PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8036     MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8037     MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8038     PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8039     if test "$MOZ_X11"; then
8040         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8041         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8042         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8043         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8044     fi
8047 AC_SUBST(MOZ_TREE_CAIRO)
8048 AC_SUBST(MOZ_CAIRO_CFLAGS)
8049 AC_SUBST(MOZ_CAIRO_LIBS)
8050 AC_SUBST(MOZ_CAIRO_OSLIBS)
8051 AC_SUBST(MOZ_TREE_PIXMAN)
8053 dnl ========================================================
8054 dnl qcms
8055 dnl ========================================================
8057 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8058 AC_SUBST(QCMS_LIBS)
8060 dnl ========================================================
8061 dnl HarfBuzz
8062 dnl ========================================================
8063 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8064 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8066 dnl ========================================================
8067 dnl SIL Graphite
8068 dnl ========================================================
8069 if test "$MOZ_GRAPHITE"; then
8070   MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8071   AC_DEFINE(MOZ_GRAPHITE)
8072 else
8073   MOZ_GRAPHITE_LIBS=
8075 AC_SUBST(MOZ_GRAPHITE)
8076 AC_SUBST(MOZ_GRAPHITE_LIBS)
8078 dnl ========================================================
8079 dnl OTS
8080 dnl ========================================================
8081 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8082 AC_SUBST(MOZ_OTS_LIBS)
8084 dnl ========================================================
8085 dnl Skia 
8086 dnl ========================================================
8087 if test "$MOZ_ENABLE_SKIA"; then
8088   MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8089   AC_DEFINE(MOZ_ENABLE_SKIA)
8090 else
8091   MOZ_SKIA_LIBS=
8093 AC_SUBST(MOZ_ENABLE_SKIA)
8094 AC_SUBST(MOZ_SKIA_LIBS)
8096 dnl ========================================================
8097 dnl disable xul
8098 dnl ========================================================
8099 MOZ_ARG_DISABLE_BOOL(xul,
8100 [  --disable-xul           Disable XUL],
8101     MOZ_XUL= )
8102 if test "$MOZ_XUL"; then
8103   AC_DEFINE(MOZ_XUL)
8104 else
8105   dnl remove extensions that require XUL
8106   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8109 AC_SUBST(MOZ_XUL)
8111 dnl ========================================================
8112 dnl disable profile locking
8113 dnl   do no use this in applications that can have more than
8114 dnl   one process accessing the profile directory.
8115 dnl ========================================================
8116 MOZ_ARG_DISABLE_BOOL(profilelocking,
8117 [  --disable-profilelocking
8118                           Disable profile locking],
8119     MOZ_PROFILELOCKING=,
8120     MOZ_PROFILELOCKING=1 )
8121 if test "$MOZ_PROFILELOCKING"; then
8122   AC_DEFINE(MOZ_PROFILELOCKING)
8125 dnl ========================================================
8126 dnl necko configuration options
8127 dnl ========================================================
8130 dnl option to disable various necko protocols
8132 MOZ_ARG_ENABLE_STRING(necko-protocols,
8133 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8134                           Enable/disable specific protocol handlers],
8135 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8136     if test "$option" = "yes" -o "$option" = "all"; then
8137         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8138     elif test "$option" = "no" -o "$option" = "none"; then
8139         NECKO_PROTOCOLS=""
8140     elif test "$option" = "default"; then
8141         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8142     elif test `echo "$option" | grep -c \^-` != 0; then
8143         option=`echo $option | sed 's/^-//'`
8144         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8145     else
8146         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8147     fi
8148 done],
8149     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8150 dnl Remove dupes
8151 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8152 AC_SUBST(NECKO_PROTOCOLS)
8153 for p in $NECKO_PROTOCOLS; do
8154     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8155     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8156 done
8159 dnl option to disable necko's wifi scanner
8161 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8162 [  --disable-necko-wifi    Disable necko wifi scanner],
8163     NECKO_WIFI=,
8164     NECKO_WIFI=1)
8166 if test "$OS_ARCH" = "OS2"; then
8167   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8168   NECKO_WIFI=
8170 if test "$NECKO_WIFI" -a \
8171         "$OS_ARCH" != "Linux" -a \
8172         "$OS_ARCH" != "Darwin" -a \
8173         "$OS_ARCH" != "SunOS" -a \
8174         "$OS_ARCH" != "WINNT"; then
8175   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8178 if test "$NECKO_WIFI"; then
8179   AC_DEFINE(NECKO_WIFI)
8180   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8182 AC_SUBST(NECKO_WIFI)
8185 dnl option to disable cookies
8187 MOZ_ARG_DISABLE_BOOL(cookies,
8188 [  --disable-cookies       Disable cookie support],
8189     NECKO_COOKIES=,
8190     NECKO_COOKIES=1)
8191 AC_SUBST(NECKO_COOKIES)
8192 if test "$NECKO_COOKIES"; then
8193     AC_DEFINE(NECKO_COOKIES)
8194     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8198 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8200 MOZ_ARG_DISABLE_BOOL(ctypes,
8201 [  --disable-ctypes        Disable js-ctypes],
8202     BUILD_CTYPES=,
8203     BUILD_CTYPES=1)
8204 AC_SUBST(BUILD_CTYPES)
8205 if test "$BUILD_CTYPES"; then
8206     AC_DEFINE(BUILD_CTYPES)
8209 dnl Build Places if required
8210 if test "$MOZ_PLACES"; then
8211   AC_DEFINE(MOZ_PLACES)
8214 dnl Build Apps in the Cloud (AITC) if required
8215 AC_SUBST(MOZ_SERVICES_AITC)
8216 if test -n "$MOZ_SERVICES_AITC"; then
8217   AC_DEFINE(MOZ_SERVICES_AITC)
8220 dnl Build Common JS modules provided by services.
8221 AC_SUBST(MOZ_SERVICES_COMMON)
8222 if test -n "$MOZ_SERVICES_COMMON"; then
8223   AC_DEFINE(MOZ_SERVICES_COMMON)
8226 dnl Build Services crypto component (used by Sync)
8227 AC_SUBST(MOZ_SERVICES_CRYPTO)
8228 if test -n "$MOZ_SERVICES_CRYPTO"; then
8229   AC_DEFINE(MOZ_SERVICES_CRYPTO)
8232 dnl Build Firefox Health Reporter Service
8233 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8234 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8235   AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8238 dnl Build Services metrics component
8239 AC_SUBST(MOZ_SERVICES_METRICS)
8240 if test -n "$MOZ_SERVICES_METRICS"; then
8241   AC_DEFINE(MOZ_SERVICES_METRICS)
8244 dnl Build Notifications if required
8245 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8246 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8247   AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8250 dnl Build Sync Services if required
8251 AC_SUBST(MOZ_SERVICES_SYNC)
8252 if test -n "$MOZ_SERVICES_SYNC"; then
8253   AC_DEFINE(MOZ_SERVICES_SYNC)
8256 dnl ========================================================
8257 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8258     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8261 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8262   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8265 if test "$MOZ_APP_COMPONENT_MODULES"; then
8266   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8269 dnl ========================================================
8270 dnl =
8271 dnl = Maintainer debug option (no --enable equivalent)
8272 dnl =
8273 dnl ========================================================
8275 AC_SUBST(AR)
8276 AC_SUBST(AR_FLAGS)
8277 AC_SUBST(AR_LIST)
8278 AC_SUBST(AR_EXTRACT)
8279 AC_SUBST(AR_DELETE)
8280 AC_SUBST(AS)
8281 AC_SUBST(ASFLAGS)
8282 AC_SUBST(AS_DASH_C_FLAG)
8283 AC_SUBST(LD)
8284 AC_SUBST(RC)
8285 AC_SUBST(RCFLAGS)
8286 AC_SUBST(MC)
8287 AC_SUBST(WINDRES)
8288 AC_SUBST(IMPLIB)
8289 AC_SUBST(FILTER)
8290 AC_SUBST(BIN_FLAGS)
8291 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8292 AC_SUBST(MOZ_UPDATE_XTERM)
8293 AC_SUBST(MOZ_PLATFORM_MAEMO)
8294 AC_SUBST(MOZ_AUTH_EXTENSION)
8295 AC_SUBST(MOZ_PERMISSIONS)
8296 AC_SUBST(MOZ_PREF_EXTENSIONS)
8297 AC_SUBST(MOZ_JS_LIBS)
8298 AC_SUBST(MOZ_PSM)
8299 AC_SUBST(MOZ_DEBUG)
8300 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8301 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8302 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8303 AC_SUBST(MOZ_DEBUG_FLAGS)
8304 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8305 AC_SUBST(WARNINGS_AS_ERRORS)
8306 AC_SUBST(MOZ_EXTENSIONS)
8307 AC_SUBST(MOZ_JSDEBUGGER)
8308 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8309 AC_SUBST(MOZ_JPROF)
8310 AC_SUBST(MOZ_SHARK)
8311 AC_SUBST(MOZ_CALLGRIND)
8312 AC_SUBST(MOZ_VTUNE)
8313 AC_SUBST(MOZ_ETW)
8314 AC_SUBST(MOZ_PROFILING)
8315 AC_SUBST(LIBICONV)
8316 AC_SUBST(MOZ_PLACES)
8317 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8318 AC_SUBST(MOZ_FEEDS)
8319 AC_SUBST(NS_PRINTING)
8320 AC_SUBST(MOZ_WEBGL)
8321 AC_SUBST(MOZ_HELP_VIEWER)
8322 AC_SUBST(TOOLCHAIN_PREFIX)
8324 AC_SUBST(JAVA)
8325 AC_SUBST(JAVAC)
8326 AC_SUBST(JAR)
8328 AC_SUBST(MOZ_PROFILELOCKING)
8330 AC_SUBST(ENABLE_TESTS)
8331 AC_SUBST(ENABLE_MARIONETTE)
8332 AC_SUBST(IBMBIDI)
8333 AC_SUBST(MOZ_UNIVERSALCHARDET)
8334 AC_SUBST(ACCESSIBILITY)
8335 AC_SUBST(MOZ_SPELLCHECK)
8336 AC_SUBST(MOZ_ANDROID_OMTC)
8337 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8338 AC_SUBST(MOZ_CRASHREPORTER)
8339 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8340 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8341 AC_SUBST(MOZ_STUB_INSTALLER)
8342 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8343 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8344 AC_SUBST(MOZ_UPDATER)
8345 AC_SUBST(MOZ_ANGLE_RENDERER)
8346 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8347 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8348 AC_SUBST(MOZ_D3DX9_VERSION)
8349 AC_SUBST(MOZ_D3DX9_CAB)
8350 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8351 AC_SUBST(MOZ_D3DX9_DLL)
8352 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8353 AC_SUBST(MOZ_METRO)
8355 AC_SUBST(MOZ_ANDROID_HISTORY)
8356 AC_SUBST(MOZ_WEBSMS_BACKEND)
8357 AC_SUBST(ENABLE_STRIP)
8358 AC_SUBST(PKG_SKIP_STRIP)
8359 AC_SUBST(STRIP_FLAGS)
8360 AC_SUBST(USE_ELF_DYNSTR_GC)
8361 AC_SUBST(USE_ELF_HACK)
8362 AC_SUBST(INCREMENTAL_LINKER)
8363 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8364 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8366 AC_SUBST(MOZ_FIX_LINK_PATHS)
8367 AC_SUBST(XPCOM_LIBS)
8368 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8369 AC_SUBST(XPCOM_GLUE_LDOPTS)
8370 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8371 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8372 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8374 AC_SUBST(USE_DEPENDENT_LIBS)
8376 AC_SUBST(MOZ_BUILD_ROOT)
8377 AC_SUBST(MOZ_OS2_TOOLS)
8379 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8380 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8381 AC_SUBST(MOZ_LINKER_EXTRACT)
8382 AC_SUBST(MOZ_PER_WINDOW_PRIVATE_BROWSING)
8384 if test -n "$MOZ_PER_WINDOW_PRIVATE_BROWSING" ; then
8385     AC_DEFINE(MOZ_PER_WINDOW_PRIVATE_BROWSING)
8388 dnl ========================================================
8389 dnl = Mac bundle name prefix
8390 dnl ========================================================
8391 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8392 [  --with-macbundlename-prefix=prefix
8393                           Prefix for MOZ_MACBUNDLE_NAME],
8394 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8396 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8397 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8398   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8401 if test "$MOZ_DEBUG"; then
8402   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8403 else
8404   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8406 AC_SUBST(MOZ_MACBUNDLE_NAME)
8408 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8409 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8410 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8411 if test "$MOZ_DEBUG"; then
8412   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8415 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8416 AC_SUBST(MOZ_MACBUNDLE_ID)
8418 # The following variables are available to branding and application
8419 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8420 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8421 # impacts profile location and user-visible fields.
8422 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8423 # versions of a given application (e.g. Aurora and Firefox both use
8424 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8425 # for application.ini's "Name" field, which controls profile location in
8426 # the absence of a "Profile" field (see below), and various system
8427 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8428 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8429 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8430 # builds (e.g. Aurora for Firefox).
8431 # - MOZ_APP_VERSION: Defines the application version number.
8432 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8433 # defaults to a lowercase form of MOZ_APP_BASENAME.
8434 # - MOZ_APP_PROFILE: When set, used for application.ini's
8435 # "Profile" field, which controls profile location.
8436 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8437 # crash reporter server url.
8438 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8439 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8441 if test -z "$MOZ_APP_NAME"; then
8442    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8445 # For extensions and langpacks, we require a max version that is compatible
8446 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8447 # 10.0a1 and 10.0a2 aren't affected
8448 # 10.0 becomes 10.0.*
8449 # 10.0.1 becomes 10.0.*
8450 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8451 if test -z "$IS_ALPHA"; then
8452   changequote(,)
8453   MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8454   changequote([,])
8455 else
8456   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8459 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8460 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8462 AC_SUBST(MOZ_APP_NAME)
8463 AC_SUBST(MOZ_APP_DISPLAYNAME)
8464 AC_SUBST(MOZ_APP_BASENAME)
8465 AC_SUBST(MOZ_APP_VENDOR)
8466 AC_SUBST(MOZ_APP_PROFILE)
8467 AC_SUBST(MOZ_APP_ID)
8468 AC_SUBST(MAR_CHANNEL_ID)
8469 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8470 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8471 AC_SUBST(MOZ_EXTENSION_MANAGER)
8472 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8473 AC_SUBST(MOZ_APP_UA_NAME)
8474 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8475 AC_SUBST(MOZ_APP_VERSION)
8476 AC_SUBST(MOZ_APP_MAXVERSION)
8477 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8478 AC_SUBST(FIREFOX_VERSION)
8479 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8480 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8481   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8484 # We can't use the static application.ini data when building against
8485 # a libxul SDK.
8486 if test -n "$LIBXUL_SDK"; then
8487     MOZ_APP_STATIC_INI=
8489 AC_SUBST(MOZ_APP_STATIC_INI)
8491 AC_SUBST(MOZ_PKG_SPECIAL)
8493 AC_SUBST(MOZILLA_OFFICIAL)
8495 if test "$MOZ_TELEMETRY_REPORTING"; then
8496     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8499 dnl win32 options
8500 AC_SUBST(MOZ_MAPINFO)
8501 AC_SUBST(MOZ_BROWSE_INFO)
8502 AC_SUBST(MOZ_TOOLS_DIR)
8503 AC_SUBST(WIN32_REDIST_DIR)
8504 AC_SUBST(MAKENSISU)
8506 dnl Echo the CFLAGS to remove extra whitespace.
8507 CFLAGS=`echo \
8508         $_WARNINGS_CFLAGS \
8509         $CFLAGS`
8511 CXXFLAGS=`echo \
8512         $_WARNINGS_CXXFLAGS \
8513         $CXXFLAGS`
8515 COMPILE_CFLAGS=`echo \
8516     $_DEFINES_CFLAGS \
8517         $_DEPEND_CFLAGS \
8518     $COMPILE_CFLAGS`
8520 COMPILE_CXXFLAGS=`echo \
8521     $_DEFINES_CXXFLAGS \
8522         $_DEPEND_CFLAGS \
8523     $COMPILE_CXXFLAGS`
8525 AC_SUBST(SYSTEM_LIBXUL)
8526 AC_SUBST(MOZ_NATIVE_JPEG)
8527 AC_SUBST(MOZ_NATIVE_PNG)
8528 AC_SUBST(MOZ_NATIVE_BZ2)
8530 AC_SUBST(MOZ_FLEXBOX)
8531 AC_SUBST(MOZ_JPEG_CFLAGS)
8532 AC_SUBST(MOZ_JPEG_LIBS)
8533 AC_SUBST(MOZ_BZ2_CFLAGS)
8534 AC_SUBST(MOZ_BZ2_LIBS)
8535 AC_SUBST(MOZ_PNG_CFLAGS)
8536 AC_SUBST(MOZ_PNG_LIBS)
8538 AC_SUBST(NSPR_CFLAGS)
8539 AC_SUBST(NSPR_LIBS)
8540 AC_SUBST(MOZ_NATIVE_NSPR)
8542 AC_SUBST(NSS_CFLAGS)
8543 AC_SUBST(NSS_LIBS)
8544 AC_SUBST(NSS_DEP_LIBS)
8545 AC_SUBST(MOZ_NATIVE_NSS)
8546 AC_SUBST(NSS_DISABLE_DBM)
8548 OS_CFLAGS="$CFLAGS"
8549 OS_CXXFLAGS="$CXXFLAGS"
8550 OS_CPPFLAGS="$CPPFLAGS"
8551 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8552 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8553 OS_LDFLAGS="$LDFLAGS"
8554 OS_LIBS="$LIBS"
8555 AC_SUBST(OS_CFLAGS)
8556 AC_SUBST(OS_CXXFLAGS)
8557 AC_SUBST(OS_CPPFLAGS)
8558 AC_SUBST(OS_COMPILE_CFLAGS)
8559 AC_SUBST(OS_COMPILE_CXXFLAGS)
8560 AC_SUBST(OS_LDFLAGS)
8561 AC_SUBST(OS_LIBS)
8562 AC_SUBST(CROSS_COMPILE)
8563 AC_SUBST(WCHAR_CFLAGS)
8565 AC_SUBST(HOST_CC)
8566 AC_SUBST(HOST_CXX)
8567 AC_SUBST(HOST_CFLAGS)
8568 AC_SUBST(HOST_CXXFLAGS)
8569 AC_SUBST(HOST_LDFLAGS)
8570 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8571 AC_SUBST(HOST_AR)
8572 AC_SUBST(HOST_AR_FLAGS)
8573 AC_SUBST(HOST_LD)
8574 AC_SUBST(HOST_RANLIB)
8575 AC_SUBST(HOST_NSPR_MDCPUCFG)
8576 AC_SUBST(HOST_BIN_SUFFIX)
8577 AC_SUBST(HOST_OS_ARCH)
8579 AC_SUBST(TARGET_CPU)
8580 AC_SUBST(TARGET_VENDOR)
8581 AC_SUBST(TARGET_OS)
8582 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8583 AC_SUBST(TARGET_MD_ARCH)
8584 AC_SUBST(TARGET_XPCOM_ABI)
8585 AC_SUBST(OS_TARGET)
8586 AC_SUBST(OS_ARCH)
8587 AC_SUBST(OS_RELEASE)
8588 AC_SUBST(OS_TEST)
8589 AC_SUBST(CPU_ARCH)
8590 AC_SUBST(INTEL_ARCHITECTURE)
8592 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8594 AC_SUBST(WRAP_LDFLAGS)
8595 AC_SUBST(MKSHLIB)
8596 AC_SUBST(MKCSHLIB)
8597 AC_SUBST(MKSHLIB_FORCE_ALL)
8598 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8599 AC_SUBST(DSO_CFLAGS)
8600 AC_SUBST(DSO_PIC_CFLAGS)
8601 AC_SUBST(DSO_LDOPTS)
8602 AC_SUBST(LIB_PREFIX)
8603 AC_SUBST(DLL_PREFIX)
8604 AC_SUBST(DLL_SUFFIX)
8605 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8606 AC_SUBST(LIB_SUFFIX)
8607 AC_SUBST(OBJ_SUFFIX)
8608 AC_SUBST(BIN_SUFFIX)
8609 AC_SUBST(ASM_SUFFIX)
8610 AC_SUBST(IMPORT_LIB_SUFFIX)
8611 AC_SUBST(USE_N32)
8612 AC_SUBST(CC_VERSION)
8613 AC_SUBST(CXX_VERSION)
8614 AC_SUBST(MSMANIFEST_TOOL)
8615 AC_SUBST(NS_ENABLE_TSF)
8616 AC_SUBST(MOZ_NSS_PATCH)
8617 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8618 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8620 AC_SUBST(MOZ_MEDIA)
8621 AC_SUBST(MOZ_SYDNEYAUDIO)
8622 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8623 AC_SUBST(MOZ_SOUNDTOUCH)
8624 AC_SUBST(MOZ_CUBEB)
8625 AC_SUBST(MOZ_WAVE)
8626 AC_SUBST(MOZ_VORBIS)
8627 AC_SUBST(MOZ_TREMOR)
8628 AC_SUBST(MOZ_OPUS)
8629 AC_SUBST(MOZ_WEBM)
8630 AC_SUBST(MOZ_DASH)
8631 AC_SUBST(MOZ_MEDIA_PLUGINS)
8632 AC_SUBST(MOZ_OMX_PLUGIN)
8633 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8634 AC_SUBST(MOZ_VP8_ENCODER)
8635 AC_SUBST(MOZ_VP8)
8636 AC_SUBST(MOZ_OGG)
8637 AC_SUBST(MOZ_ALSA_LIBS)
8638 AC_SUBST(MOZ_ALSA_CFLAGS)
8639 AC_SUBST(VPX_AS)
8640 AC_SUBST(VPX_ASFLAGS)
8641 AC_SUBST(VPX_DASH_C_FLAG)
8642 AC_SUBST(VPX_AS_CONVERSION)
8643 AC_SUBST(VPX_ASM_SUFFIX)
8644 AC_SUBST(VPX_X86_ASM)
8645 AC_SUBST(VPX_ARM_ASM)
8646 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8647 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8648 AC_SUBST(LIBJPEG_TURBO_AS)
8649 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8650 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8651 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8652 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8654 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8656 AC_MSG_CHECKING([for posix_fallocate])
8657 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8658   #include <fcntl.h>],
8659                  [posix_fallocate(0, 0, 0);],
8660                  [ac_cv___posix_fallocate=true],
8661                  [ac_cv___posix_fallocate=false])
8663 if test "$ac_cv___posix_fallocate" = true ; then
8664   AC_DEFINE(HAVE_POSIX_FALLOCATE)
8665   AC_MSG_RESULT(yes)
8666 else
8667   AC_MSG_RESULT(no)
8670 dnl Check for missing components
8671 if test "$COMPILE_ENVIRONMENT"; then
8672 if test "$MOZ_X11"; then
8673     if test "$WITHOUT_X11"; then
8674         AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8675     fi
8676     dnl ====================================================
8677     dnl = Check if X headers exist
8678     dnl ====================================================
8679     _SAVE_CFLAGS=$CFLAGS
8680     CFLAGS="$CFLAGS $XCFLAGS"
8681     AC_TRY_COMPILE([
8682         #include <stdio.h>
8683         #include <stdlib.h>
8684         #include <X11/Xlib.h>
8685         #include <X11/Intrinsic.h>
8686         #include <X11/extensions/XShm.h>
8687     ],
8688     [
8689         Display *dpy = 0;
8690         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8691             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8692             exit(1);
8693         }
8694     ], [],
8695     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8696     CFLAGS="$_SAVE_CFLAGS"
8698     if test -n "$MISSING_X"; then
8699         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8700     fi
8702 fi # MOZ_X11
8704 dnl Check for headers, etc. needed by WebGL.
8705 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8706     MOZ_CHECK_HEADER(GL/glx.h)
8707     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8708         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa-devel (openSUSE))])
8709     fi
8710 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8711 fi # COMPILE_ENVIRONMENT
8713 dnl Set various defines and substitutions
8714 dnl ========================================================
8716 if test "$OS_ARCH" = "Darwin"; then
8717   AC_DEFINE(XP_UNIX)
8718 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8719   AC_DEFINE(XP_UNIX)
8722 if test "$MOZ_DEBUG"; then
8723     AC_DEFINE(MOZ_REFLOW_PERF)
8724     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8727 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8728     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8729     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8730     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8731     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8732     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8733     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8734     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8735     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8738 AC_SUBST(MOZILLA_VERSION)
8740 AC_SUBST(ac_configure_args)
8742 dnl Spit out some output
8743 dnl ========================================================
8745 dnl The following defines are used by xpcom
8746 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8747 CPP_THROW_NEW
8748 HAVE_CPP_2BYTE_WCHAR_T
8749 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8750 HAVE_CPP_CHAR16_T
8751 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8752 HAVE_CPP_PARTIAL_SPECIALIZATION
8753 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8754 NEED_CPP_UNUSED_IMPLEMENTATIONS
8755 NEW_H
8756 HAVE_GETPAGESIZE
8757 HAVE_ICONV
8758 HAVE_ICONV_WITH_CONST_INPUT
8759 HAVE_MBRTOWC
8760 HAVE_WCRTOMB
8761 HAVE_STATVFS64
8762 HAVE_STATVFS
8763 HAVE_STATFS64
8764 HAVE_STATFS
8765 HAVE_SYS_STATVFS_H
8766 HAVE_SYS_STATFS_H
8767 HAVE_SYS_VFS_H
8768 HAVE_SYS_MOUNT_H
8771 AC_CONFIG_HEADER(
8772 netwerk/necko-config.h
8773 xpcom/xpcom-config.h
8774 xpcom/xpcom-private.h
8777 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8778 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8779 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8780 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8781 # (apparently) only need this hack when egrep's "pattern" is particularly long
8782 # (as in the following code) and the first egrep on our $PATH is Apple's.  See
8783 # bug 655339.
8784 case "$host" in
8785 *-apple-darwin11*)
8786     FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8787     ;;
8789     FIXED_EGREP="egrep"
8790     ;;
8791 esac
8793 dnl Load the list of Makefiles to generate.
8794 dnl   To add new Makefiles, edit allmakefiles.sh.
8795 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8796 . ${srcdir}/allmakefiles.sh
8798 echo $MAKEFILES > unallmakefiles
8800 AC_OUTPUT($MAKEFILES)
8802 # Generate Makefiles for WebRTC directly from .gyp files
8803 if test "${OS_TARGET}" = "WINNT"; then
8804    if test "$HAVE_64BIT_OS"; then
8805       OS_BITS=64
8806    else
8807       OS_BITS=32
8808    fi
8809    EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
8812 if test -n "$MOZ_WEBRTC"; then
8813    AC_MSG_RESULT("generating WebRTC Makefiles...")
8815 dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
8816 dnl so that regeneration via dependencies works correctly
8817    WEBRTC_CONFIG="-D build_with_mozilla=1 --include ${srcdir}/media/webrtc/webrtc_config.gypi -D FORCED_INCLUDE_FILE=${srcdir}/media/webrtc/webrtc_config.gypi"
8819    GYP_WEBRTC_OPTIONS="--format=mozmake ${WEBRTC_CONFIG} ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
8821    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8822      $GYP_WEBRTC_OPTIONS \
8823      --generator-output=${_objdir}/media/webrtc/trunk \
8824      ${srcdir}/media/webrtc/trunk/peerconnection.gyp
8825    if test "$?" != 0; then
8826       AC_MSG_ERROR([failed to generate WebRTC Makefiles])
8827    fi
8829    # XXX disable until we land the tranche with signaling
8830    if test -n "$MOZ_WEBRTC_SIGNALING"; then
8831      AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
8832      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8833        $GYP_WEBRTC_OPTIONS \
8834        -D build_for_test=0 \
8835        --generator-output=${_objdir}/media/webrtc/signaling \
8836        ${srcdir}/media/webrtc/signaling/signaling.gyp
8837      if test "$?" != 0; then
8838         AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
8839      fi
8841      AC_MSG_RESULT("generating WebRTC/SignalingTest Makefiles...")
8842      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8843        $GYP_WEBRTC_OPTIONS \
8844        -D build_for_test=1 \
8845        --generator-output=${_objdir}/media/webrtc/signalingtest \
8846        ${srcdir}/media/webrtc/signaling/signaling.gyp
8847      if test "$?" != 0; then
8848        AC_MSG_ERROR([failed to generate WebRTC/SignalingTest Makefiles])
8849      fi
8850    fi
8852    AC_MSG_RESULT("generating gtest Makefiles...")
8853    # Ok to pass some extra -D's that are ignored here
8854    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8855      $GYP_WEBRTC_OPTIONS \
8856      --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
8857      ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
8858    if test "$?" != 0; then
8859       AC_MSG_ERROR([failed to generate gtest Makefiles])
8860    fi
8862    AC_MSG_RESULT("generating nrappkit Makefiles...")
8863    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8864      $GYP_WEBRTC_OPTIONS \
8865      --generator-output=${_objdir}/media/mtransport/third_party/nrappkit \
8866      ${srcdir}/media/mtransport/third_party/nrappkit/nrappkit.gyp
8867    if test "$?" != 0; then
8868       AC_MSG_ERROR([failed to generate nrappkit Makefiles])
8869    fi
8871    AC_MSG_RESULT("generating nICEr Makefiles...")
8872    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8873      $GYP_WEBRTC_OPTIONS \
8874      --generator-output=${_objdir}/media/mtransport/third_party/nICEr \
8875      ${srcdir}/media/mtransport/third_party/nICEr/nicer.gyp
8876    if test "$?" != 0; then
8877       AC_MSG_ERROR([failed to generate nICEr Makefiles])
8878    fi
8881 # Generate a JSON config file for unittest harnesses etc to read
8882 # build configuration details from in a standardized way.
8883 OS_TARGET=${OS_TARGET} \
8884 TARGET_CPU=${TARGET_CPU} \
8885 MOZ_DEBUG=${MOZ_DEBUG} \
8886 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} \
8887 UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
8888 MOZ_CRASHREPORTER=${MOZ_CRASHREPORTER} \
8889 MOZ_PER_WINDOW_PRIVATE_BROWSING=${MOZ_PER_WINDOW_PRIVATE_BROWSING} \
8890   $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
8891 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
8892   rm ./mozinfo.json.tmp
8893 else
8894   mv -f ./mozinfo.json.tmp ./mozinfo.json
8897 # Run jemalloc configure script
8899 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_JEMALLOC" -a "$MOZ_MEMORY" ; then
8900   ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
8901   case "$OS_ARCH" in
8902     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
8903       MANGLE="malloc calloc valloc free realloc posix_memalign"
8904       case "$OS_ARCH" in
8905         Linux)
8906           MANGLE="$MANGLE memalign malloc_usable_size"
8907           ;;
8908         FreeBSD)
8909           MANGLE="$MANGLE malloc_usable_size"
8910           ;;
8911       esac
8912       ;;
8913   esac
8914   if test -n "$MANGLE"; then
8915     MANGLED=
8916     JEMALLOC_WRAPPER=
8917     if test -n "$_WRAP_MALLOC"; then
8918       JEMALLOC_WRAPPER=__wrap_
8919     fi
8920     for mangle in ${MANGLE}; do
8921       if test -n "$MANGLED"; then
8922         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
8923       else
8924         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
8925       fi
8926     done
8927     ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
8928   fi
8929   unset CONFIG_FILES
8930   if test -z "$MOZ_TLS"; then
8931     ac_configure_args="$ac_configure_args --disable-tls"
8932   fi
8933   EXTRA_CFLAGS="$CFLAGS"
8934   for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
8935     ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
8936   done
8937   if test "$CROSS_COMPILE"; then
8938     ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
8939   fi
8940   _save_cache_file="$cache_file"
8941   cache_file=$_objdir/memory/jemalloc/src/config.cache
8942   AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
8943   cache_file="$_save_cache_file"
8944   ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8947 dnl Build libunwind for Android profiling builds
8948 if test "$OS_TARGET" = "Android" -a "$MOZ_PROFILING"; then
8949   old_ac_configure_arg="$ac_configure_args"
8950   ac_configure_args="--build=${build} --host=${target_alias} --disable-shared --enable-block-signals=no"
8951   if test "$MOZ_DEBUG"; then
8952     ac_configure_args="$ac_configure_args --enable-debug"
8953   fi
8954   if test "$DSO_PIC_CFLAGS"; then
8955     ac_configure_args="$ac_configure_args --with-pic"
8956   fi
8957   ac_configure_args="$ac_configure_args \
8958       CC=\"$CC\" \
8959       CXX=\"$CXX\" \
8960       CPP=\"$CPP\" \
8961       CFLAGS=\"$CFLAGS\" \
8962       CXXFLAGS=\"$CXXFLAGS\" \
8963       CPPFLAGS=\"$CPPFLAGS\" \
8964       LD=\"$LD\" \
8965       LDFLAGS=\"$LDFLAGS\" \
8966       AR=\"$AR\" \
8967       RANLIB=\"$RANLIB\" \
8968       STRIP=\"$STRIP\" \
8969       LIBS=\"$LIBS\""
8971   # Use a separate cache file for libunwind, since it does not use caching.
8972   mkdir -p $_objdir/tools/profiler/libunwind/src
8973   old_cache_file=$cache_file
8974   cache_file=$_objdir/tools/profiler/libunwind/src/config.cache
8975   old_config_files=$CONFIG_FILES
8976   unset CONFIG_FILES
8977   AC_OUTPUT_SUBDIRS(tools/profiler/libunwind/src)
8978   cache_file=$old_cache_file
8979   ac_configure_args="$old_ac_configure_args"
8980   CONFIG_FILES=$old_config_files
8983 # Run freetype configure script
8985 if test "$MOZ_TREE_FREETYPE"; then
8986    export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
8987    export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
8988    export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
8989    export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
8990    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
8991    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
8992    AC_OUTPUT_SUBDIRS(modules/freetype2)
8995 if test -z "$direct_nspr_config"; then
8996     dnl ========================================================
8997     dnl = Setup a nice relatively clean build environment for
8998     dnl = sub-configures.
8999     dnl ========================================================
9000     CC="$_SUBDIR_CC"
9001     CXX="$_SUBDIR_CXX"
9002     CFLAGS="$_SUBDIR_CFLAGS"
9003     CPPFLAGS="$_SUBDIR_CPPFLAGS"
9004     CXXFLAGS="$_SUBDIR_CXXFLAGS"
9005     LDFLAGS="$_SUBDIR_LDFLAGS"
9006     HOST_CC="$_SUBDIR_HOST_CC"
9007     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9008     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9009     RC=
9012 unset MAKEFILES
9013 unset CONFIG_FILES
9015 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9016 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9018 export WRAP_LDFLAGS
9020 if test -n "$_WRAP_MALLOC"; then
9021     # Avoid doubling wrap malloc arguments
9022     _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9025 if test -z "$MOZ_NATIVE_NSPR"; then
9026     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9027     if test -z "$MOZ_DEBUG"; then
9028         ac_configure_args="$ac_configure_args --disable-debug"
9029     else
9030         ac_configure_args="$ac_configure_args --enable-debug"
9031     fi
9032     if test "$MOZ_OPTIMIZE" = "1"; then
9033         ac_configure_args="$ac_configure_args --enable-optimize"
9034     elif test -z "$MOZ_OPTIMIZE"; then
9035         ac_configure_args="$ac_configure_args --disable-optimize"
9036     fi
9037     if test -n "$HAVE_64BIT_OS"; then
9038         ac_configure_args="$ac_configure_args --enable-64bit"
9039     fi
9040     if test -n "$USE_ARM_KUSER"; then
9041         ac_configure_args="$ac_configure_args --with-arm-kuser"
9042     fi
9043     ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9044     if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9045       # dladdr is supported by the new linker, even when the system linker doesn't
9046       # support it. Trick nspr into using dladdr when it's not supported.
9047       _SAVE_CPPFLAGS="$CPPFLAGS"
9048       export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9049     fi
9050     _SAVE_LDFLAGS="$LDFLAGS"
9051     export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9052     AC_OUTPUT_SUBDIRS(nsprpub)
9053     LDFLAGS="$_SAVE_LDFLAGS"
9054     if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no; then
9055       unset CPPFLAGS
9056       CPPFLAGS="$_SAVE_CFLAGS"
9057     fi
9058     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9061 dnl ========================================================
9062 dnl = Setup a nice relatively clean build environment for
9063 dnl = sub-configures.
9064 dnl ========================================================
9065 CC="$_SUBDIR_CC"
9066 CXX="$_SUBDIR_CXX"
9067 CFLAGS="$_SUBDIR_CFLAGS"
9068 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9069 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9070 LDFLAGS="$_SUBDIR_LDFLAGS"
9071 HOST_CC="$_SUBDIR_HOST_CC"
9072 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9073 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9076 # Run the SpiderMonkey 'configure' script.
9077 dist=$MOZ_BUILD_ROOT/dist
9078 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9079 ac_configure_args="$ac_configure_args --enable-threadsafe"
9080 if test "$BUILD_CTYPES"; then
9081     # Build js-ctypes on the platforms we can.
9082     ac_configure_args="$ac_configure_args --enable-ctypes"
9084 if test -z "$JS_SHARED_LIBRARY" ; then
9085     ac_configure_args="$ac_configure_args --disable-shared-js"
9087 if test -z "$MOZ_NATIVE_NSPR"; then
9088     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9089     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9091 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9092 ac_configure_args="$ac_configure_args --prefix=$dist"
9093 if test "$MOZ_MEMORY"; then
9094    ac_configure_args="$ac_configure_args --enable-jemalloc"
9096 if test -n "$MOZ_GLUE_LDFLAGS"; then
9097    export MOZ_GLUE_LDFLAGS
9099 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9100    export MOZ_GLUE_PROGRAM_LDFLAGS
9102 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9103    MOZ_ZLIB_LIBS=
9105 export MOZ_NATIVE_ZLIB
9106 export MOZ_ZLIB_CFLAGS
9107 export MOZ_ZLIB_LIBS
9108 export MOZ_APP_NAME
9109 export STLPORT_CPPFLAGS
9110 export STLPORT_LDFLAGS
9111 export STLPORT_LIBS
9112 AC_OUTPUT_SUBDIRS(js/src)
9113 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9115 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR