Bug 867089 - Validate the playbackRate before using it. r=ehsan
[gecko.git] / configure.in
blobfde70d88f5ca4c866aeceb86fdb39c5437e26b9a
2 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
3 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
4 dnl This Source Code Form is subject to the terms of the Mozilla Public
5 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
6 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 dnl Process this file with autoconf to produce a configure script.
9 dnl ========================================================
11 AC_PREREQ(2.13)
12 AC_INIT(config/config.mk)
13 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
14 AC_CANONICAL_SYSTEM
15 TARGET_CPU="${target_cpu}"
16 TARGET_VENDOR="${target_vendor}"
17 TARGET_OS="${target_os}"
19 dnl ========================================================
20 dnl =
21 dnl = Don't change the following two lines.  Doing so breaks:
22 dnl =
23 dnl = CFLAGS="-foo" ./configure
24 dnl =
25 dnl ========================================================
26 CFLAGS="${CFLAGS=}"
27 CPPFLAGS="${CPPFLAGS=}"
28 CXXFLAGS="${CXXFLAGS=}"
29 LDFLAGS="${LDFLAGS=}"
30 HOST_CFLAGS="${HOST_CFLAGS=}"
31 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
32 HOST_LDFLAGS="${HOST_LDFLAGS=}"
34 dnl ========================================================
35 dnl = Preserve certain environment flags passed to configure
36 dnl = We want sub projects to receive the same flags
37 dnl = untainted by this configure script
38 dnl ========================================================
39 _SUBDIR_CC="$CC"
40 _SUBDIR_CXX="$CXX"
41 _SUBDIR_CFLAGS="$CFLAGS"
42 _SUBDIR_CPPFLAGS="$CPPFLAGS"
43 _SUBDIR_CXXFLAGS="$CXXFLAGS"
44 _SUBDIR_LDFLAGS="$LDFLAGS"
45 _SUBDIR_HOST_CC="$HOST_CC"
46 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
47 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
48 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
49 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
51 dnl Set the version number of the libs included with mozilla
52 dnl ========================================================
53 MOZJPEG=62
54 MOZPNG=10513
55 NSPR_VERSION=4
56 NSS_VERSION=3
58 dnl Set the minimum version of toolkit libs used by mozilla
59 dnl ========================================================
60 GLIB_VERSION=1.2.0
61 PERL_VERSION=5.006
62 CAIRO_VERSION=1.10
63 PANGO_VERSION=1.14.0
64 GTK2_VERSION=2.10.0
65 WINDRES_VERSION=2.14.90
66 W32API_VERSION=3.14
67 GNOMEVFS_VERSION=2.0
68 GNOMEUI_VERSION=2.2.0
69 GCONF_VERSION=1.2.1
70 GIO_VERSION=2.20
71 STARTUP_NOTIFICATION_VERSION=0.8
72 DBUS_VERSION=0.60
73 SQLITE_VERSION=3.7.16.1
75 MSMANIFEST_TOOL=
77 dnl Set various checks
78 dnl ========================================================
79 MISSING_X=
80 AC_PROG_AWK
82 dnl Initialize the Pthread test variables early so they can be
83 dnl  overridden by each platform.
84 dnl ========================================================
85 USE_PTHREADS=
86 _PTHREAD_LDFLAGS=""
88 dnl Do not allow a separate objdir build if a srcdir build exists.
89 dnl ==============================================================
90 _topsrcdir=`cd \`dirname $0\`; pwd`
91 _objdir=`pwd`
93 if test "$_topsrcdir" != "$_objdir"
94 then
95   # Check for a couple representative files in the source tree
96   _conflict_files=
97   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
98     if test -f $file; then
99       _conflict_files="$_conflict_files $file"
100     fi
101   done
102   if test "$_conflict_files"; then
103     echo "***"
104     echo "*   Your source tree contains these files:"
105     for file in $_conflict_files; do
106       echo "*         $file"
107     done
108     cat 1>&2 <<-EOF
109         *   This indicates that you previously built in the source tree.
110         *   A source tree build can confuse the separate objdir build.
111         *
112         *   To clean up the source tree:
113         *     1. cd $_topsrcdir
114         *     2. gmake distclean
115         ***
116         EOF
117     exit 1
118     break
119   fi
121 MOZ_BUILD_ROOT=`pwd`
123 MOZ_PYTHON
125 MOZ_DEFAULT_COMPILER
127 COMPILE_ENVIRONMENT=1
128 MOZ_ARG_DISABLE_BOOL(compile-environment,
129 [  --disable-compile-environment
130                           Disable compiler/library checks.],
131     COMPILE_ENVIRONMENT= )
132 AC_SUBST(COMPILE_ENVIRONMENT)
134 MOZ_ARG_WITH_STRING(l10n-base,
135 [  --with-l10n-base=DIR    path to l10n repositories],
136     L10NBASEDIR=$withval)
137 if test -n "$L10NBASEDIR"; then
138     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
139         AC_MSG_ERROR([--with-l10n-base must specify a path])
140     elif test -d "$L10NBASEDIR"; then
141         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
142     else
143         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
144     fi
146 AC_SUBST(L10NBASEDIR)
148 dnl Check for Perl first -- needed for win32 SDK checks
149 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
150 if test -z "$PERL" -o "$PERL" = ":"; then
151     AC_MSG_ERROR([perl not found in \$PATH])
154 AC_SUBST(GAIADIR)
155 if test -n "$GAIADIR" ; then
156     AC_DEFINE(PACKAGE_GAIA)
159 MOZ_ARG_WITH_STRING(gonk,
160 [  --with-gonk=DIR
161                location of gonk dir],
162     gonkdir=$withval)
164 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
165 [  --with-gonk-toolchain-prefix=DIR
166                           prefix to gonk toolchain commands],
167     gonk_toolchain_prefix=$withval)
169 if test -n "$gonkdir" ; then
170     kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
171     android_source="$gonkdir"
172     ANDROID_SOURCE="$android_source"
173     ANDROID_NDK="${ANDROID_SOURCE}/ndk"
175     dnl set up compilers
176     TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
177     AS="$gonk_toolchain_prefix"as
178     CC="$gonk_toolchain_prefix"gcc
179     CXX="$gonk_toolchain_prefix"g++
180     CPP="$gonk_toolchain_prefix"cpp
181     LD="$gonk_toolchain_prefix"ld
182     AR="$gonk_toolchain_prefix"ar
183     RANLIB="$gonk_toolchain_prefix"ranlib
184     STRIP="$gonk_toolchain_prefix"strip
185     OBJCOPY="$gonk_toolchain_prefix"objcopy
187     STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/ -I$gonkdir/external/stlport/stlport/"
188     STLPORT_LIBS="-lstlport"
190     case "$target_cpu" in
191     arm)
192         ARCH_DIR=arch-arm
193         ;;
194     i?86)
195         ARCH_DIR=arch-x86
196         ;;
197     esac
199     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"
200     CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
201     CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
202     dnl Add -llog by default, since we use it all over the place.
203     LIBS="$LIBS -llog $STLPORT_LIBS"
205     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"
207     dnl prevent cross compile section from using these flags as host flags
208     if test -z "$HOST_CPPFLAGS" ; then
209         HOST_CPPFLAGS=" "
210     fi
211     if test -z "$HOST_CFLAGS" ; then
212         HOST_CFLAGS=" "
213     fi
214     if test -z "$HOST_CXXFLAGS" ; then
215         HOST_CXXFLAGS=" "
216     fi
217     if test -z "$HOST_LDFLAGS" ; then
218         HOST_LDFLAGS=" "
219     fi
221     AC_DEFINE(ANDROID)
222     AC_DEFINE(HAVE_SYS_UIO_H)
223     AC_DEFINE(HAVE_PTHREADS)
224     CROSS_COMPILE=1
225     MOZ_CHROME_FILE_FORMAT=omni
226     direct_nspr_config=1
227 else
228     MOZ_ANDROID_NDK
230     case "$target" in
231     *-android*|*-linuxandroid*)
232         if test -z "$ANDROID_PACKAGE_NAME" ; then
233             ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
234         fi
235         MOZ_CHROME_FILE_FORMAT=omni
236         ZLIB_DIR=yes
237         ;;
238     *-linux*)
239         AC_PATH_PROG(OBJCOPY,objcopy)
240         ;;
241     esac
244 AC_SUBST(ANDROID_SOURCE)
245 AC_SUBST(ANDROID_PACKAGE_NAME)
246 AC_SUBST(OBJCOPY)
248 dnl ========================================================
249 dnl Checks for compilers.
250 dnl ========================================================
251 dnl Set CROSS_COMPILE in the environment when running configure
252 dnl to use the cross-compile setup for now
253 dnl ========================================================
255 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
256 AR_FLAGS='cr $@'
258 if test "$COMPILE_ENVIRONMENT"; then
260 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
261     echo "cross compiling from $host to $target"
262     cross_compiling=yes
264     _SAVE_CC="$CC"
265     _SAVE_CFLAGS="$CFLAGS"
266     _SAVE_LDFLAGS="$LDFLAGS"
268     AC_MSG_CHECKING([for host c compiler])
269     AC_CHECK_PROGS(HOST_CC, $HOST_CC cc gcc /usr/ucb/cc cl icc, "")
270     if test -z "$HOST_CC"; then
271         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
272     fi
273     AC_MSG_RESULT([$HOST_CC])
274     AC_MSG_CHECKING([for host c++ compiler])
275     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
276     if test -z "$HOST_CXX"; then
277         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
278     fi
279     AC_MSG_RESULT([$HOST_CXX])
281     if test -z "$HOST_CFLAGS"; then
282         HOST_CFLAGS="$CFLAGS"
283     fi
284     if test -z "$HOST_CXXFLAGS"; then
285         HOST_CXXFLAGS="$CXXFLAGS"
286     fi
287     if test -z "$HOST_LDFLAGS"; then
288         HOST_LDFLAGS="$LDFLAGS"
289     fi
290     if test -z "$HOST_AR_FLAGS"; then
291         HOST_AR_FLAGS="$AR_FLAGS"
292     fi
293     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
294     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
295     CC="$HOST_CC"
296     CFLAGS="$HOST_CFLAGS"
297     LDFLAGS="$HOST_LDFLAGS"
299     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
300     AC_TRY_COMPILE([], [return(0);],
301         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
302         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
304     CC="$HOST_CXX"
305     CFLAGS="$HOST_CXXFLAGS"
307     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
308     AC_TRY_COMPILE([], [return(0);],
309         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
310         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
312     CC=$_SAVE_CC
313     CFLAGS=$_SAVE_CFLAGS
314     LDFLAGS=$_SAVE_LDFLAGS
316     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
317     unset ac_cv_prog_CC
318     AC_PROG_CC
319     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
320     unset ac_cv_prog_CXX
321     AC_PROG_CXX
323     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
324     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
325     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
326     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
327     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
328     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
329     AC_DEFINE(CROSS_COMPILE)
330 else
331     AC_PROG_CC
332     case "$target" in
333     *-mingw*)
334       # Work around the conftest.exe access problem on Windows
335       sleep 2
336     esac
337     AC_PROG_CXX
338     AC_PROG_RANLIB
339     MOZ_PATH_PROGS(AS, $AS as, $CC)
340     AC_CHECK_PROGS(AR, ar, :)
341     AC_CHECK_PROGS(LD, ld, :)
342     AC_CHECK_PROGS(STRIP, strip, :)
343     AC_CHECK_PROGS(WINDRES, windres, :)
344     if test -z "$HOST_CC"; then
345         HOST_CC="$CC"
346     fi
347     if test -z "$HOST_CFLAGS"; then
348         HOST_CFLAGS="$CFLAGS"
349     fi
350     if test -z "$HOST_CXX"; then
351         HOST_CXX="$CXX"
352     fi
353     if test -z "$HOST_CXXFLAGS"; then
354         HOST_CXXFLAGS="$CXXFLAGS"
355     fi
356     if test -z "$HOST_LDFLAGS"; then
357         HOST_LDFLAGS="$LDFLAGS"
358     fi
359     if test -z "$HOST_RANLIB"; then
360         HOST_RANLIB="$RANLIB"
361     fi
362     if test -z "$HOST_AR"; then
363         HOST_AR="$AR"
364     fi
365     if test -z "$HOST_AR_FLAGS"; then
366         HOST_AR_FLAGS="$AR_FLAGS"
367     fi
370 if test -n "$MOZ_WINCONSOLE"; then
371     AC_DEFINE(MOZ_WINCONSOLE)
374 MOZ_TOOL_VARIABLES
376 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
377     if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
378        test "$GCC_MAJOR_VERSION" -lt 4; then
379         AC_MSG_ERROR([Only GCC 4.4 or newer supported])
380     fi
383 dnl ========================================================
384 dnl Special win32 checks
385 dnl ========================================================
387 MOZ_ARG_ENABLE_BOOL(metro,
388 [  --enable-metro           Enable Windows Metro build targets],
389     MOZ_METRO=1,
390     MOZ_METRO=)
391 if test -n "$MOZ_METRO"; then
392     AC_DEFINE(MOZ_METRO)
393     # Target the Windows 8 Kit
394     WINSDK_TARGETVER=602
395     WINVER=502
396     # toolkit/library/makefile.in needs these, see nsDllMain.
397     CRTDLLVERSION=110
398     CRTEXPDLLVERSION=1-1-0
399 else
400     # Target the Windows 7 SDK by default
401     WINSDK_TARGETVER=601
402     WINVER=502
405 AC_SUBST(CRTDLLVERSION)
406 AC_SUBST(CRTEXPDLLVERSION)
408 MOZ_ARG_WITH_STRING(windows-version,
409 [  --with-windows-version=WINSDK_TARGETVER
410                           Windows SDK version to target. Lowest version
411                           currently allowed is 601 (Win7), highest is 602 (Win8)],
412   WINSDK_TARGETVER=$withval)
414 # Currently only two sdk versions allowed, 601 and 602
415 case "$WINSDK_TARGETVER" in
416 601|602)
417     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
418     ;;
421     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
422     ;;
423 esac
425 case "$target" in
426 *-mingw*)
427     if test "$GCC" != "yes"; then
428         # Check to see if we are really running in a msvc environemnt
429         _WIN32_MSVC=1
430         AC_CHECK_PROGS(MIDL, midl)
432         # Make sure compilers are valid
433         CFLAGS="$CFLAGS -TC -nologo"
434         CXXFLAGS="$CXXFLAGS -TP -nologo"
435         AC_LANG_SAVE
436         AC_LANG_C
437         AC_TRY_COMPILE([#include <stdio.h>],
438             [ printf("Hello World\n"); ],,
439             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
441         AC_LANG_CPLUSPLUS
442         AC_TRY_COMPILE([#include <new.h>],
443             [ unsigned *test = new unsigned(42); ],,
444             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
445         AC_LANG_RESTORE
447         changequote(,)
448         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
449         changequote([,])
451         # Determine compiler version
452         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
453         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
454         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
455         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
456         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
457         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
459         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
460         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
462         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
463             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
464         fi
466         if test "$_CC_MAJOR_VERSION" = "14"; then
467             dnl Require VC8SP1 or newer.
468             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
469             if test "$_CC_RELEASE" -lt 50727 -o \
470                     \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
471               AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
472             fi
474             _CC_SUITE=8
475             _MSVS_VERSION=2005
476             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
477             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
478         elif test "$_CC_MAJOR_VERSION" = "15"; then
479             _CC_SUITE=9
480             _MSVS_VERSION=2008
481             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
482             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
483         elif test "$_CC_MAJOR_VERSION" = "16"; then
484             _CC_SUITE=10
485             _MSVS_VERSION=2010
486             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
487             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
488         elif test "$_CC_MAJOR_VERSION" = "17"; then
489             _CC_SUITE=11
490             _MSVS_VERSION=2012
491             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
492             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
493         else
494             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
495         fi
497         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
499         if test -n "$WIN32_REDIST_DIR"; then
500           if test ! -d "$WIN32_REDIST_DIR"; then
501             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
502           fi
503           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
504         fi
506         dnl Confirm we have the pri tools on win8 builds
507         if test -n "$MOZ_METRO"; then
508           AC_MSG_CHECKING([for makepri])
509           AC_CHECK_PROGS(MAKEPRI, makepri, "")
510           if test -z "MAKEPRI" ; then
511               AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
512           fi
513           AC_SUBST(MAKEPRI)
514         fi
516         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
517         dnl not something else like "magnetic tape manipulation utility".
518         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
519         if test -z "$MSMT_TOOL"; then
520           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
521         fi
523         changequote(,)
524         _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
525         changequote([,])
526         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
527         if test -z "$MSMANIFEST_TOOL_VERSION"; then
528           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
529         fi
531         MSMANIFEST_TOOL=1
532         unset MSMT_TOOL
534         # Check linker version
535         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
536         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
537         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
538             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
539         fi
541         INCREMENTAL_LINKER=1
543         # Check midl version
544         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
545         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
546         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
547         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
548         # Add flags if necessary
549         AC_MSG_CHECKING([for midl flags])
550         case "$target" in
551         i*86-*)
552             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
553                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
554                 # MIDL version 7.00.0500 or later has no problem.
555                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
556                 AC_MSG_RESULT([need -env win32])
557             else
558                 AC_MSG_RESULT([none needed])
559             fi
560             ;;
561         x86_64-*)
562             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
563             ;;
564         *)
565             AC_MSG_RESULT([none needed])
566             ;;
567         esac
569         # Identify which version of the SDK we're building with
570         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
571         # from there
572         MOZ_CHECK_HEADERS([winsdkver.h])
573         if test "$ac_cv_header_winsdkver_h" = "yes"; then
574             # Get the highest _WIN32_WINNT and NTDDI versions supported
575             # Take the higher of the two
576             # This is done because the Windows 7 beta SDK reports its
577             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
578             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
579                            ac_cv_winsdk_maxver,
580                            [cat > conftest.h <<EOF
581 #include <winsdkver.h>
582 #include <sdkddkver.h>
584 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
585 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
586 #else
587 #define WINSDK_MAXVER NTDDI_MAXVER
588 #endif
590 WINSDK_MAXVER
592                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
593                             rm -f conftest.h
594                            ])
595             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
596         else
597             # Any SDK which doesn't have WinSDKVer.h is too old.
598             AC_MSG_ERROR([Your SDK does not have WinSDKVer.h. It is probably too old. Please upgrade to a newer SDK or try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
599         fi
601         unset _MSVC_VER_FILTER
603         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
604             [
605                 AC_LANG_SAVE
606                 AC_LANG_CPLUSPLUS
607                 _SAVE_CXXFLAGS="$CXXFLAGS"
608                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
609                 AC_TRY_COMPILE([#include <exception>],
610                             [std::_Throw(std::exception()); return 0;],
611                             ac_cv_have_std__Throw="yes",
612                             ac_cv_have_std__Throw="no")
613                 CXXFLAGS="$_SAVE_CXXFLAGS"
614                 AC_LANG_RESTORE
615             ])
617         if test "$ac_cv_have_std__Throw" = "yes"; then
618             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
619                            ac_cv_have_dllimport_exception_bug,
620                 [
621                     AC_LANG_SAVE
622                     AC_LANG_CPLUSPLUS
623                     _SAVE_CXXFLAGS="$CXXFLAGS"
624                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
625                     AC_TRY_LINK([#include <vector>],
626                                 [std::vector<int> v; return v.at(1);],
627                                 ac_cv_have_dllimport_exception_bug="no",
628                                 ac_cv_have_dllimport_exception_bug="yes")
629                     CXXFLAGS="$_SAVE_CXXFLAGS"
630                     AC_LANG_RESTORE
631                 ])
632             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
633                 WRAP_STL_INCLUDES=1
634                 MOZ_MSVC_STL_WRAP__Throw=1
635                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
636             fi
637         else
638             AC_CACHE_CHECK(for overridable _RAISE,
639                            ac_cv_have__RAISE,
640                 [
641                     AC_LANG_SAVE
642                     AC_LANG_CPLUSPLUS
643                     _SAVE_CXXFLAGS="$CXXFLAGS"
644                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
645                     AC_TRY_COMPILE([#include <xstddef>
646                                     #undef _RAISE
647                                     #define _RAISE(x) externallyDefinedFunction((x).what())
648                                     #include <vector>
649                                    ],
650                                    [std::vector<int> v; return v.at(1);],
651                                    ac_cv_have__RAISE="no",
652                                    ac_cv_have__RAISE="yes")
653                     CXXFLAGS="$_SAVE_CXXFLAGS"
654                     AC_LANG_RESTORE
655                 ])
656             if test "$ac_cv_have__RAISE" = "yes"; then
657                 WRAP_STL_INCLUDES=1
658                 MOZ_MSVC_STL_WRAP__RAISE=1
659                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
660             else
661                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
662             fi
663         fi
665         if test "$WRAP_STL_INCLUDES" = "1"; then
666             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
667         fi
668     else
669         # Check w32api version
670         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
671         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
672         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
673         AC_TRY_COMPILE([#include <w32api.h>],
674             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
675                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
676                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
677                 #error "test failed."
678             #endif
679             , [ res=yes ], [ res=no ])
680         AC_MSG_RESULT([$res])
681         if test "$res" != "yes"; then
682             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
683         fi
684         # Check windres version
685         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
686         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
687         AC_MSG_RESULT([$_WINDRES_VERSION])
688         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
689         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
690         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
691         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
692         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
693         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
694         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
695                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
696                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
697                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
698                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
699                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
700         then
701             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
702         fi
704         AC_CHECK_PROGS(MIDL, $target-widl widl)
705         if test -n "$MIDL"; then
706             case "$target" in
707             i*86-*)
708                 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
709                 ;;
710             x86_64-*)
711                 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
712                 ;;
713             esac
714         fi
716         MOZ_WINSDK_MAXVER=0x06020000
717     fi # !GNU_CC
719     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
720     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
721     # Require OS features provided by IE 6.0 SP2 (XP SP2)
722     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
724     # If the maximum version supported by this SDK is lower than the target
725     # version, error out
726     AC_MSG_CHECKING([for Windows SDK being recent enough])
727     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
728         AC_MSG_RESULT("yes")
729     else
730         AC_MSG_RESULT("no")
731         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.])
732     fi
733     
734     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
735     # Definitions matching sdkddkver.h
736     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
737     ;;
738 esac
740 AC_PROG_CPP
741 AC_PROG_CXXCPP
743 if test -n "$_WIN32_MSVC"; then
744     SKIP_PATH_CHECKS=1
745     SKIP_COMPILER_CHECKS=1
746     SKIP_LIBRARY_CHECKS=1
748     # Since we're skipping compiler and library checks, hard-code
749     # some facts here.
750     AC_DEFINE(HAVE_IO_H)
751     AC_DEFINE(HAVE_SETBUF)
752     AC_DEFINE(HAVE_ISATTY)
755 fi # COMPILE_ENVIRONMENT
757 AC_SUBST(MIDL_FLAGS)
758 AC_SUBST(_MSC_VER)
760 AC_SUBST(GNU_AS)
761 AC_SUBST(GNU_LD)
762 AC_SUBST(GNU_CC)
763 AC_SUBST(GNU_CXX)
764 AC_SUBST(INTEL_CC)
765 AC_SUBST(INTEL_CXX)
767 AC_SUBST(STL_FLAGS)
768 AC_SUBST(WRAP_STL_INCLUDES)
769 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
770 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
772 dnl ========================================================
773 dnl Checks for programs.
774 dnl ========================================================
775 AC_PROG_INSTALL
776 AC_PROG_LN_S
778 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
779 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
780 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
781 _perl_res=$?
782 AC_MSG_RESULT([$_perl_version])
784 if test "$_perl_res" != 0; then
785     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
789 AC_MSG_CHECKING([for full perl installation])
790 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
791 _perl_res=$?
792 if test "$_perl_res" != 0; then
793     AC_MSG_RESULT([no])
794     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
795 else
796     AC_MSG_RESULT([yes])
799 MOZ_ARG_WITH_BOOL(system-ply,
800 [  --with-system-ply       Use system installed python ply library],
801     [if $PYTHON -c 'import ply' 2>&5; then
802          MOZ_SYSTEM_PLY=1
803      else
804          AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
805      fi])
807 AC_SUBST(MOZ_SYSTEM_PLY)
809 if test -z "$COMPILE_ENVIRONMENT"; then
810     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
812 AC_SUBST(NSINSTALL_BIN)
814 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
815 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
816 MOZ_PATH_PROGS(UNZIP, unzip)
817 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
818     AC_MSG_ERROR([unzip not found in \$PATH])
820 MOZ_PATH_PROGS(ZIP, zip)
821 if test -z "$ZIP" -o "$ZIP" = ":"; then
822     AC_MSG_ERROR([zip not found in \$PATH])
824 MOZ_PATH_PROG(XARGS, xargs)
825 if test -z "$XARGS" -o "$XARGS" = ":"; then
826     AC_MSG_ERROR([xargs not found in \$PATH .])
829 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
830 AC_SUBST(RPMBUILD)
832 if test "$COMPILE_ENVIRONMENT"; then
834 dnl ========================================================
835 dnl = Mac OS X toolchain support
836 dnl ========================================================
838 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
839 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
840 dnl when we can run target binaries.
841 AC_SUBST(UNIVERSAL_BINARY)
842 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
844 MOZ_ARG_WITH_STRING(unify-dist,
845 [  --with-unify-dist=dir   Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
846     UNIFY_DIST=$withval)
847 if test -n "$UNIVERSAL_BINARY"; then
848     if test -z "$UNIFY_DIST"; then
849         AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
850     fi
851     case "$UNIFY_DIST" in
852     /*)
853         ;;
854     *)
855         UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
856         ;;
857     esac
859 AC_SUBST(UNIFY_DIST)
861 dnl ========================================================
862 dnl Check for MacOS deployment target version
863 dnl ========================================================
865 MOZ_ARG_ENABLE_STRING(macos-target,
866                       [  --enable-macos-target=VER (default=10.6)
867                           Set the minimum MacOS version needed at runtime],
868                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
870 case "$target" in
871 *-darwin*)
872     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
873         dnl Use the specified value
874         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
875     else
876         dnl No value specified on the command line or in the environment,
877         dnl use architecture minimum.
878         export MACOSX_DEPLOYMENT_TARGET=10.6
879     fi
880     ;;
881 esac
883 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
885 dnl ========================================================
886 dnl = Mac OS X SDK support
887 dnl ========================================================
888 MACOS_SDK_DIR=
889 NEXT_ROOT=
890 MOZ_ARG_WITH_STRING(macos-sdk,
891 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
892     MACOS_SDK_DIR=$withval)
894 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
895 dnl NEXT_ROOT will be set and exported only if it's needed.
896 AC_SUBST(MACOS_SDK_DIR)
897 AC_SUBST(NEXT_ROOT)
899 if test "$MACOS_SDK_DIR"; then
900   dnl Sync this section with the ones in NSPR and NSS.
901   dnl Changes to the cross environment here need to be accounted for in
902   dnl the libIDL checks (below) and xpidl build.
904   if test ! -d "$MACOS_SDK_DIR"; then
905     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
906 specify a valid SDK.  SDKs are installed when the optional cross-development
907 tools are selected during the Xcode/Developer Tools installation.])
908   fi
910   CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
911   CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
913   dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
914   CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
915   CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
917   AC_LANG_SAVE
918   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
919   AC_LANG_CPLUSPLUS
920   AC_TRY_COMPILE([#include <new>],[],
921    result=yes,
922    result=no)
923   AC_LANG_RESTORE
924   AC_MSG_RESULT($result)
926   if test "$result" = "no" ; then
927     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
928   fi
931 fi # COMPILE_ENVIRONMENT
933 AC_MSG_CHECKING([compiler version])
934 # Just print it so it shows up in the logs.
935 cc_version=$($CC --version)
936 AC_MSG_RESULT([$cc_version])
938 if test -n "$MAKE"; then
939   if test `echo $MAKE | grep -c make.py` != 1; then
940      NOT_PYMAKE=$MAKE
941   fi
944 case "$host_os" in
945 mingw*)
946     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
947     ;;
949     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
950     ;;
951 esac
952 if test "$GMAKE" = ":"; then
953    AC_MSG_ERROR([GNU make not found])
955 AC_SUBST(GMAKE)
957 if test -z "$MAKE"; then
958   MAKE=$GMAKE
961 if test "$COMPILE_ENVIRONMENT"; then
963 AC_PATH_XTRA
965 XCFLAGS="$X_CFLAGS"
967 fi # COMPILE_ENVIRONMENT
969 dnl ========================================================
970 dnl set the defaults first
971 dnl ========================================================
972 AS_BIN=$AS
973 AR_LIST='$(AR) t'
974 AR_EXTRACT='$(AR) x'
975 AR_DELETE='$(AR) d'
976 AS='$(CC)'
977 AS_DASH_C_FLAG='-c'
978 DLL_PREFIX=lib
979 LIB_PREFIX=lib
980 DLL_SUFFIX=.so
981 OBJ_SUFFIX=o
982 LIB_SUFFIX=a
983 ASM_SUFFIX=s
984 IMPORT_LIB_SUFFIX=
985 TARGET_MD_ARCH=unix
986 DIRENT_INO=d_ino
987 MOZ_USER_DIR=".mozilla"
989 MOZ_JPEG_CFLAGS=
990 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
991 MOZ_BZ2_CFLAGS=
992 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
993 MOZ_PNG_CFLAGS=
994 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
996 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
997 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
998 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxul -lxpcom_core -lmozalloc'
999 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1000 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxul -lmozalloc'
1001 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)'
1002 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1003 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1005 # These are specially defined on Windows only
1006 case "$target" in
1007 *-mingw*)
1008   XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1009   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
1010   ;;
1012   XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
1013   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
1014   ;;
1015 esac
1017 MOZ_FS_LAYOUT=unix
1019 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1021 USE_DEPENDENT_LIBS=1
1023 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1025 if test -n "$CROSS_COMPILE"; then
1026     OS_TARGET="${target_os}"
1027     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1028     OS_RELEASE=
1029     case "${target_os}" in
1030         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1031         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1032         gnu*)         OS_ARCH=GNU ;;
1033         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1034         mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
1035         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1036     esac
1037     case "${target}" in
1038         *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1039     esac
1040 else
1041     OS_TARGET=`uname -s`
1042     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1043     OS_RELEASE=`uname -r`
1046 # Before this used `uname -m` when not cross compiling
1047 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1048 OS_TEST="${target_cpu}"
1050 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1052 #######################################################################
1053 # Master "Core Components" macros for getting the OS target           #
1054 #######################################################################
1057 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1058 # cross-compilation.
1062 # Define and override various archtecture-specific variables, including
1063 # HOST_OS_ARCH
1064 # OS_ARCH
1065 # OS_TEST
1066 # OS_TARGET
1067 # OS_RELEASE
1068 # OS_MINOR_RELEASE
1071 case "$HOST_OS_ARCH" in
1072 mingw*)
1073     HOST_OS_ARCH=WINNT
1074     ;;
1075 darwin*)
1076     HOST_OS_ARCH=Darwin
1077     ;;
1078 linux*)
1079     HOST_OS_ARCH=Linux
1080     ;;
1081 solaris*)
1082     HOST_OS_ARCH=SunOS
1083     SOLARIS_SUNPRO_CC=
1084     SOLARIS_SUNPRO_CXX=
1085     if test -z "$GNU_CC"; then
1086         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1087             SOLARIS_SUNPRO_CC=1
1088        fi
1089     fi
1091     if test -z "$GNU_CXX"; then
1092        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1093            SOLARIS_SUNPRO_CXX=1
1094        fi
1095     fi
1096     AC_SUBST(SOLARIS_SUNPRO_CC)
1097     AC_SUBST(SOLARIS_SUNPRO_CXX)
1098     ;;
1099 OS_2)
1100     HOST_OS_ARCH=OS2
1101     ;;
1102 esac
1104 case "$OS_ARCH" in
1105 WINNT)
1106     if test -z "$CROSS_COMPILE" ; then
1107         OS_TEST=`uname -p`
1108     fi
1109     ;;
1110 Windows_NT)
1112 # If uname -s returns "Windows_NT", we assume that we are using
1113 # the uname.exe in MKS toolkit.
1115 # The -r option of MKS uname only returns the major version number.
1116 # So we need to use its -v option to get the minor version number.
1117 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1119     OS_ARCH=WINNT
1120     OS_TARGET=WINNT
1121     OS_MINOR_RELEASE=`uname -v`
1122     if test "$OS_MINOR_RELEASE" = "00"; then
1123         OS_MINOR_RELEASE=0
1124     fi
1125     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1126     ;;
1127 MINGW*_NT*)
1129 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1130 # the uname.exe in the MSYS tools.
1132     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1133     OS_ARCH=WINNT
1134     OS_TARGET=WINNT
1135     ;;
1136 AIX)
1137     OS_RELEASE=`uname -v`.`uname -r`
1138     OS_TEST=${target_cpu}
1139     ;;
1140 OS_2)
1141     OS_ARCH=OS2
1142     OS_TARGET=OS2
1143     OS_RELEASE=`uname -v`
1144     ;;
1145 Darwin)
1146     case "${target_cpu}" in
1147     powerpc*)
1148         OS_TEST=ppc
1149         ;;
1150     i*86*)
1151         OS_TEST=i386
1152         ;;
1153     x86_64)
1154         OS_TEST=x86_64
1155         ;;
1156     *)
1157         if test -z "$CROSS_COMPILE" ; then
1158             OS_TEST=`uname -p`
1159         fi
1160         ;;
1161     esac
1162     ;;
1163 esac
1165 # Only set CPU_ARCH if we recognize the value of OS_TEST
1167 case "$OS_TEST" in
1168 *86 | i86pc)
1169     CPU_ARCH=x86
1170     ;;
1172 powerpc64 | ppc64)
1173     CPU_ARCH=ppc64
1174     ;;
1176 powerpc | ppc | rs6000)
1177     CPU_ARCH=ppc
1178     ;;
1180 Alpha | alpha | ALPHA)
1181     CPU_ARCH=Alpha
1182     ;;
1184 s390)
1185     CPU_ARCH=s390
1186     ;;
1188 s390x)
1189     CPU_ARCH=s390x
1190     ;;
1192 hppa* | parisc)
1193     CPU_ARCH=hppa
1194     ;;
1196 sun4u | sparc*)
1197     CPU_ARCH=sparc
1198     ;;
1200 x86_64 | ia64)
1201     CPU_ARCH="$OS_TEST"
1202     ;;
1204 arm*)
1205     CPU_ARCH=arm
1206     ;;
1208 mips|mipsel)
1209     CPU_ARCH="mips"
1210     ;;
1211 esac
1213 if test -z "$OS_TARGET"; then
1214     OS_TARGET=$OS_ARCH
1216 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1218 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1219 dnl ===============================================================
1220 INTEL_ARCHITECTURE=
1221 case "$OS_TEST" in
1222     x86_64|i?86)
1223       INTEL_ARCHITECTURE=1
1224 esac
1226 dnl Configure platform-specific CPU architecture compiler options.
1227 dnl ==============================================================
1228 MOZ_ARCH_OPTS
1230 dnl =================================================================
1231 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1232 dnl which is bad when cross compiling.
1233 dnl =================================================================
1234 if test "$COMPILE_ENVIRONMENT"; then
1235 configure_static_assert_macros='
1236 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1237 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1238 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1241 dnl test that the macros actually work:
1242 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1243 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1244  [AC_LANG_SAVE
1245   AC_LANG_C
1246   ac_cv_static_assertion_macros_work="yes"
1247   AC_TRY_COMPILE([$configure_static_assert_macros],
1248                  [CONFIGURE_STATIC_ASSERT(1)],
1249                  ,
1250                  ac_cv_static_assertion_macros_work="no")
1251   AC_TRY_COMPILE([$configure_static_assert_macros],
1252                  [CONFIGURE_STATIC_ASSERT(0)],
1253                  ac_cv_static_assertion_macros_work="no",
1254                  )
1255   AC_LANG_CPLUSPLUS
1256   AC_TRY_COMPILE([$configure_static_assert_macros],
1257                  [CONFIGURE_STATIC_ASSERT(1)],
1258                  ,
1259                  ac_cv_static_assertion_macros_work="no")
1260   AC_TRY_COMPILE([$configure_static_assert_macros],
1261                  [CONFIGURE_STATIC_ASSERT(0)],
1262                  ac_cv_static_assertion_macros_work="no",
1263                  )
1264   AC_LANG_RESTORE
1265  ])
1266 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1267 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1268     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1270 fi # COMPILE_ENVIRONMENT
1272 dnl ========================================================
1273 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1274 dnl computed above.
1275 dnl ========================================================
1277 MOZ_ANDROID_STLPORT
1279 dnl ========================================================
1280 dnl Suppress Clang Argument Warnings
1281 dnl ========================================================
1282 if test -n "$CLANG_CC"; then
1283     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1284     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1286 if test -n "$CLANG_CXX"; then
1287     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1290 dnl ========================================================
1291 dnl = Use Address Sanitizer
1292 dnl ========================================================
1293 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1294 [  --enable-address-sanitizer       Enable Address Sanitizer (default=no)],
1295     MOZ_ASAN=1,
1296     MOZ_ASAN= )
1297 if test -n "$MOZ_ASAN"; then
1298     MOZ_LLVM_HACKS=1
1299     AC_DEFINE(MOZ_ASAN)
1301 AC_SUBST(MOZ_ASAN)
1303 dnl ========================================================
1304 dnl = Enable hacks required for LLVM instrumentations
1305 dnl ========================================================
1306 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1307 [  --enable-llvm-hacks       Enable workarounds required for several LLVM instrumentations (default=no)],
1308     MOZ_LLVM_HACKS=1,
1309     MOZ_LLVM_HACKS= )
1310 if test -n "$MOZ_LLVM_HACKS"; then
1311     MOZ_NO_WLZDEFS=1
1312     MOZ_CFLAGS_NSS=1
1314 AC_SUBST(MOZ_NO_WLZDEFS)
1315 AC_SUBST(MOZ_CFLAGS_NSS)
1317 dnl ========================================================
1318 dnl GNU specific defaults
1319 dnl ========================================================
1320 if test "$GNU_CC"; then
1321     # Per bug 719659 comment 2, some of the headers on ancient build machines
1322     # may require gnu89 inline semantics.  But otherwise, we use C99.
1323     CFLAGS="$CFLAGS -std=gnu99 -fgnu89-inline"
1324     # FIXME: Let us build with strict aliasing. bug 414641.
1325     CFLAGS="$CFLAGS -fno-strict-aliasing"
1326     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1327     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1328     DSO_LDOPTS='-shared'
1329     if test "$GCC_USE_GNU_LD"; then
1330         # Some tools like ASan use a runtime library that is only
1331         # linked against executables, so we must allow undefined
1332         # symbols for shared objects in some cases.
1333         if test -z "$MOZ_NO_WLZDEFS"; then
1334             # Don't allow undefined symbols in libraries
1335             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1336         fi
1337     fi
1338     WARNINGS_AS_ERRORS='-Werror'
1339     # Don't treat -Wuninitialized as error b/c it has lots of false positives.
1340     WARNINGS_AS_ERRORS="$WARNINGS_AS_ERRORS -Wno-error=uninitialized"
1341     # Don't treat -Wdeprecated-declarations as error b/c we don't want our
1342     # builds held hostage when a platform-specific API is suddenly deprecated.
1343     WARNINGS_AS_ERRORS="$WARNINGS_AS_ERRORS -Wno-error=deprecated-declarations"
1344     DSO_CFLAGS=''
1345     DSO_PIC_CFLAGS='-fPIC'
1346     ASFLAGS="$ASFLAGS -fPIC"
1347     AC_MSG_CHECKING([for --noexecstack option to as])
1348     _SAVE_CFLAGS=$CFLAGS
1349     CFLAGS="$CFLAGS -Wa,--noexecstack"
1350     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1351                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1352                      AC_MSG_RESULT([no]))
1353     CFLAGS=$_SAVE_CFLAGS
1354     AC_MSG_CHECKING([for -z noexecstack option to ld])
1355     _SAVE_LDFLAGS=$LDFLAGS
1356     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1357     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1358                   AC_MSG_RESULT([no])
1359                   LDFLAGS=$_SAVE_LDFLAGS)
1360     AC_MSG_CHECKING([for --build-id option to ld])
1361     _SAVE_LDFLAGS=$LDFLAGS
1362     LDFLAGS="$LDFLAGS -Wl,--build-id"
1363     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1364                   [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1365                   AC_MSG_RESULT([no])
1366                   LDFLAGS=$_SAVE_LDFLAGS)
1369     # Check for -mssse3 on $CC
1370     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1371     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1372     _SAVE_CFLAGS=$CFLAGS
1373     CFLAGS="$CFLAGS -mssse3"
1374     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1375                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1376                      AC_MSG_RESULT([no]))
1377     CFLAGS=$_SAVE_CFLAGS
1378     AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
1380     # Check for -msse4.1 on $CC
1381     AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1382     HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1383     _SAVE_CFLAGS=$CFLAGS
1384     CFLAGS="$CFLAGS -msse4.1"
1385     AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1386                      [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1387                      AC_MSG_RESULT([no]))
1388     CFLAGS=$_SAVE_CFLAGS
1389     AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
1391     # Turn on GNU-specific warnings:
1392     # -Wall - turn on a lot of warnings
1393     # -Wpointer-arith - good to have
1394     # -Wdeclaration-after-statement - MSVC doesn't like these
1395     # -Werror=return-type - catches missing returns, zero false positives
1396     # -Wtype-limits - catches overflow bugs, few false positives
1397     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1398     # -Wsign-compare - catches comparison of signed and unsigned types
1399     #
1400     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1401     MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1402     MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1403     MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1404     MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1406     # Turn off the following warnings that -Wall turns on:
1407     # -Wno-unused - lots of violations in third-party code
1408     #
1409     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1411     if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1412        # Don't use -Wcast-align with ICC or clang
1413        case "$CPU_ARCH" in
1414            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1415            hppa | ia64 | sparc | arm)
1416            ;;
1417            *)
1418         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1419            ;;
1420        esac
1421     fi
1423     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1424     _USE_CPP_INCLUDE_FLAG=1
1425     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1427 elif test "$SOLARIS_SUNPRO_CC"; then
1428     DSO_CFLAGS=''
1429     if test "$CPU_ARCH" = "sparc"; then
1430         # for Sun Studio on Solaris/SPARC
1431         DSO_PIC_CFLAGS='-xcode=pic32'
1432     else
1433         DSO_PIC_CFLAGS='-KPIC'
1434     fi
1435     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1436 else
1437     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1438     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1440     DSO_LDOPTS='-shared'
1441     if test "$GNU_LD"; then
1442         # Don't allow undefined symbols in libraries
1443         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1444     fi
1446     DSO_CFLAGS=''
1447     DSO_PIC_CFLAGS='-KPIC'
1448     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1451 if test "$GNU_CXX"; then
1452     # FIXME: Let us build with strict aliasing. bug 414641.
1453     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1455     # Turn on GNU-specific warnings:
1456     # -Wall - turn on a lot of warnings
1457     # -Wpointer-arith - good to have
1458     # -Woverloaded-virtual - ???
1459     # -Werror=return-type - catches missing returns, zero false positives
1460     # -Wtype-limits - catches overflow bugs, few false positives
1461     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1462     # -Wsign-compare - catches comparison of signed and unsigned types
1463     #
1464     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1465     MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1466     MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1467     MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1468     MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1470     # Turn off the following warnings that -Wall turns on:
1471     # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1472     #
1473     MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1475     if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1476        # Don't use -Wcast-align with ICC or clang
1477        case "$CPU_ARCH" in
1478            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1479            hppa | ia64 | sparc | arm)
1480            ;;
1481            *)
1482         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1483            ;;
1484        esac
1485     fi
1487     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1488     _USE_CPP_INCLUDE_FLAG=1
1490     # Recent clang and gcc support C++11 deleted functions without warnings if
1491     # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1492     # versions).  We can't use -std=c++0x yet, so gcc's support must remain
1493     # unused.  But clang's warning can be disabled, so when compiling with clang
1494     # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1495     # deleted function syntax.
1496     if test "$CLANG_CXX"; then
1497         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1498         MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1499     fi
1501 else
1502     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1505 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1506 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1507 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1508 dnl normal behavior.
1509 dnl ========================================================
1510 MKSHLIB_FORCE_ALL=
1511 MKSHLIB_UNFORCE_ALL=
1513 if test "$COMPILE_ENVIRONMENT"; then
1514 if test "$GNU_CC"; then
1515   AC_MSG_CHECKING(whether ld has archive extraction flags)
1516   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1517    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1518     ac_cv_mkshlib_force_and_unforce="no"
1519     exec 3<&0 <<LOOP_INPUT
1520         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1521         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1522         force="-Wl,-all";              unforce="-Wl,-none"
1523 LOOP_INPUT
1524     while read line
1525     do
1526       eval $line
1527       LDFLAGS=$force
1528       LIBS=$unforce
1529       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1530     done
1531     exec 0<&3 3<&-
1532     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1533    ])
1534   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1535     AC_MSG_RESULT(no)
1536   else
1537     AC_MSG_RESULT(yes)
1538     eval $ac_cv_mkshlib_force_and_unforce
1539     MKSHLIB_FORCE_ALL=$force
1540     MKSHLIB_UNFORCE_ALL=$unforce
1541   fi
1542 fi # GNU_CC
1543 fi # COMPILE_ENVIRONMENT
1545 dnl ========================================================
1546 dnl Checking for 64-bit OS
1547 dnl ========================================================
1548 if test "$COMPILE_ENVIRONMENT"; then
1549 AC_LANG_SAVE
1550 AC_LANG_C
1551 AC_MSG_CHECKING(for 64-bit OS)
1552 AC_TRY_COMPILE([$configure_static_assert_macros],
1553                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1554                result="yes", result="no")
1555 AC_MSG_RESULT("$result")
1556 if test "$result" = "yes"; then
1557     AC_DEFINE(HAVE_64BIT_OS)
1558     HAVE_64BIT_OS=1
1560 AC_SUBST(HAVE_64BIT_OS)
1561 AC_LANG_RESTORE
1562 fi # COMPILE_ENVIRONMENT
1564 dnl ========================================================
1565 dnl Enable high-memory support on OS/2 by default.
1566 dnl ========================================================
1567 MOZ_OS2_HIGH_MEMORY=1
1568 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1569 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1570     MOZ_OS2_HIGH_MEMORY=,
1571     MOZ_OS2_HIGH_MEMORY=1 )
1572 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1574 dnl ========================================================
1575 dnl = Use profiling compile flags
1576 dnl ========================================================
1577 MOZ_ARG_ENABLE_BOOL(profiling,
1578 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1579     MOZ_PROFILING=1,
1580     MOZ_PROFILING= )
1582 # For profiling builds keep the symbol information
1583 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1584     case "$OS_TARGET" in
1585     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1586         STRIP_FLAGS="--strip-debug"
1587         ;;
1588     esac
1591 dnl ========================================================
1592 dnl = Use incremental GC
1593 dnl ========================================================
1594 JSGC_INCREMENTAL=1
1595 MOZ_ARG_DISABLE_BOOL(gcincremental,
1596 [  --disable-gcincremental Disable incremental GC],
1597     JSGC_INCREMENTAL= )
1598 if test -n "$JSGC_INCREMENTAL"; then
1599     AC_DEFINE(JSGC_INCREMENTAL)
1602 dnl ========================================================
1603 dnl = Use generational GC
1604 dnl ========================================================
1605 MOZ_ARG_ENABLE_BOOL(gcgenerational,
1606 [  --enable-gcgenerational Enable generational GC],
1607     JSGC_GENERATIONAL=1,
1608     JSGC_GENERATIONAL= )
1609 if test -n "$JSGC_GENERATIONAL"; then
1610     AC_DEFINE(JSGC_GENERATIONAL)
1613 dnl ========================================================
1614 dnl = Perform moving GC stack rooting analysis
1615 dnl ========================================================
1616 MOZ_ARG_ENABLE_BOOL(root-analysis,
1617 [  --enable-root-analysis  Enable moving GC stack root analysis],
1618     JSGC_ROOT_ANALYSIS=1,
1619     JSGC_ROOT_ANALYSIS= )
1620 if test -n "$JSGC_ROOT_ANALYSIS"; then
1621     AC_DEFINE(JSGC_ROOT_ANALYSIS)
1624 dnl ========================================================
1625 dnl = Use exact stack rooting for GC
1626 dnl ========================================================
1627 MOZ_ARG_ENABLE_BOOL(exact-rooting,
1628 [  --enable-exact-rooting  Enable use of exact stack roots for GC],
1629     JSGC_USE_EXACT_ROOTING=1,
1630     JSGC_USE_EXACT_ROOTING= )
1631 if test -n "$JSGC_USE_EXACT_ROOTING"; then
1632     AC_DEFINE(JSGC_USE_EXACT_ROOTING)
1635 dnl ========================================================
1636 dnl = Use Valgrind
1637 dnl ========================================================
1638 MOZ_ARG_ENABLE_BOOL(valgrind,
1639 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
1640     MOZ_VALGRIND=1,
1641     MOZ_VALGRIND= )
1642 if test -n "$MOZ_VALGRIND"; then
1643     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1644         AC_MSG_ERROR(
1645             [--enable-valgrind specified but Valgrind is not installed]))
1646     AC_DEFINE(MOZ_VALGRIND)
1648 AC_SUBST(MOZ_VALGRIND)
1650 dnl ========================================================
1651 dnl jprof
1652 dnl ========================================================
1653 MOZ_ARG_ENABLE_BOOL(jprof,
1654 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1655     MOZ_JPROF=1,
1656     MOZ_JPROF= )
1657 if test -n "$MOZ_JPROF"; then
1658     MOZ_PROFILING=1
1659     AC_DEFINE(MOZ_JPROF)
1662 dnl ========================================================
1663 dnl SPS Profiler
1664 dnl ========================================================
1665 MOZ_ENABLE_PROFILER_SPS=1
1667 case "${OS_TARGET}" in
1668 Android)
1669     case "${CPU_ARCH}" in
1670     x86 | arm) ;;
1671     *)
1672         MOZ_ENABLE_PROFILER_SPS=
1673     esac
1674     ;;
1675 Linux)
1676     case "${CPU_ARCH}" in
1677     x86 | x86_64) ;;
1678     *)
1679         MOZ_ENABLE_PROFILER_SPS=
1680     esac
1681     ;;
1682 WINNT|Darwin) ;;
1684     MOZ_ENABLE_PROFILER_SPS=
1685     ;;
1686 esac
1688 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1689     AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1692 dnl ========================================================
1693 dnl shark
1694 dnl ========================================================
1695 MOZ_ARG_ENABLE_BOOL(shark,
1696 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
1697     MOZ_SHARK=1,
1698     MOZ_SHARK= )
1699 if test -n "$MOZ_SHARK"; then
1700     MOZ_PROFILING=1
1701     AC_DEFINE(MOZ_SHARK)
1704 dnl ========================================================
1705 dnl instruments
1706 dnl ========================================================
1707 MOZ_ARG_ENABLE_BOOL(instruments,
1708 [  --enable-instruments    Enable instruments remote profiling. Implies --enable-profiling.],
1709     MOZ_INSTRUMENTS=1,
1710     MOZ_INSTRUMENTS= )
1711 if test -n "$MOZ_INSTRUMENTS"; then
1712     MOZ_PROFILING=1
1713     AC_DEFINE(MOZ_INSTRUMENTS)
1716 dnl ========================================================
1717 dnl callgrind
1718 dnl ========================================================
1719 MOZ_ARG_ENABLE_BOOL(callgrind,
1720 [  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
1721     MOZ_CALLGRIND=1,
1722     MOZ_CALLGRIND= )
1723 if test -n "$MOZ_CALLGRIND"; then
1724     MOZ_PROFILING=1
1725     AC_DEFINE(MOZ_CALLGRIND)
1728 dnl ========================================================
1729 dnl vtune
1730 dnl ========================================================
1731 MOZ_ARG_ENABLE_BOOL(vtune,
1732 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
1733     MOZ_VTUNE=1,
1734     MOZ_VTUNE= )
1735 if test -n "$MOZ_VTUNE"; then
1736     MOZ_PROFILING=1
1737     AC_DEFINE(MOZ_VTUNE)
1740 dnl ========================================================
1741 dnl Profiling
1742 dnl ========================================================
1743 if test -n "$MOZ_PROFILING"; then
1744     AC_DEFINE(MOZ_PROFILING)
1747 dnl ========================================================
1748 dnl System overrides of the defaults for host
1749 dnl ========================================================
1750 case "$host" in
1751 *mingw*)
1752     if test -n "$_WIN32_MSVC"; then
1753         HOST_AR=lib
1754         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1755         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1756         HOST_RANLIB='echo ranlib'
1757     else
1758         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1759     fi
1760     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1761     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1762     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1763     HOST_BIN_SUFFIX=.exe
1764     case "$host" in
1765     *mingw*)
1766         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1767         ;;
1768     esac
1770     case "${host_cpu}" in
1771     i*86)
1772         if test -n "$_WIN32_MSVC"; then
1773             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1774         fi
1775         ;;
1776     x86_64)
1777         if test -n "$_WIN32_MSVC"; then
1778             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1779         fi
1780         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1781         ;;
1782     esac
1783     ;;
1785 *-darwin*)
1786     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1787     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1788     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1789     ;;
1791 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1792     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1793     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1794     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1795     ;;
1797 *os2*)
1798     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1799     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1800     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1801     HOST_BIN_SUFFIX=.exe
1802     MOZ_FIX_LINK_PATHS=
1803     ;;
1806     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1807     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1808     ;;
1809 esac
1811 dnl Check for using a custom <stdint.h> implementation
1812 dnl ========================================================
1813 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1814 if test "$MOZ_CUSTOM_STDINT_H"; then
1815   AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1816   AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1817 else
1818   AC_MSG_RESULT(none specified)
1821 dnl Get mozilla version from central milestone file
1822 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1823 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1825 dnl Get version of various core apps from the version files.
1826 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1828 if test -z "$FIREFOX_VERSION"; then
1829     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1832 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1833 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1834 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1836 MOZ_DOING_LTO(lto_is_enabled)
1838 dnl ========================================================
1839 dnl System overrides of the defaults for target
1840 dnl ========================================================
1842 case "$target" in
1843 *-aix*)
1844     AC_DEFINE(AIX)
1845     if test ! "$GNU_CC"; then
1846         if test ! "$HAVE_64BIT_OS"; then
1847             # Compiling with Visual Age C++ object model compat is the
1848             # default. To compile with object model ibm, add
1849             # AIX_OBJMODEL=ibm to .mozconfig.
1850             if test "$AIX_OBJMODEL" = "ibm"; then
1851                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1852             else
1853                 AIX_OBJMODEL=compat
1854             fi
1855         else
1856             AIX_OBJMODEL=compat
1857         fi
1858         AC_SUBST(AIX_OBJMODEL)
1859         DSO_LDOPTS='-qmkshrobj=1'
1860         DSO_CFLAGS='-qflag=w:w'
1861         DSO_PIC_CFLAGS=
1862         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1863         MOZ_FIX_LINK_PATHS=
1864         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1865         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1866         if test "$COMPILE_ENVIRONMENT"; then
1867             AC_LANG_SAVE
1868             AC_LANG_CPLUSPLUS
1869             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1870             AC_TRY_COMPILE([],
1871                 [#if (__IBMCPP__ < 900)
1872                  #error "Bad compiler"
1873                  #endif],
1874                 _BAD_COMPILER=,_BAD_COMPILER=1)
1875             if test -n "$_BAD_COMPILER"; then
1876                 AC_MSG_RESULT([no])
1877                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1878             else
1879                 AC_MSG_RESULT([yes])
1880             fi
1881             AC_LANG_RESTORE
1882             TARGET_COMPILER_ABI="ibmc"
1883             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1884             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1885         fi
1886     fi
1887     case "${target_os}" in
1888     aix4.1*)
1889         DLL_SUFFIX='_shr.a'
1890         ;;
1891     esac
1892     if test "$COMPILE_ENVIRONMENT"; then
1893         MOZ_CHECK_HEADERS(sys/inttypes.h)
1894     fi
1895     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1896     ;;
1898 *-darwin*)
1899     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1900     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1901     MOZ_OPTIMIZE_FLAGS="-O3"
1902     # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
1903     if test "$HAVE_64BIT_OS"; then
1904         MOZ_MEMORY=1
1905     fi
1906     DLL_SUFFIX=".dylib"
1907     DSO_LDOPTS=''
1908     STRIP_FLAGS="$STRIP_FLAGS -x -S"
1909     # Check whether we're targeting OS X or iOS
1910     AC_CACHE_CHECK(for iOS target,
1911                    ac_cv_ios_target,
1912                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
1913 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1914 #error not iOS
1915 #endif],
1916                                    [],
1917                                    ac_cv_ios_target="yes",
1918                                    ac_cv_ios_target="no")])
1919     if test "$ac_cv_ios_target" = "yes"; then
1920         AC_DEFINE(XP_IOS)
1921         AC_DEFINE(XP_DARWIN)
1922         _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1923     else
1924         AC_DEFINE(XP_MACOSX)
1925         AC_DEFINE(XP_DARWIN)
1926         _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1927         # The ExceptionHandling framework is needed for Objective-C exception
1928         # logging code in nsObjCExceptions.h. Currently we only use that in debug
1929         # builds.
1930         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1931     fi
1932     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1935     if test "x$lto_is_enabled" = "xyes"; then
1936         echo "Skipping -dead_strip because lto is enabled."
1937     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1938     dnl ===================================================================
1939     elif test "x$enable_dtrace" = "xyes"; then
1940         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1941     else
1942         dnl check for the presence of the -dead_strip linker flag
1943         AC_MSG_CHECKING([for -dead_strip option to ld])
1944         _SAVE_LDFLAGS=$LDFLAGS
1945         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1946         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1947         if test -n "$_HAVE_DEAD_STRIP" ; then
1948             AC_MSG_RESULT([yes])
1949             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1950         else
1951             AC_MSG_RESULT([no])
1952         fi
1954         LDFLAGS=$_SAVE_LDFLAGS
1955     fi
1957     dnl With newer linkers we need to pass -allow_heap_execute because of
1958     dnl Microsoft Silverlight (5.1.10411.0 at least).
1959     AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1960     _SAVE_LDFLAGS=$LDFLAGS
1961     LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1962     AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1963                 _HAVE_ALLOW_HEAP_EXECUTE=)
1964     if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1965         AC_MSG_RESULT([yes])
1966         MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1967     else
1968         AC_MSG_RESULT([no])
1969     fi
1970     LDFLAGS=$_SAVE_LDFLAGS
1972     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1973     ;;
1975 ia64*-hpux*)
1976     DLL_SUFFIX=".so"
1977     if test ! "$GNU_CC"; then
1978        DSO_LDOPTS='-b'
1979        DSO_CFLAGS=""
1980        DSO_PIC_CFLAGS=
1981        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1982        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1983        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1984     else
1985        DSO_LDOPTS='-b -E'
1986        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1987        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1988     fi
1989     MOZ_FIX_LINK_PATHS=
1990     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1991     AC_DEFINE(_LARGEFILE64_SOURCE)
1992     ;;
1994 *-hpux*)
1995     DLL_SUFFIX=".sl"
1996     if test ! "$GNU_CC"; then
1997         DSO_LDOPTS='-b -Wl,+s'
1998         DSO_CFLAGS=""
1999         DSO_PIC_CFLAGS="+Z"
2000         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2001         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2002         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2003     else
2004         DSO_LDOPTS='-b -E +s'
2005         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2006         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2007     fi
2008     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2009     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2010     ;;
2012 *-android*|*-linuxandroid*)
2013     AC_DEFINE(NO_PW_GECOS)
2014     no_x=yes
2015     if test -n "$gonkdir"; then
2016         _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2017         MOZ_B2G_RIL=1
2018         MOZ_B2G_BT=1
2019         MOZ_B2G_FM=1
2020     else
2021         _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2022         MOZ_LINKER=1
2023     fi
2024     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2026     MOZ_GFX_OPTIMIZE_MOBILE=1
2027     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2028     ;;
2030 *-*linux*)
2031     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2032     # Similarly for GNU_CXX and INTEL_CXX.
2033     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2034         # -Os has been broken on Intel's C/C++ compilers for quite a
2035         # while; Intel recommends against using it.
2036         MOZ_OPTIMIZE_FLAGS="-O2"
2037         MOZ_DEBUG_FLAGS="-g"
2038     elif test "$GNU_CC" -o "$GNU_CXX"; then
2039         case $GCC_VERSION in
2040         4.5.*)
2041             # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
2042             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2043         esac
2044         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2045         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2046         MOZ_DEBUG_FLAGS="-g"
2047     fi
2049     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2051     MOZ_MEMORY=1
2053     case "${target_cpu}" in
2054     alpha*)
2055         CFLAGS="$CFLAGS -mieee"
2056         CXXFLAGS="$CXXFLAGS -mieee"
2057     ;;
2058     i*86)
2059         USE_ELF_DYNSTR_GC=1
2060     ;;
2061     mips*)
2062         MOZ_DEBUG_FLAGS="-g" # We want inlining
2063     ;;
2064     esac
2066     if test -z "$MC"; then
2067         MC=mc.exe
2068     fi
2069     ;;
2070 *-mingw*)
2071     DSO_CFLAGS=
2072     DSO_PIC_CFLAGS=
2073     DLL_SUFFIX=.dll
2074     RC=rc.exe
2075     MC=mc.exe
2076     # certain versions of cygwin's makedepend barf on the
2077     # #include <string> vs -I./dist/include/string issue so don't use it
2078     if test -n "$GNU_CC"; then
2079         CC="$CC -mwindows"
2080         CXX="$CXX -mwindows"
2081         CPP="$CPP -mwindows"
2082         CFLAGS="$CFLAGS -mms-bitfields"
2083         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2084         DSO_LDOPTS='-shared'
2085         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2086         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2087         RC='$(WINDRES)'
2088         # Use static libgcc and libstdc++
2089         LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
2090         # Use temp file for windres (bug 213281)
2091         RCFLAGS='-O coff --use-temp-file'
2092         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2093         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2094         MOZ_FIX_LINK_PATHS=
2095         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxul -lxpcom_core -lmozalloc'
2096         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxul -lmozalloc'
2097         DLL_PREFIX=
2098         IMPORT_LIB_SUFFIX=dll.a
2100         # We use mix of both POSIX and Win32 printf format across the tree, so format
2101         # warnings are useless on mingw.
2102         MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2103         MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2104     else
2105         TARGET_COMPILER_ABI=msvc
2106         HOST_CC='$(CC)'
2107         HOST_CXX='$(CXX)'
2108         HOST_LD='$(LD)'
2109         if test "$AS_BIN"; then
2110             AS="$(basename "$AS_BIN")"
2111         fi
2112         AR='lib'
2113         AR_FLAGS='-NOLOGO -OUT:"$@"'
2114         AR_EXTRACT=
2115         RANLIB='echo not_ranlib'
2116         STRIP='echo not_strip'
2117         PKG_SKIP_STRIP=1
2118         XARGS=xargs
2119         ZIP=zip
2120         UNZIP=unzip
2121         DOXYGEN=:
2122         ASM_SUFFIX=asm
2123         OBJ_SUFFIX=obj
2124         LIB_SUFFIX=lib
2125         DLL_PREFIX=
2126         LIB_PREFIX=
2127         IMPORT_LIB_SUFFIX=lib
2128         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2129         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2130         MKSHLIB_FORCE_ALL=
2131         MKSHLIB_UNFORCE_ALL=
2132         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2133         _USE_CPP_INCLUDE_FLAG=1
2134         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2135         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2136         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2137         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2138         # khuey says we can safely ignore MSVC warning C4251
2139         # MSVC warning C4244 (implicit type conversion may lose data) warns
2140         # and requires workarounds for perfectly valid code.  Also, GCC/clang
2141         # don't warn about it by default. So for consistency/sanity, we turn
2142         # it off on MSVC, too.
2143         # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2144         # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2145         # MSVC warning C4482 warns when an enum value is refered specifing the
2146         # name of the enum itself.  This behavior is allowed in C++11, and the
2147         # warning has been removed in VS2012.
2148         # MSVC warning C4800 warns when a value is implicitly cast to bool,
2149         # because this also forces narrowing to a single byte, which can be a
2150         # perf hit.  But this matters so little in practice (and often we want
2151         # that behavior) that it's better to turn it off.
2152         # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2153         # on non-Western system locales even if it is in a comment.
2154         CFLAGS="$CFLAGS -wd4244 -wd4819"
2155         CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2156         # make 'foo == bar;' error out
2157         CFLAGS="$CFLAGS -we4553"
2158         CXXFLAGS="$CXXFLAGS -we4553"
2159         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2160         MOZ_DEBUG_FLAGS='-Zi'
2161         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2162         WARNINGS_AS_ERRORS='-WX'
2163         MOZ_OPTIMIZE_FLAGS='-O1'
2164         MOZ_FIX_LINK_PATHS=
2165         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2166         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2167         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2168         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2169         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2170         dnl For profile-guided optimization
2171         PROFILE_GEN_CFLAGS="-GL"
2172         PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2173         dnl XXX: PGO builds can fail with warnings treated as errors,
2174         dnl specifically "no profile data available" appears to be
2175         dnl treated as an error sometimes. This might be a consequence
2176         dnl of using WARNINGS_AS_ERRORS in some modules, combined
2177         dnl with the linker doing most of the work in the whole-program
2178         dnl optimization/PGO case. I think it's probably a compiler bug,
2179         dnl but we work around it here.
2180         PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2181         dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2182         dnl Probably also a compiler bug, but what can you do?
2183         PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2184         LDFLAGS="$LDFLAGS -DYNAMICBASE"
2185         if test "$_MSC_VER" -ge 1500; then
2186             dnl VS2008 or later supports SSSE3
2187             HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2188             AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
2189         fi
2190     fi
2191     AC_DEFINE(HAVE_SNPRINTF)
2192     AC_DEFINE(_WINDOWS)
2193     AC_DEFINE(WIN32)
2194     AC_DEFINE(XP_WIN)
2195     AC_DEFINE(XP_WIN32)
2196     AC_DEFINE(HW_THREADS)
2197     AC_DEFINE(STDC_HEADERS)
2198     AC_DEFINE(NEW_H, <new>)
2199     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2200     TARGET_MD_ARCH=win32
2201     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2202     BIN_SUFFIX='.exe'
2203     MOZ_USER_DIR="Mozilla"
2205     dnl Hardcode to win95 for now - cls
2206     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2208     dnl set NO_X11 defines here as the general check is skipped on win32
2209     no_x=yes
2210     AC_DEFINE(NO_X11)
2212     case "$host" in
2213     *-mingw*)
2214         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2215         if test -n "$L10NBASEDIR"; then
2216             L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2217         fi
2218         ;;
2219     esac
2221     case "$host" in
2222     *-mingw*)
2223         if test -z "$MOZ_TOOLS"; then
2224             AC_MSG_ERROR([MOZ_TOOLS is not set])
2225         fi
2226         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2227         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2228             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2229         fi
2230         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2231         if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2232             AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2233         fi
2234         ;;
2235     esac
2237     case "$host_os" in
2238     cygwin*|msvc*|mks*)
2239         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.])
2240         ;;
2241     esac
2243     case "$target" in
2244     i*86-*)
2245         if test "$HAVE_64BIT_OS"; then
2246             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2247         fi
2249         if test -n "$GNU_CC"; then
2250             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2251             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2252             LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2253         else
2254             AC_DEFINE(HAVE_STDCALL)
2255             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2256             LDFLAGS="$LDFLAGS -SAFESEH"
2257         fi
2259         AC_DEFINE(_X86_)
2260         ;;
2261     x86_64-*)
2262         if test -n "$_WIN32_MSVC"; then
2263             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2264         fi
2265         AC_DEFINE(_AMD64_)
2266         ;;
2267     *)
2268         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2269         ;;
2270     esac
2272     if test "$HAVE_64BIT_OS"; then
2273         AC_DEFINE(_WIN64)
2274     fi
2275     ;;
2277 *-netbsd*)
2278     DSO_CFLAGS=''
2279     CFLAGS="$CFLAGS -Dunix"
2280     CXXFLAGS="$CXXFLAGS -Dunix"
2281     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2282         DLL_SUFFIX=".so"
2283         DSO_PIC_CFLAGS='-fPIC -DPIC'
2284         DSO_LDOPTS='-shared'
2285         BIN_FLAGS='-Wl,--export-dynamic'
2286     else
2287         DSO_PIC_CFLAGS='-fPIC -DPIC'
2288         DLL_SUFFIX=".so.1.0"
2289         DSO_LDOPTS='-shared'
2290     fi
2291     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2292     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2293     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2294     if test "$LIBRUNPATH"; then
2295         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2296     fi
2297     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2298     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2299     ;;
2301 *-openbsd*)
2302     if test "$SO_VERSION"; then
2303         DLL_SUFFIX=".so.$SO_VERSION"
2304     else
2305         DLL_SUFFIX=".so.1.0"
2306     fi
2307     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2308     DSO_CFLAGS=''
2309     DSO_PIC_CFLAGS='-fPIC'
2310     DSO_LDOPTS='-shared -fPIC'
2311     if test "$LIBRUNPATH"; then
2312         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2313     fi
2314     ;;
2316 *-os2*)
2317     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2318     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2319     AC_DEFINE(OS2)
2320     AC_DEFINE(XP_OS2)
2321     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2322     AC_DEFINE(TCPV40HDRS)
2323     DLL_PREFIX=
2324     LIB_PREFIX=
2325     LIB_SUFFIX=lib
2326     BIN_SUFFIX=".exe"
2327     DLL_SUFFIX=".dll"
2328     IMPORT_LIB_SUFFIX=lib
2329     DSO_PIC_CFLAGS=
2330     AR=emxomfar
2331     AR_FLAGS='r $@'
2332     CFLAGS="$CFLAGS -Zomf"
2333     CXXFLAGS="$CXXFLAGS -Zomf"
2334     DSO_LDOPTS='-Zdll'
2335     BIN_FLAGS='-Zlinker /ST:0x100000'
2336     IMPLIB='emximp -o'
2337     FILTER='true'
2338     LDFLAGS='-Zmap'
2339     WARNINGS_AS_ERRORS='-Werror'
2340     MOZ_DEBUG_FLAGS="-g -fno-inline"
2341     MOZ_OPTIMIZE_FLAGS="-O2"
2342     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2343     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2344     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2345     TARGET_MD_ARCH=os2
2346     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2347     RC=rc.exe
2348     MC=mc.exe
2349     RCFLAGS='-n'
2350     MOZ_USER_DIR="Mozilla"
2351     ZIP="$ZIP -X"
2352     STRIP=lxlite
2353     STRIP_FLAGS="/yua /ydd /yxd /ynl /anp /b- /cs+ /d /i- /ml1 /mr2 /mf2 /r+ /u+ /x- /zs:0 /zx /zd"
2355     if test "$MOZTOOLS"; then
2356         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2357     else
2358         AC_MSG_ERROR([MOZTOOLS is not set])
2359     fi
2360     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2361         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2362         LDFLAGS="$LDFLAGS -Zhigh-mem"
2363         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2364         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2365     fi
2367     # GCC for OS/2 currently predefines these, but we don't want them
2368     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2369     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2371     AC_CACHE_CHECK(for __declspec(dllexport),
2372         ac_os2_declspec,
2373         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2374                         [return 0;],
2375                         ac_os2_declspec="yes",
2376                         ac_os2_declspec="no")])
2377     if test "$ac_os2_declspec" != "yes"; then
2378         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2379     fi
2380     ;;
2382 *-solaris*)
2383     AC_DEFINE(SOLARIS)
2384     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2385     MOZ_FIX_LINK_PATHS=
2386     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2387     # libraries one level up (e.g. libnspr4.so)
2388     if test "$SOLARIS_SUNPRO_CC"; then
2389        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2390        LIBS="-lCrun -lCstd -lc $LIBS"
2391        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2392        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2393        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2394        LDFLAGS="-xildoff $LDFLAGS"
2395        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2396            _SAVE_LDFLAGS=$LDFLAGS
2397            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2398            AC_TRY_LINK([#include <stdio.h>],
2399                        [printf("Hello World\n");],
2400                        ,
2401                        [LDFLAGS=$_SAVE_LDFLAGS])
2402        fi
2403        MOZ_OPTIMIZE_FLAGS="-xO4"
2404        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2405        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2406        MKSHLIB_FORCE_ALL='-z allextract'
2407        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2408        DSO_LDOPTS='-G'
2409        AR_LIST="$AR t"
2410        AR_EXTRACT="$AR x"
2411        AR_DELETE="$AR d"
2412        AR='$(CXX) -xar'
2413        AR_FLAGS='-o $@'
2414        AS='/usr/ccs/bin/as'
2415        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2416        AS_DASH_C_FLAG=''
2417        TARGET_COMPILER_ABI="sunc"
2418        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2419        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2420        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2421        AC_LANG_SAVE
2422        AC_LANG_CPLUSPLUS
2423        AC_TRY_COMPILE([],
2424            [#if (__SUNPRO_CC < 0x590)
2425            #error "Denied"
2426            #endif],
2427            _BAD_COMPILER=,_BAD_COMPILER=1)
2428        if test -n "$_BAD_COMPILER"; then
2429            _res="no"
2430            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2431        else
2432            _res="yes"
2433        fi
2434        AC_TRY_COMPILE([],
2435            [#if (__SUNPRO_CC >= 0x5100)
2436            #error "Sun C++ 5.10 or above"
2437            #endif],
2438            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2439        if test "$_ABOVE_SS12U1"; then
2440            # disable xannotate
2441            CXXFLAGS="$CXXFLAGS -xannotate=no"
2442        fi
2443        AC_MSG_RESULT([$_res])
2444        AC_LANG_RESTORE
2445     else
2446        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2447        LIBS="-lc $LIBS"
2448        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2449        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2450        ASFLAGS="$ASFLAGS -fPIC"
2451        DSO_LDOPTS='-shared'
2452        WARNINGS_AS_ERRORS='-Werror'
2453        _WARNINGS_CFLAGS=''
2454        _WARNINGS_CXXFLAGS=''
2455        if test "$OS_RELEASE" = "5.3"; then
2456            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2457        fi
2458     fi
2459     if test "$OS_RELEASE" = "5.5.1"; then
2460         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2461     fi
2462     ;;
2464 *-sunos*)
2465     DSO_LDOPTS='-Bdynamic'
2466     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2467     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2468     AC_DEFINE(SUNOS4)
2469     AC_DEFINE(SPRINTF_RETURNS_STRING)
2470     case "$(target_os)" in
2471     sunos4.1*)
2472         DLL_SUFFIX='.so.1.0'
2473         ;;
2474     esac
2475     ;;
2477 *-os2*)
2478     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2479     ;;
2481 esac
2483 AC_SUBST(MOZ_LINKER)
2484 if test -n "$MOZ_LINKER"; then
2485   AC_DEFINE(MOZ_LINKER)
2488 dnl Only one oddball right now (QNX), but this gives us flexibility
2489 dnl if any other platforms need to override this in the future.
2490 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2492 dnl ========================================================
2493 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2494 dnl by now will not have any way to link most binaries (tests
2495 dnl as well as viewer, apprunner, etc.), because some symbols
2496 dnl will be left out of the "composite" .so's by ld as unneeded.
2497 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2498 dnl they can link in the static libs that provide the missing
2499 dnl symbols.
2500 dnl ========================================================
2501 NO_LD_ARCHIVE_FLAGS=
2502 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2503     NO_LD_ARCHIVE_FLAGS=1
2505 case "$target" in
2506 *-os2*)
2507     NO_LD_ARCHIVE_FLAGS=
2508     ;;
2509 *-aix4.3*|*-aix5*)
2510     NO_LD_ARCHIVE_FLAGS=
2511     ;;
2512 *-mingw*)
2513     if test -z "$GNU_CC"; then
2514         NO_LD_ARCHIVE_FLAGS=
2515     fi
2516     ;;
2517 esac
2518 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2520 dnl ========================================================
2521 dnl = Flags to strip unused symbols from .so components and
2522 dnl = to export jemalloc symbols when linking a program
2523 dnl ========================================================
2524 case "$target" in
2525     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2526         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2527         ;;
2528     *-solaris*)
2529         if test -z "$GNU_CC"; then
2530          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2531         else
2532          if test -z "$GCC_USE_GNU_LD"; then
2533           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2534          else
2535           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2536          fi
2537         fi
2538         ;;
2539     *-darwin*)
2540         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2541         ;;
2542     *-mingw*)
2543         if test -n "$GNU_CC"; then
2544            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2545         fi
2546         ;;
2547 esac
2549 if test -z "$COMPILE_ENVIRONMENT"; then
2550     SKIP_COMPILER_CHECKS=1
2551     SKIP_LIBRARY_CHECKS=1
2554 MOZ_COMPILER_OPTS
2555 if test -z "$SKIP_COMPILER_CHECKS"; then
2556 dnl Checks for typedefs, structures, and compiler characteristics.
2557 dnl ========================================================
2558 AC_HEADER_STDC
2559 AC_C_CONST
2560 AC_TYPE_MODE_T
2561 AC_TYPE_OFF_T
2562 AC_TYPE_PID_T
2563 AC_TYPE_SIZE_T
2564 AC_LANG_CPLUSPLUS
2565 AC_MSG_CHECKING(for __stdcall)
2566 AC_CACHE_VAL(ac_cv___stdcall,
2567  [AC_TRY_COMPILE([template <typename Method> struct foo;
2568                   template <> struct foo<void (*)()> {};
2569                   template <> struct foo<void (__stdcall*)()> {};],
2570                  [],
2571                  [ac_cv___stdcall=true],
2572                  [ac_cv___stdcall=false])])
2573 if test "$ac_cv___stdcall" = true ; then
2574   AC_DEFINE(HAVE_STDCALL)
2575   AC_MSG_RESULT(yes)
2576 else
2577   AC_MSG_RESULT(no)
2579 AC_LANG_C
2580 AC_MSG_CHECKING(for ssize_t)
2581 AC_CACHE_VAL(ac_cv_type_ssize_t,
2582  [AC_TRY_COMPILE([#include <stdio.h>
2583                   #include <sys/types.h>],
2584                  [ssize_t foo = 0;],
2585                  [ac_cv_type_ssize_t=true],
2586                  [ac_cv_type_ssize_t=false])])
2587 if test "$ac_cv_type_ssize_t" = true ; then
2588   AC_DEFINE(HAVE_SSIZE_T)
2589   AC_MSG_RESULT(yes)
2590 else
2591   AC_MSG_RESULT(no)
2593 AC_STRUCT_ST_BLKSIZE
2594 AC_MSG_CHECKING(for siginfo_t)
2595 AC_CACHE_VAL(ac_cv_siginfo_t,
2596  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2597                   #include <signal.h>],
2598                  [siginfo_t* info;],
2599                  [ac_cv_siginfo_t=true],
2600                  [ac_cv_siginfo_t=false])])
2601 if test "$ac_cv_siginfo_t" = true ; then
2602   AC_DEFINE(HAVE_SIGINFO_T)
2603   AC_MSG_RESULT(yes)
2604 else
2605   AC_MSG_RESULT(no)
2608 dnl Check for int64, uint, and uint_t.
2609 dnl ========================================================
2610 AC_MSG_CHECKING(for int64)
2611 AC_CACHE_VAL(ac_cv_int64,
2612  [AC_TRY_COMPILE([#include <stdio.h>
2613                   #include <sys/types.h>],
2614                  [int64 foo = 0;],
2615                  [ac_cv_int64=true],
2616                  [ac_cv_int64=false])])
2617 if test "$ac_cv_int64" = true ; then
2618   AC_DEFINE(HAVE_INT64)
2619   AC_MSG_RESULT(yes)
2620 else
2621   AC_MSG_RESULT(no)
2623 AC_MSG_CHECKING(for uint)
2624 AC_CACHE_VAL(ac_cv_uint,
2625  [AC_TRY_COMPILE([#include <stdio.h>
2626                   #include <sys/types.h>],
2627                  [uint foo = 0;],
2628                  [ac_cv_uint=true],
2629                  [ac_cv_uint=false])])
2630 if test "$ac_cv_uint" = true ; then
2631   AC_DEFINE(HAVE_UINT)
2632   AC_MSG_RESULT(yes)
2633 else
2634   AC_MSG_RESULT(no)
2636 AC_MSG_CHECKING(for uint_t)
2637 AC_CACHE_VAL(ac_cv_uint_t,
2638  [AC_TRY_COMPILE([#include <stdio.h>
2639                   #include <sys/types.h>],
2640                  [uint_t foo = 0;],
2641                  [ac_cv_uint_t=true],
2642                  [ac_cv_uint_t=false])])
2643 if test "$ac_cv_uint_t" = true ; then
2644   AC_DEFINE(HAVE_UINT_T)
2645   AC_MSG_RESULT(yes)
2646 else
2647   AC_MSG_RESULT(no)
2650 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2651 dnl are defined when compiling C++ but not C.  Since the result of this
2652 dnl test is used only in C++, do it in C++.
2653 AC_LANG_CPLUSPLUS
2655 AC_MSG_CHECKING(for uname.domainname)
2656 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2657     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2658         [ struct utsname *res; char *domain;
2659             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2660         [ac_cv_have_uname_domainname_field=true],
2661         [ac_cv_have_uname_domainname_field=false])])
2663 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2664     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2665     AC_MSG_RESULT(yes)
2666 else
2667     AC_MSG_RESULT(no)
2670 AC_MSG_CHECKING(for uname.__domainname)
2671 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2672     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2673         [ struct utsname *res; char *domain;
2674             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2675         [ac_cv_have_uname_us_domainname_field=true],
2676         [ac_cv_have_uname_us_domainname_field=false])])
2678 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2679     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2680     AC_MSG_RESULT(yes)
2681 else
2682     AC_MSG_RESULT(no)
2685 dnl Check whether we can use gcc's c++0x mode
2686 AC_LANG_CPLUSPLUS
2688 if test "$GNU_CXX"; then
2689     _SAVE_CXXFLAGS=$CXXFLAGS
2690     CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2692     AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2693         ac_cv_cxx0x_headers_bug,
2694         [AC_TRY_COMPILE([#include <memory>], [],
2695                         ac_cv_cxx0x_headers_bug="no",
2696                         ac_cv_cxx0x_headers_bug="yes")])
2698     if test "$CLANG_CXX" -a "$ac_cv_cxx0x_headers_bug" = "yes"; then
2699         CXXFLAGS="$CXXFLAGS -I$_topsrcdir/build/unix/headers"
2700         AC_CACHE_CHECK(whether workaround for gcc c++0x headers conflict with clang works,
2701             ac_cv_cxx0x_clang_workaround,
2702             [AC_TRY_COMPILE([#include <memory>], [],
2703                             ac_cv_cxx0x_clang_workaround="yes",
2704                             ac_cv_cxx0x_clang_workaround="no")])
2706         if test "ac_cv_cxx0x_clang_workaround" = "no"; then
2707             CXXFLAGS="$_SAVE_CXXFLAGS"
2708         fi
2709     elif test "$ac_cv_cxx0x_headers_bug" = "yes"; then
2710         CXXFLAGS="$_SAVE_CXXFLAGS"
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 When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3685     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3686       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3687       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3688     fi
3689   fi
3692 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3693 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3694 dnl We however want to avoid these text relocations, and this can be done
3695 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3696 dnl doesn't contain anything at all, beside placeholders for some sections,
3697 dnl and crtbegin only contains a finalizer function that calls
3698 dnl __cxa_finalize. The custom linker actually takes care of calling
3699 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3700 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3701 dnl link crtbegin and crtend at all.
3702 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3703   AC_CACHE_CHECK([whether the CRT objects have text relocations],
3704     ac_cv_crt_has_text_relocations,
3705     [echo 'int foo() { return 0; }' > conftest.cpp
3706      if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3707         test -s conftest${DLL_SUFFIX}; then
3708        if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3709          ac_cv_crt_has_text_relocations=yes
3710        else
3711          ac_cv_crt_has_text_relocations=no
3712        fi
3713      else
3714        AC_ERROR([couldn't compile a simple C file])
3715      fi
3716      rm -rf conftest*])
3717   if test "$ac_cv_crt_has_text_relocations" = yes; then
3718     dnl While we want libraries to skip the CRT files, we don't want
3719     dnl executables to be treated the same way. We thus set the flag
3720     dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3721     dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3722     dnl Using LDFLAGS in nspr is safe, since we only really build
3723     dnl libraries there.
3724     DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3725     NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3726   fi
3729 dnl Check for the existence of various allocation headers/functions
3731 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3732 MALLOC_H=
3734 for file in $MALLOC_HEADERS; do
3735   MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3736   if test "$MALLOC_H" != ""; then
3737     AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3738     break
3739   fi
3740 done
3742 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3743 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3745 AC_CHECK_FUNCS(malloc_usable_size)
3747 dnl See if compiler supports some gcc-style attributes
3749 AC_CACHE_CHECK(for __attribute__((always_inline)),
3750                ac_cv_attribute_always_inline,
3751                [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3752                                [],
3753                                ac_cv_attribute_always_inline=yes,
3754                                ac_cv_attribute_always_inline=no)])
3756 AC_CACHE_CHECK(for __attribute__((malloc)),
3757                ac_cv_attribute_malloc,
3758                [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3759                                [],
3760                                ac_cv_attribute_malloc=yes,
3761                                ac_cv_attribute_malloc=no)])
3763 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3764                ac_cv_attribute_warn_unused,
3765                [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3766                                [],
3767                                ac_cv_attribute_warn_unused=yes,
3768                                ac_cv_attribute_warn_unused=no)])
3770 dnl End of C++ language/feature checks
3771 AC_LANG_C
3773 dnl ========================================================
3774 dnl =  Internationalization checks
3775 dnl ========================================================
3777 dnl Internationalization and Locale support is different
3778 dnl on various UNIX platforms.  Checks for specific i18n
3779 dnl features go here.
3781 dnl check for LC_MESSAGES
3782 AC_CACHE_CHECK(for LC_MESSAGES,
3783                 ac_cv_i18n_lc_messages,
3784                 [AC_TRY_COMPILE([#include <locale.h>],
3785                                 [int category = LC_MESSAGES;],
3786                                 ac_cv_i18n_lc_messages=yes,
3787                                 ac_cv_i18n_lc_messages=no)])
3788 if test "$ac_cv_i18n_lc_messages" = yes; then
3789    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3792 AC_HAVE_FUNCS(localeconv)
3793 fi # ! SKIP_COMPILER_CHECKS
3795 TARGET_XPCOM_ABI=
3796 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3797     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3800 dnl Mozilla specific options
3801 dnl ========================================================
3802 dnl The macros used for command line options
3803 dnl are defined in build/autoconf/altoptions.m4.
3805 dnl If the compiler supports these attributes, define them as
3806 dnl convenience macros.
3807 if test "$ac_cv_attribute_malloc" = yes ; then
3808   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3809 else
3810   AC_DEFINE(NS_ATTR_MALLOC,)
3813 if test "$ac_cv_attribute_warn_unused" = yes ; then
3814   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3815 else
3816   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3819 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3820 dnl features that Windows actually does support.
3822 if test -n "$SKIP_COMPILER_CHECKS"; then
3823    dnl Windows has malloc.h
3824    AC_DEFINE(MALLOC_H, [<malloc.h>])
3825    AC_DEFINE(HAVE_FORCEINLINE)
3826    AC_DEFINE(HAVE_LOCALECONV)
3827 fi # SKIP_COMPILER_CHECKS
3829 dnl ========================================================
3830 dnl =
3831 dnl = Check for external package dependencies
3832 dnl =
3833 dnl ========================================================
3834 MOZ_ARG_HEADER(External Packages)
3836 MOZ_ARG_WITH_STRING(libxul-sdk,
3837 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
3838   LIBXUL_SDK_DIR=$withval)
3840 if test "$LIBXUL_SDK_DIR" = "yes"; then
3841     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3842 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3843     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3845     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3846         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3847     fi
3850 AC_SUBST(LIBXUL_SDK)
3852 if test -n "$LIBXUL_SDK"; then
3853     LIBXUL_DIST="$LIBXUL_SDK"
3854 else
3855     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3857 AC_SUBST(LIBXUL_DIST)
3859 SYSTEM_LIBXUL=
3861 MOZ_ARG_WITH_BOOL(system-libxul,
3862 [  --with-system-libxul    Use system installed libxul SDK],
3863     SYSTEM_LIBXUL=1)
3865 dnl ========================================================
3866 dnl = If NSPR was not detected in the system,
3867 dnl = use the one in the source tree (mozilla/nsprpub)
3868 dnl ========================================================
3869 MOZ_ARG_WITH_BOOL(system-nspr,
3870 [  --with-system-nspr      Use system installed NSPR],
3871     _USE_SYSTEM_NSPR=1 )
3873 if test -n "$_USE_SYSTEM_NSPR"; then
3874     AM_PATH_NSPR(4.9.6, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
3877 if test -n "$MOZ_NATIVE_NSPR"; then
3878     _SAVE_CFLAGS=$CFLAGS
3879     CFLAGS="$CFLAGS $NSPR_CFLAGS"
3880     AC_TRY_COMPILE([#include "prtypes.h"],
3881                 [#ifndef PR_STATIC_ASSERT
3882                  #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3883                  #endif],
3884                 [MOZ_NATIVE_NSPR=1],
3885                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3886     AC_TRY_COMPILE([#include "prtypes.h"],
3887                 [#ifndef PR_UINT64
3888                  #error PR_UINT64 not defined or requires including prtypes.h
3889                  #endif],
3890                 [MOZ_NATIVE_NSPR=1],
3891                 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3892     CFLAGS=$_SAVE_CFLAGS
3893 else
3894     if test -z "$LIBXUL_SDK"; then
3895         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3896         if test -n "$GNU_CC"; then
3897             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3898         else
3899             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3900         fi
3901     else
3902         NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3903         NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3904     fi
3907 dnl set GRE_MILESTONE
3908 dnl ========================================================
3909 if test -n "$LIBXUL_SDK"; then
3910     GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3911 else
3912     GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3914 AC_SUBST(GRE_MILESTONE)
3916 dnl system libevent Support
3917 dnl ========================================================
3918 MOZ_ARG_WITH_STRING(system-libevent,
3919 [  --with-system-libevent[=PFX]
3920                           Use system libevent [installed at prefix PFX]],
3921     LIBEVENT_DIR=$withval)
3923 _SAVE_CFLAGS=$CFLAGS
3924 _SAVE_LDFLAGS=$LDFLAGS
3925 _SAVE_LIBS=$LIBS
3926 if test "$LIBEVENT_DIR" = yes; then
3927     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3928         MOZ_NATIVE_LIBEVENT=1,
3929         LIBEVENT_DIR=/usr)
3931 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3932     MOZ_NATIVE_LIBEVENT=
3933 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3934     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3935     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3936     MOZ_CHECK_HEADER(event.h,
3937         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3938              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3939          fi],
3940         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3941     AC_CHECK_LIB(event, event_init,
3942                  [MOZ_NATIVE_LIBEVENT=1
3943                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3944                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3945                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3947 CFLAGS=$_SAVE_CFLAGS
3948 LDFLAGS=$_SAVE_LDFLAGS
3949 LIBS=$_SAVE_LIBS
3951 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3952 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
3953 AC_SUBST(MOZ_LIBEVENT_LIBS)
3955 dnl ========================================================
3956 dnl = If NSS was not detected in the system,
3957 dnl = use the one in the source tree (mozilla/security/nss)
3958 dnl ========================================================
3960 MOZ_ARG_WITH_BOOL(system-nss,
3961 [  --with-system-nss       Use system installed NSS],
3962     _USE_SYSTEM_NSS=1 )
3964 if test -n "$_USE_SYSTEM_NSS"; then
3965     AM_PATH_NSS(3.15, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3968 if test -n "$MOZ_NATIVE_NSS"; then
3969    NSS_LIBS="$NSS_LIBS -lcrmf"
3970 else
3971    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3973    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
3974        NSS_LIBS="\
3975         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3976         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3977         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3978         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3979         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3980    else
3981        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3982    fi
3985 dnl ======================
3986 dnl Detect yasm
3987 dnl ======================
3989 AC_MSG_CHECKING([for YASM assembler])
3990 AC_CHECK_PROGS(YASM, yasm, "")
3992 if test -n "$YASM"; then
3993   dnl Pull out yasm's version string
3994   YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3995   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3996   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3997   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3998   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4001 if test -z "$SKIP_LIBRARY_CHECKS"; then
4002 dnl system JPEG support
4003 dnl ========================================================
4004 MOZ_ARG_WITH_STRING(system-jpeg,
4005 [  --with-system-jpeg[=PFX]
4006                           Use system libjpeg [installed at prefix PFX]],
4007     JPEG_DIR=$withval)
4009 _SAVE_CFLAGS=$CFLAGS
4010 _SAVE_LDFLAGS=$LDFLAGS
4011 _SAVE_LIBS=$LIBS
4012 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4013     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4014     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4016 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4017     MOZ_NATIVE_JPEG=
4018 else
4019     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
4022 if test "$MOZ_NATIVE_JPEG" = 1; then
4023     AC_TRY_COMPILE([ #include <stdio.h>
4024                      #include <sys/types.h>
4025                      #include <jpeglib.h> ],
4026                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4027                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4028                      #endif
4029                      #ifndef JCS_EXTENSIONS
4030                      #error "libjpeg-turbo JCS_EXTENSIONS required"
4031                      #endif
4032                      ],
4033                    MOZ_NATIVE_JPEG=1,
4034                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
4036 CFLAGS=$_SAVE_CFLAGS
4037 LDFLAGS=$_SAVE_LDFLAGS
4038 LIBS=$_SAVE_LIBS
4040 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
4041     MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
4042     MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
4044 fi # SKIP_LIBRARY_CHECKS
4046 dnl system ZLIB support
4047 dnl ========================================================
4048 MOZ_ZLIB_CHECK([1.2.3])
4050 if test "$MOZ_NATIVE_ZLIB" != 1; then
4051     MOZ_ZLIB_CFLAGS=
4052     MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
4055 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
4056     AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4059 if test -z "$SKIP_LIBRARY_CHECKS"; then
4060 dnl system BZIP2 Support
4061 dnl ========================================================
4062 MOZ_ARG_WITH_STRING(system-bz2,
4063 [  --with-system-bz2[=PFX]
4064                           Use system libbz2 [installed at prefix PFX]],
4065     BZ2_DIR=$withval)
4067 _SAVE_CFLAGS=$CFLAGS
4068 _SAVE_LDFLAGS=$LDFLAGS
4069 _SAVE_LIBS=$LIBS
4070 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4071     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4072     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4074 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4075     MOZ_NATIVE_BZ2=
4076 else
4077     AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
4078         [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
4080 CFLAGS=$_SAVE_CFLAGS
4081 LDFLAGS=$_SAVE_LDFLAGS
4082 LIBS=$_SAVE_LIBS
4084 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
4085     MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
4086     MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4089 dnl system PNG Support
4090 dnl ========================================================
4091 MOZ_ARG_WITH_STRING(system-png,
4092 [  --with-system-png[=PFX]
4093                           Use system libpng [installed at prefix PFX]],
4094     PNG_DIR=$withval)
4096 _SAVE_CFLAGS=$CFLAGS
4097 _SAVE_LDFLAGS=$LDFLAGS
4098 _SAVE_LIBS=$LIBS
4099 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4100     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4101     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4103 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4104     MOZ_NATIVE_PNG=
4105 else
4106     AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
4107                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4108     AC_CHECK_LIB(png, png_get_acTL, ,
4109                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
4111 if test "$MOZ_NATIVE_PNG" = 1; then
4112     AC_TRY_COMPILE([ #include <stdio.h>
4113                      #include <sys/types.h>
4114                      #include <png.h> ],
4115                    [ #if PNG_LIBPNG_VER < $MOZPNG
4116                      #error "Insufficient libpng version ($MOZPNG required)."
4117                      #endif
4118                      #ifndef PNG_UINT_31_MAX
4119                      #error "Insufficient libpng version."
4120                      #endif ],
4121                    MOZ_NATIVE_PNG=1,
4122                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4124 CFLAGS=$_SAVE_CFLAGS
4125 LDFLAGS=$_SAVE_LDFLAGS
4126 LIBS=$_SAVE_LIBS
4128 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
4129     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
4130     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
4133 fi # SKIP_LIBRARY_CHECKS
4135 dnl system HunSpell Support
4136 dnl ========================================================
4137 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4138 [  --enable-system-hunspell
4139                           Use system hunspell (located with pkgconfig)],
4140     MOZ_NATIVE_HUNSPELL=1 )
4142 if test -n "$MOZ_NATIVE_HUNSPELL"; then
4143     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4146 AC_SUBST(MOZ_NATIVE_HUNSPELL)
4148 dnl ========================================================
4149 dnl system libffi Support
4150 dnl ========================================================
4151 MOZ_ARG_ENABLE_BOOL(system-ffi,
4152 [  --enable-system-ffi       Use system libffi (located with pkgconfig)],
4153     MOZ_NATIVE_FFI=1 )
4155 if test -n "$MOZ_NATIVE_FFI"; then
4156     # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4157     # for non-GCC compilers.
4158     if test -z "$GNU_CC"; then
4159         PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4160     else
4161         PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4162     fi
4163     MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4166 dnl ========================================================
4167 dnl Java SDK support
4168 dnl ========================================================
4170 JAVA_BIN_PATH=
4171 MOZ_ARG_WITH_STRING(java-bin-path,
4172 [  --with-java-bin-path=dir
4173                           Location of Java binaries (java, javac, jar)],
4174     JAVA_BIN_PATH=$withval)
4176 dnl ========================================================
4177 dnl =
4178 dnl = Application
4179 dnl =
4180 dnl ========================================================
4182 MOZ_ARG_HEADER(Application)
4184 ENABLE_TESTS=1
4185 ENABLE_SYSTEM_EXTENSION_DIRS=1
4186 MOZ_BRANDING_DIRECTORY=
4187 MOZ_OFFICIAL_BRANDING=
4188 MOZ_FEEDS=1
4189 MOZ_FLEXBOX=1
4190 MOZ_WEBAPP_RUNTIME=
4191 MOZ_JSDEBUGGER=1
4192 MOZ_AUTH_EXTENSION=1
4193 MOZ_OGG=1
4194 MOZ_RAW=
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_OPUS=1
4204 MOZ_WEBM=1
4205 MOZ_DASH=
4206 MOZ_WMF=
4207 MOZ_WEBRTC=1
4208 MOZ_PEERCONNECTION=
4209 MOZ_SRTP=
4210 MOZ_WEBRTC_SIGNALING=
4211 MOZ_WEBRTC_IN_LIBXUL=
4212 MOZ_WEBRTC_ASSERT_ALWAYS=1
4213 MOZ_SCTP=
4214 MOZ_MEDIA_PLUGINS=
4215 MOZ_MEDIA_NAVIGATOR=
4216 MOZ_OMX_PLUGIN=
4217 MOZ_VP8=
4218 MOZ_VP8_ERROR_CONCEALMENT=
4219 MOZ_VP8_ENCODER=
4220 MOZ_WEBSPEECH=1
4221 VPX_AS=
4222 VPX_ASFLAGS=
4223 VPX_AS_DASH_C_FLAG=
4224 VPX_AS_CONVERSION=
4225 VPX_ASM_SUFFIX=
4226 VPX_X86_ASM=
4227 VPX_ARM_ASM=
4228 LIBJPEG_TURBO_AS=
4229 LIBJPEG_TURBO_ASFLAGS=
4230 LIBJPEG_TURBO_X86_ASM=
4231 LIBJPEG_TURBO_X64_ASM=
4232 LIBJPEG_TURBO_ARM_ASM=
4233 MOZ_PANGO=1
4234 MOZ_PERMISSIONS=1
4235 MOZ_PLACES=1
4236 MOZ_PREF_EXTENSIONS=1
4237 MOZ_PROFILELOCKING=1
4238 MOZ_PSM=1
4239 MOZ_REFLOW_PERF=
4240 MOZ_SAFE_BROWSING=
4241 MOZ_HELP_VIEWER=
4242 MOZ_SPELLCHECK=1
4243 MOZ_ANDROID_OMTC=
4244 MOZ_ONLY_TOUCH_EVENTS=
4245 MOZ_TOOLKIT_SEARCH=1
4246 MOZ_UI_LOCALE=en-US
4247 MOZ_UNIVERSALCHARDET=1
4248 MOZ_URL_CLASSIFIER=
4249 MOZ_XUL=1
4250 MOZ_ZIPWRITER=1
4251 NS_PRINTING=1
4252 MOZ_PDF_PRINTING=
4253 MOZ_DISABLE_CRYPTOLEGACY=
4254 NSS_DISABLE_DBM=
4255 NECKO_WIFI=1
4256 NECKO_COOKIES=1
4257 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4258 USE_ARM_KUSER=
4259 BUILD_CTYPES=1
4260 MOZ_USE_NATIVE_POPUP_WINDOWS=
4261 MOZ_ANDROID_HISTORY=
4262 MOZ_WEBSMS_BACKEND=
4263 MOZ_ANDROID_WALLPAPER=
4264 MOZ_ANDROID_BEAM=
4265 ACCESSIBILITY=1
4266 MOZ_SYS_MSG=
4267 MOZ_TIME_MANAGER=
4268 MOZ_PAY=
4269 MOZ_AUDIO_CHANNEL_MANAGER=
4270 NSS_NO_LIBPKIX=
4272 case "$target_os" in
4273     mingw*)
4274         NS_ENABLE_TSF=1
4275         AC_DEFINE(NS_ENABLE_TSF)
4276         ;;
4277 esac
4279 case "${target}" in
4280     *-android*|*-linuxandroid*)
4281         if test "$CPU_ARCH" = "arm" ; then
4282           USE_ARM_KUSER=1
4283         fi
4285         NSS_DISABLE_DBM=1
4286         if test -z "$gonkdir"; then
4287           NECKO_WIFI=
4288         else
4289           NECKO_WIFI=1
4290         fi
4291         MOZ_THEME_FASTSTRIPE=1
4292         MOZ_TREE_FREETYPE=1
4293         MOZ_MEMORY=1
4294         MOZ_RAW=1
4295         ;;
4297 esac
4299 MOZ_ARG_WITH_STRING(external-source-dir,
4300 [  --with-external-source-dir=dir
4301                           External directory containing additional build files.],
4302 [ EXTERNAL_SOURCE_DIR=$withval])
4303 AC_SUBST(EXTERNAL_SOURCE_DIR)
4305 MOZ_ARG_ENABLE_STRING(application,
4306 [  --enable-application=APP
4307                           Options include:
4308                             browser (Firefox)
4309                             xulrunner
4310                             tools/update-packaging (AUS-related packaging tools)],
4311 [ MOZ_BUILD_APP=$enableval ] )
4313 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4314 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4315   XULRUNNER_STUB_NAME=$withval)
4317 if test -z "$XULRUNNER_STUB_NAME"; then
4318   case "$target_os" in
4319   darwin*)
4320     XULRUNNER_STUB_NAME=xulrunner
4321     ;;
4322   *)
4323     XULRUNNER_STUB_NAME=xulrunner-stub
4324   esac
4326 AC_SUBST(XULRUNNER_STUB_NAME)
4328 AC_MSG_CHECKING([for application to build])
4329 if test -z "$MOZ_BUILD_APP"; then
4330   AC_MSG_RESULT([browser])
4331   MOZ_BUILD_APP=browser
4332 else
4333   # "mobile" no longer exists.
4334   if test "$MOZ_BUILD_APP" = "mobile" ; then
4335     AC_MSG_RESULT([none])
4336     AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
4337   fi
4338   # We have a valid application only if it has a build.mk file in its top
4339   # directory.
4340   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4341     AC_MSG_RESULT([none])
4342     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4343   else
4344     AC_MSG_RESULT([$MOZ_BUILD_APP])
4345   fi
4348 # The app update channel is 'default' when not supplied. The value is used in
4349 # the application's confvars.sh so it must be set before confvars.sh is called.
4350 MOZ_ARG_ENABLE_STRING([update-channel],
4351 [  --enable-update-channel=CHANNEL
4352                           Select application update channel (default=default)],
4353     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4355 if test -z "$MOZ_UPDATE_CHANNEL"; then
4356     MOZ_UPDATE_CHANNEL=default
4358 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4359 AC_SUBST(MOZ_UPDATE_CHANNEL)
4361 # Allow the application to influence configure with a confvars.sh script.
4363 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4364 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4365   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4366   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4367 else
4368   AC_MSG_RESULT([no])
4371 # Allow the application to provide a subconfigure script
4372 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4373   do_output_subdirs() {
4374     if test -n "$_subconfigure_subdirs"; then
4375       AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4376      fi
4377     _subconfigure_subdir="$1"
4378     _subconfigure_config_args="$ac_configure_args"
4379   }
4380   tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4381   m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4382      "${srcdir}/build/autoconf/altoptions.m4" \
4383      "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4384   . $tmpscript
4385   rm -f $tmpscript
4388 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4389 MOZ_ARG_WITH_STRING(app-name,
4390 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4391 WITH_APP_NAME=$withval,
4394 if test -n "$WITH_APP_NAME" ; then
4395     MOZ_APP_NAME="$WITH_APP_NAME"
4398 MOZ_ARG_WITH_STRING(app-basename,
4399 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4400 WITH_APP_BASENAME=$withval,
4403 if test -n "$WITH_APP_BASENAME" ; then
4404     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4407 # Now is a good time to test for logic errors, define mismatches, etc.
4408 case "$MOZ_BUILD_APP" in
4409 xulrunner)
4410   if test "$LIBXUL_SDK"; then
4411     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4412   fi
4413   ;;
4414 esac
4416 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4417 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4418 # MOZ_BUILD_APP.
4419 case "$MOZ_BUILD_APP" in
4420 browser)
4421   AC_DEFINE(MOZ_PHOENIX)
4422   ;;
4424 xulrunner)
4425   AC_DEFINE(MOZ_XULRUNNER)
4426   ;;
4427 b2g)
4428   AC_DEFINE(MOZ_B2G)
4429   ;;
4430 esac
4432 AC_SUBST(MOZ_BUILD_APP)
4433 AC_SUBST(MOZ_PHOENIX)
4434 AC_SUBST(MOZ_XULRUNNER)
4435 AC_SUBST(MOZ_B2G)
4437 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4439 dnl ========================================================
4440 dnl Check android sdk version depending on mobile target
4441 dnl ========================================================
4443 if test -z "$gonkdir" ; then
4444     # Minimum Android SDK API Level we require.
4445     case "$MOZ_BUILD_APP" in
4446     mobile/android)
4447         android_min_api_level=16
4448         ;;
4449     esac
4451     MOZ_ANDROID_SDK($android_min_api_level)
4454 dnl ========================================================
4455 dnl =
4456 dnl = Toolkit Options
4457 dnl =
4458 dnl ========================================================
4459 MOZ_ARG_HEADER(Toolkit Options)
4461     dnl ========================================================
4462     dnl = Select the default toolkit
4463     dnl ========================================================
4464         MOZ_ARG_ENABLE_STRING(default-toolkit,
4465         [  --enable-default-toolkit=TK
4466                           Select default toolkit
4467                           Platform specific defaults:
4468                             Mac OS X - cairo-cocoa
4469                             OS/2 - cairo-os2
4470                             Win32 - cairo-windows
4471                             * - cairo-gtk2
4472                             * - cairo-qt],
4473     [ _DEFAULT_TOOLKIT=$enableval ],
4474     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4476     if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4477         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4478         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4479         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4480         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4481         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4482         -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4483         -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4484         -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4485     then
4486         dnl nglayout only supports building with one toolkit,
4487         dnl so ignore everything after the first comma (",").
4488         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4489     else
4490         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4491     fi
4493 MOZ_ARG_WITHOUT_BOOL(x,
4494 [  --without-x              Build without X11],
4495     WITHOUT_X11=1)
4497 dnl ========================================================
4498 dnl = Enable the toolkit as needed                         =
4499 dnl ========================================================
4501 MOZ_WIDGET_GTK=
4503 case "$MOZ_WIDGET_TOOLKIT" in
4505 cairo-windows)
4506     MOZ_WIDGET_TOOLKIT=windows
4507     MOZ_WEBGL=1
4508     MOZ_PDF_PRINTING=1
4509     MOZ_INSTRUMENT_EVENT_LOOP=1
4510     if test -n "$GNU_CC"; then
4511         MOZ_FOLD_LIBS=
4512     fi
4513     ;;
4515 cairo-gtk2|cairo-gtk2-x11)
4516     MOZ_WIDGET_TOOLKIT=gtk2
4517     MOZ_ENABLE_GTK2=1
4518     MOZ_ENABLE_XREMOTE=1
4519     MOZ_WEBGL=1
4520     MOZ_GL_DEFAULT_PROVIDER=GLX
4522     AC_DEFINE(MOZ_X11)
4523     MOZ_X11=1
4524     USE_FC_FREETYPE=1
4526     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4527     TK_LIBS='$(MOZ_GTK2_LIBS)'
4528     AC_DEFINE(MOZ_WIDGET_GTK2)
4529     MOZ_WIDGET_GTK=2
4530     AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4531     MOZ_PDF_PRINTING=1
4532     MOZ_INSTRUMENT_EVENT_LOOP=1
4533     ;;
4535 cairo-qt)
4536     MOZ_WIDGET_TOOLKIT=qt
4537     MOZ_ENABLE_QT=1
4538     if test -z "$WITHOUT_X11"; then
4539       MOZ_ENABLE_XREMOTE=1
4540       MOZ_GL_DEFAULT_PROVIDER=GLX
4541       MOZ_X11=1
4542       AC_DEFINE(MOZ_X11)
4543       XT_LIBS=
4544     fi
4546     MOZ_WEBGL=1
4547     USE_ELF_DYNSTR_GC=
4548     USE_FC_FREETYPE=1
4549     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4550     TK_LIBS='$(MOZ_QT_LIBS)'
4551     AC_DEFINE(MOZ_WIDGET_QT)
4552     MOZ_PDF_PRINTING=1
4553     AC_DEFINE(QT_NO_KEYWORDS)
4554     ;;
4556 cairo-os2)
4557     MOZ_WIDGET_TOOLKIT=os2
4558     USE_FC_FREETYPE=1
4559     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4560     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4561     MOZ_PDF_PRINTING=1
4562     ;;
4564 cairo-cocoa)
4565     MOZ_WIDGET_TOOLKIT=cocoa
4566     AC_DEFINE(MOZ_WIDGET_COCOA)
4567     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4568     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4569     TK_CFLAGS="-DNO_X11"
4570     CFLAGS="$CFLAGS $TK_CFLAGS"
4571     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4572     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc'
4573     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc'
4574     MOZ_USER_DIR="Mozilla"
4575     MOZ_FS_LAYOUT=bundle
4576     MOZ_WEBGL=1
4577     MOZ_INSTRUMENT_EVENT_LOOP=1
4578     ;;
4580 cairo-uikit)
4581     MOZ_WIDGET_TOOLKIT=uikit
4582     AC_DEFINE(MOZ_WIDGET_UIKIT)
4583     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4584     TK_CFLAGS="-DNO_X11"
4585     TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4586     CFLAGS="$CFLAGS $TK_CFLAGS"
4587     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4588     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc'
4589     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc'
4590     MOZ_USER_DIR="Mozilla"
4591     MOZ_FS_LAYOUT=bundle
4592     ;;
4594 cairo-android)
4595     AC_DEFINE(MOZ_WIDGET_ANDROID)
4596     MOZ_WIDGET_TOOLKIT=android
4597     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4598     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4599     MOZ_WEBGL=1
4600     MOZ_PDF_PRINTING=1
4601     MOZ_INSTRUMENT_EVENT_LOOP=1
4602     ;;
4604 cairo-gonk)
4605     AC_DEFINE(MOZ_WIDGET_GONK)
4606     AC_DEFINE(MOZ_TOUCH)
4607     MOZ_WIDGET_TOOLKIT=gonk
4608     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4609     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4610     MOZ_WEBGL=1
4611     MOZ_PDF_PRINTING=1
4612     MOZ_TOUCH=1
4613     ;;
4615 esac
4617 AC_SUBST(MOZ_PDF_PRINTING)
4618 if test "$MOZ_PDF_PRINTING"; then
4619    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4620    AC_DEFINE(MOZ_PDF_PRINTING)
4623 if test "$MOZ_ENABLE_XREMOTE"; then
4624     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4627 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4628    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4631 if test "$COMPILE_ENVIRONMENT"; then
4632   if test "$MOZ_ENABLE_GTK2"; then
4633     if test "$MOZ_X11"; then
4634       GDK_PACKAGES=gdk-x11-2.0
4635     fi
4637     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4638   fi
4640 fi # COMPILE_ENVIRONMENT
4642 AC_SUBST(MOZ_FS_LAYOUT)
4644 dnl ========================================================
4645 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4646 dnl their usage and use them in spidermonkey.
4647 dnl ========================================================
4648 MOZ_ARG_WITH_BOOL(arm-kuser,
4649 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4650     USE_ARM_KUSER=1,)
4651 if test -n "$USE_ARM_KUSER"; then
4652    AC_DEFINE(USE_ARM_KUSER)
4655 dnl ========================================================
4656 dnl = startup-notification support module
4657 dnl ========================================================
4659 if test "$MOZ_ENABLE_GTK2"
4660 then
4661     MOZ_ENABLE_STARTUP_NOTIFICATION=
4663     MOZ_ARG_ENABLE_BOOL(startup-notification,
4664     [  --enable-startup-notification
4665                           Enable startup-notification support (default: disabled) ],
4666         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4667         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4668     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4669     then
4670         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4671                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4672         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4673             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4674             then
4675                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4676             fi
4677             MOZ_ENABLE_STARTUP_NOTIFICATION=
4678         ])
4679     fi
4681     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4682         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4683     fi
4685     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4687 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4688 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4689 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4691 dnl ========================================================
4692 dnl = QT support
4693 dnl ========================================================
4694 if test "$MOZ_ENABLE_QT"
4695 then
4696     MOZ_ARG_WITH_STRING(qtdir,
4697     [  --with-qtdir=\$dir       Specify Qt directory ],
4698     [ QTDIR=$withval])
4700     if test -z "$QTDIR"; then
4701         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
4702         PKG_CHECK_MODULES(MOZ_QT5, Qt5Widgets Qt5Multimedia Qt5PrintSupport,
4703                       MOZ_ENABLE_QT5=1,
4704                       MOZ_ENABLE_QT5=)
4705         if test "$MOZ_ENABLE_QT5"; then
4706             echo "Using qt5"
4707             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
4708             MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
4709         fi
4711         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4712         AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4713     else
4714         MOZ_QT_CFLAGS="-DQT_SHARED"
4715         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4716         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4717         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4718         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4719         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4720         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4722         # QtWidgets was introduced only in Qt5
4723         if test -d $QTDIR/include/QtWidgets; then
4724             echo "Using qt5"
4725             MOZ_QT_LIBS="-L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml -lQt5OpenGL"
4726             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/5.0.1/QtGui"
4727             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4728             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4729             MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4730         else
4731             MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4732             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4733         fi
4734         HOST_MOC="$QTDIR/bin/moc"
4735         HOST_RCC="$QTDIR/bin/rcc"
4736     fi
4737     if test -z "$HOST_MOC"; then
4738         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4739 incorrect])
4740     fi
4741     if test -z "$HOST_RCC"; then
4742         AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4743 incorrect])
4744     fi
4746     MOC=$HOST_MOC
4747     RCC=$HOST_RCC
4749     MOZ_ENABLE_QMSYSTEM2=
4750     PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4751                       MOZ_ENABLE_QMSYSTEM2=1,
4752                       MOZ_ENABLE_QMSYSTEM2=)
4754     if test "$MOZ_ENABLE_QMSYSTEM2"; then
4755       MOZ_ENABLE_QMSYSTEM2=1
4756       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4757       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4758       AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4759     fi
4761     MOZ_ENABLE_QTNETWORK=
4762     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4763                       MOZ_ENABLE_QTNETWORK=1,
4764                       MOZ_ENABLE_QTNETWORK=)
4766     if test "$MOZ_ENABLE_QTNETWORK"; then
4767       MOZ_ENABLE_QTNETWORK=1
4768       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4769     fi
4771     MOZ_ENABLE_QTMOBILITY=
4772     PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4773                       MOZ_ENABLE_QTMOBILITY=1,
4774                       MOZ_ENABLE_QTMOBILITY=)
4775     if test "$MOZ_ENABLE_QTMOBILITY"; then
4776        MOZ_ENABLE_QTMOBILITY=1
4777        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4778        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4779     else
4780        AC_CHECK_LIB(QtSensors, main, [
4781           MOZ_ENABLE_QTMOBILITY=1
4782           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4783           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4784           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4785           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4786           MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4787        ])
4788     fi
4789     if test "$MOZ_ENABLE_QTMOBILITY"; then
4790        AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4791     fi
4794 AC_SUBST(GTK_CONFIG)
4795 AC_SUBST(TK_CFLAGS)
4796 AC_SUBST(TK_LIBS)
4798 AC_SUBST(MOZ_ENABLE_GTK2)
4799 AC_SUBST(MOZ_ENABLE_QT)
4800 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4801 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4802 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4803 AC_SUBST(MOZ_ENABLE_XREMOTE)
4804 AC_SUBST(MOZ_GTK2_CFLAGS)
4805 AC_SUBST(MOZ_GTK2_LIBS)
4806 AC_SUBST(MOZ_WIDGET_GTK)
4807 AC_SUBST(MOZ_QT_CFLAGS)
4808 AC_SUBST(MOZ_QT_LIBS)
4810 AC_SUBST(MOC)
4811 AC_SUBST(RCC)
4813 AC_SUBST(MOZ_X11)
4815 dnl ========================================================
4816 dnl =
4817 dnl = Components & Features
4818 dnl =
4819 dnl ========================================================
4820 MOZ_ARG_HEADER(Components and Features)
4822 dnl ========================================================
4823 dnl = Localization
4824 dnl ========================================================
4825 MOZ_ARG_ENABLE_STRING(ui-locale,
4826 [  --enable-ui-locale=ab-CD
4827                           Select the user interface locale (default: en-US)],
4828     MOZ_UI_LOCALE=$enableval )
4829 AC_SUBST(MOZ_UI_LOCALE)
4831 dnl ========================================================
4832 dnl = Trademarked Branding
4833 dnl ========================================================
4834 MOZ_ARG_ENABLE_BOOL(official-branding,
4835 [  --enable-official-branding
4836                           Enable Official mozilla.org Branding
4837                           Do not distribute builds with
4838                           --enable-official-branding unless you have
4839                           permission to use trademarks per
4840                           http://www.mozilla.org/foundation/trademarks/ .],
4842   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4843     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4844   else
4845     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4846     MOZ_OFFICIAL_BRANDING=1
4847   fi
4848 ], MOZ_OFFICIAL_BRANDING=)
4850 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4851 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4852   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4855 MOZ_ARG_WITH_STRING(branding,
4856 [  --with-branding=dir     Use branding from the specified directory.],
4857     MOZ_BRANDING_DIRECTORY=$withval)
4859 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4860 if test -z "$REAL_BRANDING_DIRECTORY"; then
4861   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4864 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4865   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4868 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4870 dnl ========================================================
4871 dnl = Distribution ID
4872 dnl ========================================================
4873 MOZ_ARG_WITH_STRING(distribution-id,
4874 [  --with-distribution-id=ID
4875                           Set distribution-specific id (default=org.mozilla)],
4876 [ val=`echo $withval`
4877     MOZ_DISTRIBUTION_ID="$val"])
4879 if test -z "$MOZ_DISTRIBUTION_ID"; then
4880    MOZ_DISTRIBUTION_ID="org.mozilla"
4883 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4884 AC_SUBST(MOZ_DISTRIBUTION_ID)
4887 dnl ========================================================
4888 dnl complex text support off by default
4889 dnl ========================================================
4890 MOZ_ARG_DISABLE_BOOL(pango,
4891 [  --disable-pango         Disable usage of Pango ],
4892     MOZ_PANGO=,
4893     MOZ_PANGO=1)
4895 dnl ========================================================
4896 dnl = Pango
4897 dnl ========================================================
4898 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4899 then
4900     AC_SUBST(MOZ_PANGO)
4902     if test "$MOZ_PANGO"
4903     then
4904         PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4906         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4907         AC_SUBST(MOZ_PANGO_CFLAGS)
4908         AC_SUBST(MOZ_PANGO_LIBS)
4909         AC_DEFINE(MOZ_PANGO)
4910     else
4911         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
4912         AC_SUBST(FT2_CFLAGS)
4913         AC_SUBST(FT2_LIBS)
4914     fi
4917 dnl ========================================================
4918 dnl = GnomeVFS, GIO and GConf support module
4919 dnl ========================================================
4921 if test "$MOZ_X11"
4922 then
4923     dnl build the GIO extension by default only when the
4924     dnl GTK2 toolkit is in use.
4925     if test "$MOZ_ENABLE_GTK2"
4926     then
4927         MOZ_ENABLE_GIO=1
4928         MOZ_ENABLE_GCONF=1
4929     fi
4931     dnl ========================================================
4932     dnl = GnomeVFS support module
4933     dnl ========================================================
4934     MOZ_ARG_ENABLE_BOOL(gnomevfs,
4935     [  --enable-gnomevfs       Enable GnomeVFS support (default: disabled)],
4936         MOZ_ENABLE_GNOMEVFS=force,
4937         MOZ_ENABLE_GNOMEVFS=)
4939     if test "$MOZ_ENABLE_GNOMEVFS"
4940     then
4941         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4942             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4943             MOZ_ENABLE_GNOMEVFS=1
4944             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4945         ],[
4946             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4947             then
4948                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4949             fi
4950             MOZ_ENABLE_GNOMEVFS=
4951         ])
4952     fi
4954     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4955     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4956     AC_SUBST(MOZ_GNOMEVFS_LIBS)
4958     dnl ========================================================
4959     dnl = GIO support module
4960     dnl ========================================================
4961     MOZ_ARG_DISABLE_BOOL(gio,
4962     [  --disable-gio           Disable GIO support],
4963         MOZ_ENABLE_GIO=,
4964         MOZ_ENABLE_GIO=force)
4966     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
4967     then
4968         PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4969                           [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4970         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4971             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4972             MOZ_ENABLE_GIO=1
4973             AC_DEFINE(MOZ_ENABLE_GIO)
4974         ],[
4975             if test "$MOZ_ENABLE_GIO" = "force"
4976             then
4977                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4978             fi
4979             MOZ_ENABLE_GIO=
4980         ])
4981     fi
4983     AC_SUBST(MOZ_ENABLE_GIO)
4984     AC_SUBST(MOZ_GIO_CFLAGS)
4985     AC_SUBST(MOZ_GIO_LIBS)
4987     dnl ========================================================
4988     dnl = GConf support module
4989     dnl ========================================================
4990     MOZ_ARG_DISABLE_BOOL(gconf,
4991     [  --disable-gconf      Disable Gconf support ],
4992         MOZ_ENABLE_GCONF=,
4993         MOZ_ENABLE_GCONF=force)
4995     if test "$MOZ_ENABLE_GCONF"
4996     then
4997         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4998             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4999             MOZ_ENABLE_GCONF=1
5000         ],[
5001             if test "$MOZ_ENABLE_GCONF" = "force"
5002             then
5003                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5004             fi
5005             MOZ_ENABLE_GCONF=
5006         ])
5007     fi
5009     if test "$MOZ_ENABLE_GCONF"; then
5010         AC_DEFINE(MOZ_ENABLE_GCONF)
5011     fi
5013     AC_SUBST(MOZ_ENABLE_GCONF)
5014     AC_SUBST(MOZ_GCONF_CFLAGS)
5015     AC_SUBST(MOZ_GCONF_LIBS)
5018 dnl ========================================================
5019 dnl = libproxy support
5020 dnl ========================================================
5022 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5023 then
5024     MOZ_ENABLE_LIBPROXY=
5026     MOZ_ARG_ENABLE_BOOL(libproxy,
5027     [  --enable-libproxy         Enable libproxy support ],
5028     MOZ_ENABLE_LIBPROXY=1,
5029     MOZ_ENABLE_LIBPROXY=)
5031     if test "$MOZ_ENABLE_LIBPROXY"
5032     then
5033         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5034         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5035     fi
5037 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5038 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5039 AC_SUBST(MOZ_LIBPROXY_LIBS)
5041 dnl ========================================================
5042 dnl = GNOME component (mozgnome)
5043 dnl ========================================================
5045 if test "$MOZ_ENABLE_GTK2"
5046 then
5047     MOZ_ENABLE_GNOME_COMPONENT=1
5049 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5051 dnl ========================================================
5052 dnl = libgnomeui support module
5053 dnl ========================================================
5055 if test "$MOZ_ENABLE_GTK2"
5056 then
5057     MOZ_ARG_ENABLE_BOOL(gnomeui,
5058     [  --enable-gnomeui        Enable libgnomeui instead of GIO & GTK for icon theme support ],
5059         MOZ_ENABLE_GNOMEUI=force,
5060         MOZ_ENABLE_GNOMEUI=)
5062     if test "$MOZ_ENABLE_GNOMEUI"
5063     then
5064         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5065         [
5066             MOZ_ENABLE_GNOMEUI=1
5067         ],[
5068             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5069             then
5070                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5071             fi
5072             MOZ_ENABLE_GNOMEUI=
5073         ])
5074     fi
5076     if test "$MOZ_ENABLE_GNOMEUI"; then
5077         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5078     fi
5081 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5082 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5084 dnl ========================================================
5085 dnl = dbus support
5086 dnl ========================================================
5088 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5089 then
5090     MOZ_ENABLE_DBUS=1
5092     MOZ_ARG_DISABLE_BOOL(dbus,
5093     [  --disable-dbus          Disable dbus support ],
5094         MOZ_ENABLE_DBUS=,
5095         MOZ_ENABLE_DBUS=1)
5097     if test "$MOZ_ENABLE_DBUS"
5098     then
5099         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5100         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5101         AC_DEFINE(MOZ_ENABLE_DBUS)
5102     fi
5104 AC_SUBST(MOZ_ENABLE_DBUS)
5105 AC_SUBST(MOZ_DBUS_CFLAGS)
5106 AC_SUBST(MOZ_DBUS_LIBS)
5107 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5108 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5110 dnl ========================================================
5111 dnl = Enable Android History instead of Places
5112 dnl ========================================================
5113 if test -n "$MOZ_ANDROID_HISTORY"; then
5114     if test -z "$MOZ_PLACES"; then
5115         AC_DEFINE(MOZ_ANDROID_HISTORY)
5116     else
5117         AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
5118     fi
5121 dnl ========================================================
5122 dnl = Build with the Android compositor
5123 dnl ========================================================
5124 if test -n "$MOZ_ANDROID_OMTC"; then
5125      dnl Do this if defined in confvars.sh
5126      AC_DEFINE(MOZ_ANDROID_OMTC)
5129 dnl ========================================================
5130 dnl = Disable WebSMS backend
5131 dnl ========================================================
5132 MOZ_ARG_DISABLE_BOOL(websms-backend,
5133 [  --disable-websms-backend
5134                            Disable WebSMS backend],
5135     MOZ_WEBSMS_BACKEND=,
5136     MOZ_WEBSMS_BACKEND=1)
5138 if test -n "$MOZ_WEBSMS_BACKEND"; then
5139     AC_DEFINE(MOZ_WEBSMS_BACKEND)
5142 dnl ========================================================
5143 dnl = Enable SET_WALLPAPER permission on Android
5144 dnl ========================================================
5145 if test -n "$MOZ_ANDROID_WALLPAPER"; then
5146     AC_DEFINE(MOZ_ANDROID_WALLPAPER)
5149 dnl ========================================================
5150 dnl = Enable NFC permission on Android
5151 dnl ========================================================
5152 if test -n "$MOZ_ANDROID_BEAM"; then
5153     AC_DEFINE(MOZ_ANDROID_BEAM)
5156 dnl ========================================================
5157 dnl = Build Personal Security Manager
5158 dnl ========================================================
5159 MOZ_ARG_DISABLE_BOOL(crypto,
5160 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5161     MOZ_PSM=,
5162     MOZ_PSM=1 )
5164 dnl ========================================================
5165 dnl = JS Debugger XPCOM component (js/jsd)
5166 dnl ========================================================
5167 MOZ_ARG_DISABLE_BOOL(jsd,
5168 [  --disable-jsd           Disable JavaScript debug library],
5169     MOZ_JSDEBUGGER=,
5170     MOZ_JSDEBUGGER=1)
5173 dnl ========================================================
5174 dnl = Enable IPDL's "expensive" unit tests
5175 dnl ========================================================
5176 MOZ_IPDL_TESTS=
5178 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5179 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5180     MOZ_IPDL_TESTS=1,
5181     MOZ_IPDL_TESTS=)
5183 if test -n "$MOZ_IPDL_TESTS"; then
5184     AC_DEFINE(MOZ_IPDL_TESTS)
5187 AC_SUBST(MOZ_IPDL_TESTS)
5189 dnl ========================================================
5190 dnl = Disable building dbm
5191 dnl ========================================================
5192 MOZ_ARG_DISABLE_BOOL(dbm,
5193 [  --disable-dbm           Disable building dbm],
5194     NSS_DISABLE_DBM=1,
5195     NSS_DISABLE_DBM=)
5197 dnl bi-directional support always on
5198 IBMBIDI=1
5199 AC_DEFINE(IBMBIDI)
5201 dnl ========================================================
5202 dnl accessibility support on by default on all platforms
5203 dnl ========================================================
5204 MOZ_ARG_DISABLE_BOOL(accessibility,
5205 [  --disable-accessibility Disable accessibility support],
5206     ACCESSIBILITY=,
5207     ACCESSIBILITY=1 )
5208 if test "$ACCESSIBILITY"; then
5209     case "$target" in
5210     *-mingw*)
5211         if test -z "$MIDL"; then
5212             if test "$GCC" != "yes"; then
5213                 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5214             else
5215                 AC_MSG_ERROR([You have accessibility enabled, but widl could not be found. Add --disable-accessibility to your mozconfig or install widl. See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details.])
5216             fi
5217         fi
5218     esac
5219     AC_DEFINE(ACCESSIBILITY)
5222 dnl ========================================================
5223 dnl Accessibility is required for the linuxgl widget
5224 dnl backend
5225 dnl ========================================================
5226 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5227     AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5230 dnl ========================================================
5231 dnl Disable printing
5232 dnl ========================================================
5233 MOZ_ARG_DISABLE_BOOL(printing,
5234 [  --disable-printing      Disable printing support],
5235     NS_PRINTING=,
5236     NS_PRINTING=1)
5238 if test "$NS_PRINTING"; then
5239     AC_DEFINE(NS_PRINTING)
5240     AC_DEFINE(NS_PRINT_PREVIEW)
5243 dnl Turn off webrtc for OS's we don't handle yet, but allow 
5244 dnl --enable-webrtc to override.  Can disable for everything in
5245 dnl the master list above.
5246 if test -n "$MOZ_WEBRTC"; then
5247     case "$target" in
5248     *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*)
5249         dnl Leave enabled
5250         ;;
5251     *)
5252         dnl default to disabled for all others
5253         MOZ_WEBRTC=
5254         ;;
5255     esac
5258 # target_arch is from {ia32|x64|arm|ppc}
5259 case "$CPU_ARCH" in
5260 x86_64 | ia64)
5261     WEBRTC_TARGET_ARCH=x64
5262     ;;
5264 arm*)
5265     WEBRTC_TARGET_ARCH=arm
5266     ;;
5268 x86)
5269     WEBRTC_TARGET_ARCH=ia32
5270     ;;
5272 ppc*)
5273     WEBRTC_TARGET_ARCH=ppc
5274     ;;
5276 # unsupported arch for webrtc
5277     WEBRTC_TARGET_ARCH=unknown
5278     MOZ_WEBRTC=
5279     ;;
5281 esac
5283 dnl ========================================================
5284 dnl = Disable WebRTC code
5285 dnl ========================================================
5286 MOZ_ARG_DISABLE_BOOL(webrtc,
5287 [  --disable-webrtc        Disable support for WebRTC],
5288     MOZ_WEBRTC=,
5289     MOZ_WEBRTC=1)
5291 if test -n "$MOZ_WEBRTC"; then
5292     AC_DEFINE(MOZ_WEBRTC)
5293     dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
5294     dnl opt/production builds (via MOZ_CRASH())
5295     AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
5296     MOZ_RAW=1
5297     MOZ_VP8=1
5298     MOZ_VP8_ENCODER=1
5299     MOZ_VP8_ERROR_CONCEALMENT=1
5301 dnl enable once Signaling lands
5302     MOZ_WEBRTC_SIGNALING=1
5303     AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5304     if test "${OS_TARGET}" = "WINNT"; then
5305         MOZ_WEBRTC_IN_LIBXUL=1
5306     fi
5307 dnl enable once PeerConnection lands
5308     MOZ_PEERCONNECTION=1
5309     AC_DEFINE(MOZ_PEERCONNECTION)
5310     MOZ_SCTP=1
5311     MOZ_SRTP=1
5312     AC_DEFINE(MOZ_SCTP)
5313     AC_DEFINE(MOZ_SRTP)
5316 AC_SUBST(MOZ_WEBRTC)
5317 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5318 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5319 AC_SUBST(MOZ_PEERCONNECTION)
5320 AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
5321 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5322 AC_SUBST(MOZ_SCTP)
5323 AC_SUBST(MOZ_SRTP)
5325 case "$target_cpu" in
5326 arm*)
5327     MOZ_SAMPLE_TYPE_S16=1
5328     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5329     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5332     MOZ_SAMPLE_TYPE_FLOAT32=1
5333     AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5334     AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5336 esac
5338 dnl ========================================================
5339 dnl = Disable Speech API code
5340 dnl ========================================================
5341 MOZ_ARG_DISABLE_BOOL(webspeech,
5342 [  --disable-webspeech        Disable support for HTML Speech API],
5343     MOZ_WEBSPEECH=,
5344     MOZ_WEBSPEECH=1)
5346 if test -n "$MOZ_WEBSPEECH"; then
5347     AC_DEFINE(MOZ_WEBSPEECH)
5350 AC_SUBST(MOZ_WEBSPEECH)
5352 dnl ========================================================
5353 dnl = Enable Raw Codecs
5354 dnl ========================================================
5355 MOZ_ARG_ENABLE_BOOL(raw,
5356 [  --enable-raw           Enable support for RAW media],
5357     MOZ_RAW=1,
5358     MOZ_RAW=)
5360 if test -n "$MOZ_RAW"; then
5361     AC_DEFINE(MOZ_RAW)
5364 AC_SUBST(MOZ_RAW)
5366 dnl ========================================================
5367 dnl = Disable Ogg Codecs
5368 dnl ========================================================
5369 MOZ_ARG_DISABLE_BOOL(ogg,
5370 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5371     MOZ_OGG=,
5372     MOZ_OGG=1)
5374 if test -n "$MOZ_OGG"; then
5375     AC_DEFINE(MOZ_OGG)
5376     MOZ_CUBEB=1
5378     dnl Checks for __attribute__(aligned()) directive
5379     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5380         [ac_cv_c_attribute_aligned],
5381         [ac_cv_c_attribute_aligned=0
5382          CFLAGS_save="${CFLAGS}"
5383          CFLAGS="${CFLAGS} -Werror"
5384          for ac_cv_c_attr_align_try in 64 32 16 8; do
5385            echo "trying $ac_cv_c_attr_align_try"
5386            AC_TRY_COMPILE([],
5387                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5388                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5389            if test "$ac_cv_c_attribute_aligned" != 0; then
5390              break;
5391            fi
5392          done
5393            CFLAGS="${CFLAGS_save}"])
5394     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5395       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5396                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5397     fi
5400 dnl ========================================================
5401 dnl = Disable Opus audio codec support
5402 dnl ========================================================
5403 MOZ_ARG_DISABLE_BOOL(opus,
5404 [  --disable-opus          Disable support for Opus audio],
5405     MOZ_OPUS=,
5406     MOZ_OPUS=1)
5408 dnl ========================================================
5409 dnl = Disable VP8 decoder support
5410 dnl ========================================================
5411 MOZ_ARG_DISABLE_BOOL(webm,
5412 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5413     MOZ_WEBM=,
5414     MOZ_WEBM=1)
5416 if test -n "$MOZ_WEBM"; then
5417     AC_DEFINE(MOZ_WEBM)
5418     MOZ_VP8=1
5421 dnl ========================================================
5422 dnl = Windows Media Foundation support
5423 dnl ========================================================
5424 if test "$OS_ARCH" = "WINNT"; then
5425     dnl Enable Windows Media Foundation support by default.
5426     dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5427     dnl guaranteed to have a recent-enough SDK to build WMF.
5428     MOZ_WMF=1
5431 MOZ_ARG_DISABLE_BOOL(wmf,
5432 [  --disable-wmf  Disable support for Windows Media Foundation],
5433     MOZ_WMF=,
5434     MOZ_WMF=1)
5436 if test -n "$MOZ_WMF"; then
5437     AC_DEFINE(MOZ_WMF)
5438     MOZ_CUBEB=1
5441 dnl ========================================================
5442 dnl = Enable media plugin support
5443 dnl ========================================================
5444 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5445   dnl Enable support on android by default
5446   MOZ_MEDIA_PLUGINS=1
5449 MOZ_ARG_ENABLE_BOOL(media-plugins,
5450 [  --enable-media-plugins  Enable support for media plugins],
5451     MOZ_MEDIA_PLUGINS=1,
5452     MOZ_MEDIA_PLUGINS=)
5454 if test -n "$MOZ_MEDIA_PLUGINS"; then
5455   AC_DEFINE(MOZ_MEDIA_PLUGINS)
5458 dnl ========================================================
5459 dnl = Enable getUserMedia support
5460 dnl ========================================================
5461 MOZ_ARG_ENABLE_BOOL(media-navigator,
5462 [  --enable-media-navigator  Enable support for getUserMedia],
5463     MOZ_MEDIA_NAVIGATOR=1,
5464     MOZ_MEDIA_NAVIGATOR=)
5466 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5467   AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5470 dnl ========================================================
5471 dnl = Enable building OMX media plugin (B2G or Android)
5472 dnl ========================================================
5473 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5474   dnl Enable support on android by default
5475   MOZ_OMX_PLUGIN=1
5478 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5479 [  --enable-omx-plugin      Enable building OMX plugin (B2G)],
5480     MOZ_OMX_PLUGIN=1,
5481     MOZ_OMX_PLUGIN=)
5483 if test -n "$MOZ_OMX_PLUGIN"; then
5484     if test "$OS_TARGET" = "Android"; then
5485         dnl Only allow building OMX plugin on Gonk (B2G) or Android
5486         AC_DEFINE(MOZ_OMX_PLUGIN)
5487     else
5488        dnl fail if we're not building on Gonk or Android
5489        AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5490     fi
5493 dnl system libvpx Support
5494 dnl ========================================================
5495 MOZ_ARG_WITH_BOOL(system-libvpx,
5496 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
5497     MOZ_NATIVE_LIBVPX=1)
5499 MOZ_LIBVPX_CFLAGS=
5500 MOZ_LIBVPX_LIBS=
5502 if test -n "$MOZ_VP8"; then
5503     AC_DEFINE(MOZ_VP8)
5504     if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5505         AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5506     fi
5507     if test -n "$MOZ_VP8_ENCODER" ; then
5508         AC_DEFINE(MOZ_VP8_ENCODER)
5509     fi
5511     if test -n "$MOZ_NATIVE_LIBVPX"; then
5512         dnl ============================
5513         dnl === libvpx Version check ===
5514         dnl ============================
5515         dnl Check to see if we have a system libvpx package.
5516         PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5518         MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [], 
5519          [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.])])
5521         _SAVE_LIBS=$LIBS
5522         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [], 
5523          [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5524         LIBS=$_SAVE_LIBS
5525     fi
5528 AC_SUBST(MOZ_NATIVE_LIBVPX)
5529 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5530 AC_SUBST(MOZ_LIBVPX_LIBS)
5532 if test "$MOZ_WEBM"; then
5533     MOZ_CUBEB=1
5534     if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5535         MOZ_VORBIS=1
5536     else
5537         MOZ_TREMOR=1
5538     fi
5541 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5543     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5544     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5545     dnl We currently require gcc on all arm platforms.
5546     VPX_AS=$YASM
5547     VPX_ASM_SUFFIX=asm
5548     VPX_NEED_OBJ_INT_EXTRACT=
5550     dnl See if we have assembly on this platform.
5551     case "$OS_ARCH:$CPU_ARCH" in
5552     Darwin:x86)
5553       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5554       VPX_X86_ASM=1
5555     ;;
5556     Darwin:x86_64)
5557       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5558       VPX_X86_ASM=1
5559     ;;
5560     WINNT:x86_64)
5561       VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5562       VPX_X86_ASM=1
5563     ;;
5564     WINNT:x86)
5565       dnl Check for yasm 1.1 or greater.
5566       if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5567         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.])
5568       elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5569         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.])
5570       else
5571         VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5572         VPX_X86_ASM=1
5573         dnl The encoder needs obj_int_extract to get asm offsets.
5574       fi
5575     ;;
5576     *:arm*)
5577       if test -n "$GNU_AS" ; then
5578         VPX_AS=$AS
5579         dnl These flags are a lie; they're just used to enable the requisite
5580         dnl opcodes; actual arch detection is done at runtime.
5581         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5582         VPX_DASH_C_FLAG="-c"
5583         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5584         VPX_ASM_SUFFIX="$ASM_SUFFIX"
5585         VPX_ARM_ASM=1
5586       fi
5587     ;;
5588     *:x86)
5589       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5590         VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5591         VPX_X86_ASM=1
5592       fi
5593     ;;
5594     *:x86_64)
5595       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5596         VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5597         VPX_X86_ASM=1
5598       fi
5599     ;;
5600     esac
5602     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5603       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.])
5604     fi
5606     if test -n "$MOZ_VP8_ENCODER" -a \
5607             -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5608       dnl We prefer to get asm offsets using inline assembler, which the above
5609       dnl compilers can do. When we're not using one of those, we have to fall
5610       dnl back to obj_int_extract, which reads them from a compiled object
5611       dnl file. Unfortunately, that only works if we're compiling on a system
5612       dnl with the header files for the appropriate object file format.
5613       VPX_NEED_OBJ_INT_EXTRACT=1
5614     fi
5616     if test -n "$VPX_X86_ASM"; then
5617       AC_DEFINE(VPX_X86_ASM)
5618     elif test -n "$VPX_ARM_ASM"; then
5619       AC_DEFINE(VPX_ARM_ASM)
5620     else
5621       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5622     fi
5625 dnl ========================================================
5626 dnl = Disable Wave decoder support
5627 dnl ========================================================
5628 MOZ_ARG_DISABLE_BOOL(wave,
5629 [  --disable-wave          Disable Wave decoder support],
5630     MOZ_WAVE=,
5631     MOZ_WAVE=1)
5633 if test -n "$MOZ_WAVE"; then
5634     AC_DEFINE(MOZ_WAVE)
5635     MOZ_CUBEB=1
5638 dnl ========================================================
5639 dnl = Handle dependent CUBEB and MEDIA defines
5640 dnl ========================================================
5642 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5643     AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5646 if test -n "$MOZ_SOUNDTOUCH"; then
5647     AC_DEFINE(MOZ_SOUNDTOUCH)
5650 if test -n "$MOZ_CUBEB"; then
5651     AC_DEFINE(MOZ_CUBEB)
5654 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5655     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/])
5658 if test -n "$MOZ_VORBIS"; then
5659     AC_DEFINE(MOZ_VORBIS)
5662 if test -n "$MOZ_TREMOR"; then
5663     AC_DEFINE(MOZ_TREMOR)
5666 if test -n "$MOZ_OPUS"; then
5667     AC_DEFINE(MOZ_OPUS)
5670 dnl ========================================================
5671 dnl = Check alsa availability on Linux if using sydneyaudio
5672 dnl ========================================================
5674 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5675 if test -n "$MOZ_CUBEB" -a "$OS_TARGET" = "Linux"; then
5676     MOZ_ALSA=1
5679 MOZ_ARG_ENABLE_BOOL(alsa,
5680 [  --enable-alsa          Enable Alsa support (default on Linux)],
5681 MOZ_ALSA=1,
5682 MOZ_ALSA=)
5684 if test -n "$MOZ_ALSA"; then
5685     AC_DEFINE(MOZ_CUBEB)
5686     PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5687          [echo "$MOZ_ALSA_PKG_ERRORS"
5688           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.)])])
5691 AC_SUBST(MOZ_ALSA)
5692 AC_SUBST(MOZ_ALSA_CFLAGS)
5693 AC_SUBST(MOZ_ALSA_LIBS)
5695 dnl ========================================================
5696 dnl = Enable PulseAudio
5697 dnl ========================================================
5699 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5700 [  --enable-pulseaudio          Enable PulseAudio support (experimental)],
5701 MOZ_PULSEAUDIO=1,
5702 MOZ_PULSEAUDIO=)
5704 if test -n "$MOZ_PULSEAUDIO"; then
5705     AC_DEFINE(MOZ_CUBEB)
5706     PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5707          [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5708           AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
5711 AC_SUBST(MOZ_PULSEAUDIO)
5712 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5713 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5715 dnl ========================================================
5716 dnl = Enable GStreamer
5717 dnl ========================================================
5718 MOZ_ARG_ENABLE_BOOL(gstreamer,
5719 [  --enable-gstreamer           Enable GStreamer support],
5720 MOZ_GSTREAMER=1,
5721 MOZ_GSTREAMER=)
5723 if test "$MOZ_GSTREAMER"; then
5724     # API version, eg 0.10, 1.0 etc
5725     GST_API_VERSION=0.10
5726     # core/base release number
5727     GST_VERSION=0.10.25
5728     PKG_CHECK_MODULES(GSTREAMER,
5729                       gstreamer-$GST_API_VERSION >= $GST_VERSION
5730                       gstreamer-app-$GST_API_VERSION
5731                       gstreamer-plugins-base-$GST_API_VERSION)
5732     if test -n "$GSTREAMER_LIBS"; then
5733        _SAVE_LDFLAGS=$LDFLAGS
5734        LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5735        AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5736        if test -n "$_HAVE_LIBGSTVIDEO" ; then
5737           GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5738        else
5739           AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
5740        fi
5741        LDFLAGS=$_SAVE_LDFLAGS
5742     else
5743        AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
5744     fi
5746 AC_SUBST(GSTREAMER_CFLAGS)
5747 AC_SUBST(GSTREAMER_LIBS)
5748 AC_SUBST(MOZ_GSTREAMER)
5750 if test -n "$MOZ_GSTREAMER"; then
5751    AC_DEFINE(MOZ_GSTREAMER)
5755 dnl ========================================================
5756 dnl Permissions System
5757 dnl ========================================================
5758 MOZ_ARG_DISABLE_BOOL(permissions,
5759 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5760     MOZ_PERMISSIONS=,
5761     MOZ_PERMISSIONS=1
5764 dnl ========================================================
5765 dnl NegotiateAuth
5766 dnl ========================================================
5767 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5768 [  --disable-negotiateauth Disable GSS-API negotiation ],
5769     MOZ_AUTH_EXTENSION=,
5770     MOZ_AUTH_EXTENSION=1 )
5772 dnl ========================================================
5773 dnl Pref extensions (autoconfig)
5774 dnl ========================================================
5775 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5776 [  --disable-pref-extensions
5777                           Disable pref extensions such as autoconfig],
5778   MOZ_PREF_EXTENSIONS=,
5779   MOZ_PREF_EXTENSIONS=1 )
5781 dnl ========================================================
5782 dnl Searching of system directories for extensions.
5783 dnl Note: this switch is meant to be used for test builds
5784 dnl whose behavior should not depend on what happens to be
5785 dnl installed on the local machine.
5786 dnl ========================================================
5787 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5788 [  --disable-system-extension-dirs
5789                           Disable searching system- and account-global
5790                           directories for extensions of any kind; use
5791                           only profile-specific extension directories],
5792   ENABLE_SYSTEM_EXTENSION_DIRS=,
5793   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5794 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5795   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5798 dnl ========================================================
5799 dnl = Universalchardet
5800 dnl ========================================================
5801 MOZ_ARG_DISABLE_BOOL(universalchardet,
5802 [  --disable-universalchardet
5803                           Disable universal encoding detection],
5804   MOZ_UNIVERSALCHARDET=,
5805   MOZ_UNIVERSALCHARDET=1 )
5807 if test -n "${JAVA_BIN_PATH}"; then
5808   dnl Look for javac and jar in the specified path.
5809   JAVA_PATH="$JAVA_BIN_PATH"
5810 else
5811   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5812   JAVA_PATH="$JAVA_HOME/bin:$PATH"
5815 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5816 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5817 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5818 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5820 if test -n "${JAVA_BIN_PATH}" -o \
5821   \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5822   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAVAH" -o "$JAVAH" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5823     AC_MSG_ERROR([The programs java, javac, javah and jar were not found.  Set \$JAVA_HOME to your java sdk directory or use --with-java-bin-path={java-bin-dir}])
5824   fi
5827 dnl ========================================================
5828 dnl = ANGLE OpenGL->D3D translator for WebGL
5829 dnl = * only applies to win32
5830 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5831 dnl ========================================================
5832 MOZ_ANGLE_RENDERER=
5833 MOZ_DIRECTX_SDK_PATH=
5834 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5835 MOZ_D3DCOMPILER_CAB=
5836 MOZ_D3DCOMPILER_DLL=
5837 case "$target_os" in
5838 *mingw*)
5839     MOZ_ANGLE_RENDERER=1
5840     ;;
5841 esac
5843 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5844 case "${target_cpu}" in
5845 i*86)
5846   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5847   ;;
5848 x86_64)
5849   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5850   ;;
5851 esac
5853 MOZ_ARG_DISABLE_BOOL(webgl,
5854 [  --disable-webgl     Disable building of the WebGL implementation],
5855     MOZ_WEBGL_DISABLED=1,
5856     MOZ_WEBGL_DISABLED=)
5858 if test -n "$MOZ_WEBGL_DISABLED"; then
5859   MOZ_WEBGL=
5860   MOZ_ANGLE_RENDERER=
5863 # Locate a DirectX SDK here so we can use it for both ANGLE and
5864 # Joystick support.
5865 if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
5866   # Get the SDK path from the registry.
5867   # First try to get the June 2010 SDK
5868   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5869   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5870     # Otherwise just take whatever comes first
5871     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5872   fi
5873   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'`
5876 if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
5877   if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5878     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.])
5879   fi
5881   if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5882      test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5883          test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5884     AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5885   else
5886     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.])
5887   fi
5889   # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5890   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'`
5892   if test -z "$MOZ_D3DX9_VERSION" ; then
5893         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.])
5894   fi
5896   MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5898   if test -z "$MOZ_D3DCOMPILER_CAB"; then
5899     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.])
5900   fi
5902   MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5905 dnl ========================================================
5906 dnl Gamepad support
5907 dnl ========================================================
5908 MOZ_GAMEPAD=
5909 MOZ_GAMEPAD_BACKEND=stub
5911 # Gamepad DOM is built on supported platforms by default.
5912 case "$OS_TARGET" in
5913      Darwin|WINNT|Linux)
5914        MOZ_GAMEPAD=1
5915        ;;
5916      *)
5917        ;;
5918 esac
5920 MOZ_ARG_DISABLE_BOOL(gamepad,
5921 [  --disable-gamepad   Disable gamepad support],
5922     MOZ_GAMEPAD=,
5923     MOZ_GAMEPAD=1)
5925 if test "$MOZ_GAMEPAD"; then
5926     case "$OS_TARGET" in
5927     Darwin)
5928         MOZ_GAMEPAD_BACKEND=cocoa
5929         ;;
5930     WINNT)
5931         if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
5932             if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5933                MOZ_GAMEPAD=
5934             fi
5935         elif test "$GCC" != "yes"; then
5936             MOZ_GAMEPAD=
5937         fi
5938         if test -z "$MOZ_GAMEPAD"; then
5939            AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for gamepad support. Please install it or, reconfigure with --disable-gamepad to disable gamepad support.])
5940         fi
5941         MOZ_GAMEPAD_BACKEND=windows
5942         ;;
5943     Linux)
5944         MOZ_CHECK_HEADER([linux/joystick.h])
5945         if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5946           AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers or reconfigure with --disable-gamepad to disable gamepad support.])
5947         fi
5948         MOZ_GAMEPAD_BACKEND=linux
5949         ;;
5950     *)
5951         ;;
5952    esac
5954   AC_DEFINE(MOZ_GAMEPAD)
5956 AC_SUBST(MOZ_GAMEPAD)
5957 AC_SUBST(MOZ_GAMEPAD_BACKEND)
5959 dnl ========================================================
5960 dnl = Breakpad crash reporting (on by default on supported platforms)
5961 dnl ========================================================
5963 case $target in
5964 i?86-*-mingw*|x86_64-*-mingw*)
5965   MOZ_CRASHREPORTER=1
5966   ;;
5967 i?86-apple-darwin*|x86_64-apple-darwin*)
5968   MOZ_CRASHREPORTER=1
5969   ;;
5970 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5971   if test "$MOZ_ENABLE_GTK2"; then
5972     MOZ_CRASHREPORTER=1
5973   fi
5974   ;;
5975 *-android*|*-linuxandroid*)
5976   MOZ_CRASHREPORTER=1
5977   ;;
5978 *solaris*)
5979   MOZ_CRASHREPORTER=1
5980   ;;
5981 esac
5983 MOZ_ARG_DISABLE_BOOL(crashreporter,
5984 [  --disable-crashreporter Disable breakpad crash reporting],
5985     MOZ_CRASHREPORTER=,
5986     MOZ_CRASHREPORTER=1)
5988 if test -n "$MOZ_CRASHREPORTER"; then
5989    AC_DEFINE(MOZ_CRASHREPORTER)
5991   if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5992     test -z "$SKIP_LIBRARY_CHECKS"; then
5993     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5994     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5995     AC_SUBST(MOZ_GTHREAD_LIBS)
5996   fi
5998   if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
5999     AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.  Use --disable-crashreporter.])
6000   fi
6002   if test "$OS_ARCH" = "WINNT"; then
6003     if test -z "$HAVE_64BIT_OS"; then
6004       MOZ_CRASHREPORTER_INJECTOR=1
6005       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
6006     fi
6007   fi
6009 AC_DEFINE_UNQUOTED(BREAKPAD_CUSTOM_STDINT_H, "mozilla/StandardInteger.h")
6011 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6012 [  --with-crashreporter-enable-percent=NN
6013                           Enable sending crash reports by default on NN% of users. (default=100)],
6014 [ val=`echo $withval | sed 's/[^0-9]//g'`
6015     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6017 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6018    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6020 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6022 dnl ========================================================
6023 dnl = libjpeg-turbo configuration
6024 dnl ========================================================
6025 MOZ_LIBJPEG_TURBO=
6026 if test -z "$MOZ_NATIVE_JPEG"; then
6027     MOZ_LIBJPEG_TURBO=1
6030 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6031 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
6032     MOZ_LIBJPEG_TURBO=,
6033     MOZ_LIBJPEG_TURBO=1)
6035 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6036     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6039 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6040 dnl files.
6042 if test -n "$MOZ_LIBJPEG_TURBO"; then
6044   dnl Do we support libjpeg-turbo on this platform?
6045   case "$OS_ARCH:$OS_TEST" in
6046   Darwin:i?86)
6047     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6048     LIBJPEG_TURBO_X86_ASM=1
6049   ;;
6050   Darwin:x86_64)
6051     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6052     LIBJPEG_TURBO_X64_ASM=1
6053   ;;
6054   WINNT:x86|WINNT:i?86)
6055     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6056     LIBJPEG_TURBO_X86_ASM=1
6057   ;;
6058   WINNT:x86_64)
6059     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6060     LIBJPEG_TURBO_X64_ASM=1
6061   ;;
6062   *:arm*)
6063     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6064     LIBJPEG_TURBO_ARM_ASM=1
6065   ;;
6066   *:x86|*:i?86)
6067     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6068       LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6069       LIBJPEG_TURBO_X86_ASM=1
6070     fi
6071   ;;
6072   *:x86_64)
6073     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6074       LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6075       LIBJPEG_TURBO_X64_ASM=1
6076     fi
6077   ;;
6078   esac
6082 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6083 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6084 dnl it doesn't exist or we have too old of a version.
6085 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6086     LIBJPEG_TURBO_AS=$YASM
6088     if test -z "$LIBJPEG_TURBO_AS" ; then
6089         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.])
6090     fi
6092     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
6093     dnl on Linux and 1.1 or newer everywhere else.
6094     if test "$OS_ARCH" = "Linux" ; then
6095         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
6096             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.])
6097         fi
6098     else
6099         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6100             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.])
6101         fi
6102     fi
6105 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6106 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6107 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6108     echo "Using $AS as the assembler for ARM code."
6109     LIBJPEG_TURBO_AS=$AS
6112 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6113     AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6114 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6115     AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6116 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6117     AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6118 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6119     dnl Warn if we're not building the optimized routines, even though the user
6120     dnl didn't specify --disable-libjpeg-turbo.
6121     AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
6124 dnl ========================================================
6125 dnl = Enable compilation of specific extension modules
6126 dnl ========================================================
6128 MOZ_ARG_ENABLE_STRING(extensions,
6129 [  --enable-extensions     Enable extensions],
6130 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6131     if test "$option" = "yes" -o "$option" = "all"; then
6132         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6133     elif test "$option" = "no" -o "$option" = "none"; then
6134         MOZ_EXTENSIONS=""
6135     elif test "$option" = "default"; then
6136         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6137     elif test `echo "$option" | grep -c \^-` != 0; then
6138         option=`echo $option | sed 's/^-//'`
6139         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6140     else
6141         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6142     fi
6143 done],
6144     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6146 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6147     # Suppress warning on non-X11 platforms
6148     if test -n "$MOZ_X11"; then
6149         AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6150     fi
6151     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6154 dnl Do not build gnomevfs with libxul based apps
6155 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6156     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6159 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6160     # Suppress warning on non-X11 platforms
6161     if test -n "$MOZ_X11"; then
6162         AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6163     fi
6164     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6167 dnl Do not build gio with libxul based apps
6168 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6169     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6172 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6173     MOZ_GIO_COMPONENT=1
6174     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6176 AC_SUBST(MOZ_GIO_COMPONENT)
6178 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6179     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6180     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6183 dnl Remove dupes
6184 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6186 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6187 dnl when trying to build a nonexistent extension.
6188 for extension in $MOZ_EXTENSIONS; do
6189     if test ! -d "${srcdir}/extensions/${extension}"; then
6190         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6191     fi
6192 done
6194 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6195   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6198 dnl ========================================================
6199 dnl CSS3 Flexbox Support
6200 dnl ========================================================
6201 if test -n "$MOZ_FLEXBOX"; then
6202   AC_DEFINE(MOZ_FLEXBOX)
6205 dnl ========================================================
6206 dnl Build Freetype in the tree
6207 dnl ========================================================
6208 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6209 [  --enable-tree-freetype  Enable Tree FreeType],
6210     MOZ_TREE_FREETYPE=1,
6211     MOZ_TREE_FREETYPE= )
6212 if test -n "$MOZ_TREE_FREETYPE"; then
6213    if test -n "$_WIN32_MSVC"; then
6214       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6215    fi
6216    AC_DEFINE(MOZ_TREE_FREETYPE)
6217    AC_SUBST(MOZ_TREE_FREETYPE)
6218    MOZ_ENABLE_CAIRO_FT=1
6219    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6220    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6221    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6222    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6223    CAIRO_FT_OSLIBS=''
6224    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6225    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6226    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6227    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6228    AC_SUBST(CAIRO_FT_CFLAGS)
6231 dnl ========================================================
6232 dnl Installer
6233 dnl ========================================================
6234 dnl Abort Windows build if the required major version and
6235 dnl minimum minor version of Unicode NSIS isn't in the path
6236 dnl (unless in case of cross compiling, for which Unicode
6237 dnl is not yet sufficient).
6238 if test "$OS_ARCH" = "WINNT"; then
6239     REQ_NSIS_MAJOR_VER=2
6240     MIN_NSIS_MINOR_VER=46
6241     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensis)
6242     if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6243       AC_MSG_RESULT([yes])
6244       changequote(,)
6245       MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6246       changequote([,])
6247       if test ! "$MAKENSISU_VER" = ""; then
6248           MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6249           MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6250       fi
6251       AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6252       if test "$MAKENSISU_VER" = "" || \
6253          test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6254               ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6255           AC_MSG_RESULT([no])
6256           if test -z "$CROSS_COMPILE"; then
6257             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.])
6258           else
6259             MAKENSISU=
6260           fi
6261       fi
6262     elif test -z "$CROSS_COMPILE"; then
6263       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.])
6264     else
6265       MAKENSISU=
6266     fi
6269 dnl ========================================================
6270 dnl Web App Runtime
6271 dnl ========================================================
6272 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6273 [  --disable-webapp-runtime  Disable Web App Runtime],
6274     MOZ_WEBAPP_RUNTIME=,
6275     MOZ_WEBAPP_RUNTIME=1)
6276 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6277     MOZ_WEBAPP_RUNTIME=
6279 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6280     MOZ_WEBAPP_RUNTIME=
6282 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6283 if test "$MOZ_WEBAPP_RUNTIME"; then
6284     AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6287 AC_MSG_CHECKING([for tar archiver])
6288 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6289 if test -z "$TAR"; then
6290     AC_MSG_ERROR([no tar archiver found in \$PATH])
6292 AC_MSG_RESULT([$TAR])
6293 AC_SUBST(TAR)
6295 AC_MSG_CHECKING([for wget])
6296 AC_CHECK_PROGS(WGET, wget, "")
6297 AC_MSG_RESULT([$WGET])
6298 AC_SUBST(WGET)
6300 dnl ========================================================
6301 dnl Signing
6302 dnl ========================================================
6304 if test -n "$MOZ_SIGN_CMD"; then
6305     AC_DEFINE(MOZ_SIGNING)
6308 dnl ========================================================
6309 dnl Maintenance Service
6310 dnl ========================================================
6312 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6313 [  --enable-maintenance-service       Enable building of maintenanceservice],
6314     MOZ_MAINTENANCE_SERVICE=1,
6315     MOZ_MAINTENANCE_SERVICE= )
6317 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6318   if test "$OS_ARCH" = "WINNT"; then
6319     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6320   else
6321     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6322   fi
6325 dnl ========================================================
6326 dnl Verify MAR signatures
6327 dnl ========================================================
6329 MOZ_ARG_ENABLE_BOOL(verify-mar,
6330 [  --enable-verify-mar     Enable verifying MAR signatures],
6331     MOZ_VERIFY_MAR_SIGNATURE=1,
6332     MOZ_VERIFY_MAR_SIGNATURE= )
6334 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6335   if test "$OS_ARCH" = "WINNT"; then
6336     AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6337   else
6338     AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6339   fi
6342 dnl ========================================================
6343 dnl Enable building the signmar program.
6344 dnl This option is much different than the --enable-verify-mar option.
6345 dnl --enable-verify-mar is for enabling the verification check on MAR
6346 dnl files in the updater.  The --enable-signmar option is for building
6347 dnl the signmar program.
6348 dnl ========================================================
6350 MOZ_ARG_ENABLE_BOOL(signmar,
6351 [  --enable-signmar     Enable building the signmar program],
6352     MOZ_ENABLE_SIGNMAR=1,
6353     MOZ_ENABLE_SIGNMAR= )
6355 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6356   AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6359 dnl ========================================================
6360 dnl Updater
6361 dnl ========================================================
6363 MOZ_ARG_DISABLE_BOOL(updater,
6364 [  --disable-updater       Disable building of updater],
6365     MOZ_UPDATER=,
6366     MOZ_UPDATER=1 )
6368 if test -n "$MOZ_UPDATER"; then
6369     AC_DEFINE(MOZ_UPDATER)
6372 # tools/update-packaging is not checked out by default.
6373 MOZ_ARG_ENABLE_BOOL(update-packaging,
6374 [  --enable-update-packaging
6375                           Enable tools/update-packaging],
6376     MOZ_UPDATE_PACKAGING=1,
6377     MOZ_UPDATE_PACKAGING= )
6378 AC_SUBST(MOZ_UPDATE_PACKAGING)
6380 dnl ========================================================
6381 dnl build the tests by default
6382 dnl ========================================================
6383 MOZ_ARG_DISABLE_BOOL(tests,
6384 [  --disable-tests         Do not build test libraries & programs],
6385     ENABLE_TESTS=,
6386     ENABLE_TESTS=1 )
6388 # Currently GTest is linked into libxul. This means it must be off by default.
6389 # Follow up will be to generate libxul.so and libxul-test.so to let GTest
6390 # be compiled along with ENABLE_TESTS
6391 MOZ_ARG_ENABLE_BOOL(gtest,
6392 [  --enable-gtest
6393                           Enable GTest libxul unit test.],
6394     MOZ_ENABLE_GTEST=1,
6395     MOZ_ENABLE_GTEST= )
6397 if test -n "$MOZ_ENABLE_GTEST"; then
6398     if test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "Linux" -o "${OS_TARGET}" = "Android"; then
6399         MOZ_ENABLE_GTEST=1
6400         GTEST_HAS_RTTI=0
6401         AC_DEFINE(MOZ_ENABLE_GTEST)
6402         AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6403         AC_SUBST(MOZ_ENABLE_GTEST)
6404         AC_SUBST(GTEST_HAS_RTTI)
6405     else
6406         AC_MSG_ERROR([Cannot build with --enable-gtest on this platform.])
6407     fi
6408     if test "${OS_TARGET}" = "Android"; then
6409         AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6410         AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6411         AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6412         AC_SUBST(GTEST_OS_LINUX_ANDROID)
6413         AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6414         AC_SUBST(GTEST_HAS_CLONE)
6415     fi
6418 dnl ========================================================
6419 dnl parental controls (for Windows Vista)
6420 dnl ========================================================
6421 MOZ_ARG_DISABLE_BOOL(parental-controls,
6422 [  --disable-parental-controls
6423                           Do not build parental controls],
6424    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6425    MOZ_DISABLE_PARENTAL_CONTROLS=)
6426 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6427     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6430 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6432 dnl ========================================================
6433 dnl = Disable DOMCrypto
6434 dnl ========================================================
6435 if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
6436     AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
6438 AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
6440 dnl ========================================================
6441 dnl = Disable libpkix
6442 dnl ========================================================
6443 if test -n "$NSS_NO_LIBPKIX"; then
6444     AC_DEFINE(NSS_NO_LIBPKIX)
6446 AC_SUBST(NSS_NO_LIBPKIX)
6449 dnl ========================================================
6450 dnl =
6451 dnl = Module specific options
6452 dnl =
6453 dnl ========================================================
6454 MOZ_ARG_HEADER(Individual module options)
6456 dnl ========================================================
6457 dnl = Disable feed handling components
6458 dnl ========================================================
6459 MOZ_ARG_DISABLE_BOOL(feeds,
6460 [  --disable-feeds         Disable feed handling and processing components],
6461     MOZ_FEEDS=,
6462     MOZ_FEEDS=1 )
6463 if test -n "$MOZ_FEEDS"; then
6464     AC_DEFINE(MOZ_FEEDS)
6465 else
6466     if test "$MOZ_BUILD_APP" = "browser"; then
6467         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6468     fi
6471 dnl ========================================================
6472 dnl Check for sqlite
6473 dnl ========================================================
6475 MOZ_NATIVE_SQLITE=
6476 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6477 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6478 MOZ_NATIVE_SQLITE=1,
6479 MOZ_NATIVE_SQLITE= )
6481 if test -z "$MOZ_NATIVE_SQLITE"
6482 then
6483     SQLITE_CFLAGS=
6484     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6485 else
6486     dnl ============================
6487     dnl === SQLite Version check ===
6488     dnl ============================
6489     dnl Check to see if the system SQLite package is new enough.
6490     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6492     dnl ==================================
6493     dnl === SQLITE_SECURE_DELETE check ===
6494     dnl ==================================
6495     dnl Check to see if the system SQLite package is compiled with
6496     dnl SQLITE_SECURE_DELETE enabled.
6497     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6498     _SAVE_CFLAGS="$CFLAGS"
6499     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6500     _SAVE_LIBS="$LIBS"
6501     LIBS="$LIBS $SQLITE_LIBS"
6502     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6503         AC_TRY_RUN([
6504             #include "sqlite3.h"
6506             int main(int argc, char **argv){
6507               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6508             }],
6509             ac_cv_sqlite_secure_delete=yes,
6510             ac_cv_sqlite_secure_delete=no,
6511             ac_cv_sqlite_secure_delete=no
6512         )
6513     ])
6514     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6515     CFLAGS="$_SAVE_CFLAGS"
6516     LIBS="$_SAVE_LIBS"
6517     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6518         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6519     fi
6521     dnl ===============================
6522     dnl === SQLITE_THREADSAFE check ===
6523     dnl ===============================
6524     dnl Check to see if the system SQLite package is compiled with
6525     dnl SQLITE_THREADSAFE enabled.
6526     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6527     _SAVE_CFLAGS="$CFLAGS"
6528     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6529     _SAVE_LIBS="$LIBS"
6530     LIBS="$LIBS $SQLITE_LIBS"
6531     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6532         AC_TRY_RUN([
6533             #include "sqlite3.h"
6535             int main(int argc, char **argv){
6536               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6537             }],
6538             ac_cv_sqlite_threadsafe=yes,
6539             ac_cv_sqlite_threadsafe=no,
6540             ac_cv_sqlite_threadsafe=no
6541         )
6542     ])
6543     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6544     CFLAGS="$_SAVE_CFLAGS"
6545     LIBS="$_SAVE_LIBS"
6546     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6547         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6548     fi
6550     dnl ================================
6551     dnl === SQLITE_ENABLE_FTS3 check ===
6552     dnl ================================
6553     dnl check to see if the system SQLite package is compiled with
6554     dnl SQLITE_ENABLE_FTS3 enabled.
6555     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6556     _SAVE_CFLAGS="$CFLAGS"
6557     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6558     _SAVE_LIBS="$LIBS"
6559     LIBS="$LIBS $SQLITE_LIBS"
6560     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6561         AC_TRY_RUN([
6562             #include "sqlite3.h"
6564             int main(int argc, char **argv){
6565               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6566             }],
6567             ac_cv_sqlite_enable_fts3=yes,
6568             ac_cv_sqlite_enable_fts3=no,
6569             ac_cv_sqlite_enable_fts3=no
6570         )
6571     ])
6572     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6573     CFLAGS="$_SAVE_CFLAGS"
6574     LIBS="$_SAVE_LIBS"
6575     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6576         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6577     fi
6579     dnl =========================================
6580     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6581     dnl =========================================
6582     dnl check to see if the system SQLite package is compiled with
6583     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6584     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6585     _SAVE_CFLAGS="$CFLAGS"
6586     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6587     _SAVE_LIBS="$LIBS"
6588     LIBS="$LIBS $SQLITE_LIBS"
6589     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6590         AC_TRY_RUN([
6591             #include "sqlite3.h"
6593             int main(int argc, char **argv){
6594               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6595             }],
6596             ac_cv_sqlite_enable_unlock_notify=yes,
6597             ac_cv_sqlite_enable_unlock_notify=no,
6598             ac_cv_sqlite_enable_unlock_notify=no
6599         )
6600     ])
6601     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6602     CFLAGS="$_SAVE_CFLAGS"
6603     LIBS="$_SAVE_LIBS"
6604     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6605         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6606     fi
6609 if test -n "$MOZ_NATIVE_SQLITE"; then
6610     AC_DEFINE(MOZ_NATIVE_SQLITE)
6612 AC_SUBST(MOZ_NATIVE_SQLITE)
6614 dnl ========================================================
6615 dnl = Enable help viewer (off by default)
6616 dnl ========================================================
6617 if test -n "$MOZ_HELP_VIEWER"; then
6618      dnl Do this if defined in confvars.sh
6619      AC_DEFINE(MOZ_HELP_VIEWER)
6622 dnl ========================================================
6623 dnl = Enable safe browsing (anti-phishing)
6624 dnl ========================================================
6625 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6626 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6627     MOZ_SAFE_BROWSING=1,
6628     MOZ_SAFE_BROWSING= )
6629 if test -n "$MOZ_SAFE_BROWSING"; then
6630     AC_DEFINE(MOZ_SAFE_BROWSING)
6632 AC_SUBST(MOZ_SAFE_BROWSING)
6634 dnl ========================================================
6635 dnl = Enable url-classifier
6636 dnl ========================================================
6637 dnl Implicitly enabled by default if building with safe-browsing
6638 if test -n "$MOZ_SAFE_BROWSING"; then
6639     MOZ_URL_CLASSIFIER=1
6641 MOZ_ARG_ENABLE_BOOL(url-classifier,
6642 [  --enable-url-classifier Enable url classifier module],
6643     MOZ_URL_CLASSIFIER=1,
6644     MOZ_URL_CLASSIFIER= )
6645 if test -n "$MOZ_URL_CLASSIFIER"; then
6646     AC_DEFINE(MOZ_URL_CLASSIFIER)
6648 AC_SUBST(MOZ_URL_CLASSIFIER)
6650 dnl ========================================================
6651 dnl = Disable zipwriter
6652 dnl ========================================================
6653 MOZ_ARG_DISABLE_BOOL(zipwriter,
6654 [  --disable-zipwriter     Disable zipwriter component],
6655     MOZ_ZIPWRITER=,
6656     MOZ_ZIPWRITER=1 )
6657 AC_SUBST(MOZ_ZIPWRITER)
6659 dnl ========================================================
6660 dnl = libconic
6661 dnl ========================================================
6662 dnl superseded by QtNetwork starting from 4.7
6663 MOZ_ENABLE_LIBCONIC=1
6665 if test -n "$MOZ_ENABLE_QT"; then
6666   if test "$MOZ_ENABLE_QTNETWORK"; then
6667     MOZ_ENABLE_LIBCONIC=
6668   fi
6671 MOZ_ARG_DISABLE_BOOL(libconic,
6672 [  --disable-libconic      Disable libconic],
6673     MOZ_ENABLE_LIBCONIC=,
6674     MOZ_ENABLE_LIBCONIC=1 )
6676 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6677     PKG_CHECK_MODULES(LIBCONIC, conic,
6678                       MOZ_ENABLE_LIBCONIC=1,
6679                       MOZ_ENABLE_LIBCONIC=)
6681 if test "$MOZ_ENABLE_LIBCONIC"; then
6682     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6685 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6686 AC_SUBST(LIBCONIC_CFLAGS)
6687 AC_SUBST(LIBCONIC_LIBS)
6689 dnl ========================================================
6690 dnl = Maemo checks
6691 dnl ========================================================
6693 MAEMO_SDK_TARGET_VER=-1
6695 MOZ_ARG_WITH_STRING(maemo-version,
6696 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6697                           Maemo SDK Version],
6698   MAEMO_SDK_TARGET_VER=$withval)
6700 case "$MAEMO_SDK_TARGET_VER" in
6702     MOZ_PLATFORM_MAEMO=5
6703     ;;
6706     MOZ_PLATFORM_MAEMO=6
6707     ;;
6710     dnl We aren't compiling for Maemo, move on.
6711     ;;
6713     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6714     ;;
6715 esac
6717 if test $MOZ_PLATFORM_MAEMO; then
6718    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6720    if test -z "$MOZ_ENABLE_DBUS"; then
6721        AC_MSG_ERROR([DBus is required when building for Maemo])
6722    fi
6724    MOZ_GFX_OPTIMIZE_MOBILE=1
6725    MOZ_GL_DEFAULT_PROVIDER=EGL
6726    MOZ_MAEMO_LIBLOCATION=
6728    if test $MOZ_PLATFORM_MAEMO = 5; then
6729       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6730       MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6731           [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6732       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6733                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6735       AC_SUBST(XCOMPOSITE_LIBS)
6737       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6738       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6739       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6740       if test -z "$_LIB_FOUND"; then
6741          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6742       fi
6745       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6746       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6747       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6748       if test -z "$_LIB_FOUND"; then
6749          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6750       fi
6752       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6753       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6754       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6755       if test -z "$_LIB_FOUND"; then
6756          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6757       fi
6759    fi
6760    if test $MOZ_PLATFORM_MAEMO = 6; then
6762       PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6763                         _LIB_FOUND=1,
6764                         _LIB_FOUND=)
6765       if test "$_LIB_FOUND"; then
6766          MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6767          MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6768          MOZ_ENABLE_CONTENTMANAGER=1
6769          AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6770       else
6771          AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6772       fi
6773       AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6775       dnl ========================================================
6776       dnl = Enable meego libcontentaction
6777       dnl ========================================================
6778       MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6779       [  --enable-meegocontentaction           Enable meegocontentaction support],
6780          MOZ_MEEGOCONTENTACTION=1,
6781          MOZ_MEEGOCONTENTACTION=)
6783       if test -n "$MOZ_MEEGOCONTENTACTION"; then
6785          PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6786          if test "$_LIB_FOUND"; then
6787             MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6788             MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6789             MOZ_ENABLE_CONTENTACTION=1
6790             AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6791             AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6792          fi
6793       fi
6795       MOZ_ARG_ENABLE_BOOL(meegotouch,
6796       [  --enable-meegotouch  Enable meegotouch support],
6797          MOZ_MEEGOTOUCHENABLED=1,
6798          MOZ_MEEGOTOUCHENABLED=)
6800       if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6801           PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6802           if test "$_LIB_FOUND"; then
6803               MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6804               MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6805               AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6806           else
6807               AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6808           fi
6809       fi
6810    fi
6812    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6813    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6814    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6815    if test "$_LIB_FOUND"; then
6816       MOZ_MAEMO_LIBLOCATION=1
6817       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6818    else
6819       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6820    fi
6821    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6823    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6824    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6825    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6826    if test "$_LIB_FOUND"; then
6827       MOZ_ENABLE_MEEGOTOUCHSHARE=1
6828       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6829    else
6830       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6831    fi
6832    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6834    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6835    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6838 dnl ========================================================
6839 dnl GL provider
6840 dnl ========================================================
6841 MOZ_GL_PROVIDER=
6842 MOZ_ARG_WITH_STRING(gl-provider,
6843 [  --with-gl-provider=ID
6844                           Set GL provider backend type],
6845 [ val=`echo $withval`
6846     MOZ_GL_PROVIDER="$val"])
6848 if test -n "$MOZ_GL_PROVIDER"; then
6849 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6850 AC_SUBST(MOZ_GL_PROVIDER)
6851 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6853 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6854 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6856 dnl ========================================================
6857 dnl = faststripe theme
6858 dnl ========================================================
6859 MOZ_ARG_ENABLE_BOOL(faststripe,
6860 [  --enable-faststripe     Use faststripe theme],
6861     MOZ_THEME_FASTSTRIPE=1,
6862     MOZ_THEME_FASTSTRIPE= )
6863 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6865 dnl ========================================================
6866 dnl =
6867 dnl = Feature options that require extra sources to be pulled
6868 dnl =
6869 dnl ========================================================
6870 dnl MOZ_ARG_HEADER(Features that require extra sources)
6872 dnl ========================================================
6873 dnl =
6874 dnl = Debugging Options
6875 dnl =
6876 dnl ========================================================
6877 MOZ_ARG_HEADER(Debugging and Optimizations)
6879 dnl ========================================================
6880 dnl = Disable building with debug info.
6881 dnl = Debugging is OFF by default
6882 dnl ========================================================
6883 if test -z "$MOZ_DEBUG_FLAGS"; then
6884   MOZ_DEBUG_FLAGS="-g"
6887 MOZ_ARG_ENABLE_STRING(debug,
6888 [  --enable-debug[=DBG]    Enable building with developer debug info
6889                            (using compiler flags DBG)],
6890 [ if test "$enableval" != "no"; then
6891     MOZ_DEBUG=1
6892     if test -n "$enableval" -a "$enableval" != "yes"; then
6893         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6894         _MOZ_DEBUG_FLAGS_SET=1
6895     fi
6896   else
6897     MOZ_DEBUG=
6898   fi ],
6899   MOZ_DEBUG=)
6901 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6902 MOZ_ARG_WITH_STRING(debug-label,
6903 [  --with-debug-label=LABELS
6904                           Define DEBUG_<value> for each comma-separated
6905                           value given.],
6906 [ for option in `echo $withval | sed 's/,/ /g'`; do
6907     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6908 done])
6910 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6912 if test -n "$MOZ_DEBUG"; then
6913     AC_MSG_CHECKING([for valid debug flags])
6914     _SAVE_CFLAGS=$CFLAGS
6915     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6916     AC_TRY_COMPILE([#include <stdio.h>],
6917         [printf("Hello World\n");],
6918         _results=yes,
6919         _results=no)
6920     AC_MSG_RESULT([$_results])
6921     if test "$_results" = "no"; then
6922         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6923     fi
6924     CFLAGS=$_SAVE_CFLAGS
6927 dnl ========================================================
6928 dnl enable mobile optimizations
6929 dnl ========================================================
6930 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6931 [  --enable-mobile-optimize
6932                           Enable mobile optimizations],
6933     MOZ_GFX_OPTIMIZE_MOBILE=1)
6935 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6937 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6938     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6941 dnl ========================================================
6942 dnl = Enable code optimization. ON by default.
6943 dnl ========================================================
6944 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6945         MOZ_OPTIMIZE_FLAGS="-O"
6948 MOZ_ARG_ENABLE_STRING(optimize,
6949 [  --disable-optimize      Disable compiler optimization
6950   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6951 [ if test "$enableval" != "no"; then
6952     MOZ_OPTIMIZE=1
6953     if test -n "$enableval" -a "$enableval" != "yes"; then
6954         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6955         MOZ_OPTIMIZE=2
6956     fi
6957 else
6958     MOZ_OPTIMIZE=
6959 fi ], MOZ_OPTIMIZE=1)
6961 MOZ_SET_FRAMEPTR_FLAGS
6963 if test "$COMPILE_ENVIRONMENT"; then
6964 if test -n "$MOZ_OPTIMIZE"; then
6965     AC_MSG_CHECKING([for valid optimization flags])
6966     _SAVE_CFLAGS=$CFLAGS
6967     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6968     AC_TRY_COMPILE([#include <stdio.h>],
6969         [printf("Hello World\n");],
6970         _results=yes,
6971         _results=no)
6972     AC_MSG_RESULT([$_results])
6973     if test "$_results" = "no"; then
6974         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6975     fi
6976     CFLAGS=$_SAVE_CFLAGS
6978 fi # COMPILE_ENVIRONMENT
6980 AC_SUBST(MOZ_OPTIMIZE)
6981 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6982 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6983 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6984 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6985 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6986 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6988 dnl ========================================================
6989 dnl = Enable generation of debug symbols
6990 dnl ========================================================
6991 MOZ_ARG_ENABLE_STRING(debug-symbols,
6992 [  --enable-debug-symbols[=DBG]
6993                           Enable debugging symbols (using compiler flags DBG)],
6994 [ if test "$enableval" != "no"; then
6995       MOZ_DEBUG_SYMBOLS=1
6996       if test -n "$enableval" -a "$enableval" != "yes"; then
6997           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6998               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6999           else
7000               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7001           fi
7002       fi
7003   else
7004       MOZ_DEBUG_SYMBOLS=
7005   fi ],
7006   MOZ_DEBUG_SYMBOLS=1)
7008 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7009     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7010     export MOZ_DEBUG_SYMBOLS
7013 dnl ========================================================
7014 dnl = Enable any treating of compile warnings as errors
7015 dnl ========================================================
7016 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
7017 [  --enable-warnings-as-errors
7018                           Enable treating of warnings as errors],
7019     MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
7020     MOZ_ENABLE_WARNINGS_AS_ERRORS=)
7021 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
7022    WARNINGS_AS_ERRORS=''
7025 dnl ========================================================
7026 dnl = Disable runtime logging checks
7027 dnl ========================================================
7028 MOZ_ARG_DISABLE_BOOL(logging,
7029 [  --disable-logging       Disable logging facilities],
7030     NS_DISABLE_LOGGING=1,
7031     NS_DISABLE_LOGGING= )
7032 if test "$NS_DISABLE_LOGGING"; then
7033     AC_DEFINE(NS_DISABLE_LOGGING)
7034 else
7035     AC_DEFINE(MOZ_LOGGING)
7038 dnl ========================================================
7039 dnl = This will enable logging of addref, release, ctor, dtor.
7040 dnl ========================================================
7041 _ENABLE_LOGREFCNT=42
7042 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7043 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7044     _ENABLE_LOGREFCNT=1,
7045     _ENABLE_LOGREFCNT= )
7046 if test "$_ENABLE_LOGREFCNT" = "1"; then
7047     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7048 elif test -z "$_ENABLE_LOGREFCNT"; then
7049     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7052 dnl ========================================================
7053 dnl moz_dump_painting
7054 dnl ========================================================
7055 MOZ_ARG_ENABLE_BOOL(dump-painting,
7056 [  --enable-dump-painting          Enable paint debugging.],
7057     MOZ_DUMP_PAINTING=1,
7058     MOZ_DUMP_PAINTING= )
7059 if test -n "$MOZ_DUMP_PAINTING"; then
7060     AC_DEFINE(MOZ_DUMP_PAINTING)
7061     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
7063 if test -n "$MOZ_DEBUG"; then
7064     AC_DEFINE(MOZ_DUMP_PAINTING)
7067 dnl ========================================================
7068 dnl = Enable trace malloc
7069 dnl ========================================================
7070 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7071 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7072 [  --enable-trace-malloc   Enable malloc tracing; also disables DMD and jemalloc],
7073     NS_TRACE_MALLOC=1,
7074     NS_TRACE_MALLOC= )
7075 if test "$NS_TRACE_MALLOC"; then
7076   # Please, Mr. Linker Man, don't take away our symbol names
7077   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7078   USE_ELF_DYNSTR_GC=
7079   AC_DEFINE(NS_TRACE_MALLOC)
7081 AC_SUBST(NS_TRACE_MALLOC)
7083 dnl ========================================================
7084 dnl = Enable DMD
7085 dnl ========================================================
7087 MOZ_ARG_ENABLE_BOOL(dmd,
7088 [  --enable-dmd            Enable DMD; also enables jemalloc and replace-malloc],
7089     MOZ_DMD=1,
7090     MOZ_DMD= )
7092 if test "$NS_TRACE_MALLOC"; then        # trace-malloc disables DMD
7093     MOZ_DMD=
7095 if test "$MOZ_DMD"; then
7096     USE_ELF_DYNSTR_GC=
7097     AC_DEFINE(MOZ_DMD)
7099     if test "${CPU_ARCH}" = "arm"; then
7100         CFLAGS="$CFLAGS -funwind-tables"
7101         CXXFLAGS="$CXXFLAGS -funwind-tables"
7102     fi
7104     MOZ_MEMORY=1                        # DMD enables jemalloc
7105     MOZ_REPLACE_MALLOC=1                # DMD enables replace-malloc
7107 AC_SUBST(MOZ_DMD)
7109 dnl ========================================================
7110 dnl = Enable jemalloc
7111 dnl ========================================================
7112 MOZ_ARG_ENABLE_BOOL(jemalloc,
7113 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7114     MOZ_MEMORY=1,
7115     MOZ_MEMORY=)
7117 if test "$NS_TRACE_MALLOC"; then
7118     MOZ_MEMORY=
7121 if test "${OS_TARGET}" = "Android"; then
7122   dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
7123   :
7124 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
7125   dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
7126   if test -z "$GNU_CC"; then
7127     MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7128   else
7129     MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
7130   fi
7131 else
7132   dnl On other Unix systems, we only want to link executables against mozglue
7133   MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7134   dnl On other Unix systems, where mozglue is a static library, jemalloc is
7135   dnl separated for the SDK, so we need to add it here.
7136   if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
7137     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
7138   fi
7139   MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
7140   if test -n "$GNU_CC"; then
7141     dnl And we need mozglue symbols to be exported.
7142     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
7143   fi
7144   if test "$MOZ_LINKER" = 1; then
7145     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
7146   fi
7149 dnl ========================================================
7150 dnl = Enable dynamic replacement of malloc implementation
7151 dnl ========================================================
7152 MOZ_ARG_ENABLE_BOOL(replace-malloc,
7153 [  --enable-replace-malloc   Enable ability to dynamically replace the malloc implementation],
7154     MOZ_REPLACE_MALLOC=1,
7155     MOZ_REPLACE_MALLOC= )
7157 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
7158     dnl We don't want to enable jemalloc unconditionally because it may be a
7159     dnl deliberate choice not to enable it (bug 702250, for instance)
7160     AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
7161 elif test -n "$MOZ_REPLACE_MALLOC"; then
7162     MOZ_NATIVE_JEMALLOC=
7164     dnl Replace-malloc Mac linkage quirks
7165     if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
7166         AC_CACHE_CHECK([how to do weak dynamic linking],
7167             ac_cv_weak_dynamic_linking,
7168             [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
7169              if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
7170                 test -s conftest${DLL_SUFFIX}; then
7171                  dnl There are several ways the linker can put link edit rules in a binary:
7172                  dnl - classic info only (for OSX < 10.6)
7173                  dnl - dyld info only
7174                  dnl - both
7175                  if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
7176                      _CLASSIC_INFO=
7177                  else
7178                      _CLASSIC_INFO=1
7179                  fi
7180                  if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
7181                      _DYLD_INFO=1
7182                  else
7183                      _DYLD_INFO=
7184                  fi
7185                  dnl With classic info, we need to build with -flat_namespace.
7186                  dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
7187                  dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
7188                  dnl forgets to set the weak flag in the dyld info.
7189                  dnl See http://glandium.org/blog/?p=2764 for more details.
7190                  dnl
7191                  dnl Values for ac_cv_weak_dynamic_linking, and subsequently
7192                  dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
7193                  dnl - "flat namespace" when -flat_namespace alone is needed
7194                  dnl - "dummy library" when a dummy library and -flat_namespace are needed
7195                  dnl - "compiler support" when nothing is needed
7196                  if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
7197                      if test -n "$_CLASSIC_INFO"; then
7198                          ac_cv_weak_dynamic_linking="flat namespace"
7199                      else
7200                          ac_cv_weak_dynamic_linking="compiler support"
7201                      fi
7202                  else
7203                      if test -n "$_DYLD_INFO"; then
7204                          ac_cv_weak_dynamic_linking="dummy library"
7205                      else
7206                          ac_cv_weak_dynamic_linking="flat namespace"
7207                      fi
7208                  fi
7209              else
7210                  AC_ERROR([couldn't compile a simple C file])
7211              fi
7212              rm -rf conftest*])
7213         MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
7214     fi
7216 AC_SUBST(MOZ_REPLACE_MALLOC)
7217 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
7219 dnl ========================================================
7220 dnl = Jemalloc build setup
7221 dnl ========================================================
7222 if test -z "$MOZ_MEMORY"; then
7223   if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
7224     MOZ_NATIVE_JEMALLOC=1
7225     AC_CHECK_FUNCS(mallctl nallocm,,
7226       [MOZ_NATIVE_JEMALLOC=
7227        break])
7228     if test -n "$MOZ_NATIVE_JEMALLOC"; then
7229       MOZ_MEMORY=1
7230       AC_DEFINE(MOZ_MEMORY)
7231       AC_DEFINE(MOZ_JEMALLOC3)
7232       AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7233     fi
7234   fi
7235   case "${target}" in
7236     *-mingw*)
7237       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7238         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.])
7239       fi
7240       ;;
7241   esac
7242 else
7243   dnl Don't try to run compiler tests on Windows
7244   if test "$OS_ARCH" = "WINNT"; then
7245     if test -z "$HAVE_64BIT_OS"; then
7246       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7247     else
7248       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7249     fi
7250   else
7251     AC_CHECK_SIZEOF([int *], [4])
7252     case "${ac_cv_sizeof_int_p}" in
7253     4)
7254       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7255       ;;
7256     8)
7257       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7258       ;;
7259     *)
7260       AC_MSG_ERROR([Unexpected pointer size])
7261       ;;
7262     esac
7263   fi
7265   AC_DEFINE(MOZ_MEMORY)
7266   if test -n "$MOZ_JEMALLOC3"; then
7267     AC_DEFINE(MOZ_JEMALLOC3)
7268   fi
7269   if test "x$MOZ_DEBUG" = "x1"; then
7270     AC_DEFINE(MOZ_MEMORY_DEBUG)
7271   fi
7272   dnl The generic feature tests that determine how to compute ncpus are long and
7273   dnl complicated.  Therefore, simply define special cpp variables for the
7274   dnl platforms we have special knowledge of.
7275   case "${target}" in
7276   *-darwin*)
7277     AC_DEFINE(MOZ_MEMORY_DARWIN)
7278     ;;
7279   *-*freebsd*)
7280     AC_DEFINE(MOZ_MEMORY_BSD)
7281     ;;
7282   *-android*|*-linuxandroid*)
7283     AC_DEFINE(MOZ_MEMORY_LINUX)
7284     AC_DEFINE(MOZ_MEMORY_ANDROID)
7285     if test -z "$gonkdir"; then
7286       _WRAP_MALLOC=1
7287     else
7288       AC_DEFINE(MOZ_MEMORY_GONK)
7289     fi
7290     MOZ_GLUE_LDFLAGS=
7291     ;;
7292   *-*linux*)
7293     AC_DEFINE(MOZ_MEMORY_LINUX)
7294     ;;
7295   *-netbsd*)
7296     AC_DEFINE(MOZ_MEMORY_BSD)
7297     ;;
7298   *-solaris*)
7299     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7300     ;;
7301   *-mingw*)
7302     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7303     if test -z "$MOZ_DEBUG"; then
7304       WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7305     else
7306       WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7307     fi
7308     dnl Look for a broken crtdll.obj
7309     WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7310     lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7311     if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7312       MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7313       dnl Also pass this to NSPR/NSS
7314       DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7315     else
7316       DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7317     fi
7318     rm crtdll.obj
7320     export DLLFLAGS
7321     ;;
7322   *)
7323     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7324     ;;
7325   esac
7326 fi # MOZ_MEMORY
7327 AC_SUBST(MOZ_MEMORY)
7328 AC_SUBST(MOZ_JEMALLOC3)
7329 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7330 AC_SUBST(MOZ_GLUE_LDFLAGS)
7331 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7332 AC_SUBST(WIN32_CRT_LIBS)
7333 dnl Need to set this for make because NSS doesn't have configure
7334 AC_SUBST(DLLFLAGS)
7336 dnl We need to wrap dlopen and related functions on Android because we use
7337 dnl our own linker.
7338 if test "$OS_TARGET" = Android; then
7339     WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7340     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7341     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7342     if test -z "$gonkdir"; then
7343         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7344         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=memccpy,--wrap=memchr,--wrap=memrchr,--wrap=memcmp,--wrap=memcpy,--wrap=memmove,--wrap=memset,--wrap=memmem,--wrap=memswap,--wrap=index,--wrap=strchr,--wrap=strrchr,--wrap=strlen,--wrap=strcmp,--wrap=strcpy,--wrap=strcat,--wrap=strcasecmp,--wrap=strncasecmp,--wrap=strstr,--wrap=strcasestr,--wrap=strtok,--wrap=strtok_r,--wrap=strerror,--wrap=strerror_r,--wrap=strnlen,--wrap=strncat,--wrap=strncmp,--wrap=strncpy,--wrap=strlcat,--wrap=strlcpy,--wrap=strcspn,--wrap=strpbrk,--wrap=strsep,--wrap=strspn,--wrap=strcoll,--wrap=strxfrm"
7345     fi
7348 dnl ========================================================
7349 dnl = Use malloc wrapper lib
7350 dnl ========================================================
7351 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7352 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7353     _WRAP_MALLOC=1,
7354     _WRAP_MALLOC= )
7356 if test -n "$_WRAP_MALLOC"; then
7357     if test -n "$GNU_CC"; then
7358         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7359         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7360         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7361         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7362         dnl Wrap operator new and operator delete on Android.
7363         if test "$OS_TARGET" = "Android"; then
7364             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7365             dnl Wrap the nothrow variants too.
7366             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7367         fi
7368     else
7369         AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7370     fi
7373 dnl ========================================================
7374 dnl = Location of malloc wrapper lib
7375 dnl ========================================================
7376 MOZ_ARG_WITH_STRING(wrap-malloc,
7377 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7378     WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7380 dnl ========================================================
7381 dnl = Use JS Call tracing
7382 dnl ========================================================
7383 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7384 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7385     MOZ_TRACE_JSCALLS=1,
7386     MOZ_TRACE_JSCALLS= )
7387 if test -n "$MOZ_TRACE_JSCALLS"; then
7388     AC_DEFINE(MOZ_TRACE_JSCALLS)
7391 dnl ========================================================
7392 dnl = Use incremental GC
7393 dnl ========================================================
7394 JSGC_INCREMENTAL=1
7395 MOZ_ARG_DISABLE_BOOL(gcincremental,
7396 [  --disable-gcincremental Disable incremental GC],
7397     JSGC_INCREMENTAL= )
7398 if test -n "$JSGC_INCREMENTAL"; then
7399     AC_DEFINE(JSGC_INCREMENTAL)
7402 dnl ========================================================
7403 dnl Zealous JavaScript GC
7404 dnl ========================================================
7405 MOZ_ARG_ENABLE_BOOL(gczeal,
7406 [  --enable-gczeal         Enable zealous JavaScript GCing],
7407     JS_GC_ZEAL=1,
7408     JS_GC_ZEAL= )
7409 if test -n "$JS_GC_ZEAL"; then
7410     AC_DEFINE(JS_GC_ZEAL)
7413 dnl ========================================================
7414 dnl JS opt-mode assertions and minidump instrumentation
7415 dnl ========================================================
7416 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7417 [  --enable-js-diagnostics
7418                           Enable JS diagnostic assertions and breakpad data],
7419     JS_CRASH_DIAGNOSTICS=1,
7420     JS_CRASH_DIAGNOSTICS= )
7421 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7422     AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7425 MOZ_CHECK_CCACHE
7427 dnl ========================================================
7428 dnl = Enable static checking using gcc-dehydra
7429 dnl ========================================================
7431 MOZ_ARG_WITH_STRING(static-checking,
7432 [  --with-static-checking=path/to/gcc_dehydra.so
7433                           Enable static checking of code using GCC-dehydra],
7434     DEHYDRA_PATH=$withval,
7435     DEHYDRA_PATH= )
7437 if test -n "$DEHYDRA_PATH"; then
7438     if test ! -f "$DEHYDRA_PATH"; then
7439         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7440     fi
7441     AC_DEFINE(NS_STATIC_CHECKING)
7443 AC_SUBST(DEHYDRA_PATH)
7445 dnl ========================================================
7446 dnl = Enable using the clang plugin to build
7447 dnl ========================================================
7449 MOZ_ARG_ENABLE_BOOL(clang-plugin,
7450 [  --enable-clang-plugin   Enable building with the mozilla clang plugin ],
7451    ENABLE_CLANG_PLUGIN=1,
7452    ENABLE_CLANG_PLUGIN= )
7453 if test -n "$ENABLE_CLANG_PLUGIN"; then
7454     if test -z "$CLANG_CC"; then
7455         AC_MSG_ERROR([Can't use clang plugin without clang.])
7456     fi
7457     AC_DEFINE(MOZ_CLANG_PLUGIN)
7460 AC_SUBST(ENABLE_CLANG_PLUGIN)
7462 dnl ========================================================
7463 dnl = Enable stripping of libs & executables
7464 dnl ========================================================
7465 MOZ_ARG_ENABLE_BOOL(strip,
7466 [  --enable-strip          Enable stripping of libs & executables ],
7467     ENABLE_STRIP=1,
7468     ENABLE_STRIP= )
7470 dnl ========================================================
7471 dnl = Enable stripping of libs & executables when packaging
7472 dnl ========================================================
7473 MOZ_ARG_ENABLE_BOOL(install-strip,
7474 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7475     PKG_SKIP_STRIP= ,
7476     PKG_SKIP_STRIP=1)
7478 dnl ========================================================
7479 dnl = --enable-elf-dynstr-gc
7480 dnl ========================================================
7481 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7482 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7483     USE_ELF_DYNSTR_GC=1,
7484     USE_ELF_DYNSTR_GC= )
7486 dnl ========================================================
7487 dnl = --disable-elf-hack
7488 dnl ========================================================
7490 USE_ELF_HACK=1
7491 MOZ_ARG_DISABLE_BOOL(elf-hack,
7492 [  --disable-elf-hack      Disable elf hacks],
7493     USE_ELF_HACK=,
7494     USE_ELF_HACK=1)
7496 # Disable elf hack for profiling because the built in profiler
7497 # doesn't read the segments properly with elf hack. This is
7498 # temporary and should be fixed soon in the profiler.
7499 if test "$MOZ_PROFILING" = 1; then
7500   USE_ELF_HACK=
7503 # Only enable elfhack where supported
7504 if test "$USE_ELF_HACK" = 1; then
7505     case "${HOST_OS_ARCH},${OS_ARCH}" in
7506     Linux,Linux)
7507         case "${CPU_ARCH}" in
7508         arm | x86 | x86_64)
7509             USE_ELF_HACK=1
7510             ;;
7511         *)
7512             USE_ELF_HACK=
7513             ;;
7514         esac
7515         ;;
7516     *)
7517         USE_ELF_HACK=
7518         ;;
7519     esac
7522 if test "$USE_ELF_HACK" = 1; then
7523     dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7524     dnl memory addresses it maps to. The result is that by the time elfhack
7525     dnl kicks in, it is not possible to apply relocations because of that,
7526     dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7527     dnl segment. It makes elfhack mostly useless, so considering the problems
7528     dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7529     dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7530     dnl the linker creates PT_GNU_RELRO segments.
7531     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7532         LINK_WITH_PT_GNU_RELRO,
7533         [echo "int main() {return 0;}" > conftest.${ac_ext}
7534          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7535             test -s conftest${ac_exeext}; then
7536             if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7537                 LINK_WITH_PT_GNU_RELRO=yes
7538             else
7539                 LINK_WITH_PT_GNU_RELRO=no
7540             fi
7541          else
7542              dnl We really don't expect to get here, but just in case
7543              AC_ERROR([couldn't compile a simple C file])
7544          fi
7545          rm -rf conftest*])
7546     if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7547         AC_MSG_WARN([Disabling elfhack])
7548         USE_ELF_HACK=
7549     fi
7552 dnl ========================================================
7553 dnl = libstdc++ compatibility hacks
7554 dnl ========================================================
7556 STDCXX_COMPAT=
7557 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7558 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
7559     STDCXX_COMPAT=1)
7561 AC_SUBST(STDCXX_COMPAT)
7563 if test -n "$STDCXX_COMPAT"; then
7564    eval $(CXX="$CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7565    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7566    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7569 dnl ========================================================
7570 dnl =
7571 dnl = Profiling and Instrumenting
7572 dnl =
7573 dnl ========================================================
7574 MOZ_ARG_HEADER(Profiling and Instrumenting)
7576 dnl ========================================================
7577 dnl = Enable runtime visual profiling logger
7578 dnl ========================================================
7579 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7580 [  --enable-visual-event-tracer   Enable visual event tracer instrumentation],
7581     MOZ_VISUAL_EVENT_TRACER=1,
7582     MOZ_VISUAL_EVENT_TRACER=)
7583 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7584     AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7587 dnl ========================================================
7588 dnl Turn on reflow counting
7589 dnl ========================================================
7590 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7591 [  --enable-reflow-perf    Enable reflow performance tracing],
7592     MOZ_REFLOW_PERF=1,
7593     MOZ_REFLOW_PERF= )
7594 if test -n "$MOZ_REFLOW_PERF"; then
7595     AC_DEFINE(MOZ_REFLOW_PERF)
7598 dnl ========================================================
7599 dnl Enable code size metrics.
7600 dnl ========================================================
7601 MOZ_ARG_ENABLE_BOOL(codesighs,
7602 [  --enable-codesighs      Enable code size analysis tools],
7603     _ENABLE_CODESIGHS=1,
7604     _ENABLE_CODESIGHS= )
7605 if test -n "$_ENABLE_CODESIGHS"; then
7606     if test -d $srcdir/tools/codesighs; then
7607         MOZ_MAPINFO=1
7608     else
7609         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7610     fi
7613 dnl ========================================================
7614 dnl = Enable Radio Interface for B2G (Gonk usually)
7615 dnl ========================================================
7616 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7617 [  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7618     MOZ_B2G_RIL=1,
7619     MOZ_B2G_RIL= )
7620 if test -n "$MOZ_B2G_RIL"; then
7621     AC_DEFINE(MOZ_B2G_RIL)
7623 AC_SUBST(MOZ_B2G_RIL)
7625 dnl ========================================================
7626 dnl = Enable Radio FM for B2G (Gonk usually)
7627 dnl ========================================================
7628 if test -n "$MOZ_B2G_FM"; then
7629     AC_DEFINE(MOZ_B2G_FM)
7631 AC_SUBST(MOZ_B2G_FM)
7633 dnl ========================================================
7634 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7635 dnl ========================================================
7636 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7637 [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
7638     MOZ_B2G_BT=1,
7639     MOZ_B2G_BT= )
7640 if test -n "$MOZ_B2G_BT"; then
7641     AC_DEFINE(MOZ_B2G_BT)
7643 AC_SUBST(MOZ_B2G_BT)
7645 dnl ========================================================
7646 dnl = Enable Support for System Messages API
7647 dnl ========================================================
7648 if test -n "$MOZ_SYS_MSG"; then
7649     AC_DEFINE(MOZ_SYS_MSG)
7651 AC_SUBST(MOZ_SYS_MSG)
7653 dnl ========================================================
7654 dnl = Enable Support for Time Manager API
7655 dnl ========================================================
7656 if test -n "$MOZ_TIME_MANAGER"; then
7657     AC_DEFINE(MOZ_TIME_MANAGER)
7659 AC_SUBST(MOZ_TIME_MANAGER)
7661 dnl ========================================================
7662 dnl = Enable Camera Interface for B2G (Gonk usually)
7663 dnl ========================================================
7664 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7665 [  --enable-b2g-camera      Set compile flags necessary for compiling camera API for B2G ],
7666     MOZ_B2G_CAMERA=1,
7667     MOZ_B2G_CAMERA= )
7668 if test -n "$MOZ_B2G_CAMERA"; then
7669    AC_DEFINE(MOZ_B2G_CAMERA)
7671 AC_SUBST(MOZ_B2G_CAMERA)
7673 dnl ========================================================
7674 dnl = Enable Support B2G-specific changes to the NSS
7675 dnl = certificate trust database.
7676 dnl ========================================================
7677 if test -n "$MOZ_B2G_CERTDATA"; then
7678     AC_DEFINE(MOZ_B2G_CERTDATA)
7680 AC_SUBST(MOZ_B2G_CERTDATA)
7682 dnl ========================================================
7683 dnl = Enable Support for Payment API
7684 dnl ========================================================
7685 if test -n "$MOZ_PAY"; then
7686     AC_DEFINE(MOZ_PAY)
7688 AC_SUBST(MOZ_PAY)
7690 dnl ========================================================
7691 dnl = Enable Support for AudioChannelManager API
7692 dnl ========================================================
7693 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7694     AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7696 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7698 dnl ========================================================
7699 dnl = Support for demangling undefined symbols
7700 dnl ========================================================
7701 if test -z "$SKIP_LIBRARY_CHECKS"; then
7702     AC_LANG_SAVE
7703     AC_LANG_CPLUSPLUS
7704     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7705     AC_LANG_RESTORE
7708 # Demangle only for debug or trace-malloc or DMD builds
7709 MOZ_DEMANGLE_SYMBOLS=
7710 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7711     MOZ_DEMANGLE_SYMBOLS=1
7712     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7714 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7716 dnl ========================================================
7717 dnl = Support for gcc stack unwinding (from gcc 3.3)
7718 dnl ========================================================
7719 if test -z "$SKIP_LIBRARY_CHECKS"; then
7720     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7723 dnl ========================================================
7724 dnl JIT observers
7725 dnl ========================================================
7727 MOZ_ARG_WITH_STRING(jitreport-granularity,
7728 [  --jitreport-granularity=N
7729                            Default granularity at which to report JIT code
7730                            to external tools
7731                              0 - no info
7732                              1 - code ranges for whole functions only
7733                              2 - per-line information
7734                              3 - per-op information],
7735   JITREPORT_GRANULARITY=$withval,
7736   JITREPORT_GRANULARITY=3)
7738 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7740 dnl ========================================================
7741 dnl =
7742 dnl = Misc. Options
7743 dnl =
7744 dnl ========================================================
7745 MOZ_ARG_HEADER(Misc. Options)
7747 dnl ========================================================
7748 dnl update xterm title
7749 dnl ========================================================
7750 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7751 [  --enable-xterm-updates  Update XTERM titles with current command.],
7752     MOZ_UPDATE_XTERM=1,
7753     MOZ_UPDATE_XTERM= )
7755 dnl =========================================================
7756 dnl = Chrome format
7757 dnl =========================================================
7758 MOZ_ARG_ENABLE_STRING([chrome-format],
7759 [  --enable-chrome-format=jar|flat|omni
7760                           Select FORMAT of chrome files during packaging],
7761     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7763 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7764     MOZ_CHROME_FILE_FORMAT=jar
7767 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7768     AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7771 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7772     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7773     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7774     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7777 dnl =========================================================
7778 dnl Omnijar packaging (bug 552121)
7779 dnl =========================================================
7780 dnl Omnijar packaging is compatible with flat packaging.
7781 dnl In unpackaged builds, omnijar looks for files as if
7782 dnl things were flat packaged. After packaging, all files
7783 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7784 dnl is set to flat since putting files into jars is only
7785 dnl done during packaging with omnijar.
7786 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7787     MOZ_OMNIJAR=1
7788     AC_DEFINE(MOZ_OMNIJAR)
7790 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7791 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7792     MOZ_CHROME_FILE_FORMAT=flat
7793 else
7794     MOZ_CHROME_FILE_FORMAT=symlink
7797 OMNIJAR_NAME=omni.ja
7798 AC_SUBST(OMNIJAR_NAME)
7799 AC_SUBST(MOZ_OMNIJAR)
7800 AC_SUBST(MOZ_PACKAGER_FORMAT)
7802 dnl ========================================================
7803 dnl = Define default location for MOZILLA_FIVE_HOME
7804 dnl ========================================================
7805 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7806 [  --with-default-mozilla-five-home
7807                           Set the default value for MOZILLA_FIVE_HOME],
7808 [ val=`echo $withval`
7809   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7811 dnl ========================================================
7812 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7813 dnl ========================================================
7814 MOZ_ARG_WITH_STRING(user-appdir,
7815 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7816 [ val=`echo $withval`
7817 if echo "$val" | grep "\/" >/dev/null; then
7818     AC_MSG_ERROR("Homedir must be single relative path.")
7819 else
7820     MOZ_USER_DIR="$val"
7821 fi])
7823 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7825 dnl ========================================================
7826 dnl = Doxygen configuration
7827 dnl ========================================================
7828 dnl Use commas to specify multiple dirs to this arg
7829 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7830 MOZ_ARG_WITH_STRING(doc-input-dirs,
7831 [  --with-doc-input-dirs=DIRS
7832                           Header/idl dirs to create docs from],
7833 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7834 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7836 dnl Use commas to specify multiple dirs to this arg
7837 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7838 MOZ_ARG_WITH_STRING(doc-include-dirs,
7839 [  --with-doc-include-dirs=DIRS
7840                           Include dirs to preprocess doc headers],
7841 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7842 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7844 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7845 MOZ_ARG_WITH_STRING(doc-output-dir,
7846 [  --with-doc-output-dir=DIR
7847                           Dir to generate docs into],
7848 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7849 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7851 if test -z "$SKIP_COMPILER_CHECKS"; then
7852 dnl ========================================================
7853 dnl =
7854 dnl = Compiler Options
7855 dnl =
7856 dnl ========================================================
7857 MOZ_ARG_HEADER(Compiler Options)
7859 dnl ========================================================
7860 dnl Check for gcc -pipe support
7861 dnl ========================================================
7862 AC_MSG_CHECKING([for -pipe support])
7863 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7864     dnl Any gcc that supports firefox supports -pipe.
7865     CFLAGS="$CFLAGS -pipe"
7866     CXXFLAGS="$CXXFLAGS -pipe"
7867     AC_MSG_RESULT([yes])
7868 else
7869     AC_MSG_RESULT([no])
7872 dnl ========================================================
7873 dnl Profile guided optimization (gcc checks)
7874 dnl ========================================================
7875 dnl Test for profiling options
7876 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7878 _SAVE_CFLAGS="$CFLAGS"
7879 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7881 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7882 AC_TRY_COMPILE([], [return 0;],
7883                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7884                  result="yes" ], result="no")
7885 AC_MSG_RESULT([$result])
7887 if test $result = "yes"; then
7888   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7889   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7890   PROFILE_USE_LDFLAGS="-fprofile-use"
7893 CFLAGS="$_SAVE_CFLAGS"
7895 if test -n "$INTEL_CC"; then
7896   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7897   PROFILE_GEN_LDFLAGS=
7898   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7899   PROFILE_USE_LDFLAGS=
7902 dnl Sun Studio on Solaris
7903 if test "$SOLARIS_SUNPRO_CC"; then
7904   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7905   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7906   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7907   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7910 AC_SUBST(PROFILE_GEN_CFLAGS)
7911 AC_SUBST(PROFILE_GEN_LDFLAGS)
7912 AC_SUBST(PROFILE_USE_CFLAGS)
7913 AC_SUBST(PROFILE_USE_LDFLAGS)
7915 AC_LANG_CPLUSPLUS
7917 dnl ========================================================
7918 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7919 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7920 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7921 dnl ========================================================
7922 _SAVE_CXXFLAGS=$CXXFLAGS
7923 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7924 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7925     ac_nscap_nonconst_opeq_bug,
7926     [AC_TRY_COMPILE([
7927                       template <class T>
7928                       class Pointer
7929                         {
7930                         public:
7931                           T* myPtr;
7932                         };
7934                       template <class T, class U>
7935                       int operator==(const Pointer<T>& rhs, U* lhs)
7936                         {
7937                           return rhs.myPtr == lhs;
7938                         }
7940                       template <class T, class U>
7941                       int operator==(const Pointer<T>& rhs, const U* lhs)
7942                         {
7943                           return rhs.myPtr == lhs;
7944                         }
7945                     ],
7946                     [
7947                       Pointer<int> foo;
7948                       const int* bar;
7949                       return foo == bar;
7950                     ],
7951                     ac_nscap_nonconst_opeq_bug="no",
7952                     ac_nscap_nonconst_opeq_bug="yes")])
7953 CXXFLAGS="$_SAVE_CXXFLAGS"
7955 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7956     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7958 fi # ! SKIP_COMPILER_CHECKS
7960 AC_DEFINE(CPP_THROW_NEW, [throw()])
7961 AC_LANG_C
7963 if test "$COMPILE_ENVIRONMENT"; then
7964 MOZ_EXPAND_LIBS
7965 fi # COMPILE_ENVIRONMENT
7967 dnl ========================================================
7968 dnl =
7969 dnl = Build depencency options
7970 dnl =
7971 dnl ========================================================
7972 MOZ_ARG_HEADER(Build dependencies)
7974 if test "$GNU_CC" -a "$GNU_CXX"; then
7975   _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7976 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7977 elif test "$SOLARIS_SUNPRO_CC"; then
7978   _DEPEND_CFLAGS=
7979 else
7980   dnl Don't override this for MSVC
7981   if test -z "$_WIN32_MSVC"; then
7982     _USE_CPP_INCLUDE_FLAG=
7983     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7984     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7985   else
7986     echo '#include <stdio.h>' > dummy-hello.c
7987     changequote(,)
7988     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7989     changequote([,])
7990     if test -z "$CL_INCLUDES_PREFIX"; then
7991         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7992     fi
7993     AC_SUBST(CL_INCLUDES_PREFIX)
7994     rm -f dummy-hello.c
7995   fi
7998 dnl ========================================================
7999 dnl =
8000 dnl = Static Build Options
8001 dnl =
8002 dnl ========================================================
8003 MOZ_ARG_HEADER(Static build options)
8005 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8006 if test "$OS_ARCH" = "WINNT"; then
8007   ENABLE_SHARED_JS=1
8010 MOZ_ARG_ENABLE_BOOL(shared-js,
8011 [  --enable-shared-js
8012                           Create a shared JavaScript library.],
8013     ENABLE_SHARED_JS=1,
8014     ENABLE_SHARED_JS=)
8016 if test -n "$ENABLE_SHARED_JS"; then
8017   JS_SHARED_LIBRARY=1
8018   MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
8019 else
8020   MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
8021   AC_DEFINE(MOZ_STATIC_JS)
8023 AC_SUBST(JS_SHARED_LIBRARY)
8025 AC_SUBST(LIBXUL_LIBS)
8026 XPCOM_LIBS="$LIBXUL_LIBS"
8028 dnl ========================================================
8029 dnl =
8030 dnl = Standalone module options
8031 dnl =
8032 dnl ========================================================
8033 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8035 dnl Check for GLib.
8036 dnl ========================================================
8038 if test -z "$SKIP_PATH_CHECKS"; then
8039 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8040     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8041         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8042     fi
8046 if test -z "${GLIB_GMODULE_LIBS}" \
8047    -a -n "${GLIB_CONFIG}"\
8048     -a "${GLIB_CONFIG}" != no\
8049 ; then
8050     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8053 AC_SUBST(GLIB_CFLAGS)
8054 AC_SUBST(GLIB_LIBS)
8055 AC_SUBST(GLIB_GMODULE_LIBS)
8057 dnl ========================================================
8058 dnl Graphics checks.
8059 dnl ========================================================
8061 if test "${OS_TARGET}" = "WINNT" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
8062 MOZ_ENABLE_SKIA=1
8063 else
8064 MOZ_ENABLE_SKIA=
8067 MOZ_ARG_ENABLE_BOOL(skia,
8068 [  --enable-skia   Enable use of Skia],
8069 MOZ_ENABLE_SKIA=1,
8070 MOZ_ENABLE_SKIA=)
8072 if test "$USE_FC_FREETYPE"; then
8073     if test "$COMPILE_ENVIRONMENT"; then
8074         dnl ========================================================
8075         dnl = Check for freetype2 and its functionality
8076         dnl ========================================================
8077         PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
8079         if test "$_HAVE_FREETYPE2"; then
8080             _SAVE_LIBS="$LIBS"
8081             _SAVE_CFLAGS="$CFLAGS"
8082             LIBS="$LIBS $FT2_LIBS"
8083             CFLAGS="$CFLAGS $FT2_CFLAGS"
8085             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
8086                 ac_cv_member_FT_Bitmap_Size_y_ppem,
8087                 [AC_TRY_COMPILE([#include <ft2build.h>
8088                                  #include FT_FREETYPE_H],
8089                                 [FT_Bitmap_Size s;
8090                                  if (sizeof s.y_ppem) return 0;
8091                                  return 1],
8092                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
8093                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
8094             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
8095                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
8096             else
8097                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
8098             fi
8099             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
8100                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
8101                                [FT_Bitmap_Size structure includes y_ppem field])
8103             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
8105             LIBS="$_SAVE_LIBS"
8106             CFLAGS="$_SAVE_CFLAGS"
8107         fi
8109         _SAVE_CPPFLAGS="$CPPFLAGS"
8110         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8111         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8112             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8113         CPPFLAGS="$_SAVE_CPPFLAGS"
8114     else
8115         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8116     fi
8118     PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
8119     [
8120         if test "$MOZ_PANGO"; then
8121             MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
8122             MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
8123         else
8124             FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
8125             FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
8126         fi
8127     ])
8130 dnl ========================================================
8131 dnl Check for pixman and cairo
8132 dnl ========================================================
8134 MOZ_TREE_CAIRO=1
8135 MOZ_ARG_ENABLE_BOOL(system-cairo,
8136 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8137 MOZ_TREE_CAIRO=,
8138 MOZ_TREE_CAIRO=1 )
8140 MOZ_TREE_PIXMAN=1
8141 MOZ_ARG_ENABLE_BOOL(system-pixman,
8142 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8143 MOZ_TREE_PIXMAN=,
8144 MOZ_TREE_PIXMAN=force,
8145 MOZ_TREE_PIXMAN=1 )
8147 # System cairo depends on system pixman
8148 if test "$MOZ_TREE_PIXMAN" = "force"; then
8149     if test -z "$MOZ_TREE_CAIRO"; then
8150         AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
8151     else
8152         MOZ_TREE_PIXMAN=1
8153     fi
8154 elif test -z "$MOZ_TREE_CAIRO"; then
8155     MOZ_TREE_PIXMAN=
8158 if test "$MOZ_TREE_PIXMAN"; then
8159     AC_DEFINE(MOZ_TREE_PIXMAN)
8160     MOZ_PIXMAN_CFLAGS=""
8161     MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8162 else
8163     PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8164     MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8165     MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8167 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8168 AC_SUBST(MOZ_PIXMAN_LIBS)
8170 # Check for headers defining standard int types.
8171 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8173 if test "$MOZ_TREE_CAIRO"; then
8174     MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8175     AC_DEFINE(MOZ_TREE_CAIRO)
8177     # For now we assume that we will have a uint64_t available through
8178     # one of the above headers or mozstdint.h.
8179     AC_DEFINE(HAVE_UINT64_T)
8181     # Define macros for cairo-features.h
8182     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8183     if test "$MOZ_X11"; then
8184         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8185         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8186         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8187         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8188         MOZ_ENABLE_CAIRO_FT=1
8189         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8190     fi
8191     case "$MOZ_WIDGET_TOOLKIT" in
8192       qt)
8193         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8194         ;;
8195       cocoa | uikit)
8196         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8197         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8198         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8199         ;;
8200       windows)
8201         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8202         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8203         if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8204             WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8205             WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8206             MOZ_ENABLE_D2D_SURFACE=1
8207             MOZ_ENABLE_DWRITE_FONT=1
8208         else
8209             WIN32_DWRITE_FONT_FEATURE=
8210             WIN32_D2D_SURFACE_FEATURE=
8211         fi
8213         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8215         dnl D3D10 Layers depend on D2D Surfaces.
8216         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8217           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8218         fi
8219         ;;
8220       os2)
8221         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8222         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8223         MOZ_ENABLE_CAIRO_FT=1
8224         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8225         CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8226         CAIRO_FT_LIBS=""
8227         ;;
8228     esac
8229     if test "$USE_FC_FREETYPE"; then
8230         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8231     fi
8232     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8233     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8234     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8235     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8236     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8237     AC_SUBST(CAIRO_FT_CFLAGS)
8239     AC_SUBST(PS_SURFACE_FEATURE)
8240     AC_SUBST(PDF_SURFACE_FEATURE)
8241     AC_SUBST(SVG_SURFACE_FEATURE)
8242     AC_SUBST(XLIB_SURFACE_FEATURE)
8243     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8244     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8245     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8246     AC_SUBST(WIN32_SURFACE_FEATURE)
8247     AC_SUBST(OS2_SURFACE_FEATURE)
8248     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8249     AC_SUBST(FT_FONT_FEATURE)
8250     AC_SUBST(FC_FONT_FEATURE)
8251     AC_SUBST(WIN32_FONT_FEATURE)
8252     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8253     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8254     AC_SUBST(QUARTZ_FONT_FEATURE)
8255     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8256     AC_SUBST(QT_SURFACE_FEATURE)
8257     AC_SUBST(TEE_SURFACE_FEATURE)
8259     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8260     MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8262     if test "$MOZ_X11"; then
8263         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8264     fi
8266     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8267 else
8268     PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8269     MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8270     MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8271     PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8272     if test "$MOZ_X11"; then
8273         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8274         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8275         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8276         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8277     fi
8280 AC_SUBST(MOZ_TREE_CAIRO)
8281 AC_SUBST(MOZ_CAIRO_CFLAGS)
8282 AC_SUBST(MOZ_CAIRO_LIBS)
8283 AC_SUBST(MOZ_CAIRO_OSLIBS)
8284 AC_SUBST(MOZ_TREE_PIXMAN)
8286 dnl ========================================================
8287 dnl qcms
8288 dnl ========================================================
8290 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8291 AC_SUBST(QCMS_LIBS)
8293 dnl ========================================================
8294 dnl HarfBuzz
8295 dnl ========================================================
8296 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8297 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8299 dnl ========================================================
8300 dnl SIL Graphite
8301 dnl ========================================================
8302 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8303 AC_SUBST(MOZ_GRAPHITE_LIBS)
8305 dnl ========================================================
8306 dnl OTS
8307 dnl ========================================================
8308 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8309 AC_SUBST(MOZ_OTS_LIBS)
8311 dnl ========================================================
8312 dnl Skia 
8313 dnl ========================================================
8314 if test "$MOZ_ENABLE_SKIA"; then
8315   MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8316   AC_DEFINE(MOZ_ENABLE_SKIA)
8317   AC_DEFINE(USE_SKIA)
8318   if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8319     AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8320   elif test "$OS_ARCH" = "WINNT"; then
8321     AC_DEFINE(SKIA_DLL)
8322     AC_DEFINE(GR_DLL)
8323   fi
8325   if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64"; then
8326     MOZ_ENABLE_SKIA_GPU=1
8327     AC_DEFINE(USE_SKIA_GPU)
8328     AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8329   fi
8330 else
8331   MOZ_SKIA_LIBS=
8333 AC_SUBST(MOZ_ENABLE_SKIA)
8334 AC_SUBST(MOZ_SKIA_LIBS)
8336 dnl ========================================================
8337 dnl disable xul
8338 dnl ========================================================
8339 MOZ_ARG_DISABLE_BOOL(xul,
8340 [  --disable-xul           Disable XUL],
8341     MOZ_XUL= )
8342 if test "$MOZ_XUL"; then
8343   AC_DEFINE(MOZ_XUL)
8344 else
8345   dnl remove extensions that require XUL
8346   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8349 AC_SUBST(MOZ_XUL)
8351 dnl ========================================================
8352 dnl disable profile locking
8353 dnl   do no use this in applications that can have more than
8354 dnl   one process accessing the profile directory.
8355 dnl ========================================================
8356 MOZ_ARG_DISABLE_BOOL(profilelocking,
8357 [  --disable-profilelocking
8358                           Disable profile locking],
8359     MOZ_PROFILELOCKING=,
8360     MOZ_PROFILELOCKING=1 )
8361 if test "$MOZ_PROFILELOCKING"; then
8362   AC_DEFINE(MOZ_PROFILELOCKING)
8365 dnl ========================================================
8366 dnl necko configuration options
8367 dnl ========================================================
8370 dnl option to disable various necko protocols
8372 MOZ_ARG_ENABLE_STRING(necko-protocols,
8373 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8374                           Enable/disable specific protocol handlers],
8375 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8376     if test "$option" = "yes" -o "$option" = "all"; then
8377         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8378     elif test "$option" = "no" -o "$option" = "none"; then
8379         NECKO_PROTOCOLS=""
8380     elif test "$option" = "default"; then
8381         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8382     elif test `echo "$option" | grep -c \^-` != 0; then
8383         option=`echo $option | sed 's/^-//'`
8384         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8385     else
8386         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8387     fi
8388 done],
8389     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8390 dnl Remove dupes
8391 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8392 AC_SUBST(NECKO_PROTOCOLS)
8393 for p in $NECKO_PROTOCOLS; do
8394     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8395     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8396 done
8399 dnl option to disable necko's wifi scanner
8401 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8402 [  --disable-necko-wifi    Disable necko wifi scanner],
8403     NECKO_WIFI=,
8404     NECKO_WIFI=1)
8406 if test "$OS_ARCH" = "OS2"; then
8407   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8408   NECKO_WIFI=
8410 if test "$NECKO_WIFI" -a \
8411         "$OS_ARCH" != "Linux" -a \
8412         "$OS_ARCH" != "Darwin" -a \
8413         "$OS_ARCH" != "SunOS" -a \
8414         "$OS_ARCH" != "WINNT"; then
8415   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8418 if test "$NECKO_WIFI"; then
8419   AC_DEFINE(NECKO_WIFI)
8420   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8422 AC_SUBST(NECKO_WIFI)
8425 dnl option to disable cookies
8427 MOZ_ARG_DISABLE_BOOL(cookies,
8428 [  --disable-cookies       Disable cookie support],
8429     NECKO_COOKIES=,
8430     NECKO_COOKIES=1)
8431 AC_SUBST(NECKO_COOKIES)
8432 if test "$NECKO_COOKIES"; then
8433     AC_DEFINE(NECKO_COOKIES)
8434     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8438 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8440 MOZ_ARG_DISABLE_BOOL(ctypes,
8441 [  --disable-ctypes        Disable js-ctypes],
8442     BUILD_CTYPES=,
8443     BUILD_CTYPES=1)
8444 AC_SUBST(BUILD_CTYPES)
8445 if test "$BUILD_CTYPES"; then
8446     AC_DEFINE(BUILD_CTYPES)
8449 dnl Build Places if required
8450 if test "$MOZ_PLACES"; then
8451   AC_DEFINE(MOZ_PLACES)
8454 dnl Build Common JS modules provided by services.
8455 AC_SUBST(MOZ_SERVICES_COMMON)
8456 if test -n "$MOZ_SERVICES_COMMON"; then
8457   AC_DEFINE(MOZ_SERVICES_COMMON)
8460 dnl Build Services crypto component (used by Sync)
8461 AC_SUBST(MOZ_SERVICES_CRYPTO)
8462 if test -n "$MOZ_SERVICES_CRYPTO"; then
8463   AC_DEFINE(MOZ_SERVICES_CRYPTO)
8466 dnl Build Firefox Health Reporter Service
8467 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8468 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8469   AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8472 dnl Build Services metrics component
8473 AC_SUBST(MOZ_SERVICES_METRICS)
8474 if test -n "$MOZ_SERVICES_METRICS"; then
8475   AC_DEFINE(MOZ_SERVICES_METRICS)
8478 dnl Build Notifications if required
8479 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8480 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8481   AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8484 dnl Build Sync Services if required
8485 AC_SUBST(MOZ_SERVICES_SYNC)
8486 if test -n "$MOZ_SERVICES_SYNC"; then
8487   AC_DEFINE(MOZ_SERVICES_SYNC)
8490 dnl Build Captive Portal Detector if required
8491 AC_SUBST(MOZ_CAPTIVEDETECT)
8492 if test -n "$MOZ_CAPTIVEDETECT"; then
8493   AC_DEFINE(MOZ_CAPTIVEDETECT)
8496 dnl Build WBMP decoder if required
8497 AC_SUBST(MOZ_WBMP)
8498 if test -n "$MOZ_WBMP"; then
8499   AC_DEFINE(MOZ_WBMP)
8502 dnl ========================================================
8503 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8504     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8507 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8508   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8511 if test "$MOZ_APP_COMPONENT_MODULES"; then
8512   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8515 dnl ========================================================
8516 dnl =
8517 dnl = Maintainer debug option (no --enable equivalent)
8518 dnl =
8519 dnl ========================================================
8521 AC_SUBST(AR)
8522 AC_SUBST(AR_FLAGS)
8523 AC_SUBST(AR_LIST)
8524 AC_SUBST(AR_EXTRACT)
8525 AC_SUBST(AR_DELETE)
8526 AC_SUBST(AS)
8527 AC_SUBST(ASFLAGS)
8528 AC_SUBST(AS_DASH_C_FLAG)
8529 AC_SUBST(LD)
8530 AC_SUBST(RC)
8531 AC_SUBST(RCFLAGS)
8532 AC_SUBST(MC)
8533 AC_SUBST(WINDRES)
8534 AC_SUBST(IMPLIB)
8535 AC_SUBST(FILTER)
8536 AC_SUBST(BIN_FLAGS)
8537 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8538 AC_SUBST(MOZ_UPDATE_XTERM)
8539 AC_SUBST(MOZ_PLATFORM_MAEMO)
8540 AC_SUBST(MOZ_AUTH_EXTENSION)
8541 AC_SUBST(MOZ_PERMISSIONS)
8542 AC_SUBST(MOZ_PREF_EXTENSIONS)
8543 AC_SUBST(MOZ_JS_LIBS)
8544 AC_SUBST(MOZ_PSM)
8545 AC_SUBST(MOZ_DEBUG)
8546 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8547 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8548 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8549 AC_SUBST(MOZ_DEBUG_FLAGS)
8550 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8551 AC_SUBST(WARNINGS_AS_ERRORS)
8552 AC_SUBST(MOZ_EXTENSIONS)
8553 AC_SUBST(MOZ_JSDEBUGGER)
8554 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8555 AC_SUBST(MOZ_JPROF)
8556 AC_SUBST(MOZ_SHARK)
8557 AC_SUBST(MOZ_INSTRUMENTS)
8558 AC_SUBST(MOZ_CALLGRIND)
8559 AC_SUBST(MOZ_VTUNE)
8560 AC_SUBST(MOZ_PROFILING)
8561 AC_SUBST(LIBICONV)
8562 AC_SUBST(MOZ_PLACES)
8563 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8564 AC_SUBST(MOZ_FEEDS)
8565 AC_SUBST(NS_PRINTING)
8566 AC_SUBST(MOZ_WEBGL)
8567 AC_SUBST(MOZ_HELP_VIEWER)
8568 AC_SUBST(TOOLCHAIN_PREFIX)
8570 AC_SUBST(JAVA)
8571 AC_SUBST(JAVAC)
8572 AC_SUBST(JAVAH)
8573 AC_SUBST(JAR)
8575 AC_SUBST(MOZ_PROFILELOCKING)
8577 AC_SUBST(ENABLE_TESTS)
8578 AC_SUBST(ENABLE_MARIONETTE)
8579 AC_SUBST(IBMBIDI)
8580 AC_SUBST(MOZ_UNIVERSALCHARDET)
8581 AC_SUBST(ACCESSIBILITY)
8582 AC_SUBST(MOZ_SPELLCHECK)
8583 AC_SUBST(MOZ_ANDROID_OMTC)
8584 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8585 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8586 AC_SUBST(MOZ_CRASHREPORTER)
8587 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8588 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8589 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8590 AC_SUBST(MOZ_STUB_INSTALLER)
8591 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8592 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8593 AC_SUBST(MOZ_UPDATER)
8594 AC_SUBST(MOZ_ANGLE_RENDERER)
8595 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8596 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8597 AC_SUBST(MOZ_D3DX9_VERSION)
8598 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8599 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8600 AC_SUBST(MOZ_METRO)
8602 AC_SUBST(MOZ_ANDROID_HISTORY)
8603 AC_SUBST(MOZ_WEBSMS_BACKEND)
8604 AC_SUBST(MOZ_ANDROID_WALLPAPER)
8605 AC_SUBST(MOZ_ANDROID_BEAM)
8606 AC_SUBST(ENABLE_STRIP)
8607 AC_SUBST(PKG_SKIP_STRIP)
8608 AC_SUBST(STRIP_FLAGS)
8609 AC_SUBST(USE_ELF_DYNSTR_GC)
8610 AC_SUBST(USE_ELF_HACK)
8611 AC_SUBST(INCREMENTAL_LINKER)
8612 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8613 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8615 AC_SUBST(MOZ_FIX_LINK_PATHS)
8616 AC_SUBST(XPCOM_LIBS)
8617 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8618 AC_SUBST(XPCOM_GLUE_LDOPTS)
8619 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8620 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8621 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8623 AC_SUBST(USE_DEPENDENT_LIBS)
8625 AC_SUBST(MOZ_BUILD_ROOT)
8626 AC_SUBST(MOZ_OS2_TOOLS)
8628 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8629 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8630 AC_SUBST(MOZ_LINKER_EXTRACT)
8632 dnl ========================================================
8633 dnl = Mac bundle name prefix
8634 dnl ========================================================
8635 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8636 [  --with-macbundlename-prefix=prefix
8637                           Prefix for MOZ_MACBUNDLE_NAME],
8638 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8640 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8641 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8642   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8645 if test "$MOZ_DEBUG"; then
8646   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8647 else
8648   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8650 AC_SUBST(MOZ_MACBUNDLE_NAME)
8652 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8653 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8654 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8655 if test "$MOZ_DEBUG"; then
8656   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8659 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8660 AC_SUBST(MOZ_MACBUNDLE_ID)
8662 dnl ========================================================
8663 dnl = Child Process Name for IPC
8664 dnl ========================================================
8665 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8666   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8667 else
8668   # We want to let Android unpack the file at install time, but it only does
8669   # so if the file is named libsomething.so. The lib/ path is also required
8670   # because the unpacked file will be under the lib/ subdirectory and will
8671   # need to be executed from that path.
8672   MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8674 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8676 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8677 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8679 # The following variables are available to branding and application
8680 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8681 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8682 # impacts profile location and user-visible fields.
8683 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8684 # versions of a given application (e.g. Aurora and Firefox both use
8685 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8686 # for application.ini's "Name" field, which controls profile location in
8687 # the absence of a "Profile" field (see below), and various system
8688 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8689 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8690 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8691 # builds (e.g. Aurora for Firefox).
8692 # - MOZ_APP_VERSION: Defines the application version number.
8693 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8694 # defaults to a lowercase form of MOZ_APP_BASENAME.
8695 # - MOZ_APP_PROFILE: When set, used for application.ini's
8696 # "Profile" field, which controls profile location.
8697 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8698 # crash reporter server url.
8699 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8700 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8702 if test -z "$MOZ_APP_NAME"; then
8703    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8706 # For extensions and langpacks, we require a max version that is compatible
8707 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8708 # 10.0a1 and 10.0a2 aren't affected
8709 # 10.0 becomes 10.0.*
8710 # 10.0.1 becomes 10.0.*
8711 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8712 if test -z "$IS_ALPHA"; then
8713   changequote(,)
8714   MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8715   changequote([,])
8716 else
8717   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8720 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8721 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8722 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8724 AC_SUBST(MOZ_APP_NAME)
8725 AC_SUBST(MOZ_APP_DISPLAYNAME)
8726 AC_SUBST(MOZ_APP_BASENAME)
8727 AC_SUBST(MOZ_APP_VENDOR)
8728 AC_SUBST(MOZ_APP_PROFILE)
8729 AC_SUBST(MOZ_APP_ID)
8730 AC_SUBST(MAR_CHANNEL_ID)
8731 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8732 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8733 AC_SUBST(MOZ_EXTENSION_MANAGER)
8734 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8735 AC_SUBST(MOZ_APP_UA_NAME)
8736 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8737 AC_SUBST(MOZ_APP_VERSION)
8738 AC_SUBST(MOZ_APP_MAXVERSION)
8739 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8740 AC_SUBST(FIREFOX_VERSION)
8741 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8742 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8743   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8745 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8746 AC_SUBST(MOZ_UA_BUILDID)
8748 AC_SUBST(MOZ_APP_STATIC_INI)
8750 AC_SUBST(MOZ_PKG_SPECIAL)
8752 AC_SUBST(MOZILLA_OFFICIAL)
8754 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8755 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8757 if test "$MOZ_TELEMETRY_REPORTING"; then
8758     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8760     # Enable Telemetry by default for nightly and aurora channels
8761     if test "$MOZ_UPDATE_CHANNEL" = "nightly" -o \
8762         "$MOZ_UPDATE_CHANNEL" = "aurora"; then
8763         AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8764     fi
8767 dnl If we have any service that uploads data (and requires data submission
8768 dnl policy alert), set MOZ_DATA_REPORTING.
8769 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8770 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8771   MOZ_DATA_REPORTING=1
8772   AC_DEFINE(MOZ_DATA_REPORTING)
8773   AC_SUBST(MOZ_DATA_REPORTING)
8776 dnl win32 options
8777 AC_SUBST(MOZ_MAPINFO)
8778 AC_SUBST(MOZ_BROWSE_INFO)
8779 AC_SUBST(MOZ_TOOLS_DIR)
8780 AC_SUBST(WIN32_REDIST_DIR)
8781 AC_SUBST(MAKENSISU)
8783 dnl Echo the CFLAGS to remove extra whitespace.
8784 CFLAGS=`echo \
8785         $_WARNINGS_CFLAGS \
8786         $CFLAGS`
8788 CXXFLAGS=`echo \
8789         $_WARNINGS_CXXFLAGS \
8790         $CXXFLAGS`
8792 COMPILE_CFLAGS=`echo \
8793     $_DEFINES_CFLAGS \
8794         $_DEPEND_CFLAGS \
8795     $COMPILE_CFLAGS`
8797 COMPILE_CXXFLAGS=`echo \
8798     $_DEFINES_CXXFLAGS \
8799         $_DEPEND_CFLAGS \
8800     $COMPILE_CXXFLAGS`
8802 AC_SUBST(SYSTEM_LIBXUL)
8803 AC_SUBST(MOZ_NATIVE_JPEG)
8804 AC_SUBST(MOZ_NATIVE_PNG)
8805 AC_SUBST(MOZ_NATIVE_BZ2)
8807 AC_SUBST(MOZ_FLEXBOX)
8808 AC_SUBST(MOZ_JPEG_CFLAGS)
8809 AC_SUBST(MOZ_JPEG_LIBS)
8810 AC_SUBST(MOZ_BZ2_CFLAGS)
8811 AC_SUBST(MOZ_BZ2_LIBS)
8812 AC_SUBST(MOZ_PNG_CFLAGS)
8813 AC_SUBST(MOZ_PNG_LIBS)
8815 AC_SUBST(NSPR_CFLAGS)
8816 AC_SUBST(NSPR_LIBS)
8817 AC_SUBST(MOZ_NATIVE_NSPR)
8819 AC_SUBST(NSS_CFLAGS)
8820 AC_SUBST(NSS_LIBS)
8821 AC_SUBST(MOZ_NATIVE_NSS)
8822 AC_SUBST(NSS_DISABLE_DBM)
8824 OS_CFLAGS="$CFLAGS"
8825 OS_CXXFLAGS="$CXXFLAGS"
8826 OS_CPPFLAGS="$CPPFLAGS"
8827 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8828 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8829 OS_LDFLAGS="$LDFLAGS"
8830 OS_LIBS="$LIBS"
8831 AC_SUBST(OS_CFLAGS)
8832 AC_SUBST(OS_CXXFLAGS)
8833 AC_SUBST(OS_CPPFLAGS)
8834 AC_SUBST(OS_COMPILE_CFLAGS)
8835 AC_SUBST(OS_COMPILE_CXXFLAGS)
8836 AC_SUBST(OS_LDFLAGS)
8837 AC_SUBST(OS_LIBS)
8838 AC_SUBST(CROSS_COMPILE)
8839 AC_SUBST(WCHAR_CFLAGS)
8841 AC_SUBST(HOST_CC)
8842 AC_SUBST(HOST_CXX)
8843 AC_SUBST(HOST_CFLAGS)
8844 AC_SUBST(HOST_CXXFLAGS)
8845 AC_SUBST(HOST_LDFLAGS)
8846 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8847 AC_SUBST(HOST_AR)
8848 AC_SUBST(HOST_AR_FLAGS)
8849 AC_SUBST(HOST_LD)
8850 AC_SUBST(HOST_RANLIB)
8851 AC_SUBST(HOST_NSPR_MDCPUCFG)
8852 AC_SUBST(HOST_BIN_SUFFIX)
8853 AC_SUBST(HOST_OS_ARCH)
8855 AC_SUBST(TARGET_CPU)
8856 AC_SUBST(TARGET_VENDOR)
8857 AC_SUBST(TARGET_OS)
8858 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8859 AC_SUBST(TARGET_MD_ARCH)
8860 AC_SUBST(TARGET_XPCOM_ABI)
8861 AC_SUBST(OS_TARGET)
8862 AC_SUBST(OS_ARCH)
8863 AC_SUBST(OS_RELEASE)
8864 AC_SUBST(OS_TEST)
8865 AC_SUBST(CPU_ARCH)
8866 AC_SUBST(INTEL_ARCHITECTURE)
8868 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8870 AC_SUBST(WRAP_LDFLAGS)
8871 AC_SUBST(MKSHLIB)
8872 AC_SUBST(MKCSHLIB)
8873 AC_SUBST(MKSHLIB_FORCE_ALL)
8874 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8875 AC_SUBST(DSO_CFLAGS)
8876 AC_SUBST(DSO_PIC_CFLAGS)
8877 AC_SUBST(DSO_LDOPTS)
8878 AC_SUBST(LIB_PREFIX)
8879 AC_SUBST(DLL_PREFIX)
8880 AC_SUBST(DLL_SUFFIX)
8881 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8882 AC_SUBST(LIB_SUFFIX)
8883 AC_SUBST(OBJ_SUFFIX)
8884 AC_SUBST(BIN_SUFFIX)
8885 AC_SUBST(ASM_SUFFIX)
8886 AC_SUBST(IMPORT_LIB_SUFFIX)
8887 AC_SUBST(USE_N32)
8888 AC_SUBST(CC_VERSION)
8889 AC_SUBST(CXX_VERSION)
8890 AC_SUBST(MSMANIFEST_TOOL)
8891 AC_SUBST(NS_ENABLE_TSF)
8892 AC_SUBST(MOZ_NSS_PATCH)
8893 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8894 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8896 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8897 AC_SUBST(MOZ_SOUNDTOUCH)
8898 AC_SUBST(MOZ_CUBEB)
8899 AC_SUBST(MOZ_WAVE)
8900 AC_SUBST(MOZ_VORBIS)
8901 AC_SUBST(MOZ_TREMOR)
8902 AC_SUBST(MOZ_OPUS)
8903 AC_SUBST(MOZ_WEBM)
8904 AC_SUBST(MOZ_DASH)
8905 AC_SUBST(MOZ_WMF)
8906 AC_SUBST(MOZ_MEDIA_PLUGINS)
8907 AC_SUBST(MOZ_OMX_PLUGIN)
8908 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8909 AC_SUBST(MOZ_VP8_ENCODER)
8910 AC_SUBST(MOZ_VP8)
8911 AC_SUBST(MOZ_OGG)
8912 AC_SUBST(VPX_AS)
8913 AC_SUBST(VPX_ASFLAGS)
8914 AC_SUBST(VPX_DASH_C_FLAG)
8915 AC_SUBST(VPX_AS_CONVERSION)
8916 AC_SUBST(VPX_ASM_SUFFIX)
8917 AC_SUBST(VPX_X86_ASM)
8918 AC_SUBST(VPX_ARM_ASM)
8919 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8920 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8921 AC_SUBST(LIBJPEG_TURBO_AS)
8922 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8923 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8924 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8925 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8927 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8928 AC_SUBST(MOZ_FOLD_LIBS)
8930 AC_SUBST(MOZ_ENABLE_SZIP)
8931 AC_SUBST(MOZ_SZIP_FLAGS)
8933 AC_MSG_CHECKING([for posix_fallocate])
8934 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8935   #include <fcntl.h>],
8936                  [posix_fallocate(0, 0, 0);],
8937                  [ac_cv___posix_fallocate=true],
8938                  [ac_cv___posix_fallocate=false])
8940 if test "$ac_cv___posix_fallocate" = true ; then
8941   AC_DEFINE(HAVE_POSIX_FALLOCATE)
8942   AC_MSG_RESULT(yes)
8943 else
8944   AC_MSG_RESULT(no)
8947 dnl Check for missing components
8948 if test "$COMPILE_ENVIRONMENT"; then
8949 if test "$MOZ_X11"; then
8950     if test "$WITHOUT_X11"; then
8951         AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8952     fi
8953     dnl ====================================================
8954     dnl = Check if X headers exist
8955     dnl ====================================================
8956     _SAVE_CFLAGS=$CFLAGS
8957     CFLAGS="$CFLAGS $XCFLAGS"
8958     AC_TRY_COMPILE([
8959         #include <stdio.h>
8960         #include <stdlib.h>
8961         #include <X11/Xlib.h>
8962         #include <X11/Intrinsic.h>
8963         #include <X11/extensions/XShm.h>
8964     ],
8965     [
8966         Display *dpy = 0;
8967         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8968             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8969             exit(1);
8970         }
8971     ], [],
8972     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8973     CFLAGS="$_SAVE_CFLAGS"
8975     if test -n "$MISSING_X"; then
8976         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8977     fi
8979 fi # MOZ_X11
8981 dnl Check for headers, etc. needed by WebGL.
8982 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8983     MOZ_CHECK_HEADER(GL/glx.h)
8984     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8985         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))])
8986     fi
8987 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8988 fi # COMPILE_ENVIRONMENT
8990 dnl Set various defines and substitutions
8991 dnl ========================================================
8993 if test "$OS_ARCH" = "Darwin"; then
8994   AC_DEFINE(XP_UNIX)
8995 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8996   AC_DEFINE(XP_UNIX)
8999 if test "$MOZ_DEBUG"; then
9000     AC_DEFINE(MOZ_REFLOW_PERF)
9001     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9004 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
9005     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9006     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9007     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9008     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9009     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9010     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9011     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9012     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9015 AC_SUBST(MOZILLA_VERSION)
9017 AC_SUBST(ac_configure_args)
9019 dnl Spit out some output
9020 dnl ========================================================
9022 dnl The following defines are used by xpcom
9023 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9024 CPP_THROW_NEW
9025 HAVE_CPP_2BYTE_WCHAR_T
9026 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9027 HAVE_CPP_CHAR16_T
9028 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9029 HAVE_CPP_PARTIAL_SPECIALIZATION
9030 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9031 NEED_CPP_UNUSED_IMPLEMENTATIONS
9032 NEW_H
9033 HAVE_GETPAGESIZE
9034 HAVE_ICONV
9035 HAVE_ICONV_WITH_CONST_INPUT
9036 HAVE_MBRTOWC
9037 HAVE_WCRTOMB
9038 HAVE_STATVFS64
9039 HAVE_STATVFS
9040 HAVE_STATFS64
9041 HAVE_STATFS
9042 HAVE_SYS_STATVFS_H
9043 HAVE_SYS_STATFS_H
9044 HAVE_SYS_VFS_H
9045 HAVE_SYS_MOUNT_H
9048 # FUTURE? Consider moving all these to moz.build files.
9049 AC_CONFIG_HEADER(
9050 netwerk/necko-config.h
9051 xpcom/xpcom-config.h
9052 xpcom/xpcom-private.h
9055 AC_OUTPUT([mozilla-config.h])
9057 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
9058 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
9059 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
9060 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
9061 # (apparently) only need this hack when egrep's "pattern" is particularly long
9062 # (as in the following code) and the first egrep on our $PATH is Apple's.  See
9063 # bug 655339.
9064 case "$host" in
9065 *-apple-darwin11*)
9066     FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
9067     ;;
9069     FIXED_EGREP="egrep"
9070     ;;
9071 esac
9073 # Generate Makefiles for WebRTC directly from .gyp files
9074 if test "${OS_TARGET}" = "WINNT"; then
9075    if test "$HAVE_64BIT_OS"; then
9076       OS_BITS=64
9077    else
9078       OS_BITS=32
9079    fi
9080    EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
9082 elif test "${OS_TARGET}" = "Android"; then
9083    if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
9084       EXTRA_GYP_DEFINES="-G os=linux "
9085    else
9086       EXTRA_GYP_DEFINES="-D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
9087    fi
9090 if test -n "$ARM_ARCH"; then
9091     if test "$ARM_ARCH" -lt 7; then
9092         EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
9093     else
9094         if test "${OS_TARGET}" = "Android"; then
9095             EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=1 "
9096         else
9097             dnl CPU detection for ARM works on Android only.  armv7 always uses CPU detection, so
9098             dnl we have to set armv7=0 for non-Android target
9099             EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
9100         fi
9101     fi
9104 # Don't try to compile sse4.1 code if toolchain doesn't support
9105 if test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
9106   EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
9109 if test -n "$MOZ_WEBRTC"; then
9110    AC_MSG_RESULT("generating WebRTC Makefiles...")
9112    if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
9113       EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D build_with_gonk=1 -D include_internal_audio_device=0"
9114    fi
9116 dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
9117 dnl so that regeneration via dependencies works correctly
9118    WEBRTC_CONFIG="-D build_with_mozilla=1 -D build_with_chromium=0 --include ${srcdir}/media/webrtc/webrtc_config.gypi -D FORCED_INCLUDE_FILE=${srcdir}/media/webrtc/webrtc_config.gypi"
9120    if test -n HAVE_CLOCK_MONOTONIC; then
9121       WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=1"
9122    else
9123       WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=0"
9124    fi
9126    GYP_WEBRTC_OPTIONS="--format=mozmake ${WEBRTC_CONFIG} -D target_arch=${WEBRTC_TARGET_ARCH} ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
9128    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9129      $GYP_WEBRTC_OPTIONS \
9130      --generator-output=${_objdir}/media/webrtc/trunk \
9131      ${srcdir}/media/webrtc/trunk/peerconnection.gyp
9132    if test "$?" != 0; then
9133       AC_MSG_ERROR([failed to generate WebRTC Makefiles])
9134    fi
9136    # XXX disable until we land the tranche with signaling
9137    if test -n "$MOZ_WEBRTC_SIGNALING"; then
9138      AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
9139      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9140        $GYP_WEBRTC_OPTIONS \
9141        -D build_for_test=0 \
9142        --generator-output=${_objdir}/media/webrtc/signaling \
9143        ${srcdir}/media/webrtc/signaling/signaling.gyp
9144      if test "$?" != 0; then
9145         AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
9146      fi
9148      AC_MSG_RESULT("generating WebRTC/SignalingTest Makefiles...")
9149      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9150        $GYP_WEBRTC_OPTIONS \
9151        -D build_for_test=1 \
9152        --generator-output=${_objdir}/media/webrtc/signalingtest \
9153        ${srcdir}/media/webrtc/signaling/signaling.gyp
9154      if test "$?" != 0; then
9155        AC_MSG_ERROR([failed to generate WebRTC/SignalingTest Makefiles])
9156      fi
9157    fi
9159    AC_MSG_RESULT("generating gtest Makefiles...")
9160    # Ok to pass some extra -D's that are ignored here
9161    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9162      $GYP_WEBRTC_OPTIONS \
9163      --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
9164      ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
9165    if test "$?" != 0; then
9166       AC_MSG_ERROR([failed to generate gtest Makefiles])
9167    fi
9169    AC_MSG_RESULT("generating nrappkit Makefiles...")
9170    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9171      $GYP_WEBRTC_OPTIONS \
9172      --generator-output=${_objdir}/media/mtransport/third_party/nrappkit \
9173      ${srcdir}/media/mtransport/third_party/nrappkit/nrappkit.gyp
9174    if test "$?" != 0; then
9175       AC_MSG_ERROR([failed to generate nrappkit Makefiles])
9176    fi
9178    AC_MSG_RESULT("generating nICEr Makefiles...")
9179    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9180      $GYP_WEBRTC_OPTIONS \
9181      --generator-output=${_objdir}/media/mtransport/third_party/nICEr \
9182      ${srcdir}/media/mtransport/third_party/nICEr/nicer.gyp
9183    if test "$?" != 0; then
9184       AC_MSG_ERROR([failed to generate nICEr Makefiles])
9185    fi
9188 # Generate a JSON config file for unittest harnesses etc to read
9189 # build configuration details from in a standardized way.
9190 OS_TARGET=${OS_TARGET} \
9191 TARGET_CPU=${TARGET_CPU} \
9192 MOZ_DEBUG=${MOZ_DEBUG} \
9193 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} \
9194 UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
9195 MOZ_CRASHREPORTER=${MOZ_CRASHREPORTER} \
9196 MOZ_APP_NAME=${MOZ_APP_NAME} \
9197 TOPSRCDIR=${_topsrcdir} \
9198   $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
9199 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
9200   rm ./mozinfo.json.tmp
9201 else
9202   mv -f ./mozinfo.json.tmp ./mozinfo.json
9205 # Run jemalloc configure script
9207 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
9208   ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
9209   if test -n "$MOZ_REPLACE_MALLOC"; then
9210     # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9211     ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9212     ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9213   fi
9214   if test -n "$MOZ_JEMALLOC3"; then
9215     case "${OS_ARCH}" in
9216       WINNT|Darwin)
9217         # We want jemalloc functions to be kept hidden on both Mac and Windows
9218         # See memory/build/mozmemory_wrap.h for details.
9219         ac_configure_args="$ac_configure_args --without-export"
9220         ;;
9221     esac
9222   elif test "${OS_ARCH}" = Darwin; then
9223     # When building as a replace-malloc lib, disabling the zone allocator
9224     # forces to use pthread_atfork.
9225     ac_configure_args="$ac_configure_args --disable-zone-allocator"
9226   fi
9227   _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9228   JEMALLOC_WRAPPER=
9229   if test -z "$MOZ_REPLACE_MALLOC"; then
9230     case "$OS_ARCH" in
9231       Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9232         MANGLE=$_MANGLE
9233         ;;
9234     esac
9235   elif test -z "$MOZ_JEMALLOC3"; then
9236     MANGLE=$_MANGLE
9237     JEMALLOC_WRAPPER=replace_
9238   fi
9239   if test -n "$MANGLE"; then
9240     MANGLED=
9241     if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
9242       JEMALLOC_WRAPPER=__wrap_
9243     fi
9244     for mangle in ${MANGLE}; do
9245       if test -n "$MANGLED"; then
9246         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9247       else
9248         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9249       fi
9250     done
9251     ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9252   fi
9253   unset CONFIG_FILES
9254   if test -z "$MOZ_TLS"; then
9255     ac_configure_args="$ac_configure_args --disable-tls"
9256   fi
9257   EXTRA_CFLAGS="$CFLAGS"
9258   for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9259     ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9260   done
9261   if test "$CROSS_COMPILE"; then
9262     ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9263   fi
9264   _save_cache_file="$cache_file"
9265   cache_file=$_objdir/memory/jemalloc/src/config.cache
9267   if ! test -e memory/jemalloc; then
9268     mkdir -p memory/jemalloc
9269   fi
9271   AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9272   cache_file="$_save_cache_file"
9273   ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9276 # Run freetype configure script
9278 if test "$MOZ_TREE_FREETYPE"; then
9279    export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9280    export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9281    export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9282    export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9283    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9284    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9286    if ! test -e modules; then
9287      mkdir modules
9288    fi
9290    AC_OUTPUT_SUBDIRS(modules/freetype2)
9293 if test -z "$direct_nspr_config"; then
9294     dnl ========================================================
9295     dnl = Setup a nice relatively clean build environment for
9296     dnl = sub-configures.
9297     dnl ========================================================
9298     CC="$_SUBDIR_CC"
9299     CXX="$_SUBDIR_CXX"
9300     CFLAGS="$_SUBDIR_CFLAGS"
9301     CPPFLAGS="$_SUBDIR_CPPFLAGS"
9302     CXXFLAGS="$_SUBDIR_CXXFLAGS"
9303     LDFLAGS="$_SUBDIR_LDFLAGS"
9304     HOST_CC="$_SUBDIR_HOST_CC"
9305     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9306     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9307     RC=
9310 unset MAKEFILES
9311 unset CONFIG_FILES
9313 # Run all configure scripts specified by a subconfigure
9314 if test -n "$_subconfigure_subdir"; then
9315   _save_ac_configure_args="$ac_configure_args"
9316   ac_configure_args="$_subconfigure_config_args"
9317   AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
9318   ac_configure_args="$_save_ac_configure_args"
9321 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9322 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9324 export WRAP_LDFLAGS
9326 if test -n "$_WRAP_MALLOC"; then
9327     # Avoid doubling wrap malloc arguments
9328     _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9331 if test -z "$MOZ_NATIVE_NSPR"; then
9332     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9333     if test -z "$MOZ_DEBUG"; then
9334         ac_configure_args="$ac_configure_args --disable-debug"
9335     else
9336         ac_configure_args="$ac_configure_args --enable-debug"
9337     fi
9338     if test "$MOZ_OPTIMIZE" = "1"; then
9339         ac_configure_args="$ac_configure_args --enable-optimize"
9340     elif test -z "$MOZ_OPTIMIZE"; then
9341         ac_configure_args="$ac_configure_args --disable-optimize"
9342     fi
9343     if test -n "$HAVE_64BIT_OS"; then
9344         ac_configure_args="$ac_configure_args --enable-64bit"
9345     fi
9346     if test -n "$USE_ARM_KUSER"; then
9347         ac_configure_args="$ac_configure_args --with-arm-kuser"
9348     fi
9349     ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9350     if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9351       # dladdr is supported by the new linker, even when the system linker doesn't
9352       # support it. Trick nspr into using dladdr when it's not supported.
9353       _SAVE_CPPFLAGS="$CPPFLAGS"
9354       export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9355     fi
9356     _SAVE_LDFLAGS="$LDFLAGS"
9357     export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9358     AC_OUTPUT_SUBDIRS(nsprpub)
9359     LDFLAGS="$_SAVE_LDFLAGS"
9360     if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no; then
9361       unset CPPFLAGS
9362       CPPFLAGS="$_SAVE_CFLAGS"
9363     fi
9364     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9367 dnl ========================================================
9368 dnl = Setup a nice relatively clean build environment for
9369 dnl = sub-configures.
9370 dnl ========================================================
9371 CC="$_SUBDIR_CC"
9372 CXX="$_SUBDIR_CXX"
9373 CFLAGS="$_SUBDIR_CFLAGS"
9374 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9375 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9376 LDFLAGS="$_SUBDIR_LDFLAGS"
9377 HOST_CC="$_SUBDIR_HOST_CC"
9378 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9379 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9382 if test -n "$ENABLE_CLANG_PLUGIN"; then
9383     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9384     AC_OUTPUT_SUBDIRS(build/clang-plugin)
9388 # Run the SpiderMonkey 'configure' script.
9389 dist=$MOZ_BUILD_ROOT/dist
9390 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9391 ac_configure_args="$ac_configure_args --enable-threadsafe"
9392 if test "$BUILD_CTYPES"; then
9393     # Build js-ctypes on the platforms we can.
9394     ac_configure_args="$ac_configure_args --enable-ctypes"
9396 if test -z "$JS_SHARED_LIBRARY" ; then
9397     ac_configure_args="$ac_configure_args --disable-shared-js"
9399 if test -z "$MOZ_NATIVE_NSPR"; then
9400     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9401     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9403 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9404 ac_configure_args="$ac_configure_args --prefix=$dist"
9405 if test "$MOZ_MEMORY"; then
9406    ac_configure_args="$ac_configure_args --enable-jemalloc"
9408 if test -n "$MOZ_GLUE_LDFLAGS"; then
9409    export MOZ_GLUE_LDFLAGS
9411 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9412    export MOZ_GLUE_PROGRAM_LDFLAGS
9414 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9415    MOZ_ZLIB_LIBS=
9417 export MOZ_NATIVE_ZLIB
9418 export MOZ_ZLIB_CFLAGS
9419 export MOZ_ZLIB_LIBS
9420 export MOZ_APP_NAME
9421 export DONT_POPULATE_VIRTUALENV=1
9422 export PYTHON
9423 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9424 export STLPORT_CPPFLAGS
9425 export STLPORT_LDFLAGS
9426 export STLPORT_LIBS
9427 export JS_STANDALONE=no
9429 if ! test -e js; then
9430     mkdir js
9433 AC_OUTPUT_SUBDIRS(js/src)
9434 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9436 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR