Bug 730765 - Media cache shouldn't be used when loading from blob: urls. r=biesi
[gecko.git] / configure.in
blob2cd8e3e7deb8ec21330528db1184377e60894513
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl This Source Code Form is subject to the terms of the Mozilla Public
4 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
5 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 dnl Process this file with autoconf to produce a configure script.
8 dnl ========================================================
10 AC_PREREQ(2.13)
11 AC_INIT(config/config.mk)
12 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
13 AC_CANONICAL_SYSTEM
14 TARGET_CPU="${target_cpu}"
15 TARGET_VENDOR="${target_vendor}"
16 TARGET_OS="${target_os}"
18 MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1`
19 AC_SUBST(MOZ_DEB_TIMESTAMP)
21 dnl ========================================================
22 dnl =
23 dnl = Don't change the following two lines.  Doing so breaks:
24 dnl =
25 dnl = CFLAGS="-foo" ./configure
26 dnl =
27 dnl ========================================================
28 CFLAGS="${CFLAGS=}"
29 CPPFLAGS="${CPPFLAGS=}"
30 CXXFLAGS="${CXXFLAGS=}"
31 LDFLAGS="${LDFLAGS=}"
32 HOST_CFLAGS="${HOST_CFLAGS=}"
33 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
34 HOST_LDFLAGS="${HOST_LDFLAGS=}"
36 dnl ========================================================
37 dnl = Preserve certain environment flags passed to configure
38 dnl = We want sub projects to receive the same flags
39 dnl = untainted by this configure script
40 dnl ========================================================
41 _SUBDIR_CC="$CC"
42 _SUBDIR_CXX="$CXX"
43 _SUBDIR_CFLAGS="$CFLAGS"
44 _SUBDIR_CPPFLAGS="$CPPFLAGS"
45 _SUBDIR_CXXFLAGS="$CXXFLAGS"
46 _SUBDIR_LDFLAGS="$LDFLAGS"
47 _SUBDIR_HOST_CC="$HOST_CC"
48 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
49 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
50 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
51 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
53 dnl Set the version number of the libs included with mozilla
54 dnl ========================================================
55 MOZJPEG=62
56 MOZPNG=10511
57 NSPR_VERSION=4
58 NSS_VERSION=3
60 dnl Set the minimum version of toolkit libs used by mozilla
61 dnl ========================================================
62 GLIB_VERSION=1.2.0
63 PERL_VERSION=5.006
64 PYTHON_VERSION=2.5
65 CAIRO_VERSION=1.10
66 PANGO_VERSION=1.14.0
67 GTK2_VERSION=2.10.0
68 WINDRES_VERSION=2.14.90
69 W32API_VERSION=3.14
70 GNOMEVFS_VERSION=2.0
71 GNOMEUI_VERSION=2.2.0
72 GCONF_VERSION=1.2.1
73 GIO_VERSION=2.18
74 STARTUP_NOTIFICATION_VERSION=0.8
75 DBUS_VERSION=0.60
76 SQLITE_VERSION=3.7.13
77 LIBNOTIFY_VERSION=0.4
79 MSMANIFEST_TOOL=
81 dnl Set various checks
82 dnl ========================================================
83 MISSING_X=
84 AC_PROG_AWK
86 dnl Initialize the Pthread test variables early so they can be
87 dnl  overridden by each platform.
88 dnl ========================================================
89 USE_PTHREADS=
90 _PTHREAD_LDFLAGS=""
92 dnl Do not allow a separate objdir build if a srcdir build exists.
93 dnl ==============================================================
94 _topsrcdir=`cd \`dirname $0\`; pwd`
95 _objdir=`pwd`
97 if test "$_topsrcdir" != "$_objdir"
98 then
99   # Check for a couple representative files in the source tree
100   _conflict_files=
101   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
102     if test -f $file; then
103       _conflict_files="$_conflict_files $file"
104     fi
105   done
106   if test "$_conflict_files"; then
107     echo "***"
108     echo "*   Your source tree contains these files:"
109     for file in $_conflict_files; do
110       echo "*         $file"
111     done
112     cat 1>&2 <<-EOF
113         *   This indicates that you previously built in the source tree.
114         *   A source tree build can confuse the separate objdir build.
115         *
116         *   To clean up the source tree:
117         *     1. cd $_topsrcdir
118         *     2. gmake distclean
119         ***
120         EOF
121     exit 1
122     break
123   fi
125 MOZ_BUILD_ROOT=`pwd`
127 MOZ_DEFAULT_COMPILER
129 COMPILE_ENVIRONMENT=1
130 MOZ_ARG_DISABLE_BOOL(compile-environment,
131 [  --disable-compile-environment
132                           Disable compiler/library checks.],
133     COMPILE_ENVIRONMENT= )
134 AC_SUBST(COMPILE_ENVIRONMENT)
136 MOZ_ARG_WITH_STRING(l10n-base,
137 [  --with-l10n-base=DIR    path to l10n repositories],
138     L10NBASEDIR=$withval)
139 if test -n "$L10NBASEDIR"; then
140     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
141         AC_MSG_ERROR([--with-l10n-base must specify a path])
142     elif test -d "$L10NBASEDIR"; then
143         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
144     else
145         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
146     fi
148 AC_SUBST(L10NBASEDIR)
150 dnl Check for Perl first -- needed for win32 SDK checks
151 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
152 if test -z "$PERL" -o "$PERL" = ":"; then
153     AC_MSG_ERROR([perl not found in \$PATH])
156 MOZ_ARG_WITH_STRING(gonk,
157 [  --with-gonk=DIR
158                location of gonk dir],
159     gonkdir=$withval)
161 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
162 [  --with-gonk-toolchain-prefix=DIR
163                           prefix to gonk toolchain commands],
164     gonk_toolchain_prefix=$withval)
166 if test -n "$gonkdir" ; then
167     kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
168     android_source="$gonkdir"
169     ANDROID_SOURCE="$android_source"
170     ANDROID_NDK="${ANDROID_SOURCE}/ndk"
172     dnl set up compilers
173     TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
174     AS="$gonk_toolchain_prefix"as
175     CC="$gonk_toolchain_prefix"gcc
176     CXX="$gonk_toolchain_prefix"g++
177     CPP="$gonk_toolchain_prefix"cpp
178     LD="$gonk_toolchain_prefix"ld
179     AR="$gonk_toolchain_prefix"ar
180     RANLIB="$gonk_toolchain_prefix"ranlib
181     STRIP="$gonk_toolchain_prefix"strip
183     STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/"
184     STLPORT_LIBS="-lstlport"
186     case "$target_cpu" in
187     arm)
188         ARCH_DIR=arch-arm
189         ;;
190     i?86)
191         ARCH_DIR=arch-x86
192         ;;
193     esac
195     CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice -I$gonkdir/frameworks/base/services/camera"
196     CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
197     CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
198     dnl Add -llog by default, since we use it all over the place.
199     LIBS="$LIBS -llog $STLPORT_LIBS"
201     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"
203     dnl prevent cross compile section from using these flags as host flags
204     if test -z "$HOST_CPPFLAGS" ; then
205         HOST_CPPFLAGS=" "
206     fi
207     if test -z "$HOST_CFLAGS" ; then
208         HOST_CFLAGS=" "
209     fi
210     if test -z "$HOST_CXXFLAGS" ; then
211         HOST_CXXFLAGS=" "
212     fi
213     if test -z "$HOST_LDFLAGS" ; then
214         HOST_LDFLAGS=" "
215     fi
217     AC_DEFINE(ANDROID)
218     AC_DEFINE(HAVE_SYS_UIO_H)
219     AC_DEFINE(HAVE_PTHREADS)
220     CROSS_COMPILE=1
221     MOZ_CHROME_FILE_FORMAT=omni
222     direct_nspr_config=1
223 else
224     MOZ_ANDROID_NDK
226     case "$target" in
227     *-android*|*-linuxandroid*)
228         if test -z "$ANDROID_PACKAGE_NAME" ; then
229             ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
230         fi
231         MOZ_CHROME_FILE_FORMAT=omni
232         ZLIB_DIR=yes
233         ;;
234     *-linux*)
235         AC_PATH_PROG(OBJCOPY,objcopy)
236         ;;
237     esac
240 AC_SUBST(ANDROID_SOURCE)
241 AC_SUBST(ANDROID_PACKAGE_NAME)
242 AC_SUBST(OBJCOPY)
244 dnl ========================================================
245 dnl Checks for compilers.
246 dnl ========================================================
247 dnl Set CROSS_COMPILE in the environment when running configure
248 dnl to use the cross-compile setup for now
249 dnl ========================================================
251 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
252 AR_FLAGS='cr $@'
254 if test "$COMPILE_ENVIRONMENT"; then
256 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
257     echo "cross compiling from $host to $target"
258     cross_compiling=yes
260     _SAVE_CC="$CC"
261     _SAVE_CFLAGS="$CFLAGS"
262     _SAVE_LDFLAGS="$LDFLAGS"
264     AC_MSG_CHECKING([for host c compiler])
265     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
266     if test -z "$HOST_CC"; then
267         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
268     fi
269     AC_MSG_RESULT([$HOST_CC])
270     AC_MSG_CHECKING([for host c++ compiler])
271     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
272     if test -z "$HOST_CXX"; then
273         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
274     fi
275     AC_MSG_RESULT([$HOST_CXX])
277     if test -z "$HOST_CFLAGS"; then
278         HOST_CFLAGS="$CFLAGS"
279     fi
280     if test -z "$HOST_CXXFLAGS"; then
281         HOST_CXXFLAGS="$CXXFLAGS"
282     fi
283     if test -z "$HOST_LDFLAGS"; then
284         HOST_LDFLAGS="$LDFLAGS"
285     fi
286     if test -z "$HOST_AR_FLAGS"; then
287         HOST_AR_FLAGS="$AR_FLAGS"
288     fi
289     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
290     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
291     CC="$HOST_CC"
292     CFLAGS="$HOST_CFLAGS"
293     LDFLAGS="$HOST_LDFLAGS"
295     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
296     AC_TRY_COMPILE([], [return(0);],
297         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
298         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
300     CC="$HOST_CXX"
301     CFLAGS="$HOST_CXXFLAGS"
303     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
304     AC_TRY_COMPILE([], [return(0);],
305         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
306         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
308     CC=$_SAVE_CC
309     CFLAGS=$_SAVE_CFLAGS
310     LDFLAGS=$_SAVE_LDFLAGS
312     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
313     unset ac_cv_prog_CC
314     AC_PROG_CC
315     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
316     unset ac_cv_prog_CXX
317     AC_PROG_CXX
319     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
320     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
321     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
322     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
323     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
324     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
325     AC_DEFINE(CROSS_COMPILE)
326 else
327     AC_PROG_CC
328     case "$target" in
329     *-mingw*)
330       # Work around the conftest.exe access problem on Windows
331       sleep 2
332     esac
333     AC_PROG_CXX
334     AC_PROG_RANLIB
335     MOZ_PATH_PROGS(AS, $AS as, $CC)
336     AC_CHECK_PROGS(AR, ar, :)
337     AC_CHECK_PROGS(LD, ld, :)
338     AC_CHECK_PROGS(STRIP, strip, :)
339     AC_CHECK_PROGS(WINDRES, windres, :)
340     if test -z "$HOST_CC"; then
341         HOST_CC="$CC"
342     fi
343     if test -z "$HOST_CFLAGS"; then
344         HOST_CFLAGS="$CFLAGS"
345     fi
346     if test -z "$HOST_CXX"; then
347         HOST_CXX="$CXX"
348     fi
349     if test -z "$HOST_CXXFLAGS"; then
350         HOST_CXXFLAGS="$CXXFLAGS"
351     fi
352     if test -z "$HOST_LDFLAGS"; then
353         HOST_LDFLAGS="$LDFLAGS"
354     fi
355     if test -z "$HOST_RANLIB"; then
356         HOST_RANLIB="$RANLIB"
357     fi
358     if test -z "$HOST_AR"; then
359         HOST_AR="$AR"
360     fi
361     if test -z "$HOST_AR_FLAGS"; then
362         HOST_AR_FLAGS="$AR_FLAGS"
363     fi
366 if test -n "$MOZ_WINCONSOLE"; then
367     AC_DEFINE(MOZ_WINCONSOLE)
370 MOZ_TOOL_VARIABLES
372 dnl ========================================================
373 dnl Special win32 checks
374 dnl ========================================================
376 # With win8, sdk target=602, WINVER=602
377 MOZ_ARG_ENABLE_BOOL(metro,
378 [  --enable-metro           Enable Windows Metro build targets],
379     MOZ_METRO=1,
380     MOZ_METRO=)
381 if test -n "$MOZ_METRO"; then
382     AC_DEFINE(MOZ_METRO)
383     # Target the Windows 8 Kit
384     WINSDK_TARGETVER=602
385     # Allow a higher api set
386     WINVER=602
387     # toolkit/library/makefile.in needs these, see nsDllMain.
388     CRTDLLVERSION=110
389     CRTEXPDLLVERSION=1-1-0
390 else
391     # Target the Windows 7 SDK by default
392     WINSDK_TARGETVER=601
393     WINVER=502
396 AC_SUBST(CRTDLLVERSION)
397 AC_SUBST(CRTEXPDLLVERSION)
399 if test -n "$MOZ_METRO"; then
400   case "$target" in
401   *-mingw*)
402     ;;
403   *)
404     AC_MSG_ERROR([Metro builds only valid on the windows platform.]);
405     ;;
406   esac
409 MOZ_ARG_WITH_STRING(windows-version,
410 [  --with-windows-version=WINSDK_TARGETVER
411                           Windows SDK version to target. Lowest version
412                           currently allowed is 601 (Win7), highest is 602 (Win8)],
413   WINSDK_TARGETVER=$withval)
415 # Currently only two sdk versions allowed, 601 and 602
416 case "$WINSDK_TARGETVER" in
417 601|602)
418     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
419     ;;
422     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
423     ;;
424 esac
426 case "$target" in
427 *-mingw*)
428     if test "$GCC" != "yes"; then
429         # Check to see if we are really running in a msvc environemnt
430         _WIN32_MSVC=1
431         AC_CHECK_PROGS(MIDL, midl)
433         # Make sure compilers are valid
434         CFLAGS="$CFLAGS -TC -nologo"
435         CXXFLAGS="$CXXFLAGS -TP -nologo"
436         AC_LANG_SAVE
437         AC_LANG_C
438         AC_TRY_COMPILE([#include <stdio.h>],
439             [ printf("Hello World\n"); ],,
440             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
442         AC_LANG_CPLUSPLUS
443         AC_TRY_COMPILE([#include <new.h>],
444             [ unsigned *test = new unsigned(42); ],,
445             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
446         AC_LANG_RESTORE
448         changequote(,)
449         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
450         changequote([,])
452         # Determine compiler version
453         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
454         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
455         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
456         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
457         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
458         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
460         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
461         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
463         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
464             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
465         fi
467         if test "$_CC_MAJOR_VERSION" = "14"; then
468             dnl Require VC8SP1 or newer.
469             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
470             if test "$_CC_RELEASE" -lt 50727 -o \
471                     \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
472               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.])
473             fi
475             _CC_SUITE=8
476             _MSVS_VERSION=2005
477             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
478             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
479         elif test "$_CC_MAJOR_VERSION" = "15"; then
480             _CC_SUITE=9
481             _MSVS_VERSION=2008
482             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
483             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
484         elif test "$_CC_MAJOR_VERSION" = "16"; then
485             _CC_SUITE=10
486             _MSVS_VERSION=2010
487             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
488             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
489         elif test "$_CC_MAJOR_VERSION" = "17"; then
490             _CC_SUITE=11
491             _MSVS_VERSION=2012
492             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
493             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
494         else
495             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
496         fi
498         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
500         if test -n "$WIN32_REDIST_DIR"; then
501           if test ! -d "$WIN32_REDIST_DIR"; then
502             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
503           fi
504           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
505         fi
507         dnl Confirm we have the pri tools on win8 builds
508         if test -n "$MOZ_METRO"; then
509           AC_MSG_CHECKING([for makepri])
510           AC_CHECK_PROGS(MAKEPRI, makepri, "")
511           if test -z "MAKEPRI" ; then
512               AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
513           fi
514           AC_SUBST(MAKEPRI)
515         fi
517         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
518         dnl not something else like "magnetic tape manipulation utility".
519         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
520         if test -z "$MSMT_TOOL"; then
521           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
522         fi
524         changequote(,)
525         _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
526         changequote([,])
527         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
528         if test -z "$MSMANIFEST_TOOL_VERSION"; then
529           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
530         fi
532         MSMANIFEST_TOOL=1
533         unset MSMT_TOOL
535         # Check linker version
536         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
537         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
538         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
539             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
540         fi
542         INCREMENTAL_LINKER=1
544         # Check midl version
545         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
546         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
547         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
548         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
549         # Add flags if necessary
550         AC_MSG_CHECKING([for midl flags])
551         case "$target" in
552         i*86-*)
553             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
554                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
555                 # MIDL version 7.00.0500 or later has no problem.
556                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
557                 AC_MSG_RESULT([need -env win32])
558             else
559                 AC_MSG_RESULT([none needed])
560             fi
561             ;;
562         x86_64-*)
563             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
564             ;;
565         *)
566             AC_MSG_RESULT([none needed])
567             ;;
568         esac
570         # Identify which version of the SDK we're building with
571         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
572         # from there
573         MOZ_CHECK_HEADERS([winsdkver.h])
574         if test "$ac_cv_header_winsdkver_h" = "yes"; then
575             # Get the highest _WIN32_WINNT and NTDDI versions supported
576             # Take the higher of the two
577             # This is done because the Windows 7 beta SDK reports its
578             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
579             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
580                            ac_cv_winsdk_maxver,
581                            [cat > conftest.h <<EOF
582 #include <winsdkver.h>
583 #include <sdkddkver.h>
585 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
586 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
587 #else
588 #define WINSDK_MAXVER NTDDI_MAXVER
589 #endif
591 WINSDK_MAXVER
593                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
594                             rm -f conftest.h
595                            ])
596             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
597         else
598             # Any SDK which doesn't have WinSDKVer.h is too old.
599             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.])
600         fi
602         unset _MSVC_VER_FILTER
604         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
605             [
606                 AC_LANG_SAVE
607                 AC_LANG_CPLUSPLUS
608                 _SAVE_CXXFLAGS="$CXXFLAGS"
609                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
610                 AC_TRY_COMPILE([#include <exception>],
611                             [std::_Throw(std::exception()); return 0;],
612                             ac_cv_have_std__Throw="yes",
613                             ac_cv_have_std__Throw="no")
614                 CXXFLAGS="$_SAVE_CXXFLAGS"
615                 AC_LANG_RESTORE
616             ])
618         if test "$ac_cv_have_std__Throw" = "yes"; then
619             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
620                            ac_cv_have_dllimport_exception_bug,
621                 [
622                     AC_LANG_SAVE
623                     AC_LANG_CPLUSPLUS
624                     _SAVE_CXXFLAGS="$CXXFLAGS"
625                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
626                     AC_TRY_LINK([#include <vector>],
627                                 [std::vector<int> v; return v.at(1);],
628                                 ac_cv_have_dllimport_exception_bug="no",
629                                 ac_cv_have_dllimport_exception_bug="yes")
630                     CXXFLAGS="$_SAVE_CXXFLAGS"
631                     AC_LANG_RESTORE
632                 ])
633             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
634                 WRAP_STL_INCLUDES=1
635                 MOZ_MSVC_STL_WRAP__Throw=1
636                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
637             fi
638         else
639             AC_CACHE_CHECK(for overridable _RAISE,
640                            ac_cv_have__RAISE,
641                 [
642                     AC_LANG_SAVE
643                     AC_LANG_CPLUSPLUS
644                     _SAVE_CXXFLAGS="$CXXFLAGS"
645                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
646                     AC_TRY_COMPILE([#include <xstddef>
647                                     #undef _RAISE
648                                     #define _RAISE(x) externallyDefinedFunction((x).what())
649                                     #include <vector>
650                                    ],
651                                    [std::vector<int> v; return v.at(1);],
652                                    ac_cv_have__RAISE="no",
653                                    ac_cv_have__RAISE="yes")
654                     CXXFLAGS="$_SAVE_CXXFLAGS"
655                     AC_LANG_RESTORE
656                 ])
657             if test "$ac_cv_have__RAISE" = "yes"; then
658                 WRAP_STL_INCLUDES=1
659                 MOZ_MSVC_STL_WRAP__RAISE=1
660                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
661             else
662                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
663             fi
664         fi
666         if test "$WRAP_STL_INCLUDES" = "1"; then
667             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
668         fi
669     else
670         # Check w32api version
671         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
672         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
673         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
674         AC_TRY_COMPILE([#include <w32api.h>],
675             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
676                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
677                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
678                 #error "test failed."
679             #endif
680             , [ res=yes ], [ res=no ])
681         AC_MSG_RESULT([$res])
682         if test "$res" != "yes"; then
683             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
684         fi
685         # Check windres version
686         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
687         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
688         AC_MSG_RESULT([$_WINDRES_VERSION])
689         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
690         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
691         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
692         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
693         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
694         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
695         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
696                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
697                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
698                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
699                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
700                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
701         then
702             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
703         fi
705         MOZ_WINSDK_MAXVER=0x06020000
706     fi # !GNU_CC
708     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
709     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
710     # Require OS features provided by IE 6.0 SP2 (XP SP2)
711     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
713     # If the maximum version supported by this SDK is lower than the target
714     # version, error out
715     AC_MSG_CHECKING([for Windows SDK being recent enough])
716     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
717         AC_MSG_RESULT("yes")
718     else
719         AC_MSG_RESULT("no")
720         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.])
721     fi
722     
723     # Make sure the sdk / code we're targeting has the right toolset
724     AC_MSG_CHECKING([SDK and tools are in sync])
725     if test -n "$MOZ_METRO"; then
726       if test "$MOZ_MSVCVERSION" -gt "10"; then
727         AC_MSG_RESULT("yes")
728       else
729         AC_MSG_RESULT("no")
730         AC_MSG_ERROR([Your MOZ_MSVCVERSION equals $MOZ_MSVCVERSION and you've enabled metro build support. You can't target metro without msvc 11 or higher. Disable metro support or switch to a newer set of tools.])
731       fi
732     fi
733       
734     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
735     # Definitions matching sdkddkver.h
736     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
737     ;;
738 esac
740 AC_PROG_CPP
741 AC_PROG_CXXCPP
743 if test -n "$_WIN32_MSVC"; then
744     SKIP_PATH_CHECKS=1
745     SKIP_COMPILER_CHECKS=1
746     SKIP_LIBRARY_CHECKS=1
748     # Since we're skipping compiler and library checks, hard-code
749     # some facts here.
750     AC_DEFINE(HAVE_IO_H)
751     AC_DEFINE(HAVE_SETBUF)
752     AC_DEFINE(HAVE_ISATTY)
753     if test $_MSC_VER -ge 1600; then
754         AC_DEFINE(HAVE_NULLPTR)
755     fi
758 fi # COMPILE_ENVIRONMENT
760 AC_SUBST(MIDL_FLAGS)
761 AC_SUBST(_MSC_VER)
763 AC_SUBST(GNU_AS)
764 AC_SUBST(GNU_LD)
765 AC_SUBST(GNU_CC)
766 AC_SUBST(GNU_CXX)
767 AC_SUBST(INTEL_CC)
768 AC_SUBST(INTEL_CXX)
770 AC_SUBST(STL_FLAGS)
771 AC_SUBST(WRAP_STL_INCLUDES)
772 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
773 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
775 dnl ========================================================
776 dnl Checks for programs.
777 dnl ========================================================
778 AC_PROG_INSTALL
779 AC_PROG_LN_S
781 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
782 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
783 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
784 _perl_res=$?
785 AC_MSG_RESULT([$_perl_version])
787 if test "$_perl_res" != 0; then
788     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
792 AC_MSG_CHECKING([for full perl installation])
793 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
794 _perl_res=$?
795 if test "$_perl_res" != 0; then
796     AC_MSG_RESULT([no])
797     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
798 else
799     AC_MSG_RESULT([yes])
802 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
803 if test -z "$PYTHON"; then
804     AC_MSG_ERROR([python was not found in \$PATH])
807 MOZ_ARG_WITH_BOOL(system-ply,
808 [  --with-system-ply       Use system installed python ply library],
809     [if $PYTHON -c 'import ply' 2>&5; then
810          MOZ_SYSTEM_PLY=1
811      else
812          AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
813      fi])
815 AC_SUBST(MOZ_SYSTEM_PLY)
817 if test -z "$COMPILE_ENVIRONMENT"; then
818     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
820 AC_SUBST(NSINSTALL_BIN)
822 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
823 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
824 MOZ_PATH_PROGS(UNZIP, unzip)
825 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
826     AC_MSG_ERROR([unzip not found in \$PATH])
828 MOZ_PATH_PROGS(ZIP, zip)
829 if test -z "$ZIP" -o "$ZIP" = ":"; then
830     AC_MSG_ERROR([zip not found in \$PATH])
832 MOZ_PATH_PROG(MOZ_NATIVE_MAKEDEPEND, makedepend)
833 MOZ_PATH_PROG(XARGS, xargs)
834 if test -z "$XARGS" -o "$XARGS" = ":"; then
835     AC_MSG_ERROR([xargs not found in \$PATH .])
838 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
839 AC_SUBST(RPMBUILD)
841 if test "$COMPILE_ENVIRONMENT"; then
843 dnl ========================================================
844 dnl = Mac OS X toolchain support
845 dnl ========================================================
847 case "$target_os" in
848 darwin*)
849     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
850     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
851     dnl the environment and includedir purposes (when using an SDK, below),
852     dnl but remember the full version number for the libdir (SDK).
853     changequote(,)
854     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
855     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
856     changequote([,])
857     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
858         dnl Bug 280479, but this keeps popping up in bug 292530 too because
859         dnl 4.0.0/4061 is the default compiler in Tiger.
860         changequote(,)
861         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
862         changequote([,])
863         if test "$GCC_BUILD" = "4061" ; then
864             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
865 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
866 from building Mozilla. Upgrade to Xcode 2.1 or later.])
867         fi
868     fi
870     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
871     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
872     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
873     MOZ_PATH_PROGS(PBBUILD_BIN, pbbuild xcodebuild pbxbuild)
875     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
876     dnl it has moved into /usr/bin.
877     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
878     ;;
879 esac
881 AC_SUBST(GCC_VERSION)
883 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
884 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
885 dnl when we can run target binaries.
886 AC_SUBST(UNIVERSAL_BINARY)
887 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
889 dnl ========================================================
890 dnl Check for MacOS deployment target version
891 dnl ========================================================
893 MOZ_ARG_ENABLE_STRING(macos-target,
894                       [  --enable-macos-target=VER (default=10.6)
895                           Set the minimum MacOS version needed at runtime],
896                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
898 case "$target" in
899 *-darwin*)
900     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
901         dnl Use the specified value
902         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
903     else
904         dnl No value specified on the command line or in the environment,
905         dnl use architecture minimum.
906         export MACOSX_DEPLOYMENT_TARGET=10.6
907     fi
908     ;;
909 esac
911 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
913 dnl ========================================================
914 dnl = Mac OS X SDK support
915 dnl ========================================================
916 MACOS_SDK_DIR=
917 NEXT_ROOT=
918 MOZ_ARG_WITH_STRING(macos-sdk,
919 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
920     MACOS_SDK_DIR=$withval)
922 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
923 dnl NEXT_ROOT will be set and exported only if it's needed.
924 AC_SUBST(MACOS_SDK_DIR)
925 AC_SUBST(NEXT_ROOT)
927 if test "$MACOS_SDK_DIR"; then
928   dnl Sync this section with the ones in NSPR and NSS.
929   dnl Changes to the cross environment here need to be accounted for in
930   dnl the libIDL checks (below) and xpidl build.
932   if test ! -d "$MACOS_SDK_DIR"; then
933     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
934 specify a valid SDK.  SDKs are installed when the optional cross-development
935 tools are selected during the Xcode/Developer Tools installation.])
936   fi
938   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
939   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
940     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
941   else
942     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
943     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
945     dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
946     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
947     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
949     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
950       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
951       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
952       dnl be ignored and cause warnings when -syslibroot is specified.
953       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
954       dnl the -isysroot it receives, so this is only needed with 4.0.0.
955       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
956     fi
957   fi
959   AC_LANG_SAVE
960   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
961   AC_LANG_CPLUSPLUS
962   AC_TRY_COMPILE([#include <new>],[],
963    result=yes,
964    result=no)
965   AC_LANG_RESTORE
966   AC_MSG_RESULT($result)
968   if test "$result" = "no" ; then
969     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
970   fi
973 fi # COMPILE_ENVIRONMENT
975 AC_MSG_CHECKING([compiler version])
976 # Just print it so it shows up in the logs.
977 cc_version=$($CC --version)
978 AC_MSG_RESULT([$cc_version])
980 if test -n "$MAKE"; then
981   if test `echo $MAKE | grep -c make.py` != 1; then
982      NOT_PYMAKE=$MAKE
983   fi
986 case "$host_os" in
987 mingw*)
988     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
989     ;;
991     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
992     ;;
993 esac
994 if test "$GMAKE" = ":"; then
995    AC_MSG_ERROR([GNU make not found])
997 AC_SUBST(GMAKE)
999 if test -z "$MAKE"; then
1000   MAKE=$GMAKE
1003 if test "$COMPILE_ENVIRONMENT"; then
1005 AC_PATH_XTRA
1007 XCFLAGS="$X_CFLAGS"
1009 fi # COMPILE_ENVIRONMENT
1011 dnl ========================================================
1012 dnl set the defaults first
1013 dnl ========================================================
1014 AS_BIN=$AS
1015 AR_LIST='$(AR) t'
1016 AR_EXTRACT='$(AR) x'
1017 AR_DELETE='$(AR) d'
1018 AS='$(CC)'
1019 AS_DASH_C_FLAG='-c'
1020 DLL_PREFIX=lib
1021 LIB_PREFIX=lib
1022 DLL_SUFFIX=.so
1023 OBJ_SUFFIX=o
1024 LIB_SUFFIX=a
1025 ASM_SUFFIX=s
1026 IMPORT_LIB_SUFFIX=
1027 TARGET_MD_ARCH=unix
1028 DIRENT_INO=d_ino
1029 MOZ_USER_DIR=".mozilla"
1031 MOZ_JPEG_CFLAGS=
1032 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
1033 MOZ_BZ2_CFLAGS=
1034 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1035 MOZ_PNG_CFLAGS=
1036 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
1038 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1039 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1040 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1041 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1042 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1043 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1044 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1045 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1047 # These are specially defined on Windows only
1048 case "$target" in
1049 *-mingw*)
1050   XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1051   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
1052   ;;
1054   XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
1055   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
1056   ;;
1057 esac
1059 MOZ_FS_LAYOUT=unix
1061 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1063 USE_DEPENDENT_LIBS=1
1065 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1067 if test -n "$CROSS_COMPILE"; then
1068     OS_TARGET="${target_os}"
1069     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1070     OS_RELEASE=
1071     case "${target_os}" in
1072         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1073         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1074         gnu*)         OS_ARCH=GNU ;;
1075         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1076         mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
1077         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1078     esac
1079     case "${target}" in
1080         *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1081     esac
1082 else
1083     OS_TARGET=`uname -s`
1084     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1085     OS_RELEASE=`uname -r`
1088 # Before this used `uname -m` when not cross compiling
1089 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1090 OS_TEST="${target_cpu}"
1092 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1094 #######################################################################
1095 # Master "Core Components" macros for getting the OS target           #
1096 #######################################################################
1099 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1100 # cross-compilation.
1104 # Define and override various archtecture-specific variables, including
1105 # HOST_OS_ARCH
1106 # OS_ARCH
1107 # OS_TEST
1108 # OS_TARGET
1109 # OS_RELEASE
1110 # OS_MINOR_RELEASE
1113 case "$HOST_OS_ARCH" in
1114 mingw*)
1115     HOST_OS_ARCH=WINNT
1116     ;;
1117 darwin*)
1118     HOST_OS_ARCH=Darwin
1119     ;;
1120 linux*)
1121     HOST_OS_ARCH=Linux
1122     ;;
1123 solaris*)
1124     HOST_OS_ARCH=SunOS
1125     SOLARIS_SUNPRO_CC=
1126     SOLARIS_SUNPRO_CXX=
1127     if test -z "$GNU_CC"; then
1128         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1129             SOLARIS_SUNPRO_CC=1
1130        fi
1131     fi
1133     if test -z "$GNU_CXX"; then
1134        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1135            SOLARIS_SUNPRO_CXX=1
1136        fi
1137     fi
1138     AC_SUBST(SOLARIS_SUNPRO_CC)
1139     AC_SUBST(SOLARIS_SUNPRO_CXX)
1140     ;;
1141 BSD_386)
1142     HOST_OS_ARCH=BSD
1143     ;;
1144 OS_2)
1145     HOST_OS_ARCH=OS2
1146     ;;
1147 esac
1149 case "$OS_ARCH" in
1150 WINNT)
1151     if test -z "$CROSS_COMPILE" ; then
1152         OS_TEST=`uname -p`
1153     fi
1154     ;;
1155 Windows_NT)
1157 # If uname -s returns "Windows_NT", we assume that we are using
1158 # the uname.exe in MKS toolkit.
1160 # The -r option of MKS uname only returns the major version number.
1161 # So we need to use its -v option to get the minor version number.
1162 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1164     OS_ARCH=WINNT
1165     OS_TARGET=WINNT
1166     OS_MINOR_RELEASE=`uname -v`
1167     if test "$OS_MINOR_RELEASE" = "00"; then
1168         OS_MINOR_RELEASE=0
1169     fi
1170     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1171     ;;
1172 MINGW*_NT*)
1174 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1175 # the uname.exe in the MSYS tools.
1177     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1178     OS_ARCH=WINNT
1179     OS_TARGET=WINNT
1180     ;;
1181 AIX)
1182     OS_RELEASE=`uname -v`.`uname -r`
1183     OS_TEST=${target_cpu}
1184     ;;
1185 BSD_386)
1186     OS_ARCH=BSD
1187     ;;
1188 OS_2)
1189     OS_ARCH=OS2
1190     OS_TARGET=OS2
1191     OS_RELEASE=`uname -v`
1192     ;;
1193 Darwin)
1194     case "${target_cpu}" in
1195     powerpc*)
1196         OS_TEST=ppc
1197         ;;
1198     i*86*)
1199         OS_TEST=i386
1200         ;;
1201     x86_64)
1202         OS_TEST=x86_64
1203         ;;
1204     *)
1205         if test -z "$CROSS_COMPILE" ; then
1206             OS_TEST=`uname -p`
1207         fi
1208         ;;
1209     esac
1210     ;;
1211 esac
1213 # Only set CPU_ARCH if we recognize the value of OS_TEST
1215 case "$OS_TEST" in
1216 *86 | i86pc)
1217     CPU_ARCH=x86
1218     ;;
1220 powerpc64 | ppc64)
1221     CPU_ARCH=ppc64
1222     ;;
1224 powerpc | ppc | rs6000)
1225     CPU_ARCH=ppc
1226     ;;
1228 Alpha | alpha | ALPHA)
1229     CPU_ARCH=Alpha
1230     ;;
1232 s390)
1233     CPU_ARCH=s390
1234     ;;
1236 s390x)
1237     CPU_ARCH=s390x
1238     ;;
1240 hppa* | parisc)
1241     CPU_ARCH=hppa
1242     ;;
1244 sun4u | sparc*)
1245     CPU_ARCH=sparc
1246     ;;
1248 x86_64 | ia64)
1249     CPU_ARCH="$OS_TEST"
1250     ;;
1252 arm*)
1253     CPU_ARCH=arm
1254     ;;
1256 mips|mipsel)
1257     CPU_ARCH="mips"
1258     ;;
1259 esac
1261 if test -z "$OS_TARGET"; then
1262     OS_TARGET=$OS_ARCH
1264 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1266 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1267 dnl ===============================================================
1268 INTEL_ARCHITECTURE=
1269 case "$OS_TEST" in
1270     x86_64|i?86)
1271       INTEL_ARCHITECTURE=1
1272 esac
1274 dnl Configure platform-specific CPU architecture compiler options.
1275 dnl ==============================================================
1276 MOZ_ARCH_OPTS
1278 dnl =================================================================
1279 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1280 dnl which is bad when cross compiling.
1281 dnl =================================================================
1282 if test "$COMPILE_ENVIRONMENT"; then
1283 configure_static_assert_macros='
1284 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1285 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1286 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1289 dnl test that the macros actually work:
1290 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1291 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1292  [AC_LANG_SAVE
1293   AC_LANG_C
1294   ac_cv_static_assertion_macros_work="yes"
1295   AC_TRY_COMPILE([$configure_static_assert_macros],
1296                  [CONFIGURE_STATIC_ASSERT(1)],
1297                  ,
1298                  ac_cv_static_assertion_macros_work="no")
1299   AC_TRY_COMPILE([$configure_static_assert_macros],
1300                  [CONFIGURE_STATIC_ASSERT(0)],
1301                  ac_cv_static_assertion_macros_work="no",
1302                  )
1303   AC_LANG_CPLUSPLUS
1304   AC_TRY_COMPILE([$configure_static_assert_macros],
1305                  [CONFIGURE_STATIC_ASSERT(1)],
1306                  ,
1307                  ac_cv_static_assertion_macros_work="no")
1308   AC_TRY_COMPILE([$configure_static_assert_macros],
1309                  [CONFIGURE_STATIC_ASSERT(0)],
1310                  ac_cv_static_assertion_macros_work="no",
1311                  )
1312   AC_LANG_RESTORE
1313  ])
1314 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1315 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1316     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1318 fi # COMPILE_ENVIRONMENT
1320 dnl ========================================================
1321 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1322 dnl computed above.
1323 dnl ========================================================
1325 MOZ_ANDROID_STLPORT
1327 dnl ========================================================
1328 dnl Suppress Clang Argument Warnings
1329 dnl ========================================================
1330 if test -n "$CLANG_CC"; then
1331     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1332     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1334 if test -n "$CLANG_CXX"; then
1335     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1338 dnl ========================================================
1339 dnl = Use Address Sanitizer
1340 dnl ========================================================
1341 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1342 [  --enable-address-sanitizer       Enable Address Sanitizer (default=no)],
1343     MOZ_ASAN=1,
1344     MOZ_ASAN= )
1345 if test -n "$MOZ_ASAN"; then
1346     MOZ_LLVM_HACKS=1
1347     AC_DEFINE(MOZ_ASAN)
1349 AC_SUBST(MOZ_ASAN)
1351 dnl ========================================================
1352 dnl = Enable hacks required for LLVM instrumentations
1353 dnl ========================================================
1354 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1355 [  --enable-llvm-hacks       Enable workarounds required for several LLVM instrumentations (default=no)],
1356     MOZ_LLVM_HACKS=1,
1357     MOZ_LLVM_HACKS= )
1358 if test -n "$MOZ_LLVM_HACKS"; then
1359     MOZ_NO_WLZDEFS=1
1360     MOZ_CFLAGS_NSS=1
1362 AC_SUBST(MOZ_NO_WLZDEFS)
1363 AC_SUBST(MOZ_CFLAGS_NSS)
1365 dnl ========================================================
1366 dnl GNU specific defaults
1367 dnl ========================================================
1368 if test "$GNU_CC"; then
1369     # FIXME: Let us build with strict aliasing. bug 414641.
1370     CFLAGS="$CFLAGS -fno-strict-aliasing"
1371     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1372     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1373     DSO_LDOPTS='-shared'
1374     if test "$GCC_USE_GNU_LD"; then
1375         # Some tools like ASan use a runtime library that is only
1376         # linked against executables, so we must allow undefined
1377         # symbols for shared objects in some cases.
1378         if test -z "$MOZ_NO_WLZDEFS"; then
1379             # Don't allow undefined symbols in libraries
1380             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1381         fi
1382     fi
1383     WARNINGS_AS_ERRORS='-Werror -Wno-error=uninitialized'
1384     DSO_CFLAGS=''
1385     DSO_PIC_CFLAGS='-fPIC'
1386     ASFLAGS="$ASFLAGS -fPIC"
1387     AC_MSG_CHECKING([for --noexecstack option to as])
1388     _SAVE_CFLAGS=$CFLAGS
1389     CFLAGS="$CFLAGS -Wa,--noexecstack"
1390     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1391                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1392                      AC_MSG_RESULT([no]))
1393     CFLAGS=$_SAVE_CFLAGS
1394     AC_MSG_CHECKING([for -z noexecstack option to ld])
1395     _SAVE_LDFLAGS=$LDFLAGS
1396     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1397     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1398                   AC_MSG_RESULT([no])
1399                   LDFLAGS=$_SAVE_LDFLAGS)
1401     # Check for -mssse3 on $CC
1402     AC_MSG_CHECKING([for -mssse3 option to $CC])
1403     HAVE_COMPILER_FLAG_MSSSE3=
1404     _SAVE_CFLAGS=$CFLAGS
1405     CFLAGS="$CFLAGS -mssse3"
1406     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1407                      [HAVE_COMPILER_FLAG_MSSSE3=1],
1408                      AC_MSG_RESULT([no]))
1409     CFLAGS=$_SAVE_CFLAGS
1410     AC_SUBST(HAVE_COMPILER_FLAG_MSSSE3)
1412     # Turn on GNU-specific warnings:
1413     # -Wall - turn on a lot of warnings
1414     # -pedantic - this is turned on below
1415     # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1416     # -Wdeclaration-after-statement - MSVC doesn't like these
1417     # -Werror=return-type - catches missing returns, zero false positives
1418     # -Wtype-limits - catches overflow bugs, few false positives
1419     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1420     #
1421     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1422     MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1423     MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1424     MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1425     
1426     # Turn off the following warnings that -Wall/-pedantic turn on:
1427     # -Wno-unused - lots of violations in third-party code
1428     # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1429     #
1430     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1431     MOZ_C_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_c_has_wno_overlength_strings)
1433     if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1434        # Don't use -Wcast-align with ICC or clang
1435        case "$CPU_ARCH" in
1436            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1437            hppa | ia64 | sparc | arm)
1438            ;;
1439            *)
1440         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1441            ;;
1442        esac
1443     fi
1445     dnl Turn pedantic on but disable the warnings for long long
1446     _PEDANTIC=1
1448     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1449     _USE_CPP_INCLUDE_FLAG=1
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     # -pedantic - this is turned on below
1482     # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1483     # -Woverloaded-virtual - ???
1484     # -Werror=return-type - catches missing returns, zero false positives
1485     # -Wtype-limits - catches overflow bugs, few false positives
1486     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
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)
1493     # Turn off the following warnings that -Wall/-pedantic turn on:
1494     # -Wno-ctor-dtor-privacy - ???
1495     # -Wno-overlength-strings - we exceed the minimum maximum length frequently 
1496     # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1497     # -Wno-variadic-macros - ???
1498     #
1499     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-ctor-dtor-privacy"
1500     MOZ_CXX_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_cxx_has_wno_overlength_strings)
1501     MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1502     MOZ_CXX_SUPPORTS_WARNING(-Wno-, variadic-macros, ac_cxx_has_wno_variadic_macros)
1504     if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1505        # Don't use -Wcast-align with ICC or clang
1506        case "$CPU_ARCH" in
1507            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1508            hppa | ia64 | sparc | arm)
1509            ;;
1510            *)
1511         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1512            ;;
1513        esac
1514     fi
1516     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1517     _USE_CPP_INCLUDE_FLAG=1
1519     # Recent clang and gcc support C++11 deleted functions without warnings if
1520     # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1521     # versions).  We can't use -std=c++0x yet, so gcc's support must remain
1522     # unused.  But clang's warning can be disabled, so when compiling with clang
1523     # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1524     # deleted function syntax.
1525     if test "$CLANG_CXX"; then
1526         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1527         MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1528     fi
1530 else
1531     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1534 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1535 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1536 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1537 dnl normal behavior.
1538 dnl ========================================================
1539 MKSHLIB_FORCE_ALL=
1540 MKSHLIB_UNFORCE_ALL=
1542 if test "$COMPILE_ENVIRONMENT"; then
1543 if test "$GNU_CC"; then
1544   AC_MSG_CHECKING(whether ld has archive extraction flags)
1545   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1546    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1547     ac_cv_mkshlib_force_and_unforce="no"
1548     exec 3<&0 <<LOOP_INPUT
1549         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1550         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1551         force="-Wl,-all";              unforce="-Wl,-none"
1552 LOOP_INPUT
1553     while read line
1554     do
1555       eval $line
1556       LDFLAGS=$force
1557       LIBS=$unforce
1558       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1559     done
1560     exec 0<&3 3<&-
1561     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1562    ])
1563   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1564     AC_MSG_RESULT(no)
1565   else
1566     AC_MSG_RESULT(yes)
1567     eval $ac_cv_mkshlib_force_and_unforce
1568     MKSHLIB_FORCE_ALL=$force
1569     MKSHLIB_UNFORCE_ALL=$unforce
1570   fi
1571 fi # GNU_CC
1572 fi # COMPILE_ENVIRONMENT
1574 dnl ========================================================
1575 dnl Checking for 64-bit OS
1576 dnl ========================================================
1577 if test "$COMPILE_ENVIRONMENT"; then
1578 AC_LANG_SAVE
1579 AC_LANG_C
1580 AC_MSG_CHECKING(for 64-bit OS)
1581 AC_TRY_COMPILE([$configure_static_assert_macros],
1582                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1583                result="yes", result="no")
1584 AC_MSG_RESULT("$result")
1585 if test "$result" = "yes"; then
1586     AC_DEFINE(HAVE_64BIT_OS)
1587     HAVE_64BIT_OS=1
1589 AC_SUBST(HAVE_64BIT_OS)
1590 AC_LANG_RESTORE
1591 fi # COMPILE_ENVIRONMENT
1593 dnl ========================================================
1594 dnl Enable high-memory support on OS/2 by default.
1595 dnl ========================================================
1596 MOZ_OS2_HIGH_MEMORY=1
1597 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1598 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1599     MOZ_OS2_HIGH_MEMORY=,
1600     MOZ_OS2_HIGH_MEMORY=1 )
1601 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1603 dnl ========================================================
1604 dnl = Use profiling compile flags
1605 dnl ========================================================
1606 MOZ_ARG_ENABLE_BOOL(profiling,
1607 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1608     MOZ_PROFILING=1,
1609     MOZ_PROFILING= )
1611 # For profiling builds keep the symbol information
1612 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1613     STRIP_FLAGS="--strip-debug"
1616 dnl ========================================================
1617 dnl = Use Valgrind
1618 dnl ========================================================
1619 MOZ_ARG_ENABLE_BOOL(valgrind,
1620 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
1621     MOZ_VALGRIND=1,
1622     MOZ_VALGRIND= )
1623 if test -n "$MOZ_VALGRIND"; then
1624     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1625         AC_MSG_ERROR(
1626             [--enable-valgrind specified but Valgrind is not installed]))
1627     AC_DEFINE(MOZ_VALGRIND)
1629 AC_SUBST(MOZ_VALGRIND)
1631 dnl ========================================================
1632 dnl = Use DMD
1633 dnl ========================================================
1634 MOZ_ARG_ENABLE_BOOL(dmd,
1635 [  --enable-dmd            Enable DMD; also disables jemalloc (default=no)],
1636     MOZ_DMD=1,
1637     MOZ_DMD= )
1638 if test -n "$MOZ_DMD"; then
1639     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1640         AC_MSG_ERROR(
1641             [--enable-dmd specified but Valgrind is not installed]))
1642     AC_DEFINE(MOZ_DMD)
1645 dnl ========================================================
1646 dnl jprof
1647 dnl ========================================================
1648 MOZ_ARG_ENABLE_BOOL(jprof,
1649 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1650     MOZ_JPROF=1,
1651     MOZ_JPROF= )
1652 if test -n "$MOZ_JPROF"; then
1653     MOZ_PROFILING=1
1654     AC_DEFINE(MOZ_JPROF)
1657 dnl ========================================================
1658 dnl SPS Profiler
1659 dnl ========================================================
1660 MOZ_ENABLE_PROFILER_SPS=1
1662 case "${OS_TARGET}" in
1663 Android)
1664     case "${CPU_ARCH}" in
1665     x86 | arm) ;;
1666     *)
1667         MOZ_ENABLE_PROFILER_SPS=
1668     esac
1669     ;;
1670 Linux)
1671     case "${CPU_ARCH}" in
1672     x86 | x86_64) ;;
1673     *)
1674         MOZ_ENABLE_PROFILER_SPS=
1675     esac
1676     ;;
1677 WINNT|Darwin) ;;
1679     MOZ_ENABLE_PROFILER_SPS=
1680     ;;
1681 esac
1683 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1684     AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1687 dnl ========================================================
1688 dnl shark
1689 dnl ========================================================
1690 MOZ_ARG_ENABLE_BOOL(shark,
1691 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
1692     MOZ_SHARK=1,
1693     MOZ_SHARK= )
1694 if test -n "$MOZ_SHARK"; then
1695     MOZ_PROFILING=1
1696     AC_DEFINE(MOZ_SHARK)
1699 dnl ========================================================
1700 dnl callgrind
1701 dnl ========================================================
1702 MOZ_ARG_ENABLE_BOOL(callgrind,
1703 [  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
1704     MOZ_CALLGRIND=1,
1705     MOZ_CALLGRIND= )
1706 if test -n "$MOZ_CALLGRIND"; then
1707     MOZ_PROFILING=1
1708     AC_DEFINE(MOZ_CALLGRIND)
1711 dnl ========================================================
1712 dnl vtune
1713 dnl ========================================================
1714 MOZ_ARG_ENABLE_BOOL(vtune,
1715 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
1716     MOZ_VTUNE=1,
1717     MOZ_VTUNE= )
1718 if test -n "$MOZ_VTUNE"; then
1719     MOZ_PROFILING=1
1720     AC_DEFINE(MOZ_VTUNE)
1723 dnl ========================================================
1724 dnl Profiling
1725 dnl ========================================================
1726 if test -n "$MOZ_PROFILING"; then
1727     AC_DEFINE(MOZ_PROFILING)
1730 dnl ========================================================
1731 dnl System overrides of the defaults for host
1732 dnl ========================================================
1733 case "$host" in
1734 *mingw*)
1735     if test -n "$_WIN32_MSVC"; then
1736         HOST_AR=lib
1737         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1738         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1739         HOST_RANLIB='echo ranlib'
1740     else
1741         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1742     fi
1743     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1744     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1745     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1746     HOST_BIN_SUFFIX=.exe
1747     case "$host" in
1748     *mingw*)
1749         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1750         ;;
1751     esac
1753     case "${host_cpu}" in
1754     i*86)
1755         if test -n "$_WIN32_MSVC"; then
1756             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1757         fi
1758         ;;
1759     x86_64)
1760         if test -n "$_WIN32_MSVC"; then
1761             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1762         fi
1763         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1764         ;;
1765     esac
1766     ;;
1768 *-darwin*)
1769     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1770     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1771     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1772     ;;
1774 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1775     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1776     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1777     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1778     ;;
1780 *os2*)
1781     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1782     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1783     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1784     HOST_BIN_SUFFIX=.exe
1785     MOZ_FIX_LINK_PATHS=
1786     ;;
1789     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1790     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1791     ;;
1792 esac
1794 dnl We require version 2.5 or newer of Python to build.
1795 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
1796 changequote(,)
1797 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
1798 _python_res=$?
1799 changequote([,])
1800 if test "$_python_res" != 0; then
1801     AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
1803 AC_MSG_RESULT([yes])
1805 dnl Check for using a custom <stdint.h> implementation
1806 dnl ========================================================
1807 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1808 if test "$MOZ_CUSTOM_STDINT_H"; then
1809   AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1810   AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1811 else
1812   AC_MSG_RESULT(none specified)
1815 dnl Get mozilla version from central milestone file
1816 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1817 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1819 dnl Get version of various core apps from the version files.
1820 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1822 if test -z "$FIREFOX_VERSION"; then
1823     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1826 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1827 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1828 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1830 MOZ_DOING_LTO(lto_is_enabled)
1832 dnl ========================================================
1833 dnl System overrides of the defaults for target
1834 dnl ========================================================
1836 case "$target" in
1837 *-aix*)
1838     AC_DEFINE(AIX)
1839     if test ! "$GNU_CC"; then
1840         if test ! "$HAVE_64BIT_OS"; then
1841             # Compiling with Visual Age C++ object model compat is the
1842             # default. To compile with object model ibm, add
1843             # AIX_OBJMODEL=ibm to .mozconfig.
1844             if test "$AIX_OBJMODEL" = "ibm"; then
1845                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1846             else
1847                 AIX_OBJMODEL=compat
1848             fi
1849         else
1850             AIX_OBJMODEL=compat
1851         fi
1852         AC_SUBST(AIX_OBJMODEL)
1853         DSO_LDOPTS='-qmkshrobj=1'
1854         DSO_CFLAGS='-qflag=w:w'
1855         DSO_PIC_CFLAGS=
1856         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1857         MOZ_FIX_LINK_PATHS=
1858         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1859         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1860         if test "$COMPILE_ENVIRONMENT"; then
1861             AC_LANG_SAVE
1862             AC_LANG_CPLUSPLUS
1863             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1864             AC_TRY_COMPILE([],
1865                 [#if (__IBMCPP__ < 900)
1866                  #error "Bad compiler"
1867                  #endif],
1868                 _BAD_COMPILER=,_BAD_COMPILER=1)
1869             if test -n "$_BAD_COMPILER"; then
1870                 AC_MSG_RESULT([no])
1871                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1872             else
1873                 AC_MSG_RESULT([yes])
1874             fi
1875             AC_LANG_RESTORE
1876             TARGET_COMPILER_ABI="ibmc"
1877             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1878             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1879         fi
1880     fi
1881     case "${target_os}" in
1882     aix4.1*)
1883         DLL_SUFFIX='_shr.a'
1884         ;;
1885     esac
1886     if test "$COMPILE_ENVIRONMENT"; then
1887         MOZ_CHECK_HEADERS(sys/inttypes.h)
1888     fi
1889     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1890     ;;
1892 *-bsdi*)
1893     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1894     _PEDANTIC=
1895     case $OS_RELEASE in
1896         4.*|5.*)
1897             STRIP="$STRIP -d"
1898             ;;
1899         *)
1900             DSO_CFLAGS=''
1901             DSO_LDOPTS='-r'
1902             _WARNINGS_CFLAGS="-Wall"
1903             _WARNINGS_CXXFLAGS="-Wall"
1904             # The test above doesn't work properly, at least on 3.1.
1905             MKSHLIB_FORCE_ALL=''
1906             MKSHLIB_UNFORCE_ALL=''
1907         ;;
1908     esac
1909     ;;
1911 *-darwin*)
1912     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1913     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1914     MOZ_OPTIMIZE_FLAGS="-O3"
1915     _PEDANTIC=
1916     # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
1917     if test "$HAVE_64BIT_OS"; then
1918         MOZ_MEMORY=1
1919     fi
1920     DLL_SUFFIX=".dylib"
1921     DSO_LDOPTS=''
1922     STRIP="$STRIP -x -S"
1923     # Check whether we're targeting OS X or iOS
1924     AC_CACHE_CHECK(for iOS target,
1925                    ac_cv_ios_target,
1926                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
1927 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1928 #error not iOS
1929 #endif],
1930                                    [],
1931                                    ac_cv_ios_target="yes",
1932                                    ac_cv_ios_target="no")])
1933     if test "$ac_cv_ios_target" = "yes"; then
1934         AC_DEFINE(XP_IOS)
1935         AC_DEFINE(XP_DARWIN)
1936         _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1937     else
1938         AC_DEFINE(XP_MACOSX)
1939         AC_DEFINE(XP_DARWIN)
1940         _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1941         # The ExceptionHandling framework is needed for Objective-C exception
1942         # logging code in nsObjCExceptions.h. Currently we only use that in debug
1943         # builds.
1944         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1945     fi
1946     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1949     if test "x$lto_is_enabled" = "xyes"; then
1950         echo "Skipping -dead_strip because lto is enabled."
1951     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1952     dnl ===================================================================
1953     elif test "x$enable_dtrace" = "xyes"; then
1954         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1955     else
1956         dnl check for the presence of the -dead_strip linker flag
1957         AC_MSG_CHECKING([for -dead_strip option to ld])
1958         _SAVE_LDFLAGS=$LDFLAGS
1959         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1960         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1961         if test -n "$_HAVE_DEAD_STRIP" ; then
1962             AC_MSG_RESULT([yes])
1963             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1964         else
1965             AC_MSG_RESULT([no])
1966         fi
1968         LDFLAGS=$_SAVE_LDFLAGS
1969     fi
1971     dnl With newer linkers we need to pass -allow_heap_execute because of
1972     dnl Microsoft Silverlight (5.1.10411.0 at least).
1973     AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1974     _SAVE_LDFLAGS=$LDFLAGS
1975     LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1976     AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1977                 _HAVE_ALLOW_HEAP_EXECUTE=)
1978     if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1979         AC_MSG_RESULT([yes])
1980         MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1981     else
1982         AC_MSG_RESULT([no])
1983     fi
1984     LDFLAGS=$_SAVE_LDFLAGS
1986     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1987     ;;
1989 ia64*-hpux*)
1990     DLL_SUFFIX=".so"
1991     if test ! "$GNU_CC"; then
1992        DSO_LDOPTS='-b'
1993        DSO_CFLAGS=""
1994        DSO_PIC_CFLAGS=
1995        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1996        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1997        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1998     else
1999        DSO_LDOPTS='-b -E'
2000        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2001        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2002     fi
2003     MOZ_FIX_LINK_PATHS=
2004     MOZ_NATIVE_MAKEDEPEND=
2005     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2006     AC_DEFINE(_LARGEFILE64_SOURCE)
2007     ;;
2009 *-hpux*)
2010     DLL_SUFFIX=".sl"
2011     if test ! "$GNU_CC"; then
2012         DSO_LDOPTS='-b -Wl,+s'
2013         DSO_CFLAGS=""
2014         DSO_PIC_CFLAGS="+Z"
2015         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2016         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2017         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2018     else
2019         DSO_LDOPTS='-b -E +s'
2020         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2021         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2022     fi
2023     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2024     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2025     ;;
2027 *-android*|*-linuxandroid*)
2028     AC_DEFINE(NO_PW_GECOS)
2029     no_x=yes
2030     if test -n "$gonkdir"; then
2031         _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2032         MOZ_B2G_RIL=1
2033         MOZ_B2G_BT=1
2034     else
2035         _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2036         MOZ_LINKER=1
2037     fi
2038     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2040     MOZ_GFX_OPTIMIZE_MOBILE=1
2041     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2042     ;;
2044 *-*linux*)
2045     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2046     # Similarly for GNU_CXX and INTEL_CXX.
2047     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2048         # -Os has been broken on Intel's C/C++ compilers for quite a
2049         # while; Intel recommends against using it.
2050         MOZ_OPTIMIZE_FLAGS="-O2"
2051         MOZ_DEBUG_FLAGS="-g"
2052     elif test "$GNU_CC" -o "$GNU_CXX"; then
2053         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2054         case $GCC_VERSION in
2055         4.1.*|4.2.*|4.5.*)
2056             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2057             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2058         esac
2059         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2060         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2061         MOZ_DEBUG_FLAGS="-g"
2062     fi
2064     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2066     MOZ_MEMORY=1
2068     case "${target_cpu}" in
2069     alpha*)
2070         CFLAGS="$CFLAGS -mieee"
2071         CXXFLAGS="$CXXFLAGS -mieee"
2072     ;;
2073     i*86)
2074         USE_ELF_DYNSTR_GC=1
2075     ;;
2076     mips*)
2077         MOZ_DEBUG_FLAGS="-g" # We want inlining
2078     ;;
2079     esac
2081     if test -z "$MC"; then
2082         MC=mc.exe
2083     fi
2084     ;;
2085 *-mingw*)
2086     DSO_CFLAGS=
2087     DSO_PIC_CFLAGS=
2088     DLL_SUFFIX=.dll
2089     RC=rc.exe
2090     MC=mc.exe
2091     # certain versions of cygwin's makedepend barf on the
2092     # #include <string> vs -I./dist/include/string issue so don't use it
2093     MOZ_NATIVE_MAKEDEPEND=
2094     if test -n "$GNU_CC"; then
2095         CC="$CC -mwindows"
2096         CXX="$CXX -mwindows"
2097         CPP="$CPP -mwindows"
2098         CFLAGS="$CFLAGS -mms-bitfields"
2099         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2100         DSO_LDOPTS='-shared'
2101         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2102         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2103         RC='$(WINDRES)'
2104         # Use temp file for windres (bug 213281)
2105         RCFLAGS='-O coff --use-temp-file'
2106         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2107         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv"
2108         MOZ_FIX_LINK_PATHS=
2109         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2110         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2111         DLL_PREFIX=
2112         IMPORT_LIB_SUFFIX=dll.a
2113         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2114     else
2115         TARGET_COMPILER_ABI=msvc
2116         HOST_CC='$(CC)'
2117         HOST_CXX='$(CXX)'
2118         HOST_LD='$(LD)'
2119         if test "$AS_BIN"; then
2120             AS="$(basename "$AS_BIN")"
2121         fi
2122         AR='lib'
2123         AR_FLAGS='-NOLOGO -OUT:"$@"'
2124         AR_EXTRACT=
2125         RANLIB='echo not_ranlib'
2126         STRIP='echo not_strip'
2127         PKG_SKIP_STRIP=1
2128         XARGS=xargs
2129         ZIP=zip
2130         UNZIP=unzip
2131         DOXYGEN=:
2132         ASM_SUFFIX=asm
2133         OBJ_SUFFIX=obj
2134         LIB_SUFFIX=lib
2135         DLL_PREFIX=
2136         LIB_PREFIX=
2137         IMPORT_LIB_SUFFIX=lib
2138         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2139         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2140         MKSHLIB_FORCE_ALL=
2141         MKSHLIB_UNFORCE_ALL=
2142         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2143         _USE_CPP_INCLUDE_FLAG=1
2144         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2145         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2146         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2147         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2148         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2149         # make 'foo == bar;' error out
2150         CFLAGS="$CFLAGS -we4553"
2151         CXXFLAGS="$CXXFLAGS -we4553"
2152         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2153         MOZ_DEBUG_FLAGS='-Zi'
2154         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2155         WARNINGS_AS_ERRORS='-WX'
2156         MOZ_OPTIMIZE_FLAGS='-O1'
2157         MOZ_FIX_LINK_PATHS=
2158         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2159         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2160         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2161         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2162         if test $_MSC_VER -ge 1400; then
2163             LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2164             dnl For profile-guided optimization
2165             PROFILE_GEN_CFLAGS="-GL"
2166             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2167             dnl XXX: PGO builds can fail with warnings treated as errors,
2168             dnl specifically "no profile data available" appears to be
2169             dnl treated as an error sometimes. This might be a consequence
2170             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2171             dnl with the linker doing most of the work in the whole-program
2172             dnl optimization/PGO case. I think it's probably a compiler bug,
2173             dnl but we work around it here.
2174             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2175             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2176             dnl Probably also a compiler bug, but what can you do?
2177             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2178             LDFLAGS="$LDFLAGS -DYNAMICBASE"
2179         fi
2180     fi
2181     AC_DEFINE(HAVE_SNPRINTF)
2182     AC_DEFINE(_WINDOWS)
2183     AC_DEFINE(WIN32)
2184     AC_DEFINE(XP_WIN)
2185     AC_DEFINE(XP_WIN32)
2186     AC_DEFINE(HW_THREADS)
2187     AC_DEFINE(STDC_HEADERS)
2188     AC_DEFINE(NEW_H, <new>)
2189     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2190     TARGET_MD_ARCH=win32
2191     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2192     BIN_SUFFIX='.exe'
2193     MOZ_USER_DIR="Mozilla"
2195     dnl Hardcode to win95 for now - cls
2196     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2198     dnl set NO_X11 defines here as the general check is skipped on win32
2199     no_x=yes
2200     AC_DEFINE(NO_X11)
2202     case "$host" in
2203     *-mingw*)
2204         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2205         L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2206         ;;
2207     esac
2209     case "$host" in
2210     *-mingw*)
2211         if test -z "$MOZ_TOOLS"; then
2212             AC_MSG_ERROR([MOZ_TOOLS is not set])
2213         fi
2214         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2215         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2216             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2217         fi
2218         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2219         if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2220             AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2221         fi
2222         ;;
2223     esac
2225     case "$host_os" in
2226     cygwin*|msvc*|mks*)
2227         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.])
2228         ;;
2229     esac
2231     case "$target" in
2232     i*86-*)
2233         if test "$HAVE_64BIT_OS"; then
2234             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2235         fi
2237         if test $_MSC_VER -ge 1400; then
2238             LDFLAGS="$LDFLAGS -SAFESEH"
2239         fi
2241         if test -n "$GNU_CC"; then
2242             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2243             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2244         else
2245             AC_DEFINE(HAVE_STDCALL)
2246             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2247         fi
2249         MOZ_CHECK_HEADERS(mmintrin.h)
2250         AC_DEFINE(_X86_)
2251         ;;
2252     x86_64-*)
2253         if test -n "$_WIN32_MSVC"; then
2254             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2255         fi
2256         AC_DEFINE(_AMD64_)
2257         ;;
2258     *)
2259         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2260         ;;
2261     esac
2263     if test "$HAVE_64BIT_OS"; then
2264         AC_DEFINE(_WIN64)
2265     fi
2266     ;;
2268 *-netbsd*)
2269     DSO_CFLAGS=''
2270     CFLAGS="$CFLAGS -Dunix"
2271     CXXFLAGS="$CXXFLAGS -Dunix"
2272     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2273         DLL_SUFFIX=".so"
2274         DSO_PIC_CFLAGS='-fPIC -DPIC'
2275         DSO_LDOPTS='-shared'
2276         BIN_FLAGS='-Wl,--export-dynamic'
2277     else
2278         DSO_PIC_CFLAGS='-fPIC -DPIC'
2279         DLL_SUFFIX=".so.1.0"
2280         DSO_LDOPTS='-shared'
2281     fi
2282     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2283     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2284     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2285     if test "$LIBRUNPATH"; then
2286         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2287     fi
2288     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2289     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2290     ;;
2292 *-openbsd*)
2293     if test "$SO_VERSION"; then
2294         DLL_SUFFIX=".so.$SO_VERSION"
2295     else
2296         DLL_SUFFIX=".so.1.0"
2297     fi
2298     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2299     DSO_CFLAGS=''
2300     DSO_PIC_CFLAGS='-fPIC'
2301     DSO_LDOPTS='-shared -fPIC'
2302     if test "$LIBRUNPATH"; then
2303         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2304     fi
2305     ;;
2307 *-os2*)
2308     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2309     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2310     AC_DEFINE(OS2)
2311     AC_DEFINE(XP_OS2)
2312     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2313     AC_DEFINE(TCPV40HDRS)
2314     DLL_PREFIX=
2315     LIB_PREFIX=
2316     LIB_SUFFIX=lib
2317     BIN_SUFFIX=".exe"
2318     DLL_SUFFIX=".dll"
2319     IMPORT_LIB_SUFFIX=lib
2320     DSO_PIC_CFLAGS=
2321     AR=emxomfar
2322     AR_FLAGS='r $@'
2323     CFLAGS="$CFLAGS -Zomf"
2324     CXXFLAGS="$CXXFLAGS -Zomf"
2325     DSO_LDOPTS='-Zdll'
2326     BIN_FLAGS='-Zlinker /ST:0x100000'
2327     IMPLIB='emximp -o'
2328     FILTER='true'
2329     LDFLAGS='-Zmap'
2330     WARNINGS_AS_ERRORS='-Werror'
2331     MOZ_DEBUG_FLAGS="-g -fno-inline"
2332     MOZ_OPTIMIZE_FLAGS="-O2"
2333     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2334     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2335     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2336     TARGET_MD_ARCH=os2
2337     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2338     RC=rc.exe
2339     MC=mc.exe
2340     RCFLAGS='-n'
2341     MOZ_USER_DIR="Mozilla"
2342     ZIP="$ZIP -X"
2344     if test "$MOZTOOLS"; then
2345         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2346     else
2347         AC_MSG_ERROR([MOZTOOLS is not set])
2348     fi
2349     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2350         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2351         LDFLAGS="$LDFLAGS -Zhigh-mem"
2352         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2353         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2354     fi
2356     # GCC for OS/2 currently predefines these, but we don't want them
2357     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2358     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2360     AC_CACHE_CHECK(for __declspec(dllexport),
2361         ac_os2_declspec,
2362         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2363                         [return 0;],
2364                         ac_os2_declspec="yes",
2365                         ac_os2_declspec="no")])
2366     if test "$ac_os2_declspec" != "yes"; then
2367         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2368     fi
2369     ;;
2371 *-solaris*)
2372     AC_DEFINE(SOLARIS)
2373     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2374     MOZ_NATIVE_MAKEDEPEND=
2375     MOZ_FIX_LINK_PATHS=
2376     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2377     # libraries one level up (e.g. libnspr4.so)
2378     if test "$SOLARIS_SUNPRO_CC"; then
2379        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2380        LIBS="-lCrun -lCstd -lc $LIBS"
2381        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2382        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2383        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2384        LDFLAGS="-xildoff $LDFLAGS"
2385        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2386            _SAVE_LDFLAGS=$LDFLAGS
2387            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2388            AC_TRY_LINK([#include <stdio.h>],
2389                        [printf("Hello World\n");],
2390                        ,
2391                        [LDFLAGS=$_SAVE_LDFLAGS])
2392        fi
2393        MOZ_OPTIMIZE_FLAGS="-xO4"
2394        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2395        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2396        MKSHLIB_FORCE_ALL='-z allextract'
2397        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2398        DSO_LDOPTS='-G'
2399        AR_LIST="$AR t"
2400        AR_EXTRACT="$AR x"
2401        AR_DELETE="$AR d"
2402        AR='$(CXX) -xar'
2403        AR_FLAGS='-o $@'
2404        AS='/usr/ccs/bin/as'
2405        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2406        AS_DASH_C_FLAG=''
2407        TARGET_COMPILER_ABI="sunc"
2408        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2409        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2410        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2411        AC_LANG_SAVE
2412        AC_LANG_CPLUSPLUS
2413        AC_TRY_COMPILE([],
2414            [#if (__SUNPRO_CC < 0x590)
2415            #error "Denied"
2416            #endif],
2417            _BAD_COMPILER=,_BAD_COMPILER=1)
2418        if test -n "$_BAD_COMPILER"; then
2419            _res="no"
2420            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2421        else
2422            _res="yes"
2423        fi
2424        AC_TRY_COMPILE([],
2425            [#if (__SUNPRO_CC >= 0x5100)
2426            #error "Sun C++ 5.10 or above"
2427            #endif],
2428            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2429        if test "$_ABOVE_SS12U1"; then
2430            # disable xannotate
2431            CXXFLAGS="$CXXFLAGS -xannotate=no"
2432        fi
2433        AC_MSG_RESULT([$_res])
2434        AC_LANG_RESTORE
2435     else
2436        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2437        LIBS="-lc $LIBS"
2438        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2439        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2440        ASFLAGS="$ASFLAGS -fPIC"
2441        DSO_LDOPTS='-shared'
2442        WARNINGS_AS_ERRORS='-Werror'
2443        _WARNINGS_CFLAGS=''
2444        _WARNINGS_CXXFLAGS=''
2445        if test "$OS_RELEASE" = "5.3"; then
2446            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2447        fi
2448     fi
2449     if test "$OS_RELEASE" = "5.5.1"; then
2450         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2451     fi
2452     ;;
2454 *-sunos*)
2455     DSO_LDOPTS='-Bdynamic'
2456     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2457     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2458     AC_DEFINE(SUNOS4)
2459     AC_DEFINE(SPRINTF_RETURNS_STRING)
2460     case "$(target_os)" in
2461     sunos4.1*)
2462         DLL_SUFFIX='.so.1.0'
2463         ;;
2464     esac
2465     ;;
2467 *-os2*)
2468     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2469     ;;
2471 esac
2473 AC_SUBST(MOZ_LINKER)
2474 if test -n "$MOZ_LINKER"; then
2475   AC_DEFINE(MOZ_LINKER)
2477 AC_SUBST(MOZ_ENABLE_SZIP)
2479 dnl Only one oddball right now (QNX), but this gives us flexibility
2480 dnl if any other platforms need to override this in the future.
2481 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2483 dnl ========================================================
2484 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2485 dnl by now will not have any way to link most binaries (tests
2486 dnl as well as viewer, apprunner, etc.), because some symbols
2487 dnl will be left out of the "composite" .so's by ld as unneeded.
2488 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2489 dnl they can link in the static libs that provide the missing
2490 dnl symbols.
2491 dnl ========================================================
2492 NO_LD_ARCHIVE_FLAGS=
2493 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2494     NO_LD_ARCHIVE_FLAGS=1
2496 case "$target" in
2497 *-os2*)
2498     NO_LD_ARCHIVE_FLAGS=
2499     ;;
2500 *-aix4.3*|*-aix5*)
2501     NO_LD_ARCHIVE_FLAGS=
2502     ;;
2503 *-mingw*)
2504     if test -z "$GNU_CC"; then
2505         NO_LD_ARCHIVE_FLAGS=
2506     fi
2507     ;;
2508 esac
2509 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2511 dnl ========================================================
2512 dnl = Flags to strip unused symbols from .so components and
2513 dnl = to export jemalloc symbols when linking a program
2514 dnl ========================================================
2515 case "$target" in
2516     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2517         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2518         ;;
2519     *-solaris*)
2520         if test -z "$GNU_CC"; then
2521          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2522         else
2523          if test -z "$GCC_USE_GNU_LD"; then
2524           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2525          else
2526           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2527          fi
2528         fi
2529         ;;
2530     *-darwin*)
2531         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2532         ;;
2533     *-mingw*)
2534         if test -n "$GNU_CC"; then
2535            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2536         fi
2537         ;;
2538 esac
2540 if test -z "$COMPILE_ENVIRONMENT"; then
2541     SKIP_COMPILER_CHECKS=1
2542     SKIP_LIBRARY_CHECKS=1
2545 MOZ_COMPILER_OPTS
2546 if test -z "$SKIP_COMPILER_CHECKS"; then
2547 dnl Checks for typedefs, structures, and compiler characteristics.
2548 dnl ========================================================
2549 AC_HEADER_STDC
2550 AC_C_CONST
2551 AC_TYPE_MODE_T
2552 AC_TYPE_OFF_T
2553 AC_TYPE_PID_T
2554 AC_TYPE_SIZE_T
2555 AC_LANG_CPLUSPLUS
2556 AC_MSG_CHECKING(for __stdcall)
2557 AC_CACHE_VAL(ac_cv___stdcall,
2558  [AC_TRY_COMPILE([template <typename Method> struct foo;
2559                   template <> struct foo<void (*)()> {};
2560                   template <> struct foo<void (__stdcall*)()> {};],
2561                  [],
2562                  [ac_cv___stdcall=true],
2563                  [ac_cv___stdcall=false])])
2564 if test "$ac_cv___stdcall" = true ; then
2565   AC_DEFINE(HAVE_STDCALL)
2566   AC_MSG_RESULT(yes)
2567 else
2568   AC_MSG_RESULT(no)
2570 AC_LANG_C
2571 AC_MSG_CHECKING(for ssize_t)
2572 AC_CACHE_VAL(ac_cv_type_ssize_t,
2573  [AC_TRY_COMPILE([#include <stdio.h>
2574                   #include <sys/types.h>],
2575                  [ssize_t foo = 0;],
2576                  [ac_cv_type_ssize_t=true],
2577                  [ac_cv_type_ssize_t=false])])
2578 if test "$ac_cv_type_ssize_t" = true ; then
2579   AC_DEFINE(HAVE_SSIZE_T)
2580   AC_MSG_RESULT(yes)
2581 else
2582   AC_MSG_RESULT(no)
2584 AC_STRUCT_ST_BLKSIZE
2585 AC_MSG_CHECKING(for siginfo_t)
2586 AC_CACHE_VAL(ac_cv_siginfo_t,
2587  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2588                   #include <signal.h>],
2589                  [siginfo_t* info;],
2590                  [ac_cv_siginfo_t=true],
2591                  [ac_cv_siginfo_t=false])])
2592 if test "$ac_cv_siginfo_t" = true ; then
2593   AC_DEFINE(HAVE_SIGINFO_T)
2594   AC_MSG_RESULT(yes)
2595 else
2596   AC_MSG_RESULT(no)
2599 dnl Check for int64, uint, and uint_t.
2600 dnl ========================================================
2601 AC_MSG_CHECKING(for int64)
2602 AC_CACHE_VAL(ac_cv_int64,
2603  [AC_TRY_COMPILE([#include <stdio.h>
2604                   #include <sys/types.h>],
2605                  [int64 foo = 0;],
2606                  [ac_cv_int64=true],
2607                  [ac_cv_int64=false])])
2608 if test "$ac_cv_int64" = true ; then
2609   AC_DEFINE(HAVE_INT64)
2610   AC_MSG_RESULT(yes)
2611 else
2612   AC_MSG_RESULT(no)
2614 AC_MSG_CHECKING(for uint)
2615 AC_CACHE_VAL(ac_cv_uint,
2616  [AC_TRY_COMPILE([#include <stdio.h>
2617                   #include <sys/types.h>],
2618                  [uint foo = 0;],
2619                  [ac_cv_uint=true],
2620                  [ac_cv_uint=false])])
2621 if test "$ac_cv_uint" = true ; then
2622   AC_DEFINE(HAVE_UINT)
2623   AC_MSG_RESULT(yes)
2624 else
2625   AC_MSG_RESULT(no)
2627 AC_MSG_CHECKING(for uint_t)
2628 AC_CACHE_VAL(ac_cv_uint_t,
2629  [AC_TRY_COMPILE([#include <stdio.h>
2630                   #include <sys/types.h>],
2631                  [uint_t foo = 0;],
2632                  [ac_cv_uint_t=true],
2633                  [ac_cv_uint_t=false])])
2634 if test "$ac_cv_uint_t" = true ; then
2635   AC_DEFINE(HAVE_UINT_T)
2636   AC_MSG_RESULT(yes)
2637 else
2638   AC_MSG_RESULT(no)
2641 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2642 dnl are defined when compiling C++ but not C.  Since the result of this
2643 dnl test is used only in C++, do it in C++.
2644 AC_LANG_CPLUSPLUS
2646 AC_MSG_CHECKING(for uname.domainname)
2647 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2648     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2649         [ struct utsname *res; char *domain;
2650             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2651         [ac_cv_have_uname_domainname_field=true],
2652         [ac_cv_have_uname_domainname_field=false])])
2654 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2655     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2656     AC_MSG_RESULT(yes)
2657 else
2658     AC_MSG_RESULT(no)
2661 AC_MSG_CHECKING(for uname.__domainname)
2662 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2663     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2664         [ struct utsname *res; char *domain;
2665             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2666         [ac_cv_have_uname_us_domainname_field=true],
2667         [ac_cv_have_uname_us_domainname_field=false])])
2669 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2670     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2671     AC_MSG_RESULT(yes)
2672 else
2673     AC_MSG_RESULT(no)
2676 dnl Check whether we can use gcc's c++0x mode
2677 AC_LANG_CPLUSPLUS
2679 if test "$GNU_CXX"; then
2680     _SAVE_CXXFLAGS=$CXXFLAGS
2681     CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2683     AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2684         ac_cv_cxx0x_headers_bug,
2685         [AC_TRY_COMPILE([#include <memory>], [],
2686                         ac_cv_cxx0x_headers_bug="no",
2687                         ac_cv_cxx0x_headers_bug="yes")])
2688     CXXFLAGS="$_SAVE_CXXFLAGS"
2689     if test "$ac_cv_cxx0x_headers_bug" = "no"; then
2690         CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2691     fi
2694 dnl Check for usable char16_t (2 bytes, unsigned)
2695 dnl (we might not need the unsignedness check anymore)
2696 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2697     ac_cv_have_usable_char16_t,
2698     [AC_TRY_COMPILE([$configure_static_assert_macros],
2699                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2700                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2701                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2702                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2703                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2704                     ac_cv_have_usable_char16_t="yes",
2705                     ac_cv_have_usable_char16_t="no")])
2706 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2707     AC_DEFINE(HAVE_CPP_CHAR16_T)
2708     HAVE_CPP_CHAR16_T=1
2709 elif test "$GNU_CXX"; then
2710     CXXFLAGS="$_SAVE_CXXFLAGS"
2713 dnl Check for usable wchar_t (2 bytes, unsigned)
2714 dnl (we really don't need the unsignedness check anymore)
2715 dnl ========================================================
2717 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2718     ac_cv_have_usable_wchar_v2,
2719     [AC_TRY_COMPILE([#include <stddef.h>
2720                      $configure_static_assert_macros],
2721                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2722                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2723                     ac_cv_have_usable_wchar_v2="yes",
2724                     ac_cv_have_usable_wchar_v2="no")])
2725 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2726     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2727     HAVE_CPP_2BYTE_WCHAR_T=1
2728 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2729 dnl This is really gcc-only
2730 dnl Do this test using CXX only since some versions of gcc
2731 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2732 dnl only have short-wchar support for c++.
2733 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2735     _SAVE_CXXFLAGS=$CXXFLAGS
2736     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2738     AC_CACHE_CHECK(for compiler -fshort-wchar option,
2739         ac_cv_have_usable_wchar_option_v2,
2740         [AC_TRY_LINK([#include <stddef.h>
2741                       $configure_static_assert_macros],
2742                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2743                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2744                      ac_cv_have_usable_wchar_option_v2="yes",
2745                      ac_cv_have_usable_wchar_option_v2="no")])
2747     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2748         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2749         HAVE_CPP_2BYTE_WCHAR_T=1
2750         if test "$OS_TARGET" = Android; then
2751             WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
2752             CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
2753             CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
2754             DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
2755         else
2756             WCHAR_CFLAGS="-fshort-wchar"
2757         fi
2758     else
2759         CXXFLAGS=$_SAVE_CXXFLAGS
2760     fi
2763 dnl Check for nullptr (bug 626472)
2764 AC_LANG_CPLUSPLUS
2765 AC_MSG_CHECKING(for nullptr)
2766 AC_CACHE_VAL(ac_cv_nullptr,
2767  [AC_TRY_COMPILE([],
2768                  [int* foo = nullptr;],
2769                  [ac_cv_nullptr=true],
2770                  [ac_cv_nullptr=false])])
2771 if test "$ac_cv_nullptr" = true ; then
2772   AC_DEFINE(HAVE_NULLPTR)
2773   AC_MSG_RESULT(yes)
2774 else
2775   AC_MSG_RESULT(no)
2778 AC_LANG_C
2780 dnl Check for .hidden assembler directive and visibility attribute.
2781 dnl Borrowed from glibc configure.in
2782 dnl ===============================================================
2783 if test "$GNU_CC"; then
2784   AC_CACHE_CHECK(for visibility(hidden) attribute,
2785                  ac_cv_visibility_hidden,
2786                  [cat > conftest.c <<EOF
2787                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2789                   ac_cv_visibility_hidden=no
2790                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2791                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2792                       ac_cv_visibility_hidden=yes
2793                     fi
2794                   fi
2795                   rm -f conftest.[cs]
2796                  ])
2797   if test "$ac_cv_visibility_hidden" = "yes"; then
2798     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2800     AC_CACHE_CHECK(for visibility(default) attribute,
2801                    ac_cv_visibility_default,
2802                    [cat > conftest.c <<EOF
2803                     int foo __attribute__ ((visibility ("default"))) = 1;
2805                     ac_cv_visibility_default=no
2806                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2807                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2808                         ac_cv_visibility_default=yes
2809                       fi
2810                     fi
2811                     rm -f conftest.[cs]
2812                    ])
2813     if test "$ac_cv_visibility_default" = "yes"; then
2814       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2816       AC_CACHE_CHECK(for visibility pragma support,
2817                      ac_cv_visibility_pragma,
2818                      [cat > conftest.c <<EOF
2819 #pragma GCC visibility push(hidden)
2820                       int foo_hidden = 1;
2821 #pragma GCC visibility push(default)
2822                       int foo_default = 1;
2824                       ac_cv_visibility_pragma=no
2825                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2826                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2827                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2828                             ac_cv_visibility_pragma=yes
2829                           fi
2830                         fi
2831                       fi
2832                       rm -f conftest.[cs]
2833                     ])
2834       if test "$ac_cv_visibility_pragma" = "yes"; then
2835         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2836                        ac_cv_have_visibility_class_bug,
2837                        [cat > conftest.c <<EOF
2838 #pragma GCC visibility push(hidden)
2839 struct __attribute__ ((visibility ("default"))) TestStruct {
2840   static void Init();
2842 __attribute__ ((visibility ("default"))) void TestFunc() {
2843   TestStruct::Init();
2846                        ac_cv_have_visibility_class_bug=no
2847                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2848                          ac_cv_have_visibility_class_bug=yes
2849                        else
2850                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2851                            ac_cv_have_visibility_class_bug=yes
2852                          fi
2853                        fi
2854                        rm -rf conftest.{c,S}
2855                        ])
2857         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2858                        ac_cv_have_visibility_builtin_bug,
2859                        [cat > conftest.c <<EOF
2860 #pragma GCC visibility push(hidden)
2861 #pragma GCC visibility push(default)
2862 #include <string.h>
2863 #pragma GCC visibility pop
2865 __attribute__ ((visibility ("default"))) void Func() {
2866   char c[[100]];
2867   memset(c, 0, sizeof(c));
2870                        ac_cv_have_visibility_builtin_bug=no
2871                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2872                          ac_cv_have_visibility_builtin_bug=yes
2873                        else
2874                          if test `grep -c "@PLT" conftest.S` = 0; then
2875                            ac_cv_visibility_builtin_bug=yes
2876                          fi
2877                        fi
2878                        rm -f conftest.{c,S}
2879                        ])
2880         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2881                 "$ac_cv_have_visibility_class_bug" = "no"; then
2882           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2883           WRAP_SYSTEM_INCLUDES=1
2884           STL_FLAGS='-I$(DIST)/stl_wrappers'
2885           WRAP_STL_INCLUDES=1
2886         else
2887           VISIBILITY_FLAGS='-fvisibility=hidden'
2888         fi # have visibility pragma bug
2889       fi   # have visibility pragma
2890     fi     # have visibility(default) attribute
2891   fi       # have visibility(hidden) attribute
2892 fi         # GNU_CC
2894 # visibility hidden flag for Sun Studio on Solaris
2895 if test "$SOLARIS_SUNPRO_CC"; then
2896 VISIBILITY_FLAGS='-xldscope=hidden'
2897 fi         # Sun Studio on Solaris
2899 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2900 AC_SUBST(VISIBILITY_FLAGS)
2902 MOZ_GCC_PR49911
2904 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2905 dnl ========================================================
2906 if test "$GNU_CC"; then
2907   CFLAGS_save="${CFLAGS}"
2908   CFLAGS="${CFLAGS} -Werror"
2909   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2910                  ac_cv_force_align_arg_pointer,
2911                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2912                                  [],
2913                                  ac_cv_force_align_arg_pointer="yes",
2914                                  ac_cv_force_align_arg_pointer="no")])
2915   CFLAGS="${CFLAGS_save}"
2916   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2917     HAVE_GCC_ALIGN_ARG_POINTER=1
2918   else
2919     HAVE_GCC_ALIGN_ARG_POINTER=
2920   fi
2922 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2924 dnl Checks for header files.
2925 dnl ========================================================
2926 AC_HEADER_DIRENT
2927 case "$target_os" in
2928 freebsd*|openbsd*)
2929 # for stuff like -lXshm
2930     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2931     ;;
2932 esac
2933 MOZ_CHECK_COMMON_HEADERS
2935 dnl These are all the places some variant of statfs can be hiding.
2936 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2938 dnl Quota support
2939 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2940 MOZ_CHECK_HEADERS(linux/quota.h)
2942 dnl Try for MMX support
2943 dnl NB - later gcc versions require -mmmx for this header to be successfully
2944 dnl included (or another option which implies it, such as -march=pentium-mmx)
2945 MOZ_CHECK_HEADERS(mmintrin.h)
2947 dnl Check whether the compiler supports the new-style C++ standard
2948 dnl library headers (i.e. <new>) or needs the old "new.h"
2949 AC_LANG_CPLUSPLUS
2950 NEW_H=new.h
2951 MOZ_CHECK_HEADER(new, [NEW_H=new])
2952 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2953 AC_LANG_C
2955 AC_ARG_ENABLE(dtrace,
2956               [  --enable-dtrace         build with dtrace support if available (default=no)],
2957               [enable_dtrace="yes"],)
2958 if test "x$enable_dtrace" = "xyes"; then
2959   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2960   if test -n "$HAVE_DTRACE"; then
2961       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2962   else
2963       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2964   fi
2966 AC_SUBST(HAVE_DTRACE)
2968 case $target in
2969 *-aix4.3*|*-aix5*)
2970         ;;
2972         MOZ_CHECK_HEADERS(sys/cdefs.h)
2973         ;;
2974 esac
2976 MOZ_LINUX_PERF_EVENT
2978 dnl Checks for libraries.
2979 dnl ========================================================
2980 case $target in
2981 *-hpux11.*)
2982         ;;
2984         AC_CHECK_LIB(c_r, gethostbyname_r)
2985         ;;
2986 esac
2988 dnl We don't want to link with libdl even if it's present on OS X, since
2989 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2990 dnl in libc.
2991 dnl We don't want to link against libm or libpthread on Darwin since
2992 dnl they both are just symlinks to libSystem and explicitly linking
2993 dnl against libSystem causes issues when debugging (see bug 299601).
2994 case $target in
2995 *-darwin*)
2996     ;;
2997 *-os2*)
2998     ;;
3000     AC_SEARCH_LIBS(dlopen, dl,
3001         MOZ_CHECK_HEADER(dlfcn.h,
3002         AC_DEFINE(HAVE_DLOPEN)))
3003     ;;
3004 esac
3006 _SAVE_CFLAGS="$CFLAGS"
3007 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3008 AC_CHECK_FUNCS(dladdr memmem)
3009 CFLAGS="$_SAVE_CFLAGS"
3011 if test ! "$GNU_CXX"; then
3013     case $target in
3014     *-aix*)
3015         AC_CHECK_LIB(C_r, demangle)
3016         ;;
3017      *)
3018         AC_CHECK_LIB(C, demangle)
3019         ;;
3020      esac
3023 dnl OS/2 has socket in libc.
3024 case $target in
3025 *-os2*)
3026     ;;
3028     AC_CHECK_LIB(socket, socket)
3029 esac
3031 XLDFLAGS="$X_LIBS"
3032 XLIBS="$X_EXTRA_LIBS"
3034 dnl ========================================================
3035 dnl Checks for X libraries.
3036 dnl Ordering is important.
3037 dnl Xt is dependent upon SM as of X11R6
3038 dnl ========================================================
3039 if test "$no_x" = "yes"; then
3040     AC_DEFINE(NO_X11)
3041 else
3042     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3043         XLIBS="-lX11 $XLIBS"
3044         _SAVE_LDFLAGS="$LDFLAGS"
3045         LDFLAGS="$XLDFLAGS $LDFLAGS"
3046         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3047                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3048         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3049                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3051         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3052         unset ac_cv_lib_Xt_XtFree
3053             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3054             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3055         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3056                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3057         ])
3059     # AIX needs the motif library linked before libXt to prevent
3060     # crashes in plugins linked against Motif - Bug #98892
3061     case "${target_os}" in
3062     aix*)
3063         XT_LIBS="-lXm $XT_LIBS"
3064         ;;
3065     esac
3067     dnl ========================================================
3068     dnl = Check for XShm
3069     dnl ========================================================
3070     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3071         $XLIBS $XEXT_LIBS)
3073     dnl ========================================================
3074     dnl = Check for Xss
3075     dnl ========================================================
3076     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3077         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3078             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3079              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3081         LDFLAGS="$_SAVE_LDFLAGS"
3082 fi # $no_x
3084 AC_SUBST(XCFLAGS)
3085 AC_SUBST(XLDFLAGS)
3086 AC_SUBST(XLIBS)
3087 AC_SUBST(XEXT_LIBS)
3088 AC_SUBST(XT_LIBS)
3089 AC_SUBST(XSS_LIBS)
3091 dnl ========================================================
3092 dnl = pthread support
3093 dnl = Start by checking whether the system support pthreads
3094 dnl ========================================================
3095 case "$target_os" in
3096 darwin*)
3097     USE_PTHREADS=1
3098     ;;
3100     MOZ_CHECK_PTHREADS(pthreads,
3101         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3102         MOZ_CHECK_PTHREADS(pthread,
3103             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3104             MOZ_CHECK_PTHREADS(c_r,
3105                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3106                 MOZ_CHECK_PTHREADS(c,
3107                     USE_PTHREADS=1
3108                 )
3109             )
3110         )
3111     )
3112     ;;
3113 esac
3115 dnl ========================================================
3116 dnl Check the command line for --with-pthreads
3117 dnl ========================================================
3118 MOZ_ARG_WITH_BOOL(pthreads,
3119 [  --with-pthreads         Force use of system pthread library with NSPR ],
3120 [ if test "$USE_PTHREADS"x = x; then
3121     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3122 fi],
3123     USE_PTHREADS=
3124     _PTHREAD_LDFLAGS=
3127 dnl ========================================================
3128 dnl Do the platform specific pthread hackery
3129 dnl ========================================================
3130 if test "$USE_PTHREADS"x != x
3131 then
3132         dnl
3133         dnl See if -pthread is supported.
3134         dnl
3135         rm -f conftest*
3136         ac_cv_have_dash_pthread=no
3137         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3138         echo 'int main() { return 0; }' | cat > conftest.c
3139         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3140         if test $? -eq 0; then
3141                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3142                         ac_cv_have_dash_pthread=yes
3143                 case "$target_os" in
3144                 freebsd*)
3145 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3146                 ;;
3147                 *)
3148                             CFLAGS="$CFLAGS -pthread"
3149                             CXXFLAGS="$CXXFLAGS -pthread"
3150                 ;;
3151                 esac
3152                 fi
3153         fi
3154         rm -f conftest*
3155     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3157         dnl
3158         dnl See if -pthreads is supported.
3159         dnl
3160     ac_cv_have_dash_pthreads=no
3161     if test "$ac_cv_have_dash_pthread" = "no"; then
3162             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3163         echo 'int main() { return 0; }' | cat > conftest.c
3164             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3165         if test $? -eq 0; then
3166                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3167                             ac_cv_have_dash_pthreads=yes
3168                             CFLAGS="$CFLAGS -pthreads"
3169                             CXXFLAGS="$CXXFLAGS -pthreads"
3170                     fi
3171             fi
3172             rm -f conftest*
3173         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3174     fi
3176         case "$target" in
3177             *-*-freebsd*)
3178                         AC_DEFINE(_REENTRANT)
3179                         AC_DEFINE(_THREAD_SAFE)
3180                         dnl -pthread links in -lpthread, so don't specify it explicitly.
3181                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3182                                 _PTHREAD_LDFLAGS="-pthread"
3183                         fi
3184                         ;;
3186             *-*-openbsd*|*-*-bsdi*)
3187                         AC_DEFINE(_REENTRANT)
3188                         AC_DEFINE(_THREAD_SAFE)
3189                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3190                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3191                 _PTHREAD_LDFLAGS="-pthread"
3192                         fi
3193                         ;;
3195             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3196                         AC_DEFINE(_REENTRANT)
3197                         ;;
3199             *-aix4.3*|*-aix5*)
3200                         AC_DEFINE(_REENTRANT)
3201                         ;;
3203             *-hpux11.*)
3204                         AC_DEFINE(_REENTRANT)
3205                         ;;
3207             *-*-solaris*)
3208                         AC_DEFINE(_REENTRANT)
3209                         if test "$SOLARIS_SUNPRO_CC"; then
3210                                 CFLAGS="$CFLAGS -mt"
3211                                 CXXFLAGS="$CXXFLAGS -mt"
3212                         fi
3213                         ;;
3214         esac
3215     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3219 dnl Checks for library functions.
3220 dnl ========================================================
3221 AC_PROG_GCC_TRADITIONAL
3222 AC_FUNC_MEMCMP
3223 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3224 AC_CHECK_FUNCS(flockfile getpagesize)
3225 AC_CHECK_FUNCS(localtime_r strtok_r)
3227 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3228 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3229                ac_cv_clock_monotonic,
3230                [for libs in "" -lrt; do
3231                     _SAVE_LIBS="$LIBS"
3232                     LIBS="$LIBS $libs"
3233                     AC_TRY_LINK([#include <time.h>],
3234                                  [ struct timespec ts;
3235                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
3236                                  ac_cv_clock_monotonic=$libs
3237                                  LIBS="$_SAVE_LIBS"
3238                                  break,
3239                                  ac_cv_clock_monotonic=no)
3240                     LIBS="$_SAVE_LIBS"
3241                 done])
3242 if test "$ac_cv_clock_monotonic" != "no"; then
3243     HAVE_CLOCK_MONOTONIC=1
3244     REALTIME_LIBS=$ac_cv_clock_monotonic
3245     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3246     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3247     AC_SUBST(REALTIME_LIBS)
3250 dnl check for wcrtomb/mbrtowc
3251 dnl =======================================================================
3252 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3253 AC_LANG_SAVE
3254 AC_LANG_CPLUSPLUS
3255 AC_CACHE_CHECK(for wcrtomb,
3256     ac_cv_have_wcrtomb,
3257     [AC_TRY_LINK([#include <wchar.h>],
3258                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3259                  ac_cv_have_wcrtomb="yes",
3260                  ac_cv_have_wcrtomb="no")])
3261 if test "$ac_cv_have_wcrtomb" = "yes"; then
3262     AC_DEFINE(HAVE_WCRTOMB)
3264 AC_CACHE_CHECK(for mbrtowc,
3265     ac_cv_have_mbrtowc,
3266     [AC_TRY_LINK([#include <wchar.h>],
3267                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3268                  ac_cv_have_mbrtowc="yes",
3269                  ac_cv_have_mbrtowc="no")])
3270 if test "$ac_cv_have_mbrtowc" = "yes"; then
3271     AC_DEFINE(HAVE_MBRTOWC)
3273 AC_LANG_RESTORE
3276 AC_CACHE_CHECK(
3277     [for res_ninit()],
3278     ac_cv_func_res_ninit,
3279     [AC_TRY_LINK([
3280         #ifdef linux
3281         #define _BSD_SOURCE 1
3282         #endif
3283         #include <resolv.h>
3284         ],
3285         [int foo = res_ninit(&_res);],
3286         [ac_cv_func_res_ninit=yes],
3287         [ac_cv_func_res_ninit=no])
3288     ])
3290 if test "$ac_cv_func_res_ninit" = "yes"; then
3291     AC_DEFINE(HAVE_RES_NINIT)
3292 dnl must add the link line we do something as foolish as this... dougt
3293 dnl else
3294 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3295 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3298 AC_LANG_CPLUSPLUS
3299 AC_CACHE_CHECK(
3300     [for gnu_get_libc_version()],
3301     ac_cv_func_gnu_get_libc_version,
3302     [AC_TRY_LINK([
3303         #ifdef HAVE_GNU_LIBC_VERSION_H
3304         #include <gnu/libc-version.h>
3305         #endif
3306         ],
3307         [const char *glibc_version = gnu_get_libc_version();],
3308         [ac_cv_func_gnu_get_libc_version=yes],
3309         [ac_cv_func_gnu_get_libc_version=no]
3310         )]
3311     )
3313 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3314     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3317 case $target_os in
3318     darwin*|mingw*|os2*)
3319         ;;
3320     *)
3322 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3323     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3324         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3325 _SAVE_LIBS=$LIBS
3326 LIBS="$LIBS $_ICONV_LIBS"
3327 AC_CACHE_CHECK(
3328     [for iconv()],
3329     ac_cv_func_iconv,
3330     [AC_TRY_LINK([
3331         #include <stdlib.h>
3332         #include <iconv.h>
3333         ],
3334         [
3335             iconv_t h = iconv_open("", "");
3336             iconv(h, NULL, NULL, NULL, NULL);
3337             iconv_close(h);
3338         ],
3339         [ac_cv_func_iconv=yes],
3340         [ac_cv_func_iconv=no]
3341         )]
3342     )
3343 if test "$ac_cv_func_iconv" = "yes"; then
3344     AC_DEFINE(HAVE_ICONV)
3345     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3346     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3347     LIBICONV="$_ICONV_LIBS"
3348     AC_CACHE_CHECK(
3349         [for iconv() with const input],
3350         ac_cv_func_const_iconv,
3351         [AC_TRY_COMPILE([
3352             #include <stdlib.h>
3353             #include <iconv.h>
3354             ],
3355             [
3356                 const char *input = "testing";
3357                 iconv_t h = iconv_open("", "");
3358                 iconv(h, &input, NULL, NULL, NULL);
3359                 iconv_close(h);
3360             ],
3361             [ac_cv_func_const_iconv=yes],
3362             [ac_cv_func_const_iconv=no]
3363             )]
3364         )
3365     if test "$ac_cv_func_const_iconv" = "yes"; then
3366         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3367     fi
3369 LIBS=$_SAVE_LIBS
3371     ;;
3372 esac
3374 AM_LANGINFO_CODESET
3376 AC_LANG_C
3378 dnl **********************
3379 dnl *** va_copy checks ***
3380 dnl **********************
3381 dnl we currently check for all three va_copy possibilities, so we get
3382 dnl all results in config.log for bug reports.
3383 AC_MSG_CHECKING(for an implementation of va_copy())
3384 AC_CACHE_VAL(ac_cv_va_copy,[
3385     AC_TRY_RUN([
3386         #include <stdarg.h>
3387         void f (int i, ...) {
3388             va_list args1, args2;
3389             va_start (args1, i);
3390             va_copy (args2, args1);
3391             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3392                 exit (1);
3393             va_end (args1); va_end (args2);
3394         }
3395         int main() { f (0, 42); return 0; }],
3396         ac_cv_va_copy=yes,
3397         ac_cv_va_copy=no,
3398         ac_cv_va_copy=no
3399     )
3401 AC_MSG_RESULT($ac_cv_va_copy)
3402 AC_MSG_CHECKING(for an implementation of __va_copy())
3403 AC_CACHE_VAL(ac_cv___va_copy,[
3404     AC_TRY_RUN([
3405         #include <stdarg.h>
3406         void f (int i, ...) {
3407             va_list args1, args2;
3408             va_start (args1, i);
3409             __va_copy (args2, args1);
3410             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3411                 exit (1);
3412             va_end (args1); va_end (args2);
3413         }
3414         int main() { f (0, 42); return 0; }],
3415         ac_cv___va_copy=yes,
3416         ac_cv___va_copy=no,
3417         ac_cv___va_copy=no
3418     )
3420 AC_MSG_RESULT($ac_cv___va_copy)
3421 AC_MSG_CHECKING(whether va_lists can be copied by value)
3422 AC_CACHE_VAL(ac_cv_va_val_copy,[
3423     AC_TRY_RUN([
3424         #include <stdarg.h>
3425         void f (int i, ...) {
3426             va_list args1, args2;
3427             va_start (args1, i);
3428             args2 = args1;
3429             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3430                 exit (1);
3431             va_end (args1); va_end (args2);
3432         }
3433         int main() { f (0, 42); return 0; }],
3434         ac_cv_va_val_copy=yes,
3435         ac_cv_va_val_copy=no,
3436         ac_cv_va_val_copy=yes
3437     )
3439 if test "x$ac_cv_va_copy" = "xyes"; then
3440     AC_DEFINE(VA_COPY, va_copy)
3441     AC_DEFINE(HAVE_VA_COPY)
3442 elif test "x$ac_cv___va_copy" = "xyes"; then
3443     AC_DEFINE(VA_COPY, __va_copy)
3444     AC_DEFINE(HAVE_VA_COPY)
3447 if test "x$ac_cv_va_val_copy" = "xno"; then
3448    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3450 AC_MSG_RESULT($ac_cv_va_val_copy)
3452 dnl ===================================================================
3453 dnl ========================================================
3454 dnl Put your C++ language/feature checks below
3455 dnl ========================================================
3456 AC_LANG_CPLUSPLUS
3458 ARM_ABI_PREFIX=
3459 if test "$GNU_CC"; then
3460   if test "$CPU_ARCH" = "arm" ; then
3461     AC_CACHE_CHECK(for ARM EABI,
3462         ac_cv_gcc_arm_eabi,
3463         [AC_TRY_COMPILE([],
3464                         [
3465 #if defined(__ARM_EABI__)
3466   return 0;
3467 #else
3468 #error Not ARM EABI.
3469 #endif
3470                         ],
3471                         ac_cv_gcc_arm_eabi="yes",
3472                         ac_cv_gcc_arm_eabi="no")])
3473     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3474         HAVE_ARM_EABI=1
3475         ARM_ABI_PREFIX=eabi-
3476     else
3477         ARM_ABI_PREFIX=oabi-
3478     fi
3479   fi
3481   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3484 dnl Check for support of modern template specialization syntax
3485 dnl Test code and requirement from scc@netscape.com.
3486 dnl Autoconf cut-and-paste job by waterson@netscape.com
3487 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3488                ac_cv_cpp_modern_specialize_template_syntax,
3489                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3490                                class Y {};
3491                                template <> struct X<Y> { double a; };,
3492                                X<int> int_x;
3493                                X<Y> y_x;,
3494                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3495                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3496 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
3497   AC_MSG_ERROR([The C++ compiler does not support template specialization])
3500 dnl Some compilers support only full specialization, and some don't.
3501 AC_CACHE_CHECK(whether partial template specialization works,
3502                ac_cv_cpp_partial_specialization,
3503                [AC_TRY_COMPILE(template <class T> class Foo {};
3504                                template <class T> class Foo<T*> {};,
3505                                return 0;,
3506                                ac_cv_cpp_partial_specialization=yes,
3507                                ac_cv_cpp_partial_specialization=no)])
3508 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3509   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3512 dnl Check to see if we can resolve ambiguity with |using|.
3513 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3514                ac_cv_cpp_ambiguity_resolving_using,
3515                [AC_TRY_COMPILE(class X {
3516                                  public: int go(const X&) {return 3;}
3517                                          int jo(const X&) {return 3;}
3518                                };
3519                                class Y : public X {
3520                                  public:  int go(int) {return 2;}
3521                                           int jo(int) {return 2;}
3522                                           using X::jo;
3523                                  private: using X::go;
3524                                };,
3525                                X x; Y y; y.jo(x);,
3526                                ac_cv_cpp_ambiguity_resolving_using=yes,
3527                                ac_cv_cpp_ambiguity_resolving_using=no)])
3528 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3529    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3532 dnl See if a dynamic_cast to void* gives the most derived object.
3533 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3534                ac_cv_cpp_dynamic_cast_void_ptr,
3535                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3536                             class Y { int j; public: virtual ~Y() { } };
3537                             class Z : public X, public Y { int k; };
3539                             int main() {
3540                                  Z mdo;
3541                                  X *subx = (X*)&mdo;
3542                                  Y *suby = (Y*)&mdo;
3543                                  return !((((void*)&mdo != (void*)subx) &&
3544                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3545                                           (((void*)&mdo != (void*)suby) &&
3546                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3547                             }],
3548                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3549                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3550                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3551 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3552    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3556 dnl note that this one is reversed - if the test fails, then
3557 dnl we require implementations of unused virtual methods. Which
3558 dnl really blows because it means we'll have useless vtable
3559 dnl bloat.
3560 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3561                ac_cv_cpp_unused_required,
3562                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3563                                X x;,
3564                                ac_cv_cpp_unused_required=no,
3565                                ac_cv_cpp_unused_required=yes)])
3566 if test "$ac_cv_cpp_unused_required" = yes ; then
3567    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3571 dnl Some compilers have trouble comparing a constant reference to a templatized
3572 dnl class to zero, and require an explicit operator==() to be defined that takes
3573 dnl an int. This test separates the strong from the weak.
3575 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3576                ac_cv_trouble_comparing_to_zero,
3577                [AC_TRY_COMPILE([#include <algorithm>
3578                                 template <class T> class Foo {};
3579                                 class T2;
3580                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3581                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3582                                [Foo<int> f; return (0 != f);],
3583                                ac_cv_trouble_comparing_to_zero=no,
3584                                ac_cv_trouble_comparing_to_zero=yes)])
3585 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3586   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3589 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3590 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3591 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3592 # linking XUL.
3593 _SAVE_LDFLAGS=$LDFLAGS
3594 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3595 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3596                ac_cv_thread_keyword,
3597                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3598                             [return tlsIsMainThread;],
3599                             ac_cv_thread_keyword=yes,
3600                             ac_cv_thread_keyword=no)])
3601 LDFLAGS=$_SAVE_LDFLAGS
3602 # The custom dynamic linker doesn't support TLS variables
3603 MOZ_TLS=
3604 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3605   # mips builds fail with TLS variables because of a binutils bug.
3606   # See bug 528687
3607   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3608   case "${target}" in
3609     mips*-*)
3610       :
3611       ;;
3612     *-android*|*-linuxandroid*)
3613       :
3614       ;;
3615     *-openbsd*)
3616       :
3617       ;;
3618     *)
3619       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3620       MOZ_TLS=1
3621       ;;
3622   esac
3625 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3626 if test -n "$MOZ_LINKER"; then
3627   if test "$CPU_ARCH" = arm; then
3628     dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
3629     ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
3630     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3631     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3632       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000"
3633       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000"
3634     fi
3635   fi
3638 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3639 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3640 dnl We however want to avoid these text relocations, and this can be done
3641 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3642 dnl doesn't contain anything at all, beside placeholders for some sections,
3643 dnl and crtbegin only contains a finalizer function that calls
3644 dnl __cxa_finalize. The custom linker actually takes care of calling
3645 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3646 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3647 dnl link crtbegin and crtend at all.
3648 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$OS_TARGET" = "Android"; then
3649   AC_CACHE_CHECK([whether the CRT objects have text relocations],
3650     ac_cv_crt_has_text_relocations,
3651     [echo 'int foo() { return 0; }' > conftest.cpp
3652      if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3653         test -s conftest${DLL_SUFFIX}; then
3654        if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3655          ac_cv_crt_has_text_relocations=yes
3656        else
3657          ac_cv_crt_has_text_relocations=no
3658        fi
3659      else
3660        AC_ERROR([couldn't compile a simple C file])
3661      fi
3662      rm -rf conftest*])
3663   if test "$ac_cv_crt_has_text_relocations" = yes; then
3664     dnl While we want libraries to skip the CRT files, we don't want
3665     dnl executables to be treated the same way. We thus set the flag
3666     dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3667     dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3668     dnl Using LDFLAGS in nspr is safe, since we only really build
3669     dnl libraries there.
3670     DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3671     NSPR_LDFLAGS=-nostartfiles
3672   fi
3675 dnl Check for the existence of various allocation headers/functions
3677 MALLOC_H=
3678 MOZ_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
3679 if test "$MALLOC_H" = ""; then
3680   MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
3681   if test "$MALLOC_H" = ""; then
3682     MOZ_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
3683   fi
3685 if test "$MALLOC_H" != ""; then
3686    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3689 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3690 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3692 dnl See if compiler supports some gcc-style attributes
3694 AC_CACHE_CHECK(for __attribute__((always_inline)),
3695                ac_cv_attribute_always_inline,
3696                [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3697                                [],
3698                                ac_cv_attribute_always_inline=yes,
3699                                ac_cv_attribute_always_inline=no)])
3701 AC_CACHE_CHECK(for __attribute__((malloc)),
3702                ac_cv_attribute_malloc,
3703                [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3704                                [],
3705                                ac_cv_attribute_malloc=yes,
3706                                ac_cv_attribute_malloc=no)])
3708 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3709                ac_cv_attribute_warn_unused,
3710                [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3711                                [],
3712                                ac_cv_attribute_warn_unused=yes,
3713                                ac_cv_attribute_warn_unused=no)])
3715 dnl End of C++ language/feature checks
3716 AC_LANG_C
3718 dnl ========================================================
3719 dnl =  Internationalization checks
3720 dnl ========================================================
3722 dnl Internationalization and Locale support is different
3723 dnl on various UNIX platforms.  Checks for specific i18n
3724 dnl features go here.
3726 dnl check for LC_MESSAGES
3727 AC_CACHE_CHECK(for LC_MESSAGES,
3728                 ac_cv_i18n_lc_messages,
3729                 [AC_TRY_COMPILE([#include <locale.h>],
3730                                 [int category = LC_MESSAGES;],
3731                                 ac_cv_i18n_lc_messages=yes,
3732                                 ac_cv_i18n_lc_messages=no)])
3733 if test "$ac_cv_i18n_lc_messages" = yes; then
3734    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3737 AC_HAVE_FUNCS(localeconv)
3738 fi # ! SKIP_COMPILER_CHECKS
3740 TARGET_XPCOM_ABI=
3741 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3742     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3745 dnl Mozilla specific options
3746 dnl ========================================================
3747 dnl The macros used for command line options
3748 dnl are defined in build/autoconf/altoptions.m4.
3750 dnl If the compiler supports these attributes, define them as
3751 dnl convenience macros.
3752 if test "$ac_cv_attribute_always_inline" = yes ; then
3753   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
3754 else
3755   AC_DEFINE(NS_ALWAYS_INLINE,)
3758 if test "$ac_cv_attribute_malloc" = yes ; then
3759   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3760 else
3761   AC_DEFINE(NS_ATTR_MALLOC,)
3764 if test "$ac_cv_attribute_warn_unused" = yes ; then
3765   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3766 else
3767   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3770 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3771 dnl features that Windows actually does support.
3773 if test -n "$SKIP_COMPILER_CHECKS"; then
3774    dnl Windows has malloc.h
3775    AC_DEFINE(MALLOC_H, [<malloc.h>])
3776    AC_DEFINE(HAVE_FORCEINLINE)
3777    AC_DEFINE(HAVE_LOCALECONV)
3778 fi # SKIP_COMPILER_CHECKS
3780 dnl ========================================================
3781 dnl =
3782 dnl = Check for external package dependencies
3783 dnl =
3784 dnl ========================================================
3785 MOZ_ARG_HEADER(External Packages)
3787 MOZ_ARG_WITH_STRING(libxul-sdk,
3788 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
3789   LIBXUL_SDK_DIR=$withval)
3791 if test "$LIBXUL_SDK_DIR" = "yes"; then
3792     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3793 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3794     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3796     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3797         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3798     fi
3801 AC_SUBST(LIBXUL_SDK)
3803 if test -n "$LIBXUL_SDK"; then
3804     LIBXUL_DIST="$LIBXUL_SDK"
3805 else
3806     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3808 AC_SUBST(LIBXUL_DIST)
3810 SYSTEM_LIBXUL=
3812 MOZ_ARG_WITH_BOOL(system-libxul,
3813 [  --with-system-libxul    Use system installed libxul SDK],
3814     SYSTEM_LIBXUL=1)
3816 dnl ========================================================
3817 dnl = If NSPR was not detected in the system,
3818 dnl = use the one in the source tree (mozilla/nsprpub)
3819 dnl ========================================================
3820 MOZ_ARG_WITH_BOOL(system-nspr,
3821 [  --with-system-nspr      Use system installed NSPR],
3822     _USE_SYSTEM_NSPR=1 )
3824 if test -n "$_USE_SYSTEM_NSPR"; then
3825     AM_PATH_NSPR(4.9.0, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
3828 if test -n "$MOZ_NATIVE_NSPR"; then
3829     _SAVE_CFLAGS=$CFLAGS
3830     CFLAGS="$CFLAGS $NSPR_CFLAGS"
3831     AC_TRY_COMPILE([#include "prtypes.h"],
3832                 [#ifndef PR_STATIC_ASSERT
3833                  #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3834                  #endif],
3835                 [MOZ_NATIVE_NSPR=1],
3836                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3837     AC_TRY_COMPILE([#include "prtypes.h"],
3838                 [#ifndef PR_UINT64
3839                  #error PR_UINT64 not defined or requires including prtypes.h
3840                  #endif],
3841                 [MOZ_NATIVE_NSPR=1],
3842                 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3843     CFLAGS=$_SAVE_CFLAGS
3844 else
3845     if test -z "$LIBXUL_SDK"; then
3846         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3847         if test -n "$GNU_CC"; then
3848             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3849         else
3850             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3851         fi
3852     else
3853         NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3854         NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3855     fi
3858 dnl system libevent Support
3859 dnl ========================================================
3860 MOZ_ARG_WITH_STRING(system-libevent,
3861 [  --with-system-libevent=[PFX]
3862                           Use system libevent [installed at prefix PFX]],
3863     LIBEVENT_DIR=$withval)
3865 _SAVE_CFLAGS=$CFLAGS
3866 _SAVE_LDFLAGS=$LDFLAGS
3867 _SAVE_LIBS=$LIBS
3868 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3869     MOZ_NATIVE_LIBEVENT=
3870 else
3871     if test "${LIBEVENT_DIR}" = "yes"; then
3872         LIBEVENT_DIR=/usr
3873     fi
3874     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3875     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3876     MOZ_CHECK_HEADER(event.h,
3877         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3878              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3879          fi],
3880         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3881     AC_CHECK_LIB(event, event_init,
3882                  [MOZ_NATIVE_LIBEVENT=1
3883                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
3884                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3885                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
3887 CFLAGS=$_SAVE_CFLAGS
3888 LDFLAGS=$_SAVE_LDFLAGS
3889 LIBS=$_SAVE_LIBS
3891 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3892 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
3893 AC_SUBST(MOZ_LIBEVENT_LIBS)
3895 dnl ========================================================
3896 dnl = If NSS was not detected in the system,
3897 dnl = use the one in the source tree (mozilla/security/nss)
3898 dnl ========================================================
3900 MOZ_ARG_WITH_BOOL(system-nss,
3901 [  --with-system-nss       Use system installed NSS],
3902     _USE_SYSTEM_NSS=1 )
3904 if test -n "$_USE_SYSTEM_NSS"; then
3905     AM_PATH_NSS(3.13.2, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3908 if test -n "$MOZ_NATIVE_NSS"; then
3909    NSS_LIBS="$NSS_LIBS -lcrmf"
3910 else
3911    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3912    NSS_DEP_LIBS="\
3913         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3914         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
3915         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
3916         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
3917         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
3919    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
3920        NSS_LIBS="\
3921         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3922         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3923         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3924         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3925         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3926    else
3927        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3928    fi
3931 dnl ======================
3932 dnl Detect yasm
3933 dnl ======================
3935 AC_MSG_CHECKING([for YASM assembler])
3936 AC_CHECK_PROGS(YASM, yasm, "")
3938 if test -n "$YASM"; then
3939   dnl Pull out yasm's version string
3940   changequote(,)
3941   _YASM_VER_FILTER='s|.* \([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*|\1|p'
3942   changequote([,])
3944   YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
3945   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3946   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3947   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3948   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3951 if test -z "$SKIP_LIBRARY_CHECKS"; then
3952 dnl system JPEG support
3953 dnl ========================================================
3954 MOZ_ARG_WITH_STRING(system-jpeg,
3955 [  --with-system-jpeg[=PFX]
3956                           Use system libjpeg [installed at prefix PFX]],
3957     JPEG_DIR=$withval)
3959 _SAVE_CFLAGS=$CFLAGS
3960 _SAVE_LDFLAGS=$LDFLAGS
3961 _SAVE_LIBS=$LIBS
3962 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3963     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3964     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3966 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3967     MOZ_NATIVE_JPEG=
3968 else
3969     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3972 if test "$MOZ_NATIVE_JPEG" = 1; then
3973     AC_TRY_COMPILE([ #include <stdio.h>
3974                      #include <sys/types.h>
3975                      #include <jpeglib.h> ],
3976                    [ #if JPEG_LIB_VERSION < $MOZJPEG
3977                      #error "Insufficient JPEG library version ($MOZJPEG required)."
3978                      #endif ],
3979                    MOZ_NATIVE_JPEG=1,
3980                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3982 CFLAGS=$_SAVE_CFLAGS
3983 LDFLAGS=$_SAVE_LDFLAGS
3984 LIBS=$_SAVE_LIBS
3986 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3987     MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3988     MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3990 fi # SKIP_LIBRARY_CHECKS
3992 dnl system ZLIB support
3993 dnl ========================================================
3994 MOZ_ZLIB_CHECK([1.2.3])
3996 if test "$MOZ_NATIVE_ZLIB" != 1; then
3997     MOZ_ZLIB_CFLAGS=
3998     MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
4001 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
4002     AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4005 if test -z "$SKIP_LIBRARY_CHECKS"; then
4006 dnl system BZIP2 Support
4007 dnl ========================================================
4008 MOZ_ARG_WITH_STRING(system-bz2,
4009 [  --with-system-bz2[=PFX]
4010                           Use system libbz2 [installed at prefix PFX]],
4011     BZ2_DIR=$withval)
4013 _SAVE_CFLAGS=$CFLAGS
4014 _SAVE_LDFLAGS=$LDFLAGS
4015 _SAVE_LIBS=$LIBS
4016 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4017     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4018     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4020 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4021     MOZ_NATIVE_BZ2=
4022 else
4023     AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
4024         [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
4026 CFLAGS=$_SAVE_CFLAGS
4027 LDFLAGS=$_SAVE_LDFLAGS
4028 LIBS=$_SAVE_LIBS
4030 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
4031     MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
4032     MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4035 dnl system PNG Support
4036 dnl ========================================================
4037 MOZ_ARG_WITH_STRING(system-png,
4038 [  --with-system-png[=PFX]
4039                           Use system libpng [installed at prefix PFX]],
4040     PNG_DIR=$withval)
4042 _SAVE_CFLAGS=$CFLAGS
4043 _SAVE_LDFLAGS=$LDFLAGS
4044 _SAVE_LIBS=$LIBS
4045 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4046     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4047     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4049 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4050     MOZ_NATIVE_PNG=
4051 else
4052     AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
4053                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4054     AC_CHECK_LIB(png, png_get_acTL, ,
4055                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
4057 if test "$MOZ_NATIVE_PNG" = 1; then
4058     AC_TRY_COMPILE([ #include <stdio.h>
4059                      #include <sys/types.h>
4060                      #include <png.h> ],
4061                    [ #if PNG_LIBPNG_VER < $MOZPNG
4062                      #error "Insufficient libpng version ($MOZPNG required)."
4063                      #endif
4064                      #ifndef PNG_UINT_31_MAX
4065                      #error "Insufficient libpng version."
4066                      #endif ],
4067                    MOZ_NATIVE_PNG=1,
4068                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4070 CFLAGS=$_SAVE_CFLAGS
4071 LDFLAGS=$_SAVE_LDFLAGS
4072 LIBS=$_SAVE_LIBS
4074 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
4075     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
4076     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
4079 fi # SKIP_LIBRARY_CHECKS
4081 dnl system HunSpell Support
4082 dnl ========================================================
4083 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4084 [  --enable-system-hunspell
4085                           Use system hunspell (located with pkgconfig)],
4086     MOZ_NATIVE_HUNSPELL=1 )
4088 if test -n "$MOZ_NATIVE_HUNSPELL"; then
4089     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4092 AC_SUBST(MOZ_NATIVE_HUNSPELL)
4094 dnl ========================================================
4095 dnl system libffi Support
4096 dnl ========================================================
4097 MOZ_ARG_ENABLE_BOOL(system-ffi,
4098 [  --enable-system-ffi       Use system libffi (located with pkgconfig)],
4099     MOZ_NATIVE_FFI=1 )
4101 if test -n "$MOZ_NATIVE_FFI"; then
4102     # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4103     # for non-GCC compilers.
4104     if test -z "$GNU_CC"; then
4105         PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4106     else
4107         PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4108     fi
4109     MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4112 dnl ========================================================
4113 dnl Java SDK support
4114 dnl ========================================================
4116 JAVA_BIN_PATH=
4117 MOZ_ARG_WITH_STRING(java-bin-path,
4118 [  --with-java-bin-path=dir
4119                           Location of Java binaries (java, javac, jar)],
4120     JAVA_BIN_PATH=$withval)
4122 dnl ========================================================
4123 dnl =
4124 dnl = Application
4125 dnl =
4126 dnl ========================================================
4128 MOZ_ARG_HEADER(Application)
4130 ENABLE_TESTS=1
4131 ENABLE_SYSTEM_EXTENSION_DIRS=1
4132 MOZ_BRANDING_DIRECTORY=
4133 MOZ_OFFICIAL_BRANDING=
4134 MOZ_FEEDS=1
4135 MOZ_FLEXBOX=
4136 MOZ_WEBAPP_RUNTIME=
4137 MOZ_JSDEBUGGER=1
4138 MOZ_AUTH_EXTENSION=1
4139 MOZ_OGG=1
4140 MOZ_RAW=
4141 MOZ_SYDNEYAUDIO=
4142 MOZ_SPEEX_RESAMPLER=1
4143 MOZ_CUBEB=
4144 MOZ_VORBIS=
4145 MOZ_TREMOR=
4146 MOZ_WAVE=1
4147 MOZ_SAMPLE_TYPE_FLOAT32=
4148 MOZ_SAMPLE_TYPE_S16LE=
4149 MOZ_MEDIA=
4150 MOZ_OPUS=1
4151 MOZ_WEBM=1
4152 MOZ_WEBRTC=1
4153 MOZ_WEBRTC_SIGNALING=
4154 MOZ_MEDIA_PLUGINS=
4155 MOZ_MEDIA_NAVIGATOR=
4156 MOZ_OMX_PLUGIN=
4157 MOZ_VP8=
4158 MOZ_VP8_ERROR_CONCEALMENT=
4159 MOZ_VP8_ENCODER=
4160 VPX_AS=
4161 VPX_ASFLAGS=
4162 VPX_AS_DASH_C_FLAG=
4163 VPX_AS_CONVERSION=
4164 VPX_ASM_SUFFIX=
4165 VPX_X86_ASM=
4166 VPX_ARM_ASM=
4167 LIBJPEG_TURBO_AS=
4168 LIBJPEG_TURBO_ASFLAGS=
4169 LIBJPEG_TURBO_X86_ASM=
4170 LIBJPEG_TURBO_X64_ASM=
4171 LIBJPEG_TURBO_ARM_ASM=
4172 MOZ_PANGO=1
4173 MOZ_PERMISSIONS=1
4174 MOZ_PLACES=1
4175 MOZ_PREF_EXTENSIONS=1
4176 MOZ_PROFILELOCKING=1
4177 MOZ_PSM=1
4178 MOZ_REFLOW_PERF=
4179 MOZ_SAFE_BROWSING=
4180 MOZ_HELP_VIEWER=
4181 MOZ_SPELLCHECK=1
4182 MOZ_JAVA_COMPOSITOR=
4183 MOZ_ONLY_TOUCH_EVENTS=
4184 MOZ_TOOLKIT_SEARCH=1
4185 MOZ_UI_LOCALE=en-US
4186 MOZ_UNIVERSALCHARDET=1
4187 MOZ_URL_CLASSIFIER=
4188 MOZ_XTF=1
4189 MOZ_XUL=1
4190 MOZ_ZIPWRITER=1
4191 NS_PRINTING=1
4192 MOZ_PDF_PRINTING=
4193 MOZ_DISABLE_DOMCRYPTO=
4194 NSS_DISABLE_DBM=
4195 NECKO_WIFI=1
4196 NECKO_COOKIES=1
4197 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4198 USE_ARM_KUSER=
4199 BUILD_CTYPES=1
4200 MOZ_USE_NATIVE_POPUP_WINDOWS=
4201 MOZ_ANDROID_HISTORY=
4202 MOZ_WEBSMS_BACKEND=
4203 MOZ_GRAPHITE=1
4204 ACCESSIBILITY=1
4205 MOZ_SYS_MSG=
4207 case "$target_os" in
4208     mingw*)
4209         NS_ENABLE_TSF=1
4210         AC_DEFINE(NS_ENABLE_TSF)
4211         ;;
4212 esac
4214 case "${target}" in
4215     *-android*|*-linuxandroid*)
4216         if test "$CPU_ARCH" = "arm" ; then
4217           USE_ARM_KUSER=1
4218         fi
4220         NSS_DISABLE_DBM=1
4221         NECKO_WIFI=
4222         MOZ_THEME_FASTSTRIPE=1
4223         MOZ_TREE_FREETYPE=1
4224         MOZ_MEMORY=1
4225         MOZ_RAW=1
4226         ;;
4228 esac
4230 MOZ_ARG_ENABLE_STRING(application,
4231 [  --enable-application=APP
4232                           Options include:
4233                             browser (Firefox)
4234                             xulrunner
4235                             tools/update-packaging (AUS-related packaging tools)],
4236 [ MOZ_BUILD_APP=$enableval ] )
4238 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4239 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4240   XULRUNNER_STUB_NAME=$withval)
4242 if test -z "$XULRUNNER_STUB_NAME"; then
4243   case "$target_os" in
4244   darwin*)
4245     XULRUNNER_STUB_NAME=xulrunner
4246     ;;
4247   *)
4248     XULRUNNER_STUB_NAME=xulrunner-stub
4249   esac
4251 AC_SUBST(XULRUNNER_STUB_NAME)
4253 AC_MSG_CHECKING([for application to build])
4254 if test -z "$MOZ_BUILD_APP"; then
4255   AC_MSG_RESULT([browser])
4256   MOZ_BUILD_APP=browser
4257 else
4258   # default mobile to be mobile/xul
4259   if test "$MOZ_BUILD_APP" = "mobile" ; then
4260     MOZ_BUILD_APP=mobile/xul
4261   fi
4262   # We have a valid application only if it has a build.mk file in its top
4263   # directory.
4264   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4265     AC_MSG_RESULT([none])
4266     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4267   else
4268     AC_MSG_RESULT([$MOZ_BUILD_APP])
4269   fi
4272 # Allow the application to influence configure with a confvars.sh script.
4274 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4275 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4276   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4277   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4278 else
4279   AC_MSG_RESULT([no])
4282 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4283 MOZ_ARG_WITH_STRING(app-name,
4284 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4285 WITH_APP_NAME=$withval,
4288 if test -n "$WITH_APP_NAME" ; then
4289     MOZ_APP_NAME="$WITH_APP_NAME"
4292 MOZ_ARG_WITH_STRING(app-basename,
4293 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4294 WITH_APP_BASENAME=$withval,
4297 if test -n "$WITH_APP_BASENAME" ; then
4298     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4301 # Now is a good time to test for logic errors, define mismatches, etc.
4302 case "$MOZ_BUILD_APP" in
4303 xulrunner)
4304   if test "$LIBXUL_SDK"; then
4305     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4306   fi
4307   ;;
4308 esac
4310 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4311 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4312 # MOZ_BUILD_APP.
4313 case "$MOZ_BUILD_APP" in
4314 browser)
4315   AC_DEFINE(MOZ_PHOENIX)
4316   ;;
4318 xulrunner)
4319   AC_DEFINE(MOZ_XULRUNNER)
4320   ;;
4321 esac
4323 AC_SUBST(MOZ_BUILD_APP)
4324 AC_SUBST(MOZ_PHOENIX)
4325 AC_SUBST(MOZ_XULRUNNER)
4327 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4329 dnl ========================================================
4330 dnl Check android sdk version depending on mobile target
4331 dnl ========================================================
4333 if test -z "$gonkdir" ; then
4334     # Minimum Android SDK API Level we require.
4335     case "$MOZ_BUILD_APP" in
4336     mobile/xul)
4337         android_min_api_level=13
4338         ;;
4339     mobile/android)
4340         android_min_api_level=16
4341         ;;
4342     esac
4344     MOZ_ANDROID_SDK($android_min_api_level)
4347 dnl ========================================================
4348 dnl =
4349 dnl = Toolkit Options
4350 dnl =
4351 dnl ========================================================
4352 MOZ_ARG_HEADER(Toolkit Options)
4354     dnl ========================================================
4355     dnl = Select the default toolkit
4356     dnl ========================================================
4357         MOZ_ARG_ENABLE_STRING(default-toolkit,
4358         [  --enable-default-toolkit=TK
4359                           Select default toolkit
4360                           Platform specific defaults:
4361                             Mac OS X - cairo-cocoa
4362                             OS/2 - cairo-os2
4363                             Win32 - cairo-windows
4364                             * - cairo-gtk2
4365                             * - cairo-qt],
4366     [ _DEFAULT_TOOLKIT=$enableval ],
4367     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4369     if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4370         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4371         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4372         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4373         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4374         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4375         -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4376         -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4377         -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4378     then
4379         dnl nglayout only supports building with one toolkit,
4380         dnl so ignore everything after the first comma (",").
4381         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4382     else
4383         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4384     fi
4386 MOZ_ARG_WITHOUT_BOOL(x,
4387 [  --without-x              Build without X11],
4388     WITHOUT_X11=1)
4390 dnl ========================================================
4391 dnl = Enable the toolkit as needed                         =
4392 dnl ========================================================
4394 case "$MOZ_WIDGET_TOOLKIT" in
4396 cairo-windows)
4397     MOZ_WIDGET_TOOLKIT=windows
4398     MOZ_WEBGL=1
4399     MOZ_PDF_PRINTING=1
4400     MOZ_INSTRUMENT_EVENT_LOOP=1
4401     ;;
4403 cairo-gtk2|cairo-gtk2-x11)
4404     MOZ_WIDGET_TOOLKIT=gtk2
4405     MOZ_ENABLE_GTK2=1
4406     MOZ_ENABLE_XREMOTE=1
4407     MOZ_WEBGL=1
4408     MOZ_GL_DEFAULT_PROVIDER=GLX
4410     AC_DEFINE(MOZ_X11)
4411     MOZ_X11=1
4412     USE_FC_FREETYPE=1
4414     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4415     TK_LIBS='$(MOZ_GTK2_LIBS)'
4416     AC_DEFINE(MOZ_WIDGET_GTK2)
4417     AC_DEFINE(MOZ_WIDGET_GTK,2)
4418     MOZ_PDF_PRINTING=1
4419     MOZ_INSTRUMENT_EVENT_LOOP=1
4420     ;;
4422 cairo-qt)
4423     MOZ_WIDGET_TOOLKIT=qt
4424     MOZ_ENABLE_QT=1
4425     if test -z "$WITHOUT_X11"; then
4426       MOZ_ENABLE_XREMOTE=1
4427       MOZ_GL_DEFAULT_PROVIDER=GLX
4428       MOZ_X11=1
4429       AC_DEFINE(MOZ_X11)
4430       XT_LIBS=
4431     fi
4433     MOZ_WEBGL=1
4434     USE_ELF_DYNSTR_GC=
4435     USE_FC_FREETYPE=1
4436     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4437     TK_LIBS='$(MOZ_QT_LIBS)'
4438     AC_DEFINE(MOZ_WIDGET_QT)
4439     MOZ_PDF_PRINTING=1
4440     ;;
4442 cairo-os2)
4443     MOZ_WIDGET_TOOLKIT=os2
4444     USE_FC_FREETYPE=1
4445     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4446     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4447     MOZ_PDF_PRINTING=1
4448     ;;
4450 cairo-cocoa)
4451     MOZ_WIDGET_TOOLKIT=cocoa
4452     AC_DEFINE(MOZ_WIDGET_COCOA)
4453     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4454     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4455     TK_CFLAGS="-DNO_X11"
4456     CFLAGS="$CFLAGS $TK_CFLAGS"
4457     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4458     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4459     MOZ_USER_DIR="Mozilla"
4460     MOZ_FS_LAYOUT=bundle
4461     MOZ_WEBGL=1
4462     MOZ_INSTRUMENT_EVENT_LOOP=1
4463     ;;
4465 cairo-uikit)
4466     MOZ_WIDGET_TOOLKIT=uikit
4467     AC_DEFINE(MOZ_WIDGET_UIKIT)
4468     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4469     TK_CFLAGS="-DNO_X11"
4470     TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4471     CFLAGS="$CFLAGS $TK_CFLAGS"
4472     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4473     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4474     MOZ_USER_DIR="Mozilla"
4475     MOZ_FS_LAYOUT=bundle
4476     ;;
4478 cairo-android)
4479     AC_DEFINE(MOZ_WIDGET_ANDROID)
4480     MOZ_WIDGET_TOOLKIT=android
4481     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4482     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4483     MOZ_WEBGL=1
4484     MOZ_PDF_PRINTING=1
4485     MOZ_INSTRUMENT_EVENT_LOOP=1
4486     if test "$MOZ_BUILD_APP" = "mobile/xul"; then
4487         MOZ_OLD_LINKER=1
4488     fi
4489     ;;
4491 cairo-gonk)
4492     AC_DEFINE(MOZ_WIDGET_GONK)
4493     AC_DEFINE(MOZ_TOUCH)
4494     MOZ_WIDGET_TOOLKIT=gonk
4495     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4496     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4497     MOZ_WEBGL=1
4498     MOZ_PDF_PRINTING=1
4499     MOZ_TOUCH=1
4500     ;;
4502 esac
4504 AC_SUBST(MOZ_OLD_LINKER)
4505 AC_SUBST(MOZ_PDF_PRINTING)
4506 if test "$MOZ_PDF_PRINTING"; then
4507    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4508    AC_DEFINE(MOZ_PDF_PRINTING)
4511 if test "$MOZ_ENABLE_XREMOTE"; then
4512     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4515 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4516    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4519 if test "$COMPILE_ENVIRONMENT"; then
4520   if test "$MOZ_ENABLE_GTK2"; then
4521     if test "$MOZ_X11"; then
4522       GDK_PACKAGES=gdk-x11-2.0
4523     fi
4525     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4526   fi
4528 fi # COMPILE_ENVIRONMENT
4530 AC_SUBST(MOZ_FS_LAYOUT)
4532 dnl ========================================================
4533 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4534 dnl their usage and use them in spidermonkey.
4535 dnl ========================================================
4536 MOZ_ARG_WITH_BOOL(arm-kuser,
4537 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4538     USE_ARM_KUSER=1,)
4539 if test -n "$USE_ARM_KUSER"; then
4540    AC_DEFINE(USE_ARM_KUSER)
4543 dnl ========================================================
4544 dnl = startup-notification support module
4545 dnl ========================================================
4547 if test "$MOZ_ENABLE_GTK2"
4548 then
4549     MOZ_ENABLE_STARTUP_NOTIFICATION=
4551     MOZ_ARG_ENABLE_BOOL(startup-notification,
4552     [  --enable-startup-notification
4553                           Enable startup-notification support (default: disabled) ],
4554         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4555         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4556     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4557     then
4558         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4559                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4560         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4561             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4562             then
4563                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4564             fi
4565             MOZ_ENABLE_STARTUP_NOTIFICATION=
4566         ])
4567     fi
4569     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4570         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4571     fi
4573     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4575 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4576 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4577 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4579 dnl ========================================================
4580 dnl = QT support
4581 dnl ========================================================
4582 if test "$MOZ_ENABLE_QT"
4583 then
4584     MOZ_ARG_WITH_STRING(qtdir,
4585     [  --with-qtdir=\$dir       Specify Qt directory ],
4586     [ QTDIR=$withval])
4588     if test -z "$QTDIR"; then
4589         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
4590         PKG_CHECK_MODULES(MOZ_QT5, QtWidgets QtMultimedia QtPrintSupport,
4591                       MOZ_ENABLE_QT5=1,
4592                       MOZ_ENABLE_QT5=)
4593         if test "$MOZ_ENABLE_QT5"; then
4594             echo "Using qt5"
4595             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
4596             MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
4597         fi
4599         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4600         AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4601     else
4602         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4604         MOZ_QT_CFLAGS="-DQT_SHARED"
4605         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4606         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4607         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4608         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4609         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4610         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4611         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4612         HOST_MOC="$QTDIR/bin/moc"
4613         HOST_RCC="$QTDIR/bin/rcc"
4615         # QtWidgets was introduced only in Qt5
4616         if test -d $QTDIR/include/QtWidgets; then
4617             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4618             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4619             MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtWidgets -lQtPrintSupport"
4620         fi
4621     fi
4622     if test -z "$HOST_MOC"; then
4623         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4624 incorrect])
4625     fi
4626     if test -z "$HOST_RCC"; then
4627         AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4628 incorrect])
4629     fi
4631     MOC=$HOST_MOC
4632     RCC=$HOST_RCC
4634     MOZ_ENABLE_QMSYSTEM2=
4635     PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4636                       MOZ_ENABLE_QMSYSTEM2=1,
4637                       MOZ_ENABLE_QMSYSTEM2=)
4639     if test "$MOZ_ENABLE_QMSYSTEM2"; then
4640       MOZ_ENABLE_QMSYSTEM2=1
4641       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4642       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4643       AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4644     fi
4646     MOZ_ENABLE_QTNETWORK=
4647     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4648                       MOZ_ENABLE_QTNETWORK=1,
4649                       MOZ_ENABLE_QTNETWORK=)
4651     if test "$MOZ_ENABLE_QTNETWORK"; then
4652       MOZ_ENABLE_QTNETWORK=1
4653       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4654     fi
4656     MOZ_ENABLE_QTMOBILITY=
4657     PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4658                       MOZ_ENABLE_QTMOBILITY=1,
4659                       MOZ_ENABLE_QTMOBILITY=)
4660     if test "$MOZ_ENABLE_QTMOBILITY"; then
4661        MOZ_ENABLE_QTMOBILITY=1
4662        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4663        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4664     else
4665        AC_CHECK_LIB(QtSensors, main, [
4666           MOZ_ENABLE_QTMOBILITY=1
4667           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4668           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4669           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4670           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4671           MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4672        ])
4673     fi
4674     if test "$MOZ_ENABLE_QTMOBILITY"; then
4675        AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4676     fi
4679 AC_SUBST(GTK_CONFIG)
4680 AC_SUBST(TK_CFLAGS)
4681 AC_SUBST(TK_LIBS)
4683 AC_SUBST(MOZ_ENABLE_GTK2)
4684 AC_SUBST(MOZ_ENABLE_QT)
4685 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4686 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4687 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4688 AC_SUBST(MOZ_ENABLE_XREMOTE)
4689 AC_SUBST(MOZ_GTK2_CFLAGS)
4690 AC_SUBST(MOZ_GTK2_LIBS)
4691 AC_SUBST(MOZ_QT_CFLAGS)
4692 AC_SUBST(MOZ_QT_LIBS)
4694 AC_SUBST(MOC)
4695 AC_SUBST(RCC)
4697 AC_SUBST(MOZ_X11)
4699 dnl ========================================================
4700 dnl =
4701 dnl = Components & Features
4702 dnl =
4703 dnl ========================================================
4704 MOZ_ARG_HEADER(Components and Features)
4706 dnl ========================================================
4707 dnl = Localization
4708 dnl ========================================================
4709 MOZ_ARG_ENABLE_STRING(ui-locale,
4710 [  --enable-ui-locale=ab-CD
4711                           Select the user interface locale (default: en-US)],
4712     MOZ_UI_LOCALE=$enableval )
4713 AC_SUBST(MOZ_UI_LOCALE)
4715 dnl ========================================================
4716 dnl = Trademarked Branding
4717 dnl ========================================================
4718 MOZ_ARG_ENABLE_BOOL(official-branding,
4719 [  --enable-official-branding
4720                           Enable Official mozilla.org Branding
4721                           Do not distribute builds with
4722                           --enable-official-branding unless you have
4723                           permission to use trademarks per
4724                           http://www.mozilla.org/foundation/trademarks/ .],
4726   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4727     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4728   else
4729     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4730     MOZ_OFFICIAL_BRANDING=1
4731   fi
4732 ], MOZ_OFFICIAL_BRANDING=)
4734 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4735 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4736   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4739 MOZ_ARG_WITH_STRING(branding,
4740 [  --with-branding=dir     Use branding from the specified directory.],
4741     MOZ_BRANDING_DIRECTORY=$withval)
4743 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4744 if test -z "$REAL_BRANDING_DIRECTORY"; then
4745   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4748 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4749   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4752 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4754 dnl ========================================================
4755 dnl = Distribution ID
4756 dnl ========================================================
4757 MOZ_ARG_WITH_STRING(distribution-id,
4758 [  --with-distribution-id=ID
4759                           Set distribution-specific id (default=org.mozilla)],
4760 [ val=`echo $withval`
4761     MOZ_DISTRIBUTION_ID="$val"])
4763 if test -z "$MOZ_DISTRIBUTION_ID"; then
4764    MOZ_DISTRIBUTION_ID="org.mozilla"
4767 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4768 AC_SUBST(MOZ_DISTRIBUTION_ID)
4771 dnl ========================================================
4772 dnl complex text support off by default
4773 dnl ========================================================
4774 MOZ_ARG_DISABLE_BOOL(pango,
4775 [  --disable-pango         Disable usage of Pango ],
4776     MOZ_PANGO=,
4777     MOZ_PANGO=1)
4779 dnl ========================================================
4780 dnl = Pango
4781 dnl ========================================================
4782 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4783 then
4784     AC_SUBST(MOZ_PANGO)
4786     if test "$MOZ_PANGO"
4787     then
4788         PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4790         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4791         AC_SUBST(MOZ_PANGO_CFLAGS)
4792         AC_SUBST(MOZ_PANGO_LIBS)
4793         AC_DEFINE(MOZ_PANGO)
4794     else
4795         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
4796         AC_SUBST(FT2_CFLAGS)
4797         AC_SUBST(FT2_LIBS)
4798     fi
4801 dnl ========================================================
4802 dnl = GnomeVFS, GIO and GConf support module
4803 dnl ========================================================
4805 if test "$MOZ_X11"
4806 then
4807     dnl build the gnomevfs extension by default only when the
4808     dnl GTK2 toolkit is in use.
4809     if test "$MOZ_ENABLE_GTK2"
4810     then
4811         MOZ_ENABLE_GNOMEVFS=1
4812         MOZ_ENABLE_GCONF=1
4813     fi
4815     dnl ========================================================
4816     dnl = GnomeVFS support module
4817     dnl ========================================================
4818     MOZ_ARG_DISABLE_BOOL(gnomevfs,
4819     [  --disable-gnomevfs      Disable GnomeVFS support ],
4820         MOZ_ENABLE_GNOMEVFS=,
4821         MOZ_ENABLE_GNOMEVFS=force)
4823     if test "$MOZ_ENABLE_GNOMEVFS"
4824     then
4825         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4826             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4827             MOZ_ENABLE_GNOMEVFS=1
4828             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4829         ],[
4830             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4831             then
4832                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4833             fi
4834             MOZ_ENABLE_GNOMEVFS=
4835         ])
4836     else
4837         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
4838             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4839               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4840             ])
4841         fi
4842     fi
4844     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4845     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4846     AC_SUBST(MOZ_GNOMEVFS_LIBS)
4848     dnl ========================================================
4849     dnl = GIO support module
4850     dnl ========================================================
4851     MOZ_ARG_ENABLE_BOOL(gio,
4852     [  --enable-gio            Enable GIO support (default: disabled)],
4853         MOZ_ENABLE_GIO=force,
4854         MOZ_ENABLE_GIO=)
4856     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
4857     then
4858         PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4859                           [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4860         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4861             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4862             MOZ_ENABLE_GIO=1
4863             AC_DEFINE(MOZ_ENABLE_GIO)
4864         ],[
4865             if test "$MOZ_ENABLE_GIO" = "force"
4866             then
4867                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4868             fi
4869             MOZ_ENABLE_GIO=
4870         ])
4871     fi
4873     AC_SUBST(MOZ_ENABLE_GIO)
4874     AC_SUBST(MOZ_GIO_CFLAGS)
4875     AC_SUBST(MOZ_GIO_LIBS)
4877     dnl ========================================================
4878     dnl = GConf support module
4879     dnl ========================================================
4880     MOZ_ARG_DISABLE_BOOL(gconf,
4881     [  --disable-gconf      Disable Gconf support ],
4882         MOZ_ENABLE_GCONF=,
4883         MOZ_ENABLE_GCONF=force)
4885     if test "$MOZ_ENABLE_GCONF"
4886     then
4887         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4888             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4889             MOZ_ENABLE_GCONF=1
4890         ],[
4891             if test "$MOZ_ENABLE_GCONF" = "force"
4892             then
4893                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4894             fi
4895             MOZ_ENABLE_GCONF=
4896         ])
4897     fi
4899     if test "$MOZ_ENABLE_GCONF"; then
4900         AC_DEFINE(MOZ_ENABLE_GCONF)
4901     fi
4903     AC_SUBST(MOZ_ENABLE_GCONF)
4904     AC_SUBST(MOZ_GCONF_CFLAGS)
4905     AC_SUBST(MOZ_GCONF_LIBS)
4908 dnl ========================================================
4909 dnl = libproxy support
4910 dnl ========================================================
4912 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4913 then
4914     MOZ_ENABLE_LIBPROXY=
4916     MOZ_ARG_ENABLE_BOOL(libproxy,
4917     [  --enable-libproxy         Enable libproxy support ],
4918     MOZ_ENABLE_LIBPROXY=1,
4919     MOZ_ENABLE_LIBPROXY=)
4921     if test "$MOZ_ENABLE_LIBPROXY"
4922     then
4923         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4924         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4925     fi
4927 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4928 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
4929 AC_SUBST(MOZ_LIBPROXY_LIBS)
4931 dnl ========================================================
4932 dnl = libnotify support
4933 dnl ========================================================
4935 if test "$MOZ_ENABLE_GTK2"
4936 then
4937     MOZ_ENABLE_LIBNOTIFY=1
4939     MOZ_ARG_DISABLE_BOOL(libnotify,
4940     [  --disable-libnotify     Disable libnotify support ],
4941     MOZ_ENABLE_LIBNOTIFY=,
4942     MOZ_ENABLE_LIBNOTIFY=1)
4944     if test "$MOZ_ENABLE_LIBNOTIFY"
4945     then
4946         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
4947     fi
4950 if test -z "$SKIP_LIBRARY_CHECKS"
4951 then
4952     if test "$MOZ_ENABLE_GTK2"
4953     then
4954         if test "$MOZ_ENABLE_LIBNOTIFY"
4955         then
4956             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
4957         fi
4958     fi
4960 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
4961 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
4962 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
4964 dnl ========================================================
4965 dnl = GNOME component (mozgnome)
4966 dnl ========================================================
4968 # The GNOME component is built if one of
4969 # gnome-vfs, gio, gconf or libnotify is available.
4970 if test "$MOZ_ENABLE_GCONF" -o \
4971    "$MOZ_ENABLE_GNOMEVFS" -o \
4972    "$MOZ_ENABLE_GIO" -o \
4973    "$MOZ_ENABLE_LIBNOTIFY"; then
4974     MOZ_ENABLE_GNOME_COMPONENT=1
4975 else
4976     MOZ_ENABLE_GNOME_COMPONENT=
4978 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4980 dnl ========================================================
4981 dnl = libgnomeui support module
4982 dnl ========================================================
4984 if test "$MOZ_ENABLE_GTK2"
4985 then
4986     MOZ_ENABLE_GNOMEUI=1
4988     MOZ_ARG_DISABLE_BOOL(gnomeui,
4989     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
4990         MOZ_ENABLE_GNOMEUI=,
4991         MOZ_ENABLE_GNOMEUI=force)
4993     if test "$MOZ_ENABLE_GNOMEUI"
4994     then
4995         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4996         [
4997             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
4998             MOZ_ENABLE_GNOMEUI=1
4999         ],[
5000             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5001             then
5002                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5003             fi
5004             MOZ_ENABLE_GNOMEUI=
5005         ])
5006     fi
5008     if test "$MOZ_ENABLE_GNOMEUI"; then
5009         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5010     fi
5013 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5014 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5015 AC_SUBST(MOZ_GNOMEUI_LIBS)
5017 dnl ========================================================
5018 dnl = dbus support
5019 dnl ========================================================
5021 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5022 then
5023     MOZ_ENABLE_DBUS=1
5025     MOZ_ARG_DISABLE_BOOL(dbus,
5026     [  --disable-dbus          Disable dbus support ],
5027         MOZ_ENABLE_DBUS=,
5028         MOZ_ENABLE_DBUS=1)
5030     if test "$MOZ_ENABLE_DBUS"
5031     then
5032         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5033         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5034         AC_DEFINE(MOZ_ENABLE_DBUS)
5035     fi
5037 AC_SUBST(MOZ_ENABLE_DBUS)
5038 AC_SUBST(MOZ_DBUS_CFLAGS)
5039 AC_SUBST(MOZ_DBUS_LIBS)
5040 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5041 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5043 dnl ========================================================
5044 dnl = Enable Android History instead of Places
5045 dnl ========================================================
5046 if test -n "$MOZ_ANDROID_HISTORY"; then
5047      dnl Do this if defined in confvars.sh
5048      AC_DEFINE(MOZ_ANDROID_HISTORY)
5052 dnl ========================================================
5053 dnl = Build with the Android Java compositor
5054 dnl ========================================================
5055 if test -n "$MOZ_JAVA_COMPOSITOR"; then
5056      dnl Do this if defined in confvars.sh
5057      AC_DEFINE(MOZ_JAVA_COMPOSITOR)
5060 dnl ========================================================
5061 dnl = Disable WebSMS backend
5062 dnl ========================================================
5063 MOZ_ARG_DISABLE_BOOL(websms-backend,
5064 [  --disable-websms-backend
5065                            Disable WebSMS backend],
5066     MOZ_WEBSMS_BACKEND=,
5067     MOZ_WEBSMS_BACKEND=1)
5069 if test -n "$MOZ_WEBSMS_BACKEND"; then
5070     AC_DEFINE(MOZ_WEBSMS_BACKEND)
5073 dnl ========================================================
5074 dnl = Build Personal Security Manager
5075 dnl ========================================================
5076 MOZ_ARG_DISABLE_BOOL(crypto,
5077 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5078     MOZ_PSM=,
5079     MOZ_PSM=1 )
5081 dnl ========================================================
5082 dnl = JS Debugger XPCOM component (js/jsd)
5083 dnl ========================================================
5084 MOZ_ARG_DISABLE_BOOL(jsd,
5085 [  --disable-jsd           Disable JavaScript debug library],
5086     MOZ_JSDEBUGGER=,
5087     MOZ_JSDEBUGGER=1)
5090 dnl ========================================================
5091 dnl = Enable IPDL's "expensive" unit tests
5092 dnl ========================================================
5093 MOZ_IPDL_TESTS=
5095 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5096 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5097     MOZ_IPDL_TESTS=1,
5098     MOZ_IPDL_TESTS=)
5100 if test -n "$MOZ_IPDL_TESTS"; then
5101     AC_DEFINE(MOZ_IPDL_TESTS)
5104 AC_SUBST(MOZ_IPDL_TESTS)
5106 dnl ========================================================
5107 dnl = Turns off code necessary for e10s compatibility
5108 dnl ========================================================
5109 dnl This is a temporary flag to be removed in bug 662601 when
5110 dnl it's no longer needed
5112 MOZ_E10S_COMPAT=
5114 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5115 [  --enable-e10s-compat     Turns off code for e10s compat],
5116     MOZ_E10S_COMPAT=1,
5117     MOZ_E10S_COMPAT=)
5119 if test -n "$MOZ_E10S_COMPAT"; then
5120     AC_DEFINE(MOZ_E10S_COMPAT)
5123 dnl ========================================================
5124 dnl = Disable building dbm
5125 dnl ========================================================
5126 MOZ_ARG_DISABLE_BOOL(dbm,
5127 [  --disable-dbm           Disable building dbm],
5128     NSS_DISABLE_DBM=1,
5129     NSS_DISABLE_DBM=)
5131 dnl bi-directional support always on
5132 IBMBIDI=1
5133 AC_DEFINE(IBMBIDI)
5135 dnl ========================================================
5136 dnl accessibility support on by default on all platforms
5137 dnl ========================================================
5138 MOZ_ARG_DISABLE_BOOL(accessibility,
5139 [  --disable-accessibility Disable accessibility support],
5140     ACCESSIBILITY=,
5141     ACCESSIBILITY=1 )
5142 if test "$ACCESSIBILITY"; then
5143     AC_DEFINE(ACCESSIBILITY)
5146 dnl ========================================================
5147 dnl Disable printing
5148 dnl ========================================================
5149 MOZ_ARG_DISABLE_BOOL(printing,
5150 [  --disable-printing      Disable printing support],
5151     NS_PRINTING=,
5152     NS_PRINTING=1)
5154 if test "$NS_PRINTING"; then
5155     AC_DEFINE(NS_PRINTING)
5156     AC_DEFINE(NS_PRINT_PREVIEW)
5159 dnl Turn off webrtc for OS's we don't handle yet, but allow 
5160 dnl --enable-webrtc to override.  Can disable for everything in
5161 dnl the master list above.
5162 if test -n "$MOZ_WEBRTC"; then
5163     case "$target" in
5164     *-android*|*-linuxandroid*)
5165         dnl Make sure doesn't get matched by *-linux*
5166         MOZ_WEBRTC=
5167         ;;
5168     *-linux*|*-mingw*|*-darwin*)
5169         dnl Leave enabled
5170         ;;
5171     *)
5172         dnl default to disabled for all others
5173         MOZ_WEBRTC=
5174         ;;
5175     esac
5178 dnl ========================================================
5179 dnl = Disable WebRTC code
5180 dnl ========================================================
5181 MOZ_ARG_DISABLE_BOOL(webrtc,
5182 [  --disable-webrtc        Disable support for WebRTC],
5183     MOZ_WEBRTC=,
5184     MOZ_WEBRTC=1)
5186 if test -n "$MOZ_WEBRTC"; then
5187     AC_DEFINE(MOZ_WEBRTC)
5188     MOZ_MEDIA=1
5189     MOZ_RAW=1
5190     MOZ_VP8=1
5191     MOZ_VP8_ENCODER=1
5192     MOZ_VP8_ERROR_CONCEALMENT=1
5195 AC_SUBST(MOZ_WEBRTC)
5197 case "$target_cpu" in
5198 arm*)
5199     MOZ_SAMPLE_TYPE_S16LE=1
5200     AC_DEFINE(MOZ_SAMPLE_TYPE_S16LE)
5201     AC_SUBST(MOZ_SAMPLE_TYPE_S16LE)
5204     MOZ_SAMPLE_TYPE_FLOAT32=1
5205     AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5206     AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5208 esac
5210 dnl ========================================================
5211 dnl = Enable Raw Codecs
5212 dnl ========================================================
5213 MOZ_ARG_ENABLE_BOOL(raw,
5214 [  --enable-raw           Enable support for RAW media],
5215     MOZ_RAW=1,
5216     MOZ_RAW=)
5218 if test -n "$MOZ_RAW"; then
5219     AC_DEFINE(MOZ_RAW)
5220     MOZ_MEDIA=1
5223 AC_SUBST(MOZ_RAW)
5225 dnl ========================================================
5226 dnl = Disable Ogg Codecs
5227 dnl ========================================================
5228 MOZ_ARG_DISABLE_BOOL(ogg,
5229 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5230     MOZ_OGG=,
5231     MOZ_OGG=1)
5233 if test -n "$MOZ_OGG"; then
5234     AC_DEFINE(MOZ_OGG)
5235     MOZ_SYDNEYAUDIO=1
5236     MOZ_CUBEB=1
5237     MOZ_MEDIA=1
5239     dnl Checks for __attribute__(aligned()) directive
5240     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5241         [ac_cv_c_attribute_aligned],
5242         [ac_cv_c_attribute_aligned=0
5243          CFLAGS_save="${CFLAGS}"
5244          CFLAGS="${CFLAGS} -Werror"
5245          for ac_cv_c_attr_align_try in 64 32 16 8; do
5246            echo "trying $ac_cv_c_attr_align_try"
5247            AC_TRY_COMPILE([],
5248                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5249                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5250            if test "$ac_cv_c_attribute_aligned" != 0; then
5251              break;
5252            fi
5253          done
5254            CFLAGS="${CFLAGS_save}"])
5255     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5256       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5257                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5258     fi
5261 dnl ========================================================
5262 dnl = Disable Opus audio codec support
5263 dnl ========================================================
5264 MOZ_ARG_DISABLE_BOOL(opus,
5265 [  --disable-opus          Disable support for Opus audio],
5266     MOZ_OPUS=,
5267     MOZ_OPUS=1)
5269 dnl ========================================================
5270 dnl = Disable VP8 decoder support
5271 dnl ========================================================
5272 MOZ_ARG_DISABLE_BOOL(webm,
5273 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5274     MOZ_WEBM=,
5275     MOZ_WEBM=1)
5277 if test -n "$MOZ_WEBM"; then
5278     AC_DEFINE(MOZ_WEBM)
5279     MOZ_VP8=1
5282 dnl ========================================================
5283 dnl = Enable media plugin support
5284 dnl ========================================================
5285 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5286   dnl Enable support on android by default
5287   MOZ_MEDIA_PLUGINS=1
5290 MOZ_ARG_ENABLE_BOOL(media-plugins,
5291 [  --enable-media-plugins  Enable support for media plugins],
5292     MOZ_MEDIA_PLUGINS=1,
5293     MOZ_MEDIA_PLUGINS=)
5295 if test -n "$MOZ_MEDIA_PLUGINS"; then
5296   AC_DEFINE(MOZ_MEDIA_PLUGINS)
5299 dnl ========================================================
5300 dnl = Enable getUserMedia support
5301 dnl ========================================================
5302 MOZ_ARG_ENABLE_BOOL(media-navigator,
5303 [  --enable-media-navigator  Enable support for getUserMedia],
5304     MOZ_MEDIA_NAVIGATOR=1,
5305     MOZ_MEDIA_NAVIGATOR=)
5307 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5308   AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5311 dnl ========================================================
5312 dnl = Enable building OMX media plugin (B2G or Android)
5313 dnl ========================================================
5314 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5315   dnl Enable support on android by default
5316   MOZ_OMX_PLUGIN=1
5319 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5320 [  --enable-omx-plugin      Enable building OMX plugin (B2G)],
5321     MOZ_OMX_PLUGIN=1,
5322     MOZ_OMX_PLUGIN=)
5324 if test -n "$MOZ_OMX_PLUGIN"; then
5325     if test "$OS_TARGET" = "Android"; then
5326         dnl Only allow building OMX plugin on Gonk (B2G) or Android
5327         AC_DEFINE(MOZ_OMX_PLUGIN)
5328     else
5329        dnl fail if we're not building on Gonk or Android
5330        AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5331     fi
5334 dnl system libvpx Support
5335 dnl ========================================================
5336 MOZ_ARG_WITH_BOOL(system-libvpx,
5337 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
5338     MOZ_NATIVE_LIBVPX=1)
5340 MOZ_LIBVPX_CFLAGS=
5341 MOZ_LIBVPX_LIBS=
5343 if test -n "$MOZ_VP8"; then
5344     AC_DEFINE(MOZ_VP8)
5345     if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5346         AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5347     fi
5348     if test -n "$MOZ_VP8_ENCODER" ; then
5349         AC_DEFINE(MOZ_VP8_ENCODER)
5350     fi
5352     if test -n "$MOZ_NATIVE_LIBVPX"; then
5353         dnl ============================
5354         dnl === libvpx Version check ===
5355         dnl ============================
5356         dnl Check to see if we have a system libvpx package.
5357         PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5359         MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [], 
5360          [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.])])
5362         _SAVE_LIBS=$LIBS
5363         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [], 
5364          [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5365         LIBS=$_SAVE_LIBS
5366     fi
5369 AC_SUBST(MOZ_NATIVE_LIBVPX)
5370 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5371 AC_SUBST(MOZ_LIBVPX_LIBS)
5373 if test "$MOZ_WEBM"; then
5374     MOZ_SYDNEYAUDIO=1
5375     MOZ_CUBEB=1
5376     MOZ_MEDIA=1
5377     if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5378         MOZ_VORBIS=1
5379     else
5380         MOZ_TREMOR=1
5381     fi
5384 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5386     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5387     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5388     dnl We currently require gcc on all arm platforms.
5389     VPX_AS=$YASM
5390     VPX_ASM_SUFFIX=asm
5391     VPX_NEED_OBJ_INT_EXTRACT=
5393     dnl See if we have assembly on this platform.
5394     case "$OS_ARCH:$CPU_ARCH" in
5395     Linux:x86)
5396       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5397       VPX_X86_ASM=1
5398     ;;
5399     Linux:x86_64)
5400       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5401       VPX_X86_ASM=1
5402     ;;
5403     SunOS:x86)
5404       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5405       VPX_X86_ASM=1
5406     ;;
5407     SunOS:x86_64)
5408       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5409       VPX_X86_ASM=1
5410     ;;
5411     OpenBSD:x86)
5412       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5413       VPX_X86_ASM=1
5414     ;;
5415     OpenBSD:x86_64)
5416       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5417       VPX_X86_ASM=1
5418     ;;
5419     Darwin:x86)
5420       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5421       VPX_X86_ASM=1
5422     ;;
5423     Darwin:x86_64)
5424       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5425       VPX_X86_ASM=1
5426     ;;
5427     WINNT:x86_64)
5428       VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5429       VPX_X86_ASM=1
5430     ;;
5431     WINNT:x86)
5432       dnl Check for yasm 1.1 or greater.
5433       if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5434         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.])
5435       elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5436         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.])
5437       else
5438         VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5439         VPX_X86_ASM=1
5440         dnl The encoder needs obj_int_extract to get asm offsets.
5441       fi
5442     ;;
5443     *:arm*)
5444       if test -n "$GNU_AS" ; then
5445         VPX_AS=$AS
5446         dnl These flags are a lie; they're just used to enable the requisite
5447         dnl opcodes; actual arch detection is done at runtime.
5448         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5449         VPX_DASH_C_FLAG="-c"
5450         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5451         VPX_ASM_SUFFIX="$ASM_SUFFIX"
5452         VPX_ARM_ASM=1
5453       fi
5454     esac
5456     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5457       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.])
5458     fi
5460     if test -n "$MOZ_VP8_ENCODER" -a \
5461             -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5462       dnl We prefer to get asm offsets using inline assembler, which the above
5463       dnl compilers can do. When we're not using one of those, we have to fall
5464       dnl back to obj_int_extract, which reads them from a compiled object
5465       dnl file. Unfortunately, that only works if we're compiling on a system
5466       dnl with the header files for the appropriate object file format.
5467       VPX_NEED_OBJ_INT_EXTRACT=1
5468     fi
5470     if test -n "$VPX_X86_ASM"; then
5471       AC_DEFINE(VPX_X86_ASM)
5472     elif test -n "$VPX_ARM_ASM"; then
5473       AC_DEFINE(VPX_ARM_ASM)
5474     else
5475       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5476     fi
5479 dnl ========================================================
5480 dnl = Disable Wave decoder support
5481 dnl ========================================================
5482 MOZ_ARG_DISABLE_BOOL(wave,
5483 [  --disable-wave          Disable Wave decoder support],
5484     MOZ_WAVE=,
5485     MOZ_WAVE=1)
5487 if test -n "$MOZ_WAVE"; then
5488     AC_DEFINE(MOZ_WAVE)
5489     MOZ_SYDNEYAUDIO=1
5490     MOZ_CUBEB=1
5491     MOZ_MEDIA=1
5494 dnl ========================================================
5495 dnl = Handle dependent SYDNEYAUDIO, CUBEB, and MEDIA defines
5496 dnl ========================================================
5498 if test -n "$MOZ_SYDNEYAUDIO"; then
5499     AC_DEFINE(MOZ_SYDNEYAUDIO)
5502 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5503     AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5506 if test -n "$MOZ_CUBEB"; then
5507     case "$target" in
5508     *-android*|*-linuxandroid*)
5509         dnl No Android implementation of libcubeb yet.
5510         ;;
5511     *-linux*)
5512         AC_DEFINE(MOZ_CUBEB)
5513         ;;
5514     *-mingw*)
5515         AC_DEFINE(MOZ_CUBEB)
5516         ;;
5517     *-darwin*)
5518         AC_DEFINE(MOZ_CUBEB)
5519         ;;
5520     *-openbsd*)
5521         AC_DEFINE(MOZ_CUBEB)
5522         ;;
5523     *)
5524         dnl Other targets will be enabled soon.
5525         ;;
5526     esac
5529 if test -n "$MOZ_MEDIA"; then
5530     AC_DEFINE(MOZ_MEDIA)
5533 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5534     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/])
5537 if test -n "$MOZ_VORBIS"; then
5538     AC_DEFINE(MOZ_VORBIS)
5541 if test -n "$MOZ_TREMOR"; then
5542     AC_DEFINE(MOZ_TREMOR)
5545 if test -n "$MOZ_OPUS"; then
5546     AC_DEFINE(MOZ_OPUS)
5549 dnl ========================================================
5550 dnl = Check alsa availability on Linux if using sydneyaudio
5551 dnl ========================================================
5553 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5554 if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
5555     PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5556          [echo "$MOZ_ALSA_PKG_ERRORS"
5557           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.)])])
5560 dnl ========================================================
5561 dnl = Enable PulseAudio
5562 dnl ========================================================
5564 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5565 [  --enable-pulseaudio          Enable PulseAudio support (experimental)],
5566 MOZ_PULSEAUDIO=1,
5567 MOZ_PULSEAUDIO=)
5569 if test -n "$MOZ_PULSEAUDIO"; then
5570     AC_DEFINE(MOZ_CUBEB)
5571     PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5572          [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5573           AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
5576 AC_SUBST(MOZ_PULSEAUDIO)
5577 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5578 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5580 dnl ========================================================
5581 dnl = Enable GStreamer
5582 dnl ========================================================
5583 MOZ_ARG_ENABLE_BOOL(gstreamer,
5584 [  --enable-gstreamer           Enable GStreamer support],
5585 MOZ_GSTREAMER=1,
5586 MOZ_GSTREAMER=)
5588 if test "$MOZ_GSTREAMER"; then
5589     # API version, eg 0.10, 1.0 etc
5590     GST_API_VERSION=0.10
5591     # core/base release number
5592     # depend on >= 0.10.33 as that's when the playbin2 source-setup signal was
5593     # introduced
5594     GST_VERSION=0.10.33
5595     PKG_CHECK_MODULES(GSTREAMER,
5596                       gstreamer-$GST_API_VERSION >= $GST_VERSION
5597                       gstreamer-app-$GST_API_VERSION
5598                       gstreamer-plugins-base-$GST_API_VERSION)
5599     if test -n "$GSTREAMER_LIBS"; then
5600        _SAVE_LDFLAGS=$LDFLAGS
5601        LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5602        AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5603        if test -n "$_HAVE_LIBGSTVIDEO" ; then
5604           GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5605        else
5606           AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
5607        fi
5608        LDFLAGS=$_SAVE_LDFLAGS
5609     else
5610        AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
5611     fi
5613 AC_SUBST(GSTREAMER_CFLAGS)
5614 AC_SUBST(GSTREAMER_LIBS)
5615 AC_SUBST(MOZ_GSTREAMER)
5617 if test -n "$MOZ_GSTREAMER"; then
5618    AC_DEFINE(MOZ_GSTREAMER)
5619    MOZ_MEDIA=1
5623 dnl ========================================================
5624 dnl Permissions System
5625 dnl ========================================================
5626 MOZ_ARG_DISABLE_BOOL(permissions,
5627 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5628     MOZ_PERMISSIONS=,
5629     MOZ_PERMISSIONS=1
5632 dnl ========================================================
5633 dnl NegotiateAuth
5634 dnl ========================================================
5635 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5636 [  --disable-negotiateauth Disable GSS-API negotiation ],
5637     MOZ_AUTH_EXTENSION=,
5638     MOZ_AUTH_EXTENSION=1 )
5640 dnl ========================================================
5641 dnl XTF
5642 dnl ========================================================
5643 MOZ_ARG_DISABLE_BOOL(xtf,
5644 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5645     MOZ_XTF=,
5646     MOZ_XTF=1 )
5647 if test "$MOZ_XTF"; then
5648   AC_DEFINE(MOZ_XTF)
5651 dnl ========================================================
5652 dnl Pref extensions (autoconfig)
5653 dnl ========================================================
5654 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5655 [  --disable-pref-extensions
5656                           Disable pref extensions such as autoconfig],
5657   MOZ_PREF_EXTENSIONS=,
5658   MOZ_PREF_EXTENSIONS=1 )
5660 dnl ========================================================
5661 dnl Searching of system directories for extensions.
5662 dnl Note: this switch is meant to be used for test builds
5663 dnl whose behavior should not depend on what happens to be
5664 dnl installed on the local machine.
5665 dnl ========================================================
5666 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5667 [  --disable-system-extension-dirs
5668                           Disable searching system- and account-global
5669                           directories for extensions of any kind; use
5670                           only profile-specific extension directories],
5671   ENABLE_SYSTEM_EXTENSION_DIRS=,
5672   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5673 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5674   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5677 dnl ========================================================
5678 dnl = Universalchardet
5679 dnl ========================================================
5680 MOZ_ARG_DISABLE_BOOL(universalchardet,
5681 [  --disable-universalchardet
5682                           Disable universal encoding detection],
5683   MOZ_UNIVERSALCHARDET=,
5684   MOZ_UNIVERSALCHARDET=1 )
5686 if test -n "${JAVA_BIN_PATH}"; then
5687   dnl Look for javac and jar in the specified path.
5688   JAVA_PATH="$JAVA_BIN_PATH"
5689 else
5690   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5691   JAVA_PATH="$JAVA_HOME/bin:$PATH"
5694 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5695 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5696 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5698 if test -n "${JAVA_BIN_PATH}" -o \
5699   \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5700   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5701     AC_MSG_ERROR([The programs java, javac and jar were not found.  Set \$JAVA_HOME to your java sdk directory or use --with-java-bin-path={java-bin-dir}])
5702   fi
5705 dnl ========================================================
5706 dnl = ANGLE OpenGL->D3D translator for WebGL
5707 dnl = * only applies to win32
5708 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5709 dnl ========================================================
5710 MOZ_ANGLE_RENDERER=
5711 MOZ_DIRECTX_SDK_PATH=
5712 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5713 MOZ_D3DX9_VERSION=
5714 MOZ_D3DX9_CAB=
5715 MOZ_D3DCOMPILER_CAB=
5716 MOZ_D3DX9_DLL=
5717 MOZ_D3DCOMPILER_DLL=
5718 case "$target_os" in
5719 *mingw*)
5720     MOZ_ANGLE_RENDERER=1
5721     ;;
5722 esac
5724 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5725 case "${target_cpu}" in
5726 i*86)
5727   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5728   ;;
5729 x86_64)
5730   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5731   ;;
5732 esac
5734 MOZ_ARG_DISABLE_BOOL(webgl,
5735 [  --disable-webgl     Disable building of the WebGL implementation],
5736     MOZ_WEBGL_DISABLED=1,
5737     MOZ_WEBGL_DISABLED=)
5739 if test -n "$MOZ_WEBGL_DISABLED"; then
5740   MOZ_WEBGL=
5741   MOZ_ANGLE_RENDERER=
5744 if test -n "$MOZ_ANGLE_RENDERER"; then
5745   # Get the SDK path from the registry.
5746   # First try to get the June 2010 SDK
5747   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5748   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5749     # Otherwise just take whatever comes first
5750     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5751   fi
5753   if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5754     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.])
5755   else
5756     MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/'`
5757   fi
5759   if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5760      test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5761          test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5762     AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5763   else
5764     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.])
5765   fi
5767   # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5768   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'`
5770   if test -z "$MOZ_D3DX9_VERSION" ; then
5771         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.])
5772   fi
5774   MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5775   MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5777   MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
5778   MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5781 dnl ========================================================
5782 dnl = Breakpad crash reporting (on by default on supported platforms)
5783 dnl ========================================================
5785 case $target in
5786 i?86-*-mingw*|x86_64-*-mingw*)
5787   MOZ_CRASHREPORTER=1
5788   ;;
5789 i?86-apple-darwin*|x86_64-apple-darwin*)
5790   MOZ_CRASHREPORTER=1
5791   ;;
5792 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5793   if test "$MOZ_ENABLE_GTK2"; then
5794     MOZ_CRASHREPORTER=1
5795   fi
5796   ;;
5797 *-android*|*-linuxandroid*)
5798   MOZ_CRASHREPORTER=1
5799   ;;
5800 *solaris*)
5801   MOZ_CRASHREPORTER=1
5802   ;;
5803 esac
5805 MOZ_ARG_DISABLE_BOOL(crashreporter,
5806 [  --disable-crashreporter Disable breakpad crash reporting],
5807     MOZ_CRASHREPORTER=,
5808     MOZ_CRASHREPORTER=1)
5810 if test -n "$MOZ_CRASHREPORTER"; then
5811    AC_DEFINE(MOZ_CRASHREPORTER)
5813   if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5814     test -z "$SKIP_LIBRARY_CHECKS"; then
5815     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5816     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5817     AC_SUBST(MOZ_GTHREAD_LIBS)
5819     MOZ_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter.  Use --disable-crashreporter to disable the crash reporter.])])
5820   fi
5822   if test "$OS_ARCH" != "$HOST_OS_ARCH"; then
5823     AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.  Use --disable-crashreporter.])
5824   fi
5826   if test "$OS_ARCH" = "WINNT" -a -z "$HAVE_64BIT_OS"; then
5827     MOZ_CRASHREPORTER_INJECTOR=1
5828     AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5829   fi
5832 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5833 [  --with-crashreporter-enable-percent=NN
5834                           Enable sending crash reports by default on NN% of users. (default=100)],
5835 [ val=`echo $withval | sed 's/[^0-9]//g'`
5836     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5838 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5839    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5841 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5843 dnl ========================================================
5844 dnl = libjpeg-turbo configuration
5845 dnl ========================================================
5846 MOZ_LIBJPEG_TURBO=
5847 if test -z "$MOZ_NATIVE_JPEG"; then
5848     MOZ_LIBJPEG_TURBO=1
5851 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5852 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
5853     MOZ_LIBJPEG_TURBO=,
5854     MOZ_LIBJPEG_TURBO=1)
5856 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
5857     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
5860 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
5861 dnl files.
5863 if test -n "$MOZ_LIBJPEG_TURBO"; then
5865   dnl Do we support libjpeg-turbo on this platform?
5866   case "$OS_ARCH:$OS_TEST" in
5867   Linux:x86|Linux:i?86)
5868     LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
5869     LIBJPEG_TURBO_X86_ASM=1
5870   ;;
5871   Linux:x86_64)
5872     LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
5873     LIBJPEG_TURBO_X64_ASM=1
5874   ;;
5875   SunOS:i?86)
5876     LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
5877     LIBJPEG_TURBO_X86_ASM=1
5878   ;;
5879   SunOS:x86_64)
5880     LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
5881     LIBJPEG_TURBO_X64_ASM=1
5882   ;;
5883   Darwin:i?86)
5884     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
5885     LIBJPEG_TURBO_X86_ASM=1
5886   ;;
5887   Darwin:x86_64)
5888     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
5889     LIBJPEG_TURBO_X64_ASM=1
5890   ;;
5891   WINNT:x86|WINNT:i?86)
5892     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
5893     LIBJPEG_TURBO_X86_ASM=1
5894   ;;
5895   WINNT:x86_64)
5896     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
5897     LIBJPEG_TURBO_X64_ASM=1
5898   ;;
5899   *:arm*)
5900     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
5901     LIBJPEG_TURBO_ARM_ASM=1
5902   ;;
5903   esac
5907 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
5908 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
5909 dnl it doesn't exist or we have too old of a version.
5910 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
5911     AC_MSG_CHECKING([for Yasm assembler])
5912     AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
5914     if test -z "$LIBJPEG_TURBO_AS" ; then
5915         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.])
5916     fi
5918     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
5919     dnl on Linux and 1.1 or newer everywhere else.
5920     if test "$OS_ARCH" = "Linux" ; then
5921         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
5922             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.])
5923         fi
5924     else
5925         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5926             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.])
5927         fi
5928     fi
5931 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
5932 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
5933 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
5934     echo "Using $AS as the assembler for ARM code."
5935     LIBJPEG_TURBO_AS=$AS
5938 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
5939     AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
5940 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
5941     AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
5942 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
5943     AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
5944 elif test -n "$MOZ_LIBJPEG_TURBO"; then
5945     dnl Warn if we're not building the optimized routines, even though the user
5946     dnl didn't specify --disable-libjpeg-turbo.
5947     AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
5950 dnl ========================================================
5951 dnl = Enable compilation of specific extension modules
5952 dnl ========================================================
5954 MOZ_ARG_ENABLE_STRING(extensions,
5955 [  --enable-extensions     Enable extensions],
5956 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5957     if test "$option" = "yes" -o "$option" = "all"; then
5958         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5959     elif test "$option" = "no" -o "$option" = "none"; then
5960         MOZ_EXTENSIONS=""
5961     elif test "$option" = "default"; then
5962         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5963     elif test `echo "$option" | grep -c \^-` != 0; then
5964         option=`echo $option | sed 's/^-//'`
5965         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5966     else
5967         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5968     fi
5969 done],
5970     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5972 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5973     # Suppress warning on non-X11 platforms
5974     if test -n "$MOZ_X11"; then
5975         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5976     fi
5977     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5980 dnl Do not build gnomevfs with libxul based apps
5981 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5982     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5985 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5986     # Suppress warning on non-X11 platforms
5987     if test -n "$MOZ_X11"; then
5988         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
5989     fi
5990     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5993 dnl Do not build gio with libxul based apps
5994 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5995     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5998 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5999     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6000     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6003 dnl xforms requires xtf
6004 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6005     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6006     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6009 dnl Remove dupes
6010 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6012 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6013 dnl when trying to build a nonexistent extension.
6014 for extension in $MOZ_EXTENSIONS; do
6015     if test ! -d "${srcdir}/extensions/${extension}"; then
6016         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6017     fi
6018 done
6020 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6021   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6024 dnl ========================================================
6025 dnl CSS3 Flexbox Support
6026 dnl ========================================================
6027 if test -n "$MOZ_FLEXBOX"; then
6028   AC_DEFINE(MOZ_FLEXBOX)
6031 dnl ========================================================
6032 dnl Build Freetype in the tree
6033 dnl ========================================================
6034 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6035 [  --enable-tree-freetype  Enable Tree FreeType],
6036     MOZ_TREE_FREETYPE=1,
6037     MOZ_TREE_FREETYPE= )
6038 if test -n "$MOZ_TREE_FREETYPE"; then
6039    if test -n "$_WIN32_MSVC"; then
6040       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6041    fi
6042    AC_DEFINE(MOZ_TREE_FREETYPE)
6043    AC_SUBST(MOZ_TREE_FREETYPE)
6044    MOZ_ENABLE_CAIRO_FT=1
6045    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6046    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6047    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6048    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6049    CAIRO_FT_OSLIBS=''
6050    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6051    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6052    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6053    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6054    AC_SUBST(CAIRO_FT_CFLAGS)
6057 dnl ========================================================
6058 dnl Installer
6059 dnl ========================================================
6060 dnl Abort Windows build if the required major version and
6061 dnl minimum minor version of Unicode NSIS isn't in the path
6062 dnl (unless in case of cross compiling, for which Unicode
6063 dnl is not yet sufficient).
6064 if test "$OS_ARCH" = "WINNT"; then
6065     REQ_NSIS_MAJOR_VER=2
6066     MIN_NSIS_MINOR_VER=33
6067     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6068     if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6069       AC_MSG_RESULT([yes])
6070       changequote(,)
6071       MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6072       changequote([,])
6073       if test ! "$MAKENSISU_VER" = ""; then
6074           MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6075           MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6076       fi
6077       AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6078       if test "$MAKENSISU_VER" = "" || \
6079          test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6080               ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6081           AC_MSG_RESULT([no])
6082           if test -z "$CROSS_COMPILE"; then
6083             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.])
6084           else
6085             MAKENSISU=
6086           fi
6087       fi
6088     elif test -z "$CROSS_COMPILE"; then
6089       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.])
6090     else
6091       MAKENSISU=
6092     fi
6095 dnl ========================================================
6096 dnl Web App Runtime
6097 dnl ========================================================
6098 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6099 [  --disable-webapp-runtime  Disable Web App Runtime],
6100     MOZ_WEBAPP_RUNTIME=,
6101     MOZ_WEBAPP_RUNTIME=1)
6102 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6103     MOZ_WEBAPP_RUNTIME=
6105 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6106     MOZ_WEBAPP_RUNTIME=
6108 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6109 if test "$MOZ_WEBAPP_RUNTIME"; then
6110     AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6113 AC_MSG_CHECKING([for tar archiver])
6114 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6115 if test -z "$TAR"; then
6116     AC_MSG_ERROR([no tar archiver found in \$PATH])
6118 AC_MSG_RESULT([$TAR])
6119 AC_SUBST(TAR)
6121 AC_MSG_CHECKING([for wget])
6122 AC_CHECK_PROGS(WGET, wget, "")
6123 AC_MSG_RESULT([$WGET])
6124 AC_SUBST(WGET)
6126 dnl ========================================================
6127 dnl Signing
6128 dnl ========================================================
6130 if test -n "$MOZ_SIGN_CMD"; then
6131     AC_DEFINE(MOZ_SIGNING)
6134 dnl ========================================================
6135 dnl Maintenance Service
6136 dnl ========================================================
6138 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6139 [  --enable-maintenance-service       Enable building of maintenanceservice],
6140     MOZ_MAINTENANCE_SERVICE=1,
6141     MOZ_MAINTENANCE_SERVICE= )
6143 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6144   if test "$OS_ARCH" = "WINNT"; then
6145     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6146   else
6147     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6148   fi
6151 dnl ========================================================
6152 dnl Verify MAR signatures
6153 dnl ========================================================
6155 MOZ_ARG_ENABLE_BOOL(verify-mar,
6156 [  --enable-verify-mar     Enable verifying MAR signatures],
6157     MOZ_VERIFY_MAR_SIGNATURE=1,
6158     MOZ_VERIFY_MAR_SIGNATURE= )
6160 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6161   if test "$OS_ARCH" = "WINNT"; then
6162     AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6163   else
6164     AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6165   fi
6168 dnl ========================================================
6169 dnl Enable building the signmar program.
6170 dnl This option is much different than the --enable-verify-mar option.
6171 dnl --enable-verify-mar is for enabling the verification check on MAR
6172 dnl files in the updater.  The --enable-signmar option is for building
6173 dnl the signmar program.
6174 dnl ========================================================
6176 MOZ_ARG_ENABLE_BOOL(signmar,
6177 [  --enable-signmar     Enable building the signmar program],
6178     MOZ_ENABLE_SIGNMAR=1,
6179     MOZ_ENABLE_SIGNMAR= )
6181 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6182   AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6185 dnl ========================================================
6186 dnl Updater
6187 dnl ========================================================
6189 MOZ_ARG_DISABLE_BOOL(updater,
6190 [  --disable-updater       Disable building of updater],
6191     MOZ_UPDATER=,
6192     MOZ_UPDATER=1 )
6194 if test -n "$MOZ_UPDATER"; then
6195     AC_DEFINE(MOZ_UPDATER)
6198 # app update channel is 'default' when not supplied.
6199 MOZ_ARG_ENABLE_STRING([update-channel],
6200 [  --enable-update-channel=CHANNEL
6201                           Select application update channel (default=default)],
6202     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6204 if test -z "$MOZ_UPDATE_CHANNEL"; then
6205     MOZ_UPDATE_CHANNEL=default
6207 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6208 AC_SUBST(MOZ_UPDATE_CHANNEL)
6210 # tools/update-packaging is not checked out by default.
6211 MOZ_ARG_ENABLE_BOOL(update-packaging,
6212 [  --enable-update-packaging
6213                           Enable tools/update-packaging],
6214     MOZ_UPDATE_PACKAGING=1,
6215     MOZ_UPDATE_PACKAGING= )
6216 AC_SUBST(MOZ_UPDATE_PACKAGING)
6218 dnl ========================================================
6219 dnl build the tests by default
6220 dnl ========================================================
6221 MOZ_ARG_DISABLE_BOOL(tests,
6222 [  --disable-tests         Do not build test libraries & programs],
6223     ENABLE_TESTS=,
6224     ENABLE_TESTS=1 )
6226 dnl ========================================================
6227 dnl parental controls (for Windows Vista)
6228 dnl ========================================================
6229 MOZ_ARG_DISABLE_BOOL(parental-controls,
6230 [  --disable-parental-controls
6231                           Do not build parental controls],
6232    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6233    MOZ_DISABLE_PARENTAL_CONTROLS=)
6234 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6235     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6238 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6240 dnl ========================================================
6241 dnl = Disable DOMCrypto
6242 dnl ========================================================
6243 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6244     AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6247 dnl ========================================================
6248 dnl =
6249 dnl = Module specific options
6250 dnl =
6251 dnl ========================================================
6252 MOZ_ARG_HEADER(Individual module options)
6254 dnl ========================================================
6255 dnl = Disable feed handling components
6256 dnl ========================================================
6257 MOZ_ARG_DISABLE_BOOL(feeds,
6258 [  --disable-feeds         Disable feed handling and processing components],
6259     MOZ_FEEDS=,
6260     MOZ_FEEDS=1 )
6261 if test -n "$MOZ_FEEDS"; then
6262     AC_DEFINE(MOZ_FEEDS)
6263 else
6264     if test "$MOZ_BUILD_APP" = "browser"; then
6265         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6266     fi
6269 dnl ========================================================
6270 dnl Check for sqlite
6271 dnl ========================================================
6273 MOZ_NATIVE_SQLITE=
6274 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6275 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6276 MOZ_NATIVE_SQLITE=1,
6277 MOZ_NATIVE_SQLITE= )
6279 if test -z "$MOZ_NATIVE_SQLITE"
6280 then
6281     SQLITE_CFLAGS=
6282     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6283 else
6284     dnl ============================
6285     dnl === SQLite Version check ===
6286     dnl ============================
6287     dnl Check to see if the system SQLite package is new enough.
6288     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6290     dnl ==================================
6291     dnl === SQLITE_SECURE_DELETE check ===
6292     dnl ==================================
6293     dnl Check to see if the system SQLite package is compiled with
6294     dnl SQLITE_SECURE_DELETE enabled.
6295     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6296     _SAVE_CFLAGS="$CFLAGS"
6297     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6298     _SAVE_LIBS="$LIBS"
6299     LIBS="$LIBS $SQLITE_LIBS"
6300     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6301         AC_TRY_RUN([
6302             #include "sqlite3.h"
6304             int main(int argc, char **argv){
6305               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6306             }],
6307             ac_cv_sqlite_secure_delete=yes,
6308             ac_cv_sqlite_secure_delete=no,
6309             ac_cv_sqlite_secure_delete=no
6310         )
6311     ])
6312     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6313     CFLAGS="$_SAVE_CFLAGS"
6314     LIBS="$_SAVE_LIBS"
6315     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6316         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6317     fi
6319     dnl ===============================
6320     dnl === SQLITE_THREADSAFE check ===
6321     dnl ===============================
6322     dnl Check to see if the system SQLite package is compiled with
6323     dnl SQLITE_THREADSAFE enabled.
6324     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6325     _SAVE_CFLAGS="$CFLAGS"
6326     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6327     _SAVE_LIBS="$LIBS"
6328     LIBS="$LIBS $SQLITE_LIBS"
6329     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6330         AC_TRY_RUN([
6331             #include "sqlite3.h"
6333             int main(int argc, char **argv){
6334               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6335             }],
6336             ac_cv_sqlite_threadsafe=yes,
6337             ac_cv_sqlite_threadsafe=no,
6338             ac_cv_sqlite_threadsafe=no
6339         )
6340     ])
6341     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6342     CFLAGS="$_SAVE_CFLAGS"
6343     LIBS="$_SAVE_LIBS"
6344     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6345         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6346     fi
6348     dnl ================================
6349     dnl === SQLITE_ENABLE_FTS3 check ===
6350     dnl ================================
6351     dnl check to see if the system SQLite package is compiled with
6352     dnl SQLITE_ENABLE_FTS3 enabled.
6353     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6354     _SAVE_CFLAGS="$CFLAGS"
6355     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6356     _SAVE_LIBS="$LIBS"
6357     LIBS="$LIBS $SQLITE_LIBS"
6358     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6359         AC_TRY_RUN([
6360             #include "sqlite3.h"
6362             int main(int argc, char **argv){
6363               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6364             }],
6365             ac_cv_sqlite_enable_fts3=yes,
6366             ac_cv_sqlite_enable_fts3=no,
6367             ac_cv_sqlite_enable_fts3=no
6368         )
6369     ])
6370     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6371     CFLAGS="$_SAVE_CFLAGS"
6372     LIBS="$_SAVE_LIBS"
6373     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6374         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6375     fi
6377     dnl =========================================
6378     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6379     dnl =========================================
6380     dnl check to see if the system SQLite package is compiled with
6381     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6382     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6383     _SAVE_CFLAGS="$CFLAGS"
6384     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6385     _SAVE_LIBS="$LIBS"
6386     LIBS="$LIBS $SQLITE_LIBS"
6387     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6388         AC_TRY_RUN([
6389             #include "sqlite3.h"
6391             int main(int argc, char **argv){
6392               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6393             }],
6394             ac_cv_sqlite_enable_unlock_notify=yes,
6395             ac_cv_sqlite_enable_unlock_notify=no,
6396             ac_cv_sqlite_enable_unlock_notify=no
6397         )
6398     ])
6399     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6400     CFLAGS="$_SAVE_CFLAGS"
6401     LIBS="$_SAVE_LIBS"
6402     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6403         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6404     fi
6407 if test -n "$MOZ_NATIVE_SQLITE"; then
6408     AC_DEFINE(MOZ_NATIVE_SQLITE)
6410 AC_SUBST(MOZ_NATIVE_SQLITE)
6412 dnl ========================================================
6413 dnl = Enable help viewer (off by default)
6414 dnl ========================================================
6415 if test -n "$MOZ_HELP_VIEWER"; then
6416      dnl Do this if defined in confvars.sh
6417      AC_DEFINE(MOZ_HELP_VIEWER)
6420 dnl ========================================================
6421 dnl = Enable safe browsing (anti-phishing)
6422 dnl ========================================================
6423 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6424 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6425     MOZ_SAFE_BROWSING=1,
6426     MOZ_SAFE_BROWSING= )
6427 if test -n "$MOZ_SAFE_BROWSING"; then
6428     AC_DEFINE(MOZ_SAFE_BROWSING)
6430 AC_SUBST(MOZ_SAFE_BROWSING)
6432 dnl ========================================================
6433 dnl = Enable url-classifier
6434 dnl ========================================================
6435 dnl Implicitly enabled by default if building with safe-browsing
6436 if test -n "$MOZ_SAFE_BROWSING"; then
6437     MOZ_URL_CLASSIFIER=1
6439 MOZ_ARG_ENABLE_BOOL(url-classifier,
6440 [  --enable-url-classifier Enable url classifier module],
6441     MOZ_URL_CLASSIFIER=1,
6442     MOZ_URL_CLASSIFIER= )
6443 if test -n "$MOZ_URL_CLASSIFIER"; then
6444     AC_DEFINE(MOZ_URL_CLASSIFIER)
6446 AC_SUBST(MOZ_URL_CLASSIFIER)
6448 dnl ========================================================
6449 dnl = Disable zipwriter
6450 dnl ========================================================
6451 MOZ_ARG_DISABLE_BOOL(zipwriter,
6452 [  --disable-zipwriter     Disable zipwriter component],
6453     MOZ_ZIPWRITER=,
6454     MOZ_ZIPWRITER=1 )
6455 AC_SUBST(MOZ_ZIPWRITER)
6457 dnl ========================================================
6458 dnl = libconic
6459 dnl ========================================================
6460 dnl superseded by QtNetwork starting from 4.7
6461 MOZ_ENABLE_LIBCONIC=1
6463 if test -n "$MOZ_ENABLE_QT"; then
6464   if test "$MOZ_ENABLE_QTNETWORK"; then
6465     MOZ_ENABLE_LIBCONIC=
6466   fi
6469 MOZ_ARG_DISABLE_BOOL(libconic,
6470 [  --disable-libconic      Disable libconic],
6471     MOZ_ENABLE_LIBCONIC=,
6472     MOZ_ENABLE_LIBCONIC=1 )
6474 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6475     PKG_CHECK_MODULES(LIBCONIC, conic,
6476                       MOZ_ENABLE_LIBCONIC=1,
6477                       MOZ_ENABLE_LIBCONIC=)
6479 if test "$MOZ_ENABLE_LIBCONIC"; then
6480     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6483 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6484 AC_SUBST(LIBCONIC_CFLAGS)
6485 AC_SUBST(LIBCONIC_LIBS)
6487 dnl ========================================================
6488 dnl = Maemo checks
6489 dnl ========================================================
6491 MAEMO_SDK_TARGET_VER=-1
6493 MOZ_ARG_WITH_STRING(maemo-version,
6494 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6495                           Maemo SDK Version],
6496   MAEMO_SDK_TARGET_VER=$withval)
6498 case "$MAEMO_SDK_TARGET_VER" in
6500     MOZ_PLATFORM_MAEMO=5
6501     ;;
6504     MOZ_PLATFORM_MAEMO=6
6505     ;;
6508     dnl We aren't compiling for Maemo, move on.
6509     ;;
6511     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6512     ;;
6513 esac
6515 if test $MOZ_PLATFORM_MAEMO; then
6516    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6518    if test -z "$MOZ_ENABLE_DBUS"; then
6519        AC_MSG_ERROR([DBus is required when building for Maemo])
6520    fi
6522    MOZ_GFX_OPTIMIZE_MOBILE=1
6523    MOZ_GL_DEFAULT_PROVIDER=EGL
6524    MOZ_MAEMO_LIBLOCATION=
6526    if test $MOZ_PLATFORM_MAEMO = 5; then
6527       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6528       MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6529           [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6530       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6531                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6533       AC_SUBST(XCOMPOSITE_LIBS)
6535       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6536       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6537       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6538       if test -z "$_LIB_FOUND"; then
6539          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6540       fi
6543       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6544       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6545       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6546       if test -z "$_LIB_FOUND"; then
6547          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6548       fi
6550       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6551       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6552       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6553       if test -z "$_LIB_FOUND"; then
6554          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6555       fi
6557    fi
6558    if test $MOZ_PLATFORM_MAEMO = 6; then
6560       PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6561                         _LIB_FOUND=1,
6562                         _LIB_FOUND=)
6563       if test "$_LIB_FOUND"; then
6564          MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6565          MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6566          MOZ_ENABLE_CONTENTMANAGER=1
6567          AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6568       else
6569          AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6570       fi
6571       AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6573       dnl ========================================================
6574       dnl = Enable meego libcontentaction
6575       dnl ========================================================
6576       MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6577       [  --enable-meegocontentaction           Enable meegocontentaction support],
6578          MOZ_MEEGOCONTENTACTION=1,
6579          MOZ_MEEGOCONTENTACTION=)
6581       if test -n "$MOZ_MEEGOCONTENTACTION"; then
6583          PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6584          if test "$_LIB_FOUND"; then
6585             MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6586             MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6587             MOZ_ENABLE_CONTENTACTION=1
6588             AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6589             AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6590          fi
6591       fi
6593       MOZ_ARG_ENABLE_BOOL(meegotouch,
6594       [  --enable-meegotouch  Enable meegotouch support],
6595          MOZ_MEEGOTOUCHENABLED=1,
6596          MOZ_MEEGOTOUCHENABLED=)
6598       if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6599           PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6600           if test "$_LIB_FOUND"; then
6601               MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6602               MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6603               AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6604           else
6605               AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6606           fi
6607       fi
6608    fi
6610    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6611    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6612    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6613    if test "$_LIB_FOUND"; then
6614       MOZ_MAEMO_LIBLOCATION=1
6615       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6616    else
6617       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6618    fi
6619    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6621    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6622    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6623    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6624    if test "$_LIB_FOUND"; then
6625       MOZ_ENABLE_MEEGOTOUCHSHARE=1
6626       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6627    else
6628       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6629    fi
6630    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6632    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6633    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6636 dnl ========================================================
6637 dnl = XRender Composite
6638 dnl ========================================================
6639 MOZ_ARG_ENABLE_BOOL(egl-xrender-composite,
6640 [  --enable-egl-xrender-composite
6641                           Enable EGL xrender composite optimizations],
6642     MOZ_EGL_XRENDER_COMPOSITE=1)
6644 if test -n "$MOZ_EGL_XRENDER_COMPOSITE"; then
6645     AC_DEFINE(MOZ_EGL_XRENDER_COMPOSITE)
6648 AC_SUBST(MOZ_EGL_XRENDER_COMPOSITE)
6650 dnl ========================================================
6651 dnl GL provider
6652 dnl ========================================================
6653 MOZ_GL_PROVIDER=
6654 MOZ_ARG_WITH_STRING(gl-provider,
6655 [  --with-gl-provider=ID
6656                           Set GL provider backend type],
6657 [ val=`echo $withval`
6658     MOZ_GL_PROVIDER="$val"])
6660 if test -n "$MOZ_GL_PROVIDER"; then
6661 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6662 AC_SUBST(MOZ_GL_PROVIDER)
6663 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6665 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6667 dnl ========================================================
6668 dnl = faststripe theme
6669 dnl ========================================================
6670 MOZ_ARG_ENABLE_BOOL(faststripe,
6671 [  --enable-faststripe     Use faststripe theme],
6672     MOZ_THEME_FASTSTRIPE=1,
6673     MOZ_THEME_FASTSTRIPE= )
6674 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6676 dnl ========================================================
6677 dnl =
6678 dnl = Feature options that require extra sources to be pulled
6679 dnl =
6680 dnl ========================================================
6681 dnl MOZ_ARG_HEADER(Features that require extra sources)
6683 dnl ========================================================
6684 dnl =
6685 dnl = Debugging Options
6686 dnl =
6687 dnl ========================================================
6688 MOZ_ARG_HEADER(Debugging and Optimizations)
6690 dnl ========================================================
6691 dnl = Disable building with debug info.
6692 dnl = Debugging is OFF by default
6693 dnl ========================================================
6694 if test -z "$MOZ_DEBUG_FLAGS"; then
6695   MOZ_DEBUG_FLAGS="-g"
6698 MOZ_ARG_ENABLE_STRING(debug,
6699 [  --enable-debug[=DBG]    Enable building with developer debug info
6700                            (using compiler flags DBG)],
6701 [ if test "$enableval" != "no"; then
6702     MOZ_DEBUG=1
6703     if test -n "$enableval" -a "$enableval" != "yes"; then
6704         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6705         _MOZ_DEBUG_FLAGS_SET=1
6706     fi
6707   else
6708     MOZ_DEBUG=
6709   fi ],
6710   MOZ_DEBUG=)
6712 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6713 MOZ_ARG_WITH_STRING(debug-label,
6714 [  --with-debug-label=LABELS
6715                           Define DEBUG_<value> for each comma-separated
6716                           value given.],
6717 [ for option in `echo $withval | sed 's/,/ /g'`; do
6718     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6719 done])
6721 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6723 if test -n "$MOZ_DEBUG"; then
6724     AC_MSG_CHECKING([for valid debug flags])
6725     _SAVE_CFLAGS=$CFLAGS
6726     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6727     AC_TRY_COMPILE([#include <stdio.h>],
6728         [printf("Hello World\n");],
6729         _results=yes,
6730         _results=no)
6731     AC_MSG_RESULT([$_results])
6732     if test "$_results" = "no"; then
6733         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6734     fi
6735     CFLAGS=$_SAVE_CFLAGS
6738 dnl ========================================================
6739 dnl enable mobile optimizations
6740 dnl ========================================================
6741 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6742 [  --enable-mobile-optimize
6743                           Enable mobile optimizations],
6744     MOZ_GFX_OPTIMIZE_MOBILE=1)
6746 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6748 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6749     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6752 dnl ========================================================
6753 dnl = Enable code optimization. ON by default.
6754 dnl ========================================================
6755 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6756         MOZ_OPTIMIZE_FLAGS="-O"
6759 MOZ_ARG_ENABLE_STRING(optimize,
6760 [  --disable-optimize      Disable compiler optimization
6761   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6762 [ if test "$enableval" != "no"; then
6763     MOZ_OPTIMIZE=1
6764     if test -n "$enableval" -a "$enableval" != "yes"; then
6765         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6766         MOZ_OPTIMIZE=2
6767     fi
6768 else
6769     MOZ_OPTIMIZE=
6770 fi ], MOZ_OPTIMIZE=1)
6772 MOZ_SET_FRAMEPTR_FLAGS
6774 if test "$COMPILE_ENVIRONMENT"; then
6775 if test -n "$MOZ_OPTIMIZE"; then
6776     AC_MSG_CHECKING([for valid optimization flags])
6777     _SAVE_CFLAGS=$CFLAGS
6778     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6779     AC_TRY_COMPILE([#include <stdio.h>],
6780         [printf("Hello World\n");],
6781         _results=yes,
6782         _results=no)
6783     AC_MSG_RESULT([$_results])
6784     if test "$_results" = "no"; then
6785         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6786     fi
6787     CFLAGS=$_SAVE_CFLAGS
6789 fi # COMPILE_ENVIRONMENT
6791 AC_SUBST(MOZ_OPTIMIZE)
6792 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6793 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6794 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6795 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6796 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6797 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6799 dnl ========================================================
6800 dnl = Enable generation of debug symbols
6801 dnl ========================================================
6802 MOZ_ARG_ENABLE_STRING(debug-symbols,
6803 [  --enable-debug-symbols[=DBG]
6804                           Enable debugging symbols (using compiler flags DBG)],
6805 [ if test "$enableval" != "no"; then
6806       MOZ_DEBUG_SYMBOLS=1
6807       if test -n "$enableval" -a "$enableval" != "yes"; then
6808           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6809               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6810           else
6811               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6812           fi
6813       fi
6814   else
6815       MOZ_DEBUG_SYMBOLS=
6816   fi ],
6817   MOZ_DEBUG_SYMBOLS=1)
6819 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6820     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6821     export MOZ_DEBUG_SYMBOLS
6824 dnl ========================================================
6825 dnl = Enable any treating of compile warnings as errors
6826 dnl ========================================================
6827 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6828 [  --enable-warnings-as-errors
6829                           Enable treating of warnings as errors],
6830     MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6831     MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6832 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6833    WARNINGS_AS_ERRORS=''
6836 dnl ========================================================
6837 dnl = Disable runtime logging checks
6838 dnl ========================================================
6839 MOZ_ARG_DISABLE_BOOL(logging,
6840 [  --disable-logging       Disable logging facilities],
6841     NS_DISABLE_LOGGING=1,
6842     NS_DISABLE_LOGGING= )
6843 if test "$NS_DISABLE_LOGGING"; then
6844     AC_DEFINE(NS_DISABLE_LOGGING)
6845 else
6846     AC_DEFINE(MOZ_LOGGING)
6849 dnl ========================================================
6850 dnl = This will enable logging of addref, release, ctor, dtor.
6851 dnl ========================================================
6852 _ENABLE_LOGREFCNT=42
6853 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6854 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6855     _ENABLE_LOGREFCNT=1,
6856     _ENABLE_LOGREFCNT= )
6857 if test "$_ENABLE_LOGREFCNT" = "1"; then
6858     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6859 elif test -z "$_ENABLE_LOGREFCNT"; then
6860     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6863 dnl ========================================================
6864 dnl moz_dump_painting
6865 dnl ========================================================
6866 MOZ_ARG_ENABLE_BOOL(dump-painting,
6867 [  --enable-dump-painting          Enable paint debugging.],
6868     MOZ_DUMP_PAINTING=1,
6869     MOZ_DUMP_PAINTING= )
6870 if test -n "$MOZ_DUMP_PAINTING"; then
6871     AC_DEFINE(MOZ_DUMP_PAINTING)
6872     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6874 if test -n "$MOZ_DEBUG"; then
6875     AC_DEFINE(MOZ_DUMP_PAINTING)
6878 dnl ========================================================
6879 dnl = Enable trace malloc
6880 dnl ========================================================
6881 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6882 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6883 [  --enable-trace-malloc   Enable malloc tracing; also disables jemalloc],
6884     NS_TRACE_MALLOC=1,
6885     NS_TRACE_MALLOC= )
6886 if test "$NS_TRACE_MALLOC"; then
6887   # Please, Mr. Linker Man, don't take away our symbol names
6888   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6889   USE_ELF_DYNSTR_GC=
6890   AC_DEFINE(NS_TRACE_MALLOC)
6892 AC_SUBST(NS_TRACE_MALLOC)
6894 dnl ========================================================
6895 dnl = Enable jemalloc
6896 dnl ========================================================
6897 MOZ_ARG_ENABLE_BOOL(jemalloc,
6898 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6899     MOZ_MEMORY=1,
6900     MOZ_MEMORY=)
6902 if test "$NS_TRACE_MALLOC"; then
6903     MOZ_MEMORY=
6905 if test "$MOZ_DMD"; then
6906     MOZ_MEMORY=
6909 if test "${OS_TARGET}" = "Android"; then
6910   dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6911   :
6912 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
6913   dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
6914   if test -z "$GNU_CC"; then
6915     MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6916   else
6917     MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6918   fi
6919 else
6920   dnl On other Unix systems, we only want to link executables against mozglue
6921   MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6922   dnl On other Unix systems, where mozglue is a static library, jemalloc is
6923   dnl separated for the SDK, so we need to add it here.
6924   if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6925     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6926   fi
6927   MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6928   if test -n "$GNU_CC"; then
6929     dnl And we need mozglue symbols to be exported.
6930     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6931   fi
6932   if test "$MOZ_LINKER" = 1; then
6933     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $ZLIB_LIBS"
6934   fi
6937 if test -z "$MOZ_MEMORY"; then
6938   case "${target}" in
6939     *-mingw*)
6940       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
6941         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.])
6942       fi
6943       ;;
6944   esac
6945 else
6946   dnl Don't try to run compiler tests on Windows
6947   if test "$OS_ARCH" = "WINNT"; then
6948     if test -z "$HAVE_64BIT_OS"; then
6949       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6950     else
6951       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6952     fi
6953   else
6954     AC_CHECK_SIZEOF([int *], [4])
6955     case "${ac_cv_sizeof_int_p}" in
6956     4)
6957       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6958       ;;
6959     8)
6960       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6961       ;;
6962     *)
6963       AC_MSG_ERROR([Unexpected pointer size])
6964       ;;
6965     esac
6966   fi
6968   AC_DEFINE(MOZ_MEMORY)
6969   if test -n "$MOZ_JEMALLOC"; then
6970     AC_DEFINE(MOZ_JEMALLOC)
6971   fi
6972   if test "x$MOZ_DEBUG" = "x1"; then
6973     AC_DEFINE(MOZ_MEMORY_DEBUG)
6974   fi
6975   dnl The generic feature tests that determine how to compute ncpus are long and
6976   dnl complicated.  Therefore, simply define special cpp variables for the
6977   dnl platforms we have special knowledge of.
6978   case "${target}" in
6979   *-darwin*)
6980     AC_DEFINE(MOZ_MEMORY_DARWIN)
6981     ;;
6982   *-*freebsd*)
6983     AC_DEFINE(MOZ_MEMORY_BSD)
6984     ;;
6985   *-android*|*-linuxandroid*)
6986     AC_DEFINE(MOZ_MEMORY_LINUX)
6987     AC_DEFINE(MOZ_MEMORY_ANDROID)
6988     if test -z "$gonkdir"; then
6989       _WRAP_MALLOC=1
6990     else
6991       AC_DEFINE(MOZ_MEMORY_GONK)
6992     fi
6993     MOZ_GLUE_LDFLAGS=
6994     ;;
6995   *-*linux*)
6996     AC_DEFINE(MOZ_MEMORY_LINUX)
6997     ;;
6998   *-netbsd*)
6999     AC_DEFINE(MOZ_MEMORY_BSD)
7000     ;;
7001   *-solaris*)
7002     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7003     ;;
7004   *-mingw*)
7005     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7006     if test -z "$MOZ_DEBUG"; then
7007       WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7008     else
7009       WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7010     fi
7011     dnl Look for a broken crtdll.obj
7012     WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7013     lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7014     if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7015       MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7016       dnl Also pass this to NSPR/NSS
7017       DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7018     else
7019       DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7020     fi
7021     rm crtdll.obj
7023     export DLLFLAGS
7024     ;;
7025   *)
7026     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7027     ;;
7028   esac
7029 fi # MOZ_MEMORY
7030 AC_SUBST(MOZ_MEMORY)
7031 AC_SUBST(MOZ_JEMALLOC)
7032 AC_SUBST(MOZ_GLUE_LDFLAGS)
7033 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7034 AC_SUBST(WIN32_CRT_LIBS)
7035 dnl Need to set this for make because NSS doesn't have configure
7036 AC_SUBST(DLLFLAGS)
7038 dnl We need to wrap dlopen and related functions on Android because we use
7039 dnl our own linker.
7040 if test "$OS_TARGET" = Android; then
7041     WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7042     if test -n "$MOZ_OLD_LINKER"; then
7043         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
7044     fi
7045     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7046     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7049 dnl ========================================================
7050 dnl = Use malloc wrapper lib
7051 dnl ========================================================
7052 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7053 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7054     _WRAP_MALLOC=1,
7055     _WRAP_MALLOC= )
7057 if test -n "$_WRAP_MALLOC"; then
7058     if test -n "$GNU_CC"; then
7059         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7060         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7061         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7062         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7063         dnl Wrap operator new and operator delete on Android.
7064         if test "$OS_TARGET" = "Android"; then
7065             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7066         fi
7067     else
7068         AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7069     fi
7072 dnl ========================================================
7073 dnl = Location of malloc wrapper lib
7074 dnl ========================================================
7075 MOZ_ARG_WITH_STRING(wrap-malloc,
7076 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7077     WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7079 dnl ========================================================
7080 dnl = Use JS Call tracing
7081 dnl ========================================================
7082 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7083 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7084     MOZ_TRACE_JSCALLS=1,
7085     MOZ_TRACE_JSCALLS= )
7086 if test -n "$MOZ_TRACE_JSCALLS"; then
7087     AC_DEFINE(MOZ_TRACE_JSCALLS)
7090 dnl ========================================================
7091 dnl = Use incremental GC
7092 dnl ========================================================
7093 JSGC_INCREMENTAL=1
7094 MOZ_ARG_DISABLE_BOOL(gcincremental,
7095 [  --disable-gcincremental Disable incremental GC],
7096     JSGC_INCREMENTAL= )
7097 if test -n "$JSGC_INCREMENTAL"; then
7098     AC_DEFINE(JSGC_INCREMENTAL)
7101 dnl ========================================================
7102 dnl ETW - Event Tracing for Windows
7103 dnl ========================================================
7104 MOZ_ARG_ENABLE_BOOL(ETW,
7105 [  --enable-ETW            Enable ETW (Event Tracing for Windows) event reporting],
7106     MOZ_ETW=1,
7107     MOZ_ETW= )
7108 if test -n "$MOZ_ETW"; then
7109     AC_DEFINE(MOZ_ETW)
7112 if test -n "$MOZ_ETW"; then
7113     if test -z "$MOZ_WINSDK_TARGETVER"; then
7114         AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7115     fi
7118 dnl ========================================================
7119 dnl Zealous JavaScript GC
7120 dnl ========================================================
7121 MOZ_ARG_ENABLE_BOOL(gczeal,
7122 [  --enable-gczeal         Enable zealous JavaScript GCing],
7123     JS_GC_ZEAL=1,
7124     JS_GC_ZEAL= )
7125 if test -n "$JS_GC_ZEAL"; then
7126     AC_DEFINE(JS_GC_ZEAL)
7129 dnl ========================================================
7130 dnl JS opt-mode assertions and minidump instrumentation
7131 dnl ========================================================
7132 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7133 [  --enable-js-diagnostics
7134                           Enable JS diagnostic assertions and breakpad data],
7135     JS_CRASH_DIAGNOSTICS=1,
7136     JS_CRASH_DIAGNOSTICS= )
7137 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7138     AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7141 MOZ_CHECK_CCACHE
7143 dnl ========================================================
7144 dnl = Enable static checking using gcc-dehydra
7145 dnl ========================================================
7147 MOZ_ARG_WITH_STRING(static-checking,
7148 [  --with-static-checking=path/to/gcc_dehydra.so
7149                           Enable static checking of code using GCC-dehydra],
7150     DEHYDRA_PATH=$withval,
7151     DEHYDRA_PATH= )
7153 if test -n "$DEHYDRA_PATH"; then
7154     if test ! -f "$DEHYDRA_PATH"; then
7155         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7156     fi
7157     AC_DEFINE(NS_STATIC_CHECKING)
7159 AC_SUBST(DEHYDRA_PATH)
7161 dnl ========================================================
7162 dnl = Enable stripping of libs & executables
7163 dnl ========================================================
7164 MOZ_ARG_ENABLE_BOOL(strip,
7165 [  --enable-strip          Enable stripping of libs & executables ],
7166     ENABLE_STRIP=1,
7167     ENABLE_STRIP= )
7169 dnl ========================================================
7170 dnl = Enable stripping of libs & executables when packaging
7171 dnl ========================================================
7172 MOZ_ARG_ENABLE_BOOL(install-strip,
7173 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7174     PKG_SKIP_STRIP= ,
7175     PKG_SKIP_STRIP=1)
7177 dnl ========================================================
7178 dnl = --enable-elf-dynstr-gc
7179 dnl ========================================================
7180 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7181 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7182     USE_ELF_DYNSTR_GC=1,
7183     USE_ELF_DYNSTR_GC= )
7185 dnl ========================================================
7186 dnl = --disable-elf-hack
7187 dnl ========================================================
7189 USE_ELF_HACK=1
7190 MOZ_ARG_DISABLE_BOOL(elf-hack,
7191 [  --disable-elf-hack      Disable elf hacks],
7192     USE_ELF_HACK=,
7193     USE_ELF_HACK=1)
7195 # Disable elf hack for profiling because the built in profiler
7196 # doesn't read the segments properly with elf hack. This is
7197 # temporary and should be fixed soon in the profiler.
7198 if test "$MOZ_PROFILING" = 1; then
7199   USE_ELF_HACK=
7202 # Only enable elfhack where supported
7203 if test "$USE_ELF_HACK" = 1; then
7204     case "${HOST_OS_ARCH},${OS_ARCH}" in
7205     Linux,Linux)
7206         case "${CPU_ARCH}" in
7207         arm | x86 | x86_64)
7208             USE_ELF_HACK=1
7209             ;;
7210         *)
7211             USE_ELF_HACK=
7212             ;;
7213         esac
7214         ;;
7215     *)
7216         USE_ELF_HACK=
7217         ;;
7218     esac
7221 if test "$USE_ELF_HACK" = 1; then
7222     dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7223     dnl memory addresses it maps to. The result is that by the time elfhack
7224     dnl kicks in, it is not possible to apply relocations because of that,
7225     dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7226     dnl segment. It makes elfhack mostly useless, so considering the problems
7227     dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7228     dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7229     dnl the linker creates PT_GNU_RELRO segments.
7230     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7231         LINK_WITH_PT_GNU_RELRO,
7232         [echo "int main() {return 0;}" > conftest.${ac_ext}
7233          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7234             test -s conftest${ac_exeext}; then
7235             if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7236                 LINK_WITH_PT_GNU_RELRO=yes
7237             else
7238                 LINK_WITH_PT_GNU_RELRO=no
7239             fi
7240          else
7241              dnl We really don't expect to get here, but just in case
7242              AC_ERROR([couldn't compile a simple C file])
7243          fi
7244          rm -rf conftest*])
7245     if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7246         AC_MSG_WARN([Disabling elfhack])
7247         USE_ELF_HACK=
7248     fi
7251 dnl ========================================================
7252 dnl = libstdc++ compatibility hacks
7253 dnl ========================================================
7255 STDCXX_COMPAT=
7256 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7257 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
7258     STDCXX_COMPAT=1)
7260 AC_SUBST(STDCXX_COMPAT)
7262 if test -n "$STDCXX_COMPAT"; then
7263    eval $(CXX="$CXX" MACOS_SDK_DIR="$MACOS_SDK_DIR" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7264    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7265    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7268 dnl ========================================================
7269 dnl =
7270 dnl = Profiling and Instrumenting
7271 dnl =
7272 dnl ========================================================
7273 MOZ_ARG_HEADER(Profiling and Instrumenting)
7275 dnl ========================================================
7276 dnl = Enable NS_FUNCTION_TIMER, which provides Function
7277 dnl = timing for identifying code bottlenecks
7278 dnl = NS_FUNCTION_TIMER is off by default.
7279 dnl ========================================================
7280 MOZ_ARG_ENABLE_BOOL(functiontimer,
7281 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7282     NS_FUNCTION_TIMER=1,
7283     NS_FUNCTION_TIMER= )
7284 if test -n "$NS_FUNCTION_TIMER"; then
7285     AC_DEFINE(NS_FUNCTION_TIMER)
7288 dnl ========================================================
7289 dnl = Enable runtime visual profiling logger
7290 dnl ========================================================
7291 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7292 [  --enable-visual-event-tracer   Enable visual event tracer instrumentation],
7293     MOZ_VISUAL_EVENT_TRACER=1,
7294     MOZ_VISUAL_EVENT_TRACER=)
7295 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7296     AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7299 dnl ========================================================
7300 dnl Turn on reflow counting
7301 dnl ========================================================
7302 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7303 [  --enable-reflow-perf    Enable reflow performance tracing],
7304     MOZ_REFLOW_PERF=1,
7305     MOZ_REFLOW_PERF= )
7306 if test -n "$MOZ_REFLOW_PERF"; then
7307     AC_DEFINE(MOZ_REFLOW_PERF)
7310 dnl ========================================================
7311 dnl Enable code size metrics.
7312 dnl ========================================================
7313 MOZ_ARG_ENABLE_BOOL(codesighs,
7314 [  --enable-codesighs      Enable code size analysis tools],
7315     _ENABLE_CODESIGHS=1,
7316     _ENABLE_CODESIGHS= )
7317 if test -n "$_ENABLE_CODESIGHS"; then
7318     if test -d $srcdir/tools/codesighs; then
7319         MOZ_MAPINFO=1
7320     else
7321         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7322     fi
7325 dnl ========================================================
7326 dnl = Enable Radio Interface for B2G (Gonk usually)
7327 dnl ========================================================
7328 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7329 [  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7330     MOZ_B2G_RIL=1,
7331     MOZ_B2G_RIL= )
7332 if test -n "$MOZ_B2G_RIL"; then
7333     AC_DEFINE(MOZ_B2G_RIL)
7335 AC_SUBST(MOZ_B2G_RIL)
7337 dnl ========================================================
7338 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7339 dnl ========================================================
7340 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7341 [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
7342     MOZ_B2G_BT=1,
7343     MOZ_B2G_BT= )
7344 if test -n "$MOZ_B2G_BT"; then
7345     AC_DEFINE(MOZ_B2G_BT)
7347 AC_SUBST(MOZ_B2G_BT)
7349 dnl ========================================================
7350 dnl = Enable Support for System Messages API
7351 dnl ========================================================
7352 if test -n "$MOZ_SYS_MSG"; then
7353     AC_DEFINE(MOZ_SYS_MSG)
7355 AC_SUBST(MOZ_SYS_MSG)
7357 dnl ========================================================
7358 dnl = Enable Camera Interface for B2G (Gonk usually)
7359 dnl ========================================================
7360 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7361 [  --enable-b2g-camera      Set compile flags necessary for compiling camera API for B2G ],
7362     MOZ_B2G_CAMERA=1,
7363     MOZ_B2G_CAMERA= )
7364 if test -n "$MOZ_B2G_CAMERA"; then
7365    AC_DEFINE(MOZ_B2G_CAMERA)
7367 AC_SUBST(MOZ_B2G_CAMERA)
7369 dnl ========================================================
7370 dnl = Support for demangling undefined symbols
7371 dnl ========================================================
7372 if test -z "$SKIP_LIBRARY_CHECKS"; then
7373     AC_LANG_SAVE
7374     AC_LANG_CPLUSPLUS
7375     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7376     AC_LANG_RESTORE
7379 # Demangle only for debug or trace-malloc builds
7380 MOZ_DEMANGLE_SYMBOLS=
7381 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7382     MOZ_DEMANGLE_SYMBOLS=1
7383     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7385 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7387 dnl ========================================================
7388 dnl = Support for gcc stack unwinding (from gcc 3.3)
7389 dnl ========================================================
7390 if test -z "$SKIP_LIBRARY_CHECKS"; then
7391     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7394 dnl ========================================================
7395 dnl JIT observers
7396 dnl ========================================================
7398 MOZ_ARG_WITH_STRING(jitreport-granularity,
7399 [  --jitreport-granularity=N
7400                            Default granularity at which to report JIT code
7401                            to external tools
7402                              0 - no info
7403                              1 - code ranges for whole functions only
7404                              2 - per-line information
7405                              3 - per-op information],
7406   JITREPORT_GRANULARITY=$withval,
7407   JITREPORT_GRANULARITY=3)
7409 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7411 dnl ========================================================
7412 dnl =
7413 dnl = Misc. Options
7414 dnl =
7415 dnl ========================================================
7416 MOZ_ARG_HEADER(Misc. Options)
7418 dnl ========================================================
7419 dnl update xterm title
7420 dnl ========================================================
7421 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7422 [  --enable-xterm-updates  Update XTERM titles with current command.],
7423     MOZ_UPDATE_XTERM=1,
7424     MOZ_UPDATE_XTERM= )
7426 dnl =========================================================
7427 dnl = Chrome format
7428 dnl =========================================================
7429 MOZ_ARG_ENABLE_STRING([chrome-format],
7430 [  --enable-chrome-format=jar|flat|both|symlink|omni
7431                           Select FORMAT of chrome files (default=jar)],
7432     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7434 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7435     MOZ_CHROME_FILE_FORMAT=jar
7438 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7439     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7440     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7441     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7442     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7443     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7446 dnl =========================================================
7447 dnl Omnijar packaging (bug 552121)
7448 dnl =========================================================
7449 dnl Omnijar packaging is compatible with flat packaging.
7450 dnl In unpackaged builds, omnijar looks for files as if
7451 dnl things were flat packaged. After packaging, all files
7452 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7453 dnl is set to flat since putting files into jars is only
7454 dnl done during packaging with omnijar.
7455 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7456     MOZ_OMNIJAR=1
7457     AC_DEFINE(MOZ_OMNIJAR)
7458     if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$OS_TARGET" = "Android"; then
7459         MOZ_CHROME_FILE_FORMAT=flat
7460     else
7461         MOZ_CHROME_FILE_FORMAT=symlink
7462     fi
7463 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7464     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7467 OMNIJAR_NAME=omni.ja
7468 AC_SUBST(OMNIJAR_NAME)
7469 AC_SUBST(MOZ_OMNIJAR)
7471 dnl ========================================================
7472 dnl = Define default location for MOZILLA_FIVE_HOME
7473 dnl ========================================================
7474 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7475 [  --with-default-mozilla-five-home
7476                           Set the default value for MOZILLA_FIVE_HOME],
7477 [ val=`echo $withval`
7478   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7480 dnl ========================================================
7481 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7482 dnl ========================================================
7483 MOZ_ARG_WITH_STRING(user-appdir,
7484 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7485 [ val=`echo $withval`
7486 if echo "$val" | grep "\/" >/dev/null; then
7487     AC_MSG_ERROR("Homedir must be single relative path.")
7488 else
7489     MOZ_USER_DIR="$val"
7490 fi])
7492 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7494 dnl ========================================================
7495 dnl = Doxygen configuration
7496 dnl ========================================================
7497 dnl Use commas to specify multiple dirs to this arg
7498 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7499 MOZ_ARG_WITH_STRING(doc-input-dirs,
7500 [  --with-doc-input-dirs=DIRS
7501                           Header/idl dirs to create docs from],
7502 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7503 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7505 dnl Use commas to specify multiple dirs to this arg
7506 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7507 MOZ_ARG_WITH_STRING(doc-include-dirs,
7508 [  --with-doc-include-dirs=DIRS
7509                           Include dirs to preprocess doc headers],
7510 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7511 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7513 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7514 MOZ_ARG_WITH_STRING(doc-output-dir,
7515 [  --with-doc-output-dir=DIR
7516                           Dir to generate docs into],
7517 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7518 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7520 if test -z "$SKIP_COMPILER_CHECKS"; then
7521 dnl ========================================================
7522 dnl =
7523 dnl = Compiler Options
7524 dnl =
7525 dnl ========================================================
7526 MOZ_ARG_HEADER(Compiler Options)
7528 dnl ========================================================
7529 dnl Check for gcc -pipe support
7530 dnl ========================================================
7531 AC_MSG_CHECKING([for -pipe support])
7532 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7533     dnl Any gcc that supports firefox supports -pipe.
7534     CFLAGS="$CFLAGS -pipe"
7535     CXXFLAGS="$CXXFLAGS -pipe"
7536     AC_MSG_RESULT([yes])
7537 else
7538     AC_MSG_RESULT([no])
7541 dnl ========================================================
7542 dnl Profile guided optimization (gcc checks)
7543 dnl ========================================================
7544 dnl Test for profiling options
7545 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7547 _SAVE_CFLAGS="$CFLAGS"
7548 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7550 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7551 AC_TRY_COMPILE([], [return 0;],
7552                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7553                  result="yes" ], result="no")
7554 AC_MSG_RESULT([$result])
7556 if test $result = "yes"; then
7557   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7558   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7559   PROFILE_USE_LDFLAGS="-fprofile-use"
7562 CFLAGS="$_SAVE_CFLAGS"
7564 if test -n "$INTEL_CC"; then
7565   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7566   PROFILE_GEN_LDFLAGS=
7567   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7568   PROFILE_USE_LDFLAGS=
7571 dnl Sun Studio on Solaris
7572 if test "$SOLARIS_SUNPRO_CC"; then
7573   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7574   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7575   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7576   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7579 AC_SUBST(PROFILE_GEN_CFLAGS)
7580 AC_SUBST(PROFILE_GEN_LDFLAGS)
7581 AC_SUBST(PROFILE_USE_CFLAGS)
7582 AC_SUBST(PROFILE_USE_LDFLAGS)
7584 AC_LANG_CPLUSPLUS
7586 dnl ========================================================
7587 dnl Test for -pedantic bustage
7588 dnl ========================================================
7589 MOZ_ARG_DISABLE_BOOL(pedantic,
7590 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7591 _PEDANTIC= )
7592 if test "$_PEDANTIC"; then
7593     _SAVE_CXXFLAGS=$CXXFLAGS
7594     CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7595     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7596     AC_TRY_COMPILE([$configure_static_assert_macros],
7597                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7598                    result="no", result="yes" )
7599     AC_MSG_RESULT([$result])
7600     CXXFLAGS="$_SAVE_CXXFLAGS"
7602     case "$result" in
7603     no)
7604         _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
7605         _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7606         ;;
7607     yes)
7608         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7609         ;;
7610     esac
7613 dnl ========================================================
7614 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7615 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7616 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7617 dnl ========================================================
7618 _SAVE_CXXFLAGS=$CXXFLAGS
7619 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7620 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7621     ac_nscap_nonconst_opeq_bug,
7622     [AC_TRY_COMPILE([
7623                       template <class T>
7624                       class Pointer
7625                         {
7626                         public:
7627                           T* myPtr;
7628                         };
7630                       template <class T, class U>
7631                       int operator==(const Pointer<T>& rhs, U* lhs)
7632                         {
7633                           return rhs.myPtr == lhs;
7634                         }
7636                       template <class T, class U>
7637                       int operator==(const Pointer<T>& rhs, const U* lhs)
7638                         {
7639                           return rhs.myPtr == lhs;
7640                         }
7641                     ],
7642                     [
7643                       Pointer<int> foo;
7644                       const int* bar;
7645                       return foo == bar;
7646                     ],
7647                     ac_nscap_nonconst_opeq_bug="no",
7648                     ac_nscap_nonconst_opeq_bug="yes")])
7649 CXXFLAGS="$_SAVE_CXXFLAGS"
7651 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7652     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7654 fi # ! SKIP_COMPILER_CHECKS
7656 AC_DEFINE(CPP_THROW_NEW, [throw()])
7657 AC_LANG_C
7659 if test "$COMPILE_ENVIRONMENT"; then
7660 MOZ_EXPAND_LIBS
7661 fi # COMPILE_ENVIRONMENT
7663 dnl ========================================================
7664 dnl =
7665 dnl = Build depencency options
7666 dnl =
7667 dnl ========================================================
7668 MOZ_ARG_HEADER(Build dependencies)
7670 dnl ========================================================
7671 dnl = Do not auto generate dependency info
7672 dnl ========================================================
7673 MOZ_AUTO_DEPS=1
7674 MOZ_ARG_DISABLE_BOOL(auto-deps,
7675 [  --disable-auto-deps     Do not automatically generate dependency info],
7676     MOZ_AUTO_DEPS=,
7677     MOZ_AUTO_DEPS=1)
7679 if test -n "$MOZ_AUTO_DEPS"; then
7680 dnl ========================================================
7681 dnl = Use mkdepend instead of $CC -MD for dependency generation
7682 dnl ========================================================
7683 _cpp_md_flag=
7684 MOZ_ARG_DISABLE_BOOL(md,
7685 [  --disable-md            Do not use compiler-based dependencies ],
7686   [_cpp_md_flag=],
7687   [_cpp_md_flag=1],
7688   [dnl Default is to turn on -MD if using GNU-compatible compilers
7689    if test "$GNU_CC" -a "$GNU_CXX"; then
7690      _cpp_md_flag=1
7691    fi
7692   dnl Default is to use -xM if using Sun Studio on Solaris
7693    if test "$SOLARIS_SUNPRO_CC"; then
7694      _cpp_md_flag=1
7695    fi])
7696 if test "$_cpp_md_flag"; then
7697   COMPILER_DEPEND=1
7698   _DEPEND_CFLAGS='$(filter-out %/.pp,-MMD -MF $(MDDEPDIR)/$(@F).pp)'
7699   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7700   if test "$SOLARIS_SUNPRO_CC"; then
7701     _DEPEND_CFLAGS=
7702   fi
7703 else
7704   COMPILER_DEPEND=
7705   dnl Don't override this for MSVC
7706   if test -z "$_WIN32_MSVC"; then
7707     _USE_CPP_INCLUDE_FLAG=
7708     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7709     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7710   else
7711     echo '#include <stdio.h>' > dummy-hello.c
7712     changequote(,)
7713     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7714     changequote([,])
7715     if test -z "$CL_INCLUDES_PREFIX"; then
7716         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7717     fi
7718     AC_SUBST(CL_INCLUDES_PREFIX)
7719     rm -f dummy-hello.c
7720     COMPILER_DEPEND=1
7721   fi
7723 fi # MOZ_AUTO_DEPS
7724 MDDEPDIR='.deps'
7725 AC_SUBST(MOZ_AUTO_DEPS)
7726 AC_SUBST(COMPILER_DEPEND)
7727 AC_SUBST(MDDEPDIR)
7729 dnl ========================================================
7730 dnl =
7731 dnl = Static Build Options
7732 dnl =
7733 dnl ========================================================
7734 MOZ_ARG_HEADER(Static build options)
7736 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7737 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
7738   ENABLE_SHARED_JS=1
7741 MOZ_ARG_ENABLE_BOOL(shared-js,
7742 [  --enable-shared-js
7743                           Create a shared JavaScript library.],
7744     ENABLE_SHARED_JS=1,
7745     ENABLE_SHARED_JS=)
7747 if test -n "$ENABLE_SHARED_JS"; then
7748   JS_SHARED_LIBRARY=1
7749   MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7750 else
7751   MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7752   AC_DEFINE(MOZ_STATIC_JS)
7754 AC_SUBST(JS_SHARED_LIBRARY)
7756 AC_SUBST(LIBXUL_LIBS)
7757 XPCOM_LIBS="$LIBXUL_LIBS"
7759 dnl ========================================================
7760 dnl =
7761 dnl = Standalone module options
7762 dnl =
7763 dnl ========================================================
7764 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7766 dnl Check for GLib.
7767 dnl ========================================================
7769 if test -z "$SKIP_PATH_CHECKS"; then
7770 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7771     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7772         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7773     fi
7777 if test -z "${GLIB_GMODULE_LIBS}" \
7778    -a -n "${GLIB_CONFIG}"\
7779     -a "${GLIB_CONFIG}" != no\
7780 ; then
7781     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7784 AC_SUBST(GLIB_CFLAGS)
7785 AC_SUBST(GLIB_LIBS)
7786 AC_SUBST(GLIB_GMODULE_LIBS)
7788 dnl ========================================================
7789 dnl Graphics checks.
7790 dnl ========================================================
7792 if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
7793 MOZ_ENABLE_SKIA=1
7794 else
7795 MOZ_ENABLE_SKIA=
7798 MOZ_ARG_ENABLE_BOOL(skia,
7799 [  --enable-skia   Enable use of Skia],
7800 MOZ_ENABLE_SKIA=1,
7801 MOZ_ENABLE_SKIA=)
7803 if test "$USE_FC_FREETYPE"; then
7804     if test "$COMPILE_ENVIRONMENT"; then
7805         dnl ========================================================
7806         dnl = Check for freetype2 and its functionality
7807         dnl ========================================================
7808         PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7810         if test "$_HAVE_FREETYPE2"; then
7811             _SAVE_LIBS="$LIBS"
7812             _SAVE_CFLAGS="$CFLAGS"
7813             LIBS="$LIBS $FT2_LIBS"
7814             CFLAGS="$CFLAGS $FT2_CFLAGS"
7816             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7817                 ac_cv_member_FT_Bitmap_Size_y_ppem,
7818                 [AC_TRY_COMPILE([#include <ft2build.h>
7819                                  #include FT_FREETYPE_H],
7820                                 [FT_Bitmap_Size s;
7821                                  if (sizeof s.y_ppem) return 0;
7822                                  return 1],
7823                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7824                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7825             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7826                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7827             else
7828                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7829             fi
7830             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7831                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7832                                [FT_Bitmap_Size structure includes y_ppem field])
7834             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
7836             LIBS="$_SAVE_LIBS"
7837             CFLAGS="$_SAVE_CFLAGS"
7838         fi
7840         _SAVE_CPPFLAGS="$CPPFLAGS"
7841         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7842         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7843             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7844         CPPFLAGS="$_SAVE_CPPFLAGS"
7845     else
7846         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7847     fi
7849     PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
7850     [
7851         if test "$MOZ_PANGO"; then
7852             MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
7853             MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
7854         else
7855             FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
7856             FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
7857         fi
7858     ])
7861 dnl ========================================================
7862 dnl Check for pixman and cairo
7863 dnl ========================================================
7865 MOZ_TREE_CAIRO=1
7866 MOZ_ARG_ENABLE_BOOL(system-cairo,
7867 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
7868 MOZ_TREE_CAIRO=,
7869 MOZ_TREE_CAIRO=1 )
7871 MOZ_TREE_PIXMAN=1
7872 MOZ_ARG_ENABLE_BOOL(system-pixman,
7873 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7874 MOZ_TREE_PIXMAN=,
7875 MOZ_TREE_PIXMAN=force,
7876 MOZ_TREE_PIXMAN=1 )
7878 # System cairo depends on system pixman
7879 if test "$MOZ_TREE_PIXMAN" = "force"; then
7880     if test -z "$MOZ_TREE_CAIRO"; then
7881         AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7882     else
7883         MOZ_TREE_PIXMAN=1
7884     fi
7885 elif test -z "$MOZ_TREE_CAIRO"; then
7886     MOZ_TREE_PIXMAN=
7889 if test "$MOZ_TREE_PIXMAN"; then
7890     AC_DEFINE(MOZ_TREE_PIXMAN)
7891     MOZ_PIXMAN_CFLAGS=""
7892     MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
7893 else
7894     PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
7895     MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
7896     MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
7898 AC_SUBST(MOZ_PIXMAN_CFLAGS)
7899 AC_SUBST(MOZ_PIXMAN_LIBS)
7901 # Check for headers defining standard int types.
7902 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7904 if test "$MOZ_TREE_CAIRO"; then
7905     MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7906     AC_DEFINE(MOZ_TREE_CAIRO)
7908     # For now we assume that we will have a uint64_t available through
7909     # one of the above headers or mozstdint.h.
7910     AC_DEFINE(HAVE_UINT64_T)
7912     # Define macros for cairo-features.h
7913     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
7914     if test "$MOZ_X11"; then
7915         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7916         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7917         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7918         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7919         MOZ_ENABLE_CAIRO_FT=1
7920         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7921     fi
7922     case "$MOZ_WIDGET_TOOLKIT" in
7923       qt)
7924         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7925         ;;
7926       cocoa | uikit)
7927         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7928         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7929         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7930         ;;
7931       windows)
7932         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7933         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7934         if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7935             WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7936             WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7937             MOZ_ENABLE_D2D_SURFACE=1
7938             MOZ_ENABLE_DWRITE_FONT=1
7939         else
7940             WIN32_DWRITE_FONT_FEATURE=
7941             WIN32_D2D_SURFACE_FEATURE=
7942         fi
7944         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
7946         dnl D3D10 Layers depend on D2D Surfaces.
7947         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
7948           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
7949         fi
7950         ;;
7951       os2)
7952         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7953         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7954         MOZ_ENABLE_CAIRO_FT=1
7955         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7956         CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7957         CAIRO_FT_LIBS=""
7958         ;;
7959     esac
7960     if test "$USE_FC_FREETYPE"; then
7961         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7962     fi
7963     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7964     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
7965     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
7966     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
7967     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
7968     AC_SUBST(CAIRO_FT_CFLAGS)
7970     AC_SUBST(PS_SURFACE_FEATURE)
7971     AC_SUBST(PDF_SURFACE_FEATURE)
7972     AC_SUBST(SVG_SURFACE_FEATURE)
7973     AC_SUBST(XLIB_SURFACE_FEATURE)
7974     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7975     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7976     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7977     AC_SUBST(WIN32_SURFACE_FEATURE)
7978     AC_SUBST(OS2_SURFACE_FEATURE)
7979     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7980     AC_SUBST(FT_FONT_FEATURE)
7981     AC_SUBST(FC_FONT_FEATURE)
7982     AC_SUBST(WIN32_FONT_FEATURE)
7983     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
7984     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
7985     AC_SUBST(QUARTZ_FONT_FEATURE)
7986     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7987     AC_SUBST(QT_SURFACE_FEATURE)
7988     AC_SUBST(TEE_SURFACE_FEATURE)
7990     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
7991     MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
7993     if test "$MOZ_X11"; then
7994         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
7995     fi
7997     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7998 else
7999     PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8000     MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8001     MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8002     PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8003     if test "$MOZ_X11"; then
8004         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8005         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8006         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8007         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8008     fi
8011 AC_SUBST(MOZ_TREE_CAIRO)
8012 AC_SUBST(MOZ_CAIRO_CFLAGS)
8013 AC_SUBST(MOZ_CAIRO_LIBS)
8014 AC_SUBST(MOZ_CAIRO_OSLIBS)
8015 AC_SUBST(MOZ_TREE_PIXMAN)
8017 dnl ========================================================
8018 dnl qcms
8019 dnl ========================================================
8021 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8022 AC_SUBST(QCMS_LIBS)
8024 dnl ========================================================
8025 dnl HarfBuzz
8026 dnl ========================================================
8027 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8028 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8030 dnl ========================================================
8031 dnl SIL Graphite
8032 dnl ========================================================
8033 if test "$MOZ_GRAPHITE"; then
8034   MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8035   AC_DEFINE(MOZ_GRAPHITE)
8036 else
8037   MOZ_GRAPHITE_LIBS=
8039 AC_SUBST(MOZ_GRAPHITE)
8040 AC_SUBST(MOZ_GRAPHITE_LIBS)
8042 dnl ========================================================
8043 dnl OTS
8044 dnl ========================================================
8045 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8046 AC_SUBST(MOZ_OTS_LIBS)
8048 dnl ========================================================
8049 dnl Skia 
8050 dnl ========================================================
8051 if test "$MOZ_ENABLE_SKIA"; then
8052   MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8053   AC_DEFINE(MOZ_ENABLE_SKIA)
8054 else
8055   MOZ_SKIA_LIBS=
8057 AC_SUBST(MOZ_ENABLE_SKIA)
8058 AC_SUBST(MOZ_SKIA_LIBS)
8060 dnl ========================================================
8061 dnl disable xul
8062 dnl ========================================================
8063 MOZ_ARG_DISABLE_BOOL(xul,
8064 [  --disable-xul           Disable XUL],
8065     MOZ_XUL= )
8066 if test "$MOZ_XUL"; then
8067   AC_DEFINE(MOZ_XUL)
8068 else
8069   dnl remove extensions that require XUL
8070   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8073 AC_SUBST(MOZ_XUL)
8075 dnl ========================================================
8076 dnl disable profile locking
8077 dnl   do no use this in applications that can have more than
8078 dnl   one process accessing the profile directory.
8079 dnl ========================================================
8080 MOZ_ARG_DISABLE_BOOL(profilelocking,
8081 [  --disable-profilelocking
8082                           Disable profile locking],
8083     MOZ_PROFILELOCKING=,
8084     MOZ_PROFILELOCKING=1 )
8085 if test "$MOZ_PROFILELOCKING"; then
8086   AC_DEFINE(MOZ_PROFILELOCKING)
8089 dnl ========================================================
8090 dnl necko configuration options
8091 dnl ========================================================
8094 dnl option to disable various necko protocols
8096 MOZ_ARG_ENABLE_STRING(necko-protocols,
8097 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8098                           Enable/disable specific protocol handlers],
8099 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8100     if test "$option" = "yes" -o "$option" = "all"; then
8101         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8102     elif test "$option" = "no" -o "$option" = "none"; then
8103         NECKO_PROTOCOLS=""
8104     elif test "$option" = "default"; then
8105         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8106     elif test `echo "$option" | grep -c \^-` != 0; then
8107         option=`echo $option | sed 's/^-//'`
8108         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8109     else
8110         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8111     fi
8112 done],
8113     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8114 dnl Remove dupes
8115 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8116 AC_SUBST(NECKO_PROTOCOLS)
8117 for p in $NECKO_PROTOCOLS; do
8118     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8119     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8120 done
8123 dnl option to disable necko's wifi scanner
8125 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8126 [  --disable-necko-wifi    Disable necko wifi scanner],
8127     NECKO_WIFI=,
8128     NECKO_WIFI=1)
8130 if test "$OS_ARCH" = "OS2"; then
8131   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8132   NECKO_WIFI=
8134 if test "$NECKO_WIFI" -a \
8135         "$OS_ARCH" != "Linux" -a \
8136         "$OS_ARCH" != "Darwin" -a \
8137         "$OS_ARCH" != "SunOS" -a \
8138         "$OS_ARCH" != "WINNT"; then
8139   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8142 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8143 then
8144   MOZ_CHECK_HEADER([iwlib.h])
8145   if test "$ac_cv_header_iwlib_h" != "yes"; then
8146     AC_MSG_ERROR([Can't find header iwlib.h for Necko WiFi scanning (might be in package libiw-dev (Ubuntu) or wireless-tools-devel (Fedora) or libiw-devel (openSUSE)); use --disable-necko-wifi to disable])
8147   fi
8150 if test "$NECKO_WIFI"; then
8151   AC_DEFINE(NECKO_WIFI)
8152   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8154 AC_SUBST(NECKO_WIFI)
8157 dnl option to disable cookies
8159 MOZ_ARG_DISABLE_BOOL(cookies,
8160 [  --disable-cookies       Disable cookie support],
8161     NECKO_COOKIES=,
8162     NECKO_COOKIES=1)
8163 AC_SUBST(NECKO_COOKIES)
8164 if test "$NECKO_COOKIES"; then
8165     AC_DEFINE(NECKO_COOKIES)
8166     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8170 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8172 MOZ_ARG_DISABLE_BOOL(ctypes,
8173 [  --disable-ctypes        Disable js-ctypes],
8174     BUILD_CTYPES=,
8175     BUILD_CTYPES=1)
8176 AC_SUBST(BUILD_CTYPES)
8177 if test "$BUILD_CTYPES"; then
8178     AC_DEFINE(BUILD_CTYPES)
8181 dnl Build Places if required
8182 if test "$MOZ_PLACES"; then
8183   AC_DEFINE(MOZ_PLACES)
8186 dnl Build Apps in the Cloud (AITC) if required
8187 AC_SUBST(MOZ_SERVICES_AITC)
8188 if test -n "$MOZ_SERVICES_AITC"; then
8189   AC_DEFINE(MOZ_SERVICES_AITC)
8192 dnl Build Notifications if required
8193 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8194 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8195   AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8198 dnl Build Sync Services if required
8199 AC_SUBST(MOZ_SERVICES_SYNC)
8200 if test -n "$MOZ_SERVICES_SYNC"; then
8201   AC_DEFINE(MOZ_SERVICES_SYNC)
8204 dnl ========================================================
8205 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8206     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8209 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8210   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8213 if test "$MOZ_APP_COMPONENT_MODULES"; then
8214   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8217 dnl ========================================================
8218 dnl =
8219 dnl = Maintainer debug option (no --enable equivalent)
8220 dnl =
8221 dnl ========================================================
8223 AC_SUBST(AR)
8224 AC_SUBST(AR_FLAGS)
8225 AC_SUBST(AR_LIST)
8226 AC_SUBST(AR_EXTRACT)
8227 AC_SUBST(AR_DELETE)
8228 AC_SUBST(AS)
8229 AC_SUBST(ASFLAGS)
8230 AC_SUBST(AS_DASH_C_FLAG)
8231 AC_SUBST(LD)
8232 AC_SUBST(RC)
8233 AC_SUBST(RCFLAGS)
8234 AC_SUBST(MC)
8235 AC_SUBST(WINDRES)
8236 AC_SUBST(IMPLIB)
8237 AC_SUBST(FILTER)
8238 AC_SUBST(BIN_FLAGS)
8239 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8240 AC_SUBST(MOZ_UPDATE_XTERM)
8241 AC_SUBST(MOZ_PLATFORM_MAEMO)
8242 AC_SUBST(MOZ_AUTH_EXTENSION)
8243 AC_SUBST(MOZ_PERMISSIONS)
8244 AC_SUBST(MOZ_XTF)
8245 AC_SUBST(MOZ_PREF_EXTENSIONS)
8246 AC_SUBST(MOZ_JS_LIBS)
8247 AC_SUBST(MOZ_PSM)
8248 AC_SUBST(MOZ_DEBUG)
8249 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8250 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8251 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8252 AC_SUBST(MOZ_DEBUG_FLAGS)
8253 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8254 AC_SUBST(WARNINGS_AS_ERRORS)
8255 AC_SUBST(MOZ_EXTENSIONS)
8256 AC_SUBST(MOZ_JSDEBUGGER)
8257 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8258 AC_SUBST(MOZ_JPROF)
8259 AC_SUBST(MOZ_SHARK)
8260 AC_SUBST(MOZ_CALLGRIND)
8261 AC_SUBST(MOZ_VTUNE)
8262 AC_SUBST(MOZ_ETW)
8263 AC_SUBST(MOZ_PROFILING)
8264 AC_SUBST(LIBICONV)
8265 AC_SUBST(MOZ_PLACES)
8266 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8267 AC_SUBST(MOZ_FEEDS)
8268 AC_SUBST(NS_PRINTING)
8269 AC_SUBST(MOZ_WEBGL)
8270 AC_SUBST(MOZ_HELP_VIEWER)
8271 AC_SUBST(TOOLCHAIN_PREFIX)
8273 AC_SUBST(JAVA)
8274 AC_SUBST(JAVAC)
8275 AC_SUBST(JAR)
8277 AC_SUBST(MOZ_PROFILELOCKING)
8279 AC_SUBST(ENABLE_TESTS)
8280 AC_SUBST(ENABLE_MARIONETTE)
8281 AC_SUBST(IBMBIDI)
8282 AC_SUBST(MOZ_UNIVERSALCHARDET)
8283 AC_SUBST(ACCESSIBILITY)
8284 AC_SUBST(MOZ_SPELLCHECK)
8285 AC_SUBST(MOZ_JAVA_COMPOSITOR)
8286 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8287 AC_SUBST(MOZ_CRASHREPORTER)
8288 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8289 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8290 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8291 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8292 AC_SUBST(MOZ_UPDATER)
8293 AC_SUBST(MOZ_ANGLE_RENDERER)
8294 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8295 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8296 AC_SUBST(MOZ_D3DX9_VERSION)
8297 AC_SUBST(MOZ_D3DX9_CAB)
8298 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8299 AC_SUBST(MOZ_D3DX9_DLL)
8300 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8301 AC_SUBST(MOZ_METRO)
8303 AC_SUBST(MOZ_ANDROID_HISTORY)
8304 AC_SUBST(MOZ_WEBSMS_BACKEND)
8305 AC_SUBST(ENABLE_STRIP)
8306 AC_SUBST(PKG_SKIP_STRIP)
8307 AC_SUBST(STRIP_FLAGS)
8308 AC_SUBST(USE_ELF_DYNSTR_GC)
8309 AC_SUBST(USE_ELF_HACK)
8310 AC_SUBST(INCREMENTAL_LINKER)
8311 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8312 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8314 AC_SUBST(MOZ_FIX_LINK_PATHS)
8315 AC_SUBST(XPCOM_LIBS)
8316 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8317 AC_SUBST(XPCOM_GLUE_LDOPTS)
8318 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8319 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8320 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8322 AC_SUBST(USE_DEPENDENT_LIBS)
8324 AC_SUBST(MOZ_BUILD_ROOT)
8325 AC_SUBST(MOZ_OS2_TOOLS)
8327 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8328 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8329 AC_SUBST(MOZ_LINKER_EXTRACT)
8330 AC_SUBST(MOZ_PER_WINDOW_PRIVATE_BROWSING)
8332 dnl ========================================================
8333 dnl = Mac bundle name prefix
8334 dnl ========================================================
8335 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8336 [  --with-macbundlename-prefix=prefix
8337                           Prefix for MOZ_MACBUNDLE_NAME],
8338 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8340 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8341 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8342   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8345 if test "$MOZ_DEBUG"; then
8346   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8347 else
8348   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8350 AC_SUBST(MOZ_MACBUNDLE_NAME)
8352 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8353 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8354 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8355 if test "$MOZ_DEBUG"; then
8356   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8359 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8360 AC_SUBST(MOZ_MACBUNDLE_ID)
8362 # The following variables are available to branding and application
8363 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8364 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8365 # impacts profile location and user-visible fields.
8366 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8367 # versions of a given application (e.g. Aurora and Firefox both use
8368 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8369 # for application.ini's "Name" field, which controls profile location in
8370 # the absence of a "Profile" field (see below), and various system
8371 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8372 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8373 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8374 # builds (e.g. Aurora for Firefox).
8375 # - MOZ_APP_VERSION: Defines the application version number.
8376 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8377 # defaults to a lowercase form of MOZ_APP_BASENAME.
8378 # - MOZ_APP_PROFILE: When set, used for application.ini's
8379 # "Profile" field, which controls profile location.
8380 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8381 # crash reporter server url.
8382 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8383 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8385 if test -z "$MOZ_APP_NAME"; then
8386    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8389 # For extensions and langpacks, we require a max version that is compatible
8390 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8391 # 10.0a1 and 10.0a2 aren't affected
8392 # 10.0 becomes 10.0.*
8393 # 10.0.1 becomes 10.0.*
8394 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8395 if test -z "$IS_ALPHA"; then
8396   changequote(,)
8397   MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8398   changequote([,])
8399 else
8400   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8403 AC_SUBST(MOZ_APP_NAME)
8404 AC_SUBST(MOZ_APP_DISPLAYNAME)
8405 AC_SUBST(MOZ_APP_BASENAME)
8406 AC_SUBST(MOZ_APP_VENDOR)
8407 AC_SUBST(MOZ_APP_PROFILE)
8408 AC_SUBST(MOZ_APP_ID)
8409 AC_SUBST(MAR_CHANNEL_ID)
8410 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8411 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8412 AC_SUBST(MOZ_EXTENSION_MANAGER)
8413 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8414 AC_SUBST(MOZ_APP_UA_NAME)
8415 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8416 AC_SUBST(MOZ_APP_VERSION)
8417 AC_SUBST(MOZ_APP_MAXVERSION)
8418 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8419 AC_SUBST(FIREFOX_VERSION)
8420 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8421 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8422   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8425 # We can't use the static application.ini data when building against
8426 # a libxul SDK.
8427 if test -n "$LIBXUL_SDK"; then
8428     MOZ_APP_STATIC_INI=
8430 AC_SUBST(MOZ_APP_STATIC_INI)
8432 AC_SUBST(MOZ_PKG_SPECIAL)
8434 AC_SUBST(MOZILLA_OFFICIAL)
8436 if test "$MOZ_TELEMETRY_REPORTING"; then
8437     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8440 dnl win32 options
8441 AC_SUBST(MOZ_MAPINFO)
8442 AC_SUBST(MOZ_BROWSE_INFO)
8443 AC_SUBST(MOZ_TOOLS_DIR)
8444 AC_SUBST(WIN32_REDIST_DIR)
8445 AC_SUBST(MAKENSISU)
8447 dnl Echo the CFLAGS to remove extra whitespace.
8448 CFLAGS=`echo \
8449         $_WARNINGS_CFLAGS \
8450         $CFLAGS`
8452 CXXFLAGS=`echo \
8453         $_WARNINGS_CXXFLAGS \
8454         $CXXFLAGS`
8456 COMPILE_CFLAGS=`echo \
8457     $_DEFINES_CFLAGS \
8458         $_DEPEND_CFLAGS \
8459     $COMPILE_CFLAGS`
8461 COMPILE_CXXFLAGS=`echo \
8462     $_DEFINES_CXXFLAGS \
8463         $_DEPEND_CFLAGS \
8464     $COMPILE_CXXFLAGS`
8466 AC_SUBST(MOZ_NATIVE_MAKEDEPEND)
8467 AC_SUBST(SYSTEM_LIBXUL)
8468 AC_SUBST(MOZ_NATIVE_JPEG)
8469 AC_SUBST(MOZ_NATIVE_PNG)
8470 AC_SUBST(MOZ_NATIVE_BZ2)
8472 AC_SUBST(MOZ_FLEXBOX)
8473 AC_SUBST(MOZ_JPEG_CFLAGS)
8474 AC_SUBST(MOZ_JPEG_LIBS)
8475 AC_SUBST(MOZ_BZ2_CFLAGS)
8476 AC_SUBST(MOZ_BZ2_LIBS)
8477 AC_SUBST(MOZ_PNG_CFLAGS)
8478 AC_SUBST(MOZ_PNG_LIBS)
8480 AC_SUBST(NSPR_CFLAGS)
8481 AC_SUBST(NSPR_LIBS)
8482 AC_SUBST(MOZ_NATIVE_NSPR)
8484 AC_SUBST(NSS_CFLAGS)
8485 AC_SUBST(NSS_LIBS)
8486 AC_SUBST(NSS_DEP_LIBS)
8487 AC_SUBST(MOZ_NATIVE_NSS)
8488 AC_SUBST(NSS_DISABLE_DBM)
8490 OS_CFLAGS="$CFLAGS"
8491 OS_CXXFLAGS="$CXXFLAGS"
8492 OS_CPPFLAGS="$CPPFLAGS"
8493 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8494 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8495 OS_LDFLAGS="$LDFLAGS"
8496 OS_LIBS="$LIBS"
8497 AC_SUBST(OS_CFLAGS)
8498 AC_SUBST(OS_CXXFLAGS)
8499 AC_SUBST(OS_CPPFLAGS)
8500 AC_SUBST(OS_COMPILE_CFLAGS)
8501 AC_SUBST(OS_COMPILE_CXXFLAGS)
8502 AC_SUBST(OS_LDFLAGS)
8503 AC_SUBST(OS_LIBS)
8504 AC_SUBST(CROSS_COMPILE)
8505 AC_SUBST(WCHAR_CFLAGS)
8507 AC_SUBST(HOST_CC)
8508 AC_SUBST(HOST_CXX)
8509 AC_SUBST(HOST_CFLAGS)
8510 AC_SUBST(HOST_CXXFLAGS)
8511 AC_SUBST(HOST_LDFLAGS)
8512 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8513 AC_SUBST(HOST_AR)
8514 AC_SUBST(HOST_AR_FLAGS)
8515 AC_SUBST(HOST_LD)
8516 AC_SUBST(HOST_RANLIB)
8517 AC_SUBST(HOST_NSPR_MDCPUCFG)
8518 AC_SUBST(HOST_BIN_SUFFIX)
8519 AC_SUBST(HOST_OS_ARCH)
8521 AC_SUBST(TARGET_CPU)
8522 AC_SUBST(TARGET_VENDOR)
8523 AC_SUBST(TARGET_OS)
8524 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8525 AC_SUBST(TARGET_MD_ARCH)
8526 AC_SUBST(TARGET_XPCOM_ABI)
8527 AC_SUBST(OS_TARGET)
8528 AC_SUBST(OS_ARCH)
8529 AC_SUBST(OS_RELEASE)
8530 AC_SUBST(OS_TEST)
8531 AC_SUBST(CPU_ARCH)
8532 AC_SUBST(INTEL_ARCHITECTURE)
8534 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8536 AC_SUBST(WRAP_LDFLAGS)
8537 AC_SUBST(MKSHLIB)
8538 AC_SUBST(MKCSHLIB)
8539 AC_SUBST(MKSHLIB_FORCE_ALL)
8540 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8541 AC_SUBST(DSO_CFLAGS)
8542 AC_SUBST(DSO_PIC_CFLAGS)
8543 AC_SUBST(DSO_LDOPTS)
8544 AC_SUBST(LIB_PREFIX)
8545 AC_SUBST(DLL_PREFIX)
8546 AC_SUBST(DLL_SUFFIX)
8547 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8548 AC_SUBST(LIB_SUFFIX)
8549 AC_SUBST(OBJ_SUFFIX)
8550 AC_SUBST(BIN_SUFFIX)
8551 AC_SUBST(ASM_SUFFIX)
8552 AC_SUBST(IMPORT_LIB_SUFFIX)
8553 AC_SUBST(USE_N32)
8554 AC_SUBST(CC_VERSION)
8555 AC_SUBST(CXX_VERSION)
8556 AC_SUBST(MSMANIFEST_TOOL)
8557 AC_SUBST(NS_ENABLE_TSF)
8558 AC_SUBST(MOZ_NSS_PATCH)
8559 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8560 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8562 AC_SUBST(MOZ_MEDIA)
8563 AC_SUBST(MOZ_SYDNEYAUDIO)
8564 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8565 AC_SUBST(MOZ_CUBEB)
8566 AC_SUBST(MOZ_WAVE)
8567 AC_SUBST(MOZ_VORBIS)
8568 AC_SUBST(MOZ_TREMOR)
8569 AC_SUBST(MOZ_OPUS)
8570 AC_SUBST(MOZ_WEBM)
8571 AC_SUBST(MOZ_MEDIA_PLUGINS)
8572 AC_SUBST(MOZ_OMX_PLUGIN)
8573 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8574 AC_SUBST(MOZ_VP8_ENCODER)
8575 AC_SUBST(MOZ_VP8)
8576 AC_SUBST(MOZ_OGG)
8577 AC_SUBST(MOZ_ALSA_LIBS)
8578 AC_SUBST(MOZ_ALSA_CFLAGS)
8579 AC_SUBST(VPX_AS)
8580 AC_SUBST(VPX_ASFLAGS)
8581 AC_SUBST(VPX_DASH_C_FLAG)
8582 AC_SUBST(VPX_AS_CONVERSION)
8583 AC_SUBST(VPX_ASM_SUFFIX)
8584 AC_SUBST(VPX_X86_ASM)
8585 AC_SUBST(VPX_ARM_ASM)
8586 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8587 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8588 AC_SUBST(LIBJPEG_TURBO_AS)
8589 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8590 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8591 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8592 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8594 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8596 AC_MSG_CHECKING([for posix_fallocate])
8597 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8598   #include <fcntl.h>],
8599                  [posix_fallocate(0, 0, 0);],
8600                  [ac_cv___posix_fallocate=true],
8601                  [ac_cv___posix_fallocate=false])
8603 if test "$ac_cv___posix_fallocate" = true ; then
8604   AC_DEFINE(HAVE_POSIX_FALLOCATE)
8605   AC_MSG_RESULT(yes)
8606 else
8607   AC_MSG_RESULT(no)
8610 dnl Check for missing components
8611 if test "$COMPILE_ENVIRONMENT"; then
8612 if test "$MOZ_X11"; then
8613     if test "$WITHOUT_X11"; then
8614         AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8615     fi
8616     dnl ====================================================
8617     dnl = Check if X headers exist
8618     dnl ====================================================
8619     _SAVE_CFLAGS=$CFLAGS
8620     CFLAGS="$CFLAGS $XCFLAGS"
8621     AC_TRY_COMPILE([
8622         #include <stdio.h>
8623         #include <stdlib.h>
8624         #include <X11/Xlib.h>
8625         #include <X11/Intrinsic.h>
8626         #include <X11/extensions/XShm.h>
8627     ],
8628     [
8629         Display *dpy = 0;
8630         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8631             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8632             exit(1);
8633         }
8634     ], [],
8635     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8636     CFLAGS="$_SAVE_CFLAGS"
8638     if test -n "$MISSING_X"; then
8639         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8640     fi
8642 fi # MOZ_X11
8644 dnl Check for headers, etc. needed by WebGL.
8645 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8646     MOZ_CHECK_HEADER(GL/glx.h)
8647     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8648         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))])
8649     fi
8650 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8651 fi # COMPILE_ENVIRONMENT
8653 dnl Set various defines and substitutions
8654 dnl ========================================================
8656 if test "$OS_ARCH" = "Darwin"; then
8657   AC_DEFINE(XP_UNIX)
8658 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8659   AC_DEFINE(XP_UNIX)
8662 if test "$MOZ_DEBUG"; then
8663     AC_DEFINE(MOZ_REFLOW_PERF)
8664     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8667 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8668     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8669     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8670     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8671     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8672     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8673     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8674     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8675     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8678 AC_SUBST(MOZILLA_VERSION)
8680 AC_SUBST(ac_configure_args)
8682 dnl Spit out some output
8683 dnl ========================================================
8685 dnl The following defines are used by xpcom
8686 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8687 CPP_THROW_NEW
8688 HAVE_CPP_2BYTE_WCHAR_T
8689 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8690 HAVE_CPP_CHAR16_T
8691 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8692 HAVE_CPP_PARTIAL_SPECIALIZATION
8693 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8694 HAVE_STATVFS
8695 HAVE_STATVFS64
8696 NEED_CPP_UNUSED_IMPLEMENTATIONS
8697 NEW_H
8698 HAVE_GETPAGESIZE
8699 HAVE_ICONV
8700 HAVE_ICONV_WITH_CONST_INPUT
8701 HAVE_MBRTOWC
8702 HAVE_SYS_MOUNT_H
8703 HAVE_SYS_VFS_H
8704 HAVE_WCRTOMB
8707 AC_CONFIG_HEADER(
8708 netwerk/necko-config.h
8709 xpcom/xpcom-config.h
8710 xpcom/xpcom-private.h
8713 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8714 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8715 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8716 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8717 # (apparently) only need this hack when egrep's "pattern" is particularly long
8718 # (as in the following code) and the first egrep on our $PATH is Apple's.  See
8719 # bug 655339.
8720 case "$host" in
8721 *-apple-darwin11*)
8722     FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8723     ;;
8725     FIXED_EGREP="egrep"
8726     ;;
8727 esac
8729 dnl Create a virtualenv where we can install local Python packages
8730 AC_MSG_RESULT([Creating Python virtualenv])
8731 rm -rf _virtualenv
8732 mkdir -p _virtualenv
8733 MACOSX_DEPLOYMENT_TARGET= PYTHONDONTWRITEBYTECODE= $PYTHON $_topsrcdir/python/virtualenv/virtualenv.py --system-site-packages ./_virtualenv
8734 case "$host_os" in
8735 mingw*)
8736     PYTHON=$MOZ_BUILD_ROOT/_virtualenv/Scripts/python.exe
8737     ;;
8739     PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python
8740     ;;
8741 esac
8743 AC_SUBST(PYTHON)
8745 # Populate the virtualenv
8746 AC_MSG_RESULT([Populating Python virtualenv])
8747 MACOSX_DEPLOYMENT_TARGET= LDFLAGS="${HOST_LDFLAGS}" \
8748   CC="${HOST_CC}" CXX="${HOST_CXX}" \
8749   CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" \
8750   $PYTHON $_topsrcdir/build/virtualenv/populate_virtualenv.py \
8751     $_topsrcdir $_topsrcdir/build/virtualenv/packages.txt \
8752   || exit 1
8754 dnl Load the list of Makefiles to generate.
8755 dnl   To add new Makefiles, edit allmakefiles.sh.
8756 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8757 . ${srcdir}/allmakefiles.sh
8759 echo $MAKEFILES > unallmakefiles
8761 AC_OUTPUT($MAKEFILES)
8763 # Generate Makefiles for WebRTC directly from .gyp files
8764 if test "${OS_TARGET}" = "WINNT"; then
8765    if test "$HAVE_64BIT_OS"; then
8766       OS_BITS=64
8767    else
8768       OS_BITS=32
8769    fi
8770    EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
8773 if test -n "$MOZ_WEBRTC"; then
8774    AC_MSG_RESULT("generating WebRTC Makefiles...")
8776    GYP_WEBRTC_OPTIONS="--format=mozmake -D build_with_mozilla=1 -D enable_protobuf=0 -D include_internal_video_render=0 ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
8778    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8779      $GYP_WEBRTC_OPTIONS \
8780      --generator-output=${_objdir}/media/webrtc/trunk \
8781      ${srcdir}/media/webrtc/trunk/peerconnection.gyp
8782    if test "$?" != 0; then
8783       AC_MSG_ERROR([failed to generate WebRTC Makefiles])
8784    fi
8786    # XXX disable until we land the tranche with signaling
8787    if test -n "$MOZ_WEBRTC_SIGNALING"; then
8788      AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
8789      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8790        $GYP_WEBRTC_OPTIONS \
8791        --generator-output=${_objdir}/media/webrtc/signaling \
8792        ${srcdir}/media/webrtc/signaling/signaling.gyp
8793      if test "$?" != 0; then
8794         AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
8795      fi
8796    fi
8798    AC_MSG_RESULT("generating gtest Makefiles...")
8799    # Ok to pass some extra -D's that are ignored here
8800    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8801      $GYP_WEBRTC_OPTIONS \
8802      --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
8803      ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
8804    if test "$?" != 0; then
8805       AC_MSG_ERROR([failed to generate gtest Makefiles])
8806    fi
8809 # Generate a JSON config file for unittest harnesses etc to read
8810 # build configuration details from in a standardized way.
8811 OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
8812 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
8813   $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
8814 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
8815   rm ./mozinfo.json.tmp
8816 else
8817   mv -f ./mozinfo.json.tmp ./mozinfo.json
8820 # Run jemalloc configure script
8822 if test "$MOZ_JEMALLOC" -a "$MOZ_MEMORY"; then
8823   ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
8824   if test "$OS_ARCH" = "Linux"; then
8825     MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
8826     MANGLED=
8827     JEMALLOC_WRAPPER=
8828     if test -n "$_WRAP_MALLOC"; then
8829       JEMALLOC_WRAPPER=__wrap_
8830     fi
8831     for mangle in ${MANGLE}; do
8832       if test -n "$MANGLED"; then
8833         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
8834       else
8835         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
8836       fi
8837     done
8838     ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
8839   fi
8840   unset CONFIG_FILES
8841   if test -z "$MOZ_TLS"; then
8842     ac_configure_args="$ac_configure_args --disable-tls"
8843   fi
8844   EXTRA_CFLAGS="$CFLAGS"
8845   for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
8846     ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
8847   done
8848   if test "$CROSS_COMPILE"; then
8849     ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
8850   fi
8851   _save_cache_file="$cache_file"
8852   cache_file=$_objdir/memory/jemalloc/src/config.cache
8853   AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
8854   cache_file="$_save_cache_file"
8855   ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8858 dnl Build libunwind for Android profiling builds
8859 if test "$OS_TARGET" = "Android" -a "$MOZ_PROFILING"; then
8860   old_ac_configure_arg="$ac_configure_args"
8861   ac_configure_args="--build=${build} --host=${target_alias} --disable-shared --enable-block-signals=no"
8862   if test "$MOZ_DEBUG"; then
8863     ac_configure_args="$ac_configure_args --enable-debug"
8864   fi
8865   if test "$DSO_PIC_CFLAGS"; then
8866     ac_configure_args="$ac_configure_args --with-pic"
8867   fi
8868   ac_configure_args="$ac_configure_args \
8869       CC=\"$CC\" \
8870       CXX=\"$CXX\" \
8871       CPP=\"$CPP\" \
8872       CFLAGS=\"$CFLAGS\" \
8873       CXXFLAGS=\"$CXXFLAGS\" \
8874       CPPFLAGS=\"$CPPFLAGS\" \
8875       LD=\"$LD\" \
8876       LDFLAGS=\"$LDFLAGS\" \
8877       AR=\"$AR\" \
8878       RANLIB=\"$RANLIB\" \
8879       STRIP=\"$STRIP\" \
8880       LIBS=\"$LIBS\""
8882   # Use a separate cache file for libunwind, since it does not use caching.
8883   mkdir -p $_objdir/tools/profiler/libunwind/src
8884   old_cache_file=$cache_file
8885   cache_file=$_objdir/tools/profiler/libunwind/src/config.cache
8886   old_config_files=$CONFIG_FILES
8887   unset CONFIG_FILES
8888   AC_OUTPUT_SUBDIRS(tools/profiler/libunwind/src)
8889   cache_file=$old_cache_file
8890   ac_configure_args="$old_ac_configure_args"
8891   CONFIG_FILES=$old_config_files
8894 # Run freetype configure script
8896 if test "$MOZ_TREE_FREETYPE"; then
8897    export CFLAGS="$CFLAGS -std=c99"
8898    export CPPFLAGS="$CPPFLAGS"
8899    export CXXFLAGS="$CXXFLAGS"
8900    export LDFLAGS="$LDFLAGS"
8901    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
8902    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
8903    AC_OUTPUT_SUBDIRS(modules/freetype2)
8906 if test -z "$direct_nspr_config"; then
8907     dnl ========================================================
8908     dnl = Setup a nice relatively clean build environment for
8909     dnl = sub-configures.
8910     dnl ========================================================
8911     CC="$_SUBDIR_CC"
8912     CXX="$_SUBDIR_CXX"
8913     CFLAGS="$_SUBDIR_CFLAGS"
8914     CPPFLAGS="$_SUBDIR_CPPFLAGS"
8915     CXXFLAGS="$_SUBDIR_CXXFLAGS"
8916     LDFLAGS="$_SUBDIR_LDFLAGS"
8917     HOST_CC="$_SUBDIR_HOST_CC"
8918     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8919     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8920     RC=
8923 unset MAKEFILES
8924 unset CONFIG_FILES
8926 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8927 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8929 export WRAP_LDFLAGS
8931 if test -n "$_WRAP_MALLOC"; then
8932     # Avoid doubling wrap malloc arguments
8933     _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
8936 if test -z "$MOZ_NATIVE_NSPR"; then
8937     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8938     if test -z "$MOZ_DEBUG"; then
8939         ac_configure_args="$ac_configure_args --disable-debug"
8940     else
8941         ac_configure_args="$ac_configure_args --enable-debug"
8942     fi
8943     if test "$MOZ_OPTIMIZE" = "1"; then
8944         ac_configure_args="$ac_configure_args --enable-optimize"
8945     elif test -z "$MOZ_OPTIMIZE"; then
8946         ac_configure_args="$ac_configure_args --disable-optimize"
8947     fi
8948     if test -n "$HAVE_64BIT_OS"; then
8949         ac_configure_args="$ac_configure_args --enable-64bit"
8950     fi
8951     if test -n "$USE_ARM_KUSER"; then
8952         ac_configure_args="$ac_configure_args --with-arm-kuser"
8953     fi
8954     ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
8955     if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no ; then
8956       # dladdr is supported by the new linker, even when the system linker doesn't
8957       # support it. Trick nspr into using dladdr when it's not supported.
8958       _SAVE_CPPFLAGS="$CPPFLAGS"
8959       export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
8960     fi
8961     _SAVE_LDFLAGS="$LDFLAGS"
8962     export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
8963     AC_OUTPUT_SUBDIRS(nsprpub)
8964     LDFLAGS="$_SAVE_LDFLAGS"
8965     if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no; then
8966       unset CPPFLAGS
8967       CPPFLAGS="$_SAVE_CFLAGS"
8968     fi
8969     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8972 dnl ========================================================
8973 dnl = Setup a nice relatively clean build environment for
8974 dnl = sub-configures.
8975 dnl ========================================================
8976 CC="$_SUBDIR_CC"
8977 CXX="$_SUBDIR_CXX"
8978 CFLAGS="$_SUBDIR_CFLAGS"
8979 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8980 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8981 LDFLAGS="$_SUBDIR_LDFLAGS"
8982 HOST_CC="$_SUBDIR_HOST_CC"
8983 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8984 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8987 # Run the SpiderMonkey 'configure' script.
8988 dist=$MOZ_BUILD_ROOT/dist
8989 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8990 ac_configure_args="$ac_configure_args --enable-threadsafe"
8991 if test "$BUILD_CTYPES"; then
8992     # Build js-ctypes on the platforms we can.
8993     ac_configure_args="$ac_configure_args --enable-ctypes"
8995 if test -z "$JS_SHARED_LIBRARY" ; then
8996     ac_configure_args="$ac_configure_args --disable-shared-js"
8998 if test -z "$MOZ_NATIVE_NSPR"; then
8999     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9000     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9002 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9003 ac_configure_args="$ac_configure_args --prefix=$dist"
9004 if test "$MOZ_MEMORY"; then
9005    ac_configure_args="$ac_configure_args --enable-jemalloc"
9007 if test -n "$MOZ_GLUE_LDFLAGS"; then
9008    export MOZ_GLUE_LDFLAGS
9010 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9011    export MOZ_GLUE_PROGRAM_LDFLAGS
9013 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9014    MOZ_ZLIB_LIBS=
9016 export MOZ_NATIVE_ZLIB
9017 export MOZ_ZLIB_CFLAGS
9018 export MOZ_ZLIB_LIBS
9019 export MOZ_APP_NAME
9020 export STLPORT_CPPFLAGS
9021 export STLPORT_LDFLAGS
9022 export STLPORT_LIBS
9023 AC_OUTPUT_SUBDIRS(js/src)
9024 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9026 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR