Bug 853076 - Initialized the chunk to be empty before getting audio frames. r=ehsan
[gecko.git] / configure.in
blob85d7029d5ae9cbb032ba805f2fa6bed3c561ddd5
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.15.2
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 dnl Do not allow building if a clobber is required
124 dnl ==============================================================
125 dnl TODO Make this better, ideally this would clobber automaticially
126 if test -e $_objdir/CLOBBER; then
127   if test $_topsrcdir/CLOBBER -nt $_objdir/CLOBBER; then
128     echo "      ***"
129     echo "      *       The CLOBBER file has been updated, indicating that an incremental build"
130     echo "      *       since your last build will probably not work. A full build is required."
131     echo "      *       The change that caused this is:"
132     cat $_topsrcdir/CLOBBER | sed '/^#/d' | sed 's/^/   *       /'
133     echo "      *       "
134     echo "      *       The easiest way to fix this is to manually delete your objdir:"
135     echo "      *       rm -rf $_objdir"
136     echo "      *       "
137     echo "      *       Or, if you know this clobber doesn't apply to you, it can be ignored with:"
138     echo "      *       cp '$_topsrcdir/CLOBBER' $_objdir"
139     echo "      ***"
140     exit 1
141     break;
142   fi
143 else
144   touch $_objdir/CLOBBER
147 MOZ_PYTHON
149 MOZ_DEFAULT_COMPILER
151 COMPILE_ENVIRONMENT=1
152 MOZ_ARG_DISABLE_BOOL(compile-environment,
153 [  --disable-compile-environment
154                           Disable compiler/library checks.],
155     COMPILE_ENVIRONMENT= )
156 AC_SUBST(COMPILE_ENVIRONMENT)
158 MOZ_ARG_WITH_STRING(l10n-base,
159 [  --with-l10n-base=DIR    path to l10n repositories],
160     L10NBASEDIR=$withval)
161 if test -n "$L10NBASEDIR"; then
162     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
163         AC_MSG_ERROR([--with-l10n-base must specify a path])
164     elif test -d "$L10NBASEDIR"; then
165         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
166     else
167         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
168     fi
170 AC_SUBST(L10NBASEDIR)
172 dnl Check for Perl first -- needed for win32 SDK checks
173 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
174 if test -z "$PERL" -o "$PERL" = ":"; then
175     AC_MSG_ERROR([perl not found in \$PATH])
178 AC_SUBST(GAIADIR)
179 if test -n "$GAIADIR" ; then
180     AC_DEFINE(PACKAGE_GAIA)
183 MOZ_ARG_WITH_STRING(gonk,
184 [  --with-gonk=DIR
185                location of gonk dir],
186     gonkdir=$withval)
188 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
189 [  --with-gonk-toolchain-prefix=DIR
190                           prefix to gonk toolchain commands],
191     gonk_toolchain_prefix=$withval)
193 if test -n "$gonkdir" ; then
194     kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
195     android_source="$gonkdir"
196     ANDROID_SOURCE="$android_source"
197     ANDROID_NDK="${ANDROID_SOURCE}/ndk"
199     dnl set up compilers
200     TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
201     AS="$gonk_toolchain_prefix"as
202     CC="$gonk_toolchain_prefix"gcc
203     CXX="$gonk_toolchain_prefix"g++
204     CPP="$gonk_toolchain_prefix"cpp
205     LD="$gonk_toolchain_prefix"ld
206     AR="$gonk_toolchain_prefix"ar
207     RANLIB="$gonk_toolchain_prefix"ranlib
208     STRIP="$gonk_toolchain_prefix"strip
209     OBJCOPY="$gonk_toolchain_prefix"objcopy
211     STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/ -I$gonkdir/external/stlport/stlport/"
212     STLPORT_LIBS="-lstlport"
214     case "$target_cpu" in
215     arm)
216         ARCH_DIR=arch-arm
217         ;;
218     i?86)
219         ARCH_DIR=arch-x86
220         ;;
221     esac
223     CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice -I$gonkdir/frameworks/base/services/camera -I$gonkdir/system/media/wilhelm/include -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/dalvik/libnativehelper/include/nativehelper"
224     CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
225     CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
226     dnl Add -llog by default, since we use it all over the place.
227     LIBS="$LIBS -llog $STLPORT_LIBS"
229     LDFLAGS="-mandroid -L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ $LDFLAGS"
231     dnl prevent cross compile section from using these flags as host flags
232     if test -z "$HOST_CPPFLAGS" ; then
233         HOST_CPPFLAGS=" "
234     fi
235     if test -z "$HOST_CFLAGS" ; then
236         HOST_CFLAGS=" "
237     fi
238     if test -z "$HOST_CXXFLAGS" ; then
239         HOST_CXXFLAGS=" "
240     fi
241     if test -z "$HOST_LDFLAGS" ; then
242         HOST_LDFLAGS=" "
243     fi
245     AC_DEFINE(ANDROID)
246     AC_DEFINE(HAVE_SYS_UIO_H)
247     AC_DEFINE(HAVE_PTHREADS)
248     CROSS_COMPILE=1
249     MOZ_CHROME_FILE_FORMAT=omni
250     direct_nspr_config=1
251 else
252     MOZ_ANDROID_NDK
254     case "$target" in
255     *-android*|*-linuxandroid*)
256         if test -z "$ANDROID_PACKAGE_NAME" ; then
257             ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
258         fi
259         MOZ_CHROME_FILE_FORMAT=omni
260         ZLIB_DIR=yes
261         ;;
262     *-linux*)
263         AC_PATH_PROG(OBJCOPY,objcopy)
264         ;;
265     esac
268 AC_SUBST(ANDROID_SOURCE)
269 AC_SUBST(ANDROID_PACKAGE_NAME)
270 AC_SUBST(OBJCOPY)
272 dnl ========================================================
273 dnl Checks for compilers.
274 dnl ========================================================
275 dnl Set CROSS_COMPILE in the environment when running configure
276 dnl to use the cross-compile setup for now
277 dnl ========================================================
279 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
280 AR_FLAGS='cr $@'
282 if test "$COMPILE_ENVIRONMENT"; then
284 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
285     echo "cross compiling from $host to $target"
286     cross_compiling=yes
288     _SAVE_CC="$CC"
289     _SAVE_CFLAGS="$CFLAGS"
290     _SAVE_LDFLAGS="$LDFLAGS"
292     AC_MSG_CHECKING([for host c compiler])
293     AC_CHECK_PROGS(HOST_CC, $HOST_CC cc gcc /usr/ucb/cc cl icc, "")
294     if test -z "$HOST_CC"; then
295         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
296     fi
297     AC_MSG_RESULT([$HOST_CC])
298     AC_MSG_CHECKING([for host c++ compiler])
299     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
300     if test -z "$HOST_CXX"; then
301         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
302     fi
303     AC_MSG_RESULT([$HOST_CXX])
305     if test -z "$HOST_CFLAGS"; then
306         HOST_CFLAGS="$CFLAGS"
307     fi
308     if test -z "$HOST_CXXFLAGS"; then
309         HOST_CXXFLAGS="$CXXFLAGS"
310     fi
311     if test -z "$HOST_LDFLAGS"; then
312         HOST_LDFLAGS="$LDFLAGS"
313     fi
314     if test -z "$HOST_AR_FLAGS"; then
315         HOST_AR_FLAGS="$AR_FLAGS"
316     fi
317     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
318     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
319     CC="$HOST_CC"
320     CFLAGS="$HOST_CFLAGS"
321     LDFLAGS="$HOST_LDFLAGS"
323     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
324     AC_TRY_COMPILE([], [return(0);],
325         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
326         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
328     CC="$HOST_CXX"
329     CFLAGS="$HOST_CXXFLAGS"
331     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
332     AC_TRY_COMPILE([], [return(0);],
333         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
334         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
336     CC=$_SAVE_CC
337     CFLAGS=$_SAVE_CFLAGS
338     LDFLAGS=$_SAVE_LDFLAGS
340     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
341     unset ac_cv_prog_CC
342     AC_PROG_CC
343     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
344     unset ac_cv_prog_CXX
345     AC_PROG_CXX
347     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
348     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
349     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
350     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
351     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
352     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
353     AC_DEFINE(CROSS_COMPILE)
354 else
355     AC_PROG_CC
356     case "$target" in
357     *-mingw*)
358       # Work around the conftest.exe access problem on Windows
359       sleep 2
360     esac
361     AC_PROG_CXX
362     AC_PROG_RANLIB
363     MOZ_PATH_PROGS(AS, $AS as, $CC)
364     AC_CHECK_PROGS(AR, ar, :)
365     AC_CHECK_PROGS(LD, ld, :)
366     AC_CHECK_PROGS(STRIP, strip, :)
367     AC_CHECK_PROGS(WINDRES, windres, :)
368     if test -z "$HOST_CC"; then
369         HOST_CC="$CC"
370     fi
371     if test -z "$HOST_CFLAGS"; then
372         HOST_CFLAGS="$CFLAGS"
373     fi
374     if test -z "$HOST_CXX"; then
375         HOST_CXX="$CXX"
376     fi
377     if test -z "$HOST_CXXFLAGS"; then
378         HOST_CXXFLAGS="$CXXFLAGS"
379     fi
380     if test -z "$HOST_LDFLAGS"; then
381         HOST_LDFLAGS="$LDFLAGS"
382     fi
383     if test -z "$HOST_RANLIB"; then
384         HOST_RANLIB="$RANLIB"
385     fi
386     if test -z "$HOST_AR"; then
387         HOST_AR="$AR"
388     fi
389     if test -z "$HOST_AR_FLAGS"; then
390         HOST_AR_FLAGS="$AR_FLAGS"
391     fi
394 if test -n "$MOZ_WINCONSOLE"; then
395     AC_DEFINE(MOZ_WINCONSOLE)
398 MOZ_TOOL_VARIABLES
400 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
401     if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
402        test "$GCC_MAJOR_VERSION" -lt 4; then
403         AC_MSG_ERROR([Only GCC 4.4 or newer supported])
404     fi
407 dnl ========================================================
408 dnl Special win32 checks
409 dnl ========================================================
411 MOZ_ARG_ENABLE_BOOL(metro,
412 [  --enable-metro           Enable Windows Metro build targets],
413     MOZ_METRO=1,
414     MOZ_METRO=)
415 if test -n "$MOZ_METRO"; then
416     AC_DEFINE(MOZ_METRO)
417     # Target the Windows 8 Kit
418     WINSDK_TARGETVER=602
419     WINVER=502
420     # toolkit/library/makefile.in needs these, see nsDllMain.
421     CRTDLLVERSION=110
422     CRTEXPDLLVERSION=1-1-0
423 else
424     # Target the Windows 7 SDK by default
425     WINSDK_TARGETVER=601
426     WINVER=502
429 AC_SUBST(CRTDLLVERSION)
430 AC_SUBST(CRTEXPDLLVERSION)
432 MOZ_ARG_WITH_STRING(windows-version,
433 [  --with-windows-version=WINSDK_TARGETVER
434                           Windows SDK version to target. Lowest version
435                           currently allowed is 601 (Win7), highest is 602 (Win8)],
436   WINSDK_TARGETVER=$withval)
438 # Currently only two sdk versions allowed, 601 and 602
439 case "$WINSDK_TARGETVER" in
440 601|602)
441     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
442     ;;
445     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
446     ;;
447 esac
449 case "$target" in
450 *-mingw*)
451     if test "$GCC" != "yes"; then
452         # Check to see if we are really running in a msvc environemnt
453         _WIN32_MSVC=1
454         AC_CHECK_PROGS(MIDL, midl)
456         # Make sure compilers are valid
457         CFLAGS="$CFLAGS -TC -nologo"
458         CXXFLAGS="$CXXFLAGS -TP -nologo"
459         AC_LANG_SAVE
460         AC_LANG_C
461         AC_TRY_COMPILE([#include <stdio.h>],
462             [ printf("Hello World\n"); ],,
463             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
465         AC_LANG_CPLUSPLUS
466         AC_TRY_COMPILE([#include <new.h>],
467             [ unsigned *test = new unsigned(42); ],,
468             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
469         AC_LANG_RESTORE
471         changequote(,)
472         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
473         changequote([,])
475         # Determine compiler version
476         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
477         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
478         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
479         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
480         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
481         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
483         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
484         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
486         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
487             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
488         fi
490         if test "$_CC_MAJOR_VERSION" = "14"; then
491             dnl Require VC8SP1 or newer.
492             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
493             if test "$_CC_RELEASE" -lt 50727 -o \
494                     \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
495               AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
496             fi
498             _CC_SUITE=8
499             _MSVS_VERSION=2005
500             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
501             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
502         elif test "$_CC_MAJOR_VERSION" = "15"; then
503             _CC_SUITE=9
504             _MSVS_VERSION=2008
505             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
506             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
507         elif test "$_CC_MAJOR_VERSION" = "16"; then
508             _CC_SUITE=10
509             _MSVS_VERSION=2010
510             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
511             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
512         elif test "$_CC_MAJOR_VERSION" = "17"; then
513             _CC_SUITE=11
514             _MSVS_VERSION=2012
515             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
516             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
517         else
518             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
519         fi
521         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
523         if test -n "$WIN32_REDIST_DIR"; then
524           if test ! -d "$WIN32_REDIST_DIR"; then
525             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
526           fi
527           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
528         fi
530         dnl Confirm we have the pri tools on win8 builds
531         if test -n "$MOZ_METRO"; then
532           AC_MSG_CHECKING([for makepri])
533           AC_CHECK_PROGS(MAKEPRI, makepri, "")
534           if test -z "MAKEPRI" ; then
535               AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
536           fi
537           AC_SUBST(MAKEPRI)
538         fi
540         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
541         dnl not something else like "magnetic tape manipulation utility".
542         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
543         if test -z "$MSMT_TOOL"; then
544           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
545         fi
547         changequote(,)
548         _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
549         changequote([,])
550         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
551         if test -z "$MSMANIFEST_TOOL_VERSION"; then
552           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
553         fi
555         MSMANIFEST_TOOL=1
556         unset MSMT_TOOL
558         # Check linker version
559         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
560         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
561         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
562             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
563         fi
565         INCREMENTAL_LINKER=1
567         # Check midl version
568         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
569         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
570         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
571         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
572         # Add flags if necessary
573         AC_MSG_CHECKING([for midl flags])
574         case "$target" in
575         i*86-*)
576             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
577                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
578                 # MIDL version 7.00.0500 or later has no problem.
579                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
580                 AC_MSG_RESULT([need -env win32])
581             else
582                 AC_MSG_RESULT([none needed])
583             fi
584             ;;
585         x86_64-*)
586             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
587             ;;
588         *)
589             AC_MSG_RESULT([none needed])
590             ;;
591         esac
593         # Identify which version of the SDK we're building with
594         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
595         # from there
596         MOZ_CHECK_HEADERS([winsdkver.h])
597         if test "$ac_cv_header_winsdkver_h" = "yes"; then
598             # Get the highest _WIN32_WINNT and NTDDI versions supported
599             # Take the higher of the two
600             # This is done because the Windows 7 beta SDK reports its
601             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
602             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
603                            ac_cv_winsdk_maxver,
604                            [cat > conftest.h <<EOF
605 #include <winsdkver.h>
606 #include <sdkddkver.h>
608 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
609 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
610 #else
611 #define WINSDK_MAXVER NTDDI_MAXVER
612 #endif
614 WINSDK_MAXVER
616                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
617                             rm -f conftest.h
618                            ])
619             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
620         else
621             # Any SDK which doesn't have WinSDKVer.h is too old.
622             AC_MSG_ERROR([Your SDK does not have WinSDKVer.h. It is probably too old. Please upgrade to a newer SDK or try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
623         fi
625         unset _MSVC_VER_FILTER
627         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
628             [
629                 AC_LANG_SAVE
630                 AC_LANG_CPLUSPLUS
631                 _SAVE_CXXFLAGS="$CXXFLAGS"
632                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
633                 AC_TRY_COMPILE([#include <exception>],
634                             [std::_Throw(std::exception()); return 0;],
635                             ac_cv_have_std__Throw="yes",
636                             ac_cv_have_std__Throw="no")
637                 CXXFLAGS="$_SAVE_CXXFLAGS"
638                 AC_LANG_RESTORE
639             ])
641         if test "$ac_cv_have_std__Throw" = "yes"; then
642             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
643                            ac_cv_have_dllimport_exception_bug,
644                 [
645                     AC_LANG_SAVE
646                     AC_LANG_CPLUSPLUS
647                     _SAVE_CXXFLAGS="$CXXFLAGS"
648                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
649                     AC_TRY_LINK([#include <vector>],
650                                 [std::vector<int> v; return v.at(1);],
651                                 ac_cv_have_dllimport_exception_bug="no",
652                                 ac_cv_have_dllimport_exception_bug="yes")
653                     CXXFLAGS="$_SAVE_CXXFLAGS"
654                     AC_LANG_RESTORE
655                 ])
656             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
657                 WRAP_STL_INCLUDES=1
658                 MOZ_MSVC_STL_WRAP__Throw=1
659                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
660             fi
661         else
662             AC_CACHE_CHECK(for overridable _RAISE,
663                            ac_cv_have__RAISE,
664                 [
665                     AC_LANG_SAVE
666                     AC_LANG_CPLUSPLUS
667                     _SAVE_CXXFLAGS="$CXXFLAGS"
668                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
669                     AC_TRY_COMPILE([#include <xstddef>
670                                     #undef _RAISE
671                                     #define _RAISE(x) externallyDefinedFunction((x).what())
672                                     #include <vector>
673                                    ],
674                                    [std::vector<int> v; return v.at(1);],
675                                    ac_cv_have__RAISE="no",
676                                    ac_cv_have__RAISE="yes")
677                     CXXFLAGS="$_SAVE_CXXFLAGS"
678                     AC_LANG_RESTORE
679                 ])
680             if test "$ac_cv_have__RAISE" = "yes"; then
681                 WRAP_STL_INCLUDES=1
682                 MOZ_MSVC_STL_WRAP__RAISE=1
683                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
684             else
685                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
686             fi
687         fi
689         if test "$WRAP_STL_INCLUDES" = "1"; then
690             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
691         fi
692     else
693         # Check w32api version
694         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
695         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
696         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
697         AC_TRY_COMPILE([#include <w32api.h>],
698             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
699                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
700                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
701                 #error "test failed."
702             #endif
703             , [ res=yes ], [ res=no ])
704         AC_MSG_RESULT([$res])
705         if test "$res" != "yes"; then
706             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
707         fi
708         # Check windres version
709         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
710         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
711         AC_MSG_RESULT([$_WINDRES_VERSION])
712         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
713         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
714         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
715         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
716         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
717         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
718         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
719                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
720                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
721                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
722                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
723                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
724         then
725             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
726         fi
728         AC_CHECK_PROGS(MIDL, $target-widl widl)
729         if test -n "$MIDL"; then
730             case "$target" in
731             i*86-*)
732                 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
733                 ;;
734             x86_64-*)
735                 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
736                 ;;
737             esac
738         fi
740         MOZ_WINSDK_MAXVER=0x06020000
741     fi # !GNU_CC
743     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
744     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
745     # Require OS features provided by IE 6.0 SP2 (XP SP2)
746     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
748     # If the maximum version supported by this SDK is lower than the target
749     # version, error out
750     AC_MSG_CHECKING([for Windows SDK being recent enough])
751     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
752         AC_MSG_RESULT("yes")
753     else
754         AC_MSG_RESULT("no")
755         AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
756     fi
757     
758     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
759     # Definitions matching sdkddkver.h
760     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
761     ;;
762 esac
764 AC_PROG_CPP
765 AC_PROG_CXXCPP
767 if test -n "$_WIN32_MSVC"; then
768     SKIP_PATH_CHECKS=1
769     SKIP_COMPILER_CHECKS=1
770     SKIP_LIBRARY_CHECKS=1
772     # Since we're skipping compiler and library checks, hard-code
773     # some facts here.
774     AC_DEFINE(HAVE_IO_H)
775     AC_DEFINE(HAVE_SETBUF)
776     AC_DEFINE(HAVE_ISATTY)
779 fi # COMPILE_ENVIRONMENT
781 AC_SUBST(MIDL_FLAGS)
782 AC_SUBST(_MSC_VER)
784 AC_SUBST(GNU_AS)
785 AC_SUBST(GNU_LD)
786 AC_SUBST(GNU_CC)
787 AC_SUBST(GNU_CXX)
788 AC_SUBST(INTEL_CC)
789 AC_SUBST(INTEL_CXX)
791 AC_SUBST(STL_FLAGS)
792 AC_SUBST(WRAP_STL_INCLUDES)
793 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
794 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
796 dnl ========================================================
797 dnl Checks for programs.
798 dnl ========================================================
799 AC_PROG_INSTALL
800 AC_PROG_LN_S
802 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
803 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
804 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
805 _perl_res=$?
806 AC_MSG_RESULT([$_perl_version])
808 if test "$_perl_res" != 0; then
809     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
813 AC_MSG_CHECKING([for full perl installation])
814 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
815 _perl_res=$?
816 if test "$_perl_res" != 0; then
817     AC_MSG_RESULT([no])
818     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
819 else
820     AC_MSG_RESULT([yes])
823 MOZ_ARG_WITH_BOOL(system-ply,
824 [  --with-system-ply       Use system installed python ply library],
825     [if $PYTHON -c 'import ply' 2>&5; then
826          MOZ_SYSTEM_PLY=1
827      else
828          AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
829      fi])
831 AC_SUBST(MOZ_SYSTEM_PLY)
833 if test -z "$COMPILE_ENVIRONMENT"; then
834     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
836 AC_SUBST(NSINSTALL_BIN)
838 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
839 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
840 MOZ_PATH_PROGS(UNZIP, unzip)
841 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
842     AC_MSG_ERROR([unzip not found in \$PATH])
844 MOZ_PATH_PROGS(ZIP, zip)
845 if test -z "$ZIP" -o "$ZIP" = ":"; then
846     AC_MSG_ERROR([zip not found in \$PATH])
848 MOZ_PATH_PROG(XARGS, xargs)
849 if test -z "$XARGS" -o "$XARGS" = ":"; then
850     AC_MSG_ERROR([xargs not found in \$PATH .])
853 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
854 AC_SUBST(RPMBUILD)
856 if test "$COMPILE_ENVIRONMENT"; then
858 dnl ========================================================
859 dnl = Mac OS X toolchain support
860 dnl ========================================================
862 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
863 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
864 dnl when we can run target binaries.
865 AC_SUBST(UNIVERSAL_BINARY)
866 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
868 MOZ_ARG_WITH_STRING(unify-dist,
869 [  --with-unify-dist=dir   Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
870     UNIFY_DIST=$withval)
871 if test -n "$UNIVERSAL_BINARY"; then
872     if test -z "$UNIFY_DIST"; then
873         AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
874     fi
875     case "$UNIFY_DIST" in
876     /*)
877         ;;
878     *)
879         UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
880         ;;
881     esac
883 AC_SUBST(UNIFY_DIST)
885 dnl ========================================================
886 dnl Check for MacOS deployment target version
887 dnl ========================================================
889 MOZ_ARG_ENABLE_STRING(macos-target,
890                       [  --enable-macos-target=VER (default=10.6)
891                           Set the minimum MacOS version needed at runtime],
892                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
894 case "$target" in
895 *-darwin*)
896     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
897         dnl Use the specified value
898         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
899     else
900         dnl No value specified on the command line or in the environment,
901         dnl use architecture minimum.
902         export MACOSX_DEPLOYMENT_TARGET=10.6
903     fi
904     ;;
905 esac
907 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
909 dnl ========================================================
910 dnl = Mac OS X SDK support
911 dnl ========================================================
912 MACOS_SDK_DIR=
913 NEXT_ROOT=
914 MOZ_ARG_WITH_STRING(macos-sdk,
915 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
916     MACOS_SDK_DIR=$withval)
918 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
919 dnl NEXT_ROOT will be set and exported only if it's needed.
920 AC_SUBST(MACOS_SDK_DIR)
921 AC_SUBST(NEXT_ROOT)
923 if test "$MACOS_SDK_DIR"; then
924   dnl Sync this section with the ones in NSPR and NSS.
925   dnl Changes to the cross environment here need to be accounted for in
926   dnl the libIDL checks (below) and xpidl build.
928   if test ! -d "$MACOS_SDK_DIR"; then
929     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
930 specify a valid SDK.  SDKs are installed when the optional cross-development
931 tools are selected during the Xcode/Developer Tools installation.])
932   fi
934   CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
935   CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
937   dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
938   CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
939   CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
941   AC_LANG_SAVE
942   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
943   AC_LANG_CPLUSPLUS
944   AC_TRY_COMPILE([#include <new>],[],
945    result=yes,
946    result=no)
947   AC_LANG_RESTORE
948   AC_MSG_RESULT($result)
950   if test "$result" = "no" ; then
951     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
952   fi
955 fi # COMPILE_ENVIRONMENT
957 AC_MSG_CHECKING([compiler version])
958 # Just print it so it shows up in the logs.
959 cc_version=$($CC --version)
960 AC_MSG_RESULT([$cc_version])
962 if test -n "$MAKE"; then
963   if test `echo $MAKE | grep -c make.py` != 1; then
964      NOT_PYMAKE=$MAKE
965   fi
968 case "$host_os" in
969 mingw*)
970     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
971     ;;
973     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
974     ;;
975 esac
976 if test "$GMAKE" = ":"; then
977    AC_MSG_ERROR([GNU make not found])
979 AC_SUBST(GMAKE)
981 if test -z "$MAKE"; then
982   MAKE=$GMAKE
985 if test "$COMPILE_ENVIRONMENT"; then
987 AC_PATH_XTRA
989 XCFLAGS="$X_CFLAGS"
991 fi # COMPILE_ENVIRONMENT
993 dnl ========================================================
994 dnl set the defaults first
995 dnl ========================================================
996 AS_BIN=$AS
997 AR_LIST='$(AR) t'
998 AR_EXTRACT='$(AR) x'
999 AR_DELETE='$(AR) d'
1000 AS='$(CC)'
1001 AS_DASH_C_FLAG='-c'
1002 DLL_PREFIX=lib
1003 LIB_PREFIX=lib
1004 DLL_SUFFIX=.so
1005 OBJ_SUFFIX=o
1006 LIB_SUFFIX=a
1007 ASM_SUFFIX=s
1008 IMPORT_LIB_SUFFIX=
1009 TARGET_MD_ARCH=unix
1010 DIRENT_INO=d_ino
1011 MOZ_USER_DIR=".mozilla"
1013 MOZ_JPEG_CFLAGS=
1014 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
1015 MOZ_BZ2_CFLAGS=
1016 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1017 MOZ_PNG_CFLAGS=
1018 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
1020 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1021 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1022 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1023 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1024 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1025 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1026 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1027 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1029 # These are specially defined on Windows only
1030 case "$target" in
1031 *-mingw*)
1032   XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1033   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
1034   ;;
1036   XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
1037   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
1038   ;;
1039 esac
1041 MOZ_FS_LAYOUT=unix
1043 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1045 USE_DEPENDENT_LIBS=1
1047 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1049 if test -n "$CROSS_COMPILE"; then
1050     OS_TARGET="${target_os}"
1051     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1052     OS_RELEASE=
1053     case "${target_os}" in
1054         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1055         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1056         gnu*)         OS_ARCH=GNU ;;
1057         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1058         mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
1059         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1060     esac
1061     case "${target}" in
1062         *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1063     esac
1064 else
1065     OS_TARGET=`uname -s`
1066     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1067     OS_RELEASE=`uname -r`
1070 # Before this used `uname -m` when not cross compiling
1071 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1072 OS_TEST="${target_cpu}"
1074 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1076 #######################################################################
1077 # Master "Core Components" macros for getting the OS target           #
1078 #######################################################################
1081 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1082 # cross-compilation.
1086 # Define and override various archtecture-specific variables, including
1087 # HOST_OS_ARCH
1088 # OS_ARCH
1089 # OS_TEST
1090 # OS_TARGET
1091 # OS_RELEASE
1092 # OS_MINOR_RELEASE
1095 case "$HOST_OS_ARCH" in
1096 mingw*)
1097     HOST_OS_ARCH=WINNT
1098     ;;
1099 darwin*)
1100     HOST_OS_ARCH=Darwin
1101     ;;
1102 linux*)
1103     HOST_OS_ARCH=Linux
1104     ;;
1105 solaris*)
1106     HOST_OS_ARCH=SunOS
1107     SOLARIS_SUNPRO_CC=
1108     SOLARIS_SUNPRO_CXX=
1109     if test -z "$GNU_CC"; then
1110         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1111             SOLARIS_SUNPRO_CC=1
1112        fi
1113     fi
1115     if test -z "$GNU_CXX"; then
1116        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1117            SOLARIS_SUNPRO_CXX=1
1118        fi
1119     fi
1120     AC_SUBST(SOLARIS_SUNPRO_CC)
1121     AC_SUBST(SOLARIS_SUNPRO_CXX)
1122     ;;
1123 OS_2)
1124     HOST_OS_ARCH=OS2
1125     ;;
1126 esac
1128 case "$OS_ARCH" in
1129 WINNT)
1130     if test -z "$CROSS_COMPILE" ; then
1131         OS_TEST=`uname -p`
1132     fi
1133     ;;
1134 Windows_NT)
1136 # If uname -s returns "Windows_NT", we assume that we are using
1137 # the uname.exe in MKS toolkit.
1139 # The -r option of MKS uname only returns the major version number.
1140 # So we need to use its -v option to get the minor version number.
1141 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1143     OS_ARCH=WINNT
1144     OS_TARGET=WINNT
1145     OS_MINOR_RELEASE=`uname -v`
1146     if test "$OS_MINOR_RELEASE" = "00"; then
1147         OS_MINOR_RELEASE=0
1148     fi
1149     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1150     ;;
1151 MINGW*_NT*)
1153 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1154 # the uname.exe in the MSYS tools.
1156     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1157     OS_ARCH=WINNT
1158     OS_TARGET=WINNT
1159     ;;
1160 AIX)
1161     OS_RELEASE=`uname -v`.`uname -r`
1162     OS_TEST=${target_cpu}
1163     ;;
1164 OS_2)
1165     OS_ARCH=OS2
1166     OS_TARGET=OS2
1167     OS_RELEASE=`uname -v`
1168     ;;
1169 Darwin)
1170     case "${target_cpu}" in
1171     powerpc*)
1172         OS_TEST=ppc
1173         ;;
1174     i*86*)
1175         OS_TEST=i386
1176         ;;
1177     x86_64)
1178         OS_TEST=x86_64
1179         ;;
1180     *)
1181         if test -z "$CROSS_COMPILE" ; then
1182             OS_TEST=`uname -p`
1183         fi
1184         ;;
1185     esac
1186     ;;
1187 esac
1189 # Only set CPU_ARCH if we recognize the value of OS_TEST
1191 case "$OS_TEST" in
1192 *86 | i86pc)
1193     CPU_ARCH=x86
1194     ;;
1196 powerpc64 | ppc64)
1197     CPU_ARCH=ppc64
1198     ;;
1200 powerpc | ppc | rs6000)
1201     CPU_ARCH=ppc
1202     ;;
1204 Alpha | alpha | ALPHA)
1205     CPU_ARCH=Alpha
1206     ;;
1208 s390)
1209     CPU_ARCH=s390
1210     ;;
1212 s390x)
1213     CPU_ARCH=s390x
1214     ;;
1216 hppa* | parisc)
1217     CPU_ARCH=hppa
1218     ;;
1220 sun4u | sparc*)
1221     CPU_ARCH=sparc
1222     ;;
1224 x86_64 | ia64)
1225     CPU_ARCH="$OS_TEST"
1226     ;;
1228 arm*)
1229     CPU_ARCH=arm
1230     ;;
1232 mips|mipsel)
1233     CPU_ARCH="mips"
1234     ;;
1235 esac
1237 if test -z "$OS_TARGET"; then
1238     OS_TARGET=$OS_ARCH
1240 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1242 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1243 dnl ===============================================================
1244 INTEL_ARCHITECTURE=
1245 case "$OS_TEST" in
1246     x86_64|i?86)
1247       INTEL_ARCHITECTURE=1
1248 esac
1250 dnl Configure platform-specific CPU architecture compiler options.
1251 dnl ==============================================================
1252 MOZ_ARCH_OPTS
1254 dnl =================================================================
1255 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1256 dnl which is bad when cross compiling.
1257 dnl =================================================================
1258 if test "$COMPILE_ENVIRONMENT"; then
1259 configure_static_assert_macros='
1260 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1261 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1262 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1265 dnl test that the macros actually work:
1266 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1267 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1268  [AC_LANG_SAVE
1269   AC_LANG_C
1270   ac_cv_static_assertion_macros_work="yes"
1271   AC_TRY_COMPILE([$configure_static_assert_macros],
1272                  [CONFIGURE_STATIC_ASSERT(1)],
1273                  ,
1274                  ac_cv_static_assertion_macros_work="no")
1275   AC_TRY_COMPILE([$configure_static_assert_macros],
1276                  [CONFIGURE_STATIC_ASSERT(0)],
1277                  ac_cv_static_assertion_macros_work="no",
1278                  )
1279   AC_LANG_CPLUSPLUS
1280   AC_TRY_COMPILE([$configure_static_assert_macros],
1281                  [CONFIGURE_STATIC_ASSERT(1)],
1282                  ,
1283                  ac_cv_static_assertion_macros_work="no")
1284   AC_TRY_COMPILE([$configure_static_assert_macros],
1285                  [CONFIGURE_STATIC_ASSERT(0)],
1286                  ac_cv_static_assertion_macros_work="no",
1287                  )
1288   AC_LANG_RESTORE
1289  ])
1290 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1291 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1292     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1294 fi # COMPILE_ENVIRONMENT
1296 dnl ========================================================
1297 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1298 dnl computed above.
1299 dnl ========================================================
1301 MOZ_ANDROID_STLPORT
1303 dnl ========================================================
1304 dnl Suppress Clang Argument Warnings
1305 dnl ========================================================
1306 if test -n "$CLANG_CC"; then
1307     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1308     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1310 if test -n "$CLANG_CXX"; then
1311     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1314 dnl ========================================================
1315 dnl = Use Address Sanitizer
1316 dnl ========================================================
1317 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1318 [  --enable-address-sanitizer       Enable Address Sanitizer (default=no)],
1319     MOZ_ASAN=1,
1320     MOZ_ASAN= )
1321 if test -n "$MOZ_ASAN"; then
1322     MOZ_LLVM_HACKS=1
1323     AC_DEFINE(MOZ_ASAN)
1325 AC_SUBST(MOZ_ASAN)
1327 dnl ========================================================
1328 dnl = Enable hacks required for LLVM instrumentations
1329 dnl ========================================================
1330 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1331 [  --enable-llvm-hacks       Enable workarounds required for several LLVM instrumentations (default=no)],
1332     MOZ_LLVM_HACKS=1,
1333     MOZ_LLVM_HACKS= )
1334 if test -n "$MOZ_LLVM_HACKS"; then
1335     MOZ_NO_WLZDEFS=1
1336     MOZ_CFLAGS_NSS=1
1338 AC_SUBST(MOZ_NO_WLZDEFS)
1339 AC_SUBST(MOZ_CFLAGS_NSS)
1341 dnl ========================================================
1342 dnl GNU specific defaults
1343 dnl ========================================================
1344 if test "$GNU_CC"; then
1345     # Per bug 719659 comment 2, some of the headers on ancient build machines
1346     # may require gnu89 inline semantics.  But otherwise, we use C99.
1347     CFLAGS="$CFLAGS -std=gnu99 -fgnu89-inline"
1348     # FIXME: Let us build with strict aliasing. bug 414641.
1349     CFLAGS="$CFLAGS -fno-strict-aliasing"
1350     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1351     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1352     DSO_LDOPTS='-shared'
1353     if test "$GCC_USE_GNU_LD"; then
1354         # Some tools like ASan use a runtime library that is only
1355         # linked against executables, so we must allow undefined
1356         # symbols for shared objects in some cases.
1357         if test -z "$MOZ_NO_WLZDEFS"; then
1358             # Don't allow undefined symbols in libraries
1359             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1360         fi
1361     fi
1362     WARNINGS_AS_ERRORS='-Werror'
1363     # Don't treat -Wuninitialized as error b/c it has lots of false positives.
1364     WARNINGS_AS_ERRORS="$WARNINGS_AS_ERRORS -Wno-error=uninitialized"
1365     # Don't treat -Wdeprecated-declarations as error b/c we don't want our
1366     # builds held hostage when a platform-specific API is suddenly deprecated.
1367     WARNINGS_AS_ERRORS="$WARNINGS_AS_ERRORS -Wno-error=deprecated-declarations"
1368     DSO_CFLAGS=''
1369     DSO_PIC_CFLAGS='-fPIC'
1370     ASFLAGS="$ASFLAGS -fPIC"
1371     AC_MSG_CHECKING([for --noexecstack option to as])
1372     _SAVE_CFLAGS=$CFLAGS
1373     CFLAGS="$CFLAGS -Wa,--noexecstack"
1374     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1375                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1376                      AC_MSG_RESULT([no]))
1377     CFLAGS=$_SAVE_CFLAGS
1378     AC_MSG_CHECKING([for -z noexecstack option to ld])
1379     _SAVE_LDFLAGS=$LDFLAGS
1380     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1381     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1382                   AC_MSG_RESULT([no])
1383                   LDFLAGS=$_SAVE_LDFLAGS)
1384     AC_MSG_CHECKING([for --build-id option to ld])
1385     _SAVE_LDFLAGS=$LDFLAGS
1386     LDFLAGS="$LDFLAGS -Wl,--build-id"
1387     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1388                   [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1389                   AC_MSG_RESULT([no])
1390                   LDFLAGS=$_SAVE_LDFLAGS)
1393     # Check for -mssse3 on $CC
1394     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1395     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1396     _SAVE_CFLAGS=$CFLAGS
1397     CFLAGS="$CFLAGS -mssse3"
1398     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1399                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1400                      AC_MSG_RESULT([no]))
1401     CFLAGS=$_SAVE_CFLAGS
1402     AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
1404     # Check for -msse4.1 on $CC
1405     AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1406     HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1407     _SAVE_CFLAGS=$CFLAGS
1408     CFLAGS="$CFLAGS -msse4.1"
1409     AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1410                      [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1411                      AC_MSG_RESULT([no]))
1412     CFLAGS=$_SAVE_CFLAGS
1413     AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
1415     # Turn on GNU-specific warnings:
1416     # -Wall - turn on a lot of warnings
1417     # -Wpointer-arith - good to have
1418     # -Wdeclaration-after-statement - MSVC doesn't like these
1419     # -Werror=return-type - catches missing returns, zero false positives
1420     # -Wtype-limits - catches overflow bugs, few false positives
1421     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1422     # -Wsign-compare - catches comparison of signed and unsigned types
1423     #
1424     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1425     MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1426     MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1427     MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1428     MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1429     
1430     # Turn off the following warnings that -Wall turns on:
1431     # -Wno-unused - lots of violations in third-party code
1432     #
1433     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1435     if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1436        # Don't use -Wcast-align with ICC or clang
1437        case "$CPU_ARCH" in
1438            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1439            hppa | ia64 | sparc | arm)
1440            ;;
1441            *)
1442         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1443            ;;
1444        esac
1445     fi
1447     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1448     _USE_CPP_INCLUDE_FLAG=1
1449     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1451 elif test "$SOLARIS_SUNPRO_CC"; then
1452     DSO_CFLAGS=''
1453     if test "$CPU_ARCH" = "sparc"; then
1454         # for Sun Studio on Solaris/SPARC
1455         DSO_PIC_CFLAGS='-xcode=pic32'
1456     else
1457         DSO_PIC_CFLAGS='-KPIC'
1458     fi
1459     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1460 else
1461     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1462     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1464     DSO_LDOPTS='-shared'
1465     if test "$GNU_LD"; then
1466         # Don't allow undefined symbols in libraries
1467         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1468     fi
1470     DSO_CFLAGS=''
1471     DSO_PIC_CFLAGS='-KPIC'
1472     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1475 if test "$GNU_CXX"; then
1476     # FIXME: Let us build with strict aliasing. bug 414641.
1477     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1479     # Turn on GNU-specific warnings:
1480     # -Wall - turn on a lot of warnings
1481     # -Wpointer-arith - good to have
1482     # -Woverloaded-virtual - ???
1483     # -Werror=return-type - catches missing returns, zero false positives
1484     # -Wtype-limits - catches overflow bugs, few false positives
1485     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1486     # -Wsign-compare - catches comparison of signed and unsigned types
1487     #
1488     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1489     MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1490     MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1491     MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1492     MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1494     # Turn off the following warnings that -Wall turns on:
1495     # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1496     #
1497     MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1499     if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1500        # Don't use -Wcast-align with ICC or clang
1501        case "$CPU_ARCH" in
1502            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1503            hppa | ia64 | sparc | arm)
1504            ;;
1505            *)
1506         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1507            ;;
1508        esac
1509     fi
1511     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1512     _USE_CPP_INCLUDE_FLAG=1
1514     # Recent clang and gcc support C++11 deleted functions without warnings if
1515     # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1516     # versions).  We can't use -std=c++0x yet, so gcc's support must remain
1517     # unused.  But clang's warning can be disabled, so when compiling with clang
1518     # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1519     # deleted function syntax.
1520     if test "$CLANG_CXX"; then
1521         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1522         MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1523     fi
1525 else
1526     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1529 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1530 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1531 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1532 dnl normal behavior.
1533 dnl ========================================================
1534 MKSHLIB_FORCE_ALL=
1535 MKSHLIB_UNFORCE_ALL=
1537 if test "$COMPILE_ENVIRONMENT"; then
1538 if test "$GNU_CC"; then
1539   AC_MSG_CHECKING(whether ld has archive extraction flags)
1540   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1541    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1542     ac_cv_mkshlib_force_and_unforce="no"
1543     exec 3<&0 <<LOOP_INPUT
1544         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1545         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1546         force="-Wl,-all";              unforce="-Wl,-none"
1547 LOOP_INPUT
1548     while read line
1549     do
1550       eval $line
1551       LDFLAGS=$force
1552       LIBS=$unforce
1553       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1554     done
1555     exec 0<&3 3<&-
1556     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1557    ])
1558   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1559     AC_MSG_RESULT(no)
1560   else
1561     AC_MSG_RESULT(yes)
1562     eval $ac_cv_mkshlib_force_and_unforce
1563     MKSHLIB_FORCE_ALL=$force
1564     MKSHLIB_UNFORCE_ALL=$unforce
1565   fi
1566 fi # GNU_CC
1567 fi # COMPILE_ENVIRONMENT
1569 dnl ========================================================
1570 dnl Checking for 64-bit OS
1571 dnl ========================================================
1572 if test "$COMPILE_ENVIRONMENT"; then
1573 AC_LANG_SAVE
1574 AC_LANG_C
1575 AC_MSG_CHECKING(for 64-bit OS)
1576 AC_TRY_COMPILE([$configure_static_assert_macros],
1577                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1578                result="yes", result="no")
1579 AC_MSG_RESULT("$result")
1580 if test "$result" = "yes"; then
1581     AC_DEFINE(HAVE_64BIT_OS)
1582     HAVE_64BIT_OS=1
1584 AC_SUBST(HAVE_64BIT_OS)
1585 AC_LANG_RESTORE
1586 fi # COMPILE_ENVIRONMENT
1588 dnl ========================================================
1589 dnl Enable high-memory support on OS/2 by default.
1590 dnl ========================================================
1591 MOZ_OS2_HIGH_MEMORY=1
1592 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1593 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1594     MOZ_OS2_HIGH_MEMORY=,
1595     MOZ_OS2_HIGH_MEMORY=1 )
1596 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1598 dnl ========================================================
1599 dnl = Use profiling compile flags
1600 dnl ========================================================
1601 MOZ_ARG_ENABLE_BOOL(profiling,
1602 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1603     MOZ_PROFILING=1,
1604     MOZ_PROFILING= )
1606 # For profiling builds keep the symbol information
1607 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1608     case "$OS_TARGET" in
1609     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1610         STRIP_FLAGS="--strip-debug"
1611         ;;
1612     esac
1615 dnl ========================================================
1616 dnl = Use incremental GC
1617 dnl ========================================================
1618 JSGC_INCREMENTAL=1
1619 MOZ_ARG_DISABLE_BOOL(gcincremental,
1620 [  --disable-gcincremental Disable incremental GC],
1621     JSGC_INCREMENTAL= )
1622 if test -n "$JSGC_INCREMENTAL"; then
1623     AC_DEFINE(JSGC_INCREMENTAL)
1626 dnl ========================================================
1627 dnl = Use generational GC
1628 dnl ========================================================
1629 MOZ_ARG_ENABLE_BOOL(gcgenerational,
1630 [  --enable-gcgenerational Enable generational GC],
1631     JSGC_GENERATIONAL=1,
1632     JSGC_GENERATIONAL= )
1633 if test -n "$JSGC_GENERATIONAL"; then
1634     AC_DEFINE(JSGC_GENERATIONAL)
1637 dnl ========================================================
1638 dnl = Perform moving GC stack rooting analysis
1639 dnl ========================================================
1640 MOZ_ARG_ENABLE_BOOL(root-analysis,
1641 [  --enable-root-analysis  Enable moving GC stack root analysis],
1642     JSGC_ROOT_ANALYSIS=1,
1643     JSGC_ROOT_ANALYSIS= )
1644 if test -n "$JSGC_ROOT_ANALYSIS"; then
1645     AC_DEFINE(JSGC_ROOT_ANALYSIS)
1648 dnl ========================================================
1649 dnl = Use exact stack rooting for GC
1650 dnl ========================================================
1651 MOZ_ARG_ENABLE_BOOL(exact-rooting,
1652 [  --enable-exact-rooting  Enable use of exact stack roots for GC],
1653     JSGC_USE_EXACT_ROOTING=1,
1654     JSGC_USE_EXACT_ROOTING= )
1655 if test -n "$JSGC_USE_EXACT_ROOTING"; then
1656     AC_DEFINE(JSGC_USE_EXACT_ROOTING)
1659 dnl ========================================================
1660 dnl = Use Valgrind
1661 dnl ========================================================
1662 MOZ_ARG_ENABLE_BOOL(valgrind,
1663 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
1664     MOZ_VALGRIND=1,
1665     MOZ_VALGRIND= )
1666 if test -n "$MOZ_VALGRIND"; then
1667     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1668         AC_MSG_ERROR(
1669             [--enable-valgrind specified but Valgrind is not installed]))
1670     AC_DEFINE(MOZ_VALGRIND)
1672 AC_SUBST(MOZ_VALGRIND)
1674 dnl ========================================================
1675 dnl jprof
1676 dnl ========================================================
1677 MOZ_ARG_ENABLE_BOOL(jprof,
1678 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1679     MOZ_JPROF=1,
1680     MOZ_JPROF= )
1681 if test -n "$MOZ_JPROF"; then
1682     MOZ_PROFILING=1
1683     AC_DEFINE(MOZ_JPROF)
1686 dnl ========================================================
1687 dnl SPS Profiler
1688 dnl ========================================================
1689 MOZ_ENABLE_PROFILER_SPS=1
1691 case "${OS_TARGET}" in
1692 Android)
1693     case "${CPU_ARCH}" in
1694     x86 | arm) ;;
1695     *)
1696         MOZ_ENABLE_PROFILER_SPS=
1697     esac
1698     ;;
1699 Linux)
1700     case "${CPU_ARCH}" in
1701     x86 | x86_64) ;;
1702     *)
1703         MOZ_ENABLE_PROFILER_SPS=
1704     esac
1705     ;;
1706 WINNT|Darwin) ;;
1708     MOZ_ENABLE_PROFILER_SPS=
1709     ;;
1710 esac
1712 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1713     AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1716 dnl ========================================================
1717 dnl shark
1718 dnl ========================================================
1719 MOZ_ARG_ENABLE_BOOL(shark,
1720 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
1721     MOZ_SHARK=1,
1722     MOZ_SHARK= )
1723 if test -n "$MOZ_SHARK"; then
1724     MOZ_PROFILING=1
1725     AC_DEFINE(MOZ_SHARK)
1728 dnl ========================================================
1729 dnl instruments
1730 dnl ========================================================
1731 MOZ_ARG_ENABLE_BOOL(instruments,
1732 [  --enable-instruments    Enable instruments remote profiling. Implies --enable-profiling.],
1733     MOZ_INSTRUMENTS=1,
1734     MOZ_INSTRUMENTS= )
1735 if test -n "$MOZ_INSTRUMENTS"; then
1736     MOZ_PROFILING=1
1737     AC_DEFINE(MOZ_INSTRUMENTS)
1740 dnl ========================================================
1741 dnl callgrind
1742 dnl ========================================================
1743 MOZ_ARG_ENABLE_BOOL(callgrind,
1744 [  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
1745     MOZ_CALLGRIND=1,
1746     MOZ_CALLGRIND= )
1747 if test -n "$MOZ_CALLGRIND"; then
1748     MOZ_PROFILING=1
1749     AC_DEFINE(MOZ_CALLGRIND)
1752 dnl ========================================================
1753 dnl vtune
1754 dnl ========================================================
1755 MOZ_ARG_ENABLE_BOOL(vtune,
1756 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
1757     MOZ_VTUNE=1,
1758     MOZ_VTUNE= )
1759 if test -n "$MOZ_VTUNE"; then
1760     MOZ_PROFILING=1
1761     AC_DEFINE(MOZ_VTUNE)
1764 dnl ========================================================
1765 dnl Profiling
1766 dnl ========================================================
1767 if test -n "$MOZ_PROFILING"; then
1768     AC_DEFINE(MOZ_PROFILING)
1771 dnl ========================================================
1772 dnl System overrides of the defaults for host
1773 dnl ========================================================
1774 case "$host" in
1775 *mingw*)
1776     if test -n "$_WIN32_MSVC"; then
1777         HOST_AR=lib
1778         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1779         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1780         HOST_RANLIB='echo ranlib'
1781     else
1782         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1783     fi
1784     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1785     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1786     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1787     HOST_BIN_SUFFIX=.exe
1788     case "$host" in
1789     *mingw*)
1790         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1791         ;;
1792     esac
1794     case "${host_cpu}" in
1795     i*86)
1796         if test -n "$_WIN32_MSVC"; then
1797             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1798         fi
1799         ;;
1800     x86_64)
1801         if test -n "$_WIN32_MSVC"; then
1802             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1803         fi
1804         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1805         ;;
1806     esac
1807     ;;
1809 *-darwin*)
1810     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1811     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1812     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1813     ;;
1815 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1816     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1817     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1818     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1819     ;;
1821 *os2*)
1822     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1823     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1824     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1825     HOST_BIN_SUFFIX=.exe
1826     MOZ_FIX_LINK_PATHS=
1827     ;;
1830     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1831     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1832     ;;
1833 esac
1835 dnl Check for using a custom <stdint.h> implementation
1836 dnl ========================================================
1837 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1838 if test "$MOZ_CUSTOM_STDINT_H"; then
1839   AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1840   AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1841 else
1842   AC_MSG_RESULT(none specified)
1845 dnl Get mozilla version from central milestone file
1846 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1847 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1849 dnl Get version of various core apps from the version files.
1850 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1852 if test -z "$FIREFOX_VERSION"; then
1853     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1856 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1857 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1858 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1860 MOZ_DOING_LTO(lto_is_enabled)
1862 dnl ========================================================
1863 dnl System overrides of the defaults for target
1864 dnl ========================================================
1866 case "$target" in
1867 *-aix*)
1868     AC_DEFINE(AIX)
1869     if test ! "$GNU_CC"; then
1870         if test ! "$HAVE_64BIT_OS"; then
1871             # Compiling with Visual Age C++ object model compat is the
1872             # default. To compile with object model ibm, add
1873             # AIX_OBJMODEL=ibm to .mozconfig.
1874             if test "$AIX_OBJMODEL" = "ibm"; then
1875                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1876             else
1877                 AIX_OBJMODEL=compat
1878             fi
1879         else
1880             AIX_OBJMODEL=compat
1881         fi
1882         AC_SUBST(AIX_OBJMODEL)
1883         DSO_LDOPTS='-qmkshrobj=1'
1884         DSO_CFLAGS='-qflag=w:w'
1885         DSO_PIC_CFLAGS=
1886         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1887         MOZ_FIX_LINK_PATHS=
1888         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1889         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1890         if test "$COMPILE_ENVIRONMENT"; then
1891             AC_LANG_SAVE
1892             AC_LANG_CPLUSPLUS
1893             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1894             AC_TRY_COMPILE([],
1895                 [#if (__IBMCPP__ < 900)
1896                  #error "Bad compiler"
1897                  #endif],
1898                 _BAD_COMPILER=,_BAD_COMPILER=1)
1899             if test -n "$_BAD_COMPILER"; then
1900                 AC_MSG_RESULT([no])
1901                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1902             else
1903                 AC_MSG_RESULT([yes])
1904             fi
1905             AC_LANG_RESTORE
1906             TARGET_COMPILER_ABI="ibmc"
1907             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1908             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1909         fi
1910     fi
1911     case "${target_os}" in
1912     aix4.1*)
1913         DLL_SUFFIX='_shr.a'
1914         ;;
1915     esac
1916     if test "$COMPILE_ENVIRONMENT"; then
1917         MOZ_CHECK_HEADERS(sys/inttypes.h)
1918     fi
1919     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1920     ;;
1922 *-darwin*)
1923     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1924     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1925     MOZ_OPTIMIZE_FLAGS="-O3"
1926     # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
1927     if test "$HAVE_64BIT_OS"; then
1928         MOZ_MEMORY=1
1929     fi
1930     DLL_SUFFIX=".dylib"
1931     DSO_LDOPTS=''
1932     STRIP_FLAGS="$STRIP_FLAGS -x -S"
1933     # Check whether we're targeting OS X or iOS
1934     AC_CACHE_CHECK(for iOS target,
1935                    ac_cv_ios_target,
1936                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
1937 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1938 #error not iOS
1939 #endif],
1940                                    [],
1941                                    ac_cv_ios_target="yes",
1942                                    ac_cv_ios_target="no")])
1943     if test "$ac_cv_ios_target" = "yes"; then
1944         AC_DEFINE(XP_IOS)
1945         AC_DEFINE(XP_DARWIN)
1946         _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1947     else
1948         AC_DEFINE(XP_MACOSX)
1949         AC_DEFINE(XP_DARWIN)
1950         _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1951         # The ExceptionHandling framework is needed for Objective-C exception
1952         # logging code in nsObjCExceptions.h. Currently we only use that in debug
1953         # builds.
1954         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1955     fi
1956     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1959     if test "x$lto_is_enabled" = "xyes"; then
1960         echo "Skipping -dead_strip because lto is enabled."
1961     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1962     dnl ===================================================================
1963     elif test "x$enable_dtrace" = "xyes"; then
1964         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1965     else
1966         dnl check for the presence of the -dead_strip linker flag
1967         AC_MSG_CHECKING([for -dead_strip option to ld])
1968         _SAVE_LDFLAGS=$LDFLAGS
1969         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1970         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1971         if test -n "$_HAVE_DEAD_STRIP" ; then
1972             AC_MSG_RESULT([yes])
1973             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1974         else
1975             AC_MSG_RESULT([no])
1976         fi
1978         LDFLAGS=$_SAVE_LDFLAGS
1979     fi
1981     dnl With newer linkers we need to pass -allow_heap_execute because of
1982     dnl Microsoft Silverlight (5.1.10411.0 at least).
1983     AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1984     _SAVE_LDFLAGS=$LDFLAGS
1985     LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1986     AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1987                 _HAVE_ALLOW_HEAP_EXECUTE=)
1988     if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1989         AC_MSG_RESULT([yes])
1990         MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1991     else
1992         AC_MSG_RESULT([no])
1993     fi
1994     LDFLAGS=$_SAVE_LDFLAGS
1996     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1997     ;;
1999 ia64*-hpux*)
2000     DLL_SUFFIX=".so"
2001     if test ! "$GNU_CC"; then
2002        DSO_LDOPTS='-b'
2003        DSO_CFLAGS=""
2004        DSO_PIC_CFLAGS=
2005        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2006        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2007        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2008     else
2009        DSO_LDOPTS='-b -E'
2010        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2011        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2012     fi
2013     MOZ_FIX_LINK_PATHS=
2014     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2015     AC_DEFINE(_LARGEFILE64_SOURCE)
2016     ;;
2018 *-hpux*)
2019     DLL_SUFFIX=".sl"
2020     if test ! "$GNU_CC"; then
2021         DSO_LDOPTS='-b -Wl,+s'
2022         DSO_CFLAGS=""
2023         DSO_PIC_CFLAGS="+Z"
2024         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2025         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2026         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2027     else
2028         DSO_LDOPTS='-b -E +s'
2029         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2030         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2031     fi
2032     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2033     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2034     ;;
2036 *-android*|*-linuxandroid*)
2037     AC_DEFINE(NO_PW_GECOS)
2038     no_x=yes
2039     if test -n "$gonkdir"; then
2040         _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2041         MOZ_B2G_RIL=1
2042         MOZ_B2G_BT=1
2043         MOZ_B2G_FM=1
2044     else
2045         _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2046         MOZ_LINKER=1
2047     fi
2048     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2050     MOZ_GFX_OPTIMIZE_MOBILE=1
2051     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2052     ;;
2054 *-*linux*)
2055     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2056     # Similarly for GNU_CXX and INTEL_CXX.
2057     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2058         # -Os has been broken on Intel's C/C++ compilers for quite a
2059         # while; Intel recommends against using it.
2060         MOZ_OPTIMIZE_FLAGS="-O2"
2061         MOZ_DEBUG_FLAGS="-g"
2062     elif test "$GNU_CC" -o "$GNU_CXX"; then
2063         case $GCC_VERSION in
2064         4.5.*)
2065             # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
2066             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2067         esac
2068         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2069         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2070         MOZ_DEBUG_FLAGS="-g"
2071     fi
2073     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2075     MOZ_MEMORY=1
2077     case "${target_cpu}" in
2078     alpha*)
2079         CFLAGS="$CFLAGS -mieee"
2080         CXXFLAGS="$CXXFLAGS -mieee"
2081     ;;
2082     i*86)
2083         USE_ELF_DYNSTR_GC=1
2084     ;;
2085     mips*)
2086         MOZ_DEBUG_FLAGS="-g" # We want inlining
2087     ;;
2088     esac
2090     if test -z "$MC"; then
2091         MC=mc.exe
2092     fi
2093     ;;
2094 *-mingw*)
2095     DSO_CFLAGS=
2096     DSO_PIC_CFLAGS=
2097     DLL_SUFFIX=.dll
2098     RC=rc.exe
2099     MC=mc.exe
2100     # certain versions of cygwin's makedepend barf on the
2101     # #include <string> vs -I./dist/include/string issue so don't use it
2102     if test -n "$GNU_CC"; then
2103         CC="$CC -mwindows"
2104         CXX="$CXX -mwindows"
2105         CPP="$CPP -mwindows"
2106         CFLAGS="$CFLAGS -mms-bitfields"
2107         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2108         DSO_LDOPTS='-shared'
2109         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2110         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2111         RC='$(WINDRES)'
2112         # Use static libgcc and libstdc++
2113         LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
2114         # Use temp file for windres (bug 213281)
2115         RCFLAGS='-O coff --use-temp-file'
2116         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2117         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2118         MOZ_FIX_LINK_PATHS=
2119         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2120         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2121         DLL_PREFIX=
2122         IMPORT_LIB_SUFFIX=dll.a
2124         # We use mix of both POSIX and Win32 printf format across the tree, so format
2125         # warnings are useless on mingw.
2126         MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2127         MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2128     else
2129         TARGET_COMPILER_ABI=msvc
2130         HOST_CC='$(CC)'
2131         HOST_CXX='$(CXX)'
2132         HOST_LD='$(LD)'
2133         if test "$AS_BIN"; then
2134             AS="$(basename "$AS_BIN")"
2135         fi
2136         AR='lib'
2137         AR_FLAGS='-NOLOGO -OUT:"$@"'
2138         AR_EXTRACT=
2139         RANLIB='echo not_ranlib'
2140         STRIP='echo not_strip'
2141         PKG_SKIP_STRIP=1
2142         XARGS=xargs
2143         ZIP=zip
2144         UNZIP=unzip
2145         DOXYGEN=:
2146         ASM_SUFFIX=asm
2147         OBJ_SUFFIX=obj
2148         LIB_SUFFIX=lib
2149         DLL_PREFIX=
2150         LIB_PREFIX=
2151         IMPORT_LIB_SUFFIX=lib
2152         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2153         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2154         MKSHLIB_FORCE_ALL=
2155         MKSHLIB_UNFORCE_ALL=
2156         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2157         _USE_CPP_INCLUDE_FLAG=1
2158         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2159         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2160         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2161         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2162         # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2163         # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2164         # MSVC warning C4482 warns when an enum value is refered specifing the
2165         # name of the enum itself.  This behavior is allowed in C++11, and the
2166         # warning has been removed in VS2012.
2167         # MSVC warning C4800 warns when a value is implicitly cast to bool,
2168         # because this also forces narrowing to a single byte, which can be a
2169         # perf hit.  But this matters so little in practice (and often we want
2170         # that behavior) that it's better to turn it off.
2171         # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2172         # on non-Western system locales even if it is in a comment.
2173         # khuey says we can safely ignore MSVC warning C4251
2174         CFLAGS="$CFLAGS -wd4819"
2175         CXXFLAGS="$CXXFLAGS -wd4251 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2176         # make 'foo == bar;' error out
2177         CFLAGS="$CFLAGS -we4553"
2178         CXXFLAGS="$CXXFLAGS -we4553"
2179         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2180         MOZ_DEBUG_FLAGS='-Zi'
2181         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2182         WARNINGS_AS_ERRORS='-WX'
2183         MOZ_OPTIMIZE_FLAGS='-O1'
2184         MOZ_FIX_LINK_PATHS=
2185         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2186         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2187         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2188         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2189         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2190         dnl For profile-guided optimization
2191         PROFILE_GEN_CFLAGS="-GL"
2192         PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2193         dnl XXX: PGO builds can fail with warnings treated as errors,
2194         dnl specifically "no profile data available" appears to be
2195         dnl treated as an error sometimes. This might be a consequence
2196         dnl of using WARNINGS_AS_ERRORS in some modules, combined
2197         dnl with the linker doing most of the work in the whole-program
2198         dnl optimization/PGO case. I think it's probably a compiler bug,
2199         dnl but we work around it here.
2200         PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2201         dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2202         dnl Probably also a compiler bug, but what can you do?
2203         PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2204         LDFLAGS="$LDFLAGS -DYNAMICBASE"
2205         if test "$_MSC_VER" -ge 1500; then
2206             dnl VS2008 or later supports SSSE3
2207             HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2208             AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
2209         fi
2210     fi
2211     AC_DEFINE(HAVE_SNPRINTF)
2212     AC_DEFINE(_WINDOWS)
2213     AC_DEFINE(WIN32)
2214     AC_DEFINE(XP_WIN)
2215     AC_DEFINE(XP_WIN32)
2216     AC_DEFINE(HW_THREADS)
2217     AC_DEFINE(STDC_HEADERS)
2218     AC_DEFINE(NEW_H, <new>)
2219     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2220     TARGET_MD_ARCH=win32
2221     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2222     BIN_SUFFIX='.exe'
2223     MOZ_USER_DIR="Mozilla"
2225     dnl Hardcode to win95 for now - cls
2226     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2228     dnl set NO_X11 defines here as the general check is skipped on win32
2229     no_x=yes
2230     AC_DEFINE(NO_X11)
2232     case "$host" in
2233     *-mingw*)
2234         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2235         L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2236         ;;
2237     esac
2239     case "$host" in
2240     *-mingw*)
2241         if test -z "$MOZ_TOOLS"; then
2242             AC_MSG_ERROR([MOZ_TOOLS is not set])
2243         fi
2244         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2245         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2246             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2247         fi
2248         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2249         if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2250             AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2251         fi
2252         ;;
2253     esac
2255     case "$host_os" in
2256     cygwin*|msvc*|mks*)
2257         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.])
2258         ;;
2259     esac
2261     case "$target" in
2262     i*86-*)
2263         if test "$HAVE_64BIT_OS"; then
2264             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2265         fi
2267         if test -n "$GNU_CC"; then
2268             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2269             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2270             LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup"
2271         else
2272             AC_DEFINE(HAVE_STDCALL)
2273             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2274             LDFLAGS="$LDFLAGS -SAFESEH"
2275         fi
2277         AC_DEFINE(_X86_)
2278         ;;
2279     x86_64-*)
2280         if test -n "$_WIN32_MSVC"; then
2281             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2282         fi
2283         AC_DEFINE(_AMD64_)
2284         ;;
2285     *)
2286         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2287         ;;
2288     esac
2290     if test "$HAVE_64BIT_OS"; then
2291         AC_DEFINE(_WIN64)
2292     fi
2293     ;;
2295 *-netbsd*)
2296     DSO_CFLAGS=''
2297     CFLAGS="$CFLAGS -Dunix"
2298     CXXFLAGS="$CXXFLAGS -Dunix"
2299     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2300         DLL_SUFFIX=".so"
2301         DSO_PIC_CFLAGS='-fPIC -DPIC'
2302         DSO_LDOPTS='-shared'
2303         BIN_FLAGS='-Wl,--export-dynamic'
2304     else
2305         DSO_PIC_CFLAGS='-fPIC -DPIC'
2306         DLL_SUFFIX=".so.1.0"
2307         DSO_LDOPTS='-shared'
2308     fi
2309     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2310     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2311     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2312     if test "$LIBRUNPATH"; then
2313         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2314     fi
2315     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2316     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2317     ;;
2319 *-openbsd*)
2320     if test "$SO_VERSION"; then
2321         DLL_SUFFIX=".so.$SO_VERSION"
2322     else
2323         DLL_SUFFIX=".so.1.0"
2324     fi
2325     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2326     DSO_CFLAGS=''
2327     DSO_PIC_CFLAGS='-fPIC'
2328     DSO_LDOPTS='-shared -fPIC'
2329     if test "$LIBRUNPATH"; then
2330         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2331     fi
2332     ;;
2334 *-os2*)
2335     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2336     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2337     AC_DEFINE(OS2)
2338     AC_DEFINE(XP_OS2)
2339     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2340     AC_DEFINE(TCPV40HDRS)
2341     DLL_PREFIX=
2342     LIB_PREFIX=
2343     LIB_SUFFIX=lib
2344     BIN_SUFFIX=".exe"
2345     DLL_SUFFIX=".dll"
2346     IMPORT_LIB_SUFFIX=lib
2347     DSO_PIC_CFLAGS=
2348     AR=emxomfar
2349     AR_FLAGS='r $@'
2350     CFLAGS="$CFLAGS -Zomf"
2351     CXXFLAGS="$CXXFLAGS -Zomf"
2352     DSO_LDOPTS='-Zdll'
2353     BIN_FLAGS='-Zlinker /ST:0x100000'
2354     IMPLIB='emximp -o'
2355     FILTER='true'
2356     LDFLAGS='-Zmap'
2357     WARNINGS_AS_ERRORS='-Werror'
2358     MOZ_DEBUG_FLAGS="-g -fno-inline"
2359     MOZ_OPTIMIZE_FLAGS="-O2"
2360     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2361     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2362     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2363     TARGET_MD_ARCH=os2
2364     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2365     RC=rc.exe
2366     MC=mc.exe
2367     RCFLAGS='-n'
2368     MOZ_USER_DIR="Mozilla"
2369     ZIP="$ZIP -X"
2370     STRIP=lxlite
2371     STRIP_FLAGS="/yua /ydd /yxd /ynl /anp /b- /cs+ /d /i- /ml1 /mr2 /mf2 /r+ /u+ /x- /zs:0 /zx /zd"
2373     if test "$MOZTOOLS"; then
2374         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2375     else
2376         AC_MSG_ERROR([MOZTOOLS is not set])
2377     fi
2378     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2379         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2380         LDFLAGS="$LDFLAGS -Zhigh-mem"
2381         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2382         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2383     fi
2385     # GCC for OS/2 currently predefines these, but we don't want them
2386     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2387     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2389     AC_CACHE_CHECK(for __declspec(dllexport),
2390         ac_os2_declspec,
2391         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2392                         [return 0;],
2393                         ac_os2_declspec="yes",
2394                         ac_os2_declspec="no")])
2395     if test "$ac_os2_declspec" != "yes"; then
2396         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2397     fi
2398     ;;
2400 *-solaris*)
2401     AC_DEFINE(SOLARIS)
2402     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2403     MOZ_FIX_LINK_PATHS=
2404     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2405     # libraries one level up (e.g. libnspr4.so)
2406     if test "$SOLARIS_SUNPRO_CC"; then
2407        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2408        LIBS="-lCrun -lCstd -lc $LIBS"
2409        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2410        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2411        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2412        LDFLAGS="-xildoff $LDFLAGS"
2413        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2414            _SAVE_LDFLAGS=$LDFLAGS
2415            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2416            AC_TRY_LINK([#include <stdio.h>],
2417                        [printf("Hello World\n");],
2418                        ,
2419                        [LDFLAGS=$_SAVE_LDFLAGS])
2420        fi
2421        MOZ_OPTIMIZE_FLAGS="-xO4"
2422        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2423        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2424        MKSHLIB_FORCE_ALL='-z allextract'
2425        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2426        DSO_LDOPTS='-G'
2427        AR_LIST="$AR t"
2428        AR_EXTRACT="$AR x"
2429        AR_DELETE="$AR d"
2430        AR='$(CXX) -xar'
2431        AR_FLAGS='-o $@'
2432        AS='/usr/ccs/bin/as'
2433        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2434        AS_DASH_C_FLAG=''
2435        TARGET_COMPILER_ABI="sunc"
2436        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2437        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2438        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2439        AC_LANG_SAVE
2440        AC_LANG_CPLUSPLUS
2441        AC_TRY_COMPILE([],
2442            [#if (__SUNPRO_CC < 0x590)
2443            #error "Denied"
2444            #endif],
2445            _BAD_COMPILER=,_BAD_COMPILER=1)
2446        if test -n "$_BAD_COMPILER"; then
2447            _res="no"
2448            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2449        else
2450            _res="yes"
2451        fi
2452        AC_TRY_COMPILE([],
2453            [#if (__SUNPRO_CC >= 0x5100)
2454            #error "Sun C++ 5.10 or above"
2455            #endif],
2456            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2457        if test "$_ABOVE_SS12U1"; then
2458            # disable xannotate
2459            CXXFLAGS="$CXXFLAGS -xannotate=no"
2460        fi
2461        AC_MSG_RESULT([$_res])
2462        AC_LANG_RESTORE
2463     else
2464        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2465        LIBS="-lc $LIBS"
2466        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2467        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2468        ASFLAGS="$ASFLAGS -fPIC"
2469        DSO_LDOPTS='-shared'
2470        WARNINGS_AS_ERRORS='-Werror'
2471        _WARNINGS_CFLAGS=''
2472        _WARNINGS_CXXFLAGS=''
2473        if test "$OS_RELEASE" = "5.3"; then
2474            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2475        fi
2476     fi
2477     if test "$OS_RELEASE" = "5.5.1"; then
2478         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2479     fi
2480     ;;
2482 *-sunos*)
2483     DSO_LDOPTS='-Bdynamic'
2484     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2485     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2486     AC_DEFINE(SUNOS4)
2487     AC_DEFINE(SPRINTF_RETURNS_STRING)
2488     case "$(target_os)" in
2489     sunos4.1*)
2490         DLL_SUFFIX='.so.1.0'
2491         ;;
2492     esac
2493     ;;
2495 *-os2*)
2496     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2497     ;;
2499 esac
2501 AC_SUBST(MOZ_LINKER)
2502 if test -n "$MOZ_LINKER"; then
2503   AC_DEFINE(MOZ_LINKER)
2505 AC_SUBST(MOZ_ENABLE_SZIP)
2507 dnl Only one oddball right now (QNX), but this gives us flexibility
2508 dnl if any other platforms need to override this in the future.
2509 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2511 dnl ========================================================
2512 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2513 dnl by now will not have any way to link most binaries (tests
2514 dnl as well as viewer, apprunner, etc.), because some symbols
2515 dnl will be left out of the "composite" .so's by ld as unneeded.
2516 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2517 dnl they can link in the static libs that provide the missing
2518 dnl symbols.
2519 dnl ========================================================
2520 NO_LD_ARCHIVE_FLAGS=
2521 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2522     NO_LD_ARCHIVE_FLAGS=1
2524 case "$target" in
2525 *-os2*)
2526     NO_LD_ARCHIVE_FLAGS=
2527     ;;
2528 *-aix4.3*|*-aix5*)
2529     NO_LD_ARCHIVE_FLAGS=
2530     ;;
2531 *-mingw*)
2532     if test -z "$GNU_CC"; then
2533         NO_LD_ARCHIVE_FLAGS=
2534     fi
2535     ;;
2536 esac
2537 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2539 dnl ========================================================
2540 dnl = Flags to strip unused symbols from .so components and
2541 dnl = to export jemalloc symbols when linking a program
2542 dnl ========================================================
2543 case "$target" in
2544     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2545         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2546         ;;
2547     *-solaris*)
2548         if test -z "$GNU_CC"; then
2549          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2550         else
2551          if test -z "$GCC_USE_GNU_LD"; then
2552           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2553          else
2554           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2555          fi
2556         fi
2557         ;;
2558     *-darwin*)
2559         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2560         ;;
2561     *-mingw*)
2562         if test -n "$GNU_CC"; then
2563            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2564         fi
2565         ;;
2566 esac
2568 if test -z "$COMPILE_ENVIRONMENT"; then
2569     SKIP_COMPILER_CHECKS=1
2570     SKIP_LIBRARY_CHECKS=1
2573 MOZ_COMPILER_OPTS
2574 if test -z "$SKIP_COMPILER_CHECKS"; then
2575 dnl Checks for typedefs, structures, and compiler characteristics.
2576 dnl ========================================================
2577 AC_HEADER_STDC
2578 AC_C_CONST
2579 AC_TYPE_MODE_T
2580 AC_TYPE_OFF_T
2581 AC_TYPE_PID_T
2582 AC_TYPE_SIZE_T
2583 AC_LANG_CPLUSPLUS
2584 AC_MSG_CHECKING(for __stdcall)
2585 AC_CACHE_VAL(ac_cv___stdcall,
2586  [AC_TRY_COMPILE([template <typename Method> struct foo;
2587                   template <> struct foo<void (*)()> {};
2588                   template <> struct foo<void (__stdcall*)()> {};],
2589                  [],
2590                  [ac_cv___stdcall=true],
2591                  [ac_cv___stdcall=false])])
2592 if test "$ac_cv___stdcall" = true ; then
2593   AC_DEFINE(HAVE_STDCALL)
2594   AC_MSG_RESULT(yes)
2595 else
2596   AC_MSG_RESULT(no)
2598 AC_LANG_C
2599 AC_MSG_CHECKING(for ssize_t)
2600 AC_CACHE_VAL(ac_cv_type_ssize_t,
2601  [AC_TRY_COMPILE([#include <stdio.h>
2602                   #include <sys/types.h>],
2603                  [ssize_t foo = 0;],
2604                  [ac_cv_type_ssize_t=true],
2605                  [ac_cv_type_ssize_t=false])])
2606 if test "$ac_cv_type_ssize_t" = true ; then
2607   AC_DEFINE(HAVE_SSIZE_T)
2608   AC_MSG_RESULT(yes)
2609 else
2610   AC_MSG_RESULT(no)
2612 AC_STRUCT_ST_BLKSIZE
2613 AC_MSG_CHECKING(for siginfo_t)
2614 AC_CACHE_VAL(ac_cv_siginfo_t,
2615  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2616                   #include <signal.h>],
2617                  [siginfo_t* info;],
2618                  [ac_cv_siginfo_t=true],
2619                  [ac_cv_siginfo_t=false])])
2620 if test "$ac_cv_siginfo_t" = true ; then
2621   AC_DEFINE(HAVE_SIGINFO_T)
2622   AC_MSG_RESULT(yes)
2623 else
2624   AC_MSG_RESULT(no)
2627 dnl Check for int64, uint, and uint_t.
2628 dnl ========================================================
2629 AC_MSG_CHECKING(for int64)
2630 AC_CACHE_VAL(ac_cv_int64,
2631  [AC_TRY_COMPILE([#include <stdio.h>
2632                   #include <sys/types.h>],
2633                  [int64 foo = 0;],
2634                  [ac_cv_int64=true],
2635                  [ac_cv_int64=false])])
2636 if test "$ac_cv_int64" = true ; then
2637   AC_DEFINE(HAVE_INT64)
2638   AC_MSG_RESULT(yes)
2639 else
2640   AC_MSG_RESULT(no)
2642 AC_MSG_CHECKING(for uint)
2643 AC_CACHE_VAL(ac_cv_uint,
2644  [AC_TRY_COMPILE([#include <stdio.h>
2645                   #include <sys/types.h>],
2646                  [uint foo = 0;],
2647                  [ac_cv_uint=true],
2648                  [ac_cv_uint=false])])
2649 if test "$ac_cv_uint" = true ; then
2650   AC_DEFINE(HAVE_UINT)
2651   AC_MSG_RESULT(yes)
2652 else
2653   AC_MSG_RESULT(no)
2655 AC_MSG_CHECKING(for uint_t)
2656 AC_CACHE_VAL(ac_cv_uint_t,
2657  [AC_TRY_COMPILE([#include <stdio.h>
2658                   #include <sys/types.h>],
2659                  [uint_t foo = 0;],
2660                  [ac_cv_uint_t=true],
2661                  [ac_cv_uint_t=false])])
2662 if test "$ac_cv_uint_t" = true ; then
2663   AC_DEFINE(HAVE_UINT_T)
2664   AC_MSG_RESULT(yes)
2665 else
2666   AC_MSG_RESULT(no)
2669 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2670 dnl are defined when compiling C++ but not C.  Since the result of this
2671 dnl test is used only in C++, do it in C++.
2672 AC_LANG_CPLUSPLUS
2674 AC_MSG_CHECKING(for uname.domainname)
2675 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2676     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2677         [ struct utsname *res; char *domain;
2678             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2679         [ac_cv_have_uname_domainname_field=true],
2680         [ac_cv_have_uname_domainname_field=false])])
2682 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2683     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2684     AC_MSG_RESULT(yes)
2685 else
2686     AC_MSG_RESULT(no)
2689 AC_MSG_CHECKING(for uname.__domainname)
2690 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2691     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2692         [ struct utsname *res; char *domain;
2693             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2694         [ac_cv_have_uname_us_domainname_field=true],
2695         [ac_cv_have_uname_us_domainname_field=false])])
2697 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2698     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2699     AC_MSG_RESULT(yes)
2700 else
2701     AC_MSG_RESULT(no)
2704 dnl Check whether we can use gcc's c++0x mode
2705 AC_LANG_CPLUSPLUS
2707 if test "$GNU_CXX"; then
2708     _SAVE_CXXFLAGS=$CXXFLAGS
2709     CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2711     AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2712         ac_cv_cxx0x_headers_bug,
2713         [AC_TRY_COMPILE([#include <memory>], [],
2714                         ac_cv_cxx0x_headers_bug="no",
2715                         ac_cv_cxx0x_headers_bug="yes")])
2716     CXXFLAGS="$_SAVE_CXXFLAGS"
2717     if test "$ac_cv_cxx0x_headers_bug" = "no"; then
2718         CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2719     fi
2722 dnl Check for usable char16_t (2 bytes, unsigned)
2723 dnl (we might not need the unsignedness check anymore)
2724 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2725     ac_cv_have_usable_char16_t,
2726     [AC_TRY_COMPILE([$configure_static_assert_macros],
2727                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2728                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2729                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2730                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2731                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2732                     ac_cv_have_usable_char16_t="yes",
2733                     ac_cv_have_usable_char16_t="no")])
2734 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2735     AC_DEFINE(HAVE_CPP_CHAR16_T)
2736     HAVE_CPP_CHAR16_T=1
2737 elif test "$GNU_CXX"; then
2738     CXXFLAGS="$_SAVE_CXXFLAGS"
2741 dnl Check for usable wchar_t (2 bytes, unsigned)
2742 dnl (we really don't need the unsignedness check anymore)
2743 dnl ========================================================
2745 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2746     ac_cv_have_usable_wchar_v2,
2747     [AC_TRY_COMPILE([#include <stddef.h>
2748                      $configure_static_assert_macros],
2749                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2750                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2751                     ac_cv_have_usable_wchar_v2="yes",
2752                     ac_cv_have_usable_wchar_v2="no")])
2753 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2754     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2755     HAVE_CPP_2BYTE_WCHAR_T=1
2756 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2757 dnl This is really gcc-only
2758 dnl Do this test using CXX only since some versions of gcc
2759 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2760 dnl only have short-wchar support for c++.
2761 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2763     _SAVE_CXXFLAGS=$CXXFLAGS
2764     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2766     AC_CACHE_CHECK(for compiler -fshort-wchar option,
2767         ac_cv_have_usable_wchar_option_v2,
2768         [AC_TRY_LINK([#include <stddef.h>
2769                       $configure_static_assert_macros],
2770                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2771                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2772                      ac_cv_have_usable_wchar_option_v2="yes",
2773                      ac_cv_have_usable_wchar_option_v2="no")])
2775     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2776         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2777         HAVE_CPP_2BYTE_WCHAR_T=1
2778         if test "$OS_TARGET" = Android; then
2779             WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
2780             CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
2781             CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
2782             DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
2783         else
2784             WCHAR_CFLAGS="-fshort-wchar"
2785         fi
2786     else
2787         CXXFLAGS=$_SAVE_CXXFLAGS
2788     fi
2791 AC_LANG_C
2793 dnl Check for .hidden assembler directive and visibility attribute.
2794 dnl Borrowed from glibc configure.in
2795 dnl ===============================================================
2796 if test "$GNU_CC"; then
2797   AC_CACHE_CHECK(for visibility(hidden) attribute,
2798                  ac_cv_visibility_hidden,
2799                  [cat > conftest.c <<EOF
2800                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2802                   ac_cv_visibility_hidden=no
2803                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2804                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2805                       ac_cv_visibility_hidden=yes
2806                     fi
2807                   fi
2808                   rm -f conftest.[cs]
2809                  ])
2810   if test "$ac_cv_visibility_hidden" = "yes"; then
2811     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2813     AC_CACHE_CHECK(for visibility(default) attribute,
2814                    ac_cv_visibility_default,
2815                    [cat > conftest.c <<EOF
2816                     int foo __attribute__ ((visibility ("default"))) = 1;
2818                     ac_cv_visibility_default=no
2819                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2820                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2821                         ac_cv_visibility_default=yes
2822                       fi
2823                     fi
2824                     rm -f conftest.[cs]
2825                    ])
2826     if test "$ac_cv_visibility_default" = "yes"; then
2827       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2829       AC_CACHE_CHECK(for visibility pragma support,
2830                      ac_cv_visibility_pragma,
2831                      [cat > conftest.c <<EOF
2832 #pragma GCC visibility push(hidden)
2833                       int foo_hidden = 1;
2834 #pragma GCC visibility push(default)
2835                       int foo_default = 1;
2837                       ac_cv_visibility_pragma=no
2838                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2839                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2840                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2841                             ac_cv_visibility_pragma=yes
2842                           fi
2843                         fi
2844                       fi
2845                       rm -f conftest.[cs]
2846                     ])
2847       if test "$ac_cv_visibility_pragma" = "yes"; then
2848         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2849                        ac_cv_have_visibility_class_bug,
2850                        [cat > conftest.c <<EOF
2851 #pragma GCC visibility push(hidden)
2852 struct __attribute__ ((visibility ("default"))) TestStruct {
2853   static void Init();
2855 __attribute__ ((visibility ("default"))) void TestFunc() {
2856   TestStruct::Init();
2859                        ac_cv_have_visibility_class_bug=no
2860                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2861                          ac_cv_have_visibility_class_bug=yes
2862                        else
2863                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2864                            ac_cv_have_visibility_class_bug=yes
2865                          fi
2866                        fi
2867                        rm -rf conftest.{c,S}
2868                        ])
2870         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2871                        ac_cv_have_visibility_builtin_bug,
2872                        [cat > conftest.c <<EOF
2873 #pragma GCC visibility push(hidden)
2874 #pragma GCC visibility push(default)
2875 #include <string.h>
2876 #pragma GCC visibility pop
2878 __attribute__ ((visibility ("default"))) void Func() {
2879   char c[[100]];
2880   memset(c, 0, sizeof(c));
2883                        ac_cv_have_visibility_builtin_bug=no
2884                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2885                          ac_cv_have_visibility_builtin_bug=yes
2886                        else
2887                          if test `grep -c "@PLT" conftest.S` = 0; then
2888                            ac_cv_visibility_builtin_bug=yes
2889                          fi
2890                        fi
2891                        rm -f conftest.{c,S}
2892                        ])
2893         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2894                 "$ac_cv_have_visibility_class_bug" = "no"; then
2895           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2896           WRAP_SYSTEM_INCLUDES=1
2897           STL_FLAGS='-I$(DIST)/stl_wrappers'
2898           WRAP_STL_INCLUDES=1
2899         else
2900           VISIBILITY_FLAGS='-fvisibility=hidden'
2901         fi # have visibility pragma bug
2902       fi   # have visibility pragma
2903     fi     # have visibility(default) attribute
2904   fi       # have visibility(hidden) attribute
2905 fi         # GNU_CC
2907 # visibility hidden flag for Sun Studio on Solaris
2908 if test "$SOLARIS_SUNPRO_CC"; then
2909 VISIBILITY_FLAGS='-xldscope=hidden'
2910 fi         # Sun Studio on Solaris
2912 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2913 AC_SUBST(VISIBILITY_FLAGS)
2915 MOZ_GCC_PR49911
2916 MOZ_GCC_PR39608
2917 MOZ_LLVM_PR8927
2919 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2920 dnl ========================================================
2921 if test "$GNU_CC"; then
2922   CFLAGS_save="${CFLAGS}"
2923   CFLAGS="${CFLAGS} -Werror"
2924   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2925                  ac_cv_force_align_arg_pointer,
2926                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2927                                  [],
2928                                  ac_cv_force_align_arg_pointer="yes",
2929                                  ac_cv_force_align_arg_pointer="no")])
2930   CFLAGS="${CFLAGS_save}"
2931   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2932     HAVE_GCC_ALIGN_ARG_POINTER=1
2933   else
2934     HAVE_GCC_ALIGN_ARG_POINTER=
2935   fi
2937 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2939 dnl Checks for header files.
2940 dnl ========================================================
2941 AC_HEADER_DIRENT
2942 case "$target_os" in
2943 freebsd*|openbsd*)
2944 # for stuff like -lXshm
2945     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2946     ;;
2947 esac
2948 MOZ_CHECK_COMMON_HEADERS
2950 dnl These are all the places some variant of statfs can be hiding.
2951 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2953 dnl Quota support
2954 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2955 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2957 dnl SCTP support - needs various network include headers
2958 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2960 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2962 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2963 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2964                    ac_cv_sockaddr_in_sin_len,
2965                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2966                                     #include <sys/types.h>
2967                                     #endif
2968                                     #include <netinet/in.h>
2969                                     struct sockaddr_in x;
2970                                     void *foo = (void*) &x.sin_len;],
2971                                    [],
2972                                    [ac_cv_sockaddr_in_sin_len=true],
2973                                    [ac_cv_sockaddr_in_sin_len=false])])
2974 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2975   AC_DEFINE(HAVE_SIN_LEN)
2976 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2977   AC_DEFINE(HAVE_SCONN_LEN)
2980 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2981                ac_cv_sockaddr_in6_sin6_len,
2982                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2983                                 #include <sys/types.h>
2984                                 #endif
2985                                 #include <netinet/in.h>
2986                                 struct sockaddr_in6 x;
2987                                 void *foo = (void*) &x.sin6_len;],
2988                                [],
2989                                [ac_cv_sockaddr_in6_sin6_len=true],
2990                                [ac_cv_sockaddr_in6_sin6_len=false])])
2991 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2992   AC_DEFINE(HAVE_SIN6_LEN)
2995 AC_CACHE_CHECK(for sockaddr.sa_len,
2996                ac_cv_sockaddr_sa_len,
2997                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2998                                 #include <sys/types.h>
2999                                 #endif
3000                                 #include <sys/socket.h>
3001                                 struct sockaddr x;
3002                                 void *foo = (void*) &x.sa_len;],
3003                                [],
3004                                [ac_cv_sockaddr_sa_len=true],
3005                                [ac_cv_sockaddr_sa_len=false])])
3006 if test "$ac_cv_sockaddr_sa_len" = true ; then
3007   AC_DEFINE(HAVE_SA_LEN)
3010 dnl Check whether the compiler supports the new-style C++ standard
3011 dnl library headers (i.e. <new>) or needs the old "new.h"
3012 AC_LANG_CPLUSPLUS
3013 NEW_H=new.h
3014 MOZ_CHECK_HEADER(new, [NEW_H=new])
3015 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3016 AC_LANG_C
3018 AC_ARG_ENABLE(dtrace,
3019               [  --enable-dtrace         build with dtrace support if available (default=no)],
3020               [enable_dtrace="yes"],)
3021 if test "x$enable_dtrace" = "xyes"; then
3022   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3023   if test -n "$HAVE_DTRACE"; then
3024       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3025   else
3026       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3027   fi
3029 AC_SUBST(HAVE_DTRACE)
3031 case $target in
3032 *-aix4.3*|*-aix5*)
3033         ;;
3035         MOZ_CHECK_HEADERS(sys/cdefs.h)
3036         ;;
3037 esac
3039 MOZ_LINUX_PERF_EVENT
3041 dnl Checks for libraries.
3042 dnl ========================================================
3043 case $target in
3044 *-hpux11.*)
3045         ;;
3047         AC_CHECK_LIB(c_r, gethostbyname_r)
3048         ;;
3049 esac
3051 dnl We don't want to link with libdl even if it's present on OS X, since
3052 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3053 dnl in libc.
3054 dnl We don't want to link against libm or libpthread on Darwin since
3055 dnl they both are just symlinks to libSystem and explicitly linking
3056 dnl against libSystem causes issues when debugging (see bug 299601).
3057 case $target in
3058 *-darwin*)
3059     ;;
3060 *-os2*)
3061     ;;
3063     AC_SEARCH_LIBS(dlopen, dl,
3064         MOZ_CHECK_HEADER(dlfcn.h,
3065         AC_DEFINE(HAVE_DLOPEN)))
3066     ;;
3067 esac
3069 _SAVE_CFLAGS="$CFLAGS"
3070 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3071 AC_CHECK_FUNCS(dladdr memmem)
3072 CFLAGS="$_SAVE_CFLAGS"
3074 if test ! "$GNU_CXX"; then
3076     case $target in
3077     *-aix*)
3078         AC_CHECK_LIB(C_r, demangle)
3079         ;;
3080      *)
3081         AC_CHECK_LIB(C, demangle)
3082         ;;
3083      esac
3086 dnl OS/2 has socket in libc.
3087 case $target in
3088 *-os2*)
3089     ;;
3091     AC_CHECK_LIB(socket, socket)
3092 esac
3094 XLDFLAGS="$X_LIBS"
3095 XLIBS="$X_EXTRA_LIBS"
3097 dnl ========================================================
3098 dnl Checks for X libraries.
3099 dnl Ordering is important.
3100 dnl Xt is dependent upon SM as of X11R6
3101 dnl ========================================================
3102 if test "$no_x" = "yes"; then
3103     AC_DEFINE(NO_X11)
3104 else
3105     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3106         XLIBS="-lX11 $XLIBS"
3107         _SAVE_LDFLAGS="$LDFLAGS"
3108         LDFLAGS="$XLDFLAGS $LDFLAGS"
3109         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3110                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3111         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3112                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3114         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3115         unset ac_cv_lib_Xt_XtFree
3116             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3117             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3118         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3119                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3120         ])
3122     # AIX needs the motif library linked before libXt to prevent
3123     # crashes in plugins linked against Motif - Bug #98892
3124     case "${target_os}" in
3125     aix*)
3126         XT_LIBS="-lXm $XT_LIBS"
3127         ;;
3128     esac
3130     dnl ========================================================
3131     dnl = Check for XShm
3132     dnl ========================================================
3133     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3134         $XLIBS $XEXT_LIBS)
3136     dnl ========================================================
3137     dnl = Check for Xss
3138     dnl ========================================================
3139     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3140         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3141             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3142              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3144         LDFLAGS="$_SAVE_LDFLAGS"
3145 fi # $no_x
3147 AC_SUBST(XCFLAGS)
3148 AC_SUBST(XLDFLAGS)
3149 AC_SUBST(XLIBS)
3150 AC_SUBST(XEXT_LIBS)
3151 AC_SUBST(XT_LIBS)
3152 AC_SUBST(XSS_LIBS)
3154 dnl ========================================================
3155 dnl = pthread support
3156 dnl = Start by checking whether the system support pthreads
3157 dnl ========================================================
3158 case "$target_os" in
3159 darwin*)
3160     USE_PTHREADS=1
3161     ;;
3163     MOZ_CHECK_PTHREADS(pthreads,
3164         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3165         MOZ_CHECK_PTHREADS(pthread,
3166             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3167             MOZ_CHECK_PTHREADS(c_r,
3168                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3169                 MOZ_CHECK_PTHREADS(c,
3170                     USE_PTHREADS=1
3171                 )
3172             )
3173         )
3174     )
3175     ;;
3176 esac
3178 dnl ========================================================
3179 dnl Check the command line for --with-pthreads
3180 dnl ========================================================
3181 MOZ_ARG_WITH_BOOL(pthreads,
3182 [  --with-pthreads         Force use of system pthread library with NSPR ],
3183 [ if test "$USE_PTHREADS"x = x; then
3184     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3185 fi],
3186     USE_PTHREADS=
3187     _PTHREAD_LDFLAGS=
3190 dnl ========================================================
3191 dnl Do the platform specific pthread hackery
3192 dnl ========================================================
3193 if test "$USE_PTHREADS"x != x
3194 then
3195         dnl
3196         dnl See if -pthread is supported.
3197         dnl
3198         rm -f conftest*
3199         ac_cv_have_dash_pthread=no
3200         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3201         echo 'int main() { return 0; }' | cat > conftest.c
3202         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3203         if test $? -eq 0; then
3204                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3205                         ac_cv_have_dash_pthread=yes
3206                 case "$target_os" in
3207                 freebsd*)
3208 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3209                 ;;
3210                 *)
3211                             CFLAGS="$CFLAGS -pthread"
3212                             CXXFLAGS="$CXXFLAGS -pthread"
3213                 ;;
3214                 esac
3215                 fi
3216         fi
3217         rm -f conftest*
3218     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3220         dnl
3221         dnl See if -pthreads is supported.
3222         dnl
3223     ac_cv_have_dash_pthreads=no
3224     if test "$ac_cv_have_dash_pthread" = "no"; then
3225             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3226         echo 'int main() { return 0; }' | cat > conftest.c
3227             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3228         if test $? -eq 0; then
3229                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3230                             ac_cv_have_dash_pthreads=yes
3231                             CFLAGS="$CFLAGS -pthreads"
3232                             CXXFLAGS="$CXXFLAGS -pthreads"
3233                     fi
3234             fi
3235             rm -f conftest*
3236         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3237     fi
3239         case "$target" in
3240             *-*-freebsd*)
3241                         AC_DEFINE(_REENTRANT)
3242                         AC_DEFINE(_THREAD_SAFE)
3243                         dnl -pthread links in -lpthread, so don't specify it explicitly.
3244                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3245                                 _PTHREAD_LDFLAGS="-pthread"
3246                         fi
3247                         ;;
3249             *-*-openbsd*|*-*-bsdi*)
3250                         AC_DEFINE(_REENTRANT)
3251                         AC_DEFINE(_THREAD_SAFE)
3252                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3253                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3254                 _PTHREAD_LDFLAGS="-pthread"
3255                         fi
3256                         ;;
3258             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3259                         AC_DEFINE(_REENTRANT)
3260                         ;;
3262             *-aix4.3*|*-aix5*)
3263                         AC_DEFINE(_REENTRANT)
3264                         ;;
3266             *-hpux11.*)
3267                         AC_DEFINE(_REENTRANT)
3268                         ;;
3270             *-*-solaris*)
3271                         AC_DEFINE(_REENTRANT)
3272                         if test "$SOLARIS_SUNPRO_CC"; then
3273                                 CFLAGS="$CFLAGS -mt"
3274                                 CXXFLAGS="$CXXFLAGS -mt"
3275                         fi
3276                         ;;
3277         esac
3278     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3282 dnl Checks for library functions.
3283 dnl ========================================================
3284 AC_PROG_GCC_TRADITIONAL
3285 AC_FUNC_MEMCMP
3286 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf memmove rint stat64 lstat64 truncate64 setbuf isatty)
3287 AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
3288 AC_CHECK_FUNCS(flockfile getpagesize)
3289 AC_CHECK_FUNCS(localtime_r strtok_r)
3291 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3292 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3293                ac_cv_clock_monotonic,
3294                [for libs in "" -lrt; do
3295                     _SAVE_LIBS="$LIBS"
3296                     LIBS="$LIBS $libs"
3297                     AC_TRY_LINK([#include <time.h>],
3298                                  [ struct timespec ts;
3299                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
3300                                  ac_cv_clock_monotonic=$libs
3301                                  LIBS="$_SAVE_LIBS"
3302                                  break,
3303                                  ac_cv_clock_monotonic=no)
3304                     LIBS="$_SAVE_LIBS"
3305                 done])
3306 if test "$ac_cv_clock_monotonic" != "no"; then
3307     HAVE_CLOCK_MONOTONIC=1
3308     REALTIME_LIBS=$ac_cv_clock_monotonic
3309     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3310     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3311     AC_SUBST(REALTIME_LIBS)
3314 dnl check for wcrtomb/mbrtowc
3315 dnl =======================================================================
3316 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3317 AC_LANG_SAVE
3318 AC_LANG_CPLUSPLUS
3319 AC_CACHE_CHECK(for wcrtomb,
3320     ac_cv_have_wcrtomb,
3321     [AC_TRY_LINK([#include <wchar.h>],
3322                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3323                  ac_cv_have_wcrtomb="yes",
3324                  ac_cv_have_wcrtomb="no")])
3325 if test "$ac_cv_have_wcrtomb" = "yes"; then
3326     AC_DEFINE(HAVE_WCRTOMB)
3328 AC_CACHE_CHECK(for mbrtowc,
3329     ac_cv_have_mbrtowc,
3330     [AC_TRY_LINK([#include <wchar.h>],
3331                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3332                  ac_cv_have_mbrtowc="yes",
3333                  ac_cv_have_mbrtowc="no")])
3334 if test "$ac_cv_have_mbrtowc" = "yes"; then
3335     AC_DEFINE(HAVE_MBRTOWC)
3337 AC_LANG_RESTORE
3340 AC_CACHE_CHECK(
3341     [for res_ninit()],
3342     ac_cv_func_res_ninit,
3343     [AC_TRY_LINK([
3344         #ifdef linux
3345         #define _BSD_SOURCE 1
3346         #endif
3347         #include <resolv.h>
3348         ],
3349         [int foo = res_ninit(&_res);],
3350         [ac_cv_func_res_ninit=yes],
3351         [ac_cv_func_res_ninit=no])
3352     ])
3354 if test "$ac_cv_func_res_ninit" = "yes"; then
3355     AC_DEFINE(HAVE_RES_NINIT)
3356 dnl must add the link line we do something as foolish as this... dougt
3357 dnl else
3358 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3359 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3362 AC_LANG_CPLUSPLUS
3363 AC_CACHE_CHECK(
3364     [for gnu_get_libc_version()],
3365     ac_cv_func_gnu_get_libc_version,
3366     [AC_TRY_LINK([
3367         #ifdef HAVE_GNU_LIBC_VERSION_H
3368         #include <gnu/libc-version.h>
3369         #endif
3370         ],
3371         [const char *glibc_version = gnu_get_libc_version();],
3372         [ac_cv_func_gnu_get_libc_version=yes],
3373         [ac_cv_func_gnu_get_libc_version=no]
3374         )]
3375     )
3377 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3378     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3381 case $target_os in
3382     darwin*|mingw*|os2*)
3383         ;;
3384     *)
3386 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3387     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3388         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3389 _SAVE_LIBS=$LIBS
3390 LIBS="$LIBS $_ICONV_LIBS"
3391 AC_CACHE_CHECK(
3392     [for iconv()],
3393     ac_cv_func_iconv,
3394     [AC_TRY_LINK([
3395         #include <stdlib.h>
3396         #include <iconv.h>
3397         ],
3398         [
3399             iconv_t h = iconv_open("", "");
3400             iconv(h, NULL, NULL, NULL, NULL);
3401             iconv_close(h);
3402         ],
3403         [ac_cv_func_iconv=yes],
3404         [ac_cv_func_iconv=no]
3405         )]
3406     )
3407 if test "$ac_cv_func_iconv" = "yes"; then
3408     AC_DEFINE(HAVE_ICONV)
3409     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3410     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3411     LIBICONV="$_ICONV_LIBS"
3412     AC_CACHE_CHECK(
3413         [for iconv() with const input],
3414         ac_cv_func_const_iconv,
3415         [AC_TRY_COMPILE([
3416             #include <stdlib.h>
3417             #include <iconv.h>
3418             ],
3419             [
3420                 const char *input = "testing";
3421                 iconv_t h = iconv_open("", "");
3422                 iconv(h, &input, NULL, NULL, NULL);
3423                 iconv_close(h);
3424             ],
3425             [ac_cv_func_const_iconv=yes],
3426             [ac_cv_func_const_iconv=no]
3427             )]
3428         )
3429     if test "$ac_cv_func_const_iconv" = "yes"; then
3430         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3431     fi
3433 LIBS=$_SAVE_LIBS
3435     ;;
3436 esac
3438 AM_LANGINFO_CODESET
3440 AC_LANG_C
3442 dnl **********************
3443 dnl *** va_copy checks ***
3444 dnl **********************
3445 dnl we currently check for all three va_copy possibilities, so we get
3446 dnl all results in config.log for bug reports.
3447 AC_MSG_CHECKING(for an implementation of va_copy())
3448 AC_CACHE_VAL(ac_cv_va_copy,[
3449     AC_TRY_RUN([
3450         #include <stdarg.h>
3451         void f (int i, ...) {
3452             va_list args1, args2;
3453             va_start (args1, i);
3454             va_copy (args2, args1);
3455             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3456                 exit (1);
3457             va_end (args1); va_end (args2);
3458         }
3459         int main() { f (0, 42); return 0; }],
3460         ac_cv_va_copy=yes,
3461         ac_cv_va_copy=no,
3462         ac_cv_va_copy=no
3463     )
3465 AC_MSG_RESULT($ac_cv_va_copy)
3466 AC_MSG_CHECKING(for an implementation of __va_copy())
3467 AC_CACHE_VAL(ac_cv___va_copy,[
3468     AC_TRY_RUN([
3469         #include <stdarg.h>
3470         void f (int i, ...) {
3471             va_list args1, args2;
3472             va_start (args1, i);
3473             __va_copy (args2, args1);
3474             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3475                 exit (1);
3476             va_end (args1); va_end (args2);
3477         }
3478         int main() { f (0, 42); return 0; }],
3479         ac_cv___va_copy=yes,
3480         ac_cv___va_copy=no,
3481         ac_cv___va_copy=no
3482     )
3484 AC_MSG_RESULT($ac_cv___va_copy)
3485 AC_MSG_CHECKING(whether va_lists can be copied by value)
3486 AC_CACHE_VAL(ac_cv_va_val_copy,[
3487     AC_TRY_RUN([
3488         #include <stdarg.h>
3489         void f (int i, ...) {
3490             va_list args1, args2;
3491             va_start (args1, i);
3492             args2 = args1;
3493             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3494                 exit (1);
3495             va_end (args1); va_end (args2);
3496         }
3497         int main() { f (0, 42); return 0; }],
3498         ac_cv_va_val_copy=yes,
3499         ac_cv_va_val_copy=no,
3500         ac_cv_va_val_copy=yes
3501     )
3503 if test "x$ac_cv_va_copy" = "xyes"; then
3504     AC_DEFINE(VA_COPY, va_copy)
3505     AC_DEFINE(HAVE_VA_COPY)
3506 elif test "x$ac_cv___va_copy" = "xyes"; then
3507     AC_DEFINE(VA_COPY, __va_copy)
3508     AC_DEFINE(HAVE_VA_COPY)
3511 if test "x$ac_cv_va_val_copy" = "xno"; then
3512    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3514 AC_MSG_RESULT($ac_cv_va_val_copy)
3516 dnl ===================================================================
3517 dnl ========================================================
3518 dnl Put your C++ language/feature checks below
3519 dnl ========================================================
3520 AC_LANG_CPLUSPLUS
3522 ARM_ABI_PREFIX=
3523 if test "$GNU_CC"; then
3524   if test "$CPU_ARCH" = "arm" ; then
3525     AC_CACHE_CHECK(for ARM EABI,
3526         ac_cv_gcc_arm_eabi,
3527         [AC_TRY_COMPILE([],
3528                         [
3529 #if defined(__ARM_EABI__)
3530   return 0;
3531 #else
3532 #error Not ARM EABI.
3533 #endif
3534                         ],
3535                         ac_cv_gcc_arm_eabi="yes",
3536                         ac_cv_gcc_arm_eabi="no")])
3537     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3538         HAVE_ARM_EABI=1
3539         ARM_ABI_PREFIX=eabi-
3540     else
3541         ARM_ABI_PREFIX=oabi-
3542     fi
3543   fi
3545   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3548 dnl Check for support of modern template specialization syntax
3549 dnl Test code and requirement from scc@netscape.com.
3550 dnl Autoconf cut-and-paste job by waterson@netscape.com
3551 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3552                ac_cv_cpp_modern_specialize_template_syntax,
3553                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3554                                class Y {};
3555                                template <> struct X<Y> { double a; };,
3556                                X<int> int_x;
3557                                X<Y> y_x;,
3558                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3559                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3560 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
3561   AC_MSG_ERROR([The C++ compiler does not support template specialization])
3564 dnl Some compilers support only full specialization, and some don't.
3565 AC_CACHE_CHECK(whether partial template specialization works,
3566                ac_cv_cpp_partial_specialization,
3567                [AC_TRY_COMPILE(template <class T> class Foo {};
3568                                template <class T> class Foo<T*> {};,
3569                                return 0;,
3570                                ac_cv_cpp_partial_specialization=yes,
3571                                ac_cv_cpp_partial_specialization=no)])
3572 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3573   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3576 dnl Check to see if we can resolve ambiguity with |using|.
3577 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3578                ac_cv_cpp_ambiguity_resolving_using,
3579                [AC_TRY_COMPILE(class X {
3580                                  public: int go(const X&) {return 3;}
3581                                          int jo(const X&) {return 3;}
3582                                };
3583                                class Y : public X {
3584                                  public:  int go(int) {return 2;}
3585                                           int jo(int) {return 2;}
3586                                           using X::jo;
3587                                  private: using X::go;
3588                                };,
3589                                X x; Y y; y.jo(x);,
3590                                ac_cv_cpp_ambiguity_resolving_using=yes,
3591                                ac_cv_cpp_ambiguity_resolving_using=no)])
3592 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3593    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3596 dnl See if a dynamic_cast to void* gives the most derived object.
3597 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3598                ac_cv_cpp_dynamic_cast_void_ptr,
3599                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3600                             class Y { int j; public: virtual ~Y() { } };
3601                             class Z : public X, public Y { int k; };
3603                             int main() {
3604                                  Z mdo;
3605                                  X *subx = (X*)&mdo;
3606                                  Y *suby = (Y*)&mdo;
3607                                  return !((((void*)&mdo != (void*)subx) &&
3608                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3609                                           (((void*)&mdo != (void*)suby) &&
3610                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3611                             }],
3612                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3613                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3614                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3615 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3616    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3620 dnl note that this one is reversed - if the test fails, then
3621 dnl we require implementations of unused virtual methods. Which
3622 dnl really blows because it means we'll have useless vtable
3623 dnl bloat.
3624 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3625                ac_cv_cpp_unused_required,
3626                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3627                                X x;,
3628                                ac_cv_cpp_unused_required=no,
3629                                ac_cv_cpp_unused_required=yes)])
3630 if test "$ac_cv_cpp_unused_required" = yes ; then
3631    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3635 dnl Some compilers have trouble comparing a constant reference to a templatized
3636 dnl class to zero, and require an explicit operator==() to be defined that takes
3637 dnl an int. This test separates the strong from the weak.
3639 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3640                ac_cv_trouble_comparing_to_zero,
3641                [AC_TRY_COMPILE([#include <algorithm>
3642                                 template <class T> class Foo {};
3643                                 class T2;
3644                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3645                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3646                                [Foo<int> f; return (0 != f);],
3647                                ac_cv_trouble_comparing_to_zero=no,
3648                                ac_cv_trouble_comparing_to_zero=yes)])
3649 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3650   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3653 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3654 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3655 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3656 # linking XUL.
3657 _SAVE_LDFLAGS=$LDFLAGS
3658 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3659 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3660                ac_cv_thread_keyword,
3661                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3662                             [return tlsIsMainThread;],
3663                             ac_cv_thread_keyword=yes,
3664                             ac_cv_thread_keyword=no)])
3665 LDFLAGS=$_SAVE_LDFLAGS
3666 # The custom dynamic linker doesn't support TLS variables
3667 MOZ_TLS=
3668 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3669   # mips builds fail with TLS variables because of a binutils bug.
3670   # See bug 528687
3671   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3672   case "${target}" in
3673     mips*-*)
3674       :
3675       ;;
3676     *-android*|*-linuxandroid*)
3677       :
3678       ;;
3679     *-openbsd*)
3680       :
3681       ;;
3682     *)
3683       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3684       MOZ_TLS=1
3685       ;;
3686   esac
3689 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3690 if test -n "$MOZ_LINKER"; then
3691   if test "$CPU_ARCH" = arm; then
3692     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3693     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3694       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3695       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3696     fi
3697   fi
3700 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3701 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3702 dnl We however want to avoid these text relocations, and this can be done
3703 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3704 dnl doesn't contain anything at all, beside placeholders for some sections,
3705 dnl and crtbegin only contains a finalizer function that calls
3706 dnl __cxa_finalize. The custom linker actually takes care of calling
3707 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3708 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3709 dnl link crtbegin and crtend at all.
3710 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3711   AC_CACHE_CHECK([whether the CRT objects have text relocations],
3712     ac_cv_crt_has_text_relocations,
3713     [echo 'int foo() { return 0; }' > conftest.cpp
3714      if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3715         test -s conftest${DLL_SUFFIX}; then
3716        if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3717          ac_cv_crt_has_text_relocations=yes
3718        else
3719          ac_cv_crt_has_text_relocations=no
3720        fi
3721      else
3722        AC_ERROR([couldn't compile a simple C file])
3723      fi
3724      rm -rf conftest*])
3725   if test "$ac_cv_crt_has_text_relocations" = yes; then
3726     dnl While we want libraries to skip the CRT files, we don't want
3727     dnl executables to be treated the same way. We thus set the flag
3728     dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3729     dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3730     dnl Using LDFLAGS in nspr is safe, since we only really build
3731     dnl libraries there.
3732     DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3733     NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3734   fi
3737 dnl Check for the existence of various allocation headers/functions
3739 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3740 MALLOC_H=
3742 for file in $MALLOC_HEADERS; do
3743   MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3744   if test "$MALLOC_H" != ""; then
3745     AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3746     break
3747   fi
3748 done
3750 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3751 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3753 AC_CHECK_FUNCS(malloc_usable_size)
3755 dnl See if compiler supports some gcc-style attributes
3757 AC_CACHE_CHECK(for __attribute__((always_inline)),
3758                ac_cv_attribute_always_inline,
3759                [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3760                                [],
3761                                ac_cv_attribute_always_inline=yes,
3762                                ac_cv_attribute_always_inline=no)])
3764 AC_CACHE_CHECK(for __attribute__((malloc)),
3765                ac_cv_attribute_malloc,
3766                [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3767                                [],
3768                                ac_cv_attribute_malloc=yes,
3769                                ac_cv_attribute_malloc=no)])
3771 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3772                ac_cv_attribute_warn_unused,
3773                [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3774                                [],
3775                                ac_cv_attribute_warn_unused=yes,
3776                                ac_cv_attribute_warn_unused=no)])
3778 dnl End of C++ language/feature checks
3779 AC_LANG_C
3781 dnl ========================================================
3782 dnl =  Internationalization checks
3783 dnl ========================================================
3785 dnl Internationalization and Locale support is different
3786 dnl on various UNIX platforms.  Checks for specific i18n
3787 dnl features go here.
3789 dnl check for LC_MESSAGES
3790 AC_CACHE_CHECK(for LC_MESSAGES,
3791                 ac_cv_i18n_lc_messages,
3792                 [AC_TRY_COMPILE([#include <locale.h>],
3793                                 [int category = LC_MESSAGES;],
3794                                 ac_cv_i18n_lc_messages=yes,
3795                                 ac_cv_i18n_lc_messages=no)])
3796 if test "$ac_cv_i18n_lc_messages" = yes; then
3797    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3800 AC_HAVE_FUNCS(localeconv)
3801 fi # ! SKIP_COMPILER_CHECKS
3803 TARGET_XPCOM_ABI=
3804 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3805     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3808 dnl Mozilla specific options
3809 dnl ========================================================
3810 dnl The macros used for command line options
3811 dnl are defined in build/autoconf/altoptions.m4.
3813 dnl If the compiler supports these attributes, define them as
3814 dnl convenience macros.
3815 if test "$ac_cv_attribute_malloc" = yes ; then
3816   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3817 else
3818   AC_DEFINE(NS_ATTR_MALLOC,)
3821 if test "$ac_cv_attribute_warn_unused" = yes ; then
3822   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3823 else
3824   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3827 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3828 dnl features that Windows actually does support.
3830 if test -n "$SKIP_COMPILER_CHECKS"; then
3831    dnl Windows has malloc.h
3832    AC_DEFINE(MALLOC_H, [<malloc.h>])
3833    AC_DEFINE(HAVE_FORCEINLINE)
3834    AC_DEFINE(HAVE_LOCALECONV)
3835 fi # SKIP_COMPILER_CHECKS
3837 dnl ========================================================
3838 dnl =
3839 dnl = Check for external package dependencies
3840 dnl =
3841 dnl ========================================================
3842 MOZ_ARG_HEADER(External Packages)
3844 MOZ_ARG_WITH_STRING(libxul-sdk,
3845 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
3846   LIBXUL_SDK_DIR=$withval)
3848 if test "$LIBXUL_SDK_DIR" = "yes"; then
3849     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3850 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3851     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3853     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3854         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3855     fi
3858 AC_SUBST(LIBXUL_SDK)
3860 if test -n "$LIBXUL_SDK"; then
3861     LIBXUL_DIST="$LIBXUL_SDK"
3862 else
3863     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3865 AC_SUBST(LIBXUL_DIST)
3867 SYSTEM_LIBXUL=
3869 MOZ_ARG_WITH_BOOL(system-libxul,
3870 [  --with-system-libxul    Use system installed libxul SDK],
3871     SYSTEM_LIBXUL=1)
3873 dnl ========================================================
3874 dnl = If NSPR was not detected in the system,
3875 dnl = use the one in the source tree (mozilla/nsprpub)
3876 dnl ========================================================
3877 MOZ_ARG_WITH_BOOL(system-nspr,
3878 [  --with-system-nspr      Use system installed NSPR],
3879     _USE_SYSTEM_NSPR=1 )
3881 if test -n "$_USE_SYSTEM_NSPR"; then
3882     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])])
3885 if test -n "$MOZ_NATIVE_NSPR"; then
3886     _SAVE_CFLAGS=$CFLAGS
3887     CFLAGS="$CFLAGS $NSPR_CFLAGS"
3888     AC_TRY_COMPILE([#include "prtypes.h"],
3889                 [#ifndef PR_STATIC_ASSERT
3890                  #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3891                  #endif],
3892                 [MOZ_NATIVE_NSPR=1],
3893                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3894     AC_TRY_COMPILE([#include "prtypes.h"],
3895                 [#ifndef PR_UINT64
3896                  #error PR_UINT64 not defined or requires including prtypes.h
3897                  #endif],
3898                 [MOZ_NATIVE_NSPR=1],
3899                 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3900     CFLAGS=$_SAVE_CFLAGS
3901 else
3902     if test -z "$LIBXUL_SDK"; then
3903         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3904         if test -n "$GNU_CC"; then
3905             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3906         else
3907             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3908         fi
3909     else
3910         NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3911         NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3912     fi
3915 dnl set GRE_MILESTONE
3916 dnl ========================================================
3917 if test -n "$LIBXUL_SDK"; then
3918     GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3919 else
3920     GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3922 AC_SUBST(GRE_MILESTONE)
3924 dnl system libevent Support
3925 dnl ========================================================
3926 MOZ_ARG_WITH_STRING(system-libevent,
3927 [  --with-system-libevent[=PFX]
3928                           Use system libevent [installed at prefix PFX]],
3929     LIBEVENT_DIR=$withval)
3931 _SAVE_CFLAGS=$CFLAGS
3932 _SAVE_LDFLAGS=$LDFLAGS
3933 _SAVE_LIBS=$LIBS
3934 if test "$LIBEVENT_DIR" = yes; then
3935     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3936         MOZ_NATIVE_LIBEVENT=1,
3937         LIBEVENT_DIR=/usr)
3939 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3940     MOZ_NATIVE_LIBEVENT=
3941 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3942     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3943     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3944     MOZ_CHECK_HEADER(event.h,
3945         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3946              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3947          fi],
3948         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3949     AC_CHECK_LIB(event, event_init,
3950                  [MOZ_NATIVE_LIBEVENT=1
3951                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3952                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3953                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3955 CFLAGS=$_SAVE_CFLAGS
3956 LDFLAGS=$_SAVE_LDFLAGS
3957 LIBS=$_SAVE_LIBS
3959 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3960 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
3961 AC_SUBST(MOZ_LIBEVENT_LIBS)
3963 dnl ========================================================
3964 dnl = If NSS was not detected in the system,
3965 dnl = use the one in the source tree (mozilla/security/nss)
3966 dnl ========================================================
3968 MOZ_ARG_WITH_BOOL(system-nss,
3969 [  --with-system-nss       Use system installed NSS],
3970     _USE_SYSTEM_NSS=1 )
3972 if test -n "$_USE_SYSTEM_NSS"; then
3973     AM_PATH_NSS(3.14.3, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3976 if test -n "$MOZ_NATIVE_NSS"; then
3977    NSS_LIBS="$NSS_LIBS -lcrmf"
3978 else
3979    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3980    if test -z "$IMPORT_LIB_SUFFIX"; then
3981        DLL_LINK_SUFFIX='$(DLL_SUFFIX)'
3982    else
3983        DLL_LINK_SUFFIX='.$(IMPORT_LIB_SUFFIX)'
3984    fi
3985    NSS_DEP_LIBS="\
3986         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3987         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION${DLL_LINK_SUFFIX} \
3988         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION${DLL_LINK_SUFFIX} \
3989         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION${DLL_LINK_SUFFIX} \
3990         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION${DLL_LINK_SUFFIX}"
3992    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
3993        NSS_LIBS="\
3994         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3995         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3996         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3997         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3998         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3999    else
4000        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4001    fi
4004 dnl ======================
4005 dnl Detect yasm
4006 dnl ======================
4008 AC_MSG_CHECKING([for YASM assembler])
4009 AC_CHECK_PROGS(YASM, yasm, "")
4011 if test -n "$YASM"; then
4012   dnl Pull out yasm's version string
4013   YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
4014   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4015   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4016   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4017   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4020 if test -z "$SKIP_LIBRARY_CHECKS"; then
4021 dnl system JPEG support
4022 dnl ========================================================
4023 MOZ_ARG_WITH_STRING(system-jpeg,
4024 [  --with-system-jpeg[=PFX]
4025                           Use system libjpeg [installed at prefix PFX]],
4026     JPEG_DIR=$withval)
4028 _SAVE_CFLAGS=$CFLAGS
4029 _SAVE_LDFLAGS=$LDFLAGS
4030 _SAVE_LIBS=$LIBS
4031 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4032     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4033     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4035 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4036     MOZ_NATIVE_JPEG=
4037 else
4038     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
4041 if test "$MOZ_NATIVE_JPEG" = 1; then
4042     AC_TRY_COMPILE([ #include <stdio.h>
4043                      #include <sys/types.h>
4044                      #include <jpeglib.h> ],
4045                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4046                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4047                      #endif
4048                      #ifndef JCS_EXTENSIONS
4049                      #error "libjpeg-turbo JCS_EXTENSIONS required"
4050                      #endif
4051                      ],
4052                    MOZ_NATIVE_JPEG=1,
4053                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
4055 CFLAGS=$_SAVE_CFLAGS
4056 LDFLAGS=$_SAVE_LDFLAGS
4057 LIBS=$_SAVE_LIBS
4059 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
4060     MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
4061     MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
4063 fi # SKIP_LIBRARY_CHECKS
4065 dnl system ZLIB support
4066 dnl ========================================================
4067 MOZ_ZLIB_CHECK([1.2.3])
4069 if test "$MOZ_NATIVE_ZLIB" != 1; then
4070     MOZ_ZLIB_CFLAGS=
4071     MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
4074 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
4075     AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4078 if test -z "$SKIP_LIBRARY_CHECKS"; then
4079 dnl system BZIP2 Support
4080 dnl ========================================================
4081 MOZ_ARG_WITH_STRING(system-bz2,
4082 [  --with-system-bz2[=PFX]
4083                           Use system libbz2 [installed at prefix PFX]],
4084     BZ2_DIR=$withval)
4086 _SAVE_CFLAGS=$CFLAGS
4087 _SAVE_LDFLAGS=$LDFLAGS
4088 _SAVE_LIBS=$LIBS
4089 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4090     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4091     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4093 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4094     MOZ_NATIVE_BZ2=
4095 else
4096     AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
4097         [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
4099 CFLAGS=$_SAVE_CFLAGS
4100 LDFLAGS=$_SAVE_LDFLAGS
4101 LIBS=$_SAVE_LIBS
4103 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
4104     MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
4105     MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4108 dnl system PNG Support
4109 dnl ========================================================
4110 MOZ_ARG_WITH_STRING(system-png,
4111 [  --with-system-png[=PFX]
4112                           Use system libpng [installed at prefix PFX]],
4113     PNG_DIR=$withval)
4115 _SAVE_CFLAGS=$CFLAGS
4116 _SAVE_LDFLAGS=$LDFLAGS
4117 _SAVE_LIBS=$LIBS
4118 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4119     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4120     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4122 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4123     MOZ_NATIVE_PNG=
4124 else
4125     AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
4126                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4127     AC_CHECK_LIB(png, png_get_acTL, ,
4128                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
4130 if test "$MOZ_NATIVE_PNG" = 1; then
4131     AC_TRY_COMPILE([ #include <stdio.h>
4132                      #include <sys/types.h>
4133                      #include <png.h> ],
4134                    [ #if PNG_LIBPNG_VER < $MOZPNG
4135                      #error "Insufficient libpng version ($MOZPNG required)."
4136                      #endif
4137                      #ifndef PNG_UINT_31_MAX
4138                      #error "Insufficient libpng version."
4139                      #endif ],
4140                    MOZ_NATIVE_PNG=1,
4141                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4143 CFLAGS=$_SAVE_CFLAGS
4144 LDFLAGS=$_SAVE_LDFLAGS
4145 LIBS=$_SAVE_LIBS
4147 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
4148     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
4149     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
4152 fi # SKIP_LIBRARY_CHECKS
4154 dnl system HunSpell Support
4155 dnl ========================================================
4156 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4157 [  --enable-system-hunspell
4158                           Use system hunspell (located with pkgconfig)],
4159     MOZ_NATIVE_HUNSPELL=1 )
4161 if test -n "$MOZ_NATIVE_HUNSPELL"; then
4162     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4165 AC_SUBST(MOZ_NATIVE_HUNSPELL)
4167 dnl ========================================================
4168 dnl system libffi Support
4169 dnl ========================================================
4170 MOZ_ARG_ENABLE_BOOL(system-ffi,
4171 [  --enable-system-ffi       Use system libffi (located with pkgconfig)],
4172     MOZ_NATIVE_FFI=1 )
4174 if test -n "$MOZ_NATIVE_FFI"; then
4175     # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4176     # for non-GCC compilers.
4177     if test -z "$GNU_CC"; then
4178         PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4179     else
4180         PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4181     fi
4182     MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4185 dnl ========================================================
4186 dnl Java SDK support
4187 dnl ========================================================
4189 JAVA_BIN_PATH=
4190 MOZ_ARG_WITH_STRING(java-bin-path,
4191 [  --with-java-bin-path=dir
4192                           Location of Java binaries (java, javac, jar)],
4193     JAVA_BIN_PATH=$withval)
4195 dnl ========================================================
4196 dnl =
4197 dnl = Application
4198 dnl =
4199 dnl ========================================================
4201 MOZ_ARG_HEADER(Application)
4203 ENABLE_TESTS=1
4204 ENABLE_SYSTEM_EXTENSION_DIRS=1
4205 MOZ_BRANDING_DIRECTORY=
4206 MOZ_OFFICIAL_BRANDING=
4207 MOZ_FEEDS=1
4208 MOZ_FLEXBOX=1
4209 MOZ_WEBAPP_RUNTIME=
4210 MOZ_JSDEBUGGER=1
4211 MOZ_AUTH_EXTENSION=1
4212 MOZ_OGG=1
4213 MOZ_RAW=
4214 MOZ_SPEEX_RESAMPLER=1
4215 MOZ_SOUNDTOUCH=1
4216 MOZ_CUBEB=
4217 MOZ_VORBIS=
4218 MOZ_TREMOR=
4219 MOZ_WAVE=1
4220 MOZ_SAMPLE_TYPE_FLOAT32=
4221 MOZ_SAMPLE_TYPE_S16=
4222 MOZ_MEDIA=
4223 MOZ_OPUS=1
4224 MOZ_WEBM=1
4225 MOZ_DASH=1
4226 MOZ_WMF=
4227 MOZ_WEBRTC=1
4228 MOZ_PEERCONNECTION=
4229 MOZ_SRTP=
4230 MOZ_WEBRTC_SIGNALING=
4231 MOZ_WEBRTC_IN_LIBXUL=
4232 MOZ_SCTP=
4233 MOZ_MEDIA_PLUGINS=
4234 MOZ_MEDIA_NAVIGATOR=
4235 MOZ_OMX_PLUGIN=
4236 MOZ_VP8=
4237 MOZ_VP8_ERROR_CONCEALMENT=
4238 MOZ_VP8_ENCODER=
4239 MOZ_WEBVTT=1
4240 VPX_AS=
4241 VPX_ASFLAGS=
4242 VPX_AS_DASH_C_FLAG=
4243 VPX_AS_CONVERSION=
4244 VPX_ASM_SUFFIX=
4245 VPX_X86_ASM=
4246 VPX_ARM_ASM=
4247 LIBJPEG_TURBO_AS=
4248 LIBJPEG_TURBO_ASFLAGS=
4249 LIBJPEG_TURBO_X86_ASM=
4250 LIBJPEG_TURBO_X64_ASM=
4251 LIBJPEG_TURBO_ARM_ASM=
4252 MOZ_PANGO=1
4253 MOZ_PERMISSIONS=1
4254 MOZ_PLACES=1
4255 MOZ_PREF_EXTENSIONS=1
4256 MOZ_PROFILELOCKING=1
4257 MOZ_PSM=1
4258 MOZ_REFLOW_PERF=
4259 MOZ_SAFE_BROWSING=
4260 MOZ_HELP_VIEWER=
4261 MOZ_SPELLCHECK=1
4262 MOZ_ANDROID_OMTC=
4263 MOZ_ONLY_TOUCH_EVENTS=
4264 MOZ_TOOLKIT_SEARCH=1
4265 MOZ_UI_LOCALE=en-US
4266 MOZ_UNIVERSALCHARDET=1
4267 MOZ_URL_CLASSIFIER=
4268 MOZ_XUL=1
4269 MOZ_ZIPWRITER=1
4270 NS_PRINTING=1
4271 MOZ_PDF_PRINTING=
4272 MOZ_DISABLE_CRYPTOLEGACY=
4273 NSS_DISABLE_DBM=
4274 NECKO_WIFI=1
4275 NECKO_COOKIES=1
4276 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4277 USE_ARM_KUSER=
4278 BUILD_CTYPES=1
4279 MOZ_USE_NATIVE_POPUP_WINDOWS=
4280 MOZ_ANDROID_HISTORY=
4281 MOZ_WEBSMS_BACKEND=
4282 ACCESSIBILITY=1
4283 MOZ_SYS_MSG=
4284 MOZ_TIME_MANAGER=
4285 MOZ_PAY=
4286 MOZ_AUDIO_CHANNEL_MANAGER=
4288 case "$target_os" in
4289     mingw*)
4290         NS_ENABLE_TSF=1
4291         AC_DEFINE(NS_ENABLE_TSF)
4292         ;;
4293 esac
4295 case "${target}" in
4296     *-android*|*-linuxandroid*)
4297         if test "$CPU_ARCH" = "arm" ; then
4298           USE_ARM_KUSER=1
4299         fi
4301         NSS_DISABLE_DBM=1
4302         if test -z "$gonkdir"; then
4303           NECKO_WIFI=
4304         else
4305           NECKO_WIFI=1
4306         fi
4307         MOZ_THEME_FASTSTRIPE=1
4308         MOZ_TREE_FREETYPE=1
4309         MOZ_MEMORY=1
4310         MOZ_RAW=1
4311         ;;
4313 esac
4315 MOZ_ARG_WITH_STRING(external-source-dir,
4316 [  --with-external-source-dir=dir
4317                           External directory containing additional build files.],
4318 [ EXTERNAL_SOURCE_DIR=$withval])
4319 AC_SUBST(EXTERNAL_SOURCE_DIR)
4321 MOZ_ARG_ENABLE_STRING(application,
4322 [  --enable-application=APP
4323                           Options include:
4324                             browser (Firefox)
4325                             xulrunner
4326                             tools/update-packaging (AUS-related packaging tools)],
4327 [ MOZ_BUILD_APP=$enableval ] )
4329 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4330 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4331   XULRUNNER_STUB_NAME=$withval)
4333 if test -z "$XULRUNNER_STUB_NAME"; then
4334   case "$target_os" in
4335   darwin*)
4336     XULRUNNER_STUB_NAME=xulrunner
4337     ;;
4338   *)
4339     XULRUNNER_STUB_NAME=xulrunner-stub
4340   esac
4342 AC_SUBST(XULRUNNER_STUB_NAME)
4344 AC_MSG_CHECKING([for application to build])
4345 if test -z "$MOZ_BUILD_APP"; then
4346   AC_MSG_RESULT([browser])
4347   MOZ_BUILD_APP=browser
4348 else
4349   # "mobile" no longer exists.
4350   if test "$MOZ_BUILD_APP" = "mobile" ; then
4351     AC_MSG_RESULT([none])
4352     AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
4353   fi
4354   # We have a valid application only if it has a build.mk file in its top
4355   # directory.
4356   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4357     AC_MSG_RESULT([none])
4358     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4359   else
4360     AC_MSG_RESULT([$MOZ_BUILD_APP])
4361   fi
4364 # The app update channel is 'default' when not supplied. The value is used in
4365 # the application's confvars.sh so it must be set before confvars.sh is called.
4366 MOZ_ARG_ENABLE_STRING([update-channel],
4367 [  --enable-update-channel=CHANNEL
4368                           Select application update channel (default=default)],
4369     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4371 if test -z "$MOZ_UPDATE_CHANNEL"; then
4372     MOZ_UPDATE_CHANNEL=default
4374 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4375 AC_SUBST(MOZ_UPDATE_CHANNEL)
4377 # Allow the application to influence configure with a confvars.sh script.
4379 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4380 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4381   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4382   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4383 else
4384   AC_MSG_RESULT([no])
4387 # Allow the application to provide a subconfigure script
4388 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4389   do_output_subdirs() {
4390     if test -n "$_subconfigure_subdirs"; then
4391       AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4392      fi
4393     _subconfigure_subdir="$1"
4394     _subconfigure_config_args="$ac_configure_args"
4395   }
4396   tmpscript=`mktemp -t subscript.XXXXXX` || exit 1
4397   m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4398      "${srcdir}/build/autoconf/altoptions.m4" \
4399      "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4400   . $tmpscript
4401   rm -f $tmpscript
4404 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4405 MOZ_ARG_WITH_STRING(app-name,
4406 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4407 WITH_APP_NAME=$withval,
4410 if test -n "$WITH_APP_NAME" ; then
4411     MOZ_APP_NAME="$WITH_APP_NAME"
4414 MOZ_ARG_WITH_STRING(app-basename,
4415 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4416 WITH_APP_BASENAME=$withval,
4419 if test -n "$WITH_APP_BASENAME" ; then
4420     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4423 # Now is a good time to test for logic errors, define mismatches, etc.
4424 case "$MOZ_BUILD_APP" in
4425 xulrunner)
4426   if test "$LIBXUL_SDK"; then
4427     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4428   fi
4429   ;;
4430 esac
4432 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4433 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4434 # MOZ_BUILD_APP.
4435 case "$MOZ_BUILD_APP" in
4436 browser)
4437   AC_DEFINE(MOZ_PHOENIX)
4438   ;;
4440 xulrunner)
4441   AC_DEFINE(MOZ_XULRUNNER)
4442   ;;
4443 b2g)
4444   AC_DEFINE(MOZ_B2G)
4445   ;;
4446 esac
4448 AC_SUBST(MOZ_BUILD_APP)
4449 AC_SUBST(MOZ_PHOENIX)
4450 AC_SUBST(MOZ_XULRUNNER)
4451 AC_SUBST(MOZ_B2G)
4453 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4455 dnl ========================================================
4456 dnl Check android sdk version depending on mobile target
4457 dnl ========================================================
4459 if test -z "$gonkdir" ; then
4460     # Minimum Android SDK API Level we require.
4461     case "$MOZ_BUILD_APP" in
4462     mobile/android)
4463         android_min_api_level=16
4464         ;;
4465     esac
4467     MOZ_ANDROID_SDK($android_min_api_level)
4470 dnl ========================================================
4471 dnl =
4472 dnl = Toolkit Options
4473 dnl =
4474 dnl ========================================================
4475 MOZ_ARG_HEADER(Toolkit Options)
4477     dnl ========================================================
4478     dnl = Select the default toolkit
4479     dnl ========================================================
4480         MOZ_ARG_ENABLE_STRING(default-toolkit,
4481         [  --enable-default-toolkit=TK
4482                           Select default toolkit
4483                           Platform specific defaults:
4484                             Mac OS X - cairo-cocoa
4485                             OS/2 - cairo-os2
4486                             Win32 - cairo-windows
4487                             * - cairo-gtk2
4488                             * - cairo-qt],
4489     [ _DEFAULT_TOOLKIT=$enableval ],
4490     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4492     if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4493         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4494         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4495         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4496         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4497         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4498         -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4499         -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4500         -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4501     then
4502         dnl nglayout only supports building with one toolkit,
4503         dnl so ignore everything after the first comma (",").
4504         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4505     else
4506         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4507     fi
4509 MOZ_ARG_WITHOUT_BOOL(x,
4510 [  --without-x              Build without X11],
4511     WITHOUT_X11=1)
4513 dnl ========================================================
4514 dnl = Enable the toolkit as needed                         =
4515 dnl ========================================================
4517 MOZ_WIDGET_GTK=
4519 case "$MOZ_WIDGET_TOOLKIT" in
4521 cairo-windows)
4522     MOZ_WIDGET_TOOLKIT=windows
4523     MOZ_WEBGL=1
4524     MOZ_PDF_PRINTING=1
4525     MOZ_INSTRUMENT_EVENT_LOOP=1
4526     ;;
4528 cairo-gtk2|cairo-gtk2-x11)
4529     MOZ_WIDGET_TOOLKIT=gtk2
4530     MOZ_ENABLE_GTK2=1
4531     MOZ_ENABLE_XREMOTE=1
4532     MOZ_WEBGL=1
4533     MOZ_GL_DEFAULT_PROVIDER=GLX
4535     AC_DEFINE(MOZ_X11)
4536     MOZ_X11=1
4537     USE_FC_FREETYPE=1
4539     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4540     TK_LIBS='$(MOZ_GTK2_LIBS)'
4541     AC_DEFINE(MOZ_WIDGET_GTK2)
4542     MOZ_WIDGET_GTK=2
4543     AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4544     MOZ_PDF_PRINTING=1
4545     MOZ_INSTRUMENT_EVENT_LOOP=1
4546     ;;
4548 cairo-qt)
4549     MOZ_WIDGET_TOOLKIT=qt
4550     MOZ_ENABLE_QT=1
4551     if test -z "$WITHOUT_X11"; then
4552       MOZ_ENABLE_XREMOTE=1
4553       MOZ_GL_DEFAULT_PROVIDER=GLX
4554       MOZ_X11=1
4555       AC_DEFINE(MOZ_X11)
4556       XT_LIBS=
4557     fi
4559     MOZ_WEBGL=1
4560     USE_ELF_DYNSTR_GC=
4561     USE_FC_FREETYPE=1
4562     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4563     TK_LIBS='$(MOZ_QT_LIBS)'
4564     AC_DEFINE(MOZ_WIDGET_QT)
4565     MOZ_PDF_PRINTING=1
4566     AC_DEFINE(QT_NO_KEYWORDS)
4567     ;;
4569 cairo-os2)
4570     MOZ_WIDGET_TOOLKIT=os2
4571     USE_FC_FREETYPE=1
4572     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4573     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4574     MOZ_PDF_PRINTING=1
4575     ;;
4577 cairo-cocoa)
4578     MOZ_WIDGET_TOOLKIT=cocoa
4579     AC_DEFINE(MOZ_WIDGET_COCOA)
4580     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4581     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4582     TK_CFLAGS="-DNO_X11"
4583     CFLAGS="$CFLAGS $TK_CFLAGS"
4584     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4585     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4586     MOZ_USER_DIR="Mozilla"
4587     MOZ_FS_LAYOUT=bundle
4588     MOZ_WEBGL=1
4589     MOZ_INSTRUMENT_EVENT_LOOP=1
4590     ;;
4592 cairo-uikit)
4593     MOZ_WIDGET_TOOLKIT=uikit
4594     AC_DEFINE(MOZ_WIDGET_UIKIT)
4595     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4596     TK_CFLAGS="-DNO_X11"
4597     TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4598     CFLAGS="$CFLAGS $TK_CFLAGS"
4599     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4600     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4601     MOZ_USER_DIR="Mozilla"
4602     MOZ_FS_LAYOUT=bundle
4603     ;;
4605 cairo-android)
4606     AC_DEFINE(MOZ_WIDGET_ANDROID)
4607     MOZ_WIDGET_TOOLKIT=android
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_INSTRUMENT_EVENT_LOOP=1
4613     ;;
4615 cairo-gonk)
4616     AC_DEFINE(MOZ_WIDGET_GONK)
4617     AC_DEFINE(MOZ_TOUCH)
4618     MOZ_WIDGET_TOOLKIT=gonk
4619     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4620     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4621     MOZ_WEBGL=1
4622     MOZ_PDF_PRINTING=1
4623     MOZ_TOUCH=1
4624     ;;
4626 esac
4628 AC_SUBST(MOZ_PDF_PRINTING)
4629 if test "$MOZ_PDF_PRINTING"; then
4630    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4631    AC_DEFINE(MOZ_PDF_PRINTING)
4634 if test "$MOZ_ENABLE_XREMOTE"; then
4635     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4638 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4639    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4642 if test "$COMPILE_ENVIRONMENT"; then
4643   if test "$MOZ_ENABLE_GTK2"; then
4644     if test "$MOZ_X11"; then
4645       GDK_PACKAGES=gdk-x11-2.0
4646     fi
4648     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4649   fi
4651 fi # COMPILE_ENVIRONMENT
4653 AC_SUBST(MOZ_FS_LAYOUT)
4655 dnl ========================================================
4656 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4657 dnl their usage and use them in spidermonkey.
4658 dnl ========================================================
4659 MOZ_ARG_WITH_BOOL(arm-kuser,
4660 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4661     USE_ARM_KUSER=1,)
4662 if test -n "$USE_ARM_KUSER"; then
4663    AC_DEFINE(USE_ARM_KUSER)
4666 dnl ========================================================
4667 dnl = startup-notification support module
4668 dnl ========================================================
4670 if test "$MOZ_ENABLE_GTK2"
4671 then
4672     MOZ_ENABLE_STARTUP_NOTIFICATION=
4674     MOZ_ARG_ENABLE_BOOL(startup-notification,
4675     [  --enable-startup-notification
4676                           Enable startup-notification support (default: disabled) ],
4677         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4678         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4679     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4680     then
4681         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4682                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4683         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4684             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4685             then
4686                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4687             fi
4688             MOZ_ENABLE_STARTUP_NOTIFICATION=
4689         ])
4690     fi
4692     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4693         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4694     fi
4696     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4698 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4699 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4700 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4702 dnl ========================================================
4703 dnl = QT support
4704 dnl ========================================================
4705 if test "$MOZ_ENABLE_QT"
4706 then
4707     MOZ_ARG_WITH_STRING(qtdir,
4708     [  --with-qtdir=\$dir       Specify Qt directory ],
4709     [ QTDIR=$withval])
4711     if test -z "$QTDIR"; then
4712         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
4713         PKG_CHECK_MODULES(MOZ_QT5, Qt5Widgets Qt5Multimedia Qt5PrintSupport,
4714                       MOZ_ENABLE_QT5=1,
4715                       MOZ_ENABLE_QT5=)
4716         if test "$MOZ_ENABLE_QT5"; then
4717             echo "Using qt5"
4718             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
4719             MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
4720         fi
4722         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4723         AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4724     else
4725         MOZ_QT_CFLAGS="-DQT_SHARED"
4726         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4727         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4728         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4729         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4730         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4731         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4733         # QtWidgets was introduced only in Qt5
4734         if test -d $QTDIR/include/QtWidgets; then
4735             echo "Using qt5"
4736             MOZ_QT_LIBS="-L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml -lQt5OpenGL"
4737             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/5.0.1/QtGui"
4738             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4739             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4740             MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4741         else
4742             MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4743             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4744         fi
4745         HOST_MOC="$QTDIR/bin/moc"
4746         HOST_RCC="$QTDIR/bin/rcc"
4747     fi
4748     if test -z "$HOST_MOC"; then
4749         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4750 incorrect])
4751     fi
4752     if test -z "$HOST_RCC"; then
4753         AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4754 incorrect])
4755     fi
4757     MOC=$HOST_MOC
4758     RCC=$HOST_RCC
4760     MOZ_ENABLE_QMSYSTEM2=
4761     PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4762                       MOZ_ENABLE_QMSYSTEM2=1,
4763                       MOZ_ENABLE_QMSYSTEM2=)
4765     if test "$MOZ_ENABLE_QMSYSTEM2"; then
4766       MOZ_ENABLE_QMSYSTEM2=1
4767       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4768       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4769       AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4770     fi
4772     MOZ_ENABLE_QTNETWORK=
4773     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4774                       MOZ_ENABLE_QTNETWORK=1,
4775                       MOZ_ENABLE_QTNETWORK=)
4777     if test "$MOZ_ENABLE_QTNETWORK"; then
4778       MOZ_ENABLE_QTNETWORK=1
4779       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4780     fi
4782     MOZ_ENABLE_QTMOBILITY=
4783     PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4784                       MOZ_ENABLE_QTMOBILITY=1,
4785                       MOZ_ENABLE_QTMOBILITY=)
4786     if test "$MOZ_ENABLE_QTMOBILITY"; then
4787        MOZ_ENABLE_QTMOBILITY=1
4788        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4789        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4790     else
4791        AC_CHECK_LIB(QtSensors, main, [
4792           MOZ_ENABLE_QTMOBILITY=1
4793           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4794           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4795           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4796           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4797           MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4798        ])
4799     fi
4800     if test "$MOZ_ENABLE_QTMOBILITY"; then
4801        AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4802     fi
4805 AC_SUBST(GTK_CONFIG)
4806 AC_SUBST(TK_CFLAGS)
4807 AC_SUBST(TK_LIBS)
4809 AC_SUBST(MOZ_ENABLE_GTK2)
4810 AC_SUBST(MOZ_ENABLE_QT)
4811 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4812 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4813 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4814 AC_SUBST(MOZ_ENABLE_XREMOTE)
4815 AC_SUBST(MOZ_GTK2_CFLAGS)
4816 AC_SUBST(MOZ_GTK2_LIBS)
4817 AC_SUBST(MOZ_WIDGET_GTK)
4818 AC_SUBST(MOZ_QT_CFLAGS)
4819 AC_SUBST(MOZ_QT_LIBS)
4821 AC_SUBST(MOC)
4822 AC_SUBST(RCC)
4824 AC_SUBST(MOZ_X11)
4826 dnl ========================================================
4827 dnl =
4828 dnl = Components & Features
4829 dnl =
4830 dnl ========================================================
4831 MOZ_ARG_HEADER(Components and Features)
4833 dnl ========================================================
4834 dnl = Localization
4835 dnl ========================================================
4836 MOZ_ARG_ENABLE_STRING(ui-locale,
4837 [  --enable-ui-locale=ab-CD
4838                           Select the user interface locale (default: en-US)],
4839     MOZ_UI_LOCALE=$enableval )
4840 AC_SUBST(MOZ_UI_LOCALE)
4842 dnl ========================================================
4843 dnl = Trademarked Branding
4844 dnl ========================================================
4845 MOZ_ARG_ENABLE_BOOL(official-branding,
4846 [  --enable-official-branding
4847                           Enable Official mozilla.org Branding
4848                           Do not distribute builds with
4849                           --enable-official-branding unless you have
4850                           permission to use trademarks per
4851                           http://www.mozilla.org/foundation/trademarks/ .],
4853   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4854     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4855   else
4856     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4857     MOZ_OFFICIAL_BRANDING=1
4858   fi
4859 ], MOZ_OFFICIAL_BRANDING=)
4861 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4862 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4863   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4866 MOZ_ARG_WITH_STRING(branding,
4867 [  --with-branding=dir     Use branding from the specified directory.],
4868     MOZ_BRANDING_DIRECTORY=$withval)
4870 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4871 if test -z "$REAL_BRANDING_DIRECTORY"; then
4872   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4875 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4876   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4879 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4881 dnl ========================================================
4882 dnl = Distribution ID
4883 dnl ========================================================
4884 MOZ_ARG_WITH_STRING(distribution-id,
4885 [  --with-distribution-id=ID
4886                           Set distribution-specific id (default=org.mozilla)],
4887 [ val=`echo $withval`
4888     MOZ_DISTRIBUTION_ID="$val"])
4890 if test -z "$MOZ_DISTRIBUTION_ID"; then
4891    MOZ_DISTRIBUTION_ID="org.mozilla"
4894 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4895 AC_SUBST(MOZ_DISTRIBUTION_ID)
4898 dnl ========================================================
4899 dnl complex text support off by default
4900 dnl ========================================================
4901 MOZ_ARG_DISABLE_BOOL(pango,
4902 [  --disable-pango         Disable usage of Pango ],
4903     MOZ_PANGO=,
4904     MOZ_PANGO=1)
4906 dnl ========================================================
4907 dnl = Pango
4908 dnl ========================================================
4909 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4910 then
4911     AC_SUBST(MOZ_PANGO)
4913     if test "$MOZ_PANGO"
4914     then
4915         PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4917         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4918         AC_SUBST(MOZ_PANGO_CFLAGS)
4919         AC_SUBST(MOZ_PANGO_LIBS)
4920         AC_DEFINE(MOZ_PANGO)
4921     else
4922         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
4923         AC_SUBST(FT2_CFLAGS)
4924         AC_SUBST(FT2_LIBS)
4925     fi
4928 dnl ========================================================
4929 dnl = GnomeVFS, GIO and GConf support module
4930 dnl ========================================================
4932 if test "$MOZ_X11"
4933 then
4934     dnl build the GIO extension by default only when the
4935     dnl GTK2 toolkit is in use.
4936     if test "$MOZ_ENABLE_GTK2"
4937     then
4938         MOZ_ENABLE_GIO=1
4939         MOZ_ENABLE_GCONF=1
4940     fi
4942     dnl ========================================================
4943     dnl = GnomeVFS support module
4944     dnl ========================================================
4945     MOZ_ARG_ENABLE_BOOL(gnomevfs,
4946     [  --enable-gnomevfs       Enable GnomeVFS support (default: disabled)],
4947         MOZ_ENABLE_GNOMEVFS=force,
4948         MOZ_ENABLE_GNOMEVFS=)
4950     if test "$MOZ_ENABLE_GNOMEVFS"
4951     then
4952         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4953             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4954             MOZ_ENABLE_GNOMEVFS=1
4955             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4956         ],[
4957             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4958             then
4959                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4960             fi
4961             MOZ_ENABLE_GNOMEVFS=
4962         ])
4963     fi
4965     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4966     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4967     AC_SUBST(MOZ_GNOMEVFS_LIBS)
4969     dnl ========================================================
4970     dnl = GIO support module
4971     dnl ========================================================
4972     MOZ_ARG_DISABLE_BOOL(gio,
4973     [  --disable-gio           Disable GIO support],
4974         MOZ_ENABLE_GIO=,
4975         MOZ_ENABLE_GIO=force)
4977     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
4978     then
4979         PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4980                           [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4981         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4982             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4983             MOZ_ENABLE_GIO=1
4984             AC_DEFINE(MOZ_ENABLE_GIO)
4985         ],[
4986             if test "$MOZ_ENABLE_GIO" = "force"
4987             then
4988                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4989             fi
4990             MOZ_ENABLE_GIO=
4991         ])
4992     fi
4994     AC_SUBST(MOZ_ENABLE_GIO)
4995     AC_SUBST(MOZ_GIO_CFLAGS)
4996     AC_SUBST(MOZ_GIO_LIBS)
4998     dnl ========================================================
4999     dnl = GConf support module
5000     dnl ========================================================
5001     MOZ_ARG_DISABLE_BOOL(gconf,
5002     [  --disable-gconf      Disable Gconf support ],
5003         MOZ_ENABLE_GCONF=,
5004         MOZ_ENABLE_GCONF=force)
5006     if test "$MOZ_ENABLE_GCONF"
5007     then
5008         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5009             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
5010             MOZ_ENABLE_GCONF=1
5011         ],[
5012             if test "$MOZ_ENABLE_GCONF" = "force"
5013             then
5014                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5015             fi
5016             MOZ_ENABLE_GCONF=
5017         ])
5018     fi
5020     if test "$MOZ_ENABLE_GCONF"; then
5021         AC_DEFINE(MOZ_ENABLE_GCONF)
5022     fi
5024     AC_SUBST(MOZ_ENABLE_GCONF)
5025     AC_SUBST(MOZ_GCONF_CFLAGS)
5026     AC_SUBST(MOZ_GCONF_LIBS)
5029 dnl ========================================================
5030 dnl = libproxy support
5031 dnl ========================================================
5033 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5034 then
5035     MOZ_ENABLE_LIBPROXY=
5037     MOZ_ARG_ENABLE_BOOL(libproxy,
5038     [  --enable-libproxy         Enable libproxy support ],
5039     MOZ_ENABLE_LIBPROXY=1,
5040     MOZ_ENABLE_LIBPROXY=)
5042     if test "$MOZ_ENABLE_LIBPROXY"
5043     then
5044         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5045         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5046     fi
5048 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5049 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5050 AC_SUBST(MOZ_LIBPROXY_LIBS)
5052 dnl ========================================================
5053 dnl = GNOME component (mozgnome)
5054 dnl ========================================================
5056 if test "$MOZ_ENABLE_GTK2"
5057 then
5058     MOZ_ENABLE_GNOME_COMPONENT=1
5060 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5062 dnl ========================================================
5063 dnl = libgnomeui support module
5064 dnl ========================================================
5066 if test "$MOZ_ENABLE_GTK2"
5067 then
5068     MOZ_ARG_ENABLE_BOOL(gnomeui,
5069     [  --enable-gnomeui        Enable libgnomeui instead of GIO & GTK for icon theme support ],
5070         MOZ_ENABLE_GNOMEUI=force,
5071         MOZ_ENABLE_GNOMEUI=)
5073     if test "$MOZ_ENABLE_GNOMEUI"
5074     then
5075         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5076         [
5077             MOZ_ENABLE_GNOMEUI=1
5078         ],[
5079             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5080             then
5081                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5082             fi
5083             MOZ_ENABLE_GNOMEUI=
5084         ])
5085     fi
5087     if test "$MOZ_ENABLE_GNOMEUI"; then
5088         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5089     fi
5092 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5093 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5095 dnl ========================================================
5096 dnl = dbus support
5097 dnl ========================================================
5099 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5100 then
5101     MOZ_ENABLE_DBUS=1
5103     MOZ_ARG_DISABLE_BOOL(dbus,
5104     [  --disable-dbus          Disable dbus support ],
5105         MOZ_ENABLE_DBUS=,
5106         MOZ_ENABLE_DBUS=1)
5108     if test "$MOZ_ENABLE_DBUS"
5109     then
5110         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5111         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5112         AC_DEFINE(MOZ_ENABLE_DBUS)
5113     fi
5115 AC_SUBST(MOZ_ENABLE_DBUS)
5116 AC_SUBST(MOZ_DBUS_CFLAGS)
5117 AC_SUBST(MOZ_DBUS_LIBS)
5118 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5119 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5121 dnl ========================================================
5122 dnl = Enable Android History instead of Places
5123 dnl ========================================================
5124 if test -n "$MOZ_ANDROID_HISTORY"; then
5125     if test -z "$MOZ_PLACES"; then
5126         AC_DEFINE(MOZ_ANDROID_HISTORY)
5127     else
5128         AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
5129     fi
5132 dnl ========================================================
5133 dnl = Build with the Android compositor
5134 dnl ========================================================
5135 if test -n "$MOZ_ANDROID_OMTC"; then
5136      dnl Do this if defined in confvars.sh
5137      AC_DEFINE(MOZ_ANDROID_OMTC)
5140 dnl ========================================================
5141 dnl = Disable WebSMS backend
5142 dnl ========================================================
5143 MOZ_ARG_DISABLE_BOOL(websms-backend,
5144 [  --disable-websms-backend
5145                            Disable WebSMS backend],
5146     MOZ_WEBSMS_BACKEND=,
5147     MOZ_WEBSMS_BACKEND=1)
5149 if test -n "$MOZ_WEBSMS_BACKEND"; then
5150     AC_DEFINE(MOZ_WEBSMS_BACKEND)
5153 dnl ========================================================
5154 dnl = Build Personal Security Manager
5155 dnl ========================================================
5156 MOZ_ARG_DISABLE_BOOL(crypto,
5157 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5158     MOZ_PSM=,
5159     MOZ_PSM=1 )
5161 dnl ========================================================
5162 dnl = JS Debugger XPCOM component (js/jsd)
5163 dnl ========================================================
5164 MOZ_ARG_DISABLE_BOOL(jsd,
5165 [  --disable-jsd           Disable JavaScript debug library],
5166     MOZ_JSDEBUGGER=,
5167     MOZ_JSDEBUGGER=1)
5170 dnl ========================================================
5171 dnl = Enable IPDL's "expensive" unit tests
5172 dnl ========================================================
5173 MOZ_IPDL_TESTS=
5175 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5176 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5177     MOZ_IPDL_TESTS=1,
5178     MOZ_IPDL_TESTS=)
5180 if test -n "$MOZ_IPDL_TESTS"; then
5181     AC_DEFINE(MOZ_IPDL_TESTS)
5184 AC_SUBST(MOZ_IPDL_TESTS)
5186 dnl ========================================================
5187 dnl = Turns off code necessary for e10s compatibility
5188 dnl ========================================================
5189 dnl This is a temporary flag to be removed in bug 662601 when
5190 dnl it's no longer needed
5192 MOZ_E10S_COMPAT=
5194 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5195 [  --enable-e10s-compat     Turns off code for e10s compat],
5196     MOZ_E10S_COMPAT=1,
5197     MOZ_E10S_COMPAT=)
5199 if test -n "$MOZ_E10S_COMPAT"; then
5200     AC_DEFINE(MOZ_E10S_COMPAT)
5203 dnl ========================================================
5204 dnl = Disable building dbm
5205 dnl ========================================================
5206 MOZ_ARG_DISABLE_BOOL(dbm,
5207 [  --disable-dbm           Disable building dbm],
5208     NSS_DISABLE_DBM=1,
5209     NSS_DISABLE_DBM=)
5211 dnl bi-directional support always on
5212 IBMBIDI=1
5213 AC_DEFINE(IBMBIDI)
5215 dnl ========================================================
5216 dnl accessibility support on by default on all platforms
5217 dnl ========================================================
5218 MOZ_ARG_DISABLE_BOOL(accessibility,
5219 [  --disable-accessibility Disable accessibility support],
5220     ACCESSIBILITY=,
5221     ACCESSIBILITY=1 )
5222 if test "$ACCESSIBILITY"; then
5223     case "$target" in
5224     *-mingw*)
5225         if test -z "$MIDL"; then
5226             if test "$GCC" != "yes"; then
5227                 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5228             else
5229                 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.])
5230             fi
5231         fi
5232     esac
5233     AC_DEFINE(ACCESSIBILITY)
5236 dnl ========================================================
5237 dnl Accessibility is required for the linuxgl widget
5238 dnl backend
5239 dnl ========================================================
5240 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5241     AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5244 dnl ========================================================
5245 dnl Disable printing
5246 dnl ========================================================
5247 MOZ_ARG_DISABLE_BOOL(printing,
5248 [  --disable-printing      Disable printing support],
5249     NS_PRINTING=,
5250     NS_PRINTING=1)
5252 if test "$NS_PRINTING"; then
5253     AC_DEFINE(NS_PRINTING)
5254     AC_DEFINE(NS_PRINT_PREVIEW)
5257 dnl Turn off webrtc for OS's we don't handle yet, but allow 
5258 dnl --enable-webrtc to override.  Can disable for everything in
5259 dnl the master list above.
5260 if test -n "$MOZ_WEBRTC"; then
5261     case "$target" in
5262     *-android*|*-linuxandroid*)
5263         if test -n "$MOZ_B2G"; then
5264             MOZ_WEBRTC=1
5265         else
5266             dnl Make sure doesn't get matched by *-linux*
5267             MOZ_WEBRTC=
5268         fi
5269         ;;
5270     *-linux*|*-mingw*|*-darwin*)
5271         dnl Leave enabled
5272         ;;
5273     *)
5274         dnl default to disabled for all others
5275         MOZ_WEBRTC=
5276         ;;
5277     esac
5280 dnl ========================================================
5281 dnl = Disable WebRTC code
5282 dnl ========================================================
5283 MOZ_ARG_DISABLE_BOOL(webrtc,
5284 [  --disable-webrtc        Disable support for WebRTC],
5285     MOZ_WEBRTC=,
5286     MOZ_WEBRTC=1)
5288 if test -n "$MOZ_WEBRTC"; then
5289     AC_DEFINE(MOZ_WEBRTC)
5290     MOZ_MEDIA=1
5291     MOZ_RAW=1
5292     MOZ_VP8=1
5293     MOZ_VP8_ENCODER=1
5294     MOZ_VP8_ERROR_CONCEALMENT=1
5296     if test "$MOZ_WIDGET_TOOLKIT" != "gonk"; then
5297        dnl OpenSLES is only available in Android 2.3 and later; we'll change this
5298        dnl hard dependency to a dynamic load with graceful runtime failure before
5299        dnl we make --enable-webrtc on by default in Android (bug 815905)
5300        dnl
5301        if test "$OS_TARGET" = "Android"; then
5302           LDFLAGS="$LDFLAGS -lOpenSLES"
5303        fi
5304        case "$target" in
5305           *-android*|*-linuxandroid*)
5306           LDFLAGS="$LDFLAGS -lOpenSLES"
5307           ;;
5308        esac
5309     fi
5311 dnl enable once Signaling lands
5312     MOZ_WEBRTC_SIGNALING=1
5313     AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5314     if test "${OS_TARGET}" = "WINNT"; then
5315         MOZ_WEBRTC_IN_LIBXUL=1
5316     fi
5317 dnl enable once PeerConnection lands
5318     MOZ_PEERCONNECTION=1
5319     AC_DEFINE(MOZ_PEERCONNECTION)
5320     MOZ_SCTP=1
5321     MOZ_SRTP=1
5322     AC_DEFINE(MOZ_SCTP)
5323     AC_DEFINE(MOZ_SRTP)
5326 AC_SUBST(MOZ_WEBRTC)
5327 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5328 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5329 AC_SUBST(MOZ_PEERCONNECTION)
5330 AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
5331 AC_SUBST(MOZ_SCTP)
5332 AC_SUBST(MOZ_SRTP)
5334 case "$target_cpu" in
5335 arm*)
5336     MOZ_SAMPLE_TYPE_S16=1
5337     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5338     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5341     MOZ_SAMPLE_TYPE_FLOAT32=1
5342     AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5343     AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5345 esac
5347 dnl ========================================================
5348 dnl = Enable Raw Codecs
5349 dnl ========================================================
5350 MOZ_ARG_ENABLE_BOOL(raw,
5351 [  --enable-raw           Enable support for RAW media],
5352     MOZ_RAW=1,
5353     MOZ_RAW=)
5355 if test -n "$MOZ_RAW"; then
5356     AC_DEFINE(MOZ_RAW)
5357     MOZ_MEDIA=1
5360 AC_SUBST(MOZ_RAW)
5362 dnl ========================================================
5363 dnl = Disable Ogg Codecs
5364 dnl ========================================================
5365 MOZ_ARG_DISABLE_BOOL(ogg,
5366 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5367     MOZ_OGG=,
5368     MOZ_OGG=1)
5370 if test -n "$MOZ_OGG"; then
5371     AC_DEFINE(MOZ_OGG)
5372     MOZ_CUBEB=1
5373     MOZ_MEDIA=1
5375     dnl Checks for __attribute__(aligned()) directive
5376     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5377         [ac_cv_c_attribute_aligned],
5378         [ac_cv_c_attribute_aligned=0
5379          CFLAGS_save="${CFLAGS}"
5380          CFLAGS="${CFLAGS} -Werror"
5381          for ac_cv_c_attr_align_try in 64 32 16 8; do
5382            echo "trying $ac_cv_c_attr_align_try"
5383            AC_TRY_COMPILE([],
5384                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5385                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5386            if test "$ac_cv_c_attribute_aligned" != 0; then
5387              break;
5388            fi
5389          done
5390            CFLAGS="${CFLAGS_save}"])
5391     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5392       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5393                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5394     fi
5397 dnl ========================================================
5398 dnl = Disable Opus audio codec support
5399 dnl ========================================================
5400 MOZ_ARG_DISABLE_BOOL(opus,
5401 [  --disable-opus          Disable support for Opus audio],
5402     MOZ_OPUS=,
5403     MOZ_OPUS=1)
5405 dnl ========================================================
5406 dnl = Disable VP8 decoder support
5407 dnl ========================================================
5408 MOZ_ARG_DISABLE_BOOL(webm,
5409 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5410     MOZ_WEBM=,
5411     MOZ_WEBM=1)
5413 if test -n "$MOZ_WEBM"; then
5414     AC_DEFINE(MOZ_WEBM)
5415     MOZ_VP8=1
5418 dnl ========================================================
5419 dnl = Disable DASH-WebM support
5420 dnl ========================================================
5421 MOZ_ARG_DISABLE_BOOL(dash,
5422 [  --disable-dash          Disable support for DASH-WebM],
5423     MOZ_DASH=,
5424     MOZ_DASH=1)
5426 if test -n "$MOZ_DASH"; then
5427     if test -n "$MOZ_WEBM"; then
5428         AC_DEFINE(MOZ_DASH)
5429     else
5430         dnl Fail if WebM is not enabled as well as DASH.
5431         AC_MSG_ERROR([WebM is currently disabled and must be enabled for DASH
5432                      to work.])
5433     fi
5437 dnl ========================================================
5438 dnl = Windows Media Foundation support
5439 dnl ========================================================
5440 if test "$OS_ARCH" = "WINNT"; then
5441     dnl Enable Windows Media Foundation support by default.
5442     dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5443     dnl guaranteed to have a recent-enough SDK to build WMF.
5444     MOZ_WMF=1
5447 MOZ_ARG_DISABLE_BOOL(wmf,
5448 [  --disable-wmf  Disable support for Windows Media Foundation],
5449     MOZ_WMF=,
5450     MOZ_WMF=1)
5452 if test -n "$MOZ_WMF"; then
5453     AC_DEFINE(MOZ_WMF)
5454     MOZ_CUBEB=1
5455     MOZ_MEDIA=1
5458 dnl ========================================================
5459 dnl = Enable media plugin support
5460 dnl ========================================================
5461 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5462   dnl Enable support on android by default
5463   MOZ_MEDIA_PLUGINS=1
5466 MOZ_ARG_ENABLE_BOOL(media-plugins,
5467 [  --enable-media-plugins  Enable support for media plugins],
5468     MOZ_MEDIA_PLUGINS=1,
5469     MOZ_MEDIA_PLUGINS=)
5471 if test -n "$MOZ_MEDIA_PLUGINS"; then
5472   AC_DEFINE(MOZ_MEDIA_PLUGINS)
5475 dnl ========================================================
5476 dnl = Enable getUserMedia support
5477 dnl ========================================================
5478 MOZ_ARG_ENABLE_BOOL(media-navigator,
5479 [  --enable-media-navigator  Enable support for getUserMedia],
5480     MOZ_MEDIA_NAVIGATOR=1,
5481     MOZ_MEDIA_NAVIGATOR=)
5483 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5484   AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5487 dnl ========================================================
5488 dnl = Enable building OMX media plugin (B2G or Android)
5489 dnl ========================================================
5490 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5491   dnl Enable support on android by default
5492   MOZ_OMX_PLUGIN=1
5495 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5496 [  --enable-omx-plugin      Enable building OMX plugin (B2G)],
5497     MOZ_OMX_PLUGIN=1,
5498     MOZ_OMX_PLUGIN=)
5500 if test -n "$MOZ_OMX_PLUGIN"; then
5501     if test "$OS_TARGET" = "Android"; then
5502         dnl Only allow building OMX plugin on Gonk (B2G) or Android
5503         AC_DEFINE(MOZ_OMX_PLUGIN)
5504     else
5505        dnl fail if we're not building on Gonk or Android
5506        AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5507     fi
5510 dnl system libvpx Support
5511 dnl ========================================================
5512 MOZ_ARG_WITH_BOOL(system-libvpx,
5513 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
5514     MOZ_NATIVE_LIBVPX=1)
5516 MOZ_LIBVPX_CFLAGS=
5517 MOZ_LIBVPX_LIBS=
5519 if test -n "$MOZ_VP8"; then
5520     AC_DEFINE(MOZ_VP8)
5521     if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5522         AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5523     fi
5524     if test -n "$MOZ_VP8_ENCODER" ; then
5525         AC_DEFINE(MOZ_VP8_ENCODER)
5526     fi
5528     if test -n "$MOZ_NATIVE_LIBVPX"; then
5529         dnl ============================
5530         dnl === libvpx Version check ===
5531         dnl ============================
5532         dnl Check to see if we have a system libvpx package.
5533         PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5535         MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [], 
5536          [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.])])
5538         _SAVE_LIBS=$LIBS
5539         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [], 
5540          [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5541         LIBS=$_SAVE_LIBS
5542     fi
5545 AC_SUBST(MOZ_NATIVE_LIBVPX)
5546 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5547 AC_SUBST(MOZ_LIBVPX_LIBS)
5549 if test "$MOZ_WEBM"; then
5550     MOZ_CUBEB=1
5551     MOZ_MEDIA=1
5552     if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5553         MOZ_VORBIS=1
5554     else
5555         MOZ_TREMOR=1
5556     fi
5559 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5561     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5562     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5563     dnl We currently require gcc on all arm platforms.
5564     VPX_AS=$YASM
5565     VPX_ASM_SUFFIX=asm
5566     VPX_NEED_OBJ_INT_EXTRACT=
5568     dnl See if we have assembly on this platform.
5569     case "$OS_ARCH:$CPU_ARCH" in
5570     Darwin:x86)
5571       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5572       VPX_X86_ASM=1
5573     ;;
5574     Darwin:x86_64)
5575       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5576       VPX_X86_ASM=1
5577     ;;
5578     WINNT:x86_64)
5579       VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5580       VPX_X86_ASM=1
5581     ;;
5582     WINNT:x86)
5583       dnl Check for yasm 1.1 or greater.
5584       if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5585         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.])
5586       elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5587         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.])
5588       else
5589         VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5590         VPX_X86_ASM=1
5591         dnl The encoder needs obj_int_extract to get asm offsets.
5592       fi
5593     ;;
5594     *:arm*)
5595       if test -n "$GNU_AS" ; then
5596         VPX_AS=$AS
5597         dnl These flags are a lie; they're just used to enable the requisite
5598         dnl opcodes; actual arch detection is done at runtime.
5599         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5600         VPX_DASH_C_FLAG="-c"
5601         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5602         VPX_ASM_SUFFIX="$ASM_SUFFIX"
5603         VPX_ARM_ASM=1
5604       fi
5605     ;;
5606     *:x86)
5607       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5608         VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5609         VPX_X86_ASM=1
5610       fi
5611     ;;
5612     *:x86_64)
5613       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5614         VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5615         VPX_X86_ASM=1
5616       fi
5617     ;;
5618     esac
5620     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5621       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.])
5622     fi
5624     if test -n "$MOZ_VP8_ENCODER" -a \
5625             -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5626       dnl We prefer to get asm offsets using inline assembler, which the above
5627       dnl compilers can do. When we're not using one of those, we have to fall
5628       dnl back to obj_int_extract, which reads them from a compiled object
5629       dnl file. Unfortunately, that only works if we're compiling on a system
5630       dnl with the header files for the appropriate object file format.
5631       VPX_NEED_OBJ_INT_EXTRACT=1
5632     fi
5634     if test -n "$VPX_X86_ASM"; then
5635       AC_DEFINE(VPX_X86_ASM)
5636     elif test -n "$VPX_ARM_ASM"; then
5637       AC_DEFINE(VPX_ARM_ASM)
5638     else
5639       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5640     fi
5643 dnl ========================================================
5644 dnl = Disable Wave decoder support
5645 dnl ========================================================
5646 MOZ_ARG_DISABLE_BOOL(wave,
5647 [  --disable-wave          Disable Wave decoder support],
5648     MOZ_WAVE=,
5649     MOZ_WAVE=1)
5651 if test -n "$MOZ_WAVE"; then
5652     AC_DEFINE(MOZ_WAVE)
5653     MOZ_CUBEB=1
5654     MOZ_MEDIA=1
5657 dnl ========================================================
5658 dnl = Handle dependent CUBEB and MEDIA defines
5659 dnl ========================================================
5661 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5662     AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5665 if test -n "$MOZ_SOUNDTOUCH"; then
5666     AC_DEFINE(MOZ_SOUNDTOUCH)
5669 if test -n "$MOZ_CUBEB"; then
5670     AC_DEFINE(MOZ_CUBEB)
5673 if test -n "$MOZ_MEDIA"; then
5674     AC_DEFINE(MOZ_MEDIA)
5677 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5678     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/])
5681 if test -n "$MOZ_VORBIS"; then
5682     AC_DEFINE(MOZ_VORBIS)
5685 if test -n "$MOZ_TREMOR"; then
5686     AC_DEFINE(MOZ_TREMOR)
5689 if test -n "$MOZ_OPUS"; then
5690     AC_DEFINE(MOZ_OPUS)
5693 if test -n "$MOZ_WEBVTT"; then
5694     AC_DEFINE(MOZ_WEBVTT)
5697 dnl ========================================================
5698 dnl = Check alsa availability on Linux if using sydneyaudio
5699 dnl ========================================================
5701 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5702 if test -n "$MOZ_CUBEB" -a "$OS_TARGET" = "Linux"; then
5703     MOZ_ALSA=1
5706 MOZ_ARG_ENABLE_BOOL(alsa,
5707 [  --enable-alsa          Enable Alsa support (default on Linux)],
5708 MOZ_ALSA=1,
5709 MOZ_ALSA=)
5711 if test -n "$MOZ_ALSA"; then
5712     AC_DEFINE(MOZ_CUBEB)
5713     PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5714          [echo "$MOZ_ALSA_PKG_ERRORS"
5715           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.)])])
5718 AC_SUBST(MOZ_ALSA)
5719 AC_SUBST(MOZ_ALSA_CFLAGS)
5720 AC_SUBST(MOZ_ALSA_LIBS)
5722 dnl ========================================================
5723 dnl = Enable PulseAudio
5724 dnl ========================================================
5726 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5727 [  --enable-pulseaudio          Enable PulseAudio support (experimental)],
5728 MOZ_PULSEAUDIO=1,
5729 MOZ_PULSEAUDIO=)
5731 if test -n "$MOZ_PULSEAUDIO"; then
5732     AC_DEFINE(MOZ_CUBEB)
5733     PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5734          [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5735           AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
5738 AC_SUBST(MOZ_PULSEAUDIO)
5739 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5740 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5742 dnl ========================================================
5743 dnl = Enable GStreamer
5744 dnl ========================================================
5745 MOZ_ARG_ENABLE_BOOL(gstreamer,
5746 [  --enable-gstreamer           Enable GStreamer support],
5747 MOZ_GSTREAMER=1,
5748 MOZ_GSTREAMER=)
5750 if test "$MOZ_GSTREAMER"; then
5751     # API version, eg 0.10, 1.0 etc
5752     GST_API_VERSION=0.10
5753     # core/base release number
5754     GST_VERSION=0.10.25
5755     PKG_CHECK_MODULES(GSTREAMER,
5756                       gstreamer-$GST_API_VERSION >= $GST_VERSION
5757                       gstreamer-app-$GST_API_VERSION
5758                       gstreamer-plugins-base-$GST_API_VERSION)
5759     if test -n "$GSTREAMER_LIBS"; then
5760        _SAVE_LDFLAGS=$LDFLAGS
5761        LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5762        AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5763        if test -n "$_HAVE_LIBGSTVIDEO" ; then
5764           GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5765        else
5766           AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
5767        fi
5768        LDFLAGS=$_SAVE_LDFLAGS
5769     else
5770        AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
5771     fi
5773 AC_SUBST(GSTREAMER_CFLAGS)
5774 AC_SUBST(GSTREAMER_LIBS)
5775 AC_SUBST(MOZ_GSTREAMER)
5777 if test -n "$MOZ_GSTREAMER"; then
5778    AC_DEFINE(MOZ_GSTREAMER)
5779    MOZ_MEDIA=1
5783 dnl ========================================================
5784 dnl Permissions System
5785 dnl ========================================================
5786 MOZ_ARG_DISABLE_BOOL(permissions,
5787 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5788     MOZ_PERMISSIONS=,
5789     MOZ_PERMISSIONS=1
5792 dnl ========================================================
5793 dnl NegotiateAuth
5794 dnl ========================================================
5795 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5796 [  --disable-negotiateauth Disable GSS-API negotiation ],
5797     MOZ_AUTH_EXTENSION=,
5798     MOZ_AUTH_EXTENSION=1 )
5800 dnl ========================================================
5801 dnl Pref extensions (autoconfig)
5802 dnl ========================================================
5803 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5804 [  --disable-pref-extensions
5805                           Disable pref extensions such as autoconfig],
5806   MOZ_PREF_EXTENSIONS=,
5807   MOZ_PREF_EXTENSIONS=1 )
5809 dnl ========================================================
5810 dnl Searching of system directories for extensions.
5811 dnl Note: this switch is meant to be used for test builds
5812 dnl whose behavior should not depend on what happens to be
5813 dnl installed on the local machine.
5814 dnl ========================================================
5815 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5816 [  --disable-system-extension-dirs
5817                           Disable searching system- and account-global
5818                           directories for extensions of any kind; use
5819                           only profile-specific extension directories],
5820   ENABLE_SYSTEM_EXTENSION_DIRS=,
5821   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5822 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5823   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5826 dnl ========================================================
5827 dnl = Universalchardet
5828 dnl ========================================================
5829 MOZ_ARG_DISABLE_BOOL(universalchardet,
5830 [  --disable-universalchardet
5831                           Disable universal encoding detection],
5832   MOZ_UNIVERSALCHARDET=,
5833   MOZ_UNIVERSALCHARDET=1 )
5835 if test -n "${JAVA_BIN_PATH}"; then
5836   dnl Look for javac and jar in the specified path.
5837   JAVA_PATH="$JAVA_BIN_PATH"
5838 else
5839   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5840   JAVA_PATH="$JAVA_HOME/bin:$PATH"
5843 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5844 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5845 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5846 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5848 if test -n "${JAVA_BIN_PATH}" -o \
5849   \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5850   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAVAH" -o "$JAVAH" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5851     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}])
5852   fi
5855 dnl ========================================================
5856 dnl = ANGLE OpenGL->D3D translator for WebGL
5857 dnl = * only applies to win32
5858 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5859 dnl ========================================================
5860 MOZ_ANGLE_RENDERER=
5861 MOZ_DIRECTX_SDK_PATH=
5862 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5863 MOZ_D3DCOMPILER_CAB=
5864 MOZ_D3DCOMPILER_DLL=
5865 case "$target_os" in
5866 *mingw*)
5867     MOZ_ANGLE_RENDERER=1
5868     ;;
5869 esac
5871 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5872 case "${target_cpu}" in
5873 i*86)
5874   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5875   ;;
5876 x86_64)
5877   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5878   ;;
5879 esac
5881 MOZ_ARG_DISABLE_BOOL(webgl,
5882 [  --disable-webgl     Disable building of the WebGL implementation],
5883     MOZ_WEBGL_DISABLED=1,
5884     MOZ_WEBGL_DISABLED=)
5886 if test -n "$MOZ_WEBGL_DISABLED"; then
5887   MOZ_WEBGL=
5888   MOZ_ANGLE_RENDERER=
5891 # Locate a DirectX SDK here so we can use it for both ANGLE and
5892 # Joystick support.
5893 if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
5894   # Get the SDK path from the registry.
5895   # First try to get the June 2010 SDK
5896   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5897   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5898     # Otherwise just take whatever comes first
5899     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5900   fi
5901   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'`
5904 if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
5905   if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5906     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.])
5907   fi
5909   if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5910      test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5911          test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5912     AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5913   else
5914     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.])
5915   fi
5917   # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5918   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'`
5920   if test -z "$MOZ_D3DX9_VERSION" ; then
5921         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.])
5922   fi
5924   MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5926   if test -z "$MOZ_D3DCOMPILER_CAB"; then
5927     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.])
5928   fi
5930   MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5933 dnl ========================================================
5934 dnl Gamepad support
5935 dnl ========================================================
5936 MOZ_GAMEPAD=
5937 MOZ_GAMEPAD_BACKEND=stub
5939 # Gamepad DOM is built on supported platforms by default.
5940 case "$OS_TARGET" in
5941      Darwin|WINNT|Linux)
5942        MOZ_GAMEPAD=1
5943        ;;
5944      *)
5945        ;;
5946 esac
5948 MOZ_ARG_DISABLE_BOOL(gamepad,
5949 [  --disable-gamepad   Disable gamepad support],
5950     MOZ_GAMEPAD=,
5951     MOZ_GAMEPAD=1)
5953 if test "$MOZ_GAMEPAD"; then
5954     case "$OS_TARGET" in
5955     Darwin)
5956         MOZ_GAMEPAD_BACKEND=cocoa
5957         ;;
5958     WINNT)
5959         if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
5960             if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5961                MOZ_GAMEPAD=
5962             fi
5963         else
5964             MOZ_GAMEPAD=
5965         fi
5966         if test -z "$MOZ_GAMEPAD"; then
5967            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.])
5968         fi
5969         MOZ_GAMEPAD_BACKEND=windows
5970         ;;
5971     Linux)
5972         MOZ_CHECK_HEADER([linux/joystick.h])
5973         if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5974           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.])
5975         fi
5976         MOZ_GAMEPAD_BACKEND=linux
5977         ;;
5978     *)
5979         ;;
5980    esac
5982   AC_DEFINE(MOZ_GAMEPAD)
5984 AC_SUBST(MOZ_GAMEPAD)
5985 AC_SUBST(MOZ_GAMEPAD_BACKEND)
5987 dnl ========================================================
5988 dnl = Breakpad crash reporting (on by default on supported platforms)
5989 dnl ========================================================
5991 case $target in
5992 i?86-*-mingw*|x86_64-*-mingw*)
5993   MOZ_CRASHREPORTER=1
5994   ;;
5995 i?86-apple-darwin*|x86_64-apple-darwin*)
5996   MOZ_CRASHREPORTER=1
5997   ;;
5998 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5999   if test "$MOZ_ENABLE_GTK2"; then
6000     MOZ_CRASHREPORTER=1
6001   fi
6002   ;;
6003 *-android*|*-linuxandroid*)
6004   MOZ_CRASHREPORTER=1
6005   ;;
6006 *solaris*)
6007   MOZ_CRASHREPORTER=1
6008   ;;
6009 esac
6011 MOZ_ARG_DISABLE_BOOL(crashreporter,
6012 [  --disable-crashreporter Disable breakpad crash reporting],
6013     MOZ_CRASHREPORTER=,
6014     MOZ_CRASHREPORTER=1)
6016 if test -n "$MOZ_CRASHREPORTER"; then
6017    AC_DEFINE(MOZ_CRASHREPORTER)
6019   if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
6020     test -z "$SKIP_LIBRARY_CHECKS"; then
6021     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6022     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6023     AC_SUBST(MOZ_GTHREAD_LIBS)
6024   fi
6026   if test "$OS_ARCH" != "$HOST_OS_ARCH"; then
6027     AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.  Use --disable-crashreporter.])
6028   fi
6030   if test "$OS_ARCH" = "WINNT"; then
6031     AC_DEFINE_UNQUOTED(BREAKPAD_CUSTOM_STDINT_H, "mozilla/StandardInteger.h")
6032     if test -z "$HAVE_64BIT_OS"; then
6033       MOZ_CRASHREPORTER_INJECTOR=1
6034       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
6035     fi
6036   fi
6039 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6040 [  --with-crashreporter-enable-percent=NN
6041                           Enable sending crash reports by default on NN% of users. (default=100)],
6042 [ val=`echo $withval | sed 's/[^0-9]//g'`
6043     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6045 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6046    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6048 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6050 dnl ========================================================
6051 dnl = libjpeg-turbo configuration
6052 dnl ========================================================
6053 MOZ_LIBJPEG_TURBO=
6054 if test -z "$MOZ_NATIVE_JPEG"; then
6055     MOZ_LIBJPEG_TURBO=1
6058 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6059 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
6060     MOZ_LIBJPEG_TURBO=,
6061     MOZ_LIBJPEG_TURBO=1)
6063 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6064     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6067 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6068 dnl files.
6070 if test -n "$MOZ_LIBJPEG_TURBO"; then
6072   dnl Do we support libjpeg-turbo on this platform?
6073   case "$OS_ARCH:$OS_TEST" in
6074   Darwin:i?86)
6075     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6076     LIBJPEG_TURBO_X86_ASM=1
6077   ;;
6078   Darwin:x86_64)
6079     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6080     LIBJPEG_TURBO_X64_ASM=1
6081   ;;
6082   WINNT:x86|WINNT:i?86)
6083     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6084     LIBJPEG_TURBO_X86_ASM=1
6085   ;;
6086   WINNT:x86_64)
6087     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6088     LIBJPEG_TURBO_X64_ASM=1
6089   ;;
6090   *:arm*)
6091     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6092     LIBJPEG_TURBO_ARM_ASM=1
6093   ;;
6094   *:x86|*:i?86)
6095     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6096       LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6097       LIBJPEG_TURBO_X86_ASM=1
6098     fi
6099   ;;
6100   *:x86_64)
6101     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6102       LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6103       LIBJPEG_TURBO_X64_ASM=1
6104     fi
6105   ;;
6106   esac
6110 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6111 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6112 dnl it doesn't exist or we have too old of a version.
6113 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6114     AC_MSG_CHECKING([for Yasm assembler])
6115     AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
6117     if test -z "$LIBJPEG_TURBO_AS" ; then
6118         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.])
6119     fi
6121     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
6122     dnl on Linux and 1.1 or newer everywhere else.
6123     if test "$OS_ARCH" = "Linux" ; then
6124         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
6125             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.])
6126         fi
6127     else
6128         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6129             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.])
6130         fi
6131     fi
6134 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6135 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6136 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6137     echo "Using $AS as the assembler for ARM code."
6138     LIBJPEG_TURBO_AS=$AS
6141 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6142     AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6143 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6144     AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6145 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6146     AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6147 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6148     dnl Warn if we're not building the optimized routines, even though the user
6149     dnl didn't specify --disable-libjpeg-turbo.
6150     AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
6153 dnl ========================================================
6154 dnl = Enable compilation of specific extension modules
6155 dnl ========================================================
6157 MOZ_ARG_ENABLE_STRING(extensions,
6158 [  --enable-extensions     Enable extensions],
6159 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6160     if test "$option" = "yes" -o "$option" = "all"; then
6161         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6162     elif test "$option" = "no" -o "$option" = "none"; then
6163         MOZ_EXTENSIONS=""
6164     elif test "$option" = "default"; then
6165         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6166     elif test `echo "$option" | grep -c \^-` != 0; then
6167         option=`echo $option | sed 's/^-//'`
6168         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6169     else
6170         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6171     fi
6172 done],
6173     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6175 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6176     # Suppress warning on non-X11 platforms
6177     if test -n "$MOZ_X11"; then
6178         AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6179     fi
6180     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6183 dnl Do not build gnomevfs with libxul based apps
6184 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6185     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6188 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6189     # Suppress warning on non-X11 platforms
6190     if test -n "$MOZ_X11"; then
6191         AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6192     fi
6193     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6196 dnl Do not build gio with libxul based apps
6197 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6198     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6201 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6202     MOZ_GIO_COMPONENT=1
6203     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6205 AC_SUBST(MOZ_GIO_COMPONENT)
6207 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6208     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6209     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6212 dnl Remove dupes
6213 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6215 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6216 dnl when trying to build a nonexistent extension.
6217 for extension in $MOZ_EXTENSIONS; do
6218     if test ! -d "${srcdir}/extensions/${extension}"; then
6219         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6220     fi
6221 done
6223 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6224   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6227 dnl ========================================================
6228 dnl CSS3 Flexbox Support
6229 dnl ========================================================
6230 if test -n "$MOZ_FLEXBOX"; then
6231   AC_DEFINE(MOZ_FLEXBOX)
6234 dnl ========================================================
6235 dnl Build Freetype in the tree
6236 dnl ========================================================
6237 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6238 [  --enable-tree-freetype  Enable Tree FreeType],
6239     MOZ_TREE_FREETYPE=1,
6240     MOZ_TREE_FREETYPE= )
6241 if test -n "$MOZ_TREE_FREETYPE"; then
6242    if test -n "$_WIN32_MSVC"; then
6243       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6244    fi
6245    AC_DEFINE(MOZ_TREE_FREETYPE)
6246    AC_SUBST(MOZ_TREE_FREETYPE)
6247    MOZ_ENABLE_CAIRO_FT=1
6248    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6249    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6250    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6251    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6252    CAIRO_FT_OSLIBS=''
6253    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6254    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6255    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6256    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6257    AC_SUBST(CAIRO_FT_CFLAGS)
6260 dnl ========================================================
6261 dnl Installer
6262 dnl ========================================================
6263 dnl Abort Windows build if the required major version and
6264 dnl minimum minor version of Unicode NSIS isn't in the path
6265 dnl (unless in case of cross compiling, for which Unicode
6266 dnl is not yet sufficient).
6267 if test "$OS_ARCH" = "WINNT"; then
6268     REQ_NSIS_MAJOR_VER=2
6269     MIN_NSIS_MINOR_VER=46
6270     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensis)
6271     if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6272       AC_MSG_RESULT([yes])
6273       changequote(,)
6274       MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6275       changequote([,])
6276       if test ! "$MAKENSISU_VER" = ""; then
6277           MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6278           MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6279       fi
6280       AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6281       if test "$MAKENSISU_VER" = "" || \
6282          test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6283               ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6284           AC_MSG_RESULT([no])
6285           if test -z "$CROSS_COMPILE"; then
6286             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.])
6287           else
6288             MAKENSISU=
6289           fi
6290       fi
6291     elif test -z "$CROSS_COMPILE"; then
6292       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.])
6293     else
6294       MAKENSISU=
6295     fi
6298 dnl ========================================================
6299 dnl Web App Runtime
6300 dnl ========================================================
6301 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6302 [  --disable-webapp-runtime  Disable Web App Runtime],
6303     MOZ_WEBAPP_RUNTIME=,
6304     MOZ_WEBAPP_RUNTIME=1)
6305 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6306     MOZ_WEBAPP_RUNTIME=
6308 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6309     MOZ_WEBAPP_RUNTIME=
6311 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6312 if test "$MOZ_WEBAPP_RUNTIME"; then
6313     AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6316 AC_MSG_CHECKING([for tar archiver])
6317 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6318 if test -z "$TAR"; then
6319     AC_MSG_ERROR([no tar archiver found in \$PATH])
6321 AC_MSG_RESULT([$TAR])
6322 AC_SUBST(TAR)
6324 AC_MSG_CHECKING([for wget])
6325 AC_CHECK_PROGS(WGET, wget, "")
6326 AC_MSG_RESULT([$WGET])
6327 AC_SUBST(WGET)
6329 dnl ========================================================
6330 dnl Signing
6331 dnl ========================================================
6333 if test -n "$MOZ_SIGN_CMD"; then
6334     AC_DEFINE(MOZ_SIGNING)
6337 dnl ========================================================
6338 dnl Maintenance Service
6339 dnl ========================================================
6341 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6342 [  --enable-maintenance-service       Enable building of maintenanceservice],
6343     MOZ_MAINTENANCE_SERVICE=1,
6344     MOZ_MAINTENANCE_SERVICE= )
6346 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6347   if test "$OS_ARCH" = "WINNT"; then
6348     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6349   else
6350     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6351   fi
6354 dnl ========================================================
6355 dnl Verify MAR signatures
6356 dnl ========================================================
6358 MOZ_ARG_ENABLE_BOOL(verify-mar,
6359 [  --enable-verify-mar     Enable verifying MAR signatures],
6360     MOZ_VERIFY_MAR_SIGNATURE=1,
6361     MOZ_VERIFY_MAR_SIGNATURE= )
6363 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6364   if test "$OS_ARCH" = "WINNT"; then
6365     AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6366   else
6367     AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6368   fi
6371 dnl ========================================================
6372 dnl Enable building the signmar program.
6373 dnl This option is much different than the --enable-verify-mar option.
6374 dnl --enable-verify-mar is for enabling the verification check on MAR
6375 dnl files in the updater.  The --enable-signmar option is for building
6376 dnl the signmar program.
6377 dnl ========================================================
6379 MOZ_ARG_ENABLE_BOOL(signmar,
6380 [  --enable-signmar     Enable building the signmar program],
6381     MOZ_ENABLE_SIGNMAR=1,
6382     MOZ_ENABLE_SIGNMAR= )
6384 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6385   AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6388 dnl ========================================================
6389 dnl Updater
6390 dnl ========================================================
6392 MOZ_ARG_DISABLE_BOOL(updater,
6393 [  --disable-updater       Disable building of updater],
6394     MOZ_UPDATER=,
6395     MOZ_UPDATER=1 )
6397 if test -n "$MOZ_UPDATER"; then
6398     AC_DEFINE(MOZ_UPDATER)
6401 # tools/update-packaging is not checked out by default.
6402 MOZ_ARG_ENABLE_BOOL(update-packaging,
6403 [  --enable-update-packaging
6404                           Enable tools/update-packaging],
6405     MOZ_UPDATE_PACKAGING=1,
6406     MOZ_UPDATE_PACKAGING= )
6407 AC_SUBST(MOZ_UPDATE_PACKAGING)
6409 dnl ========================================================
6410 dnl build the tests by default
6411 dnl ========================================================
6412 MOZ_ARG_DISABLE_BOOL(tests,
6413 [  --disable-tests         Do not build test libraries & programs],
6414     ENABLE_TESTS=,
6415     ENABLE_TESTS=1 )
6417 # Currently GTest is linked into libxul. This means it must be off by default.
6418 # Follow up will be to generate libxul.so and libxul-test.so to let GTest
6419 # be compiled along with ENABLE_TESTS
6420 MOZ_ARG_ENABLE_BOOL(gtest,
6421 [  --enable-gtest
6422                           Enable GTest libxul unit test.],
6423     MOZ_ENABLE_GTEST=1,
6424     MOZ_ENABLE_GTEST= )
6426 if test -n "$MOZ_ENABLE_GTEST"; then
6427     if test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "Linux"; then
6428         MOZ_ENABLE_GTEST=1
6429         GTEST_HAS_RTTI=0
6430         AC_DEFINE(MOZ_ENABLE_GTEST)
6431         AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6432         AC_SUBST(MOZ_ENABLE_GTEST)
6433         AC_SUBST(GTEST_HAS_RTTI)
6434     else
6435         AC_MSG_ERROR([Cannot build with --enable-gtest on this platform.])
6436     fi
6439 dnl ========================================================
6440 dnl parental controls (for Windows Vista)
6441 dnl ========================================================
6442 MOZ_ARG_DISABLE_BOOL(parental-controls,
6443 [  --disable-parental-controls
6444                           Do not build parental controls],
6445    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6446    MOZ_DISABLE_PARENTAL_CONTROLS=)
6447 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6448     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6451 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6453 dnl ========================================================
6454 dnl = Disable DOMCrypto
6455 dnl ========================================================
6456 if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
6457     AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
6459 AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
6461 dnl ========================================================
6462 dnl =
6463 dnl = Module specific options
6464 dnl =
6465 dnl ========================================================
6466 MOZ_ARG_HEADER(Individual module options)
6468 dnl ========================================================
6469 dnl = Disable feed handling components
6470 dnl ========================================================
6471 MOZ_ARG_DISABLE_BOOL(feeds,
6472 [  --disable-feeds         Disable feed handling and processing components],
6473     MOZ_FEEDS=,
6474     MOZ_FEEDS=1 )
6475 if test -n "$MOZ_FEEDS"; then
6476     AC_DEFINE(MOZ_FEEDS)
6477 else
6478     if test "$MOZ_BUILD_APP" = "browser"; then
6479         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6480     fi
6483 dnl ========================================================
6484 dnl Check for sqlite
6485 dnl ========================================================
6487 MOZ_NATIVE_SQLITE=
6488 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6489 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6490 MOZ_NATIVE_SQLITE=1,
6491 MOZ_NATIVE_SQLITE= )
6493 if test -z "$MOZ_NATIVE_SQLITE"
6494 then
6495     SQLITE_CFLAGS=
6496     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6497 else
6498     dnl ============================
6499     dnl === SQLite Version check ===
6500     dnl ============================
6501     dnl Check to see if the system SQLite package is new enough.
6502     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6504     dnl ==================================
6505     dnl === SQLITE_SECURE_DELETE check ===
6506     dnl ==================================
6507     dnl Check to see if the system SQLite package is compiled with
6508     dnl SQLITE_SECURE_DELETE enabled.
6509     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6510     _SAVE_CFLAGS="$CFLAGS"
6511     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6512     _SAVE_LIBS="$LIBS"
6513     LIBS="$LIBS $SQLITE_LIBS"
6514     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6515         AC_TRY_RUN([
6516             #include "sqlite3.h"
6518             int main(int argc, char **argv){
6519               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6520             }],
6521             ac_cv_sqlite_secure_delete=yes,
6522             ac_cv_sqlite_secure_delete=no,
6523             ac_cv_sqlite_secure_delete=no
6524         )
6525     ])
6526     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6527     CFLAGS="$_SAVE_CFLAGS"
6528     LIBS="$_SAVE_LIBS"
6529     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6530         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6531     fi
6533     dnl ===============================
6534     dnl === SQLITE_THREADSAFE check ===
6535     dnl ===============================
6536     dnl Check to see if the system SQLite package is compiled with
6537     dnl SQLITE_THREADSAFE enabled.
6538     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6539     _SAVE_CFLAGS="$CFLAGS"
6540     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6541     _SAVE_LIBS="$LIBS"
6542     LIBS="$LIBS $SQLITE_LIBS"
6543     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6544         AC_TRY_RUN([
6545             #include "sqlite3.h"
6547             int main(int argc, char **argv){
6548               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6549             }],
6550             ac_cv_sqlite_threadsafe=yes,
6551             ac_cv_sqlite_threadsafe=no,
6552             ac_cv_sqlite_threadsafe=no
6553         )
6554     ])
6555     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6556     CFLAGS="$_SAVE_CFLAGS"
6557     LIBS="$_SAVE_LIBS"
6558     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6559         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6560     fi
6562     dnl ================================
6563     dnl === SQLITE_ENABLE_FTS3 check ===
6564     dnl ================================
6565     dnl check to see if the system SQLite package is compiled with
6566     dnl SQLITE_ENABLE_FTS3 enabled.
6567     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6568     _SAVE_CFLAGS="$CFLAGS"
6569     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6570     _SAVE_LIBS="$LIBS"
6571     LIBS="$LIBS $SQLITE_LIBS"
6572     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6573         AC_TRY_RUN([
6574             #include "sqlite3.h"
6576             int main(int argc, char **argv){
6577               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6578             }],
6579             ac_cv_sqlite_enable_fts3=yes,
6580             ac_cv_sqlite_enable_fts3=no,
6581             ac_cv_sqlite_enable_fts3=no
6582         )
6583     ])
6584     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6585     CFLAGS="$_SAVE_CFLAGS"
6586     LIBS="$_SAVE_LIBS"
6587     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6588         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6589     fi
6591     dnl =========================================
6592     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6593     dnl =========================================
6594     dnl check to see if the system SQLite package is compiled with
6595     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6596     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6597     _SAVE_CFLAGS="$CFLAGS"
6598     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6599     _SAVE_LIBS="$LIBS"
6600     LIBS="$LIBS $SQLITE_LIBS"
6601     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6602         AC_TRY_RUN([
6603             #include "sqlite3.h"
6605             int main(int argc, char **argv){
6606               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6607             }],
6608             ac_cv_sqlite_enable_unlock_notify=yes,
6609             ac_cv_sqlite_enable_unlock_notify=no,
6610             ac_cv_sqlite_enable_unlock_notify=no
6611         )
6612     ])
6613     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6614     CFLAGS="$_SAVE_CFLAGS"
6615     LIBS="$_SAVE_LIBS"
6616     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6617         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6618     fi
6621 if test -n "$MOZ_NATIVE_SQLITE"; then
6622     AC_DEFINE(MOZ_NATIVE_SQLITE)
6624 AC_SUBST(MOZ_NATIVE_SQLITE)
6626 dnl ========================================================
6627 dnl = Enable help viewer (off by default)
6628 dnl ========================================================
6629 if test -n "$MOZ_HELP_VIEWER"; then
6630      dnl Do this if defined in confvars.sh
6631      AC_DEFINE(MOZ_HELP_VIEWER)
6634 dnl ========================================================
6635 dnl = Enable safe browsing (anti-phishing)
6636 dnl ========================================================
6637 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6638 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6639     MOZ_SAFE_BROWSING=1,
6640     MOZ_SAFE_BROWSING= )
6641 if test -n "$MOZ_SAFE_BROWSING"; then
6642     AC_DEFINE(MOZ_SAFE_BROWSING)
6644 AC_SUBST(MOZ_SAFE_BROWSING)
6646 dnl ========================================================
6647 dnl = Enable url-classifier
6648 dnl ========================================================
6649 dnl Implicitly enabled by default if building with safe-browsing
6650 if test -n "$MOZ_SAFE_BROWSING"; then
6651     MOZ_URL_CLASSIFIER=1
6653 MOZ_ARG_ENABLE_BOOL(url-classifier,
6654 [  --enable-url-classifier Enable url classifier module],
6655     MOZ_URL_CLASSIFIER=1,
6656     MOZ_URL_CLASSIFIER= )
6657 if test -n "$MOZ_URL_CLASSIFIER"; then
6658     AC_DEFINE(MOZ_URL_CLASSIFIER)
6660 AC_SUBST(MOZ_URL_CLASSIFIER)
6662 dnl ========================================================
6663 dnl = Disable zipwriter
6664 dnl ========================================================
6665 MOZ_ARG_DISABLE_BOOL(zipwriter,
6666 [  --disable-zipwriter     Disable zipwriter component],
6667     MOZ_ZIPWRITER=,
6668     MOZ_ZIPWRITER=1 )
6669 AC_SUBST(MOZ_ZIPWRITER)
6671 dnl ========================================================
6672 dnl = libconic
6673 dnl ========================================================
6674 dnl superseded by QtNetwork starting from 4.7
6675 MOZ_ENABLE_LIBCONIC=1
6677 if test -n "$MOZ_ENABLE_QT"; then
6678   if test "$MOZ_ENABLE_QTNETWORK"; then
6679     MOZ_ENABLE_LIBCONIC=
6680   fi
6683 MOZ_ARG_DISABLE_BOOL(libconic,
6684 [  --disable-libconic      Disable libconic],
6685     MOZ_ENABLE_LIBCONIC=,
6686     MOZ_ENABLE_LIBCONIC=1 )
6688 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6689     PKG_CHECK_MODULES(LIBCONIC, conic,
6690                       MOZ_ENABLE_LIBCONIC=1,
6691                       MOZ_ENABLE_LIBCONIC=)
6693 if test "$MOZ_ENABLE_LIBCONIC"; then
6694     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6697 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6698 AC_SUBST(LIBCONIC_CFLAGS)
6699 AC_SUBST(LIBCONIC_LIBS)
6701 dnl ========================================================
6702 dnl = Maemo checks
6703 dnl ========================================================
6705 MAEMO_SDK_TARGET_VER=-1
6707 MOZ_ARG_WITH_STRING(maemo-version,
6708 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6709                           Maemo SDK Version],
6710   MAEMO_SDK_TARGET_VER=$withval)
6712 case "$MAEMO_SDK_TARGET_VER" in
6714     MOZ_PLATFORM_MAEMO=5
6715     ;;
6718     MOZ_PLATFORM_MAEMO=6
6719     ;;
6722     dnl We aren't compiling for Maemo, move on.
6723     ;;
6725     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6726     ;;
6727 esac
6729 if test $MOZ_PLATFORM_MAEMO; then
6730    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6732    if test -z "$MOZ_ENABLE_DBUS"; then
6733        AC_MSG_ERROR([DBus is required when building for Maemo])
6734    fi
6736    MOZ_GFX_OPTIMIZE_MOBILE=1
6737    MOZ_GL_DEFAULT_PROVIDER=EGL
6738    MOZ_MAEMO_LIBLOCATION=
6740    if test $MOZ_PLATFORM_MAEMO = 5; then
6741       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6742       MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6743           [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6744       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6745                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6747       AC_SUBST(XCOMPOSITE_LIBS)
6749       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6750       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6751       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6752       if test -z "$_LIB_FOUND"; then
6753          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6754       fi
6757       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6758       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6759       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6760       if test -z "$_LIB_FOUND"; then
6761          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6762       fi
6764       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6765       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6766       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6767       if test -z "$_LIB_FOUND"; then
6768          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6769       fi
6771    fi
6772    if test $MOZ_PLATFORM_MAEMO = 6; then
6774       PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6775                         _LIB_FOUND=1,
6776                         _LIB_FOUND=)
6777       if test "$_LIB_FOUND"; then
6778          MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6779          MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6780          MOZ_ENABLE_CONTENTMANAGER=1
6781          AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6782       else
6783          AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6784       fi
6785       AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6787       dnl ========================================================
6788       dnl = Enable meego libcontentaction
6789       dnl ========================================================
6790       MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6791       [  --enable-meegocontentaction           Enable meegocontentaction support],
6792          MOZ_MEEGOCONTENTACTION=1,
6793          MOZ_MEEGOCONTENTACTION=)
6795       if test -n "$MOZ_MEEGOCONTENTACTION"; then
6797          PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6798          if test "$_LIB_FOUND"; then
6799             MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6800             MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6801             MOZ_ENABLE_CONTENTACTION=1
6802             AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6803             AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6804          fi
6805       fi
6807       MOZ_ARG_ENABLE_BOOL(meegotouch,
6808       [  --enable-meegotouch  Enable meegotouch support],
6809          MOZ_MEEGOTOUCHENABLED=1,
6810          MOZ_MEEGOTOUCHENABLED=)
6812       if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6813           PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6814           if test "$_LIB_FOUND"; then
6815               MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6816               MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6817               AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6818           else
6819               AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6820           fi
6821       fi
6822    fi
6824    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6825    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6826    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6827    if test "$_LIB_FOUND"; then
6828       MOZ_MAEMO_LIBLOCATION=1
6829       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6830    else
6831       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6832    fi
6833    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6835    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6836    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6837    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6838    if test "$_LIB_FOUND"; then
6839       MOZ_ENABLE_MEEGOTOUCHSHARE=1
6840       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6841    else
6842       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6843    fi
6844    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6846    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6847    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6850 dnl ========================================================
6851 dnl GL provider
6852 dnl ========================================================
6853 MOZ_GL_PROVIDER=
6854 MOZ_ARG_WITH_STRING(gl-provider,
6855 [  --with-gl-provider=ID
6856                           Set GL provider backend type],
6857 [ val=`echo $withval`
6858     MOZ_GL_PROVIDER="$val"])
6860 if test -n "$MOZ_GL_PROVIDER"; then
6861 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6862 AC_SUBST(MOZ_GL_PROVIDER)
6863 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6865 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6866 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6868 dnl ========================================================
6869 dnl = faststripe theme
6870 dnl ========================================================
6871 MOZ_ARG_ENABLE_BOOL(faststripe,
6872 [  --enable-faststripe     Use faststripe theme],
6873     MOZ_THEME_FASTSTRIPE=1,
6874     MOZ_THEME_FASTSTRIPE= )
6875 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6877 dnl ========================================================
6878 dnl =
6879 dnl = Feature options that require extra sources to be pulled
6880 dnl =
6881 dnl ========================================================
6882 dnl MOZ_ARG_HEADER(Features that require extra sources)
6884 dnl ========================================================
6885 dnl =
6886 dnl = Debugging Options
6887 dnl =
6888 dnl ========================================================
6889 MOZ_ARG_HEADER(Debugging and Optimizations)
6891 dnl ========================================================
6892 dnl = Disable building with debug info.
6893 dnl = Debugging is OFF by default
6894 dnl ========================================================
6895 if test -z "$MOZ_DEBUG_FLAGS"; then
6896   MOZ_DEBUG_FLAGS="-g"
6899 MOZ_ARG_ENABLE_STRING(debug,
6900 [  --enable-debug[=DBG]    Enable building with developer debug info
6901                            (using compiler flags DBG)],
6902 [ if test "$enableval" != "no"; then
6903     MOZ_DEBUG=1
6904     if test -n "$enableval" -a "$enableval" != "yes"; then
6905         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6906         _MOZ_DEBUG_FLAGS_SET=1
6907     fi
6908   else
6909     MOZ_DEBUG=
6910   fi ],
6911   MOZ_DEBUG=)
6913 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6914 MOZ_ARG_WITH_STRING(debug-label,
6915 [  --with-debug-label=LABELS
6916                           Define DEBUG_<value> for each comma-separated
6917                           value given.],
6918 [ for option in `echo $withval | sed 's/,/ /g'`; do
6919     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6920 done])
6922 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6924 if test -n "$MOZ_DEBUG"; then
6925     AC_MSG_CHECKING([for valid debug flags])
6926     _SAVE_CFLAGS=$CFLAGS
6927     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6928     AC_TRY_COMPILE([#include <stdio.h>],
6929         [printf("Hello World\n");],
6930         _results=yes,
6931         _results=no)
6932     AC_MSG_RESULT([$_results])
6933     if test "$_results" = "no"; then
6934         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6935     fi
6936     CFLAGS=$_SAVE_CFLAGS
6939 dnl ========================================================
6940 dnl enable mobile optimizations
6941 dnl ========================================================
6942 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6943 [  --enable-mobile-optimize
6944                           Enable mobile optimizations],
6945     MOZ_GFX_OPTIMIZE_MOBILE=1)
6947 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6949 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6950     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6953 dnl ========================================================
6954 dnl = Enable code optimization. ON by default.
6955 dnl ========================================================
6956 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6957         MOZ_OPTIMIZE_FLAGS="-O"
6960 MOZ_ARG_ENABLE_STRING(optimize,
6961 [  --disable-optimize      Disable compiler optimization
6962   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6963 [ if test "$enableval" != "no"; then
6964     MOZ_OPTIMIZE=1
6965     if test -n "$enableval" -a "$enableval" != "yes"; then
6966         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6967         MOZ_OPTIMIZE=2
6968     fi
6969 else
6970     MOZ_OPTIMIZE=
6971 fi ], MOZ_OPTIMIZE=1)
6973 MOZ_SET_FRAMEPTR_FLAGS
6975 if test "$COMPILE_ENVIRONMENT"; then
6976 if test -n "$MOZ_OPTIMIZE"; then
6977     AC_MSG_CHECKING([for valid optimization flags])
6978     _SAVE_CFLAGS=$CFLAGS
6979     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6980     AC_TRY_COMPILE([#include <stdio.h>],
6981         [printf("Hello World\n");],
6982         _results=yes,
6983         _results=no)
6984     AC_MSG_RESULT([$_results])
6985     if test "$_results" = "no"; then
6986         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6987     fi
6988     CFLAGS=$_SAVE_CFLAGS
6990 fi # COMPILE_ENVIRONMENT
6992 AC_SUBST(MOZ_OPTIMIZE)
6993 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6994 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6995 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6996 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6997 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6998 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
7000 dnl ========================================================
7001 dnl = Enable generation of debug symbols
7002 dnl ========================================================
7003 MOZ_ARG_ENABLE_STRING(debug-symbols,
7004 [  --enable-debug-symbols[=DBG]
7005                           Enable debugging symbols (using compiler flags DBG)],
7006 [ if test "$enableval" != "no"; then
7007       MOZ_DEBUG_SYMBOLS=1
7008       if test -n "$enableval" -a "$enableval" != "yes"; then
7009           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7010               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7011           else
7012               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7013           fi
7014       fi
7015   else
7016       MOZ_DEBUG_SYMBOLS=
7017   fi ],
7018   MOZ_DEBUG_SYMBOLS=1)
7020 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7021     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7022     export MOZ_DEBUG_SYMBOLS
7025 dnl ========================================================
7026 dnl = Enable any treating of compile warnings as errors
7027 dnl ========================================================
7028 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
7029 [  --enable-warnings-as-errors
7030                           Enable treating of warnings as errors],
7031     MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
7032     MOZ_ENABLE_WARNINGS_AS_ERRORS=)
7033 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
7034    WARNINGS_AS_ERRORS=''
7037 dnl ========================================================
7038 dnl = Disable runtime logging checks
7039 dnl ========================================================
7040 MOZ_ARG_DISABLE_BOOL(logging,
7041 [  --disable-logging       Disable logging facilities],
7042     NS_DISABLE_LOGGING=1,
7043     NS_DISABLE_LOGGING= )
7044 if test "$NS_DISABLE_LOGGING"; then
7045     AC_DEFINE(NS_DISABLE_LOGGING)
7046 else
7047     AC_DEFINE(MOZ_LOGGING)
7050 dnl ========================================================
7051 dnl = This will enable logging of addref, release, ctor, dtor.
7052 dnl ========================================================
7053 _ENABLE_LOGREFCNT=42
7054 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7055 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7056     _ENABLE_LOGREFCNT=1,
7057     _ENABLE_LOGREFCNT= )
7058 if test "$_ENABLE_LOGREFCNT" = "1"; then
7059     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7060 elif test -z "$_ENABLE_LOGREFCNT"; then
7061     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7064 dnl ========================================================
7065 dnl moz_dump_painting
7066 dnl ========================================================
7067 MOZ_ARG_ENABLE_BOOL(dump-painting,
7068 [  --enable-dump-painting          Enable paint debugging.],
7069     MOZ_DUMP_PAINTING=1,
7070     MOZ_DUMP_PAINTING= )
7071 if test -n "$MOZ_DUMP_PAINTING"; then
7072     AC_DEFINE(MOZ_DUMP_PAINTING)
7073     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
7075 if test -n "$MOZ_DEBUG"; then
7076     AC_DEFINE(MOZ_DUMP_PAINTING)
7079 dnl ========================================================
7080 dnl = Enable trace malloc
7081 dnl ========================================================
7082 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7083 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7084 [  --enable-trace-malloc   Enable malloc tracing; also disables DMD and jemalloc],
7085     NS_TRACE_MALLOC=1,
7086     NS_TRACE_MALLOC= )
7087 if test "$NS_TRACE_MALLOC"; then
7088   # Please, Mr. Linker Man, don't take away our symbol names
7089   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7090   USE_ELF_DYNSTR_GC=
7091   AC_DEFINE(NS_TRACE_MALLOC)
7093 AC_SUBST(NS_TRACE_MALLOC)
7095 dnl ========================================================
7096 dnl = Enable DMD
7097 dnl ========================================================
7099 MOZ_ARG_ENABLE_BOOL(dmd,
7100 [  --enable-dmd            Enable DMD; also enables jemalloc and replace-malloc],
7101     MOZ_DMD=1,
7102     MOZ_DMD= )
7104 if test "$NS_TRACE_MALLOC"; then        # trace-malloc disables DMD
7105     MOZ_DMD=
7107 if test "$MOZ_DMD"; then
7108     USE_ELF_DYNSTR_GC=
7109     AC_DEFINE(MOZ_DMD)
7111     if test "${CPU_ARCH}" = "arm"; then
7112         CFLAGS="$CFLAGS -funwind-tables"
7113         CXXFLAGS="$CXXFLAGS -funwind-tables"
7114     fi
7116     MOZ_MEMORY=1                        # DMD enables jemalloc
7117     MOZ_REPLACE_MALLOC=1                # DMD enables replace-malloc
7119 AC_SUBST(MOZ_DMD)
7121 dnl ========================================================
7122 dnl = Enable jemalloc
7123 dnl ========================================================
7124 MOZ_ARG_ENABLE_BOOL(jemalloc,
7125 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7126     MOZ_MEMORY=1,
7127     MOZ_MEMORY=)
7129 if test "$NS_TRACE_MALLOC"; then
7130     MOZ_MEMORY=
7133 if test "${OS_TARGET}" = "Android"; then
7134   dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
7135   :
7136 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
7137   dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
7138   if test -z "$GNU_CC"; then
7139     MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7140   else
7141     MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
7142   fi
7143 else
7144   dnl On other Unix systems, we only want to link executables against mozglue
7145   MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7146   dnl On other Unix systems, where mozglue is a static library, jemalloc is
7147   dnl separated for the SDK, so we need to add it here.
7148   if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
7149     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
7150   fi
7151   MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
7152   if test -n "$GNU_CC"; then
7153     dnl And we need mozglue symbols to be exported.
7154     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
7155   fi
7156   if test "$MOZ_LINKER" = 1; then
7157     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
7158   fi
7161 dnl ========================================================
7162 dnl = Enable dynamic replacement of malloc implementation
7163 dnl ========================================================
7164 MOZ_ARG_ENABLE_BOOL(replace-malloc,
7165 [  --enable-replace-malloc   Enable ability to dynamically replace the malloc implementation],
7166     MOZ_REPLACE_MALLOC=1,
7167     MOZ_REPLACE_MALLOC= )
7169 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
7170     dnl We don't want to enable jemalloc unconditionally because it may be a
7171     dnl deliberate choice not to enable it (bug 702250, for instance)
7172     AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
7173 elif test -n "$MOZ_REPLACE_MALLOC"; then
7174     MOZ_NATIVE_JEMALLOC=
7176     dnl Replace-malloc Mac linkage quirks
7177     if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
7178         AC_CACHE_CHECK([how to do weak dynamic linking],
7179             ac_cv_weak_dynamic_linking,
7180             [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
7181              if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
7182                 test -s conftest${DLL_SUFFIX}; then
7183                  dnl There are several ways the linker can put link edit rules in a binary:
7184                  dnl - classic info only (for OSX < 10.6)
7185                  dnl - dyld info only
7186                  dnl - both
7187                  if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
7188                      _CLASSIC_INFO=
7189                  else
7190                      _CLASSIC_INFO=1
7191                  fi
7192                  if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
7193                      _DYLD_INFO=1
7194                  else
7195                      _DYLD_INFO=
7196                  fi
7197                  dnl With classic info, we need to build with -flat_namespace.
7198                  dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
7199                  dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
7200                  dnl forgets to set the weak flag in the dyld info.
7201                  dnl See http://glandium.org/blog/?p=2764 for more details.
7202                  dnl
7203                  dnl Values for ac_cv_weak_dynamic_linking, and subsequently
7204                  dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
7205                  dnl - "flat namespace" when -flat_namespace alone is needed
7206                  dnl - "dummy library" when a dummy library and -flat_namespace are needed
7207                  dnl - "compiler support" when nothing is needed
7208                  if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
7209                      if test -n "$_CLASSIC_INFO"; then
7210                          ac_cv_weak_dynamic_linking="flat namespace"
7211                      else
7212                          ac_cv_weak_dynamic_linking="compiler support"
7213                      fi
7214                  else
7215                      if test -n "$_DYLD_INFO"; then
7216                          ac_cv_weak_dynamic_linking="dummy library"
7217                      else
7218                          ac_cv_weak_dynamic_linking="flat namespace"
7219                      fi
7220                  fi
7221              else
7222                  AC_ERROR([couldn't compile a simple C file])
7223              fi
7224              rm -rf conftest*])
7225         MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
7226     fi
7228 AC_SUBST(MOZ_REPLACE_MALLOC)
7229 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
7231 dnl ========================================================
7232 dnl = Jemalloc build setup
7233 dnl ========================================================
7234 if test -z "$MOZ_MEMORY"; then
7235   if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
7236     MOZ_NATIVE_JEMALLOC=1
7237     AC_CHECK_FUNCS(mallctl nallocm,,
7238       [MOZ_NATIVE_JEMALLOC=
7239        break])
7240     if test -n "$MOZ_NATIVE_JEMALLOC"; then
7241       MOZ_MEMORY=1
7242       AC_DEFINE(MOZ_MEMORY)
7243       AC_DEFINE(MOZ_JEMALLOC3)
7244       AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7245     fi
7246   fi
7247   case "${target}" in
7248     *-mingw*)
7249       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7250         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.])
7251       fi
7252       ;;
7253   esac
7254 else
7255   dnl Don't try to run compiler tests on Windows
7256   if test "$OS_ARCH" = "WINNT"; then
7257     if test -z "$HAVE_64BIT_OS"; then
7258       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7259     else
7260       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7261     fi
7262   else
7263     AC_CHECK_SIZEOF([int *], [4])
7264     case "${ac_cv_sizeof_int_p}" in
7265     4)
7266       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7267       ;;
7268     8)
7269       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7270       ;;
7271     *)
7272       AC_MSG_ERROR([Unexpected pointer size])
7273       ;;
7274     esac
7275   fi
7277   AC_DEFINE(MOZ_MEMORY)
7278   if test -n "$MOZ_JEMALLOC3"; then
7279     AC_DEFINE(MOZ_JEMALLOC3)
7280   fi
7281   if test "x$MOZ_DEBUG" = "x1"; then
7282     AC_DEFINE(MOZ_MEMORY_DEBUG)
7283   fi
7284   dnl The generic feature tests that determine how to compute ncpus are long and
7285   dnl complicated.  Therefore, simply define special cpp variables for the
7286   dnl platforms we have special knowledge of.
7287   case "${target}" in
7288   *-darwin*)
7289     AC_DEFINE(MOZ_MEMORY_DARWIN)
7290     ;;
7291   *-*freebsd*)
7292     AC_DEFINE(MOZ_MEMORY_BSD)
7293     ;;
7294   *-android*|*-linuxandroid*)
7295     AC_DEFINE(MOZ_MEMORY_LINUX)
7296     AC_DEFINE(MOZ_MEMORY_ANDROID)
7297     if test -z "$gonkdir"; then
7298       _WRAP_MALLOC=1
7299     else
7300       AC_DEFINE(MOZ_MEMORY_GONK)
7301     fi
7302     MOZ_GLUE_LDFLAGS=
7303     ;;
7304   *-*linux*)
7305     AC_DEFINE(MOZ_MEMORY_LINUX)
7306     ;;
7307   *-netbsd*)
7308     AC_DEFINE(MOZ_MEMORY_BSD)
7309     ;;
7310   *-solaris*)
7311     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7312     ;;
7313   *-mingw*)
7314     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7315     if test -z "$MOZ_DEBUG"; then
7316       WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7317     else
7318       WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7319     fi
7320     dnl Look for a broken crtdll.obj
7321     WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7322     lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7323     if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7324       MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7325       dnl Also pass this to NSPR/NSS
7326       DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7327     else
7328       DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7329     fi
7330     rm crtdll.obj
7332     export DLLFLAGS
7333     ;;
7334   *)
7335     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7336     ;;
7337   esac
7338 fi # MOZ_MEMORY
7339 AC_SUBST(MOZ_MEMORY)
7340 AC_SUBST(MOZ_JEMALLOC3)
7341 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7342 AC_SUBST(MOZ_GLUE_LDFLAGS)
7343 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7344 AC_SUBST(WIN32_CRT_LIBS)
7345 dnl Need to set this for make because NSS doesn't have configure
7346 AC_SUBST(DLLFLAGS)
7348 dnl We need to wrap dlopen and related functions on Android because we use
7349 dnl our own linker.
7350 if test "$OS_TARGET" = Android; then
7351     WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7352     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7353     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7354     if test -z "$gonkdir"; then
7355         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7356         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"
7357     fi
7360 dnl ========================================================
7361 dnl = Use malloc wrapper lib
7362 dnl ========================================================
7363 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7364 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7365     _WRAP_MALLOC=1,
7366     _WRAP_MALLOC= )
7368 if test -n "$_WRAP_MALLOC"; then
7369     if test -n "$GNU_CC"; then
7370         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7371         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7372         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7373         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7374         dnl Wrap operator new and operator delete on Android.
7375         if test "$OS_TARGET" = "Android"; then
7376             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7377             dnl Wrap the nothrow variants too.
7378             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7379         fi
7380     else
7381         AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7382     fi
7385 dnl ========================================================
7386 dnl = Location of malloc wrapper lib
7387 dnl ========================================================
7388 MOZ_ARG_WITH_STRING(wrap-malloc,
7389 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7390     WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7392 dnl ========================================================
7393 dnl = Use JS Call tracing
7394 dnl ========================================================
7395 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7396 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7397     MOZ_TRACE_JSCALLS=1,
7398     MOZ_TRACE_JSCALLS= )
7399 if test -n "$MOZ_TRACE_JSCALLS"; then
7400     AC_DEFINE(MOZ_TRACE_JSCALLS)
7403 dnl ========================================================
7404 dnl = Use incremental GC
7405 dnl ========================================================
7406 JSGC_INCREMENTAL=1
7407 MOZ_ARG_DISABLE_BOOL(gcincremental,
7408 [  --disable-gcincremental Disable incremental GC],
7409     JSGC_INCREMENTAL= )
7410 if test -n "$JSGC_INCREMENTAL"; then
7411     AC_DEFINE(JSGC_INCREMENTAL)
7414 dnl ========================================================
7415 dnl ETW - Event Tracing for Windows
7416 dnl ========================================================
7417 MOZ_ARG_ENABLE_BOOL(ETW,
7418 [  --enable-ETW            Enable ETW (Event Tracing for Windows) event reporting],
7419     MOZ_ETW=1,
7420     MOZ_ETW= )
7421 if test -n "$MOZ_ETW"; then
7422     AC_DEFINE(MOZ_ETW)
7425 if test -n "$MOZ_ETW"; then
7426     if test -z "$MOZ_WINSDK_TARGETVER"; then
7427         AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7428     fi
7431 dnl ========================================================
7432 dnl Zealous JavaScript GC
7433 dnl ========================================================
7434 MOZ_ARG_ENABLE_BOOL(gczeal,
7435 [  --enable-gczeal         Enable zealous JavaScript GCing],
7436     JS_GC_ZEAL=1,
7437     JS_GC_ZEAL= )
7438 if test -n "$JS_GC_ZEAL"; then
7439     AC_DEFINE(JS_GC_ZEAL)
7442 dnl ========================================================
7443 dnl JS opt-mode assertions and minidump instrumentation
7444 dnl ========================================================
7445 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7446 [  --enable-js-diagnostics
7447                           Enable JS diagnostic assertions and breakpad data],
7448     JS_CRASH_DIAGNOSTICS=1,
7449     JS_CRASH_DIAGNOSTICS= )
7450 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7451     AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7454 MOZ_CHECK_CCACHE
7456 dnl ========================================================
7457 dnl = Enable static checking using gcc-dehydra
7458 dnl ========================================================
7460 MOZ_ARG_WITH_STRING(static-checking,
7461 [  --with-static-checking=path/to/gcc_dehydra.so
7462                           Enable static checking of code using GCC-dehydra],
7463     DEHYDRA_PATH=$withval,
7464     DEHYDRA_PATH= )
7466 if test -n "$DEHYDRA_PATH"; then
7467     if test ! -f "$DEHYDRA_PATH"; then
7468         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7469     fi
7470     AC_DEFINE(NS_STATIC_CHECKING)
7472 AC_SUBST(DEHYDRA_PATH)
7474 dnl ========================================================
7475 dnl = Enable stripping of libs & executables
7476 dnl ========================================================
7477 MOZ_ARG_ENABLE_BOOL(strip,
7478 [  --enable-strip          Enable stripping of libs & executables ],
7479     ENABLE_STRIP=1,
7480     ENABLE_STRIP= )
7482 dnl ========================================================
7483 dnl = Enable stripping of libs & executables when packaging
7484 dnl ========================================================
7485 MOZ_ARG_ENABLE_BOOL(install-strip,
7486 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7487     PKG_SKIP_STRIP= ,
7488     PKG_SKIP_STRIP=1)
7490 dnl ========================================================
7491 dnl = --enable-elf-dynstr-gc
7492 dnl ========================================================
7493 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7494 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7495     USE_ELF_DYNSTR_GC=1,
7496     USE_ELF_DYNSTR_GC= )
7498 dnl ========================================================
7499 dnl = --disable-elf-hack
7500 dnl ========================================================
7502 USE_ELF_HACK=1
7503 MOZ_ARG_DISABLE_BOOL(elf-hack,
7504 [  --disable-elf-hack      Disable elf hacks],
7505     USE_ELF_HACK=,
7506     USE_ELF_HACK=1)
7508 # Disable elf hack for profiling because the built in profiler
7509 # doesn't read the segments properly with elf hack. This is
7510 # temporary and should be fixed soon in the profiler.
7511 if test "$MOZ_PROFILING" = 1; then
7512   USE_ELF_HACK=
7515 # Only enable elfhack where supported
7516 if test "$USE_ELF_HACK" = 1; then
7517     case "${HOST_OS_ARCH},${OS_ARCH}" in
7518     Linux,Linux)
7519         case "${CPU_ARCH}" in
7520         arm | x86 | x86_64)
7521             USE_ELF_HACK=1
7522             ;;
7523         *)
7524             USE_ELF_HACK=
7525             ;;
7526         esac
7527         ;;
7528     *)
7529         USE_ELF_HACK=
7530         ;;
7531     esac
7534 if test "$USE_ELF_HACK" = 1; then
7535     dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7536     dnl memory addresses it maps to. The result is that by the time elfhack
7537     dnl kicks in, it is not possible to apply relocations because of that,
7538     dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7539     dnl segment. It makes elfhack mostly useless, so considering the problems
7540     dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7541     dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7542     dnl the linker creates PT_GNU_RELRO segments.
7543     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7544         LINK_WITH_PT_GNU_RELRO,
7545         [echo "int main() {return 0;}" > conftest.${ac_ext}
7546          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7547             test -s conftest${ac_exeext}; then
7548             if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7549                 LINK_WITH_PT_GNU_RELRO=yes
7550             else
7551                 LINK_WITH_PT_GNU_RELRO=no
7552             fi
7553          else
7554              dnl We really don't expect to get here, but just in case
7555              AC_ERROR([couldn't compile a simple C file])
7556          fi
7557          rm -rf conftest*])
7558     if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7559         AC_MSG_WARN([Disabling elfhack])
7560         USE_ELF_HACK=
7561     fi
7564 dnl ========================================================
7565 dnl = libstdc++ compatibility hacks
7566 dnl ========================================================
7568 STDCXX_COMPAT=
7569 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7570 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
7571     STDCXX_COMPAT=1)
7573 AC_SUBST(STDCXX_COMPAT)
7575 if test -n "$STDCXX_COMPAT"; then
7576    eval $(CXX="$CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7577    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7578    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7581 dnl ========================================================
7582 dnl =
7583 dnl = Profiling and Instrumenting
7584 dnl =
7585 dnl ========================================================
7586 MOZ_ARG_HEADER(Profiling and Instrumenting)
7588 dnl ========================================================
7589 dnl = Enable runtime visual profiling logger
7590 dnl ========================================================
7591 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7592 [  --enable-visual-event-tracer   Enable visual event tracer instrumentation],
7593     MOZ_VISUAL_EVENT_TRACER=1,
7594     MOZ_VISUAL_EVENT_TRACER=)
7595 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7596     AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7599 dnl ========================================================
7600 dnl Turn on reflow counting
7601 dnl ========================================================
7602 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7603 [  --enable-reflow-perf    Enable reflow performance tracing],
7604     MOZ_REFLOW_PERF=1,
7605     MOZ_REFLOW_PERF= )
7606 if test -n "$MOZ_REFLOW_PERF"; then
7607     AC_DEFINE(MOZ_REFLOW_PERF)
7610 dnl ========================================================
7611 dnl Enable code size metrics.
7612 dnl ========================================================
7613 MOZ_ARG_ENABLE_BOOL(codesighs,
7614 [  --enable-codesighs      Enable code size analysis tools],
7615     _ENABLE_CODESIGHS=1,
7616     _ENABLE_CODESIGHS= )
7617 if test -n "$_ENABLE_CODESIGHS"; then
7618     if test -d $srcdir/tools/codesighs; then
7619         MOZ_MAPINFO=1
7620     else
7621         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7622     fi
7625 dnl ========================================================
7626 dnl = Enable Radio Interface for B2G (Gonk usually)
7627 dnl ========================================================
7628 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7629 [  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7630     MOZ_B2G_RIL=1,
7631     MOZ_B2G_RIL= )
7632 if test -n "$MOZ_B2G_RIL"; then
7633     AC_DEFINE(MOZ_B2G_RIL)
7635 AC_SUBST(MOZ_B2G_RIL)
7637 dnl ========================================================
7638 dnl = Enable Radio FM for B2G (Gonk usually)
7639 dnl ========================================================
7640 if test -n "$MOZ_B2G_FM"; then
7641     AC_DEFINE(MOZ_B2G_FM)
7643 AC_SUBST(MOZ_B2G_FM)
7645 dnl ========================================================
7646 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7647 dnl ========================================================
7648 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7649 [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
7650     MOZ_B2G_BT=1,
7651     MOZ_B2G_BT= )
7652 if test -n "$MOZ_B2G_BT"; then
7653     AC_DEFINE(MOZ_B2G_BT)
7655 AC_SUBST(MOZ_B2G_BT)
7657 dnl ========================================================
7658 dnl = Enable Support for System Messages API
7659 dnl ========================================================
7660 if test -n "$MOZ_SYS_MSG"; then
7661     AC_DEFINE(MOZ_SYS_MSG)
7663 AC_SUBST(MOZ_SYS_MSG)
7665 dnl ========================================================
7666 dnl = Enable Support for Time Manager API
7667 dnl ========================================================
7668 if test -n "$MOZ_TIME_MANAGER"; then
7669     AC_DEFINE(MOZ_TIME_MANAGER)
7671 AC_SUBST(MOZ_TIME_MANAGER)
7673 dnl ========================================================
7674 dnl = Enable Camera Interface for B2G (Gonk usually)
7675 dnl ========================================================
7676 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7677 [  --enable-b2g-camera      Set compile flags necessary for compiling camera API for B2G ],
7678     MOZ_B2G_CAMERA=1,
7679     MOZ_B2G_CAMERA= )
7680 if test -n "$MOZ_B2G_CAMERA"; then
7681    AC_DEFINE(MOZ_B2G_CAMERA)
7683 AC_SUBST(MOZ_B2G_CAMERA)
7685 dnl ========================================================
7686 dnl = Enable Support B2G-specific changes to the NSS
7687 dnl = certificate trust database.
7688 dnl ========================================================
7689 if test -n "$MOZ_B2G_CERTDATA"; then
7690     AC_DEFINE(MOZ_B2G_CERTDATA)
7692 AC_SUBST(MOZ_B2G_CERTDATA)
7694 dnl ========================================================
7695 dnl = Enable Support for Payment API
7696 dnl ========================================================
7697 if test -n "$MOZ_PAY"; then
7698     AC_DEFINE(MOZ_PAY)
7700 AC_SUBST(MOZ_PAY)
7702 dnl ========================================================
7703 dnl = Enable Support for AudioChannelManager API
7704 dnl ========================================================
7705 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7706     AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7708 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7710 dnl ========================================================
7711 dnl = Support for demangling undefined symbols
7712 dnl ========================================================
7713 if test -z "$SKIP_LIBRARY_CHECKS"; then
7714     AC_LANG_SAVE
7715     AC_LANG_CPLUSPLUS
7716     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7717     AC_LANG_RESTORE
7720 # Demangle only for debug or trace-malloc or DMD builds
7721 MOZ_DEMANGLE_SYMBOLS=
7722 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7723     MOZ_DEMANGLE_SYMBOLS=1
7724     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7726 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7728 dnl ========================================================
7729 dnl = Support for gcc stack unwinding (from gcc 3.3)
7730 dnl ========================================================
7731 if test -z "$SKIP_LIBRARY_CHECKS"; then
7732     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7735 dnl ========================================================
7736 dnl JIT observers
7737 dnl ========================================================
7739 MOZ_ARG_WITH_STRING(jitreport-granularity,
7740 [  --jitreport-granularity=N
7741                            Default granularity at which to report JIT code
7742                            to external tools
7743                              0 - no info
7744                              1 - code ranges for whole functions only
7745                              2 - per-line information
7746                              3 - per-op information],
7747   JITREPORT_GRANULARITY=$withval,
7748   JITREPORT_GRANULARITY=3)
7750 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7752 dnl ========================================================
7753 dnl =
7754 dnl = Misc. Options
7755 dnl =
7756 dnl ========================================================
7757 MOZ_ARG_HEADER(Misc. Options)
7759 dnl ========================================================
7760 dnl update xterm title
7761 dnl ========================================================
7762 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7763 [  --enable-xterm-updates  Update XTERM titles with current command.],
7764     MOZ_UPDATE_XTERM=1,
7765     MOZ_UPDATE_XTERM= )
7767 dnl =========================================================
7768 dnl = Chrome format
7769 dnl =========================================================
7770 MOZ_ARG_ENABLE_STRING([chrome-format],
7771 [  --enable-chrome-format=jar|flat|both|symlink|omni
7772                           Select FORMAT of chrome files (default=jar)],
7773     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7775 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7776     MOZ_CHROME_FILE_FORMAT=jar
7779 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7780     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7781     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7782     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7783     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7784     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7787 dnl =========================================================
7788 dnl Omnijar packaging (bug 552121)
7789 dnl =========================================================
7790 dnl Omnijar packaging is compatible with flat packaging.
7791 dnl In unpackaged builds, omnijar looks for files as if
7792 dnl things were flat packaged. After packaging, all files
7793 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7794 dnl is set to flat since putting files into jars is only
7795 dnl done during packaging with omnijar.
7796 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7797     MOZ_OMNIJAR=1
7798     AC_DEFINE(MOZ_OMNIJAR)
7800 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7801 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7802     MOZ_CHROME_FILE_FORMAT=flat
7803 else
7804     MOZ_CHROME_FILE_FORMAT=symlink
7807 OMNIJAR_NAME=omni.ja
7808 AC_SUBST(OMNIJAR_NAME)
7809 AC_SUBST(MOZ_OMNIJAR)
7810 AC_SUBST(MOZ_PACKAGER_FORMAT)
7812 dnl ========================================================
7813 dnl = Define default location for MOZILLA_FIVE_HOME
7814 dnl ========================================================
7815 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7816 [  --with-default-mozilla-five-home
7817                           Set the default value for MOZILLA_FIVE_HOME],
7818 [ val=`echo $withval`
7819   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7821 dnl ========================================================
7822 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7823 dnl ========================================================
7824 MOZ_ARG_WITH_STRING(user-appdir,
7825 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7826 [ val=`echo $withval`
7827 if echo "$val" | grep "\/" >/dev/null; then
7828     AC_MSG_ERROR("Homedir must be single relative path.")
7829 else
7830     MOZ_USER_DIR="$val"
7831 fi])
7833 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7835 dnl ========================================================
7836 dnl = Doxygen configuration
7837 dnl ========================================================
7838 dnl Use commas to specify multiple dirs to this arg
7839 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7840 MOZ_ARG_WITH_STRING(doc-input-dirs,
7841 [  --with-doc-input-dirs=DIRS
7842                           Header/idl dirs to create docs from],
7843 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7844 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7846 dnl Use commas to specify multiple dirs to this arg
7847 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7848 MOZ_ARG_WITH_STRING(doc-include-dirs,
7849 [  --with-doc-include-dirs=DIRS
7850                           Include dirs to preprocess doc headers],
7851 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7852 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7854 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7855 MOZ_ARG_WITH_STRING(doc-output-dir,
7856 [  --with-doc-output-dir=DIR
7857                           Dir to generate docs into],
7858 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7859 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7861 if test -z "$SKIP_COMPILER_CHECKS"; then
7862 dnl ========================================================
7863 dnl =
7864 dnl = Compiler Options
7865 dnl =
7866 dnl ========================================================
7867 MOZ_ARG_HEADER(Compiler Options)
7869 dnl ========================================================
7870 dnl Check for gcc -pipe support
7871 dnl ========================================================
7872 AC_MSG_CHECKING([for -pipe support])
7873 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7874     dnl Any gcc that supports firefox supports -pipe.
7875     CFLAGS="$CFLAGS -pipe"
7876     CXXFLAGS="$CXXFLAGS -pipe"
7877     AC_MSG_RESULT([yes])
7878 else
7879     AC_MSG_RESULT([no])
7882 dnl ========================================================
7883 dnl Profile guided optimization (gcc checks)
7884 dnl ========================================================
7885 dnl Test for profiling options
7886 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7888 _SAVE_CFLAGS="$CFLAGS"
7889 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7891 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7892 AC_TRY_COMPILE([], [return 0;],
7893                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7894                  result="yes" ], result="no")
7895 AC_MSG_RESULT([$result])
7897 if test $result = "yes"; then
7898   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7899   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7900   PROFILE_USE_LDFLAGS="-fprofile-use"
7903 CFLAGS="$_SAVE_CFLAGS"
7905 if test -n "$INTEL_CC"; then
7906   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7907   PROFILE_GEN_LDFLAGS=
7908   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7909   PROFILE_USE_LDFLAGS=
7912 dnl Sun Studio on Solaris
7913 if test "$SOLARIS_SUNPRO_CC"; then
7914   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7915   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7916   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7917   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7920 AC_SUBST(PROFILE_GEN_CFLAGS)
7921 AC_SUBST(PROFILE_GEN_LDFLAGS)
7922 AC_SUBST(PROFILE_USE_CFLAGS)
7923 AC_SUBST(PROFILE_USE_LDFLAGS)
7925 AC_LANG_CPLUSPLUS
7927 dnl ========================================================
7928 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7929 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7930 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7931 dnl ========================================================
7932 _SAVE_CXXFLAGS=$CXXFLAGS
7933 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7934 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7935     ac_nscap_nonconst_opeq_bug,
7936     [AC_TRY_COMPILE([
7937                       template <class T>
7938                       class Pointer
7939                         {
7940                         public:
7941                           T* myPtr;
7942                         };
7944                       template <class T, class U>
7945                       int operator==(const Pointer<T>& rhs, U* lhs)
7946                         {
7947                           return rhs.myPtr == lhs;
7948                         }
7950                       template <class T, class U>
7951                       int operator==(const Pointer<T>& rhs, const U* lhs)
7952                         {
7953                           return rhs.myPtr == lhs;
7954                         }
7955                     ],
7956                     [
7957                       Pointer<int> foo;
7958                       const int* bar;
7959                       return foo == bar;
7960                     ],
7961                     ac_nscap_nonconst_opeq_bug="no",
7962                     ac_nscap_nonconst_opeq_bug="yes")])
7963 CXXFLAGS="$_SAVE_CXXFLAGS"
7965 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7966     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7968 fi # ! SKIP_COMPILER_CHECKS
7970 AC_DEFINE(CPP_THROW_NEW, [throw()])
7971 AC_LANG_C
7973 if test "$COMPILE_ENVIRONMENT"; then
7974 MOZ_EXPAND_LIBS
7975 fi # COMPILE_ENVIRONMENT
7977 dnl ========================================================
7978 dnl =
7979 dnl = Build depencency options
7980 dnl =
7981 dnl ========================================================
7982 MOZ_ARG_HEADER(Build dependencies)
7984 if test "$GNU_CC" -a "$GNU_CXX"; then
7985   _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
7986 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7987 elif test "$SOLARIS_SUNPRO_CC"; then
7988   _DEPEND_CFLAGS=
7989 else
7990   dnl Don't override this for MSVC
7991   if test -z "$_WIN32_MSVC"; then
7992     _USE_CPP_INCLUDE_FLAG=
7993     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7994     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7995   else
7996     echo '#include <stdio.h>' > dummy-hello.c
7997     changequote(,)
7998     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7999     changequote([,])
8000     if test -z "$CL_INCLUDES_PREFIX"; then
8001         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8002     fi
8003     AC_SUBST(CL_INCLUDES_PREFIX)
8004     rm -f dummy-hello.c
8005   fi
8008 dnl ========================================================
8009 dnl =
8010 dnl = Static Build Options
8011 dnl =
8012 dnl ========================================================
8013 MOZ_ARG_HEADER(Static build options)
8015 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8016 if test "$OS_ARCH" = "WINNT"; then
8017   ENABLE_SHARED_JS=1
8020 MOZ_ARG_ENABLE_BOOL(shared-js,
8021 [  --enable-shared-js
8022                           Create a shared JavaScript library.],
8023     ENABLE_SHARED_JS=1,
8024     ENABLE_SHARED_JS=)
8026 if test -n "$ENABLE_SHARED_JS"; then
8027   JS_SHARED_LIBRARY=1
8028   MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
8029 else
8030   MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
8031   AC_DEFINE(MOZ_STATIC_JS)
8033 AC_SUBST(JS_SHARED_LIBRARY)
8035 AC_SUBST(LIBXUL_LIBS)
8036 XPCOM_LIBS="$LIBXUL_LIBS"
8038 dnl ========================================================
8039 dnl =
8040 dnl = Standalone module options
8041 dnl =
8042 dnl ========================================================
8043 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8045 dnl Check for GLib.
8046 dnl ========================================================
8048 if test -z "$SKIP_PATH_CHECKS"; then
8049 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8050     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8051         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8052     fi
8056 if test -z "${GLIB_GMODULE_LIBS}" \
8057    -a -n "${GLIB_CONFIG}"\
8058     -a "${GLIB_CONFIG}" != no\
8059 ; then
8060     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8063 AC_SUBST(GLIB_CFLAGS)
8064 AC_SUBST(GLIB_LIBS)
8065 AC_SUBST(GLIB_GMODULE_LIBS)
8067 dnl ========================================================
8068 dnl Graphics checks.
8069 dnl ========================================================
8071 if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
8072 MOZ_ENABLE_SKIA=1
8073 else
8074 MOZ_ENABLE_SKIA=
8077 MOZ_ARG_ENABLE_BOOL(skia,
8078 [  --enable-skia   Enable use of Skia],
8079 MOZ_ENABLE_SKIA=1,
8080 MOZ_ENABLE_SKIA=)
8082 if test "$USE_FC_FREETYPE"; then
8083     if test "$COMPILE_ENVIRONMENT"; then
8084         dnl ========================================================
8085         dnl = Check for freetype2 and its functionality
8086         dnl ========================================================
8087         PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
8089         if test "$_HAVE_FREETYPE2"; then
8090             _SAVE_LIBS="$LIBS"
8091             _SAVE_CFLAGS="$CFLAGS"
8092             LIBS="$LIBS $FT2_LIBS"
8093             CFLAGS="$CFLAGS $FT2_CFLAGS"
8095             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
8096                 ac_cv_member_FT_Bitmap_Size_y_ppem,
8097                 [AC_TRY_COMPILE([#include <ft2build.h>
8098                                  #include FT_FREETYPE_H],
8099                                 [FT_Bitmap_Size s;
8100                                  if (sizeof s.y_ppem) return 0;
8101                                  return 1],
8102                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
8103                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
8104             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
8105                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
8106             else
8107                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
8108             fi
8109             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
8110                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
8111                                [FT_Bitmap_Size structure includes y_ppem field])
8113             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
8115             LIBS="$_SAVE_LIBS"
8116             CFLAGS="$_SAVE_CFLAGS"
8117         fi
8119         _SAVE_CPPFLAGS="$CPPFLAGS"
8120         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8121         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8122             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8123         CPPFLAGS="$_SAVE_CPPFLAGS"
8124     else
8125         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8126     fi
8128     PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
8129     [
8130         if test "$MOZ_PANGO"; then
8131             MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
8132             MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
8133         else
8134             FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
8135             FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
8136         fi
8137     ])
8140 dnl ========================================================
8141 dnl Check for pixman and cairo
8142 dnl ========================================================
8144 MOZ_TREE_CAIRO=1
8145 MOZ_ARG_ENABLE_BOOL(system-cairo,
8146 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8147 MOZ_TREE_CAIRO=,
8148 MOZ_TREE_CAIRO=1 )
8150 MOZ_TREE_PIXMAN=1
8151 MOZ_ARG_ENABLE_BOOL(system-pixman,
8152 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8153 MOZ_TREE_PIXMAN=,
8154 MOZ_TREE_PIXMAN=force,
8155 MOZ_TREE_PIXMAN=1 )
8157 # System cairo depends on system pixman
8158 if test "$MOZ_TREE_PIXMAN" = "force"; then
8159     if test -z "$MOZ_TREE_CAIRO"; then
8160         AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
8161     else
8162         MOZ_TREE_PIXMAN=1
8163     fi
8164 elif test -z "$MOZ_TREE_CAIRO"; then
8165     MOZ_TREE_PIXMAN=
8168 if test "$MOZ_TREE_PIXMAN"; then
8169     AC_DEFINE(MOZ_TREE_PIXMAN)
8170     MOZ_PIXMAN_CFLAGS=""
8171     MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8172 else
8173     PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8174     MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8175     MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8177 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8178 AC_SUBST(MOZ_PIXMAN_LIBS)
8180 # Check for headers defining standard int types.
8181 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8183 if test "$MOZ_TREE_CAIRO"; then
8184     MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8185     AC_DEFINE(MOZ_TREE_CAIRO)
8187     # For now we assume that we will have a uint64_t available through
8188     # one of the above headers or mozstdint.h.
8189     AC_DEFINE(HAVE_UINT64_T)
8191     # Define macros for cairo-features.h
8192     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8193     if test "$MOZ_X11"; then
8194         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8195         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8196         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8197         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8198         MOZ_ENABLE_CAIRO_FT=1
8199         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8200     fi
8201     case "$MOZ_WIDGET_TOOLKIT" in
8202       qt)
8203         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8204         ;;
8205       cocoa | uikit)
8206         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8207         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8208         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8209         ;;
8210       windows)
8211         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8212         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8213         if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8214             WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8215             WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8216             MOZ_ENABLE_D2D_SURFACE=1
8217             MOZ_ENABLE_DWRITE_FONT=1
8218         else
8219             WIN32_DWRITE_FONT_FEATURE=
8220             WIN32_D2D_SURFACE_FEATURE=
8221         fi
8223         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8225         dnl D3D10 Layers depend on D2D Surfaces.
8226         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8227           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8228         fi
8229         ;;
8230       os2)
8231         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8232         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8233         MOZ_ENABLE_CAIRO_FT=1
8234         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8235         CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8236         CAIRO_FT_LIBS=""
8237         ;;
8238     esac
8239     if test "$USE_FC_FREETYPE"; then
8240         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8241     fi
8242     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8243     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8244     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8245     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8246     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8247     AC_SUBST(CAIRO_FT_CFLAGS)
8249     AC_SUBST(PS_SURFACE_FEATURE)
8250     AC_SUBST(PDF_SURFACE_FEATURE)
8251     AC_SUBST(SVG_SURFACE_FEATURE)
8252     AC_SUBST(XLIB_SURFACE_FEATURE)
8253     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8254     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8255     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8256     AC_SUBST(WIN32_SURFACE_FEATURE)
8257     AC_SUBST(OS2_SURFACE_FEATURE)
8258     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8259     AC_SUBST(FT_FONT_FEATURE)
8260     AC_SUBST(FC_FONT_FEATURE)
8261     AC_SUBST(WIN32_FONT_FEATURE)
8262     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8263     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8264     AC_SUBST(QUARTZ_FONT_FEATURE)
8265     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8266     AC_SUBST(QT_SURFACE_FEATURE)
8267     AC_SUBST(TEE_SURFACE_FEATURE)
8269     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8270     MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8272     if test "$MOZ_X11"; then
8273         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8274     fi
8276     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8277 else
8278     PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8279     MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8280     MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8281     PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8282     if test "$MOZ_X11"; then
8283         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8284         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8285         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8286         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8287     fi
8290 AC_SUBST(MOZ_TREE_CAIRO)
8291 AC_SUBST(MOZ_CAIRO_CFLAGS)
8292 AC_SUBST(MOZ_CAIRO_LIBS)
8293 AC_SUBST(MOZ_CAIRO_OSLIBS)
8294 AC_SUBST(MOZ_TREE_PIXMAN)
8296 dnl ========================================================
8297 dnl qcms
8298 dnl ========================================================
8300 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8301 AC_SUBST(QCMS_LIBS)
8303 dnl ========================================================
8304 dnl HarfBuzz
8305 dnl ========================================================
8306 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8307 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8309 dnl ========================================================
8310 dnl SIL Graphite
8311 dnl ========================================================
8312 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8313 AC_SUBST(MOZ_GRAPHITE_LIBS)
8315 dnl ========================================================
8316 dnl OTS
8317 dnl ========================================================
8318 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8319 AC_SUBST(MOZ_OTS_LIBS)
8321 dnl ========================================================
8322 dnl Skia 
8323 dnl ========================================================
8324 if test "$MOZ_ENABLE_SKIA"; then
8325   MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8326   AC_DEFINE(MOZ_ENABLE_SKIA)
8327   AC_DEFINE(USE_SKIA)
8328   if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8329     AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8330   elif test "$OS_ARCH" = "WINNT"; then
8331     AC_DEFINE(SKIA_DLL)
8332     AC_DEFINE(GR_DLL)
8333   fi
8334 else
8335   MOZ_SKIA_LIBS=
8337 AC_SUBST(MOZ_ENABLE_SKIA)
8338 AC_SUBST(MOZ_SKIA_LIBS)
8340 dnl ========================================================
8341 dnl disable xul
8342 dnl ========================================================
8343 MOZ_ARG_DISABLE_BOOL(xul,
8344 [  --disable-xul           Disable XUL],
8345     MOZ_XUL= )
8346 if test "$MOZ_XUL"; then
8347   AC_DEFINE(MOZ_XUL)
8348 else
8349   dnl remove extensions that require XUL
8350   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8353 AC_SUBST(MOZ_XUL)
8355 dnl ========================================================
8356 dnl disable profile locking
8357 dnl   do no use this in applications that can have more than
8358 dnl   one process accessing the profile directory.
8359 dnl ========================================================
8360 MOZ_ARG_DISABLE_BOOL(profilelocking,
8361 [  --disable-profilelocking
8362                           Disable profile locking],
8363     MOZ_PROFILELOCKING=,
8364     MOZ_PROFILELOCKING=1 )
8365 if test "$MOZ_PROFILELOCKING"; then
8366   AC_DEFINE(MOZ_PROFILELOCKING)
8369 dnl ========================================================
8370 dnl necko configuration options
8371 dnl ========================================================
8374 dnl option to disable various necko protocols
8376 MOZ_ARG_ENABLE_STRING(necko-protocols,
8377 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8378                           Enable/disable specific protocol handlers],
8379 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8380     if test "$option" = "yes" -o "$option" = "all"; then
8381         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8382     elif test "$option" = "no" -o "$option" = "none"; then
8383         NECKO_PROTOCOLS=""
8384     elif test "$option" = "default"; then
8385         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8386     elif test `echo "$option" | grep -c \^-` != 0; then
8387         option=`echo $option | sed 's/^-//'`
8388         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8389     else
8390         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8391     fi
8392 done],
8393     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8394 dnl Remove dupes
8395 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8396 AC_SUBST(NECKO_PROTOCOLS)
8397 for p in $NECKO_PROTOCOLS; do
8398     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8399     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8400 done
8403 dnl option to disable necko's wifi scanner
8405 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8406 [  --disable-necko-wifi    Disable necko wifi scanner],
8407     NECKO_WIFI=,
8408     NECKO_WIFI=1)
8410 if test "$OS_ARCH" = "OS2"; then
8411   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8412   NECKO_WIFI=
8414 if test "$NECKO_WIFI" -a \
8415         "$OS_ARCH" != "Linux" -a \
8416         "$OS_ARCH" != "Darwin" -a \
8417         "$OS_ARCH" != "SunOS" -a \
8418         "$OS_ARCH" != "WINNT"; then
8419   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8422 if test "$NECKO_WIFI"; then
8423   AC_DEFINE(NECKO_WIFI)
8424   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8426 AC_SUBST(NECKO_WIFI)
8429 dnl option to disable cookies
8431 MOZ_ARG_DISABLE_BOOL(cookies,
8432 [  --disable-cookies       Disable cookie support],
8433     NECKO_COOKIES=,
8434     NECKO_COOKIES=1)
8435 AC_SUBST(NECKO_COOKIES)
8436 if test "$NECKO_COOKIES"; then
8437     AC_DEFINE(NECKO_COOKIES)
8438     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8442 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8444 MOZ_ARG_DISABLE_BOOL(ctypes,
8445 [  --disable-ctypes        Disable js-ctypes],
8446     BUILD_CTYPES=,
8447     BUILD_CTYPES=1)
8448 AC_SUBST(BUILD_CTYPES)
8449 if test "$BUILD_CTYPES"; then
8450     AC_DEFINE(BUILD_CTYPES)
8453 dnl Build Places if required
8454 if test "$MOZ_PLACES"; then
8455   AC_DEFINE(MOZ_PLACES)
8458 dnl Build Common JS modules provided by services.
8459 AC_SUBST(MOZ_SERVICES_COMMON)
8460 if test -n "$MOZ_SERVICES_COMMON"; then
8461   AC_DEFINE(MOZ_SERVICES_COMMON)
8464 dnl Build Services crypto component (used by Sync)
8465 AC_SUBST(MOZ_SERVICES_CRYPTO)
8466 if test -n "$MOZ_SERVICES_CRYPTO"; then
8467   AC_DEFINE(MOZ_SERVICES_CRYPTO)
8470 dnl Build Firefox Health Reporter Service
8471 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8472 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8473   AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8476 dnl Build Services metrics component
8477 AC_SUBST(MOZ_SERVICES_METRICS)
8478 if test -n "$MOZ_SERVICES_METRICS"; then
8479   AC_DEFINE(MOZ_SERVICES_METRICS)
8482 dnl Build Notifications if required
8483 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8484 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8485   AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8488 dnl Build Sync Services if required
8489 AC_SUBST(MOZ_SERVICES_SYNC)
8490 if test -n "$MOZ_SERVICES_SYNC"; then
8491   AC_DEFINE(MOZ_SERVICES_SYNC)
8494 dnl Build Captive Portal Detector if required
8495 AC_SUBST(MOZ_CAPTIVEDETECT)
8496 if test -n "$MOZ_CAPTIVEDETECT"; then
8497   AC_DEFINE(MOZ_CAPTIVEDETECT)
8500 dnl ========================================================
8501 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8502     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8505 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8506   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8509 if test "$MOZ_APP_COMPONENT_MODULES"; then
8510   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8513 dnl ========================================================
8514 dnl =
8515 dnl = Maintainer debug option (no --enable equivalent)
8516 dnl =
8517 dnl ========================================================
8519 AC_SUBST(AR)
8520 AC_SUBST(AR_FLAGS)
8521 AC_SUBST(AR_LIST)
8522 AC_SUBST(AR_EXTRACT)
8523 AC_SUBST(AR_DELETE)
8524 AC_SUBST(AS)
8525 AC_SUBST(ASFLAGS)
8526 AC_SUBST(AS_DASH_C_FLAG)
8527 AC_SUBST(LD)
8528 AC_SUBST(RC)
8529 AC_SUBST(RCFLAGS)
8530 AC_SUBST(MC)
8531 AC_SUBST(WINDRES)
8532 AC_SUBST(IMPLIB)
8533 AC_SUBST(FILTER)
8534 AC_SUBST(BIN_FLAGS)
8535 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8536 AC_SUBST(MOZ_UPDATE_XTERM)
8537 AC_SUBST(MOZ_PLATFORM_MAEMO)
8538 AC_SUBST(MOZ_AUTH_EXTENSION)
8539 AC_SUBST(MOZ_PERMISSIONS)
8540 AC_SUBST(MOZ_PREF_EXTENSIONS)
8541 AC_SUBST(MOZ_JS_LIBS)
8542 AC_SUBST(MOZ_PSM)
8543 AC_SUBST(MOZ_DEBUG)
8544 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8545 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8546 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8547 AC_SUBST(MOZ_DEBUG_FLAGS)
8548 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8549 AC_SUBST(WARNINGS_AS_ERRORS)
8550 AC_SUBST(MOZ_EXTENSIONS)
8551 AC_SUBST(MOZ_JSDEBUGGER)
8552 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8553 AC_SUBST(MOZ_JPROF)
8554 AC_SUBST(MOZ_SHARK)
8555 AC_SUBST(MOZ_INSTRUMENTS)
8556 AC_SUBST(MOZ_CALLGRIND)
8557 AC_SUBST(MOZ_VTUNE)
8558 AC_SUBST(MOZ_ETW)
8559 AC_SUBST(MOZ_PROFILING)
8560 AC_SUBST(LIBICONV)
8561 AC_SUBST(MOZ_PLACES)
8562 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8563 AC_SUBST(MOZ_FEEDS)
8564 AC_SUBST(NS_PRINTING)
8565 AC_SUBST(MOZ_WEBGL)
8566 AC_SUBST(MOZ_HELP_VIEWER)
8567 AC_SUBST(TOOLCHAIN_PREFIX)
8569 AC_SUBST(JAVA)
8570 AC_SUBST(JAVAC)
8571 AC_SUBST(JAVAH)
8572 AC_SUBST(JAR)
8574 AC_SUBST(MOZ_PROFILELOCKING)
8576 AC_SUBST(ENABLE_TESTS)
8577 AC_SUBST(ENABLE_MARIONETTE)
8578 AC_SUBST(IBMBIDI)
8579 AC_SUBST(MOZ_UNIVERSALCHARDET)
8580 AC_SUBST(ACCESSIBILITY)
8581 AC_SUBST(MOZ_SPELLCHECK)
8582 AC_SUBST(MOZ_ANDROID_OMTC)
8583 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8584 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8585 AC_SUBST(MOZ_CRASHREPORTER)
8586 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8587 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8588 AC_SUBST(MOZ_STUB_INSTALLER)
8589 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8590 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8591 AC_SUBST(MOZ_UPDATER)
8592 AC_SUBST(MOZ_ANGLE_RENDERER)
8593 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8594 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8595 AC_SUBST(MOZ_D3DX9_VERSION)
8596 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8597 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8598 AC_SUBST(MOZ_METRO)
8600 AC_SUBST(MOZ_ANDROID_HISTORY)
8601 AC_SUBST(MOZ_WEBSMS_BACKEND)
8602 AC_SUBST(ENABLE_STRIP)
8603 AC_SUBST(PKG_SKIP_STRIP)
8604 AC_SUBST(STRIP_FLAGS)
8605 AC_SUBST(USE_ELF_DYNSTR_GC)
8606 AC_SUBST(USE_ELF_HACK)
8607 AC_SUBST(INCREMENTAL_LINKER)
8608 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8609 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8611 AC_SUBST(MOZ_FIX_LINK_PATHS)
8612 AC_SUBST(XPCOM_LIBS)
8613 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8614 AC_SUBST(XPCOM_GLUE_LDOPTS)
8615 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8616 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8617 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8619 AC_SUBST(USE_DEPENDENT_LIBS)
8621 AC_SUBST(MOZ_BUILD_ROOT)
8622 AC_SUBST(MOZ_OS2_TOOLS)
8624 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8625 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8626 AC_SUBST(MOZ_LINKER_EXTRACT)
8628 AC_SUBST(MOZ_JSDOWNLOADS)
8630 if test -n "$MOZ_JSDOWNLOADS" ; then
8631     AC_DEFINE(MOZ_JSDOWNLOADS)
8634 dnl ========================================================
8635 dnl = Mac bundle name prefix
8636 dnl ========================================================
8637 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8638 [  --with-macbundlename-prefix=prefix
8639                           Prefix for MOZ_MACBUNDLE_NAME],
8640 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8642 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8643 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8644   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8647 if test "$MOZ_DEBUG"; then
8648   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8649 else
8650   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8652 AC_SUBST(MOZ_MACBUNDLE_NAME)
8654 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8655 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8656 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8657 if test "$MOZ_DEBUG"; then
8658   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8661 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8662 AC_SUBST(MOZ_MACBUNDLE_ID)
8664 # The following variables are available to branding and application
8665 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8666 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8667 # impacts profile location and user-visible fields.
8668 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8669 # versions of a given application (e.g. Aurora and Firefox both use
8670 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8671 # for application.ini's "Name" field, which controls profile location in
8672 # the absence of a "Profile" field (see below), and various system
8673 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8674 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8675 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8676 # builds (e.g. Aurora for Firefox).
8677 # - MOZ_APP_VERSION: Defines the application version number.
8678 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8679 # defaults to a lowercase form of MOZ_APP_BASENAME.
8680 # - MOZ_APP_PROFILE: When set, used for application.ini's
8681 # "Profile" field, which controls profile location.
8682 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8683 # crash reporter server url.
8684 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8685 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8687 if test -z "$MOZ_APP_NAME"; then
8688    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8691 # For extensions and langpacks, we require a max version that is compatible
8692 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8693 # 10.0a1 and 10.0a2 aren't affected
8694 # 10.0 becomes 10.0.*
8695 # 10.0.1 becomes 10.0.*
8696 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8697 if test -z "$IS_ALPHA"; then
8698   changequote(,)
8699   MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8700   changequote([,])
8701 else
8702   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8705 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8706 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8707 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8709 AC_SUBST(MOZ_APP_NAME)
8710 AC_SUBST(MOZ_APP_DISPLAYNAME)
8711 AC_SUBST(MOZ_APP_BASENAME)
8712 AC_SUBST(MOZ_APP_VENDOR)
8713 AC_SUBST(MOZ_APP_PROFILE)
8714 AC_SUBST(MOZ_APP_ID)
8715 AC_SUBST(MAR_CHANNEL_ID)
8716 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8717 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8718 AC_SUBST(MOZ_EXTENSION_MANAGER)
8719 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8720 AC_SUBST(MOZ_APP_UA_NAME)
8721 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8722 AC_SUBST(MOZ_APP_VERSION)
8723 AC_SUBST(MOZ_APP_MAXVERSION)
8724 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8725 AC_SUBST(FIREFOX_VERSION)
8726 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8727 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8728   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8730 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8731 AC_SUBST(MOZ_UA_BUILDID)
8733 AC_SUBST(MOZ_APP_STATIC_INI)
8735 AC_SUBST(MOZ_PKG_SPECIAL)
8737 AC_SUBST(MOZILLA_OFFICIAL)
8739 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8740 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8742 if test "$MOZ_TELEMETRY_REPORTING"; then
8743     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8745     # Enable Telemetry by default for nightly and aurora channels
8746     if test "$MOZ_UPDATE_CHANNEL" = "nightly" -o \
8747         "$MOZ_UPDATE_CHANNEL" = "aurora"; then
8748         AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8749     fi
8752 dnl If we have any service that uploads data (and requires data submission
8753 dnl policy alert), set MOZ_DATA_REPORTING.
8754 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8755 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8756   MOZ_DATA_REPORTING=1
8757   AC_DEFINE(MOZ_DATA_REPORTING)
8758   AC_SUBST(MOZ_DATA_REPORTING)
8761 dnl win32 options
8762 AC_SUBST(MOZ_MAPINFO)
8763 AC_SUBST(MOZ_BROWSE_INFO)
8764 AC_SUBST(MOZ_TOOLS_DIR)
8765 AC_SUBST(WIN32_REDIST_DIR)
8766 AC_SUBST(MAKENSISU)
8768 dnl Echo the CFLAGS to remove extra whitespace.
8769 CFLAGS=`echo \
8770         $_WARNINGS_CFLAGS \
8771         $CFLAGS`
8773 CXXFLAGS=`echo \
8774         $_WARNINGS_CXXFLAGS \
8775         $CXXFLAGS`
8777 COMPILE_CFLAGS=`echo \
8778     $_DEFINES_CFLAGS \
8779         $_DEPEND_CFLAGS \
8780     $COMPILE_CFLAGS`
8782 COMPILE_CXXFLAGS=`echo \
8783     $_DEFINES_CXXFLAGS \
8784         $_DEPEND_CFLAGS \
8785     $COMPILE_CXXFLAGS`
8787 AC_SUBST(SYSTEM_LIBXUL)
8788 AC_SUBST(MOZ_NATIVE_JPEG)
8789 AC_SUBST(MOZ_NATIVE_PNG)
8790 AC_SUBST(MOZ_NATIVE_BZ2)
8792 AC_SUBST(MOZ_FLEXBOX)
8793 AC_SUBST(MOZ_JPEG_CFLAGS)
8794 AC_SUBST(MOZ_JPEG_LIBS)
8795 AC_SUBST(MOZ_BZ2_CFLAGS)
8796 AC_SUBST(MOZ_BZ2_LIBS)
8797 AC_SUBST(MOZ_PNG_CFLAGS)
8798 AC_SUBST(MOZ_PNG_LIBS)
8800 AC_SUBST(NSPR_CFLAGS)
8801 AC_SUBST(NSPR_LIBS)
8802 AC_SUBST(MOZ_NATIVE_NSPR)
8804 AC_SUBST(NSS_CFLAGS)
8805 AC_SUBST(NSS_LIBS)
8806 AC_SUBST(NSS_DEP_LIBS)
8807 AC_SUBST(MOZ_NATIVE_NSS)
8808 AC_SUBST(NSS_DISABLE_DBM)
8810 OS_CFLAGS="$CFLAGS"
8811 OS_CXXFLAGS="$CXXFLAGS"
8812 OS_CPPFLAGS="$CPPFLAGS"
8813 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8814 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8815 OS_LDFLAGS="$LDFLAGS"
8816 OS_LIBS="$LIBS"
8817 AC_SUBST(OS_CFLAGS)
8818 AC_SUBST(OS_CXXFLAGS)
8819 AC_SUBST(OS_CPPFLAGS)
8820 AC_SUBST(OS_COMPILE_CFLAGS)
8821 AC_SUBST(OS_COMPILE_CXXFLAGS)
8822 AC_SUBST(OS_LDFLAGS)
8823 AC_SUBST(OS_LIBS)
8824 AC_SUBST(CROSS_COMPILE)
8825 AC_SUBST(WCHAR_CFLAGS)
8827 AC_SUBST(HOST_CC)
8828 AC_SUBST(HOST_CXX)
8829 AC_SUBST(HOST_CFLAGS)
8830 AC_SUBST(HOST_CXXFLAGS)
8831 AC_SUBST(HOST_LDFLAGS)
8832 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8833 AC_SUBST(HOST_AR)
8834 AC_SUBST(HOST_AR_FLAGS)
8835 AC_SUBST(HOST_LD)
8836 AC_SUBST(HOST_RANLIB)
8837 AC_SUBST(HOST_NSPR_MDCPUCFG)
8838 AC_SUBST(HOST_BIN_SUFFIX)
8839 AC_SUBST(HOST_OS_ARCH)
8841 AC_SUBST(TARGET_CPU)
8842 AC_SUBST(TARGET_VENDOR)
8843 AC_SUBST(TARGET_OS)
8844 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8845 AC_SUBST(TARGET_MD_ARCH)
8846 AC_SUBST(TARGET_XPCOM_ABI)
8847 AC_SUBST(OS_TARGET)
8848 AC_SUBST(OS_ARCH)
8849 AC_SUBST(OS_RELEASE)
8850 AC_SUBST(OS_TEST)
8851 AC_SUBST(CPU_ARCH)
8852 AC_SUBST(INTEL_ARCHITECTURE)
8854 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8856 AC_SUBST(WRAP_LDFLAGS)
8857 AC_SUBST(MKSHLIB)
8858 AC_SUBST(MKCSHLIB)
8859 AC_SUBST(MKSHLIB_FORCE_ALL)
8860 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8861 AC_SUBST(DSO_CFLAGS)
8862 AC_SUBST(DSO_PIC_CFLAGS)
8863 AC_SUBST(DSO_LDOPTS)
8864 AC_SUBST(LIB_PREFIX)
8865 AC_SUBST(DLL_PREFIX)
8866 AC_SUBST(DLL_SUFFIX)
8867 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8868 AC_SUBST(LIB_SUFFIX)
8869 AC_SUBST(OBJ_SUFFIX)
8870 AC_SUBST(BIN_SUFFIX)
8871 AC_SUBST(ASM_SUFFIX)
8872 AC_SUBST(IMPORT_LIB_SUFFIX)
8873 AC_SUBST(USE_N32)
8874 AC_SUBST(CC_VERSION)
8875 AC_SUBST(CXX_VERSION)
8876 AC_SUBST(MSMANIFEST_TOOL)
8877 AC_SUBST(NS_ENABLE_TSF)
8878 AC_SUBST(MOZ_NSS_PATCH)
8879 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8880 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8882 AC_SUBST(MOZ_MEDIA)
8883 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8884 AC_SUBST(MOZ_SOUNDTOUCH)
8885 AC_SUBST(MOZ_CUBEB)
8886 AC_SUBST(MOZ_WAVE)
8887 AC_SUBST(MOZ_VORBIS)
8888 AC_SUBST(MOZ_TREMOR)
8889 AC_SUBST(MOZ_OPUS)
8890 AC_SUBST(MOZ_WEBM)
8891 AC_SUBST(MOZ_WEBVTT)
8892 AC_SUBST(MOZ_DASH)
8893 AC_SUBST(MOZ_WMF)
8894 AC_SUBST(MOZ_MEDIA_PLUGINS)
8895 AC_SUBST(MOZ_OMX_PLUGIN)
8896 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8897 AC_SUBST(MOZ_VP8_ENCODER)
8898 AC_SUBST(MOZ_VP8)
8899 AC_SUBST(MOZ_OGG)
8900 AC_SUBST(VPX_AS)
8901 AC_SUBST(VPX_ASFLAGS)
8902 AC_SUBST(VPX_DASH_C_FLAG)
8903 AC_SUBST(VPX_AS_CONVERSION)
8904 AC_SUBST(VPX_ASM_SUFFIX)
8905 AC_SUBST(VPX_X86_ASM)
8906 AC_SUBST(VPX_ARM_ASM)
8907 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8908 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8909 AC_SUBST(LIBJPEG_TURBO_AS)
8910 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8911 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8912 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8913 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8915 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8916 AC_SUBST(MOZ_FOLD_LIBS)
8918 AC_MSG_CHECKING([for posix_fallocate])
8919 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8920   #include <fcntl.h>],
8921                  [posix_fallocate(0, 0, 0);],
8922                  [ac_cv___posix_fallocate=true],
8923                  [ac_cv___posix_fallocate=false])
8925 if test "$ac_cv___posix_fallocate" = true ; then
8926   AC_DEFINE(HAVE_POSIX_FALLOCATE)
8927   AC_MSG_RESULT(yes)
8928 else
8929   AC_MSG_RESULT(no)
8932 dnl Check for missing components
8933 if test "$COMPILE_ENVIRONMENT"; then
8934 if test "$MOZ_X11"; then
8935     if test "$WITHOUT_X11"; then
8936         AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8937     fi
8938     dnl ====================================================
8939     dnl = Check if X headers exist
8940     dnl ====================================================
8941     _SAVE_CFLAGS=$CFLAGS
8942     CFLAGS="$CFLAGS $XCFLAGS"
8943     AC_TRY_COMPILE([
8944         #include <stdio.h>
8945         #include <stdlib.h>
8946         #include <X11/Xlib.h>
8947         #include <X11/Intrinsic.h>
8948         #include <X11/extensions/XShm.h>
8949     ],
8950     [
8951         Display *dpy = 0;
8952         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8953             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8954             exit(1);
8955         }
8956     ], [],
8957     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8958     CFLAGS="$_SAVE_CFLAGS"
8960     if test -n "$MISSING_X"; then
8961         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8962     fi
8964 fi # MOZ_X11
8966 dnl Check for headers, etc. needed by WebGL.
8967 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8968     MOZ_CHECK_HEADER(GL/glx.h)
8969     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8970         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))])
8971     fi
8972 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8973 fi # COMPILE_ENVIRONMENT
8975 dnl Set various defines and substitutions
8976 dnl ========================================================
8978 if test "$OS_ARCH" = "Darwin"; then
8979   AC_DEFINE(XP_UNIX)
8980 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8981   AC_DEFINE(XP_UNIX)
8984 if test "$MOZ_DEBUG"; then
8985     AC_DEFINE(MOZ_REFLOW_PERF)
8986     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8989 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8990     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8991     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8992     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8993     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8994     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8995     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8996     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8997     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9000 AC_SUBST(MOZILLA_VERSION)
9002 AC_SUBST(ac_configure_args)
9004 dnl Spit out some output
9005 dnl ========================================================
9007 dnl The following defines are used by xpcom
9008 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9009 CPP_THROW_NEW
9010 HAVE_CPP_2BYTE_WCHAR_T
9011 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9012 HAVE_CPP_CHAR16_T
9013 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9014 HAVE_CPP_PARTIAL_SPECIALIZATION
9015 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9016 NEED_CPP_UNUSED_IMPLEMENTATIONS
9017 NEW_H
9018 HAVE_GETPAGESIZE
9019 HAVE_ICONV
9020 HAVE_ICONV_WITH_CONST_INPUT
9021 HAVE_MBRTOWC
9022 HAVE_WCRTOMB
9023 HAVE_STATVFS64
9024 HAVE_STATVFS
9025 HAVE_STATFS64
9026 HAVE_STATFS
9027 HAVE_SYS_STATVFS_H
9028 HAVE_SYS_STATFS_H
9029 HAVE_SYS_VFS_H
9030 HAVE_SYS_MOUNT_H
9033 # FUTURE? Consider moving all these to moz.build files.
9034 AC_CONFIG_HEADER(
9035 netwerk/necko-config.h
9036 xpcom/xpcom-config.h
9037 xpcom/xpcom-private.h
9040 AC_OUTPUT([mozilla-config.h])
9042 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
9043 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
9044 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
9045 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
9046 # (apparently) only need this hack when egrep's "pattern" is particularly long
9047 # (as in the following code) and the first egrep on our $PATH is Apple's.  See
9048 # bug 655339.
9049 case "$host" in
9050 *-apple-darwin11*)
9051     FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
9052     ;;
9054     FIXED_EGREP="egrep"
9055     ;;
9056 esac
9058 # target_arch is from {ia32|x64|arm|ppc}
9059 case "$CPU_ARCH" in
9060 x86_64 | ia64)
9061     WEBRTC_TARGET_ARCH=x64
9062     ;;
9064 arm*)
9065     WEBRTC_TARGET_ARCH=arm
9066     ;;
9068 x86)
9069     WEBRTC_TARGET_ARCH=ia32
9070     ;;
9072 ppc*)
9073     WEBRTC_TARGET_ARCH=ppc
9074     ;;
9076 # unsupported arch for webrtc
9077     WEBRTC_TARGET_ARCH=unknown
9078     MOZ_WEBRTC=
9079     ;;
9081 esac
9083 # Generate Makefiles for WebRTC directly from .gyp files
9084 if test "${OS_TARGET}" = "WINNT"; then
9085    if test "$HAVE_64BIT_OS"; then
9086       OS_BITS=64
9087    else
9088       OS_BITS=32
9089    fi
9090    EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
9092 elif test "${OS_TARGET}" = "Android"; then
9093    if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
9094       EXTRA_GYP_DEFINES="-G os=linux "
9095    else
9096       EXTRA_GYP_DEFINES="-D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
9097    fi
9100 if test -n "$ARM_ARCH"; then
9101     if test "$ARM_ARCH" -lt 7; then
9102         EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
9103     else
9104         if test "${OS_TARGET}" = "Android"; then
9105             EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=1 "
9106         else
9107             dnl CPU detection for ARM works on Android only.  armv7 always uses CPU detection, so
9108             dnl we have to set armv7=0 for non-Android target
9109             EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
9110         fi
9111     fi
9114 # Don't try to compile sse4.1 code if toolchain doesn't support
9115 if test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
9116   EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
9119 if test -n "$MOZ_WEBRTC"; then
9120    AC_MSG_RESULT("generating WebRTC Makefiles...")
9122    if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
9123       EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D build_with_gonk=1 -D include_internal_audio_device=0"
9124    fi
9126 dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
9127 dnl so that regeneration via dependencies works correctly
9128    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"
9130    if test -n HAVE_CLOCK_MONOTONIC; then
9131       WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=1"
9132    else
9133       WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=0"
9134    fi
9136    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}"
9138    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9139      $GYP_WEBRTC_OPTIONS \
9140      --generator-output=${_objdir}/media/webrtc/trunk \
9141      ${srcdir}/media/webrtc/trunk/peerconnection.gyp
9142    if test "$?" != 0; then
9143       AC_MSG_ERROR([failed to generate WebRTC Makefiles])
9144    fi
9146    # XXX disable until we land the tranche with signaling
9147    if test -n "$MOZ_WEBRTC_SIGNALING"; then
9148      AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
9149      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9150        $GYP_WEBRTC_OPTIONS \
9151        -D build_for_test=0 \
9152        --generator-output=${_objdir}/media/webrtc/signaling \
9153        ${srcdir}/media/webrtc/signaling/signaling.gyp
9154      if test "$?" != 0; then
9155         AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
9156      fi
9158      AC_MSG_RESULT("generating WebRTC/SignalingTest Makefiles...")
9159      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9160        $GYP_WEBRTC_OPTIONS \
9161        -D build_for_test=1 \
9162        --generator-output=${_objdir}/media/webrtc/signalingtest \
9163        ${srcdir}/media/webrtc/signaling/signaling.gyp
9164      if test "$?" != 0; then
9165        AC_MSG_ERROR([failed to generate WebRTC/SignalingTest Makefiles])
9166      fi
9167    fi
9169    AC_MSG_RESULT("generating gtest Makefiles...")
9170    # Ok to pass some extra -D's that are ignored here
9171    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9172      $GYP_WEBRTC_OPTIONS \
9173      --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
9174      ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
9175    if test "$?" != 0; then
9176       AC_MSG_ERROR([failed to generate gtest Makefiles])
9177    fi
9179    AC_MSG_RESULT("generating nrappkit Makefiles...")
9180    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9181      $GYP_WEBRTC_OPTIONS \
9182      --generator-output=${_objdir}/media/mtransport/third_party/nrappkit \
9183      ${srcdir}/media/mtransport/third_party/nrappkit/nrappkit.gyp
9184    if test "$?" != 0; then
9185       AC_MSG_ERROR([failed to generate nrappkit Makefiles])
9186    fi
9188    AC_MSG_RESULT("generating nICEr Makefiles...")
9189    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9190      $GYP_WEBRTC_OPTIONS \
9191      --generator-output=${_objdir}/media/mtransport/third_party/nICEr \
9192      ${srcdir}/media/mtransport/third_party/nICEr/nicer.gyp
9193    if test "$?" != 0; then
9194       AC_MSG_ERROR([failed to generate nICEr Makefiles])
9195    fi
9198 # Generate a JSON config file for unittest harnesses etc to read
9199 # build configuration details from in a standardized way.
9200 OS_TARGET=${OS_TARGET} \
9201 TARGET_CPU=${TARGET_CPU} \
9202 MOZ_DEBUG=${MOZ_DEBUG} \
9203 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} \
9204 UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
9205 MOZ_CRASHREPORTER=${MOZ_CRASHREPORTER} \
9206 MOZ_APP_NAME=${MOZ_APP_NAME} \
9207 TOPSRCDIR=${_topsrcdir} \
9208   $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
9209 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
9210   rm ./mozinfo.json.tmp
9211 else
9212   mv -f ./mozinfo.json.tmp ./mozinfo.json
9215 # Run jemalloc configure script
9217 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
9218   ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
9219   if test -n "$MOZ_REPLACE_MALLOC"; then
9220     # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9221     ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9222     ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9223   fi
9224   if test -n "$MOZ_JEMALLOC3"; then
9225     case "${OS_ARCH}" in
9226       WINNT|Darwin)
9227         # We want jemalloc functions to be kept hidden on both Mac and Windows
9228         # See memory/build/mozmemory_wrap.h for details.
9229         ac_configure_args="$ac_configure_args --without-export"
9230         ;;
9231     esac
9232   elif test "${OS_ARCH}" = Darwin; then
9233     # When building as a replace-malloc lib, disabling the zone allocator
9234     # forces to use pthread_atfork.
9235     ac_configure_args="$ac_configure_args --disable-zone-allocator"
9236   fi
9237   _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9238   JEMALLOC_WRAPPER=
9239   if test -z "$MOZ_REPLACE_MALLOC"; then
9240     case "$OS_ARCH" in
9241       Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9242         MANGLE=$_MANGLE
9243         ;;
9244     esac
9245   elif test -z "$MOZ_JEMALLOC3"; then
9246     MANGLE=$_MANGLE
9247     JEMALLOC_WRAPPER=replace_
9248   fi
9249   if test -n "$MANGLE"; then
9250     MANGLED=
9251     if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
9252       JEMALLOC_WRAPPER=__wrap_
9253     fi
9254     for mangle in ${MANGLE}; do
9255       if test -n "$MANGLED"; then
9256         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9257       else
9258         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9259       fi
9260     done
9261     ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9262   fi
9263   unset CONFIG_FILES
9264   if test -z "$MOZ_TLS"; then
9265     ac_configure_args="$ac_configure_args --disable-tls"
9266   fi
9267   EXTRA_CFLAGS="$CFLAGS"
9268   for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9269     ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9270   done
9271   if test "$CROSS_COMPILE"; then
9272     ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9273   fi
9274   _save_cache_file="$cache_file"
9275   cache_file=$_objdir/memory/jemalloc/src/config.cache
9277   if ! test -e memory/jemalloc; then
9278     mkdir -p memory/jemalloc
9279   fi
9281   AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9282   cache_file="$_save_cache_file"
9283   ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9286 # Run freetype configure script
9288 if test "$MOZ_TREE_FREETYPE"; then
9289    export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9290    export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9291    export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9292    export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9293    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9294    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9296    if ! test -e modules; then
9297      mkdir modules
9298    fi
9300    AC_OUTPUT_SUBDIRS(modules/freetype2)
9303 if test -z "$direct_nspr_config"; then
9304     dnl ========================================================
9305     dnl = Setup a nice relatively clean build environment for
9306     dnl = sub-configures.
9307     dnl ========================================================
9308     CC="$_SUBDIR_CC"
9309     CXX="$_SUBDIR_CXX"
9310     CFLAGS="$_SUBDIR_CFLAGS"
9311     CPPFLAGS="$_SUBDIR_CPPFLAGS"
9312     CXXFLAGS="$_SUBDIR_CXXFLAGS"
9313     LDFLAGS="$_SUBDIR_LDFLAGS"
9314     HOST_CC="$_SUBDIR_HOST_CC"
9315     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9316     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9317     RC=
9320 unset MAKEFILES
9321 unset CONFIG_FILES
9323 # Run all configure scripts specified by a subconfigure
9324 if test -n "$_subconfigure_subdir"; then
9325   _save_ac_configure_args="$ac_configure_args"
9326   ac_configure_args="$_subconfigure_config_args"
9327   AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
9328   ac_configure_args="$_save_ac_configure_args"
9331 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9332 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9334 export WRAP_LDFLAGS
9336 if test -n "$_WRAP_MALLOC"; then
9337     # Avoid doubling wrap malloc arguments
9338     _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9341 if test -z "$MOZ_NATIVE_NSPR"; then
9342     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla --with-android-version=$ANDROID_VERSION"
9343     if test -z "$MOZ_DEBUG"; then
9344         ac_configure_args="$ac_configure_args --disable-debug"
9345     else
9346         ac_configure_args="$ac_configure_args --enable-debug"
9347     fi
9348     if test "$MOZ_OPTIMIZE" = "1"; then
9349         ac_configure_args="$ac_configure_args --enable-optimize"
9350     elif test -z "$MOZ_OPTIMIZE"; then
9351         ac_configure_args="$ac_configure_args --disable-optimize"
9352     fi
9353     if test -n "$HAVE_64BIT_OS"; then
9354         ac_configure_args="$ac_configure_args --enable-64bit"
9355     fi
9356     if test -n "$USE_ARM_KUSER"; then
9357         ac_configure_args="$ac_configure_args --with-arm-kuser"
9358     fi
9359     ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9360     if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9361       # dladdr is supported by the new linker, even when the system linker doesn't
9362       # support it. Trick nspr into using dladdr when it's not supported.
9363       _SAVE_CPPFLAGS="$CPPFLAGS"
9364       export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9365     fi
9366     _SAVE_LDFLAGS="$LDFLAGS"
9367     export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9368     AC_OUTPUT_SUBDIRS(nsprpub)
9369     LDFLAGS="$_SAVE_LDFLAGS"
9370     if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no; then
9371       unset CPPFLAGS
9372       CPPFLAGS="$_SAVE_CFLAGS"
9373     fi
9374     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9377 dnl ========================================================
9378 dnl = Setup a nice relatively clean build environment for
9379 dnl = sub-configures.
9380 dnl ========================================================
9381 CC="$_SUBDIR_CC"
9382 CXX="$_SUBDIR_CXX"
9383 CFLAGS="$_SUBDIR_CFLAGS"
9384 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9385 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9386 LDFLAGS="$_SUBDIR_LDFLAGS"
9387 HOST_CC="$_SUBDIR_HOST_CC"
9388 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9389 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9392 # Run the SpiderMonkey 'configure' script.
9393 dist=$MOZ_BUILD_ROOT/dist
9394 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9395 ac_configure_args="$ac_configure_args --enable-threadsafe"
9396 if test "$BUILD_CTYPES"; then
9397     # Build js-ctypes on the platforms we can.
9398     ac_configure_args="$ac_configure_args --enable-ctypes"
9400 if test -z "$JS_SHARED_LIBRARY" ; then
9401     ac_configure_args="$ac_configure_args --disable-shared-js"
9403 if test -z "$MOZ_NATIVE_NSPR"; then
9404     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9405     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9407 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9408 ac_configure_args="$ac_configure_args --prefix=$dist"
9409 if test "$MOZ_MEMORY"; then
9410    ac_configure_args="$ac_configure_args --enable-jemalloc"
9412 if test -n "$MOZ_GLUE_LDFLAGS"; then
9413    export MOZ_GLUE_LDFLAGS
9415 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9416    export MOZ_GLUE_PROGRAM_LDFLAGS
9418 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9419    MOZ_ZLIB_LIBS=
9421 export MOZ_NATIVE_ZLIB
9422 export MOZ_ZLIB_CFLAGS
9423 export MOZ_ZLIB_LIBS
9424 export MOZ_APP_NAME
9425 export DONT_POPULATE_VIRTUALENV=1
9426 export PYTHON
9427 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9428 export STLPORT_CPPFLAGS
9429 export STLPORT_LDFLAGS
9430 export STLPORT_LIBS
9431 export JS_STANDALONE=no
9433 if ! test -e js; then
9434     mkdir js
9437 AC_OUTPUT_SUBDIRS(js/src)
9438 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9440 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR