bug 779662 - click-to-play overlay click handler too restrictive. r=jaws
[gecko.git] / configure.in
blobb4ea8729208452cf0056ba03f883e6b6f6ba0893
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.5)
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         case "${target_cpu}" in
907           i*86)
908             export MACOSX_DEPLOYMENT_TARGET=10.5
909             ;;
910           x86_64)
911             export MACOSX_DEPLOYMENT_TARGET=10.6
912             ;;
913         esac
914     fi
915     ;;
916 esac
918 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
920 dnl ========================================================
921 dnl = Mac OS X SDK support
922 dnl ========================================================
923 MACOS_SDK_DIR=
924 NEXT_ROOT=
925 MOZ_ARG_WITH_STRING(macos-sdk,
926 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
927     MACOS_SDK_DIR=$withval)
929 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
930 dnl NEXT_ROOT will be set and exported only if it's needed.
931 AC_SUBST(MACOS_SDK_DIR)
932 AC_SUBST(NEXT_ROOT)
934 if test "$MACOS_SDK_DIR"; then
935   dnl Sync this section with the ones in NSPR and NSS.
936   dnl Changes to the cross environment here need to be accounted for in
937   dnl the libIDL checks (below) and xpidl build.
939   if test ! -d "$MACOS_SDK_DIR"; then
940     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
941 specify a valid SDK.  SDKs are installed when the optional cross-development
942 tools are selected during the Xcode/Developer Tools installation.])
943   fi
945   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
946   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
947     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
948   else
949     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
950     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
952     dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
953     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
954     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
956     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
957       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
958       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
959       dnl be ignored and cause warnings when -syslibroot is specified.
960       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
961       dnl the -isysroot it receives, so this is only needed with 4.0.0.
962       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
963     fi
964   fi
966   AC_LANG_SAVE
967   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
968   AC_LANG_CPLUSPLUS
969   AC_TRY_COMPILE([#include <new>],[],
970    result=yes,
971    result=no)
972   AC_LANG_RESTORE
973   AC_MSG_RESULT($result)
975   if test "$result" = "no" ; then
976     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
977   fi
980 fi # COMPILE_ENVIRONMENT
982 AC_MSG_CHECKING([compiler version])
983 # Just print it so it shows up in the logs.
984 cc_version=$($CC --version)
985 AC_MSG_RESULT([$cc_version])
987 if test -n "$MAKE"; then
988   if test `echo $MAKE | grep -c make.py` != 1; then
989      NOT_PYMAKE=$MAKE
990   fi
993 case "$host_os" in
994 mingw*)
995     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
996     ;;
998     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
999     ;;
1000 esac
1001 if test "$GMAKE" = ":"; then
1002    AC_MSG_ERROR([GNU make not found])
1004 AC_SUBST(GMAKE)
1006 if test -z "$MAKE"; then
1007   MAKE=$GMAKE
1010 if test "$COMPILE_ENVIRONMENT"; then
1012 AC_PATH_XTRA
1014 XCFLAGS="$X_CFLAGS"
1016 fi # COMPILE_ENVIRONMENT
1018 dnl ========================================================
1019 dnl set the defaults first
1020 dnl ========================================================
1021 AS_BIN=$AS
1022 AR_LIST='$(AR) t'
1023 AR_EXTRACT='$(AR) x'
1024 AR_DELETE='$(AR) d'
1025 AS='$(CC)'
1026 AS_DASH_C_FLAG='-c'
1027 DLL_PREFIX=lib
1028 LIB_PREFIX=lib
1029 DLL_SUFFIX=.so
1030 OBJ_SUFFIX=o
1031 LIB_SUFFIX=a
1032 ASM_SUFFIX=s
1033 IMPORT_LIB_SUFFIX=
1034 TARGET_MD_ARCH=unix
1035 DIRENT_INO=d_ino
1036 MOZ_USER_DIR=".mozilla"
1038 MOZ_JPEG_CFLAGS=
1039 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
1040 MOZ_BZ2_CFLAGS=
1041 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1042 MOZ_PNG_CFLAGS=
1043 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
1045 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1046 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1047 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1048 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1049 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1050 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1051 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1052 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1054 # These are specially defined on Windows only
1055 case "$target" in
1056 *-mingw*)
1057   XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1058   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
1059   ;;
1061   XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
1062   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
1063   ;;
1064 esac
1066 MOZ_FS_LAYOUT=unix
1068 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1070 USE_DEPENDENT_LIBS=1
1072 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1074 if test -n "$CROSS_COMPILE"; then
1075     OS_TARGET="${target_os}"
1076     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1077     OS_RELEASE=
1078     case "${target_os}" in
1079         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1080         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1081         gnu*)         OS_ARCH=GNU ;;
1082         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1083         mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
1084         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1085     esac
1086     case "${target}" in
1087         *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1088     esac
1089 else
1090     OS_TARGET=`uname -s`
1091     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1092     OS_RELEASE=`uname -r`
1095 # Before this used `uname -m` when not cross compiling
1096 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1097 OS_TEST="${target_cpu}"
1099 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1101 #######################################################################
1102 # Master "Core Components" macros for getting the OS target           #
1103 #######################################################################
1106 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1107 # cross-compilation.
1111 # Define and override various archtecture-specific variables, including
1112 # HOST_OS_ARCH
1113 # OS_ARCH
1114 # OS_TEST
1115 # OS_TARGET
1116 # OS_RELEASE
1117 # OS_MINOR_RELEASE
1120 case "$HOST_OS_ARCH" in
1121 mingw*)
1122     HOST_OS_ARCH=WINNT
1123     ;;
1124 darwin*)
1125     HOST_OS_ARCH=Darwin
1126     ;;
1127 linux*)
1128     HOST_OS_ARCH=Linux
1129     ;;
1130 solaris*)
1131     HOST_OS_ARCH=SunOS
1132     SOLARIS_SUNPRO_CC=
1133     SOLARIS_SUNPRO_CXX=
1134     if test -z "$GNU_CC"; then
1135         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1136             SOLARIS_SUNPRO_CC=1
1137        fi
1138     fi
1140     if test -z "$GNU_CXX"; then
1141        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1142            SOLARIS_SUNPRO_CXX=1
1143        fi
1144     fi
1145     AC_SUBST(SOLARIS_SUNPRO_CC)
1146     AC_SUBST(SOLARIS_SUNPRO_CXX)
1147     ;;
1148 BSD_386)
1149     HOST_OS_ARCH=BSD
1150     ;;
1151 OS_2)
1152     HOST_OS_ARCH=OS2
1153     ;;
1154 esac
1156 case "$OS_ARCH" in
1157 WINNT)
1158     if test -z "$CROSS_COMPILE" ; then
1159         OS_TEST=`uname -p`
1160     fi
1161     ;;
1162 Windows_NT)
1164 # If uname -s returns "Windows_NT", we assume that we are using
1165 # the uname.exe in MKS toolkit.
1167 # The -r option of MKS uname only returns the major version number.
1168 # So we need to use its -v option to get the minor version number.
1169 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1171     OS_ARCH=WINNT
1172     OS_TARGET=WINNT
1173     OS_MINOR_RELEASE=`uname -v`
1174     if test "$OS_MINOR_RELEASE" = "00"; then
1175         OS_MINOR_RELEASE=0
1176     fi
1177     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1178     ;;
1179 MINGW*_NT*)
1181 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1182 # the uname.exe in the MSYS tools.
1184     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1185     OS_ARCH=WINNT
1186     OS_TARGET=WINNT
1187     ;;
1188 AIX)
1189     OS_RELEASE=`uname -v`.`uname -r`
1190     OS_TEST=${target_cpu}
1191     ;;
1192 BSD_386)
1193     OS_ARCH=BSD
1194     ;;
1195 OS_2)
1196     OS_ARCH=OS2
1197     OS_TARGET=OS2
1198     OS_RELEASE=`uname -v`
1199     ;;
1200 Darwin)
1201     case "${target_cpu}" in
1202     powerpc*)
1203         OS_TEST=ppc
1204         ;;
1205     i*86*)
1206         OS_TEST=i386
1207         ;;
1208     x86_64)
1209         OS_TEST=x86_64
1210         ;;
1211     *)
1212         if test -z "$CROSS_COMPILE" ; then
1213             OS_TEST=`uname -p`
1214         fi
1215         ;;
1216     esac
1217     ;;
1218 esac
1220 # Only set CPU_ARCH if we recognize the value of OS_TEST
1222 case "$OS_TEST" in
1223 *86 | i86pc)
1224     CPU_ARCH=x86
1225     ;;
1227 powerpc64 | ppc64)
1228     CPU_ARCH=ppc64
1229     ;;
1231 powerpc | ppc | rs6000)
1232     CPU_ARCH=ppc
1233     ;;
1235 Alpha | alpha | ALPHA)
1236     CPU_ARCH=Alpha
1237     ;;
1239 s390)
1240     CPU_ARCH=s390
1241     ;;
1243 s390x)
1244     CPU_ARCH=s390x
1245     ;;
1247 hppa* | parisc)
1248     CPU_ARCH=hppa
1249     ;;
1251 sun4u | sparc*)
1252     CPU_ARCH=sparc
1253     ;;
1255 x86_64 | ia64)
1256     CPU_ARCH="$OS_TEST"
1257     ;;
1259 arm*)
1260     CPU_ARCH=arm
1261     ;;
1263 mips|mipsel)
1264     CPU_ARCH="mips"
1265     ;;
1266 esac
1268 if test -z "$OS_TARGET"; then
1269     OS_TARGET=$OS_ARCH
1271 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1273 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1274 dnl ===============================================================
1275 INTEL_ARCHITECTURE=
1276 case "$OS_TEST" in
1277     x86_64|i?86)
1278       INTEL_ARCHITECTURE=1
1279 esac
1281 dnl Configure platform-specific CPU architecture compiler options.
1282 dnl ==============================================================
1283 MOZ_ARCH_OPTS
1285 dnl =================================================================
1286 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1287 dnl which is bad when cross compiling.
1288 dnl =================================================================
1289 if test "$COMPILE_ENVIRONMENT"; then
1290 configure_static_assert_macros='
1291 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1292 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1293 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1296 dnl test that the macros actually work:
1297 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1298 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1299  [AC_LANG_SAVE
1300   AC_LANG_C
1301   ac_cv_static_assertion_macros_work="yes"
1302   AC_TRY_COMPILE([$configure_static_assert_macros],
1303                  [CONFIGURE_STATIC_ASSERT(1)],
1304                  ,
1305                  ac_cv_static_assertion_macros_work="no")
1306   AC_TRY_COMPILE([$configure_static_assert_macros],
1307                  [CONFIGURE_STATIC_ASSERT(0)],
1308                  ac_cv_static_assertion_macros_work="no",
1309                  )
1310   AC_LANG_CPLUSPLUS
1311   AC_TRY_COMPILE([$configure_static_assert_macros],
1312                  [CONFIGURE_STATIC_ASSERT(1)],
1313                  ,
1314                  ac_cv_static_assertion_macros_work="no")
1315   AC_TRY_COMPILE([$configure_static_assert_macros],
1316                  [CONFIGURE_STATIC_ASSERT(0)],
1317                  ac_cv_static_assertion_macros_work="no",
1318                  )
1319   AC_LANG_RESTORE
1320  ])
1321 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1322 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1323     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1325 fi # COMPILE_ENVIRONMENT
1327 dnl ========================================================
1328 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1329 dnl computed above.
1330 dnl ========================================================
1332 MOZ_ANDROID_STLPORT
1334 dnl ========================================================
1335 dnl Suppress Clang Argument Warnings
1336 dnl ========================================================
1337 if test -n "$CLANG_CC"; then
1338     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1339     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1341 if test -n "$CLANG_CXX"; then
1342     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1345 dnl ========================================================
1346 dnl = Use Address Sanitizer
1347 dnl ========================================================
1348 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1349 [  --enable-address-sanitizer       Enable Address Sanitizer (default=no)],
1350     MOZ_ASAN=1,
1351     MOZ_ASAN= )
1352 if test -n "$MOZ_ASAN"; then
1353     MOZ_LLVM_HACKS=1
1354     AC_DEFINE(MOZ_ASAN)
1356 AC_SUBST(MOZ_ASAN)
1358 dnl ========================================================
1359 dnl = Enable hacks required for LLVM instrumentations
1360 dnl ========================================================
1361 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1362 [  --enable-llvm-hacks       Enable workarounds required for several LLVM instrumentations (default=no)],
1363     MOZ_LLVM_HACKS=1,
1364     MOZ_LLVM_HACKS= )
1365 if test -n "$MOZ_LLVM_HACKS"; then
1366     MOZ_NO_WLZDEFS=1
1367     MOZ_CFLAGS_NSS=1
1369 AC_SUBST(MOZ_NO_WLZDEFS)
1370 AC_SUBST(MOZ_CFLAGS_NSS)
1372 dnl ========================================================
1373 dnl GNU specific defaults
1374 dnl ========================================================
1375 if test "$GNU_CC"; then
1376     # FIXME: Let us build with strict aliasing. bug 414641.
1377     CFLAGS="$CFLAGS -fno-strict-aliasing"
1378     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1379     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1380     DSO_LDOPTS='-shared'
1381     if test "$GCC_USE_GNU_LD"; then
1382         # Some tools like ASan use a runtime library that is only
1383         # linked against executables, so we must allow undefined
1384         # symbols for shared objects in some cases.
1385         if test -z "$MOZ_NO_WLZDEFS"; then
1386             # Don't allow undefined symbols in libraries
1387             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1388         fi
1389     fi
1390     WARNINGS_AS_ERRORS='-Werror -Wno-error=uninitialized'
1391     DSO_CFLAGS=''
1392     DSO_PIC_CFLAGS='-fPIC'
1393     ASFLAGS="$ASFLAGS -fPIC"
1394     AC_MSG_CHECKING([for --noexecstack option to as])
1395     _SAVE_CFLAGS=$CFLAGS
1396     CFLAGS="$CFLAGS -Wa,--noexecstack"
1397     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1398                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1399                      AC_MSG_RESULT([no]))
1400     CFLAGS=$_SAVE_CFLAGS
1401     AC_MSG_CHECKING([for -z noexecstack option to ld])
1402     _SAVE_LDFLAGS=$LDFLAGS
1403     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1404     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1405                   AC_MSG_RESULT([no])
1406                   LDFLAGS=$_SAVE_LDFLAGS)
1408     # Check for -mssse3 on $CC
1409     AC_MSG_CHECKING([for -mssse3 option to $CC])
1410     HAVE_COMPILER_FLAG_MSSSE3=
1411     _SAVE_CFLAGS=$CFLAGS
1412     CFLAGS="$CFLAGS -mssse3"
1413     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1414                      [HAVE_COMPILER_FLAG_MSSSE3=1],
1415                      AC_MSG_RESULT([no]))
1416     CFLAGS=$_SAVE_CFLAGS
1417     AC_SUBST(HAVE_COMPILER_FLAG_MSSSE3)
1419     # Turn on GNU-specific warnings:
1420     # -Wall - turn on a lot of warnings
1421     # -pedantic - this is turned on below
1422     # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1423     # -Wdeclaration-after-statement - MSVC doesn't like these
1424     # -Werror=return-type - catches missing returns, zero false positives
1425     # -Wtype-limits - catches overflow bugs, few false positives
1426     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1427     #
1428     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1429     MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1430     MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1431     MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1432     
1433     # Turn off the following warnings that -Wall/-pedantic turn on:
1434     # -Wno-unused - lots of violations in third-party code
1435     # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1436     #
1437     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1438     MOZ_C_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_c_has_wno_overlength_strings)
1440     if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1441        # Don't use -Wcast-align with ICC or clang
1442        case "$CPU_ARCH" in
1443            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1444            hppa | ia64 | sparc | arm)
1445            ;;
1446            *)
1447         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1448            ;;
1449        esac
1450     fi
1452     dnl Turn pedantic on but disable the warnings for long long
1453     _PEDANTIC=1
1455     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1456     _USE_CPP_INCLUDE_FLAG=1
1458 elif test "$SOLARIS_SUNPRO_CC"; then
1459     DSO_CFLAGS=''
1460     if test "$CPU_ARCH" = "sparc"; then
1461         # for Sun Studio on Solaris/SPARC
1462         DSO_PIC_CFLAGS='-xcode=pic32'
1463     else
1464         DSO_PIC_CFLAGS='-KPIC'
1465     fi
1466     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1467 else
1468     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1469     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1471     DSO_LDOPTS='-shared'
1472     if test "$GNU_LD"; then
1473         # Don't allow undefined symbols in libraries
1474         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1475     fi
1477     DSO_CFLAGS=''
1478     DSO_PIC_CFLAGS='-KPIC'
1479     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1482 if test "$GNU_CXX"; then
1483     # FIXME: Let us build with strict aliasing. bug 414641.
1484     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1486     # Turn on GNU-specific warnings:
1487     # -Wall - turn on a lot of warnings
1488     # -pedantic - this is turned on below
1489     # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1490     # -Woverloaded-virtual - ???
1491     # -Werror=return-type - catches missing returns, zero false positives
1492     # -Wtype-limits - catches overflow bugs, few false positives
1493     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1494     #
1495     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1496     MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1497     MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1498     MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1500     # Turn off the following warnings that -Wall/-pedantic turn on:
1501     # -Wno-ctor-dtor-privacy - ???
1502     # -Wno-overlength-strings - we exceed the minimum maximum length frequently 
1503     # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1504     # -Wno-variadic-macros - ???
1505     #
1506     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-ctor-dtor-privacy"
1507     MOZ_CXX_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_cxx_has_wno_overlength_strings)
1508     MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1509     MOZ_CXX_SUPPORTS_WARNING(-Wno-, variadic-macros, ac_cxx_has_wno_variadic_macros)
1511     if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1512        # Don't use -Wcast-align with ICC or clang
1513        case "$CPU_ARCH" in
1514            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1515            hppa | ia64 | sparc | arm)
1516            ;;
1517            *)
1518         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1519            ;;
1520        esac
1521     fi
1523     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1524     _USE_CPP_INCLUDE_FLAG=1
1526     # Recent clang and gcc support C++11 deleted functions without warnings if
1527     # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1528     # versions).  We can't use -std=c++0x yet, so gcc's support must remain
1529     # unused.  But clang's warning can be disabled, so when compiling with clang
1530     # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1531     # deleted function syntax.
1532     if test "$CLANG_CXX"; then
1533         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1534         MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1535     fi
1537 else
1538     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1541 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1542 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1543 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1544 dnl normal behavior.
1545 dnl ========================================================
1546 MKSHLIB_FORCE_ALL=
1547 MKSHLIB_UNFORCE_ALL=
1549 if test "$COMPILE_ENVIRONMENT"; then
1550 if test "$GNU_CC"; then
1551   AC_MSG_CHECKING(whether ld has archive extraction flags)
1552   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1553    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1554     ac_cv_mkshlib_force_and_unforce="no"
1555     exec 3<&0 <<LOOP_INPUT
1556         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1557         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1558         force="-Wl,-all";              unforce="-Wl,-none"
1559 LOOP_INPUT
1560     while read line
1561     do
1562       eval $line
1563       LDFLAGS=$force
1564       LIBS=$unforce
1565       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1566     done
1567     exec 0<&3 3<&-
1568     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1569    ])
1570   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1571     AC_MSG_RESULT(no)
1572   else
1573     AC_MSG_RESULT(yes)
1574     eval $ac_cv_mkshlib_force_and_unforce
1575     MKSHLIB_FORCE_ALL=$force
1576     MKSHLIB_UNFORCE_ALL=$unforce
1577   fi
1578 fi # GNU_CC
1579 fi # COMPILE_ENVIRONMENT
1581 dnl ========================================================
1582 dnl Checking for 64-bit OS
1583 dnl ========================================================
1584 if test "$COMPILE_ENVIRONMENT"; then
1585 AC_LANG_SAVE
1586 AC_LANG_C
1587 AC_MSG_CHECKING(for 64-bit OS)
1588 AC_TRY_COMPILE([$configure_static_assert_macros],
1589                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1590                result="yes", result="no")
1591 AC_MSG_RESULT("$result")
1592 if test "$result" = "yes"; then
1593     AC_DEFINE(HAVE_64BIT_OS)
1594     HAVE_64BIT_OS=1
1596 AC_SUBST(HAVE_64BIT_OS)
1597 AC_LANG_RESTORE
1598 fi # COMPILE_ENVIRONMENT
1600 dnl ========================================================
1601 dnl Enable high-memory support on OS/2 by default.
1602 dnl ========================================================
1603 MOZ_OS2_HIGH_MEMORY=1
1604 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1605 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1606     MOZ_OS2_HIGH_MEMORY=,
1607     MOZ_OS2_HIGH_MEMORY=1 )
1608 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1610 dnl ========================================================
1611 dnl = Use profiling compile flags
1612 dnl ========================================================
1613 MOZ_ARG_ENABLE_BOOL(profiling,
1614 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1615     MOZ_PROFILING=1,
1616     MOZ_PROFILING= )
1618 # For profiling builds keep the symbol information
1619 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1620     STRIP_FLAGS="--strip-debug"
1623 dnl ========================================================
1624 dnl = Use Valgrind
1625 dnl ========================================================
1626 MOZ_ARG_ENABLE_BOOL(valgrind,
1627 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
1628     MOZ_VALGRIND=1,
1629     MOZ_VALGRIND= )
1630 if test -n "$MOZ_VALGRIND"; then
1631     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1632         AC_MSG_ERROR(
1633             [--enable-valgrind specified but Valgrind is not installed]))
1634     AC_DEFINE(MOZ_VALGRIND)
1636 AC_SUBST(MOZ_VALGRIND)
1638 dnl ========================================================
1639 dnl = Use DMD
1640 dnl ========================================================
1641 MOZ_ARG_ENABLE_BOOL(dmd,
1642 [  --enable-dmd            Enable DMD; also disables jemalloc (default=no)],
1643     MOZ_DMD=1,
1644     MOZ_DMD= )
1645 if test -n "$MOZ_DMD"; then
1646     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1647         AC_MSG_ERROR(
1648             [--enable-dmd specified but Valgrind is not installed]))
1649     AC_DEFINE(MOZ_DMD)
1652 dnl ========================================================
1653 dnl jprof
1654 dnl ========================================================
1655 MOZ_ARG_ENABLE_BOOL(jprof,
1656 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1657     MOZ_JPROF=1,
1658     MOZ_JPROF= )
1659 if test -n "$MOZ_JPROF"; then
1660     MOZ_PROFILING=1
1661     AC_DEFINE(MOZ_JPROF)
1664 dnl ========================================================
1665 dnl SPS Profiler
1666 dnl ========================================================
1667 MOZ_ENABLE_PROFILER_SPS=1
1669 case "${OS_TARGET}" in
1670 Android)
1671     case "${CPU_ARCH}" in
1672     x86 | arm) ;;
1673     *)
1674         MOZ_ENABLE_PROFILER_SPS=
1675     esac
1676     ;;
1677 Linux)
1678     case "${CPU_ARCH}" in
1679     x86 | x86_64) ;;
1680     *)
1681         MOZ_ENABLE_PROFILER_SPS=
1682     esac
1683     ;;
1684 WINNT|Darwin) ;;
1686     MOZ_ENABLE_PROFILER_SPS=
1687     ;;
1688 esac
1690 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1691     AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1694 dnl ========================================================
1695 dnl shark
1696 dnl ========================================================
1697 MOZ_ARG_ENABLE_BOOL(shark,
1698 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
1699     MOZ_SHARK=1,
1700     MOZ_SHARK= )
1701 if test -n "$MOZ_SHARK"; then
1702     MOZ_PROFILING=1
1703     AC_DEFINE(MOZ_SHARK)
1706 dnl ========================================================
1707 dnl callgrind
1708 dnl ========================================================
1709 MOZ_ARG_ENABLE_BOOL(callgrind,
1710 [  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
1711     MOZ_CALLGRIND=1,
1712     MOZ_CALLGRIND= )
1713 if test -n "$MOZ_CALLGRIND"; then
1714     MOZ_PROFILING=1
1715     AC_DEFINE(MOZ_CALLGRIND)
1718 dnl ========================================================
1719 dnl vtune
1720 dnl ========================================================
1721 MOZ_ARG_ENABLE_BOOL(vtune,
1722 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
1723     MOZ_VTUNE=1,
1724     MOZ_VTUNE= )
1725 if test -n "$MOZ_VTUNE"; then
1726     MOZ_PROFILING=1
1727     AC_DEFINE(MOZ_VTUNE)
1730 dnl ========================================================
1731 dnl Profiling
1732 dnl ========================================================
1733 if test -n "$MOZ_PROFILING"; then
1734     AC_DEFINE(MOZ_PROFILING)
1737 dnl ========================================================
1738 dnl System overrides of the defaults for host
1739 dnl ========================================================
1740 case "$host" in
1741 *mingw*)
1742     if test -n "$_WIN32_MSVC"; then
1743         HOST_AR=lib
1744         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1745         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1746         HOST_RANLIB='echo ranlib'
1747     else
1748         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1749     fi
1750     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1751     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1752     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1753     HOST_BIN_SUFFIX=.exe
1754     case "$host" in
1755     *mingw*)
1756         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1757         ;;
1758     esac
1760     case "${host_cpu}" in
1761     i*86)
1762         if test -n "$_WIN32_MSVC"; then
1763             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1764         fi
1765         ;;
1766     x86_64)
1767         if test -n "$_WIN32_MSVC"; then
1768             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1769         fi
1770         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1771         ;;
1772     esac
1773     ;;
1775 *-darwin*)
1776     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1777     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1778     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1779     ;;
1781 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1782     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1783     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1784     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1785     ;;
1787 *os2*)
1788     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1789     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1790     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1791     HOST_BIN_SUFFIX=.exe
1792     MOZ_FIX_LINK_PATHS=
1793     ;;
1796     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1797     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1798     ;;
1799 esac
1801 dnl We require version 2.5 or newer of Python to build.
1802 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
1803 changequote(,)
1804 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
1805 _python_res=$?
1806 changequote([,])
1807 if test "$_python_res" != 0; then
1808     AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
1810 AC_MSG_RESULT([yes])
1812 dnl Check for using a custom <stdint.h> implementation
1813 dnl ========================================================
1814 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1815 if test "$MOZ_CUSTOM_STDINT_H"; then
1816   AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1817   AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1818 else
1819   AC_MSG_RESULT(none specified)
1822 dnl Get mozilla version from central milestone file
1823 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1824 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1826 dnl Get version of various core apps from the version files.
1827 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1829 if test -z "$FIREFOX_VERSION"; then
1830     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1833 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1834 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1835 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1837 MOZ_DOING_LTO(lto_is_enabled)
1839 dnl ========================================================
1840 dnl System overrides of the defaults for target
1841 dnl ========================================================
1843 case "$target" in
1844 *-aix*)
1845     AC_DEFINE(AIX)
1846     if test ! "$GNU_CC"; then
1847         if test ! "$HAVE_64BIT_OS"; then
1848             # Compiling with Visual Age C++ object model compat is the
1849             # default. To compile with object model ibm, add
1850             # AIX_OBJMODEL=ibm to .mozconfig.
1851             if test "$AIX_OBJMODEL" = "ibm"; then
1852                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1853             else
1854                 AIX_OBJMODEL=compat
1855             fi
1856         else
1857             AIX_OBJMODEL=compat
1858         fi
1859         AC_SUBST(AIX_OBJMODEL)
1860         DSO_LDOPTS='-qmkshrobj=1'
1861         DSO_CFLAGS='-qflag=w:w'
1862         DSO_PIC_CFLAGS=
1863         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1864         MOZ_FIX_LINK_PATHS=
1865         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1866         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1867         if test "$COMPILE_ENVIRONMENT"; then
1868             AC_LANG_SAVE
1869             AC_LANG_CPLUSPLUS
1870             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1871             AC_TRY_COMPILE([],
1872                 [#if (__IBMCPP__ < 900)
1873                  #error "Bad compiler"
1874                  #endif],
1875                 _BAD_COMPILER=,_BAD_COMPILER=1)
1876             if test -n "$_BAD_COMPILER"; then
1877                 AC_MSG_RESULT([no])
1878                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1879             else
1880                 AC_MSG_RESULT([yes])
1881             fi
1882             AC_LANG_RESTORE
1883             TARGET_COMPILER_ABI="ibmc"
1884             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1885             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1886         fi
1887     fi
1888     case "${target_os}" in
1889     aix4.1*)
1890         DLL_SUFFIX='_shr.a'
1891         ;;
1892     esac
1893     if test "$COMPILE_ENVIRONMENT"; then
1894         MOZ_CHECK_HEADERS(sys/inttypes.h)
1895     fi
1896     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1897     ;;
1899 *-bsdi*)
1900     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1901     _PEDANTIC=
1902     case $OS_RELEASE in
1903         4.*|5.*)
1904             STRIP="$STRIP -d"
1905             ;;
1906         *)
1907             DSO_CFLAGS=''
1908             DSO_LDOPTS='-r'
1909             _WARNINGS_CFLAGS="-Wall"
1910             _WARNINGS_CXXFLAGS="-Wall"
1911             # The test above doesn't work properly, at least on 3.1.
1912             MKSHLIB_FORCE_ALL=''
1913             MKSHLIB_UNFORCE_ALL=''
1914         ;;
1915     esac
1916     ;;
1918 *-darwin*)
1919     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1920     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1921     MOZ_OPTIMIZE_FLAGS="-O3"
1922     _PEDANTIC=
1923     # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
1924     if test "$HAVE_64BIT_OS"; then
1925         MOZ_MEMORY=1
1926     fi
1927     DLL_SUFFIX=".dylib"
1928     DSO_LDOPTS=''
1929     STRIP="$STRIP -x -S"
1930     # Check whether we're targeting OS X or iOS
1931     AC_CACHE_CHECK(for iOS target,
1932                    ac_cv_ios_target,
1933                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
1934 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1935 #error not iOS
1936 #endif],
1937                                    [],
1938                                    ac_cv_ios_target="yes",
1939                                    ac_cv_ios_target="no")])
1940     if test "$ac_cv_ios_target" = "yes"; then
1941         AC_DEFINE(XP_IOS)
1942         AC_DEFINE(XP_DARWIN)
1943         _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1944     else
1945         AC_DEFINE(XP_MACOSX)
1946         AC_DEFINE(XP_DARWIN)
1947         _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1948         # The ExceptionHandling framework is needed for Objective-C exception
1949         # logging code in nsObjCExceptions.h. Currently we only use that in debug
1950         # builds.
1951         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1952     fi
1953     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1956     if test "x$lto_is_enabled" = "xyes"; then
1957         echo "Skipping -dead_strip because lto is enabled."
1958     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1959     dnl ===================================================================
1960     elif test "x$enable_dtrace" = "xyes"; then
1961         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1962     else
1963         dnl check for the presence of the -dead_strip linker flag
1964         AC_MSG_CHECKING([for -dead_strip option to ld])
1965         _SAVE_LDFLAGS=$LDFLAGS
1966         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1967         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1968         if test -n "$_HAVE_DEAD_STRIP" ; then
1969             AC_MSG_RESULT([yes])
1970             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1971         else
1972             AC_MSG_RESULT([no])
1973         fi
1975         LDFLAGS=$_SAVE_LDFLAGS
1976     fi
1978     dnl With newer linkers we need to pass -allow_heap_execute because of
1979     dnl Microsoft Silverlight (5.1.10411.0 at least).
1980     AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1981     _SAVE_LDFLAGS=$LDFLAGS
1982     LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1983     AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1984                 _HAVE_ALLOW_HEAP_EXECUTE=)
1985     if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1986         AC_MSG_RESULT([yes])
1987         MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1988     else
1989         AC_MSG_RESULT([no])
1990     fi
1991     LDFLAGS=$_SAVE_LDFLAGS
1993     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1994     ;;
1996 ia64*-hpux*)
1997     DLL_SUFFIX=".so"
1998     if test ! "$GNU_CC"; then
1999        DSO_LDOPTS='-b'
2000        DSO_CFLAGS=""
2001        DSO_PIC_CFLAGS=
2002        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2003        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2004        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2005     else
2006        DSO_LDOPTS='-b -E'
2007        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2008        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2009     fi
2010     MOZ_FIX_LINK_PATHS=
2011     MOZ_NATIVE_MAKEDEPEND=
2012     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2013     AC_DEFINE(_LARGEFILE64_SOURCE)
2014     ;;
2016 *-hpux*)
2017     DLL_SUFFIX=".sl"
2018     if test ! "$GNU_CC"; then
2019         DSO_LDOPTS='-b -Wl,+s'
2020         DSO_CFLAGS=""
2021         DSO_PIC_CFLAGS="+Z"
2022         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2023         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2024         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2025     else
2026         DSO_LDOPTS='-b -E +s'
2027         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2028         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2029     fi
2030     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2031     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2032     ;;
2034 *-android*|*-linuxandroid*)
2035     AC_DEFINE(NO_PW_GECOS)
2036     no_x=yes
2037     if test -n "$gonkdir"; then
2038         _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2039         MOZ_B2G_RIL=1
2040         MOZ_B2G_BT=1
2041     else
2042         _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2043         MOZ_LINKER=1
2044     fi
2045     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2047     MOZ_GFX_OPTIMIZE_MOBILE=1
2048     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2049     ;;
2051 *-*linux*)
2052     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2053     # Similarly for GNU_CXX and INTEL_CXX.
2054     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2055         # -Os has been broken on Intel's C/C++ compilers for quite a
2056         # while; Intel recommends against using it.
2057         MOZ_OPTIMIZE_FLAGS="-O2"
2058         MOZ_DEBUG_FLAGS="-g"
2059     elif test "$GNU_CC" -o "$GNU_CXX"; then
2060         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2061         case $GCC_VERSION in
2062         4.1.*|4.2.*|4.5.*)
2063             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2064             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2065         esac
2066         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2067         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2068         MOZ_DEBUG_FLAGS="-g"
2069     fi
2071     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2073     MOZ_MEMORY=1
2075     case "${target_cpu}" in
2076     alpha*)
2077         CFLAGS="$CFLAGS -mieee"
2078         CXXFLAGS="$CXXFLAGS -mieee"
2079     ;;
2080     i*86)
2081         USE_ELF_DYNSTR_GC=1
2082     ;;
2083     mips*)
2084         MOZ_DEBUG_FLAGS="-g" # We want inlining
2085     ;;
2086     esac
2088     if test -z "$MC"; then
2089         MC=mc.exe
2090     fi
2091     ;;
2092 *-mingw*)
2093     DSO_CFLAGS=
2094     DSO_PIC_CFLAGS=
2095     DLL_SUFFIX=.dll
2096     RC=rc.exe
2097     MC=mc.exe
2098     # certain versions of cygwin's makedepend barf on the
2099     # #include <string> vs -I./dist/include/string issue so don't use it
2100     MOZ_NATIVE_MAKEDEPEND=
2101     if test -n "$GNU_CC"; then
2102         CC="$CC -mwindows"
2103         CXX="$CXX -mwindows"
2104         CPP="$CPP -mwindows"
2105         CFLAGS="$CFLAGS -mms-bitfields"
2106         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2107         DSO_LDOPTS='-shared'
2108         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2109         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2110         RC='$(WINDRES)'
2111         # Use temp file for windres (bug 213281)
2112         RCFLAGS='-O coff --use-temp-file'
2113         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2114         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv"
2115         MOZ_FIX_LINK_PATHS=
2116         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2117         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2118         DLL_PREFIX=
2119         IMPORT_LIB_SUFFIX=dll.a
2120         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2121     else
2122         TARGET_COMPILER_ABI=msvc
2123         HOST_CC='$(CC)'
2124         HOST_CXX='$(CXX)'
2125         HOST_LD='$(LD)'
2126         if test "$AS_BIN"; then
2127             AS="$(basename "$AS_BIN")"
2128         fi
2129         AR='lib'
2130         AR_FLAGS='-NOLOGO -OUT:"$@"'
2131         AR_EXTRACT=
2132         RANLIB='echo not_ranlib'
2133         STRIP='echo not_strip'
2134         PKG_SKIP_STRIP=1
2135         XARGS=xargs
2136         ZIP=zip
2137         UNZIP=unzip
2138         DOXYGEN=:
2139         ASM_SUFFIX=asm
2140         OBJ_SUFFIX=obj
2141         LIB_SUFFIX=lib
2142         DLL_PREFIX=
2143         LIB_PREFIX=
2144         IMPORT_LIB_SUFFIX=lib
2145         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2146         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2147         MKSHLIB_FORCE_ALL=
2148         MKSHLIB_UNFORCE_ALL=
2149         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2150         _USE_CPP_INCLUDE_FLAG=1
2151         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2152         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2153         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2154         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2155         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2156         # make 'foo == bar;' error out
2157         CFLAGS="$CFLAGS -we4553"
2158         CXXFLAGS="$CXXFLAGS -we4553"
2159         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2160         MOZ_DEBUG_FLAGS='-Zi'
2161         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2162         WARNINGS_AS_ERRORS='-WX'
2163         MOZ_OPTIMIZE_FLAGS='-O1'
2164         MOZ_FIX_LINK_PATHS=
2165         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2166         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2167         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2168         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2169         if test $_MSC_VER -ge 1400; then
2170             LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2171             dnl For profile-guided optimization
2172             PROFILE_GEN_CFLAGS="-GL"
2173             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2174             dnl XXX: PGO builds can fail with warnings treated as errors,
2175             dnl specifically "no profile data available" appears to be
2176             dnl treated as an error sometimes. This might be a consequence
2177             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2178             dnl with the linker doing most of the work in the whole-program
2179             dnl optimization/PGO case. I think it's probably a compiler bug,
2180             dnl but we work around it here.
2181             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2182             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2183             dnl Probably also a compiler bug, but what can you do?
2184             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2185             LDFLAGS="$LDFLAGS -DYNAMICBASE"
2186         fi
2187     fi
2188     AC_DEFINE(HAVE_SNPRINTF)
2189     AC_DEFINE(_WINDOWS)
2190     AC_DEFINE(WIN32)
2191     AC_DEFINE(XP_WIN)
2192     AC_DEFINE(XP_WIN32)
2193     AC_DEFINE(HW_THREADS)
2194     AC_DEFINE(STDC_HEADERS)
2195     AC_DEFINE(NEW_H, <new>)
2196     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2197     TARGET_MD_ARCH=win32
2198     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2199     BIN_SUFFIX='.exe'
2200     MOZ_USER_DIR="Mozilla"
2202     dnl Hardcode to win95 for now - cls
2203     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2205     dnl set NO_X11 defines here as the general check is skipped on win32
2206     no_x=yes
2207     AC_DEFINE(NO_X11)
2209     case "$host" in
2210     *-mingw*)
2211         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2212         L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2213         ;;
2214     esac
2216     case "$host" in
2217     *-mingw*)
2218         if test -z "$MOZ_TOOLS"; then
2219             AC_MSG_ERROR([MOZ_TOOLS is not set])
2220         fi
2221         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2222         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2223             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2224         fi
2225         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2226         if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2227             AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2228         fi
2229         ;;
2230     esac
2232     case "$host_os" in
2233     cygwin*|msvc*|mks*)
2234         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.])
2235         ;;
2236     esac
2238     case "$target" in
2239     i*86-*)
2240         if test "$HAVE_64BIT_OS"; then
2241             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2242         fi
2244         if test $_MSC_VER -ge 1400; then
2245             LDFLAGS="$LDFLAGS -SAFESEH"
2246         fi
2248         if test -n "$GNU_CC"; then
2249             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2250             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2251         else
2252             AC_DEFINE(HAVE_STDCALL)
2253             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2254         fi
2256         MOZ_CHECK_HEADERS(mmintrin.h)
2257         AC_DEFINE(_X86_)
2258         ;;
2259     x86_64-*)
2260         if test -n "$_WIN32_MSVC"; then
2261             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2262         fi
2263         AC_DEFINE(_AMD64_)
2264         ;;
2265     *)
2266         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2267         ;;
2268     esac
2270     if test "$HAVE_64BIT_OS"; then
2271         AC_DEFINE(_WIN64)
2272     fi
2273     ;;
2275 *-netbsd*)
2276     DSO_CFLAGS=''
2277     CFLAGS="$CFLAGS -Dunix"
2278     CXXFLAGS="$CXXFLAGS -Dunix"
2279     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2280         DLL_SUFFIX=".so"
2281         DSO_PIC_CFLAGS='-fPIC -DPIC'
2282         DSO_LDOPTS='-shared'
2283         BIN_FLAGS='-Wl,--export-dynamic'
2284     else
2285         DSO_PIC_CFLAGS='-fPIC -DPIC'
2286         DLL_SUFFIX=".so.1.0"
2287         DSO_LDOPTS='-shared'
2288     fi
2289     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2290     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2291     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2292     if test "$LIBRUNPATH"; then
2293         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2294     fi
2295     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2296     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2297     ;;
2299 *-openbsd*)
2300     if test "$SO_VERSION"; then
2301         DLL_SUFFIX=".so.$SO_VERSION"
2302     else
2303         DLL_SUFFIX=".so.1.0"
2304     fi
2305     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2306     DSO_CFLAGS=''
2307     DSO_PIC_CFLAGS='-fPIC'
2308     DSO_LDOPTS='-shared -fPIC'
2309     if test "$LIBRUNPATH"; then
2310         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2311     fi
2312     ;;
2314 *-os2*)
2315     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2316     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2317     AC_DEFINE(OS2)
2318     AC_DEFINE(XP_OS2)
2319     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2320     AC_DEFINE(TCPV40HDRS)
2321     DLL_PREFIX=
2322     LIB_PREFIX=
2323     LIB_SUFFIX=lib
2324     BIN_SUFFIX=".exe"
2325     DLL_SUFFIX=".dll"
2326     IMPORT_LIB_SUFFIX=lib
2327     DSO_PIC_CFLAGS=
2328     AR=emxomfar
2329     AR_FLAGS='r $@'
2330     CFLAGS="$CFLAGS -Zomf"
2331     CXXFLAGS="$CXXFLAGS -Zomf"
2332     DSO_LDOPTS='-Zdll'
2333     BIN_FLAGS='-Zlinker /ST:0x100000'
2334     IMPLIB='emximp -o'
2335     FILTER='true'
2336     LDFLAGS='-Zmap'
2337     WARNINGS_AS_ERRORS='-Werror'
2338     MOZ_DEBUG_FLAGS="-g -fno-inline"
2339     MOZ_OPTIMIZE_FLAGS="-O2"
2340     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2341     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2342     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2343     TARGET_MD_ARCH=os2
2344     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2345     RC=rc.exe
2346     MC=mc.exe
2347     RCFLAGS='-n'
2348     MOZ_USER_DIR="Mozilla"
2349     ZIP="$ZIP -X"
2351     if test "$MOZTOOLS"; then
2352         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2353     else
2354         AC_MSG_ERROR([MOZTOOLS is not set])
2355     fi
2356     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2357         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2358         LDFLAGS="$LDFLAGS -Zhigh-mem"
2359         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2360         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2361     fi
2363     # GCC for OS/2 currently predefines these, but we don't want them
2364     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2365     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2367     AC_CACHE_CHECK(for __declspec(dllexport),
2368         ac_os2_declspec,
2369         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2370                         [return 0;],
2371                         ac_os2_declspec="yes",
2372                         ac_os2_declspec="no")])
2373     if test "$ac_os2_declspec" != "yes"; then
2374         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2375     fi
2376     ;;
2378 *-solaris*)
2379     AC_DEFINE(SOLARIS)
2380     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2381     MOZ_NATIVE_MAKEDEPEND=
2382     MOZ_FIX_LINK_PATHS=
2383     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2384     # libraries one level up (e.g. libnspr4.so)
2385     if test "$SOLARIS_SUNPRO_CC"; then
2386        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2387        LIBS="-lCrun -lCstd -lc $LIBS"
2388        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2389        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2390        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2391        LDFLAGS="-xildoff $LDFLAGS"
2392        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2393            _SAVE_LDFLAGS=$LDFLAGS
2394            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2395            AC_TRY_LINK([#include <stdio.h>],
2396                        [printf("Hello World\n");],
2397                        ,
2398                        [LDFLAGS=$_SAVE_LDFLAGS])
2399        fi
2400        MOZ_OPTIMIZE_FLAGS="-xO4"
2401        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2402        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2403        MKSHLIB_FORCE_ALL='-z allextract'
2404        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2405        DSO_LDOPTS='-G'
2406        AR_LIST="$AR t"
2407        AR_EXTRACT="$AR x"
2408        AR_DELETE="$AR d"
2409        AR='$(CXX) -xar'
2410        AR_FLAGS='-o $@'
2411        AS='/usr/ccs/bin/as'
2412        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2413        AS_DASH_C_FLAG=''
2414        TARGET_COMPILER_ABI="sunc"
2415        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2416        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2417        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2418        AC_LANG_SAVE
2419        AC_LANG_CPLUSPLUS
2420        AC_TRY_COMPILE([],
2421            [#if (__SUNPRO_CC < 0x590)
2422            #error "Denied"
2423            #endif],
2424            _BAD_COMPILER=,_BAD_COMPILER=1)
2425        if test -n "$_BAD_COMPILER"; then
2426            _res="no"
2427            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2428        else
2429            _res="yes"
2430        fi
2431        AC_TRY_COMPILE([],
2432            [#if (__SUNPRO_CC >= 0x5100)
2433            #error "Sun C++ 5.10 or above"
2434            #endif],
2435            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2436        if test "$_ABOVE_SS12U1"; then
2437            # disable xannotate
2438            CXXFLAGS="$CXXFLAGS -xannotate=no"
2439        fi
2440        AC_MSG_RESULT([$_res])
2441        AC_LANG_RESTORE
2442     else
2443        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2444        LIBS="-lc $LIBS"
2445        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2446        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2447        ASFLAGS="$ASFLAGS -fPIC"
2448        DSO_LDOPTS='-shared'
2449        WARNINGS_AS_ERRORS='-Werror'
2450        _WARNINGS_CFLAGS=''
2451        _WARNINGS_CXXFLAGS=''
2452        if test "$OS_RELEASE" = "5.3"; then
2453            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2454        fi
2455     fi
2456     if test "$OS_RELEASE" = "5.5.1"; then
2457         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2458     fi
2459     ;;
2461 *-sunos*)
2462     DSO_LDOPTS='-Bdynamic'
2463     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2464     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2465     AC_DEFINE(SUNOS4)
2466     AC_DEFINE(SPRINTF_RETURNS_STRING)
2467     case "$(target_os)" in
2468     sunos4.1*)
2469         DLL_SUFFIX='.so.1.0'
2470         ;;
2471     esac
2472     ;;
2474 *-os2*)
2475     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2476     ;;
2478 esac
2480 AC_SUBST(MOZ_LINKER)
2481 if test -n "$MOZ_LINKER"; then
2482   AC_DEFINE(MOZ_LINKER)
2484 AC_SUBST(MOZ_ENABLE_SZIP)
2486 dnl Only one oddball right now (QNX), but this gives us flexibility
2487 dnl if any other platforms need to override this in the future.
2488 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2490 dnl ========================================================
2491 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2492 dnl by now will not have any way to link most binaries (tests
2493 dnl as well as viewer, apprunner, etc.), because some symbols
2494 dnl will be left out of the "composite" .so's by ld as unneeded.
2495 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2496 dnl they can link in the static libs that provide the missing
2497 dnl symbols.
2498 dnl ========================================================
2499 NO_LD_ARCHIVE_FLAGS=
2500 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2501     NO_LD_ARCHIVE_FLAGS=1
2503 case "$target" in
2504 *-os2*)
2505     NO_LD_ARCHIVE_FLAGS=
2506     ;;
2507 *-aix4.3*|*-aix5*)
2508     NO_LD_ARCHIVE_FLAGS=
2509     ;;
2510 *-mingw*)
2511     if test -z "$GNU_CC"; then
2512         NO_LD_ARCHIVE_FLAGS=
2513     fi
2514     ;;
2515 esac
2516 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2518 dnl ========================================================
2519 dnl = Flags to strip unused symbols from .so components and
2520 dnl = to export jemalloc symbols when linking a program
2521 dnl ========================================================
2522 case "$target" in
2523     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2524         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2525         ;;
2526     *-solaris*)
2527         if test -z "$GNU_CC"; then
2528          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2529         else
2530          if test -z "$GCC_USE_GNU_LD"; then
2531           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2532          else
2533           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2534          fi
2535         fi
2536         ;;
2537     *-darwin*)
2538         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2539         ;;
2540     *-mingw*)
2541         if test -n "$GNU_CC"; then
2542            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2543         fi
2544         ;;
2545 esac
2547 if test -z "$COMPILE_ENVIRONMENT"; then
2548     SKIP_COMPILER_CHECKS=1
2549     SKIP_LIBRARY_CHECKS=1
2552 MOZ_COMPILER_OPTS
2553 if test -z "$SKIP_COMPILER_CHECKS"; then
2554 dnl Checks for typedefs, structures, and compiler characteristics.
2555 dnl ========================================================
2556 AC_HEADER_STDC
2557 AC_C_CONST
2558 AC_TYPE_MODE_T
2559 AC_TYPE_OFF_T
2560 AC_TYPE_PID_T
2561 AC_TYPE_SIZE_T
2562 AC_LANG_CPLUSPLUS
2563 AC_MSG_CHECKING(for __stdcall)
2564 AC_CACHE_VAL(ac_cv___stdcall,
2565  [AC_TRY_COMPILE([template <typename Method> struct foo;
2566                   template <> struct foo<void (*)()> {};
2567                   template <> struct foo<void (__stdcall*)()> {};],
2568                  [],
2569                  [ac_cv___stdcall=true],
2570                  [ac_cv___stdcall=false])])
2571 if test "$ac_cv___stdcall" = true ; then
2572   AC_DEFINE(HAVE_STDCALL)
2573   AC_MSG_RESULT(yes)
2574 else
2575   AC_MSG_RESULT(no)
2577 AC_LANG_C
2578 AC_MSG_CHECKING(for ssize_t)
2579 AC_CACHE_VAL(ac_cv_type_ssize_t,
2580  [AC_TRY_COMPILE([#include <stdio.h>
2581                   #include <sys/types.h>],
2582                  [ssize_t foo = 0;],
2583                  [ac_cv_type_ssize_t=true],
2584                  [ac_cv_type_ssize_t=false])])
2585 if test "$ac_cv_type_ssize_t" = true ; then
2586   AC_DEFINE(HAVE_SSIZE_T)
2587   AC_MSG_RESULT(yes)
2588 else
2589   AC_MSG_RESULT(no)
2591 AC_STRUCT_ST_BLKSIZE
2592 AC_MSG_CHECKING(for siginfo_t)
2593 AC_CACHE_VAL(ac_cv_siginfo_t,
2594  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2595                   #include <signal.h>],
2596                  [siginfo_t* info;],
2597                  [ac_cv_siginfo_t=true],
2598                  [ac_cv_siginfo_t=false])])
2599 if test "$ac_cv_siginfo_t" = true ; then
2600   AC_DEFINE(HAVE_SIGINFO_T)
2601   AC_MSG_RESULT(yes)
2602 else
2603   AC_MSG_RESULT(no)
2606 dnl Check for int64, uint, and uint_t.
2607 dnl ========================================================
2608 AC_MSG_CHECKING(for int64)
2609 AC_CACHE_VAL(ac_cv_int64,
2610  [AC_TRY_COMPILE([#include <stdio.h>
2611                   #include <sys/types.h>],
2612                  [int64 foo = 0;],
2613                  [ac_cv_int64=true],
2614                  [ac_cv_int64=false])])
2615 if test "$ac_cv_int64" = true ; then
2616   AC_DEFINE(HAVE_INT64)
2617   AC_MSG_RESULT(yes)
2618 else
2619   AC_MSG_RESULT(no)
2621 AC_MSG_CHECKING(for uint)
2622 AC_CACHE_VAL(ac_cv_uint,
2623  [AC_TRY_COMPILE([#include <stdio.h>
2624                   #include <sys/types.h>],
2625                  [uint foo = 0;],
2626                  [ac_cv_uint=true],
2627                  [ac_cv_uint=false])])
2628 if test "$ac_cv_uint" = true ; then
2629   AC_DEFINE(HAVE_UINT)
2630   AC_MSG_RESULT(yes)
2631 else
2632   AC_MSG_RESULT(no)
2634 AC_MSG_CHECKING(for uint_t)
2635 AC_CACHE_VAL(ac_cv_uint_t,
2636  [AC_TRY_COMPILE([#include <stdio.h>
2637                   #include <sys/types.h>],
2638                  [uint_t foo = 0;],
2639                  [ac_cv_uint_t=true],
2640                  [ac_cv_uint_t=false])])
2641 if test "$ac_cv_uint_t" = true ; then
2642   AC_DEFINE(HAVE_UINT_T)
2643   AC_MSG_RESULT(yes)
2644 else
2645   AC_MSG_RESULT(no)
2648 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2649 dnl are defined when compiling C++ but not C.  Since the result of this
2650 dnl test is used only in C++, do it in C++.
2651 AC_LANG_CPLUSPLUS
2653 AC_MSG_CHECKING(for uname.domainname)
2654 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2655     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2656         [ struct utsname *res; char *domain;
2657             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2658         [ac_cv_have_uname_domainname_field=true],
2659         [ac_cv_have_uname_domainname_field=false])])
2661 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2662     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2663     AC_MSG_RESULT(yes)
2664 else
2665     AC_MSG_RESULT(no)
2668 AC_MSG_CHECKING(for uname.__domainname)
2669 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2670     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2671         [ struct utsname *res; char *domain;
2672             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2673         [ac_cv_have_uname_us_domainname_field=true],
2674         [ac_cv_have_uname_us_domainname_field=false])])
2676 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2677     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2678     AC_MSG_RESULT(yes)
2679 else
2680     AC_MSG_RESULT(no)
2683 dnl Check whether we can use gcc's c++0x mode
2684 AC_LANG_CPLUSPLUS
2686 if test "$GNU_CXX"; then
2687     _SAVE_CXXFLAGS=$CXXFLAGS
2688     CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2690     AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2691         ac_cv_cxx0x_headers_bug,
2692         [AC_TRY_COMPILE([#include <memory>], [],
2693                         ac_cv_cxx0x_headers_bug="no",
2694                         ac_cv_cxx0x_headers_bug="yes")])
2695     CXXFLAGS="$_SAVE_CXXFLAGS"
2696     if test "$ac_cv_cxx0x_headers_bug" = "no"; then
2697         CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2698     fi
2701 dnl Check for usable char16_t (2 bytes, unsigned)
2702 dnl (we might not need the unsignedness check anymore)
2703 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2704     ac_cv_have_usable_char16_t,
2705     [AC_TRY_COMPILE([$configure_static_assert_macros],
2706                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2707                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2708                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2709                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2710                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2711                     ac_cv_have_usable_char16_t="yes",
2712                     ac_cv_have_usable_char16_t="no")])
2713 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2714     AC_DEFINE(HAVE_CPP_CHAR16_T)
2715     HAVE_CPP_CHAR16_T=1
2716 elif test "$GNU_CXX"; then
2717     CXXFLAGS="$_SAVE_CXXFLAGS"
2720 dnl Check for usable wchar_t (2 bytes, unsigned)
2721 dnl (we really don't need the unsignedness check anymore)
2722 dnl ========================================================
2724 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2725     ac_cv_have_usable_wchar_v2,
2726     [AC_TRY_COMPILE([#include <stddef.h>
2727                      $configure_static_assert_macros],
2728                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2729                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2730                     ac_cv_have_usable_wchar_v2="yes",
2731                     ac_cv_have_usable_wchar_v2="no")])
2732 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2733     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2734     HAVE_CPP_2BYTE_WCHAR_T=1
2735 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2736 dnl This is really gcc-only
2737 dnl Do this test using CXX only since some versions of gcc
2738 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2739 dnl only have short-wchar support for c++.
2740 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2742     _SAVE_CXXFLAGS=$CXXFLAGS
2743     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2745     AC_CACHE_CHECK(for compiler -fshort-wchar option,
2746         ac_cv_have_usable_wchar_option_v2,
2747         [AC_TRY_LINK([#include <stddef.h>
2748                       $configure_static_assert_macros],
2749                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2750                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2751                      ac_cv_have_usable_wchar_option_v2="yes",
2752                      ac_cv_have_usable_wchar_option_v2="no")])
2754     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2755         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2756         HAVE_CPP_2BYTE_WCHAR_T=1
2757         if test "$OS_TARGET" = Android; then
2758             WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
2759             CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
2760             CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
2761             DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
2762         else
2763             WCHAR_CFLAGS="-fshort-wchar"
2764         fi
2765     else
2766         CXXFLAGS=$_SAVE_CXXFLAGS
2767     fi
2770 dnl Check for nullptr (bug 626472)
2771 AC_LANG_CPLUSPLUS
2772 AC_MSG_CHECKING(for nullptr)
2773 AC_CACHE_VAL(ac_cv_nullptr,
2774  [AC_TRY_COMPILE([],
2775                  [int* foo = nullptr;],
2776                  [ac_cv_nullptr=true],
2777                  [ac_cv_nullptr=false])])
2778 if test "$ac_cv_nullptr" = true ; then
2779   AC_DEFINE(HAVE_NULLPTR)
2780   AC_MSG_RESULT(yes)
2781 else
2782   AC_MSG_RESULT(no)
2785 AC_LANG_C
2787 dnl Check for .hidden assembler directive and visibility attribute.
2788 dnl Borrowed from glibc configure.in
2789 dnl ===============================================================
2790 if test "$GNU_CC"; then
2791   AC_CACHE_CHECK(for visibility(hidden) attribute,
2792                  ac_cv_visibility_hidden,
2793                  [cat > conftest.c <<EOF
2794                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2796                   ac_cv_visibility_hidden=no
2797                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2798                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2799                       ac_cv_visibility_hidden=yes
2800                     fi
2801                   fi
2802                   rm -f conftest.[cs]
2803                  ])
2804   if test "$ac_cv_visibility_hidden" = "yes"; then
2805     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2807     AC_CACHE_CHECK(for visibility(default) attribute,
2808                    ac_cv_visibility_default,
2809                    [cat > conftest.c <<EOF
2810                     int foo __attribute__ ((visibility ("default"))) = 1;
2812                     ac_cv_visibility_default=no
2813                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2814                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2815                         ac_cv_visibility_default=yes
2816                       fi
2817                     fi
2818                     rm -f conftest.[cs]
2819                    ])
2820     if test "$ac_cv_visibility_default" = "yes"; then
2821       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2823       AC_CACHE_CHECK(for visibility pragma support,
2824                      ac_cv_visibility_pragma,
2825                      [cat > conftest.c <<EOF
2826 #pragma GCC visibility push(hidden)
2827                       int foo_hidden = 1;
2828 #pragma GCC visibility push(default)
2829                       int foo_default = 1;
2831                       ac_cv_visibility_pragma=no
2832                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2833                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2834                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2835                             ac_cv_visibility_pragma=yes
2836                           fi
2837                         fi
2838                       fi
2839                       rm -f conftest.[cs]
2840                     ])
2841       if test "$ac_cv_visibility_pragma" = "yes"; then
2842         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2843                        ac_cv_have_visibility_class_bug,
2844                        [cat > conftest.c <<EOF
2845 #pragma GCC visibility push(hidden)
2846 struct __attribute__ ((visibility ("default"))) TestStruct {
2847   static void Init();
2849 __attribute__ ((visibility ("default"))) void TestFunc() {
2850   TestStruct::Init();
2853                        ac_cv_have_visibility_class_bug=no
2854                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2855                          ac_cv_have_visibility_class_bug=yes
2856                        else
2857                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2858                            ac_cv_have_visibility_class_bug=yes
2859                          fi
2860                        fi
2861                        rm -rf conftest.{c,S}
2862                        ])
2864         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2865                        ac_cv_have_visibility_builtin_bug,
2866                        [cat > conftest.c <<EOF
2867 #pragma GCC visibility push(hidden)
2868 #pragma GCC visibility push(default)
2869 #include <string.h>
2870 #pragma GCC visibility pop
2872 __attribute__ ((visibility ("default"))) void Func() {
2873   char c[[100]];
2874   memset(c, 0, sizeof(c));
2877                        ac_cv_have_visibility_builtin_bug=no
2878                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2879                          ac_cv_have_visibility_builtin_bug=yes
2880                        else
2881                          if test `grep -c "@PLT" conftest.S` = 0; then
2882                            ac_cv_visibility_builtin_bug=yes
2883                          fi
2884                        fi
2885                        rm -f conftest.{c,S}
2886                        ])
2887         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2888                 "$ac_cv_have_visibility_class_bug" = "no"; then
2889           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2890           WRAP_SYSTEM_INCLUDES=1
2891           STL_FLAGS='-I$(DIST)/stl_wrappers'
2892           WRAP_STL_INCLUDES=1
2893         else
2894           VISIBILITY_FLAGS='-fvisibility=hidden'
2895         fi # have visibility pragma bug
2896       fi   # have visibility pragma
2897     fi     # have visibility(default) attribute
2898   fi       # have visibility(hidden) attribute
2899 fi         # GNU_CC
2901 # visibility hidden flag for Sun Studio on Solaris
2902 if test "$SOLARIS_SUNPRO_CC"; then
2903 VISIBILITY_FLAGS='-xldscope=hidden'
2904 fi         # Sun Studio on Solaris
2906 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2907 AC_SUBST(VISIBILITY_FLAGS)
2909 MOZ_GCC_PR49911
2911 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2912 dnl ========================================================
2913 if test "$GNU_CC"; then
2914   CFLAGS_save="${CFLAGS}"
2915   CFLAGS="${CFLAGS} -Werror"
2916   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2917                  ac_cv_force_align_arg_pointer,
2918                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2919                                  [],
2920                                  ac_cv_force_align_arg_pointer="yes",
2921                                  ac_cv_force_align_arg_pointer="no")])
2922   CFLAGS="${CFLAGS_save}"
2923   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2924     HAVE_GCC_ALIGN_ARG_POINTER=1
2925   else
2926     HAVE_GCC_ALIGN_ARG_POINTER=
2927   fi
2929 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2931 dnl Checks for header files.
2932 dnl ========================================================
2933 AC_HEADER_DIRENT
2934 case "$target_os" in
2935 freebsd*|openbsd*)
2936 # for stuff like -lXshm
2937     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2938     ;;
2939 esac
2940 MOZ_CHECK_COMMON_HEADERS
2942 dnl These are all the places some variant of statfs can be hiding.
2943 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2945 dnl Quota support
2946 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2947 MOZ_CHECK_HEADERS(linux/quota.h)
2949 dnl Try for MMX support
2950 dnl NB - later gcc versions require -mmmx for this header to be successfully
2951 dnl included (or another option which implies it, such as -march=pentium-mmx)
2952 MOZ_CHECK_HEADERS(mmintrin.h)
2954 dnl Check whether the compiler supports the new-style C++ standard
2955 dnl library headers (i.e. <new>) or needs the old "new.h"
2956 AC_LANG_CPLUSPLUS
2957 NEW_H=new.h
2958 MOZ_CHECK_HEADER(new, [NEW_H=new])
2959 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2960 AC_LANG_C
2962 AC_ARG_ENABLE(dtrace,
2963               [  --enable-dtrace         build with dtrace support if available (default=no)],
2964               [enable_dtrace="yes"],)
2965 if test "x$enable_dtrace" = "xyes"; then
2966   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2967   if test -n "$HAVE_DTRACE"; then
2968       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2969   else
2970       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2971   fi
2973 AC_SUBST(HAVE_DTRACE)
2975 case $target in
2976 *-aix4.3*|*-aix5*)
2977         ;;
2979         MOZ_CHECK_HEADERS(sys/cdefs.h)
2980         ;;
2981 esac
2983 MOZ_LINUX_PERF_EVENT
2985 dnl Checks for libraries.
2986 dnl ========================================================
2987 case $target in
2988 *-hpux11.*)
2989         ;;
2991         AC_CHECK_LIB(c_r, gethostbyname_r)
2992         ;;
2993 esac
2995 dnl We don't want to link with libdl even if it's present on OS X, since
2996 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2997 dnl in libc.
2998 dnl We don't want to link against libm or libpthread on Darwin since
2999 dnl they both are just symlinks to libSystem and explicitly linking
3000 dnl against libSystem causes issues when debugging (see bug 299601).
3001 case $target in
3002 *-darwin*)
3003     ;;
3004 *-os2*)
3005     ;;
3007     AC_SEARCH_LIBS(dlopen, dl,
3008         MOZ_CHECK_HEADER(dlfcn.h,
3009         AC_DEFINE(HAVE_DLOPEN)))
3010     ;;
3011 esac
3013 _SAVE_CFLAGS="$CFLAGS"
3014 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3015 AC_CHECK_FUNCS(dladdr memmem)
3016 CFLAGS="$_SAVE_CFLAGS"
3018 if test ! "$GNU_CXX"; then
3020     case $target in
3021     *-aix*)
3022         AC_CHECK_LIB(C_r, demangle)
3023         ;;
3024      *)
3025         AC_CHECK_LIB(C, demangle)
3026         ;;
3027      esac
3030 dnl OS/2 has socket in libc.
3031 case $target in
3032 *-os2*)
3033     ;;
3035     AC_CHECK_LIB(socket, socket)
3036 esac
3038 XLDFLAGS="$X_LIBS"
3039 XLIBS="$X_EXTRA_LIBS"
3041 dnl ========================================================
3042 dnl Checks for X libraries.
3043 dnl Ordering is important.
3044 dnl Xt is dependent upon SM as of X11R6
3045 dnl ========================================================
3046 if test "$no_x" = "yes"; then
3047     AC_DEFINE(NO_X11)
3048 else
3049     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3050         XLIBS="-lX11 $XLIBS"
3051         _SAVE_LDFLAGS="$LDFLAGS"
3052         LDFLAGS="$XLDFLAGS $LDFLAGS"
3053         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3054                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3055         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3056                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3058         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3059         unset ac_cv_lib_Xt_XtFree
3060             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3061             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3062         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3063                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3064         ])
3066     # AIX needs the motif library linked before libXt to prevent
3067     # crashes in plugins linked against Motif - Bug #98892
3068     case "${target_os}" in
3069     aix*)
3070         XT_LIBS="-lXm $XT_LIBS"
3071         ;;
3072     esac
3074     dnl ========================================================
3075     dnl = Check for XShm
3076     dnl ========================================================
3077     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3078         $XLIBS $XEXT_LIBS)
3080     dnl ========================================================
3081     dnl = Check for Xss
3082     dnl ========================================================
3083     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3084         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3085             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3086              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3088         LDFLAGS="$_SAVE_LDFLAGS"
3089 fi # $no_x
3091 AC_SUBST(XCFLAGS)
3092 AC_SUBST(XLDFLAGS)
3093 AC_SUBST(XLIBS)
3094 AC_SUBST(XEXT_LIBS)
3095 AC_SUBST(XT_LIBS)
3096 AC_SUBST(XSS_LIBS)
3098 dnl ========================================================
3099 dnl = pthread support
3100 dnl = Start by checking whether the system support pthreads
3101 dnl ========================================================
3102 case "$target_os" in
3103 darwin*)
3104     USE_PTHREADS=1
3105     ;;
3107     MOZ_CHECK_PTHREADS(pthreads,
3108         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3109         MOZ_CHECK_PTHREADS(pthread,
3110             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3111             MOZ_CHECK_PTHREADS(c_r,
3112                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3113                 MOZ_CHECK_PTHREADS(c,
3114                     USE_PTHREADS=1
3115                 )
3116             )
3117         )
3118     )
3119     ;;
3120 esac
3122 dnl ========================================================
3123 dnl Check the command line for --with-pthreads
3124 dnl ========================================================
3125 MOZ_ARG_WITH_BOOL(pthreads,
3126 [  --with-pthreads         Force use of system pthread library with NSPR ],
3127 [ if test "$USE_PTHREADS"x = x; then
3128     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3129 fi],
3130     USE_PTHREADS=
3131     _PTHREAD_LDFLAGS=
3134 dnl ========================================================
3135 dnl Do the platform specific pthread hackery
3136 dnl ========================================================
3137 if test "$USE_PTHREADS"x != x
3138 then
3139         dnl
3140         dnl See if -pthread is supported.
3141         dnl
3142         rm -f conftest*
3143         ac_cv_have_dash_pthread=no
3144         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3145         echo 'int main() { return 0; }' | cat > conftest.c
3146         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3147         if test $? -eq 0; then
3148                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3149                         ac_cv_have_dash_pthread=yes
3150                 case "$target_os" in
3151                 freebsd*)
3152 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3153                 ;;
3154                 *)
3155                             CFLAGS="$CFLAGS -pthread"
3156                             CXXFLAGS="$CXXFLAGS -pthread"
3157                 ;;
3158                 esac
3159                 fi
3160         fi
3161         rm -f conftest*
3162     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3164         dnl
3165         dnl See if -pthreads is supported.
3166         dnl
3167     ac_cv_have_dash_pthreads=no
3168     if test "$ac_cv_have_dash_pthread" = "no"; then
3169             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3170         echo 'int main() { return 0; }' | cat > conftest.c
3171             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3172         if test $? -eq 0; then
3173                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3174                             ac_cv_have_dash_pthreads=yes
3175                             CFLAGS="$CFLAGS -pthreads"
3176                             CXXFLAGS="$CXXFLAGS -pthreads"
3177                     fi
3178             fi
3179             rm -f conftest*
3180         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3181     fi
3183         case "$target" in
3184             *-*-freebsd*)
3185                         AC_DEFINE(_REENTRANT)
3186                         AC_DEFINE(_THREAD_SAFE)
3187                         dnl -pthread links in -lpthread, so don't specify it explicitly.
3188                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3189                                 _PTHREAD_LDFLAGS="-pthread"
3190                         fi
3191                         ;;
3193             *-*-openbsd*|*-*-bsdi*)
3194                         AC_DEFINE(_REENTRANT)
3195                         AC_DEFINE(_THREAD_SAFE)
3196                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3197                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3198                 _PTHREAD_LDFLAGS="-pthread"
3199                         fi
3200                         ;;
3202             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3203                         AC_DEFINE(_REENTRANT)
3204                         ;;
3206             *-aix4.3*|*-aix5*)
3207                         AC_DEFINE(_REENTRANT)
3208                         ;;
3210             *-hpux11.*)
3211                         AC_DEFINE(_REENTRANT)
3212                         ;;
3214             *-*-solaris*)
3215                         AC_DEFINE(_REENTRANT)
3216                         if test "$SOLARIS_SUNPRO_CC"; then
3217                                 CFLAGS="$CFLAGS -mt"
3218                                 CXXFLAGS="$CXXFLAGS -mt"
3219                         fi
3220                         ;;
3221         esac
3222     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3226 dnl Checks for library functions.
3227 dnl ========================================================
3228 AC_PROG_GCC_TRADITIONAL
3229 AC_FUNC_MEMCMP
3230 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3231 AC_CHECK_FUNCS(flockfile getpagesize)
3232 AC_CHECK_FUNCS(localtime_r strtok_r)
3234 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3235 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3236                ac_cv_clock_monotonic,
3237                [for libs in "" -lrt; do
3238                     _SAVE_LIBS="$LIBS"
3239                     LIBS="$LIBS $libs"
3240                     AC_TRY_LINK([#include <time.h>],
3241                                  [ struct timespec ts;
3242                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
3243                                  ac_cv_clock_monotonic=$libs
3244                                  LIBS="$_SAVE_LIBS"
3245                                  break,
3246                                  ac_cv_clock_monotonic=no)
3247                     LIBS="$_SAVE_LIBS"
3248                 done])
3249 if test "$ac_cv_clock_monotonic" != "no"; then
3250     HAVE_CLOCK_MONOTONIC=1
3251     REALTIME_LIBS=$ac_cv_clock_monotonic
3252     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3253     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3254     AC_SUBST(REALTIME_LIBS)
3257 dnl check for wcrtomb/mbrtowc
3258 dnl =======================================================================
3259 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3260 AC_LANG_SAVE
3261 AC_LANG_CPLUSPLUS
3262 AC_CACHE_CHECK(for wcrtomb,
3263     ac_cv_have_wcrtomb,
3264     [AC_TRY_LINK([#include <wchar.h>],
3265                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3266                  ac_cv_have_wcrtomb="yes",
3267                  ac_cv_have_wcrtomb="no")])
3268 if test "$ac_cv_have_wcrtomb" = "yes"; then
3269     AC_DEFINE(HAVE_WCRTOMB)
3271 AC_CACHE_CHECK(for mbrtowc,
3272     ac_cv_have_mbrtowc,
3273     [AC_TRY_LINK([#include <wchar.h>],
3274                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3275                  ac_cv_have_mbrtowc="yes",
3276                  ac_cv_have_mbrtowc="no")])
3277 if test "$ac_cv_have_mbrtowc" = "yes"; then
3278     AC_DEFINE(HAVE_MBRTOWC)
3280 AC_LANG_RESTORE
3283 AC_CACHE_CHECK(
3284     [for res_ninit()],
3285     ac_cv_func_res_ninit,
3286     [AC_TRY_LINK([
3287         #ifdef linux
3288         #define _BSD_SOURCE 1
3289         #endif
3290         #include <resolv.h>
3291         ],
3292         [int foo = res_ninit(&_res);],
3293         [ac_cv_func_res_ninit=yes],
3294         [ac_cv_func_res_ninit=no])
3295     ])
3297 if test "$ac_cv_func_res_ninit" = "yes"; then
3298     AC_DEFINE(HAVE_RES_NINIT)
3299 dnl must add the link line we do something as foolish as this... dougt
3300 dnl else
3301 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3302 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3305 AC_LANG_CPLUSPLUS
3306 AC_CACHE_CHECK(
3307     [for gnu_get_libc_version()],
3308     ac_cv_func_gnu_get_libc_version,
3309     [AC_TRY_LINK([
3310         #ifdef HAVE_GNU_LIBC_VERSION_H
3311         #include <gnu/libc-version.h>
3312         #endif
3313         ],
3314         [const char *glibc_version = gnu_get_libc_version();],
3315         [ac_cv_func_gnu_get_libc_version=yes],
3316         [ac_cv_func_gnu_get_libc_version=no]
3317         )]
3318     )
3320 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3321     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3324 case $target_os in
3325     darwin*|mingw*|os2*)
3326         ;;
3327     *)
3329 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3330     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3331         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3332 _SAVE_LIBS=$LIBS
3333 LIBS="$LIBS $_ICONV_LIBS"
3334 AC_CACHE_CHECK(
3335     [for iconv()],
3336     ac_cv_func_iconv,
3337     [AC_TRY_LINK([
3338         #include <stdlib.h>
3339         #include <iconv.h>
3340         ],
3341         [
3342             iconv_t h = iconv_open("", "");
3343             iconv(h, NULL, NULL, NULL, NULL);
3344             iconv_close(h);
3345         ],
3346         [ac_cv_func_iconv=yes],
3347         [ac_cv_func_iconv=no]
3348         )]
3349     )
3350 if test "$ac_cv_func_iconv" = "yes"; then
3351     AC_DEFINE(HAVE_ICONV)
3352     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3353     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3354     LIBICONV="$_ICONV_LIBS"
3355     AC_CACHE_CHECK(
3356         [for iconv() with const input],
3357         ac_cv_func_const_iconv,
3358         [AC_TRY_COMPILE([
3359             #include <stdlib.h>
3360             #include <iconv.h>
3361             ],
3362             [
3363                 const char *input = "testing";
3364                 iconv_t h = iconv_open("", "");
3365                 iconv(h, &input, NULL, NULL, NULL);
3366                 iconv_close(h);
3367             ],
3368             [ac_cv_func_const_iconv=yes],
3369             [ac_cv_func_const_iconv=no]
3370             )]
3371         )
3372     if test "$ac_cv_func_const_iconv" = "yes"; then
3373         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3374     fi
3376 LIBS=$_SAVE_LIBS
3378     ;;
3379 esac
3381 AM_LANGINFO_CODESET
3383 AC_LANG_C
3385 dnl **********************
3386 dnl *** va_copy checks ***
3387 dnl **********************
3388 dnl we currently check for all three va_copy possibilities, so we get
3389 dnl all results in config.log for bug reports.
3390 AC_MSG_CHECKING(for an implementation of va_copy())
3391 AC_CACHE_VAL(ac_cv_va_copy,[
3392     AC_TRY_RUN([
3393         #include <stdarg.h>
3394         void f (int i, ...) {
3395             va_list args1, args2;
3396             va_start (args1, i);
3397             va_copy (args2, args1);
3398             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3399                 exit (1);
3400             va_end (args1); va_end (args2);
3401         }
3402         int main() { f (0, 42); return 0; }],
3403         ac_cv_va_copy=yes,
3404         ac_cv_va_copy=no,
3405         ac_cv_va_copy=no
3406     )
3408 AC_MSG_RESULT($ac_cv_va_copy)
3409 AC_MSG_CHECKING(for an implementation of __va_copy())
3410 AC_CACHE_VAL(ac_cv___va_copy,[
3411     AC_TRY_RUN([
3412         #include <stdarg.h>
3413         void f (int i, ...) {
3414             va_list args1, args2;
3415             va_start (args1, i);
3416             __va_copy (args2, args1);
3417             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3418                 exit (1);
3419             va_end (args1); va_end (args2);
3420         }
3421         int main() { f (0, 42); return 0; }],
3422         ac_cv___va_copy=yes,
3423         ac_cv___va_copy=no,
3424         ac_cv___va_copy=no
3425     )
3427 AC_MSG_RESULT($ac_cv___va_copy)
3428 AC_MSG_CHECKING(whether va_lists can be copied by value)
3429 AC_CACHE_VAL(ac_cv_va_val_copy,[
3430     AC_TRY_RUN([
3431         #include <stdarg.h>
3432         void f (int i, ...) {
3433             va_list args1, args2;
3434             va_start (args1, i);
3435             args2 = args1;
3436             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3437                 exit (1);
3438             va_end (args1); va_end (args2);
3439         }
3440         int main() { f (0, 42); return 0; }],
3441         ac_cv_va_val_copy=yes,
3442         ac_cv_va_val_copy=no,
3443         ac_cv_va_val_copy=yes
3444     )
3446 if test "x$ac_cv_va_copy" = "xyes"; then
3447     AC_DEFINE(VA_COPY, va_copy)
3448     AC_DEFINE(HAVE_VA_COPY)
3449 elif test "x$ac_cv___va_copy" = "xyes"; then
3450     AC_DEFINE(VA_COPY, __va_copy)
3451     AC_DEFINE(HAVE_VA_COPY)
3454 if test "x$ac_cv_va_val_copy" = "xno"; then
3455    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3457 AC_MSG_RESULT($ac_cv_va_val_copy)
3459 dnl ===================================================================
3460 dnl ========================================================
3461 dnl Put your C++ language/feature checks below
3462 dnl ========================================================
3463 AC_LANG_CPLUSPLUS
3465 ARM_ABI_PREFIX=
3466 if test "$GNU_CC"; then
3467   if test "$CPU_ARCH" = "arm" ; then
3468     AC_CACHE_CHECK(for ARM EABI,
3469         ac_cv_gcc_arm_eabi,
3470         [AC_TRY_COMPILE([],
3471                         [
3472 #if defined(__ARM_EABI__)
3473   return 0;
3474 #else
3475 #error Not ARM EABI.
3476 #endif
3477                         ],
3478                         ac_cv_gcc_arm_eabi="yes",
3479                         ac_cv_gcc_arm_eabi="no")])
3480     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3481         HAVE_ARM_EABI=1
3482         ARM_ABI_PREFIX=eabi-
3483     else
3484         ARM_ABI_PREFIX=oabi-
3485     fi
3486   fi
3488   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3491 dnl Check for support of modern template specialization syntax
3492 dnl Test code and requirement from scc@netscape.com.
3493 dnl Autoconf cut-and-paste job by waterson@netscape.com
3494 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3495                ac_cv_cpp_modern_specialize_template_syntax,
3496                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3497                                class Y {};
3498                                template <> struct X<Y> { double a; };,
3499                                X<int> int_x;
3500                                X<Y> y_x;,
3501                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3502                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3503 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
3504   AC_MSG_ERROR([The C++ compiler does not support template specialization])
3507 dnl Some compilers support only full specialization, and some don't.
3508 AC_CACHE_CHECK(whether partial template specialization works,
3509                ac_cv_cpp_partial_specialization,
3510                [AC_TRY_COMPILE(template <class T> class Foo {};
3511                                template <class T> class Foo<T*> {};,
3512                                return 0;,
3513                                ac_cv_cpp_partial_specialization=yes,
3514                                ac_cv_cpp_partial_specialization=no)])
3515 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3516   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3519 dnl Check to see if we can resolve ambiguity with |using|.
3520 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3521                ac_cv_cpp_ambiguity_resolving_using,
3522                [AC_TRY_COMPILE(class X {
3523                                  public: int go(const X&) {return 3;}
3524                                          int jo(const X&) {return 3;}
3525                                };
3526                                class Y : public X {
3527                                  public:  int go(int) {return 2;}
3528                                           int jo(int) {return 2;}
3529                                           using X::jo;
3530                                  private: using X::go;
3531                                };,
3532                                X x; Y y; y.jo(x);,
3533                                ac_cv_cpp_ambiguity_resolving_using=yes,
3534                                ac_cv_cpp_ambiguity_resolving_using=no)])
3535 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3536    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3539 dnl See if a dynamic_cast to void* gives the most derived object.
3540 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3541                ac_cv_cpp_dynamic_cast_void_ptr,
3542                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3543                             class Y { int j; public: virtual ~Y() { } };
3544                             class Z : public X, public Y { int k; };
3546                             int main() {
3547                                  Z mdo;
3548                                  X *subx = (X*)&mdo;
3549                                  Y *suby = (Y*)&mdo;
3550                                  return !((((void*)&mdo != (void*)subx) &&
3551                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3552                                           (((void*)&mdo != (void*)suby) &&
3553                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3554                             }],
3555                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3556                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3557                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3558 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3559    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3563 dnl note that this one is reversed - if the test fails, then
3564 dnl we require implementations of unused virtual methods. Which
3565 dnl really blows because it means we'll have useless vtable
3566 dnl bloat.
3567 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3568                ac_cv_cpp_unused_required,
3569                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3570                                X x;,
3571                                ac_cv_cpp_unused_required=no,
3572                                ac_cv_cpp_unused_required=yes)])
3573 if test "$ac_cv_cpp_unused_required" = yes ; then
3574    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3578 dnl Some compilers have trouble comparing a constant reference to a templatized
3579 dnl class to zero, and require an explicit operator==() to be defined that takes
3580 dnl an int. This test separates the strong from the weak.
3582 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3583                ac_cv_trouble_comparing_to_zero,
3584                [AC_TRY_COMPILE([#include <algorithm>
3585                                 template <class T> class Foo {};
3586                                 class T2;
3587                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3588                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3589                                [Foo<int> f; return (0 != f);],
3590                                ac_cv_trouble_comparing_to_zero=no,
3591                                ac_cv_trouble_comparing_to_zero=yes)])
3592 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3593   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3596 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3597 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3598 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3599 # linking XUL.
3600 _SAVE_LDFLAGS=$LDFLAGS
3601 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3602 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3603                ac_cv_thread_keyword,
3604                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3605                             [return tlsIsMainThread;],
3606                             ac_cv_thread_keyword=yes,
3607                             ac_cv_thread_keyword=no)])
3608 LDFLAGS=$_SAVE_LDFLAGS
3609 # The custom dynamic linker doesn't support TLS variables
3610 MOZ_TLS=
3611 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3612   # mips builds fail with TLS variables because of a binutils bug.
3613   # See bug 528687
3614   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3615   case "${target}" in
3616     mips*-*)
3617       :
3618       ;;
3619     *-android*|*-linuxandroid*)
3620       :
3621       ;;
3622     *-openbsd*)
3623       :
3624       ;;
3625     *)
3626       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3627       MOZ_TLS=1
3628       ;;
3629   esac
3632 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3633 if test -n "$MOZ_LINKER"; then
3634   if test "$CPU_ARCH" = arm; then
3635     dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
3636     ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
3637     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3638     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3639       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000"
3640       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000"
3641     fi
3642   fi
3645 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3646 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3647 dnl We however want to avoid these text relocations, and this can be done
3648 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3649 dnl doesn't contain anything at all, beside placeholders for some sections,
3650 dnl and crtbegin only contains a finalizer function that calls
3651 dnl __cxa_finalize. The custom linker actually takes care of calling
3652 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3653 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3654 dnl link crtbegin and crtend at all.
3655 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$OS_TARGET" = "Android"; then
3656   AC_CACHE_CHECK([whether the CRT objects have text relocations],
3657     ac_cv_crt_has_text_relocations,
3658     [echo 'int foo() { return 0; }' > conftest.cpp
3659      if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3660         test -s conftest${DLL_SUFFIX}; then
3661        if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3662          ac_cv_crt_has_text_relocations=yes
3663        else
3664          ac_cv_crt_has_text_relocations=no
3665        fi
3666      else
3667        AC_ERROR([couldn't compile a simple C file])
3668      fi
3669      rm -rf conftest*])
3670   if test "$ac_cv_crt_has_text_relocations" = yes; then
3671     dnl While we want libraries to skip the CRT files, we don't want
3672     dnl executables to be treated the same way. We thus set the flag
3673     dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3674     dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3675     dnl Using LDFLAGS in nspr is safe, since we only really build
3676     dnl libraries there.
3677     DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3678     NSPR_LDFLAGS=-nostartfiles
3679   fi
3682 dnl Check for the existence of various allocation headers/functions
3684 MALLOC_H=
3685 MOZ_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
3686 if test "$MALLOC_H" = ""; then
3687   MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
3688   if test "$MALLOC_H" = ""; then
3689     MOZ_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
3690   fi
3692 if test "$MALLOC_H" != ""; then
3693    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3696 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3697 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3699 dnl See if compiler supports some gcc-style attributes
3701 AC_CACHE_CHECK(for __attribute__((always_inline)),
3702                ac_cv_attribute_always_inline,
3703                [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3704                                [],
3705                                ac_cv_attribute_always_inline=yes,
3706                                ac_cv_attribute_always_inline=no)])
3708 AC_CACHE_CHECK(for __attribute__((malloc)),
3709                ac_cv_attribute_malloc,
3710                [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3711                                [],
3712                                ac_cv_attribute_malloc=yes,
3713                                ac_cv_attribute_malloc=no)])
3715 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3716                ac_cv_attribute_warn_unused,
3717                [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3718                                [],
3719                                ac_cv_attribute_warn_unused=yes,
3720                                ac_cv_attribute_warn_unused=no)])
3722 dnl End of C++ language/feature checks
3723 AC_LANG_C
3725 dnl ========================================================
3726 dnl =  Internationalization checks
3727 dnl ========================================================
3729 dnl Internationalization and Locale support is different
3730 dnl on various UNIX platforms.  Checks for specific i18n
3731 dnl features go here.
3733 dnl check for LC_MESSAGES
3734 AC_CACHE_CHECK(for LC_MESSAGES,
3735                 ac_cv_i18n_lc_messages,
3736                 [AC_TRY_COMPILE([#include <locale.h>],
3737                                 [int category = LC_MESSAGES;],
3738                                 ac_cv_i18n_lc_messages=yes,
3739                                 ac_cv_i18n_lc_messages=no)])
3740 if test "$ac_cv_i18n_lc_messages" = yes; then
3741    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3744 AC_HAVE_FUNCS(localeconv)
3745 fi # ! SKIP_COMPILER_CHECKS
3747 TARGET_XPCOM_ABI=
3748 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3749     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3752 dnl Mozilla specific options
3753 dnl ========================================================
3754 dnl The macros used for command line options
3755 dnl are defined in build/autoconf/altoptions.m4.
3757 dnl If the compiler supports these attributes, define them as
3758 dnl convenience macros.
3759 if test "$ac_cv_attribute_always_inline" = yes ; then
3760   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
3761 else
3762   AC_DEFINE(NS_ALWAYS_INLINE,)
3765 if test "$ac_cv_attribute_malloc" = yes ; then
3766   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3767 else
3768   AC_DEFINE(NS_ATTR_MALLOC,)
3771 if test "$ac_cv_attribute_warn_unused" = yes ; then
3772   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3773 else
3774   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3777 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3778 dnl features that Windows actually does support.
3780 if test -n "$SKIP_COMPILER_CHECKS"; then
3781    dnl Windows has malloc.h
3782    AC_DEFINE(MALLOC_H, [<malloc.h>])
3783    AC_DEFINE(HAVE_FORCEINLINE)
3784    AC_DEFINE(HAVE_LOCALECONV)
3785 fi # SKIP_COMPILER_CHECKS
3787 dnl ========================================================
3788 dnl =
3789 dnl = Check for external package dependencies
3790 dnl =
3791 dnl ========================================================
3792 MOZ_ARG_HEADER(External Packages)
3794 MOZ_ARG_WITH_STRING(libxul-sdk,
3795 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
3796   LIBXUL_SDK_DIR=$withval)
3798 if test "$LIBXUL_SDK_DIR" = "yes"; then
3799     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3800 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3801     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3803     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3804         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3805     fi
3808 AC_SUBST(LIBXUL_SDK)
3810 if test -n "$LIBXUL_SDK"; then
3811     LIBXUL_DIST="$LIBXUL_SDK"
3812 else
3813     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3815 AC_SUBST(LIBXUL_DIST)
3817 SYSTEM_LIBXUL=
3819 MOZ_ARG_WITH_BOOL(system-libxul,
3820 [  --with-system-libxul    Use system installed libxul SDK],
3821     SYSTEM_LIBXUL=1)
3823 dnl ========================================================
3824 dnl = If NSPR was not detected in the system,
3825 dnl = use the one in the source tree (mozilla/nsprpub)
3826 dnl ========================================================
3827 MOZ_ARG_WITH_BOOL(system-nspr,
3828 [  --with-system-nspr      Use system installed NSPR],
3829     _USE_SYSTEM_NSPR=1 )
3831 if test -n "$_USE_SYSTEM_NSPR"; then
3832     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])])
3835 if test -n "$MOZ_NATIVE_NSPR"; then
3836     _SAVE_CFLAGS=$CFLAGS
3837     CFLAGS="$CFLAGS $NSPR_CFLAGS"
3838     AC_TRY_COMPILE([#include "prtypes.h"],
3839                 [#ifndef PR_STATIC_ASSERT
3840                  #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3841                  #endif],
3842                 [MOZ_NATIVE_NSPR=1],
3843                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3844     AC_TRY_COMPILE([#include "prtypes.h"],
3845                 [#ifndef PR_UINT64
3846                  #error PR_UINT64 not defined or requires including prtypes.h
3847                  #endif],
3848                 [MOZ_NATIVE_NSPR=1],
3849                 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3850     CFLAGS=$_SAVE_CFLAGS
3851 else
3852     if test -z "$LIBXUL_SDK"; then
3853         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3854         if test -n "$GNU_CC"; then
3855             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3856         else
3857             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3858         fi
3859     else
3860         NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3861         NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3862     fi
3865 dnl system libevent Support
3866 dnl ========================================================
3867 MOZ_ARG_WITH_STRING(system-libevent,
3868 [  --with-system-libevent=[PFX]
3869                           Use system libevent [installed at prefix PFX]],
3870     LIBEVENT_DIR=$withval)
3872 _SAVE_CFLAGS=$CFLAGS
3873 _SAVE_LDFLAGS=$LDFLAGS
3874 _SAVE_LIBS=$LIBS
3875 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3876     MOZ_NATIVE_LIBEVENT=
3877 else
3878     if test "${LIBEVENT_DIR}" = "yes"; then
3879         LIBEVENT_DIR=/usr
3880     fi
3881     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3882     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3883     MOZ_CHECK_HEADER(event.h,
3884         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3885              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3886          fi],
3887         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3888     AC_CHECK_LIB(event, event_init,
3889                  [MOZ_NATIVE_LIBEVENT=1
3890                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
3891                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3892                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
3894 CFLAGS=$_SAVE_CFLAGS
3895 LDFLAGS=$_SAVE_LDFLAGS
3896 LIBS=$_SAVE_LIBS
3898 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3899 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
3900 AC_SUBST(MOZ_LIBEVENT_LIBS)
3902 dnl ========================================================
3903 dnl = If NSS was not detected in the system,
3904 dnl = use the one in the source tree (mozilla/security/nss)
3905 dnl ========================================================
3907 MOZ_ARG_WITH_BOOL(system-nss,
3908 [  --with-system-nss       Use system installed NSS],
3909     _USE_SYSTEM_NSS=1 )
3911 if test -n "$_USE_SYSTEM_NSS"; then
3912     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])])
3915 if test -n "$MOZ_NATIVE_NSS"; then
3916    NSS_LIBS="$NSS_LIBS -lcrmf"
3917 else
3918    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3919    NSS_DEP_LIBS="\
3920         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3921         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
3922         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
3923         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
3924         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
3926    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
3927        NSS_LIBS="\
3928         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3929         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3930         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3931         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3932         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3933    else
3934        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3935    fi
3938 dnl ======================
3939 dnl Detect yasm
3940 dnl ======================
3942 AC_MSG_CHECKING([for YASM assembler])
3943 AC_CHECK_PROGS(YASM, yasm, "")
3945 if test -n "$YASM"; then
3946   dnl Pull out yasm's version string
3947   changequote(,)
3948   _YASM_VER_FILTER='s|.* \([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*|\1|p'
3949   changequote([,])
3951   YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
3952   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3953   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3954   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3955   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3958 if test -z "$SKIP_LIBRARY_CHECKS"; then
3959 dnl system JPEG support
3960 dnl ========================================================
3961 MOZ_ARG_WITH_STRING(system-jpeg,
3962 [  --with-system-jpeg[=PFX]
3963                           Use system libjpeg [installed at prefix PFX]],
3964     JPEG_DIR=$withval)
3966 _SAVE_CFLAGS=$CFLAGS
3967 _SAVE_LDFLAGS=$LDFLAGS
3968 _SAVE_LIBS=$LIBS
3969 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3970     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3971     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3973 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3974     MOZ_NATIVE_JPEG=
3975 else
3976     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3979 if test "$MOZ_NATIVE_JPEG" = 1; then
3980     AC_TRY_COMPILE([ #include <stdio.h>
3981                      #include <sys/types.h>
3982                      #include <jpeglib.h> ],
3983                    [ #if JPEG_LIB_VERSION < $MOZJPEG
3984                      #error "Insufficient JPEG library version ($MOZJPEG required)."
3985                      #endif ],
3986                    MOZ_NATIVE_JPEG=1,
3987                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3989 CFLAGS=$_SAVE_CFLAGS
3990 LDFLAGS=$_SAVE_LDFLAGS
3991 LIBS=$_SAVE_LIBS
3993 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3994     MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3995     MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3997 fi # SKIP_LIBRARY_CHECKS
3999 dnl system ZLIB support
4000 dnl ========================================================
4001 MOZ_ZLIB_CHECK([1.2.3])
4003 if test "$MOZ_NATIVE_ZLIB" != 1; then
4004     MOZ_ZLIB_CFLAGS=
4005     MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
4008 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
4009     AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4012 if test -z "$SKIP_LIBRARY_CHECKS"; then
4013 dnl system BZIP2 Support
4014 dnl ========================================================
4015 MOZ_ARG_WITH_STRING(system-bz2,
4016 [  --with-system-bz2[=PFX]
4017                           Use system libbz2 [installed at prefix PFX]],
4018     BZ2_DIR=$withval)
4020 _SAVE_CFLAGS=$CFLAGS
4021 _SAVE_LDFLAGS=$LDFLAGS
4022 _SAVE_LIBS=$LIBS
4023 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4024     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4025     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4027 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4028     MOZ_NATIVE_BZ2=
4029 else
4030     AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
4031         [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
4033 CFLAGS=$_SAVE_CFLAGS
4034 LDFLAGS=$_SAVE_LDFLAGS
4035 LIBS=$_SAVE_LIBS
4037 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
4038     MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
4039     MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4042 dnl system PNG Support
4043 dnl ========================================================
4044 MOZ_ARG_WITH_STRING(system-png,
4045 [  --with-system-png[=PFX]
4046                           Use system libpng [installed at prefix PFX]],
4047     PNG_DIR=$withval)
4049 _SAVE_CFLAGS=$CFLAGS
4050 _SAVE_LDFLAGS=$LDFLAGS
4051 _SAVE_LIBS=$LIBS
4052 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4053     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4054     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4056 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4057     MOZ_NATIVE_PNG=
4058 else
4059     AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
4060                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4061     AC_CHECK_LIB(png, png_get_acTL, ,
4062                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
4064 if test "$MOZ_NATIVE_PNG" = 1; then
4065     AC_TRY_COMPILE([ #include <stdio.h>
4066                      #include <sys/types.h>
4067                      #include <png.h> ],
4068                    [ #if PNG_LIBPNG_VER < $MOZPNG
4069                      #error "Insufficient libpng version ($MOZPNG required)."
4070                      #endif
4071                      #ifndef PNG_UINT_31_MAX
4072                      #error "Insufficient libpng version."
4073                      #endif ],
4074                    MOZ_NATIVE_PNG=1,
4075                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4077 CFLAGS=$_SAVE_CFLAGS
4078 LDFLAGS=$_SAVE_LDFLAGS
4079 LIBS=$_SAVE_LIBS
4081 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
4082     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
4083     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
4086 fi # SKIP_LIBRARY_CHECKS
4088 dnl system HunSpell Support
4089 dnl ========================================================
4090 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4091 [  --enable-system-hunspell
4092                           Use system hunspell (located with pkgconfig)],
4093     MOZ_NATIVE_HUNSPELL=1 )
4095 if test -n "$MOZ_NATIVE_HUNSPELL"; then
4096     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4099 AC_SUBST(MOZ_NATIVE_HUNSPELL)
4101 dnl ========================================================
4102 dnl system libffi Support
4103 dnl ========================================================
4104 MOZ_ARG_ENABLE_BOOL(system-ffi,
4105 [  --enable-system-ffi       Use system libffi (located with pkgconfig)],
4106     MOZ_NATIVE_FFI=1 )
4108 if test -n "$MOZ_NATIVE_FFI"; then
4109     # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4110     # for non-GCC compilers.
4111     if test -z "$GNU_CC"; then
4112         PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4113     else
4114         PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4115     fi
4116     MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4119 dnl ========================================================
4120 dnl Java SDK support
4121 dnl ========================================================
4123 JAVA_BIN_PATH=
4124 MOZ_ARG_WITH_STRING(java-bin-path,
4125 [  --with-java-bin-path=dir
4126                           Location of Java binaries (java, javac, jar)],
4127     JAVA_BIN_PATH=$withval)
4129 dnl ========================================================
4130 dnl =
4131 dnl = Application
4132 dnl =
4133 dnl ========================================================
4135 MOZ_ARG_HEADER(Application)
4137 ENABLE_TESTS=1
4138 ENABLE_SYSTEM_EXTENSION_DIRS=1
4139 MOZ_BRANDING_DIRECTORY=
4140 MOZ_OFFICIAL_BRANDING=
4141 MOZ_FEEDS=1
4142 MOZ_FLEXBOX=
4143 MOZ_WEBAPP_RUNTIME=
4144 MOZ_JSDEBUGGER=1
4145 MOZ_AUTH_EXTENSION=1
4146 MOZ_OGG=1
4147 MOZ_RAW=
4148 MOZ_SYDNEYAUDIO=
4149 MOZ_SPEEX_RESAMPLER=1
4150 MOZ_CUBEB=
4151 MOZ_VORBIS=
4152 MOZ_TREMOR=
4153 MOZ_FLOATING_POINT_AUDIO=
4154 MOZ_WAVE=1
4155 MOZ_MEDIA=
4156 MOZ_OPUS=1
4157 MOZ_WEBM=1
4158 MOZ_WEBRTC=1
4159 MOZ_WEBRTC_SIGNALING=
4160 MOZ_MEDIA_PLUGINS=
4161 MOZ_MEDIA_NAVIGATOR=
4162 MOZ_OMX_PLUGIN=
4163 MOZ_VP8=
4164 MOZ_VP8_ERROR_CONCEALMENT=
4165 MOZ_VP8_ENCODER=
4166 VPX_AS=
4167 VPX_ASFLAGS=
4168 VPX_AS_DASH_C_FLAG=
4169 VPX_AS_CONVERSION=
4170 VPX_ASM_SUFFIX=
4171 VPX_X86_ASM=
4172 VPX_ARM_ASM=
4173 LIBJPEG_TURBO_AS=
4174 LIBJPEG_TURBO_ASFLAGS=
4175 LIBJPEG_TURBO_X86_ASM=
4176 LIBJPEG_TURBO_X64_ASM=
4177 LIBJPEG_TURBO_ARM_ASM=
4178 MOZ_PANGO=1
4179 MOZ_PERMISSIONS=1
4180 MOZ_PLACES=1
4181 MOZ_PREF_EXTENSIONS=1
4182 MOZ_PROFILELOCKING=1
4183 MOZ_PSM=1
4184 MOZ_REFLOW_PERF=
4185 MOZ_SAFE_BROWSING=
4186 MOZ_HELP_VIEWER=
4187 MOZ_SPELLCHECK=1
4188 MOZ_JAVA_COMPOSITOR=
4189 MOZ_ONLY_TOUCH_EVENTS=
4190 MOZ_TOOLKIT_SEARCH=1
4191 MOZ_UI_LOCALE=en-US
4192 MOZ_UNIVERSALCHARDET=1
4193 MOZ_URL_CLASSIFIER=
4194 MOZ_XTF=1
4195 MOZ_XUL=1
4196 MOZ_ZIPWRITER=1
4197 NS_PRINTING=1
4198 MOZ_PDF_PRINTING=
4199 MOZ_DISABLE_DOMCRYPTO=
4200 NSS_DISABLE_DBM=
4201 NECKO_WIFI=1
4202 NECKO_COOKIES=1
4203 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4204 USE_ARM_KUSER=
4205 BUILD_CTYPES=1
4206 MOZ_USE_NATIVE_POPUP_WINDOWS=
4207 MOZ_ANDROID_HISTORY=
4208 MOZ_WEBSMS_BACKEND=
4209 MOZ_GRAPHITE=1
4210 ACCESSIBILITY=1
4211 MOZ_SYS_MSG=
4213 case "$target_os" in
4214     mingw*)
4215         NS_ENABLE_TSF=1
4216         AC_DEFINE(NS_ENABLE_TSF)
4217         ;;
4218 esac
4220 case "${target}" in
4221     *-android*|*-linuxandroid*)
4222         if test "$CPU_ARCH" = "arm" ; then
4223           USE_ARM_KUSER=1
4224         fi
4226         NSS_DISABLE_DBM=1
4227         NECKO_WIFI=
4228         MOZ_THEME_FASTSTRIPE=1
4229         MOZ_TREE_FREETYPE=1
4230         MOZ_MEMORY=1
4231         MOZ_RAW=1
4232         ;;
4234 esac
4236 MOZ_ARG_ENABLE_STRING(application,
4237 [  --enable-application=APP
4238                           Options include:
4239                             browser (Firefox)
4240                             xulrunner
4241                             tools/update-packaging (AUS-related packaging tools)],
4242 [ MOZ_BUILD_APP=$enableval ] )
4244 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4245 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4246   XULRUNNER_STUB_NAME=$withval)
4248 if test -z "$XULRUNNER_STUB_NAME"; then
4249   case "$target_os" in
4250   darwin*)
4251     XULRUNNER_STUB_NAME=xulrunner
4252     ;;
4253   *)
4254     XULRUNNER_STUB_NAME=xulrunner-stub
4255   esac
4257 AC_SUBST(XULRUNNER_STUB_NAME)
4259 AC_MSG_CHECKING([for application to build])
4260 if test -z "$MOZ_BUILD_APP"; then
4261   AC_MSG_RESULT([browser])
4262   MOZ_BUILD_APP=browser
4263 else
4264   # default mobile to be mobile/xul
4265   if test "$MOZ_BUILD_APP" = "mobile" ; then
4266     MOZ_BUILD_APP=mobile/xul
4267   fi
4268   # We have a valid application only if it has a build.mk file in its top
4269   # directory.
4270   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4271     AC_MSG_RESULT([none])
4272     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4273   else
4274     AC_MSG_RESULT([$MOZ_BUILD_APP])
4275   fi
4278 # Allow the application to influence configure with a confvars.sh script.
4280 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4281 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4282   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4283   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4284 else
4285   AC_MSG_RESULT([no])
4288 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4289 MOZ_ARG_WITH_STRING(app-name,
4290 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4291 WITH_APP_NAME=$withval,
4294 if test -n "$WITH_APP_NAME" ; then
4295     MOZ_APP_NAME="$WITH_APP_NAME"
4298 MOZ_ARG_WITH_STRING(app-basename,
4299 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4300 WITH_APP_BASENAME=$withval,
4303 if test -n "$WITH_APP_BASENAME" ; then
4304     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4307 # Now is a good time to test for logic errors, define mismatches, etc.
4308 case "$MOZ_BUILD_APP" in
4309 xulrunner)
4310   if test "$LIBXUL_SDK"; then
4311     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4312   fi
4313   ;;
4314 esac
4316 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4317 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4318 # MOZ_BUILD_APP.
4319 case "$MOZ_BUILD_APP" in
4320 browser)
4321   AC_DEFINE(MOZ_PHOENIX)
4322   ;;
4324 xulrunner)
4325   AC_DEFINE(MOZ_XULRUNNER)
4326   ;;
4327 esac
4329 AC_SUBST(MOZ_BUILD_APP)
4330 AC_SUBST(MOZ_PHOENIX)
4331 AC_SUBST(MOZ_XULRUNNER)
4333 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4335 dnl ========================================================
4336 dnl Check android sdk version depending on mobile target
4337 dnl ========================================================
4339 if test -z "$gonkdir" ; then
4340     # Minimum Android SDK API Level we require.
4341     case "$MOZ_BUILD_APP" in
4342     mobile/xul)
4343         android_min_api_level=13
4344         ;;
4345     mobile/android)
4346         android_min_api_level=14
4347         ;;
4348     esac
4350     MOZ_ANDROID_SDK($android_min_api_level)
4353 dnl ========================================================
4354 dnl =
4355 dnl = Toolkit Options
4356 dnl =
4357 dnl ========================================================
4358 MOZ_ARG_HEADER(Toolkit Options)
4360     dnl ========================================================
4361     dnl = Select the default toolkit
4362     dnl ========================================================
4363         MOZ_ARG_ENABLE_STRING(default-toolkit,
4364         [  --enable-default-toolkit=TK
4365                           Select default toolkit
4366                           Platform specific defaults:
4367                             Mac OS X - cairo-cocoa
4368                             OS/2 - cairo-os2
4369                             Win32 - cairo-windows
4370                             * - cairo-gtk2
4371                             * - cairo-qt],
4372     [ _DEFAULT_TOOLKIT=$enableval ],
4373     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4375     if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4376         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4377         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4378         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4379         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4380         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4381         -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4382         -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4383         -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4384     then
4385         dnl nglayout only supports building with one toolkit,
4386         dnl so ignore everything after the first comma (",").
4387         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4388     else
4389         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4390     fi
4392 MOZ_ARG_WITHOUT_BOOL(x,
4393 [  --without-x              Build without X11],
4394     WITHOUT_X11=1)
4396 dnl ========================================================
4397 dnl = Enable the toolkit as needed                         =
4398 dnl ========================================================
4400 case "$MOZ_WIDGET_TOOLKIT" in
4402 cairo-windows)
4403     MOZ_WIDGET_TOOLKIT=windows
4404     MOZ_WEBGL=1
4405     MOZ_PDF_PRINTING=1
4406     MOZ_INSTRUMENT_EVENT_LOOP=1
4407     ;;
4409 cairo-gtk2|cairo-gtk2-x11)
4410     MOZ_WIDGET_TOOLKIT=gtk2
4411     MOZ_ENABLE_GTK2=1
4412     MOZ_ENABLE_XREMOTE=1
4413     MOZ_WEBGL=1
4414     MOZ_GL_DEFAULT_PROVIDER=GLX
4416     AC_DEFINE(MOZ_X11)
4417     MOZ_X11=1
4418     USE_FC_FREETYPE=1
4420     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4421     TK_LIBS='$(MOZ_GTK2_LIBS)'
4422     AC_DEFINE(MOZ_WIDGET_GTK2)
4423     AC_DEFINE(MOZ_WIDGET_GTK,2)
4424     MOZ_PDF_PRINTING=1
4425     MOZ_INSTRUMENT_EVENT_LOOP=1
4426     ;;
4428 cairo-qt)
4429     MOZ_WIDGET_TOOLKIT=qt
4430     MOZ_ENABLE_QT=1
4431     if test -z "$WITHOUT_X11"; then
4432       MOZ_ENABLE_XREMOTE=1
4433       MOZ_GL_DEFAULT_PROVIDER=GLX
4434       MOZ_X11=1
4435       AC_DEFINE(MOZ_X11)
4436       XT_LIBS=
4437     fi
4439     MOZ_WEBGL=1
4440     USE_ELF_DYNSTR_GC=
4441     USE_FC_FREETYPE=1
4442     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4443     TK_LIBS='$(MOZ_QT_LIBS)'
4444     AC_DEFINE(MOZ_WIDGET_QT)
4445     MOZ_PDF_PRINTING=1
4446     ;;
4448 cairo-os2)
4449     MOZ_WIDGET_TOOLKIT=os2
4450     USE_FC_FREETYPE=1
4451     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4452     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4453     MOZ_PDF_PRINTING=1
4454     ;;
4456 cairo-cocoa)
4457     MOZ_WIDGET_TOOLKIT=cocoa
4458     AC_DEFINE(MOZ_WIDGET_COCOA)
4459     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4460     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4461     TK_CFLAGS="-DNO_X11"
4462     CFLAGS="$CFLAGS $TK_CFLAGS"
4463     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4464     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4465     MOZ_USER_DIR="Mozilla"
4466     MOZ_FS_LAYOUT=bundle
4467     MOZ_WEBGL=1
4468     MOZ_INSTRUMENT_EVENT_LOOP=1
4469     ;;
4471 cairo-uikit)
4472     MOZ_WIDGET_TOOLKIT=uikit
4473     AC_DEFINE(MOZ_WIDGET_UIKIT)
4474     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4475     TK_CFLAGS="-DNO_X11"
4476     TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4477     CFLAGS="$CFLAGS $TK_CFLAGS"
4478     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4479     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4480     MOZ_USER_DIR="Mozilla"
4481     MOZ_FS_LAYOUT=bundle
4482     ;;
4484 cairo-android)
4485     AC_DEFINE(MOZ_WIDGET_ANDROID)
4486     MOZ_WIDGET_TOOLKIT=android
4487     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4488     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4489     MOZ_WEBGL=1
4490     MOZ_PDF_PRINTING=1
4491     MOZ_INSTRUMENT_EVENT_LOOP=1
4492     if test "$MOZ_BUILD_APP" = "mobile/xul"; then
4493         MOZ_OLD_LINKER=1
4494     fi
4495     ;;
4497 cairo-gonk)
4498     AC_DEFINE(MOZ_WIDGET_GONK)
4499     AC_DEFINE(MOZ_TOUCH)
4500     MOZ_WIDGET_TOOLKIT=gonk
4501     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4502     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4503     MOZ_WEBGL=1
4504     MOZ_PDF_PRINTING=1
4505     MOZ_TOUCH=1
4506     ;;
4508 esac
4510 AC_SUBST(MOZ_OLD_LINKER)
4511 AC_SUBST(MOZ_PDF_PRINTING)
4512 if test "$MOZ_PDF_PRINTING"; then
4513    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4514    AC_DEFINE(MOZ_PDF_PRINTING)
4517 if test "$MOZ_ENABLE_XREMOTE"; then
4518     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4521 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4522    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4525 if test "$COMPILE_ENVIRONMENT"; then
4526   if test "$MOZ_ENABLE_GTK2"; then
4527     if test "$MOZ_X11"; then
4528       GDK_PACKAGES=gdk-x11-2.0
4529     fi
4531     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4532   fi
4534 fi # COMPILE_ENVIRONMENT
4536 AC_SUBST(MOZ_FS_LAYOUT)
4538 dnl ========================================================
4539 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4540 dnl their usage and use them in spidermonkey.
4541 dnl ========================================================
4542 MOZ_ARG_WITH_BOOL(arm-kuser,
4543 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4544     USE_ARM_KUSER=1,)
4545 if test -n "$USE_ARM_KUSER"; then
4546    AC_DEFINE(USE_ARM_KUSER)
4549 dnl ========================================================
4550 dnl = startup-notification support module
4551 dnl ========================================================
4553 if test "$MOZ_ENABLE_GTK2"
4554 then
4555     MOZ_ENABLE_STARTUP_NOTIFICATION=
4557     MOZ_ARG_ENABLE_BOOL(startup-notification,
4558     [  --enable-startup-notification
4559                           Enable startup-notification support (default: disabled) ],
4560         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4561         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4562     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4563     then
4564         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4565                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4566         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4567             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4568             then
4569                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4570             fi
4571             MOZ_ENABLE_STARTUP_NOTIFICATION=
4572         ])
4573     fi
4575     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4576         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4577     fi
4579     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4581 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4582 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4583 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4585 dnl ========================================================
4586 dnl = QT support
4587 dnl ========================================================
4588 if test "$MOZ_ENABLE_QT"
4589 then
4590     MOZ_ARG_WITH_STRING(qtdir,
4591     [  --with-qtdir=\$dir       Specify Qt directory ],
4592     [ QTDIR=$withval])
4594     if test -z "$QTDIR"; then
4595         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
4596         PKG_CHECK_MODULES(MOZ_QT5, QtWidgets QtMultimedia QtPrintSupport,
4597                       MOZ_ENABLE_QT5=1,
4598                       MOZ_ENABLE_QT5=)
4599         if test "$MOZ_ENABLE_QT5"; then
4600             echo "Using qt5"
4601             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
4602             MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
4603         fi
4605         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4606         AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4607     else
4608         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4610         MOZ_QT_CFLAGS="-DQT_SHARED"
4611         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4612         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4613         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4614         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4615         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4616         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4617         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4618         HOST_MOC="$QTDIR/bin/moc"
4619         HOST_RCC="$QTDIR/bin/rcc"
4621         # QtWidgets was introduced only in Qt5
4622         if test -d $QTDIR/include/QtWidgets; then
4623             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4624             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4625             MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtWidgets -lQtPrintSupport"
4626         fi
4627     fi
4628     if test -z "$HOST_MOC"; then
4629         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4630 incorrect])
4631     fi
4632     if test -z "$HOST_RCC"; then
4633         AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4634 incorrect])
4635     fi
4637     MOC=$HOST_MOC
4638     RCC=$HOST_RCC
4640     MOZ_ENABLE_QMSYSTEM2=
4641     PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4642                       MOZ_ENABLE_QMSYSTEM2=1,
4643                       MOZ_ENABLE_QMSYSTEM2=)
4645     if test "$MOZ_ENABLE_QMSYSTEM2"; then
4646       MOZ_ENABLE_QMSYSTEM2=1
4647       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4648       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4649       AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4650     fi
4652     MOZ_ENABLE_QTNETWORK=
4653     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4654                       MOZ_ENABLE_QTNETWORK=1,
4655                       MOZ_ENABLE_QTNETWORK=)
4657     if test "$MOZ_ENABLE_QTNETWORK"; then
4658       MOZ_ENABLE_QTNETWORK=1
4659       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4660     fi
4662     MOZ_ENABLE_QTMOBILITY=
4663     PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4664                       MOZ_ENABLE_QTMOBILITY=1,
4665                       MOZ_ENABLE_QTMOBILITY=)
4666     if test "$MOZ_ENABLE_QTMOBILITY"; then
4667        MOZ_ENABLE_QTMOBILITY=1
4668        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4669        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4670     else
4671        AC_CHECK_LIB(QtSensors, main, [
4672           MOZ_ENABLE_QTMOBILITY=1
4673           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4674           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4675           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4676           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4677           MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4678        ])
4679     fi
4680     if test "$MOZ_ENABLE_QTMOBILITY"; then
4681        AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4682     fi
4685 AC_SUBST(GTK_CONFIG)
4686 AC_SUBST(TK_CFLAGS)
4687 AC_SUBST(TK_LIBS)
4689 AC_SUBST(MOZ_ENABLE_GTK2)
4690 AC_SUBST(MOZ_ENABLE_QT)
4691 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4692 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4693 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4694 AC_SUBST(MOZ_ENABLE_XREMOTE)
4695 AC_SUBST(MOZ_GTK2_CFLAGS)
4696 AC_SUBST(MOZ_GTK2_LIBS)
4697 AC_SUBST(MOZ_QT_CFLAGS)
4698 AC_SUBST(MOZ_QT_LIBS)
4700 AC_SUBST(MOC)
4701 AC_SUBST(RCC)
4703 AC_SUBST(MOZ_X11)
4705 dnl ========================================================
4706 dnl =
4707 dnl = Components & Features
4708 dnl =
4709 dnl ========================================================
4710 MOZ_ARG_HEADER(Components and Features)
4712 dnl ========================================================
4713 dnl = Localization
4714 dnl ========================================================
4715 MOZ_ARG_ENABLE_STRING(ui-locale,
4716 [  --enable-ui-locale=ab-CD
4717                           Select the user interface locale (default: en-US)],
4718     MOZ_UI_LOCALE=$enableval )
4719 AC_SUBST(MOZ_UI_LOCALE)
4721 dnl ========================================================
4722 dnl = Trademarked Branding
4723 dnl ========================================================
4724 MOZ_ARG_ENABLE_BOOL(official-branding,
4725 [  --enable-official-branding
4726                           Enable Official mozilla.org Branding
4727                           Do not distribute builds with
4728                           --enable-official-branding unless you have
4729                           permission to use trademarks per
4730                           http://www.mozilla.org/foundation/trademarks/ .],
4732   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4733     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4734   else
4735     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4736     MOZ_OFFICIAL_BRANDING=1
4737   fi
4738 ], MOZ_OFFICIAL_BRANDING=)
4740 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4741 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4742   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4745 MOZ_ARG_WITH_STRING(branding,
4746 [  --with-branding=dir     Use branding from the specified directory.],
4747     MOZ_BRANDING_DIRECTORY=$withval)
4749 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4750 if test -z "$REAL_BRANDING_DIRECTORY"; then
4751   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4754 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4755   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4758 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4760 dnl ========================================================
4761 dnl = Distribution ID
4762 dnl ========================================================
4763 MOZ_ARG_WITH_STRING(distribution-id,
4764 [  --with-distribution-id=ID
4765                           Set distribution-specific id (default=org.mozilla)],
4766 [ val=`echo $withval`
4767     MOZ_DISTRIBUTION_ID="$val"])
4769 if test -z "$MOZ_DISTRIBUTION_ID"; then
4770    MOZ_DISTRIBUTION_ID="org.mozilla"
4773 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4774 AC_SUBST(MOZ_DISTRIBUTION_ID)
4777 dnl ========================================================
4778 dnl complex text support off by default
4779 dnl ========================================================
4780 MOZ_ARG_DISABLE_BOOL(pango,
4781 [  --disable-pango         Disable usage of Pango ],
4782     MOZ_PANGO=,
4783     MOZ_PANGO=1)
4785 dnl ========================================================
4786 dnl = Pango
4787 dnl ========================================================
4788 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4789 then
4790     AC_SUBST(MOZ_PANGO)
4792     if test "$MOZ_PANGO"
4793     then
4794         PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4796         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4797         AC_SUBST(MOZ_PANGO_CFLAGS)
4798         AC_SUBST(MOZ_PANGO_LIBS)
4799         AC_DEFINE(MOZ_PANGO)
4800     else
4801         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
4802         AC_SUBST(FT2_CFLAGS)
4803         AC_SUBST(FT2_LIBS)
4804     fi
4807 dnl ========================================================
4808 dnl = GnomeVFS, GIO and GConf support module
4809 dnl ========================================================
4811 if test "$MOZ_X11"
4812 then
4813     dnl build the gnomevfs extension by default only when the
4814     dnl GTK2 toolkit is in use.
4815     if test "$MOZ_ENABLE_GTK2"
4816     then
4817         MOZ_ENABLE_GNOMEVFS=1
4818         MOZ_ENABLE_GCONF=1
4819     fi
4821     dnl ========================================================
4822     dnl = GnomeVFS support module
4823     dnl ========================================================
4824     MOZ_ARG_DISABLE_BOOL(gnomevfs,
4825     [  --disable-gnomevfs      Disable GnomeVFS support ],
4826         MOZ_ENABLE_GNOMEVFS=,
4827         MOZ_ENABLE_GNOMEVFS=force)
4829     if test "$MOZ_ENABLE_GNOMEVFS"
4830     then
4831         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4832             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4833             MOZ_ENABLE_GNOMEVFS=1
4834             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4835         ],[
4836             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4837             then
4838                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4839             fi
4840             MOZ_ENABLE_GNOMEVFS=
4841         ])
4842     else
4843         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
4844             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4845               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4846             ])
4847         fi
4848     fi
4850     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4851     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4852     AC_SUBST(MOZ_GNOMEVFS_LIBS)
4854     dnl ========================================================
4855     dnl = GIO support module
4856     dnl ========================================================
4857     MOZ_ARG_ENABLE_BOOL(gio,
4858     [  --enable-gio            Enable GIO support (default: disabled)],
4859         MOZ_ENABLE_GIO=force,
4860         MOZ_ENABLE_GIO=)
4862     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
4863     then
4864         PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4865                           [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4866         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4867             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4868             MOZ_ENABLE_GIO=1
4869             AC_DEFINE(MOZ_ENABLE_GIO)
4870         ],[
4871             if test "$MOZ_ENABLE_GIO" = "force"
4872             then
4873                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4874             fi
4875             MOZ_ENABLE_GIO=
4876         ])
4877     fi
4879     AC_SUBST(MOZ_ENABLE_GIO)
4880     AC_SUBST(MOZ_GIO_CFLAGS)
4881     AC_SUBST(MOZ_GIO_LIBS)
4883     dnl ========================================================
4884     dnl = GConf support module
4885     dnl ========================================================
4886     MOZ_ARG_DISABLE_BOOL(gconf,
4887     [  --disable-gconf      Disable Gconf support ],
4888         MOZ_ENABLE_GCONF=,
4889         MOZ_ENABLE_GCONF=force)
4891     if test "$MOZ_ENABLE_GCONF"
4892     then
4893         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4894             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4895             MOZ_ENABLE_GCONF=1
4896         ],[
4897             if test "$MOZ_ENABLE_GCONF" = "force"
4898             then
4899                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4900             fi
4901             MOZ_ENABLE_GCONF=
4902         ])
4903     fi
4905     if test "$MOZ_ENABLE_GCONF"; then
4906         AC_DEFINE(MOZ_ENABLE_GCONF)
4907     fi
4909     AC_SUBST(MOZ_ENABLE_GCONF)
4910     AC_SUBST(MOZ_GCONF_CFLAGS)
4911     AC_SUBST(MOZ_GCONF_LIBS)
4914 dnl ========================================================
4915 dnl = libproxy support
4916 dnl ========================================================
4918 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4919 then
4920     MOZ_ENABLE_LIBPROXY=
4922     MOZ_ARG_ENABLE_BOOL(libproxy,
4923     [  --enable-libproxy         Enable libproxy support ],
4924     MOZ_ENABLE_LIBPROXY=1,
4925     MOZ_ENABLE_LIBPROXY=)
4927     if test "$MOZ_ENABLE_LIBPROXY"
4928     then
4929         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4930         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4931     fi
4933 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4934 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
4935 AC_SUBST(MOZ_LIBPROXY_LIBS)
4937 dnl ========================================================
4938 dnl = libnotify support
4939 dnl ========================================================
4941 if test "$MOZ_ENABLE_GTK2"
4942 then
4943     MOZ_ENABLE_LIBNOTIFY=1
4945     MOZ_ARG_DISABLE_BOOL(libnotify,
4946     [  --disable-libnotify     Disable libnotify support ],
4947     MOZ_ENABLE_LIBNOTIFY=,
4948     MOZ_ENABLE_LIBNOTIFY=1)
4950     if test "$MOZ_ENABLE_LIBNOTIFY"
4951     then
4952         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
4953     fi
4956 if test -z "$SKIP_LIBRARY_CHECKS"
4957 then
4958     if test "$MOZ_ENABLE_GTK2"
4959     then
4960         if test "$MOZ_ENABLE_LIBNOTIFY"
4961         then
4962             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
4963         fi
4964     fi
4966 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
4967 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
4968 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
4970 dnl ========================================================
4971 dnl = GNOME component (mozgnome)
4972 dnl ========================================================
4974 # The GNOME component is built if one of
4975 # gnome-vfs, gio, gconf or libnotify is available.
4976 if test "$MOZ_ENABLE_GCONF" -o \
4977    "$MOZ_ENABLE_GNOMEVFS" -o \
4978    "$MOZ_ENABLE_GIO" -o \
4979    "$MOZ_ENABLE_LIBNOTIFY"; then
4980     MOZ_ENABLE_GNOME_COMPONENT=1
4981 else
4982     MOZ_ENABLE_GNOME_COMPONENT=
4984 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4986 dnl ========================================================
4987 dnl = libgnomeui support module
4988 dnl ========================================================
4990 if test "$MOZ_ENABLE_GTK2"
4991 then
4992     MOZ_ENABLE_GNOMEUI=1
4994     MOZ_ARG_DISABLE_BOOL(gnomeui,
4995     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
4996         MOZ_ENABLE_GNOMEUI=,
4997         MOZ_ENABLE_GNOMEUI=force)
4999     if test "$MOZ_ENABLE_GNOMEUI"
5000     then
5001         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5002         [
5003             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5004             MOZ_ENABLE_GNOMEUI=1
5005         ],[
5006             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5007             then
5008                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5009             fi
5010             MOZ_ENABLE_GNOMEUI=
5011         ])
5012     fi
5014     if test "$MOZ_ENABLE_GNOMEUI"; then
5015         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5016     fi
5019 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5020 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5021 AC_SUBST(MOZ_GNOMEUI_LIBS)
5023 dnl ========================================================
5024 dnl = dbus support
5025 dnl ========================================================
5027 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5028 then
5029     MOZ_ENABLE_DBUS=1
5031     MOZ_ARG_DISABLE_BOOL(dbus,
5032     [  --disable-dbus          Disable dbus support ],
5033         MOZ_ENABLE_DBUS=,
5034         MOZ_ENABLE_DBUS=1)
5036     if test "$MOZ_ENABLE_DBUS"
5037     then
5038         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5039         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5040         AC_DEFINE(MOZ_ENABLE_DBUS)
5041     fi
5043 AC_SUBST(MOZ_ENABLE_DBUS)
5044 AC_SUBST(MOZ_DBUS_CFLAGS)
5045 AC_SUBST(MOZ_DBUS_LIBS)
5046 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5047 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5049 dnl ========================================================
5050 dnl = Enable Android History instead of Places
5051 dnl ========================================================
5052 if test -n "$MOZ_ANDROID_HISTORY"; then
5053      dnl Do this if defined in confvars.sh
5054      AC_DEFINE(MOZ_ANDROID_HISTORY)
5058 dnl ========================================================
5059 dnl = Build with the Android Java compositor
5060 dnl ========================================================
5061 if test -n "$MOZ_JAVA_COMPOSITOR"; then
5062      dnl Do this if defined in confvars.sh
5063      AC_DEFINE(MOZ_JAVA_COMPOSITOR)
5066 dnl ========================================================
5067 dnl = Disable WebSMS backend
5068 dnl ========================================================
5069 MOZ_ARG_DISABLE_BOOL(websms-backend,
5070 [  --disable-websms-backend
5071                            Disable WebSMS backend],
5072     MOZ_WEBSMS_BACKEND=,
5073     MOZ_WEBSMS_BACKEND=1)
5075 if test -n "$MOZ_WEBSMS_BACKEND"; then
5076     AC_DEFINE(MOZ_WEBSMS_BACKEND)
5079 dnl ========================================================
5080 dnl = Build Personal Security Manager
5081 dnl ========================================================
5082 MOZ_ARG_DISABLE_BOOL(crypto,
5083 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5084     MOZ_PSM=,
5085     MOZ_PSM=1 )
5087 dnl ========================================================
5088 dnl = JS Debugger XPCOM component (js/jsd)
5089 dnl ========================================================
5090 MOZ_ARG_DISABLE_BOOL(jsd,
5091 [  --disable-jsd           Disable JavaScript debug library],
5092     MOZ_JSDEBUGGER=,
5093     MOZ_JSDEBUGGER=1)
5096 dnl ========================================================
5097 dnl = Enable IPDL's "expensive" unit tests
5098 dnl ========================================================
5099 MOZ_IPDL_TESTS=
5101 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5102 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5103     MOZ_IPDL_TESTS=1,
5104     MOZ_IPDL_TESTS=)
5106 if test -n "$MOZ_IPDL_TESTS"; then
5107     AC_DEFINE(MOZ_IPDL_TESTS)
5110 AC_SUBST(MOZ_IPDL_TESTS)
5112 dnl ========================================================
5113 dnl = Turns off code necessary for e10s compatibility
5114 dnl ========================================================
5115 dnl This is a temporary flag to be removed in bug 662601 when
5116 dnl it's no longer needed
5118 MOZ_E10S_COMPAT=
5120 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5121 [  --enable-e10s-compat     Turns off code for e10s compat],
5122     MOZ_E10S_COMPAT=1,
5123     MOZ_E10S_COMPAT=)
5125 if test -n "$MOZ_E10S_COMPAT"; then
5126     AC_DEFINE(MOZ_E10S_COMPAT)
5129 dnl ========================================================
5130 dnl = Disable building dbm
5131 dnl ========================================================
5132 MOZ_ARG_DISABLE_BOOL(dbm,
5133 [  --disable-dbm           Disable building dbm],
5134     NSS_DISABLE_DBM=1,
5135     NSS_DISABLE_DBM=)
5137 dnl bi-directional support always on
5138 IBMBIDI=1
5139 AC_DEFINE(IBMBIDI)
5141 dnl ========================================================
5142 dnl accessibility support on by default on all platforms
5143 dnl ========================================================
5144 MOZ_ARG_DISABLE_BOOL(accessibility,
5145 [  --disable-accessibility Disable accessibility support],
5146     ACCESSIBILITY=,
5147     ACCESSIBILITY=1 )
5148 if test "$ACCESSIBILITY"; then
5149     AC_DEFINE(ACCESSIBILITY)
5152 dnl ========================================================
5153 dnl Disable printing
5154 dnl ========================================================
5155 MOZ_ARG_DISABLE_BOOL(printing,
5156 [  --disable-printing      Disable printing support],
5157     NS_PRINTING=,
5158     NS_PRINTING=1)
5160 if test "$NS_PRINTING"; then
5161     AC_DEFINE(NS_PRINTING)
5162     AC_DEFINE(NS_PRINT_PREVIEW)
5165 dnl Turn off webrtc for OS's we don't handle yet, but allow 
5166 dnl --enable-webrtc to override.  Can disable for everything in
5167 dnl the master list above.
5168 if test -n "$MOZ_WEBRTC"; then
5169     case "$target" in
5170     *-android*|*-linuxandroid*)
5171         dnl Make sure doesn't get matched by *-linux*
5172         MOZ_WEBRTC=
5173         ;;
5174     *-linux*|*-mingw*|*-darwin*)
5175         dnl Leave enabled
5176         ;;
5177     *)
5178         dnl default to disabled for all others
5179         MOZ_WEBRTC=
5180         ;;
5181     esac
5184 dnl ========================================================
5185 dnl = Disable WebRTC code
5186 dnl ========================================================
5187 MOZ_ARG_DISABLE_BOOL(webrtc,
5188 [  --disable-webrtc        Disable support for WebRTC],
5189     MOZ_WEBRTC=,
5190     MOZ_WEBRTC=1)
5192 if test -n "$MOZ_WEBRTC"; then
5193     AC_DEFINE(MOZ_WEBRTC)
5194     MOZ_MEDIA=1
5195     MOZ_RAW=1
5196     MOZ_VP8=1
5197     MOZ_VP8_ENCODER=1
5198     MOZ_VP8_ERROR_CONCEALMENT=1
5201 AC_SUBST(MOZ_WEBRTC)
5203 dnl ========================================================
5204 dnl = Disable floating point audio.
5205 dnl ========================================================
5206 MOZ_ARG_DISABLE_BOOL(floating-point,
5207 [ --disable-floating-point     Disable floating point audio],
5208     MOZ_FLOATING_POINT_AUDIO=,
5209     MOZ_FLOATING_POINT_AUDIO=1)
5212 case "$target_cpu" in
5213 arm*)
5216     AC_DEFINE(MOZ_FLOATING_POINT_AUDIO)
5217     MOZ_FLOATING_POINT_AUDIO=1
5219 esac
5221 dnl ========================================================
5222 dnl = Enable Raw Codecs
5223 dnl ========================================================
5224 MOZ_ARG_ENABLE_BOOL(raw,
5225 [  --enable-raw           Enable support for RAW media],
5226     MOZ_RAW=1,
5227     MOZ_RAW=)
5229 if test -n "$MOZ_RAW"; then
5230     AC_DEFINE(MOZ_RAW)
5231     MOZ_MEDIA=1
5234 AC_SUBST(MOZ_RAW)
5236 dnl ========================================================
5237 dnl = Disable Ogg Codecs
5238 dnl ========================================================
5239 MOZ_ARG_DISABLE_BOOL(ogg,
5240 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5241     MOZ_OGG=,
5242     MOZ_OGG=1)
5244 if test -n "$MOZ_OGG"; then
5245     AC_DEFINE(MOZ_OGG)
5246     MOZ_SYDNEYAUDIO=1
5247     MOZ_CUBEB=1
5248     MOZ_MEDIA=1
5250     dnl Checks for __attribute__(aligned()) directive
5251     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5252         [ac_cv_c_attribute_aligned],
5253         [ac_cv_c_attribute_aligned=0
5254          CFLAGS_save="${CFLAGS}"
5255          CFLAGS="${CFLAGS} -Werror"
5256          for ac_cv_c_attr_align_try in 64 32 16 8; do
5257            echo "trying $ac_cv_c_attr_align_try"
5258            AC_TRY_COMPILE([],
5259                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5260                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5261            if test "$ac_cv_c_attribute_aligned" != 0; then
5262              break;
5263            fi
5264          done
5265            CFLAGS="${CFLAGS_save}"])
5266     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5267       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5268                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5269     fi
5272 dnl ========================================================
5273 dnl = Disable Opus audio codec support
5274 dnl ========================================================
5275 MOZ_ARG_DISABLE_BOOL(opus,
5276 [  --disable-opus          Disable support for Opus audio],
5277     MOZ_OPUS=,
5278     MOZ_OPUS=1)
5280 dnl ========================================================
5281 dnl = Disable VP8 decoder support
5282 dnl ========================================================
5283 MOZ_ARG_DISABLE_BOOL(webm,
5284 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5285     MOZ_WEBM=,
5286     MOZ_WEBM=1)
5288 if test -n "$MOZ_WEBM"; then
5289     AC_DEFINE(MOZ_WEBM)
5290     MOZ_VP8=1
5293 dnl ========================================================
5294 dnl = Disable media plugin support
5295 dnl ========================================================
5296 MOZ_ARG_ENABLE_BOOL(media-plugins,
5297 [  --enable-media-plugins  Enable support for media plugins],
5298     MOZ_MEDIA_PLUGINS=1,
5299     MOZ_MEDIA_PLUGINS=)
5301 if test -n "$MOZ_MEDIA_PLUGINS"; then
5302   AC_DEFINE(MOZ_MEDIA_PLUGINS)
5305 dnl ========================================================
5306 dnl = Enable getUserMedia support
5307 dnl ========================================================
5308 MOZ_ARG_ENABLE_BOOL(media-navigator,
5309 [  --enable-media-navigator  Enable support for getUserMedia],
5310     MOZ_MEDIA_NAVIGATOR=1,
5311     MOZ_MEDIA_NAVIGATOR=)
5313 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5314   AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5317 dnl ========================================================
5318 dnl = Enable building OMX media plugin (B2G)
5319 dnl ========================================================
5320 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5321 [  --enable-omx-plugin      Enable building OMX plugin (B2G)],
5322     MOZ_OMX_PLUGIN=1,
5323     MOZ_OMX_PLUGIN=)
5325 if test -n "$MOZ_OMX_PLUGIN"; then
5326     if test "$OS_TARGET" = "Android" -a -n "$gonkdir"; then
5327         dnl Only allow building OMX plugin on Gonk (B2G)
5328         AC_DEFINE(MOZ_OMX_PLUGIN)
5329     else
5330        dnl fail if we're not building on Gonk
5331        AC_MSG_ERROR([OMX media plugin can only be built on B2G])
5332     fi
5335 dnl system libvpx Support
5336 dnl ========================================================
5337 MOZ_ARG_WITH_BOOL(system-libvpx,
5338 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
5339     MOZ_NATIVE_LIBVPX=1)
5341 MOZ_LIBVPX_CFLAGS=
5342 MOZ_LIBVPX_LIBS=
5344 if test -n "$MOZ_VP8"; then
5345     AC_DEFINE(MOZ_VP8)
5346     if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5347         AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5348     fi
5349     if test -n "$MOZ_VP8_ENCODER" ; then
5350         AC_DEFINE(MOZ_VP8_ENCODER)
5351     fi
5353     if test -n "$MOZ_NATIVE_LIBVPX"; then
5354         dnl ============================
5355         dnl === libvpx Version check ===
5356         dnl ============================
5357         dnl Check to see if we have a system libvpx package.
5358         PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5360         MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [], 
5361          [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.])])
5363         _SAVE_LIBS=$LIBS
5364         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [], 
5365          [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5366         LIBS=$_SAVE_LIBS
5367     fi
5370 AC_SUBST(MOZ_NATIVE_LIBVPX)
5371 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5372 AC_SUBST(MOZ_LIBVPX_LIBS)
5374 if test "$MOZ_WEBM"; then
5375     MOZ_SYDNEYAUDIO=1
5376     MOZ_CUBEB=1
5377     MOZ_MEDIA=1
5378     if test -n "$MOZ_FLOATING_POINT_AUDIO"; then
5379         MOZ_VORBIS=1
5380     else
5381         MOZ_TREMOR=1
5382     fi
5385 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5387     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5388     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5389     dnl We currently require gcc on all arm platforms.
5390     VPX_AS=$YASM
5391     VPX_ASM_SUFFIX=asm
5392     VPX_NEED_OBJ_INT_EXTRACT=
5394     dnl See if we have assembly on this platform.
5395     case "$OS_ARCH:$CPU_ARCH" in
5396     Linux:x86)
5397       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5398       VPX_X86_ASM=1
5399     ;;
5400     Linux:x86_64)
5401       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5402       VPX_X86_ASM=1
5403     ;;
5404     SunOS:x86)
5405       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5406       VPX_X86_ASM=1
5407     ;;
5408     SunOS:x86_64)
5409       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5410       VPX_X86_ASM=1
5411     ;;
5412     OpenBSD:x86)
5413       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5414       VPX_X86_ASM=1
5415     ;;
5416     OpenBSD:x86_64)
5417       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5418       VPX_X86_ASM=1
5419     ;;
5420     Darwin:x86)
5421       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5422       VPX_X86_ASM=1
5423     ;;
5424     Darwin:x86_64)
5425       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5426       VPX_X86_ASM=1
5427     ;;
5428     WINNT:x86_64)
5429       VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5430       VPX_X86_ASM=1
5431     ;;
5432     WINNT:x86)
5433       dnl Check for yasm 1.1 or greater.
5434       if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5435         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.])
5436       elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5437         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.])
5438       else
5439         VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5440         VPX_X86_ASM=1
5441         dnl The encoder needs obj_int_extract to get asm offsets.
5442       fi
5443     ;;
5444     *:arm*)
5445       if test -n "$GNU_AS" ; then
5446         VPX_AS=$AS
5447         dnl These flags are a lie; they're just used to enable the requisite
5448         dnl opcodes; actual arch detection is done at runtime.
5449         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5450         VPX_DASH_C_FLAG="-c"
5451         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5452         VPX_ASM_SUFFIX="$ASM_SUFFIX"
5453         VPX_ARM_ASM=1
5454       fi
5455     esac
5457     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5458       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.])
5459     fi
5461     if test -n "$MOZ_VP8_ENCODER" -a \
5462             -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5463       dnl We prefer to get asm offsets using inline assembler, which the above
5464       dnl compilers can do. When we're not using one of those, we have to fall
5465       dnl back to obj_int_extract, which reads them from a compiled object
5466       dnl file. Unfortunately, that only works if we're compiling on a system
5467       dnl with the header files for the appropriate object file format.
5468       VPX_NEED_OBJ_INT_EXTRACT=1
5469     fi
5471     if test -n "$VPX_X86_ASM"; then
5472       AC_DEFINE(VPX_X86_ASM)
5473     elif test -n "$VPX_ARM_ASM"; then
5474       AC_DEFINE(VPX_ARM_ASM)
5475     else
5476       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5477     fi
5480 dnl ========================================================
5481 dnl = Disable Wave decoder support
5482 dnl ========================================================
5483 MOZ_ARG_DISABLE_BOOL(wave,
5484 [  --disable-wave          Disable Wave decoder support],
5485     MOZ_WAVE=,
5486     MOZ_WAVE=1)
5488 if test -n "$MOZ_WAVE"; then
5489     AC_DEFINE(MOZ_WAVE)
5490     MOZ_SYDNEYAUDIO=1
5491     MOZ_CUBEB=1
5492     MOZ_MEDIA=1
5495 dnl ========================================================
5496 dnl = Handle dependent SYDNEYAUDIO, CUBEB, and MEDIA defines
5497 dnl ========================================================
5499 if test -n "$MOZ_SYDNEYAUDIO"; then
5500     AC_DEFINE(MOZ_SYDNEYAUDIO)
5503 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5504     AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5507 if test -n "$MOZ_CUBEB"; then
5508     case "$target" in
5509     *-android*|*-linuxandroid*)
5510         dnl No Android implementation of libcubeb yet.
5511         ;;
5512     *-linux*)
5513         AC_DEFINE(MOZ_CUBEB)
5514         ;;
5515     *-mingw*)
5516         AC_DEFINE(MOZ_CUBEB)
5517         ;;
5518     *-darwin*)
5519         AC_DEFINE(MOZ_CUBEB)
5520         ;;
5521     *-openbsd*)
5522         AC_DEFINE(MOZ_CUBEB)
5523         ;;
5524     *)
5525         dnl Other targets will be enabled soon.
5526         ;;
5527     esac
5530 if test -n "$MOZ_MEDIA"; then
5531     AC_DEFINE(MOZ_MEDIA)
5534 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5535     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/])
5538 if test -n "$MOZ_VORBIS"; then
5539     AC_DEFINE(MOZ_VORBIS)
5542 if test -n "$MOZ_TREMOR"; then
5543     AC_DEFINE(MOZ_TREMOR)
5546 if test -n "$MOZ_OPUS"; then
5547     AC_DEFINE(MOZ_OPUS)
5550 dnl ========================================================
5551 dnl = Check alsa availability on Linux if using sydneyaudio
5552 dnl ========================================================
5554 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5555 if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
5556     PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5557          [echo "$MOZ_ALSA_PKG_ERRORS"
5558           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.)])])
5561 dnl ========================================================
5562 dnl = Enable PulseAudio
5563 dnl ========================================================
5565 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5566 [  --enable-pulseaudio          Enable PulseAudio support (experimental)],
5567 MOZ_PULSEAUDIO=1,
5568 MOZ_PULSEAUDIO=)
5570 if test -n "$MOZ_PULSEAUDIO"; then
5571     AC_DEFINE(MOZ_CUBEB)
5572     PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5573          [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5574           AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
5577 AC_SUBST(MOZ_PULSEAUDIO)
5578 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5579 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5581 dnl ========================================================
5582 dnl = Enable GStreamer
5583 dnl ========================================================
5584 MOZ_ARG_ENABLE_BOOL(gstreamer,
5585 [  --enable-gstreamer           Enable GStreamer support],
5586 MOZ_GSTREAMER=1,
5587 MOZ_GSTREAMER=)
5589 if test "$MOZ_GSTREAMER"; then
5590     # API version, eg 0.10, 1.0 etc
5591     GST_API_VERSION=0.10
5592     # core/base release number
5593     # depend on >= 0.10.33 as that's when the playbin2 source-setup signal was
5594     # introduced
5595     GST_VERSION=0.10.33
5596     PKG_CHECK_MODULES(GSTREAMER,
5597                       gstreamer-$GST_API_VERSION >= $GST_VERSION
5598                       gstreamer-app-$GST_API_VERSION
5599                       gstreamer-plugins-base-$GST_API_VERSION)
5600     if test -n "$GSTREAMER_LIBS"; then
5601        _SAVE_LDFLAGS=$LDFLAGS
5602        LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5603        AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5604        if test -n "$_HAVE_LIBGSTVIDEO" ; then
5605           GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5606        else
5607           AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
5608        fi
5609        LDFLAGS=$_SAVE_LDFLAGS
5610     else
5611        AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
5612     fi
5614 AC_SUBST(GSTREAMER_CFLAGS)
5615 AC_SUBST(GSTREAMER_LIBS)
5616 AC_SUBST(MOZ_GSTREAMER)
5618 if test -n "$MOZ_GSTREAMER"; then
5619    AC_DEFINE(MOZ_GSTREAMER)
5620    MOZ_MEDIA=1
5624 dnl ========================================================
5625 dnl Permissions System
5626 dnl ========================================================
5627 MOZ_ARG_DISABLE_BOOL(permissions,
5628 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5629     MOZ_PERMISSIONS=,
5630     MOZ_PERMISSIONS=1
5633 dnl ========================================================
5634 dnl NegotiateAuth
5635 dnl ========================================================
5636 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5637 [  --disable-negotiateauth Disable GSS-API negotiation ],
5638     MOZ_AUTH_EXTENSION=,
5639     MOZ_AUTH_EXTENSION=1 )
5641 dnl ========================================================
5642 dnl XTF
5643 dnl ========================================================
5644 MOZ_ARG_DISABLE_BOOL(xtf,
5645 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5646     MOZ_XTF=,
5647     MOZ_XTF=1 )
5648 if test "$MOZ_XTF"; then
5649   AC_DEFINE(MOZ_XTF)
5652 dnl ========================================================
5653 dnl Pref extensions (autoconfig)
5654 dnl ========================================================
5655 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5656 [  --disable-pref-extensions
5657                           Disable pref extensions such as autoconfig],
5658   MOZ_PREF_EXTENSIONS=,
5659   MOZ_PREF_EXTENSIONS=1 )
5661 dnl ========================================================
5662 dnl Searching of system directories for extensions.
5663 dnl Note: this switch is meant to be used for test builds
5664 dnl whose behavior should not depend on what happens to be
5665 dnl installed on the local machine.
5666 dnl ========================================================
5667 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5668 [  --disable-system-extension-dirs
5669                           Disable searching system- and account-global
5670                           directories for extensions of any kind; use
5671                           only profile-specific extension directories],
5672   ENABLE_SYSTEM_EXTENSION_DIRS=,
5673   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5674 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5675   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5678 dnl ========================================================
5679 dnl = Universalchardet
5680 dnl ========================================================
5681 MOZ_ARG_DISABLE_BOOL(universalchardet,
5682 [  --disable-universalchardet
5683                           Disable universal encoding detection],
5684   MOZ_UNIVERSALCHARDET=,
5685   MOZ_UNIVERSALCHARDET=1 )
5687 if test -n "${JAVA_BIN_PATH}"; then
5688   dnl Look for javac and jar in the specified path.
5689   JAVA_PATH="$JAVA_BIN_PATH"
5690 else
5691   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5692   JAVA_PATH="$JAVA_HOME/bin:$PATH"
5695 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5696 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5697 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5699 if test -n "${JAVA_BIN_PATH}" -o \
5700   \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5701   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5702     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}])
5703   fi
5706 dnl ========================================================
5707 dnl = ANGLE OpenGL->D3D translator for WebGL
5708 dnl = * only applies to win32
5709 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5710 dnl ========================================================
5711 MOZ_ANGLE_RENDERER=
5712 MOZ_DIRECTX_SDK_PATH=
5713 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5714 MOZ_D3DX9_VERSION=
5715 MOZ_D3DX9_CAB=
5716 MOZ_D3DCOMPILER_CAB=
5717 MOZ_D3DX9_DLL=
5718 MOZ_D3DCOMPILER_DLL=
5719 case "$target_os" in
5720 *mingw*)
5721     MOZ_ANGLE_RENDERER=1
5722     ;;
5723 esac
5725 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5726 case "${target_cpu}" in
5727 i*86)
5728   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5729   ;;
5730 x86_64)
5731   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5732   ;;
5733 esac
5735 MOZ_ARG_DISABLE_BOOL(webgl,
5736 [  --disable-webgl     Disable building of the WebGL implementation],
5737     MOZ_WEBGL_DISABLED=1,
5738     MOZ_WEBGL_DISABLED=)
5740 if test -n "$MOZ_WEBGL_DISABLED"; then
5741   MOZ_WEBGL=
5742   MOZ_ANGLE_RENDERER=
5745 if test -n "$MOZ_ANGLE_RENDERER"; then
5746   # Get the SDK path from the registry.
5747   # First try to get the June 2010 SDK
5748   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5749   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5750     # Otherwise just take whatever comes first
5751     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5752   fi
5754   if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5755     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.])
5756   else
5757     MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/'`
5758   fi
5760   if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5761      test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5762          test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5763     AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5764   else
5765     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.])
5766   fi
5768   # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5769   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'`
5771   if test -z "$MOZ_D3DX9_VERSION" ; then
5772         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.])
5773   fi
5775   MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5776   MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5778   MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
5779   MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5782 dnl ========================================================
5783 dnl = Breakpad crash reporting (on by default on supported platforms)
5784 dnl ========================================================
5786 case $target in
5787 i?86-*-mingw*|x86_64-*-mingw*)
5788   MOZ_CRASHREPORTER=1
5789   ;;
5790 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
5791   MOZ_CRASHREPORTER=1
5792   ;;
5793 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5794   if test "$MOZ_ENABLE_GTK2"; then
5795     MOZ_CRASHREPORTER=1
5796   fi
5797   ;;
5798 *-android*|*-linuxandroid*)
5799   MOZ_CRASHREPORTER=1
5800   ;;
5801 *solaris*)
5802   MOZ_CRASHREPORTER=1
5803   ;;
5804 esac
5806 MOZ_ARG_DISABLE_BOOL(crashreporter,
5807 [  --disable-crashreporter Disable breakpad crash reporting],
5808     MOZ_CRASHREPORTER=,
5809     MOZ_CRASHREPORTER=1)
5811 if test -n "$MOZ_CRASHREPORTER"; then
5812    AC_DEFINE(MOZ_CRASHREPORTER)
5814   if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
5815     test -z "$SKIP_LIBRARY_CHECKS"; then
5816     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5817     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5818     AC_SUBST(MOZ_GTHREAD_LIBS)
5820     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.])])
5821   fi
5823   if (test "$OS_ARCH" != "$HOST_OS_ARCH"); then
5824     AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.  Use --disable-crashreporter.])
5825   fi
5827   if test "$OS_ARCH" = "WINNT" -a -z "$HAVE_64BIT_OS"; then
5828     MOZ_CRASHREPORTER_INJECTOR=1
5829     AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5830   fi
5833 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5834 [  --with-crashreporter-enable-percent=NN
5835                           Enable sending crash reports by default on NN% of users. (default=100)],
5836 [ val=`echo $withval | sed 's/[^0-9]//g'`
5837     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5839 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5840    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5842 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5844 dnl ========================================================
5845 dnl = libjpeg-turbo configuration
5846 dnl ========================================================
5847 MOZ_LIBJPEG_TURBO=
5848 if test -z "$MOZ_NATIVE_JPEG"; then
5849     MOZ_LIBJPEG_TURBO=1
5852 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5853 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
5854     MOZ_LIBJPEG_TURBO=,
5855     MOZ_LIBJPEG_TURBO=1)
5857 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
5858     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
5861 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
5862 dnl files.
5864 if test -n "$MOZ_LIBJPEG_TURBO"; then
5866   dnl Do we support libjpeg-turbo on this platform?
5867   case "$OS_ARCH:$OS_TEST" in
5868   Linux:x86|Linux:i?86)
5869     LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
5870     LIBJPEG_TURBO_X86_ASM=1
5871   ;;
5872   Linux:x86_64)
5873     LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
5874     LIBJPEG_TURBO_X64_ASM=1
5875   ;;
5876   SunOS:i?86)
5877     LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
5878     LIBJPEG_TURBO_X86_ASM=1
5879   ;;
5880   SunOS:x86_64)
5881     LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
5882     LIBJPEG_TURBO_X64_ASM=1
5883   ;;
5884   Darwin:i?86)
5885     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
5886     LIBJPEG_TURBO_X86_ASM=1
5887   ;;
5888   Darwin:x86_64)
5889     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
5890     LIBJPEG_TURBO_X64_ASM=1
5891   ;;
5892   WINNT:x86|WINNT:i?86)
5893     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
5894     LIBJPEG_TURBO_X86_ASM=1
5895   ;;
5896   WINNT:x86_64)
5897     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
5898     LIBJPEG_TURBO_X64_ASM=1
5899   ;;
5900   *:arm*)
5901     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
5902     LIBJPEG_TURBO_ARM_ASM=1
5903   ;;
5904   esac
5908 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
5909 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
5910 dnl it doesn't exist or we have too old of a version.
5911 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
5912     AC_MSG_CHECKING([for Yasm assembler])
5913     AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
5915     if test -z "$LIBJPEG_TURBO_AS" ; then
5916         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.])
5917     fi
5919     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
5920     dnl on Linux and 1.1 or newer everywhere else.
5921     if test "$OS_ARCH" = "Linux" ; then
5922         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
5923             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.])
5924         fi
5925     else
5926         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5927             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.])
5928         fi
5929     fi
5932 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
5933 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
5934 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
5935     echo "Using $AS as the assembler for ARM code."
5936     LIBJPEG_TURBO_AS=$AS
5939 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
5940     AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
5941 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
5942     AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
5943 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
5944     AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
5945 elif test -n "$MOZ_LIBJPEG_TURBO"; then
5946     dnl Warn if we're not building the optimized routines, even though the user
5947     dnl didn't specify --disable-libjpeg-turbo.
5948     AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
5951 dnl ========================================================
5952 dnl = Enable compilation of specific extension modules
5953 dnl ========================================================
5955 MOZ_ARG_ENABLE_STRING(extensions,
5956 [  --enable-extensions     Enable extensions],
5957 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5958     if test "$option" = "yes" -o "$option" = "all"; then
5959         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5960     elif test "$option" = "no" -o "$option" = "none"; then
5961         MOZ_EXTENSIONS=""
5962     elif test "$option" = "default"; then
5963         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5964     elif test `echo "$option" | grep -c \^-` != 0; then
5965         option=`echo $option | sed 's/^-//'`
5966         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5967     else
5968         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5969     fi
5970 done],
5971     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5973 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5974     # Suppress warning on non-X11 platforms
5975     if test -n "$MOZ_X11"; then
5976         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5977     fi
5978     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5981 dnl Do not build gnomevfs with libxul based apps
5982 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5983     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5986 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5987     # Suppress warning on non-X11 platforms
5988     if test -n "$MOZ_X11"; then
5989         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
5990     fi
5991     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5994 dnl Do not build gio with libxul based apps
5995 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5996     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5999 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6000     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6001     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6004 dnl xforms requires xtf
6005 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6006     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6007     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6010 dnl Remove dupes
6011 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6013 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6014 dnl when trying to build a nonexistent extension.
6015 for extension in $MOZ_EXTENSIONS; do
6016     if test ! -d "${srcdir}/extensions/${extension}"; then
6017         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6018     fi
6019 done
6021 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6022   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6025 dnl ========================================================
6026 dnl CSS3 Flexbox Support
6027 dnl ========================================================
6028 if test -n "$MOZ_FLEXBOX"; then
6029   AC_DEFINE(MOZ_FLEXBOX)
6032 dnl ========================================================
6033 dnl Build Freetype in the tree
6034 dnl ========================================================
6035 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6036 [  --enable-tree-freetype  Enable Tree FreeType],
6037     MOZ_TREE_FREETYPE=1,
6038     MOZ_TREE_FREETYPE= )
6039 if test -n "$MOZ_TREE_FREETYPE"; then
6040    if test -n "$_WIN32_MSVC"; then
6041       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6042    fi
6043    AC_DEFINE(MOZ_TREE_FREETYPE)
6044    AC_SUBST(MOZ_TREE_FREETYPE)
6045    MOZ_ENABLE_CAIRO_FT=1
6046    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6047    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6048    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6049    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6050    CAIRO_FT_OSLIBS=''
6051    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6052    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6053    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6054    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6055    AC_SUBST(CAIRO_FT_CFLAGS)
6058 dnl ========================================================
6059 dnl Installer
6060 dnl ========================================================
6061 dnl Abort Windows build if the required major version and
6062 dnl minimum minor version of Unicode NSIS isn't in the path
6063 dnl (unless in case of cross compiling, for which Unicode
6064 dnl is not yet sufficient).
6065 if test "$OS_ARCH" = "WINNT"; then
6066     REQ_NSIS_MAJOR_VER=2
6067     MIN_NSIS_MINOR_VER=33
6068     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6069     if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6070       AC_MSG_RESULT([yes])
6071       changequote(,)
6072       MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6073       changequote([,])
6074       if test ! "$MAKENSISU_VER" = ""; then
6075           MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6076           MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6077       fi
6078       AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6079       if test "$MAKENSISU_VER" = "" || \
6080          test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6081               ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6082           AC_MSG_RESULT([no])
6083           if test -z "$CROSS_COMPILE"; then
6084             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.])
6085           else
6086             MAKENSISU=
6087           fi
6088       fi
6089     elif test -z "$CROSS_COMPILE"; then
6090       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.])
6091     else
6092       MAKENSISU=
6093     fi
6096 dnl ========================================================
6097 dnl Web App Runtime
6098 dnl ========================================================
6099 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6100 [  --disable-webapp-runtime  Disable Web App Runtime],
6101     MOZ_WEBAPP_RUNTIME=,
6102     MOZ_WEBAPP_RUNTIME=1)
6103 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6104     MOZ_WEBAPP_RUNTIME=
6106 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6107     MOZ_WEBAPP_RUNTIME=
6109 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6110 if test "$MOZ_WEBAPP_RUNTIME"; then
6111     AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6114 AC_MSG_CHECKING([for tar archiver])
6115 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6116 if test -z "$TAR"; then
6117     AC_MSG_ERROR([no tar archiver found in \$PATH])
6119 AC_MSG_RESULT([$TAR])
6120 AC_SUBST(TAR)
6122 AC_MSG_CHECKING([for wget])
6123 AC_CHECK_PROGS(WGET, wget, "")
6124 AC_MSG_RESULT([$WGET])
6125 AC_SUBST(WGET)
6127 dnl ========================================================
6128 dnl Signing
6129 dnl ========================================================
6131 if test -n "$MOZ_SIGN_CMD"; then
6132     AC_DEFINE(MOZ_SIGNING)
6135 dnl ========================================================
6136 dnl Maintenance Service
6137 dnl ========================================================
6139 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6140 [  --enable-maintenance-service       Enable building of maintenanceservice],
6141     MOZ_MAINTENANCE_SERVICE=1,
6142     MOZ_MAINTENANCE_SERVICE= )
6144 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6145   if test "$OS_ARCH" = "WINNT"; then
6146     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6147   else
6148     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6149   fi
6152 dnl ========================================================
6153 dnl Verify MAR signatures
6154 dnl ========================================================
6156 MOZ_ARG_ENABLE_BOOL(verify-mar,
6157 [  --enable-verify-mar     Enable verifying MAR signatures],
6158     MOZ_VERIFY_MAR_SIGNATURE=1,
6159     MOZ_VERIFY_MAR_SIGNATURE= )
6161 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6162   if test "$OS_ARCH" = "WINNT"; then
6163     AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6164   else
6165     AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6166   fi
6169 dnl ========================================================
6170 dnl Enable building the signmar program.
6171 dnl This option is much different than the --enable-verify-mar option.
6172 dnl --enable-verify-mar is for enabling the verification check on MAR
6173 dnl files in the updater.  The --enable-signmar option is for building
6174 dnl the signmar program.
6175 dnl ========================================================
6177 MOZ_ARG_ENABLE_BOOL(signmar,
6178 [  --enable-signmar     Enable building the signmar program],
6179     MOZ_ENABLE_SIGNMAR=1,
6180     MOZ_ENABLE_SIGNMAR= )
6182 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6183   AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6186 dnl ========================================================
6187 dnl Updater
6188 dnl ========================================================
6190 MOZ_ARG_DISABLE_BOOL(updater,
6191 [  --disable-updater       Disable building of updater],
6192     MOZ_UPDATER=,
6193     MOZ_UPDATER=1 )
6195 if test -n "$MOZ_UPDATER"; then
6196     AC_DEFINE(MOZ_UPDATER)
6199 # app update channel is 'default' when not supplied.
6200 MOZ_ARG_ENABLE_STRING([update-channel],
6201 [  --enable-update-channel=CHANNEL
6202                           Select application update channel (default=default)],
6203     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6205 if test -z "$MOZ_UPDATE_CHANNEL"; then
6206     MOZ_UPDATE_CHANNEL=default
6208 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6209 AC_SUBST(MOZ_UPDATE_CHANNEL)
6211 # tools/update-packaging is not checked out by default.
6212 MOZ_ARG_ENABLE_BOOL(update-packaging,
6213 [  --enable-update-packaging
6214                           Enable tools/update-packaging],
6215     MOZ_UPDATE_PACKAGING=1,
6216     MOZ_UPDATE_PACKAGING= )
6217 AC_SUBST(MOZ_UPDATE_PACKAGING)
6219 dnl ========================================================
6220 dnl build the tests by default
6221 dnl ========================================================
6222 MOZ_ARG_DISABLE_BOOL(tests,
6223 [  --disable-tests         Do not build test libraries & programs],
6224     ENABLE_TESTS=,
6225     ENABLE_TESTS=1 )
6227 dnl ========================================================
6228 dnl parental controls (for Windows Vista)
6229 dnl ========================================================
6230 MOZ_ARG_DISABLE_BOOL(parental-controls,
6231 [  --disable-parental-controls
6232                           Do not build parental controls],
6233    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6234    MOZ_DISABLE_PARENTAL_CONTROLS=)
6235 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6236     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6239 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6241 dnl ========================================================
6242 dnl = Disable DOMCrypto
6243 dnl ========================================================
6244 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6245     AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6248 dnl ========================================================
6249 dnl =
6250 dnl = Module specific options
6251 dnl =
6252 dnl ========================================================
6253 MOZ_ARG_HEADER(Individual module options)
6255 dnl ========================================================
6256 dnl = Disable feed handling components
6257 dnl ========================================================
6258 MOZ_ARG_DISABLE_BOOL(feeds,
6259 [  --disable-feeds         Disable feed handling and processing components],
6260     MOZ_FEEDS=,
6261     MOZ_FEEDS=1 )
6262 if test -n "$MOZ_FEEDS"; then
6263     AC_DEFINE(MOZ_FEEDS)
6264 else
6265     if test "$MOZ_BUILD_APP" = "browser"; then
6266         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6267     fi
6270 dnl ========================================================
6271 dnl Check for sqlite
6272 dnl ========================================================
6274 MOZ_NATIVE_SQLITE=
6275 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6276 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6277 MOZ_NATIVE_SQLITE=1,
6278 MOZ_NATIVE_SQLITE= )
6280 if test -z "$MOZ_NATIVE_SQLITE"
6281 then
6282     SQLITE_CFLAGS=
6283     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6284 else
6285     dnl ============================
6286     dnl === SQLite Version check ===
6287     dnl ============================
6288     dnl Check to see if the system SQLite package is new enough.
6289     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6291     dnl ==================================
6292     dnl === SQLITE_SECURE_DELETE check ===
6293     dnl ==================================
6294     dnl Check to see if the system SQLite package is compiled with
6295     dnl SQLITE_SECURE_DELETE enabled.
6296     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6297     _SAVE_CFLAGS="$CFLAGS"
6298     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6299     _SAVE_LIBS="$LIBS"
6300     LIBS="$LIBS $SQLITE_LIBS"
6301     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6302         AC_TRY_RUN([
6303             #include "sqlite3.h"
6305             int main(int argc, char **argv){
6306               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6307             }],
6308             ac_cv_sqlite_secure_delete=yes,
6309             ac_cv_sqlite_secure_delete=no,
6310             ac_cv_sqlite_secure_delete=no
6311         )
6312     ])
6313     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6314     CFLAGS="$_SAVE_CFLAGS"
6315     LIBS="$_SAVE_LIBS"
6316     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6317         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6318     fi
6320     dnl ===============================
6321     dnl === SQLITE_THREADSAFE check ===
6322     dnl ===============================
6323     dnl Check to see if the system SQLite package is compiled with
6324     dnl SQLITE_THREADSAFE enabled.
6325     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6326     _SAVE_CFLAGS="$CFLAGS"
6327     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6328     _SAVE_LIBS="$LIBS"
6329     LIBS="$LIBS $SQLITE_LIBS"
6330     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6331         AC_TRY_RUN([
6332             #include "sqlite3.h"
6334             int main(int argc, char **argv){
6335               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6336             }],
6337             ac_cv_sqlite_threadsafe=yes,
6338             ac_cv_sqlite_threadsafe=no,
6339             ac_cv_sqlite_threadsafe=no
6340         )
6341     ])
6342     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6343     CFLAGS="$_SAVE_CFLAGS"
6344     LIBS="$_SAVE_LIBS"
6345     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6346         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6347     fi
6349     dnl ================================
6350     dnl === SQLITE_ENABLE_FTS3 check ===
6351     dnl ================================
6352     dnl check to see if the system SQLite package is compiled with
6353     dnl SQLITE_ENABLE_FTS3 enabled.
6354     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6355     _SAVE_CFLAGS="$CFLAGS"
6356     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6357     _SAVE_LIBS="$LIBS"
6358     LIBS="$LIBS $SQLITE_LIBS"
6359     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6360         AC_TRY_RUN([
6361             #include "sqlite3.h"
6363             int main(int argc, char **argv){
6364               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6365             }],
6366             ac_cv_sqlite_enable_fts3=yes,
6367             ac_cv_sqlite_enable_fts3=no,
6368             ac_cv_sqlite_enable_fts3=no
6369         )
6370     ])
6371     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6372     CFLAGS="$_SAVE_CFLAGS"
6373     LIBS="$_SAVE_LIBS"
6374     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6375         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6376     fi
6378     dnl =========================================
6379     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6380     dnl =========================================
6381     dnl check to see if the system SQLite package is compiled with
6382     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6383     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6384     _SAVE_CFLAGS="$CFLAGS"
6385     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6386     _SAVE_LIBS="$LIBS"
6387     LIBS="$LIBS $SQLITE_LIBS"
6388     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6389         AC_TRY_RUN([
6390             #include "sqlite3.h"
6392             int main(int argc, char **argv){
6393               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6394             }],
6395             ac_cv_sqlite_enable_unlock_notify=yes,
6396             ac_cv_sqlite_enable_unlock_notify=no,
6397             ac_cv_sqlite_enable_unlock_notify=no
6398         )
6399     ])
6400     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6401     CFLAGS="$_SAVE_CFLAGS"
6402     LIBS="$_SAVE_LIBS"
6403     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6404         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6405     fi
6408 if test -n "$MOZ_NATIVE_SQLITE"; then
6409     AC_DEFINE(MOZ_NATIVE_SQLITE)
6411 AC_SUBST(MOZ_NATIVE_SQLITE)
6413 dnl ========================================================
6414 dnl = Enable help viewer (off by default)
6415 dnl ========================================================
6416 if test -n "$MOZ_HELP_VIEWER"; then
6417      dnl Do this if defined in confvars.sh
6418      AC_DEFINE(MOZ_HELP_VIEWER)
6421 dnl ========================================================
6422 dnl = Enable safe browsing (anti-phishing)
6423 dnl ========================================================
6424 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6425 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6426     MOZ_SAFE_BROWSING=1,
6427     MOZ_SAFE_BROWSING= )
6428 if test -n "$MOZ_SAFE_BROWSING"; then
6429     AC_DEFINE(MOZ_SAFE_BROWSING)
6431 AC_SUBST(MOZ_SAFE_BROWSING)
6433 dnl ========================================================
6434 dnl = Enable url-classifier
6435 dnl ========================================================
6436 dnl Implicitly enabled by default if building with safe-browsing
6437 if test -n "$MOZ_SAFE_BROWSING"; then
6438     MOZ_URL_CLASSIFIER=1
6440 MOZ_ARG_ENABLE_BOOL(url-classifier,
6441 [  --enable-url-classifier Enable url classifier module],
6442     MOZ_URL_CLASSIFIER=1,
6443     MOZ_URL_CLASSIFIER= )
6444 if test -n "$MOZ_URL_CLASSIFIER"; then
6445     AC_DEFINE(MOZ_URL_CLASSIFIER)
6447 AC_SUBST(MOZ_URL_CLASSIFIER)
6449 dnl ========================================================
6450 dnl = Disable zipwriter
6451 dnl ========================================================
6452 MOZ_ARG_DISABLE_BOOL(zipwriter,
6453 [  --disable-zipwriter     Disable zipwriter component],
6454     MOZ_ZIPWRITER=,
6455     MOZ_ZIPWRITER=1 )
6456 AC_SUBST(MOZ_ZIPWRITER)
6458 dnl ========================================================
6459 dnl = libconic
6460 dnl ========================================================
6461 dnl superseded by QtNetwork starting from 4.7
6462 MOZ_ENABLE_LIBCONIC=1
6464 if test -n "$MOZ_ENABLE_QT"; then
6465   if test "$MOZ_ENABLE_QTNETWORK"; then
6466     MOZ_ENABLE_LIBCONIC=
6467   fi
6470 MOZ_ARG_DISABLE_BOOL(libconic,
6471 [  --disable-libconic      Disable libconic],
6472     MOZ_ENABLE_LIBCONIC=,
6473     MOZ_ENABLE_LIBCONIC=1 )
6475 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6476     PKG_CHECK_MODULES(LIBCONIC, conic,
6477                       MOZ_ENABLE_LIBCONIC=1,
6478                       MOZ_ENABLE_LIBCONIC=)
6480 if test "$MOZ_ENABLE_LIBCONIC"; then
6481     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6484 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6485 AC_SUBST(LIBCONIC_CFLAGS)
6486 AC_SUBST(LIBCONIC_LIBS)
6488 dnl ========================================================
6489 dnl = Maemo checks
6490 dnl ========================================================
6492 MAEMO_SDK_TARGET_VER=-1
6494 MOZ_ARG_WITH_STRING(maemo-version,
6495 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6496                           Maemo SDK Version],
6497   MAEMO_SDK_TARGET_VER=$withval)
6499 case "$MAEMO_SDK_TARGET_VER" in
6501     MOZ_PLATFORM_MAEMO=5
6502     ;;
6505     MOZ_PLATFORM_MAEMO=6
6506     ;;
6509     dnl We aren't compiling for Maemo, move on.
6510     ;;
6512     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6513     ;;
6514 esac
6516 if test $MOZ_PLATFORM_MAEMO; then
6517    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6519    if test -z "$MOZ_ENABLE_DBUS"; then
6520        AC_MSG_ERROR([DBus is required when building for Maemo])
6521    fi
6523    MOZ_GFX_OPTIMIZE_MOBILE=1
6524    MOZ_GL_DEFAULT_PROVIDER=EGL
6525    MOZ_MAEMO_LIBLOCATION=
6527    if test $MOZ_PLATFORM_MAEMO = 5; then
6528       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6529       MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6530           [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6531       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6532                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6534       AC_SUBST(XCOMPOSITE_LIBS)
6536       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6537       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6538       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6539       if test -z "$_LIB_FOUND"; then
6540          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6541       fi
6544       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6545       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6546       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6547       if test -z "$_LIB_FOUND"; then
6548          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6549       fi
6551       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6552       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6553       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6554       if test -z "$_LIB_FOUND"; then
6555          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6556       fi
6558    fi
6559    if test $MOZ_PLATFORM_MAEMO = 6; then
6561       PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6562                         _LIB_FOUND=1,
6563                         _LIB_FOUND=)
6564       if test "$_LIB_FOUND"; then
6565          MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6566          MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6567          MOZ_ENABLE_CONTENTMANAGER=1
6568          AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6569       else
6570          AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6571       fi
6572       AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6574       dnl ========================================================
6575       dnl = Enable meego libcontentaction
6576       dnl ========================================================
6577       MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6578       [  --enable-meegocontentaction           Enable meegocontentaction support],
6579          MOZ_MEEGOCONTENTACTION=1,
6580          MOZ_MEEGOCONTENTACTION=)
6582       if test -n "$MOZ_MEEGOCONTENTACTION"; then
6584          PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6585          if test "$_LIB_FOUND"; then
6586             MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6587             MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6588             MOZ_ENABLE_CONTENTACTION=1
6589             AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6590             AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6591          fi
6592       fi
6594       MOZ_ARG_ENABLE_BOOL(meegotouch,
6595       [  --enable-meegotouch  Enable meegotouch support],
6596          MOZ_MEEGOTOUCHENABLED=1,
6597          MOZ_MEEGOTOUCHENABLED=)
6599       if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6600           PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6601           if test "$_LIB_FOUND"; then
6602               MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6603               MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6604               AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6605           else
6606               AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6607           fi
6608       fi
6609    fi
6611    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6612    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6613    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6614    if test "$_LIB_FOUND"; then
6615       MOZ_MAEMO_LIBLOCATION=1
6616       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6617    else
6618       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6619    fi
6620    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6622    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6623    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6624    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6625    if test "$_LIB_FOUND"; then
6626       MOZ_ENABLE_MEEGOTOUCHSHARE=1
6627       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6628    else
6629       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6630    fi
6631    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6633    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6634    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6637 dnl ========================================================
6638 dnl = XRender Composite
6639 dnl ========================================================
6640 MOZ_ARG_ENABLE_BOOL(egl-xrender-composite,
6641 [  --enable-egl-xrender-composite
6642                           Enable EGL xrender composite optimizations],
6643     MOZ_EGL_XRENDER_COMPOSITE=1)
6645 if test -n "$MOZ_EGL_XRENDER_COMPOSITE"; then
6646     AC_DEFINE(MOZ_EGL_XRENDER_COMPOSITE)
6649 AC_SUBST(MOZ_EGL_XRENDER_COMPOSITE)
6651 dnl ========================================================
6652 dnl GL provider
6653 dnl ========================================================
6654 MOZ_GL_PROVIDER=
6655 MOZ_ARG_WITH_STRING(gl-provider,
6656 [  --with-gl-provider=ID
6657                           Set GL provider backend type],
6658 [ val=`echo $withval`
6659     MOZ_GL_PROVIDER="$val"])
6661 if test -n "$MOZ_GL_PROVIDER"; then
6662 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6663 AC_SUBST(MOZ_GL_PROVIDER)
6664 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6666 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6668 dnl ========================================================
6669 dnl = faststripe theme
6670 dnl ========================================================
6671 MOZ_ARG_ENABLE_BOOL(faststripe,
6672 [  --enable-faststripe     Use faststripe theme],
6673     MOZ_THEME_FASTSTRIPE=1,
6674     MOZ_THEME_FASTSTRIPE= )
6675 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6677 dnl ========================================================
6678 dnl =
6679 dnl = Feature options that require extra sources to be pulled
6680 dnl =
6681 dnl ========================================================
6682 dnl MOZ_ARG_HEADER(Features that require extra sources)
6684 dnl ========================================================
6685 dnl =
6686 dnl = Debugging Options
6687 dnl =
6688 dnl ========================================================
6689 MOZ_ARG_HEADER(Debugging and Optimizations)
6691 dnl ========================================================
6692 dnl = Disable building with debug info.
6693 dnl = Debugging is OFF by default
6694 dnl ========================================================
6695 if test -z "$MOZ_DEBUG_FLAGS"; then
6696   MOZ_DEBUG_FLAGS="-g"
6699 MOZ_ARG_ENABLE_STRING(debug,
6700 [  --enable-debug[=DBG]    Enable building with developer debug info
6701                            (using compiler flags DBG)],
6702 [ if test "$enableval" != "no"; then
6703     MOZ_DEBUG=1
6704     if test -n "$enableval" -a "$enableval" != "yes"; then
6705         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6706         _MOZ_DEBUG_FLAGS_SET=1
6707     fi
6708   else
6709     MOZ_DEBUG=
6710   fi ],
6711   MOZ_DEBUG=)
6713 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6714 MOZ_ARG_WITH_STRING(debug-label,
6715 [  --with-debug-label=LABELS
6716                           Define DEBUG_<value> for each comma-separated
6717                           value given.],
6718 [ for option in `echo $withval | sed 's/,/ /g'`; do
6719     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6720 done])
6722 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6724 if test -n "$MOZ_DEBUG"; then
6725     AC_MSG_CHECKING([for valid debug flags])
6726     _SAVE_CFLAGS=$CFLAGS
6727     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6728     AC_TRY_COMPILE([#include <stdio.h>],
6729         [printf("Hello World\n");],
6730         _results=yes,
6731         _results=no)
6732     AC_MSG_RESULT([$_results])
6733     if test "$_results" = "no"; then
6734         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6735     fi
6736     CFLAGS=$_SAVE_CFLAGS
6739 dnl ========================================================
6740 dnl enable mobile optimizations
6741 dnl ========================================================
6742 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6743 [  --enable-mobile-optimize
6744                           Enable mobile optimizations],
6745     MOZ_GFX_OPTIMIZE_MOBILE=1)
6747 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6749 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6750     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6753 dnl ========================================================
6754 dnl = Enable code optimization. ON by default.
6755 dnl ========================================================
6756 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6757         MOZ_OPTIMIZE_FLAGS="-O"
6760 MOZ_ARG_ENABLE_STRING(optimize,
6761 [  --disable-optimize      Disable compiler optimization
6762   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6763 [ if test "$enableval" != "no"; then
6764     MOZ_OPTIMIZE=1
6765     if test -n "$enableval" -a "$enableval" != "yes"; then
6766         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6767         MOZ_OPTIMIZE=2
6768     fi
6769 else
6770     MOZ_OPTIMIZE=
6771 fi ], MOZ_OPTIMIZE=1)
6773 MOZ_SET_FRAMEPTR_FLAGS
6775 if test "$COMPILE_ENVIRONMENT"; then
6776 if test -n "$MOZ_OPTIMIZE"; then
6777     AC_MSG_CHECKING([for valid optimization flags])
6778     _SAVE_CFLAGS=$CFLAGS
6779     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6780     AC_TRY_COMPILE([#include <stdio.h>],
6781         [printf("Hello World\n");],
6782         _results=yes,
6783         _results=no)
6784     AC_MSG_RESULT([$_results])
6785     if test "$_results" = "no"; then
6786         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6787     fi
6788     CFLAGS=$_SAVE_CFLAGS
6790 fi # COMPILE_ENVIRONMENT
6792 AC_SUBST(MOZ_OPTIMIZE)
6793 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6794 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6795 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6796 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6797 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6798 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6800 dnl ========================================================
6801 dnl = Enable generation of debug symbols
6802 dnl ========================================================
6803 MOZ_ARG_ENABLE_STRING(debug-symbols,
6804 [  --enable-debug-symbols[=DBG]
6805                           Enable debugging symbols (using compiler flags DBG)],
6806 [ if test "$enableval" != "no"; then
6807       MOZ_DEBUG_SYMBOLS=1
6808       if test -n "$enableval" -a "$enableval" != "yes"; then
6809           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6810               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6811           else
6812               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6813           fi
6814       fi
6815   else
6816       MOZ_DEBUG_SYMBOLS=
6817   fi ],
6818   MOZ_DEBUG_SYMBOLS=1)
6820 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6821     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6822     export MOZ_DEBUG_SYMBOLS
6825 dnl ========================================================
6826 dnl = Enable any treating of compile warnings as errors
6827 dnl ========================================================
6828 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6829 [  --enable-warnings-as-errors
6830                           Enable treating of warnings as errors],
6831     MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6832     MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6833 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6834    WARNINGS_AS_ERRORS=''
6837 dnl ========================================================
6838 dnl = Disable runtime logging checks
6839 dnl ========================================================
6840 MOZ_ARG_DISABLE_BOOL(logging,
6841 [  --disable-logging       Disable logging facilities],
6842     NS_DISABLE_LOGGING=1,
6843     NS_DISABLE_LOGGING= )
6844 if test "$NS_DISABLE_LOGGING"; then
6845     AC_DEFINE(NS_DISABLE_LOGGING)
6846 else
6847     AC_DEFINE(MOZ_LOGGING)
6850 dnl ========================================================
6851 dnl = This will enable logging of addref, release, ctor, dtor.
6852 dnl ========================================================
6853 _ENABLE_LOGREFCNT=42
6854 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6855 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6856     _ENABLE_LOGREFCNT=1,
6857     _ENABLE_LOGREFCNT= )
6858 if test "$_ENABLE_LOGREFCNT" = "1"; then
6859     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6860 elif test -z "$_ENABLE_LOGREFCNT"; then
6861     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6864 dnl ========================================================
6865 dnl moz_dump_painting
6866 dnl ========================================================
6867 MOZ_ARG_ENABLE_BOOL(dump-painting,
6868 [  --enable-dump-painting          Enable paint debugging.],
6869     MOZ_DUMP_PAINTING=1,
6870     MOZ_DUMP_PAINTING= )
6871 if test -n "$MOZ_DUMP_PAINTING"; then
6872     AC_DEFINE(MOZ_DUMP_PAINTING)
6873     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6875 if test -n "$MOZ_DEBUG"; then
6876     AC_DEFINE(MOZ_DUMP_PAINTING)
6879 dnl ========================================================
6880 dnl = Enable trace malloc
6881 dnl ========================================================
6882 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6883 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6884 [  --enable-trace-malloc   Enable malloc tracing; also disables jemalloc],
6885     NS_TRACE_MALLOC=1,
6886     NS_TRACE_MALLOC= )
6887 if test "$NS_TRACE_MALLOC"; then
6888   # Please, Mr. Linker Man, don't take away our symbol names
6889   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6890   USE_ELF_DYNSTR_GC=
6891   AC_DEFINE(NS_TRACE_MALLOC)
6893 AC_SUBST(NS_TRACE_MALLOC)
6895 dnl ========================================================
6896 dnl = Enable jemalloc
6897 dnl ========================================================
6898 MOZ_ARG_ENABLE_BOOL(jemalloc,
6899 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6900     MOZ_MEMORY=1,
6901     MOZ_MEMORY=)
6903 if test "$NS_TRACE_MALLOC"; then
6904     MOZ_MEMORY=
6906 if test "$MOZ_DMD"; then
6907     MOZ_MEMORY=
6910 if test "${OS_TARGET}" = "Android"; then
6911   dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6912   :
6913 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
6914   dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
6915   if test -z "$GNU_CC"; then
6916     MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6917   else
6918     MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6919   fi
6920 else
6921   dnl On other Unix systems, we only want to link executables against mozglue
6922   MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6923   dnl On other Unix systems, where mozglue is a static library, jemalloc is
6924   dnl separated for the SDK, so we need to add it here.
6925   if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6926     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6927   fi
6928   MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6929   if test -n "$GNU_CC"; then
6930     dnl And we need mozglue symbols to be exported.
6931     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6932   fi
6933   if test "$MOZ_LINKER" = 1; then
6934     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $ZLIB_LIBS"
6935   fi
6938 if test -z "$MOZ_MEMORY"; then
6939   case "${target}" in
6940     *-mingw*)
6941       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
6942         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.])
6943       fi
6944       ;;
6945   esac
6946 else
6947   dnl Don't try to run compiler tests on Windows
6948   if test "$OS_ARCH" = "WINNT"; then
6949     if test -z "$HAVE_64BIT_OS"; then
6950       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6951     else
6952       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6953     fi
6954   else
6955     AC_CHECK_SIZEOF([int *], [4])
6956     case "${ac_cv_sizeof_int_p}" in
6957     4)
6958       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6959       ;;
6960     8)
6961       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6962       ;;
6963     *)
6964       AC_MSG_ERROR([Unexpected pointer size])
6965       ;;
6966     esac
6967   fi
6969   AC_DEFINE(MOZ_MEMORY)
6970   if test -n "$MOZ_JEMALLOC"; then
6971     AC_DEFINE(MOZ_JEMALLOC)
6972   fi
6973   if test "x$MOZ_DEBUG" = "x1"; then
6974     AC_DEFINE(MOZ_MEMORY_DEBUG)
6975   fi
6976   dnl The generic feature tests that determine how to compute ncpus are long and
6977   dnl complicated.  Therefore, simply define special cpp variables for the
6978   dnl platforms we have special knowledge of.
6979   case "${target}" in
6980   *-darwin*)
6981     AC_DEFINE(MOZ_MEMORY_DARWIN)
6982     ;;
6983   *-*freebsd*)
6984     AC_DEFINE(MOZ_MEMORY_BSD)
6985     ;;
6986   *-android*|*-linuxandroid*)
6987     AC_DEFINE(MOZ_MEMORY_LINUX)
6988     AC_DEFINE(MOZ_MEMORY_ANDROID)
6989     if test -z "$gonkdir"; then
6990       _WRAP_MALLOC=1
6991     else
6992       AC_DEFINE(MOZ_MEMORY_GONK)
6993     fi
6994     MOZ_GLUE_LDFLAGS=
6995     ;;
6996   *-*linux*)
6997     AC_DEFINE(MOZ_MEMORY_LINUX)
6998     ;;
6999   *-netbsd*)
7000     AC_DEFINE(MOZ_MEMORY_BSD)
7001     ;;
7002   *-solaris*)
7003     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7004     ;;
7005   *-mingw*)
7006     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7007     if test -z "$MOZ_DEBUG"; then
7008       WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7009     else
7010       WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7011     fi
7012     dnl Look for a broken crtdll.obj
7013     WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7014     lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7015     if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7016       MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7017       dnl Also pass this to NSPR/NSS
7018       DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7019     else
7020       DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7021     fi
7022     rm crtdll.obj
7024     export DLLFLAGS
7025     ;;
7026   *)
7027     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7028     ;;
7029   esac
7030 fi # MOZ_MEMORY
7031 AC_SUBST(MOZ_MEMORY)
7032 AC_SUBST(MOZ_JEMALLOC)
7033 AC_SUBST(MOZ_GLUE_LDFLAGS)
7034 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7035 AC_SUBST(WIN32_CRT_LIBS)
7036 dnl Need to set this for make because NSS doesn't have configure
7037 AC_SUBST(DLLFLAGS)
7039 dnl We need to wrap dlopen and related functions on Android because we use
7040 dnl our own linker.
7041 if test "$OS_TARGET" = Android; then
7042     WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7043     if test -n "$MOZ_OLD_LINKER"; then
7044         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
7045     fi
7046     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7047     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7050 dnl ========================================================
7051 dnl = Use malloc wrapper lib
7052 dnl ========================================================
7053 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7054 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7055     _WRAP_MALLOC=1,
7056     _WRAP_MALLOC= )
7058 if test -n "$_WRAP_MALLOC"; then
7059     if test -n "$GNU_CC"; then
7060         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7061         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7062         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7063         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7064         dnl Wrap operator new and operator delete on Android.
7065         if test "$OS_TARGET" = "Android"; then
7066             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7067         fi
7068     else
7069         AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7070     fi
7073 dnl ========================================================
7074 dnl = Location of malloc wrapper lib
7075 dnl ========================================================
7076 MOZ_ARG_WITH_STRING(wrap-malloc,
7077 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7078     WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7080 dnl ========================================================
7081 dnl = Use JS Call tracing
7082 dnl ========================================================
7083 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7084 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7085     MOZ_TRACE_JSCALLS=1,
7086     MOZ_TRACE_JSCALLS= )
7087 if test -n "$MOZ_TRACE_JSCALLS"; then
7088     AC_DEFINE(MOZ_TRACE_JSCALLS)
7091 dnl ========================================================
7092 dnl = Use incremental GC
7093 dnl ========================================================
7094 JSGC_INCREMENTAL=1
7095 MOZ_ARG_DISABLE_BOOL(gcincremental,
7096 [  --disable-gcincremental Disable incremental GC],
7097     JSGC_INCREMENTAL= )
7098 if test -n "$JSGC_INCREMENTAL"; then
7099     AC_DEFINE(JSGC_INCREMENTAL)
7102 dnl ========================================================
7103 dnl ETW - Event Tracing for Windows
7104 dnl ========================================================
7105 MOZ_ARG_ENABLE_BOOL(ETW,
7106 [  --enable-ETW            Enable ETW (Event Tracing for Windows) event reporting],
7107     MOZ_ETW=1,
7108     MOZ_ETW= )
7109 if test -n "$MOZ_ETW"; then
7110     AC_DEFINE(MOZ_ETW)
7113 if test -n "$MOZ_ETW"; then
7114     if test -z "$MOZ_WINSDK_TARGETVER"; then
7115         AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7116     fi
7119 dnl ========================================================
7120 dnl Zealous JavaScript GC
7121 dnl ========================================================
7122 MOZ_ARG_ENABLE_BOOL(gczeal,
7123 [  --enable-gczeal         Enable zealous JavaScript GCing],
7124     JS_GC_ZEAL=1,
7125     JS_GC_ZEAL= )
7126 if test -n "$JS_GC_ZEAL"; then
7127     AC_DEFINE(JS_GC_ZEAL)
7130 dnl ========================================================
7131 dnl JS opt-mode assertions and minidump instrumentation
7132 dnl ========================================================
7133 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7134 [  --enable-js-diagnostics
7135                           Enable JS diagnostic assertions and breakpad data],
7136     JS_CRASH_DIAGNOSTICS=1,
7137     JS_CRASH_DIAGNOSTICS= )
7138 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7139     AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7142 MOZ_CHECK_CCACHE
7144 dnl ========================================================
7145 dnl = Enable static checking using gcc-dehydra
7146 dnl ========================================================
7148 MOZ_ARG_WITH_STRING(static-checking,
7149 [  --with-static-checking=path/to/gcc_dehydra.so
7150                           Enable static checking of code using GCC-dehydra],
7151     DEHYDRA_PATH=$withval,
7152     DEHYDRA_PATH= )
7154 if test -n "$DEHYDRA_PATH"; then
7155     if test ! -f "$DEHYDRA_PATH"; then
7156         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7157     fi
7158     AC_DEFINE(NS_STATIC_CHECKING)
7160 AC_SUBST(DEHYDRA_PATH)
7162 dnl ========================================================
7163 dnl = Enable stripping of libs & executables
7164 dnl ========================================================
7165 MOZ_ARG_ENABLE_BOOL(strip,
7166 [  --enable-strip          Enable stripping of libs & executables ],
7167     ENABLE_STRIP=1,
7168     ENABLE_STRIP= )
7170 dnl ========================================================
7171 dnl = Enable stripping of libs & executables when packaging
7172 dnl ========================================================
7173 MOZ_ARG_ENABLE_BOOL(install-strip,
7174 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7175     PKG_SKIP_STRIP= ,
7176     PKG_SKIP_STRIP=1)
7178 dnl ========================================================
7179 dnl = --enable-elf-dynstr-gc
7180 dnl ========================================================
7181 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7182 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7183     USE_ELF_DYNSTR_GC=1,
7184     USE_ELF_DYNSTR_GC= )
7186 dnl ========================================================
7187 dnl = --disable-elf-hack
7188 dnl ========================================================
7190 USE_ELF_HACK=1
7191 MOZ_ARG_DISABLE_BOOL(elf-hack,
7192 [  --disable-elf-hack      Disable elf hacks],
7193     USE_ELF_HACK=,
7194     USE_ELF_HACK=1)
7196 # Disable elf hack for profiling because the built in profiler
7197 # doesn't read the segments properly with elf hack. This is
7198 # temporary and should be fixed soon in the profiler.
7199 if test "$MOZ_PROFILING" = 1; then
7200   USE_ELF_HACK=
7203 # Only enable elfhack where supported
7204 if test "$USE_ELF_HACK" = 1; then
7205     case "${HOST_OS_ARCH},${OS_ARCH}" in
7206     Linux,Linux)
7207         case "${CPU_ARCH}" in
7208         arm | x86 | x86_64)
7209             USE_ELF_HACK=1
7210             ;;
7211         *)
7212             USE_ELF_HACK=
7213             ;;
7214         esac
7215         ;;
7216     *)
7217         USE_ELF_HACK=
7218         ;;
7219     esac
7222 if test "$USE_ELF_HACK" = 1; then
7223     dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7224     dnl memory addresses it maps to. The result is that by the time elfhack
7225     dnl kicks in, it is not possible to apply relocations because of that,
7226     dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7227     dnl segment. It makes elfhack mostly useless, so considering the problems
7228     dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7229     dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7230     dnl the linker creates PT_GNU_RELRO segments.
7231     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7232         LINK_WITH_PT_GNU_RELRO,
7233         [echo "int main() {return 0;}" > conftest.${ac_ext}
7234          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7235             test -s conftest${ac_exeext}; then
7236             if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7237                 LINK_WITH_PT_GNU_RELRO=yes
7238             else
7239                 LINK_WITH_PT_GNU_RELRO=no
7240             fi
7241          else
7242              dnl We really don't expect to get here, but just in case
7243              AC_ERROR([couldn't compile a simple C file])
7244          fi
7245          rm -rf conftest*])
7246     if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7247         AC_MSG_WARN([Disabling elfhack])
7248         USE_ELF_HACK=
7249     fi
7252 dnl ========================================================
7253 dnl = libstdc++ compatibility hacks
7254 dnl ========================================================
7256 STDCXX_COMPAT=
7257 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7258 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
7259     STDCXX_COMPAT=1)
7261 AC_SUBST(STDCXX_COMPAT)
7263 if test -n "$STDCXX_COMPAT"; then
7264    eval $(CXX="$CXX" MACOS_SDK_DIR="$MACOS_SDK_DIR" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7265    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7266    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7269 dnl ========================================================
7270 dnl =
7271 dnl = Profiling and Instrumenting
7272 dnl =
7273 dnl ========================================================
7274 MOZ_ARG_HEADER(Profiling and Instrumenting)
7276 dnl ========================================================
7277 dnl = Enable NS_FUNCTION_TIMER, which provides Function
7278 dnl = timing for identifying code bottlenecks
7279 dnl = NS_FUNCTION_TIMER is off by default.
7280 dnl ========================================================
7281 MOZ_ARG_ENABLE_BOOL(functiontimer,
7282 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7283     NS_FUNCTION_TIMER=1,
7284     NS_FUNCTION_TIMER= )
7285 if test -n "$NS_FUNCTION_TIMER"; then
7286     AC_DEFINE(NS_FUNCTION_TIMER)
7289 dnl ========================================================
7290 dnl = Enable runtime visual profiling logger
7291 dnl ========================================================
7292 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7293 [  --enable-visual-event-tracer   Enable visual event tracer instrumentation],
7294     MOZ_VISUAL_EVENT_TRACER=1,
7295     MOZ_VISUAL_EVENT_TRACER=)
7296 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7297     AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7300 dnl ========================================================
7301 dnl Turn on reflow counting
7302 dnl ========================================================
7303 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7304 [  --enable-reflow-perf    Enable reflow performance tracing],
7305     MOZ_REFLOW_PERF=1,
7306     MOZ_REFLOW_PERF= )
7307 if test -n "$MOZ_REFLOW_PERF"; then
7308     AC_DEFINE(MOZ_REFLOW_PERF)
7311 dnl ========================================================
7312 dnl Enable code size metrics.
7313 dnl ========================================================
7314 MOZ_ARG_ENABLE_BOOL(codesighs,
7315 [  --enable-codesighs      Enable code size analysis tools],
7316     _ENABLE_CODESIGHS=1,
7317     _ENABLE_CODESIGHS= )
7318 if test -n "$_ENABLE_CODESIGHS"; then
7319     if test -d $srcdir/tools/codesighs; then
7320         MOZ_MAPINFO=1
7321     else
7322         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7323     fi
7326 dnl ========================================================
7327 dnl = Enable Radio Interface for B2G (Gonk usually)
7328 dnl ========================================================
7329 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7330 [  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7331     MOZ_B2G_RIL=1,
7332     MOZ_B2G_RIL= )
7333 if test -n "$MOZ_B2G_RIL"; then
7334     AC_DEFINE(MOZ_B2G_RIL)
7336 AC_SUBST(MOZ_B2G_RIL)
7338 dnl ========================================================
7339 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7340 dnl ========================================================
7341 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7342 [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
7343     MOZ_B2G_BT=1,
7344     MOZ_B2G_BT= )
7345 if test -n "$MOZ_B2G_BT"; then
7346     AC_DEFINE(MOZ_B2G_BT)
7348 AC_SUBST(MOZ_B2G_BT)
7350 dnl ========================================================
7351 dnl = Enable Support for System Messages API
7352 dnl ========================================================
7353 if test -n "$MOZ_SYS_MSG"; then
7354     AC_DEFINE(MOZ_SYS_MSG)
7356 AC_SUBST(MOZ_SYS_MSG)
7358 dnl ========================================================
7359 dnl = Enable Camera Interface for B2G (Gonk usually)
7360 dnl ========================================================
7361 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7362 [  --enable-b2g-camera      Set compile flags necessary for compiling camera API for B2G ],
7363     MOZ_B2G_CAMERA=1,
7364     MOZ_B2G_CAMERA= )
7365 if test -n "$MOZ_B2G_CAMERA"; then
7366    AC_DEFINE(MOZ_B2G_CAMERA)
7368 AC_SUBST(MOZ_B2G_CAMERA)
7370 dnl ========================================================
7371 dnl = Support for demangling undefined symbols
7372 dnl ========================================================
7373 if test -z "$SKIP_LIBRARY_CHECKS"; then
7374     AC_LANG_SAVE
7375     AC_LANG_CPLUSPLUS
7376     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7377     AC_LANG_RESTORE
7380 # Demangle only for debug or trace-malloc builds
7381 MOZ_DEMANGLE_SYMBOLS=
7382 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7383     MOZ_DEMANGLE_SYMBOLS=1
7384     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7386 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7388 dnl ========================================================
7389 dnl = Support for gcc stack unwinding (from gcc 3.3)
7390 dnl ========================================================
7391 if test -z "$SKIP_LIBRARY_CHECKS"; then
7392     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7395 dnl ========================================================
7396 dnl JIT observers
7397 dnl ========================================================
7399 MOZ_ARG_WITH_STRING(jitreport-granularity,
7400 [  --jitreport-granularity=N
7401                            Default granularity at which to report JIT code
7402                            to external tools
7403                              0 - no info
7404                              1 - code ranges for whole functions only
7405                              2 - per-line information
7406                              3 - per-op information],
7407   JITREPORT_GRANULARITY=$withval,
7408   JITREPORT_GRANULARITY=3)
7410 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7412 dnl ========================================================
7413 dnl =
7414 dnl = Misc. Options
7415 dnl =
7416 dnl ========================================================
7417 MOZ_ARG_HEADER(Misc. Options)
7419 dnl ========================================================
7420 dnl update xterm title
7421 dnl ========================================================
7422 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7423 [  --enable-xterm-updates  Update XTERM titles with current command.],
7424     MOZ_UPDATE_XTERM=1,
7425     MOZ_UPDATE_XTERM= )
7427 dnl =========================================================
7428 dnl = Chrome format
7429 dnl =========================================================
7430 MOZ_ARG_ENABLE_STRING([chrome-format],
7431 [  --enable-chrome-format=jar|flat|both|symlink|omni
7432                           Select FORMAT of chrome files (default=jar)],
7433     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7435 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7436     MOZ_CHROME_FILE_FORMAT=jar
7439 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7440     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7441     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7442     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7443     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7444     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7447 dnl =========================================================
7448 dnl Omnijar packaging (bug 552121)
7449 dnl =========================================================
7450 dnl Omnijar packaging is compatible with flat packaging.
7451 dnl In unpackaged builds, omnijar looks for files as if
7452 dnl things were flat packaged. After packaging, all files
7453 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7454 dnl is set to flat since putting files into jars is only
7455 dnl done during packaging with omnijar.
7456 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7457     MOZ_OMNIJAR=1
7458     AC_DEFINE(MOZ_OMNIJAR)
7459     if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$OS_TARGET" = "Android"; then
7460         MOZ_CHROME_FILE_FORMAT=flat
7461     else
7462         MOZ_CHROME_FILE_FORMAT=symlink
7463     fi
7464 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7465     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7468 OMNIJAR_NAME=omni.ja
7469 AC_SUBST(OMNIJAR_NAME)
7470 AC_SUBST(MOZ_OMNIJAR)
7472 dnl ========================================================
7473 dnl = Define default location for MOZILLA_FIVE_HOME
7474 dnl ========================================================
7475 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7476 [  --with-default-mozilla-five-home
7477                           Set the default value for MOZILLA_FIVE_HOME],
7478 [ val=`echo $withval`
7479   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7481 dnl ========================================================
7482 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7483 dnl ========================================================
7484 MOZ_ARG_WITH_STRING(user-appdir,
7485 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7486 [ val=`echo $withval`
7487 if echo "$val" | grep "\/" >/dev/null; then
7488     AC_MSG_ERROR("Homedir must be single relative path.")
7489 else
7490     MOZ_USER_DIR="$val"
7491 fi])
7493 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7495 dnl ========================================================
7496 dnl = Doxygen configuration
7497 dnl ========================================================
7498 dnl Use commas to specify multiple dirs to this arg
7499 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7500 MOZ_ARG_WITH_STRING(doc-input-dirs,
7501 [  --with-doc-input-dirs=DIRS
7502                           Header/idl dirs to create docs from],
7503 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7504 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7506 dnl Use commas to specify multiple dirs to this arg
7507 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7508 MOZ_ARG_WITH_STRING(doc-include-dirs,
7509 [  --with-doc-include-dirs=DIRS
7510                           Include dirs to preprocess doc headers],
7511 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7512 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7514 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7515 MOZ_ARG_WITH_STRING(doc-output-dir,
7516 [  --with-doc-output-dir=DIR
7517                           Dir to generate docs into],
7518 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7519 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7521 if test -z "$SKIP_COMPILER_CHECKS"; then
7522 dnl ========================================================
7523 dnl =
7524 dnl = Compiler Options
7525 dnl =
7526 dnl ========================================================
7527 MOZ_ARG_HEADER(Compiler Options)
7529 dnl ========================================================
7530 dnl Check for gcc -pipe support
7531 dnl ========================================================
7532 AC_MSG_CHECKING([for -pipe support])
7533 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7534     dnl Any gcc that supports firefox supports -pipe.
7535     CFLAGS="$CFLAGS -pipe"
7536     CXXFLAGS="$CXXFLAGS -pipe"
7537     AC_MSG_RESULT([yes])
7538 else
7539     AC_MSG_RESULT([no])
7542 dnl ========================================================
7543 dnl Profile guided optimization (gcc checks)
7544 dnl ========================================================
7545 dnl Test for profiling options
7546 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7548 _SAVE_CFLAGS="$CFLAGS"
7549 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7551 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7552 AC_TRY_COMPILE([], [return 0;],
7553                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7554                  result="yes" ], result="no")
7555 AC_MSG_RESULT([$result])
7557 if test $result = "yes"; then
7558   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7559   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7560   PROFILE_USE_LDFLAGS="-fprofile-use"
7563 CFLAGS="$_SAVE_CFLAGS"
7565 if test -n "$INTEL_CC"; then
7566   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7567   PROFILE_GEN_LDFLAGS=
7568   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7569   PROFILE_USE_LDFLAGS=
7572 dnl Sun Studio on Solaris
7573 if test "$SOLARIS_SUNPRO_CC"; then
7574   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7575   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7576   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7577   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7580 AC_SUBST(PROFILE_GEN_CFLAGS)
7581 AC_SUBST(PROFILE_GEN_LDFLAGS)
7582 AC_SUBST(PROFILE_USE_CFLAGS)
7583 AC_SUBST(PROFILE_USE_LDFLAGS)
7585 AC_LANG_CPLUSPLUS
7587 dnl ========================================================
7588 dnl Test for -pedantic bustage
7589 dnl ========================================================
7590 MOZ_ARG_DISABLE_BOOL(pedantic,
7591 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7592 _PEDANTIC= )
7593 if test "$_PEDANTIC"; then
7594     _SAVE_CXXFLAGS=$CXXFLAGS
7595     CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7596     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7597     AC_TRY_COMPILE([$configure_static_assert_macros],
7598                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7599                    result="no", result="yes" )
7600     AC_MSG_RESULT([$result])
7601     CXXFLAGS="$_SAVE_CXXFLAGS"
7603     case "$result" in
7604     no)
7605         _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
7606         _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7607         ;;
7608     yes)
7609         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7610         ;;
7611     esac
7614 dnl ========================================================
7615 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7616 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7617 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7618 dnl ========================================================
7619 _SAVE_CXXFLAGS=$CXXFLAGS
7620 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7621 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7622     ac_nscap_nonconst_opeq_bug,
7623     [AC_TRY_COMPILE([
7624                       template <class T>
7625                       class Pointer
7626                         {
7627                         public:
7628                           T* myPtr;
7629                         };
7631                       template <class T, class U>
7632                       int operator==(const Pointer<T>& rhs, U* lhs)
7633                         {
7634                           return rhs.myPtr == lhs;
7635                         }
7637                       template <class T, class U>
7638                       int operator==(const Pointer<T>& rhs, const U* lhs)
7639                         {
7640                           return rhs.myPtr == lhs;
7641                         }
7642                     ],
7643                     [
7644                       Pointer<int> foo;
7645                       const int* bar;
7646                       return foo == bar;
7647                     ],
7648                     ac_nscap_nonconst_opeq_bug="no",
7649                     ac_nscap_nonconst_opeq_bug="yes")])
7650 CXXFLAGS="$_SAVE_CXXFLAGS"
7652 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7653     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7655 fi # ! SKIP_COMPILER_CHECKS
7657 AC_DEFINE(CPP_THROW_NEW, [throw()])
7658 AC_LANG_C
7660 if test "$COMPILE_ENVIRONMENT"; then
7661 MOZ_EXPAND_LIBS
7662 fi # COMPILE_ENVIRONMENT
7664 dnl ========================================================
7665 dnl =
7666 dnl = Build depencency options
7667 dnl =
7668 dnl ========================================================
7669 MOZ_ARG_HEADER(Build dependencies)
7671 dnl ========================================================
7672 dnl = Do not auto generate dependency info
7673 dnl ========================================================
7674 MOZ_AUTO_DEPS=1
7675 MOZ_ARG_DISABLE_BOOL(auto-deps,
7676 [  --disable-auto-deps     Do not automatically generate dependency info],
7677     MOZ_AUTO_DEPS=,
7678     MOZ_AUTO_DEPS=1)
7680 if test -n "$MOZ_AUTO_DEPS"; then
7681 dnl ========================================================
7682 dnl = Use mkdepend instead of $CC -MD for dependency generation
7683 dnl ========================================================
7684 _cpp_md_flag=
7685 MOZ_ARG_DISABLE_BOOL(md,
7686 [  --disable-md            Do not use compiler-based dependencies ],
7687   [_cpp_md_flag=],
7688   [_cpp_md_flag=1],
7689   [dnl Default is to turn on -MD if using GNU-compatible compilers
7690    if test "$GNU_CC" -a "$GNU_CXX"; then
7691      _cpp_md_flag=1
7692    fi
7693   dnl Default is to use -xM if using Sun Studio on Solaris
7694    if test "$SOLARIS_SUNPRO_CC"; then
7695      _cpp_md_flag=1
7696    fi])
7697 if test "$_cpp_md_flag"; then
7698   COMPILER_DEPEND=1
7699   _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
7700   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7701   if test "$SOLARIS_SUNPRO_CC"; then
7702     _DEPEND_CFLAGS=
7703   fi
7704 else
7705   COMPILER_DEPEND=
7706   dnl Don't override this for MSVC
7707   if test -z "$_WIN32_MSVC"; then
7708     _USE_CPP_INCLUDE_FLAG=
7709     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7710     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7711   else
7712     echo '#include <stdio.h>' > dummy-hello.c
7713     changequote(,)
7714     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7715     changequote([,])
7716     if test -z "$CL_INCLUDES_PREFIX"; then
7717         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7718     fi
7719     AC_SUBST(CL_INCLUDES_PREFIX)
7720     rm -f dummy-hello.c
7721     COMPILER_DEPEND=1
7722   fi
7724 fi # MOZ_AUTO_DEPS
7725 MDDEPDIR='.deps'
7726 AC_SUBST(MOZ_AUTO_DEPS)
7727 AC_SUBST(COMPILER_DEPEND)
7728 AC_SUBST(MDDEPDIR)
7730 dnl ========================================================
7731 dnl =
7732 dnl = Static Build Options
7733 dnl =
7734 dnl ========================================================
7735 MOZ_ARG_HEADER(Static build options)
7737 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7738 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
7739   ENABLE_SHARED_JS=1
7742 MOZ_ARG_ENABLE_BOOL(shared-js,
7743 [  --enable-shared-js
7744                           Create a shared JavaScript library.],
7745     ENABLE_SHARED_JS=1,
7746     ENABLE_SHARED_JS=)
7748 if test -n "$ENABLE_SHARED_JS"; then
7749   JS_SHARED_LIBRARY=1
7750   MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7751 else
7752   MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7753   AC_DEFINE(MOZ_STATIC_JS)
7755 AC_SUBST(JS_SHARED_LIBRARY)
7757 AC_SUBST(LIBXUL_LIBS)
7758 XPCOM_LIBS="$LIBXUL_LIBS"
7760 dnl ========================================================
7761 dnl =
7762 dnl = Standalone module options
7763 dnl =
7764 dnl ========================================================
7765 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7767 dnl Check for GLib.
7768 dnl ========================================================
7770 if test -z "$SKIP_PATH_CHECKS"; then
7771 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7772     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7773         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7774     fi
7778 if test -z "${GLIB_GMODULE_LIBS}" \
7779    -a -n "${GLIB_CONFIG}"\
7780     -a "${GLIB_CONFIG}" != no\
7781 ; then
7782     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7785 AC_SUBST(GLIB_CFLAGS)
7786 AC_SUBST(GLIB_LIBS)
7787 AC_SUBST(GLIB_GMODULE_LIBS)
7789 dnl ========================================================
7790 dnl Graphics checks.
7791 dnl ========================================================
7793 if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
7794 MOZ_ENABLE_SKIA=1
7795 else
7796 MOZ_ENABLE_SKIA=
7799 MOZ_ARG_ENABLE_BOOL(skia,
7800 [  --enable-skia   Enable use of Skia],
7801 MOZ_ENABLE_SKIA=1,
7802 MOZ_ENABLE_SKIA=)
7804 if test "$USE_FC_FREETYPE"; then
7805     if test "$COMPILE_ENVIRONMENT"; then
7806         dnl ========================================================
7807         dnl = Check for freetype2 and its functionality
7808         dnl ========================================================
7809         PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7811         if test "$_HAVE_FREETYPE2"; then
7812             _SAVE_LIBS="$LIBS"
7813             _SAVE_CFLAGS="$CFLAGS"
7814             LIBS="$LIBS $FT2_LIBS"
7815             CFLAGS="$CFLAGS $FT2_CFLAGS"
7817             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7818                 ac_cv_member_FT_Bitmap_Size_y_ppem,
7819                 [AC_TRY_COMPILE([#include <ft2build.h>
7820                                  #include FT_FREETYPE_H],
7821                                 [FT_Bitmap_Size s;
7822                                  if (sizeof s.y_ppem) return 0;
7823                                  return 1],
7824                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7825                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7826             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7827                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7828             else
7829                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7830             fi
7831             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7832                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7833                                [FT_Bitmap_Size structure includes y_ppem field])
7835             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
7837             LIBS="$_SAVE_LIBS"
7838             CFLAGS="$_SAVE_CFLAGS"
7839         fi
7841         _SAVE_CPPFLAGS="$CPPFLAGS"
7842         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7843         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7844             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7845         CPPFLAGS="$_SAVE_CPPFLAGS"
7846     else
7847         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7848     fi
7850     PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
7851     [
7852         if test "$MOZ_PANGO"; then
7853             MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
7854             MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
7855         else
7856             FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
7857             FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
7858         fi
7859     ])
7862 dnl ========================================================
7863 dnl Check for pixman and cairo
7864 dnl ========================================================
7866 MOZ_TREE_CAIRO=1
7867 MOZ_ARG_ENABLE_BOOL(system-cairo,
7868 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
7869 MOZ_TREE_CAIRO=,
7870 MOZ_TREE_CAIRO=1 )
7872 MOZ_TREE_PIXMAN=1
7873 MOZ_ARG_ENABLE_BOOL(system-pixman,
7874 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7875 MOZ_TREE_PIXMAN=,
7876 MOZ_TREE_PIXMAN=force,
7877 MOZ_TREE_PIXMAN=1 )
7879 # System cairo depends on system pixman
7880 if test "$MOZ_TREE_PIXMAN" = "force"; then
7881     if test -z "$MOZ_TREE_CAIRO"; then
7882         AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7883     else
7884         MOZ_TREE_PIXMAN=1
7885     fi
7886 elif test -z "$MOZ_TREE_CAIRO"; then
7887     MOZ_TREE_PIXMAN=
7890 if test "$MOZ_TREE_PIXMAN"; then
7891     AC_DEFINE(MOZ_TREE_PIXMAN)
7892     MOZ_PIXMAN_CFLAGS=""
7893     MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
7894 else
7895     PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
7896     MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
7897     MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
7899 AC_SUBST(MOZ_PIXMAN_CFLAGS)
7900 AC_SUBST(MOZ_PIXMAN_LIBS)
7902 # Check for headers defining standard int types.
7903 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7905 if test "$MOZ_TREE_CAIRO"; then
7906     MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7907     AC_DEFINE(MOZ_TREE_CAIRO)
7909     # For now we assume that we will have a uint64_t available through
7910     # one of the above headers or mozstdint.h.
7911     AC_DEFINE(HAVE_UINT64_T)
7913     # Define macros for cairo-features.h
7914     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
7915     if test "$MOZ_X11"; then
7916         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7917         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7918         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7919         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7920         MOZ_ENABLE_CAIRO_FT=1
7921         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7922     fi
7923     case "$MOZ_WIDGET_TOOLKIT" in
7924       qt)
7925         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7926         ;;
7927       cocoa | uikit)
7928         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7929         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7930         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7931         ;;
7932       windows)
7933         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7934         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7935         if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7936             WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7937             WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7938             MOZ_ENABLE_D2D_SURFACE=1
7939             MOZ_ENABLE_DWRITE_FONT=1
7940         else
7941             WIN32_DWRITE_FONT_FEATURE=
7942             WIN32_D2D_SURFACE_FEATURE=
7943         fi
7945         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
7947         dnl D3D10 Layers depend on D2D Surfaces.
7948         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
7949           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
7950         fi
7951         ;;
7952       os2)
7953         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7954         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7955         MOZ_ENABLE_CAIRO_FT=1
7956         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7957         CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7958         CAIRO_FT_LIBS=""
7959         ;;
7960     esac
7961     if test "$USE_FC_FREETYPE"; then
7962         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7963     fi
7964     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7965     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
7966     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
7967     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
7968     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
7969     AC_SUBST(CAIRO_FT_CFLAGS)
7971     AC_SUBST(PS_SURFACE_FEATURE)
7972     AC_SUBST(PDF_SURFACE_FEATURE)
7973     AC_SUBST(SVG_SURFACE_FEATURE)
7974     AC_SUBST(XLIB_SURFACE_FEATURE)
7975     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7976     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7977     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7978     AC_SUBST(WIN32_SURFACE_FEATURE)
7979     AC_SUBST(OS2_SURFACE_FEATURE)
7980     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7981     AC_SUBST(FT_FONT_FEATURE)
7982     AC_SUBST(FC_FONT_FEATURE)
7983     AC_SUBST(WIN32_FONT_FEATURE)
7984     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
7985     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
7986     AC_SUBST(QUARTZ_FONT_FEATURE)
7987     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7988     AC_SUBST(QT_SURFACE_FEATURE)
7989     AC_SUBST(TEE_SURFACE_FEATURE)
7991     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
7992     MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
7994     if test "$MOZ_X11"; then
7995         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
7996     fi
7998     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7999 else
8000     PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8001     MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8002     MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8003     PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8004     if test "$MOZ_X11"; then
8005         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8006         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8007         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8008         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8009     fi
8012 AC_SUBST(MOZ_TREE_CAIRO)
8013 AC_SUBST(MOZ_CAIRO_CFLAGS)
8014 AC_SUBST(MOZ_CAIRO_LIBS)
8015 AC_SUBST(MOZ_CAIRO_OSLIBS)
8016 AC_SUBST(MOZ_TREE_PIXMAN)
8018 dnl ========================================================
8019 dnl qcms
8020 dnl ========================================================
8022 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8023 AC_SUBST(QCMS_LIBS)
8025 dnl ========================================================
8026 dnl HarfBuzz
8027 dnl ========================================================
8028 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8029 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8031 dnl ========================================================
8032 dnl SIL Graphite
8033 dnl ========================================================
8034 if test "$MOZ_GRAPHITE"; then
8035   MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8036   AC_DEFINE(MOZ_GRAPHITE)
8037 else
8038   MOZ_GRAPHITE_LIBS=
8040 AC_SUBST(MOZ_GRAPHITE)
8041 AC_SUBST(MOZ_GRAPHITE_LIBS)
8043 dnl ========================================================
8044 dnl OTS
8045 dnl ========================================================
8046 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8047 AC_SUBST(MOZ_OTS_LIBS)
8049 dnl ========================================================
8050 dnl Skia 
8051 dnl ========================================================
8052 if test "$MOZ_ENABLE_SKIA"; then
8053   MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8054   AC_DEFINE(MOZ_ENABLE_SKIA)
8055 else
8056   MOZ_SKIA_LIBS=
8058 AC_SUBST(MOZ_ENABLE_SKIA)
8059 AC_SUBST(MOZ_SKIA_LIBS)
8061 dnl ========================================================
8062 dnl disable xul
8063 dnl ========================================================
8064 MOZ_ARG_DISABLE_BOOL(xul,
8065 [  --disable-xul           Disable XUL],
8066     MOZ_XUL= )
8067 if test "$MOZ_XUL"; then
8068   AC_DEFINE(MOZ_XUL)
8069 else
8070   dnl remove extensions that require XUL
8071   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8074 AC_SUBST(MOZ_XUL)
8076 dnl ========================================================
8077 dnl disable profile locking
8078 dnl   do no use this in applications that can have more than
8079 dnl   one process accessing the profile directory.
8080 dnl ========================================================
8081 MOZ_ARG_DISABLE_BOOL(profilelocking,
8082 [  --disable-profilelocking
8083                           Disable profile locking],
8084     MOZ_PROFILELOCKING=,
8085     MOZ_PROFILELOCKING=1 )
8086 if test "$MOZ_PROFILELOCKING"; then
8087   AC_DEFINE(MOZ_PROFILELOCKING)
8090 dnl ========================================================
8091 dnl necko configuration options
8092 dnl ========================================================
8095 dnl option to disable various necko protocols
8097 MOZ_ARG_ENABLE_STRING(necko-protocols,
8098 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8099                           Enable/disable specific protocol handlers],
8100 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8101     if test "$option" = "yes" -o "$option" = "all"; then
8102         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8103     elif test "$option" = "no" -o "$option" = "none"; then
8104         NECKO_PROTOCOLS=""
8105     elif test "$option" = "default"; then
8106         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8107     elif test `echo "$option" | grep -c \^-` != 0; then
8108         option=`echo $option | sed 's/^-//'`
8109         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8110     else
8111         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8112     fi
8113 done],
8114     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8115 dnl Remove dupes
8116 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8117 AC_SUBST(NECKO_PROTOCOLS)
8118 for p in $NECKO_PROTOCOLS; do
8119     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8120     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8121 done
8124 dnl option to disable necko's wifi scanner
8126 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8127 [  --disable-necko-wifi    Disable necko wifi scanner],
8128     NECKO_WIFI=,
8129     NECKO_WIFI=1)
8131 if test "$OS_ARCH" = "OS2"; then
8132   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8133   NECKO_WIFI=
8135 if test "$NECKO_WIFI" -a \
8136         "$OS_ARCH" != "Linux" -a \
8137         "$OS_ARCH" != "Darwin" -a \
8138         "$OS_ARCH" != "SunOS" -a \
8139         "$OS_ARCH" != "WINNT"; then
8140   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8143 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8144 then
8145   MOZ_CHECK_HEADER([iwlib.h])
8146   if test "$ac_cv_header_iwlib_h" != "yes"; then
8147     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])
8148   fi
8151 if test "$NECKO_WIFI"; then
8152   AC_DEFINE(NECKO_WIFI)
8153   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8155 AC_SUBST(NECKO_WIFI)
8158 dnl option to disable cookies
8160 MOZ_ARG_DISABLE_BOOL(cookies,
8161 [  --disable-cookies       Disable cookie support],
8162     NECKO_COOKIES=,
8163     NECKO_COOKIES=1)
8164 AC_SUBST(NECKO_COOKIES)
8165 if test "$NECKO_COOKIES"; then
8166     AC_DEFINE(NECKO_COOKIES)
8167     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8171 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8173 MOZ_ARG_DISABLE_BOOL(ctypes,
8174 [  --disable-ctypes        Disable js-ctypes],
8175     BUILD_CTYPES=,
8176     BUILD_CTYPES=1)
8177 AC_SUBST(BUILD_CTYPES)
8178 if test "$BUILD_CTYPES"; then
8179     AC_DEFINE(BUILD_CTYPES)
8182 dnl Build Places if required
8183 if test "$MOZ_PLACES"; then
8184   AC_DEFINE(MOZ_PLACES)
8187 dnl Build Apps in the Cloud (AITC) if required
8188 AC_SUBST(MOZ_SERVICES_AITC)
8189 if test -n "$MOZ_SERVICES_AITC"; then
8190   AC_DEFINE(MOZ_SERVICES_AITC)
8193 dnl Build Notifications if required
8194 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8195 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8196   AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8199 dnl Build Sync Services if required
8200 AC_SUBST(MOZ_SERVICES_SYNC)
8201 if test -n "$MOZ_SERVICES_SYNC"; then
8202   AC_DEFINE(MOZ_SERVICES_SYNC)
8205 dnl ========================================================
8206 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8207     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8210 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8211   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8214 if test "$MOZ_APP_COMPONENT_MODULES"; then
8215   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8218 dnl ========================================================
8219 dnl =
8220 dnl = Maintainer debug option (no --enable equivalent)
8221 dnl =
8222 dnl ========================================================
8224 AC_SUBST(AR)
8225 AC_SUBST(AR_FLAGS)
8226 AC_SUBST(AR_LIST)
8227 AC_SUBST(AR_EXTRACT)
8228 AC_SUBST(AR_DELETE)
8229 AC_SUBST(AS)
8230 AC_SUBST(ASFLAGS)
8231 AC_SUBST(AS_DASH_C_FLAG)
8232 AC_SUBST(LD)
8233 AC_SUBST(RC)
8234 AC_SUBST(RCFLAGS)
8235 AC_SUBST(MC)
8236 AC_SUBST(WINDRES)
8237 AC_SUBST(IMPLIB)
8238 AC_SUBST(FILTER)
8239 AC_SUBST(BIN_FLAGS)
8240 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8241 AC_SUBST(MOZ_UPDATE_XTERM)
8242 AC_SUBST(MOZ_PLATFORM_MAEMO)
8243 AC_SUBST(MOZ_AUTH_EXTENSION)
8244 AC_SUBST(MOZ_PERMISSIONS)
8245 AC_SUBST(MOZ_XTF)
8246 AC_SUBST(MOZ_PREF_EXTENSIONS)
8247 AC_SUBST(MOZ_JS_LIBS)
8248 AC_SUBST(MOZ_PSM)
8249 AC_SUBST(MOZ_DEBUG)
8250 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8251 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8252 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8253 AC_SUBST(MOZ_DEBUG_FLAGS)
8254 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8255 AC_SUBST(WARNINGS_AS_ERRORS)
8256 AC_SUBST(MOZ_EXTENSIONS)
8257 AC_SUBST(MOZ_JSDEBUGGER)
8258 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8259 AC_SUBST(MOZ_JPROF)
8260 AC_SUBST(MOZ_SHARK)
8261 AC_SUBST(MOZ_CALLGRIND)
8262 AC_SUBST(MOZ_VTUNE)
8263 AC_SUBST(MOZ_ETW)
8264 AC_SUBST(MOZ_PROFILING)
8265 AC_SUBST(LIBICONV)
8266 AC_SUBST(MOZ_PLACES)
8267 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8268 AC_SUBST(MOZ_FEEDS)
8269 AC_SUBST(NS_PRINTING)
8270 AC_SUBST(MOZ_WEBGL)
8271 AC_SUBST(MOZ_HELP_VIEWER)
8272 AC_SUBST(TOOLCHAIN_PREFIX)
8274 AC_SUBST(JAVA)
8275 AC_SUBST(JAVAC)
8276 AC_SUBST(JAR)
8278 AC_SUBST(MOZ_PROFILELOCKING)
8280 AC_SUBST(ENABLE_TESTS)
8281 AC_SUBST(ENABLE_MARIONETTE)
8282 AC_SUBST(IBMBIDI)
8283 AC_SUBST(MOZ_UNIVERSALCHARDET)
8284 AC_SUBST(ACCESSIBILITY)
8285 AC_SUBST(MOZ_SPELLCHECK)
8286 AC_SUBST(MOZ_JAVA_COMPOSITOR)
8287 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8288 AC_SUBST(MOZ_CRASHREPORTER)
8289 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8290 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8291 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8292 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8293 AC_SUBST(MOZ_UPDATER)
8294 AC_SUBST(MOZ_ANGLE_RENDERER)
8295 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8296 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8297 AC_SUBST(MOZ_D3DX9_VERSION)
8298 AC_SUBST(MOZ_D3DX9_CAB)
8299 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8300 AC_SUBST(MOZ_D3DX9_DLL)
8301 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8302 AC_SUBST(MOZ_METRO)
8304 AC_SUBST(MOZ_ANDROID_HISTORY)
8305 AC_SUBST(MOZ_WEBSMS_BACKEND)
8306 AC_SUBST(ENABLE_STRIP)
8307 AC_SUBST(PKG_SKIP_STRIP)
8308 AC_SUBST(STRIP_FLAGS)
8309 AC_SUBST(USE_ELF_DYNSTR_GC)
8310 AC_SUBST(USE_ELF_HACK)
8311 AC_SUBST(INCREMENTAL_LINKER)
8312 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8313 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8315 AC_SUBST(MOZ_FIX_LINK_PATHS)
8316 AC_SUBST(XPCOM_LIBS)
8317 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8318 AC_SUBST(XPCOM_GLUE_LDOPTS)
8319 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8320 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8321 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8323 AC_SUBST(USE_DEPENDENT_LIBS)
8325 AC_SUBST(MOZ_BUILD_ROOT)
8326 AC_SUBST(MOZ_OS2_TOOLS)
8328 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8329 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8330 AC_SUBST(MOZ_LINKER_EXTRACT)
8331 AC_SUBST(MOZ_PER_WINDOW_PRIVATE_BROWSING)
8333 dnl ========================================================
8334 dnl = Mac bundle name prefix
8335 dnl ========================================================
8336 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8337 [  --with-macbundlename-prefix=prefix
8338                           Prefix for MOZ_MACBUNDLE_NAME],
8339 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8341 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8342 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8343   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8346 if test "$MOZ_DEBUG"; then
8347   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8348 else
8349   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8351 AC_SUBST(MOZ_MACBUNDLE_NAME)
8353 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8354 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8355 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8356 if test "$MOZ_DEBUG"; then
8357   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8360 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8361 AC_SUBST(MOZ_MACBUNDLE_ID)
8363 # The following variables are available to branding and application
8364 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8365 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8366 # impacts profile location and user-visible fields.
8367 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8368 # versions of a given application (e.g. Aurora and Firefox both use
8369 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8370 # for application.ini's "Name" field, which controls profile location in
8371 # the absence of a "Profile" field (see below), and various system
8372 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8373 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8374 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8375 # builds (e.g. Aurora for Firefox).
8376 # - MOZ_APP_VERSION: Defines the application version number.
8377 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8378 # defaults to a lowercase form of MOZ_APP_BASENAME.
8379 # - MOZ_APP_PROFILE: When set, used for application.ini's
8380 # "Profile" field, which controls profile location.
8381 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8382 # crash reporter server url.
8383 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8384 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8386 if test -z "$MOZ_APP_NAME"; then
8387    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8390 # For extensions and langpacks, we require a max version that is compatible
8391 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8392 # 10.0a1 and 10.0a2 aren't affected
8393 # 10.0 becomes 10.0.*
8394 # 10.0.1 becomes 10.0.*
8395 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8396 if test -z "$IS_ALPHA"; then
8397   changequote(,)
8398   MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8399   changequote([,])
8400 else
8401   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8404 AC_SUBST(MOZ_APP_NAME)
8405 AC_SUBST(MOZ_APP_DISPLAYNAME)
8406 AC_SUBST(MOZ_APP_BASENAME)
8407 AC_SUBST(MOZ_APP_VENDOR)
8408 AC_SUBST(MOZ_APP_PROFILE)
8409 AC_SUBST(MOZ_APP_ID)
8410 AC_SUBST(MAR_CHANNEL_ID)
8411 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8412 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8413 AC_SUBST(MOZ_EXTENSION_MANAGER)
8414 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8415 AC_SUBST(MOZ_APP_UA_NAME)
8416 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8417 AC_SUBST(MOZ_APP_VERSION)
8418 AC_SUBST(MOZ_APP_MAXVERSION)
8419 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8420 AC_SUBST(FIREFOX_VERSION)
8421 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8422 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8423   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8426 # We can't use the static application.ini data when building against
8427 # a libxul SDK.
8428 if test -n "$LIBXUL_SDK"; then
8429     MOZ_APP_STATIC_INI=
8431 AC_SUBST(MOZ_APP_STATIC_INI)
8433 AC_SUBST(MOZ_PKG_SPECIAL)
8435 AC_SUBST(MOZILLA_OFFICIAL)
8437 if test "$MOZ_TELEMETRY_REPORTING"; then
8438     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8441 dnl win32 options
8442 AC_SUBST(MOZ_MAPINFO)
8443 AC_SUBST(MOZ_BROWSE_INFO)
8444 AC_SUBST(MOZ_TOOLS_DIR)
8445 AC_SUBST(WIN32_REDIST_DIR)
8446 AC_SUBST(MAKENSISU)
8448 dnl Echo the CFLAGS to remove extra whitespace.
8449 CFLAGS=`echo \
8450         $_WARNINGS_CFLAGS \
8451         $CFLAGS`
8453 CXXFLAGS=`echo \
8454         $_WARNINGS_CXXFLAGS \
8455         $CXXFLAGS`
8457 COMPILE_CFLAGS=`echo \
8458     $_DEFINES_CFLAGS \
8459         $_DEPEND_CFLAGS \
8460     $COMPILE_CFLAGS`
8462 COMPILE_CXXFLAGS=`echo \
8463     $_DEFINES_CXXFLAGS \
8464         $_DEPEND_CFLAGS \
8465     $COMPILE_CXXFLAGS`
8467 AC_SUBST(MOZ_NATIVE_MAKEDEPEND)
8468 AC_SUBST(SYSTEM_LIBXUL)
8469 AC_SUBST(MOZ_NATIVE_JPEG)
8470 AC_SUBST(MOZ_NATIVE_PNG)
8471 AC_SUBST(MOZ_NATIVE_BZ2)
8473 AC_SUBST(MOZ_FLEXBOX)
8474 AC_SUBST(MOZ_JPEG_CFLAGS)
8475 AC_SUBST(MOZ_JPEG_LIBS)
8476 AC_SUBST(MOZ_BZ2_CFLAGS)
8477 AC_SUBST(MOZ_BZ2_LIBS)
8478 AC_SUBST(MOZ_PNG_CFLAGS)
8479 AC_SUBST(MOZ_PNG_LIBS)
8481 AC_SUBST(NSPR_CFLAGS)
8482 AC_SUBST(NSPR_LIBS)
8483 AC_SUBST(MOZ_NATIVE_NSPR)
8485 AC_SUBST(NSS_CFLAGS)
8486 AC_SUBST(NSS_LIBS)
8487 AC_SUBST(NSS_DEP_LIBS)
8488 AC_SUBST(MOZ_NATIVE_NSS)
8489 AC_SUBST(NSS_DISABLE_DBM)
8491 OS_CFLAGS="$CFLAGS"
8492 OS_CXXFLAGS="$CXXFLAGS"
8493 OS_CPPFLAGS="$CPPFLAGS"
8494 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8495 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8496 OS_LDFLAGS="$LDFLAGS"
8497 OS_LIBS="$LIBS"
8498 AC_SUBST(OS_CFLAGS)
8499 AC_SUBST(OS_CXXFLAGS)
8500 AC_SUBST(OS_CPPFLAGS)
8501 AC_SUBST(OS_COMPILE_CFLAGS)
8502 AC_SUBST(OS_COMPILE_CXXFLAGS)
8503 AC_SUBST(OS_LDFLAGS)
8504 AC_SUBST(OS_LIBS)
8505 AC_SUBST(CROSS_COMPILE)
8506 AC_SUBST(WCHAR_CFLAGS)
8508 AC_SUBST(HOST_CC)
8509 AC_SUBST(HOST_CXX)
8510 AC_SUBST(HOST_CFLAGS)
8511 AC_SUBST(HOST_CXXFLAGS)
8512 AC_SUBST(HOST_LDFLAGS)
8513 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8514 AC_SUBST(HOST_AR)
8515 AC_SUBST(HOST_AR_FLAGS)
8516 AC_SUBST(HOST_LD)
8517 AC_SUBST(HOST_RANLIB)
8518 AC_SUBST(HOST_NSPR_MDCPUCFG)
8519 AC_SUBST(HOST_BIN_SUFFIX)
8520 AC_SUBST(HOST_OS_ARCH)
8522 AC_SUBST(TARGET_CPU)
8523 AC_SUBST(TARGET_VENDOR)
8524 AC_SUBST(TARGET_OS)
8525 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8526 AC_SUBST(TARGET_MD_ARCH)
8527 AC_SUBST(TARGET_XPCOM_ABI)
8528 AC_SUBST(OS_TARGET)
8529 AC_SUBST(OS_ARCH)
8530 AC_SUBST(OS_RELEASE)
8531 AC_SUBST(OS_TEST)
8532 AC_SUBST(CPU_ARCH)
8533 AC_SUBST(INTEL_ARCHITECTURE)
8535 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8537 AC_SUBST(WRAP_LDFLAGS)
8538 AC_SUBST(MKSHLIB)
8539 AC_SUBST(MKCSHLIB)
8540 AC_SUBST(MKSHLIB_FORCE_ALL)
8541 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8542 AC_SUBST(DSO_CFLAGS)
8543 AC_SUBST(DSO_PIC_CFLAGS)
8544 AC_SUBST(DSO_LDOPTS)
8545 AC_SUBST(LIB_PREFIX)
8546 AC_SUBST(DLL_PREFIX)
8547 AC_SUBST(DLL_SUFFIX)
8548 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8549 AC_SUBST(LIB_SUFFIX)
8550 AC_SUBST(OBJ_SUFFIX)
8551 AC_SUBST(BIN_SUFFIX)
8552 AC_SUBST(ASM_SUFFIX)
8553 AC_SUBST(IMPORT_LIB_SUFFIX)
8554 AC_SUBST(USE_N32)
8555 AC_SUBST(CC_VERSION)
8556 AC_SUBST(CXX_VERSION)
8557 AC_SUBST(MSMANIFEST_TOOL)
8558 AC_SUBST(NS_ENABLE_TSF)
8559 AC_SUBST(MOZ_NSS_PATCH)
8560 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8561 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8563 AC_SUBST(MOZ_MEDIA)
8564 AC_SUBST(MOZ_SYDNEYAUDIO)
8565 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8566 AC_SUBST(MOZ_CUBEB)
8567 AC_SUBST(MOZ_WAVE)
8568 AC_SUBST(MOZ_VORBIS)
8569 AC_SUBST(MOZ_TREMOR)
8570 AC_SUBST(MOZ_OPUS)
8571 AC_SUBST(MOZ_WEBM)
8572 AC_SUBST(MOZ_MEDIA_PLUGINS)
8573 AC_SUBST(MOZ_OMX_PLUGIN)
8574 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8575 AC_SUBST(MOZ_VP8_ENCODER)
8576 AC_SUBST(MOZ_VP8)
8577 AC_SUBST(MOZ_OGG)
8578 AC_SUBST(MOZ_ALSA_LIBS)
8579 AC_SUBST(MOZ_ALSA_CFLAGS)
8580 AC_SUBST(VPX_AS)
8581 AC_SUBST(VPX_ASFLAGS)
8582 AC_SUBST(VPX_DASH_C_FLAG)
8583 AC_SUBST(VPX_AS_CONVERSION)
8584 AC_SUBST(VPX_ASM_SUFFIX)
8585 AC_SUBST(VPX_X86_ASM)
8586 AC_SUBST(VPX_ARM_ASM)
8587 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8588 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8589 AC_SUBST(LIBJPEG_TURBO_AS)
8590 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8591 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8592 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8593 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8595 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8597 AC_MSG_CHECKING([for posix_fallocate])
8598 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8599   #include <fcntl.h>],
8600                  [posix_fallocate(0, 0, 0);],
8601                  [ac_cv___posix_fallocate=true],
8602                  [ac_cv___posix_fallocate=false])
8604 if test "$ac_cv___posix_fallocate" = true ; then
8605   AC_DEFINE(HAVE_POSIX_FALLOCATE)
8606   AC_MSG_RESULT(yes)
8607 else
8608   AC_MSG_RESULT(no)
8611 dnl Check for missing components
8612 if test "$COMPILE_ENVIRONMENT"; then
8613 if test "$MOZ_X11"; then
8614     if test "$WITHOUT_X11"; then
8615         AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8616     fi
8617     dnl ====================================================
8618     dnl = Check if X headers exist
8619     dnl ====================================================
8620     _SAVE_CFLAGS=$CFLAGS
8621     CFLAGS="$CFLAGS $XCFLAGS"
8622     AC_TRY_COMPILE([
8623         #include <stdio.h>
8624         #include <stdlib.h>
8625         #include <X11/Xlib.h>
8626         #include <X11/Intrinsic.h>
8627         #include <X11/extensions/XShm.h>
8628     ],
8629     [
8630         Display *dpy = 0;
8631         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8632             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8633             exit(1);
8634         }
8635     ], [],
8636     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8637     CFLAGS="$_SAVE_CFLAGS"
8639     if test -n "$MISSING_X"; then
8640         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8641     fi
8643 fi # MOZ_X11
8645 dnl Check for headers, etc. needed by WebGL.
8646 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8647     MOZ_CHECK_HEADER(GL/glx.h)
8648     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8649         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))])
8650     fi
8651 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8652 fi # COMPILE_ENVIRONMENT
8654 dnl Set various defines and substitutions
8655 dnl ========================================================
8657 if test "$OS_ARCH" = "Darwin"; then
8658   AC_DEFINE(XP_UNIX)
8659   AC_DEFINE(UNIX_ASYNC_DNS)
8660 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8661   AC_DEFINE(XP_UNIX)
8662   AC_DEFINE(UNIX_ASYNC_DNS)
8665 if test "$MOZ_DEBUG"; then
8666     AC_DEFINE(MOZ_REFLOW_PERF)
8667     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8670 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8671     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8672     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8673     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8674     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8675     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8676     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8677     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8678     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8681 AC_SUBST(MOZILLA_VERSION)
8683 AC_SUBST(ac_configure_args)
8685 dnl Spit out some output
8686 dnl ========================================================
8688 dnl The following defines are used by xpcom
8689 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8690 CPP_THROW_NEW
8691 HAVE_CPP_2BYTE_WCHAR_T
8692 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8693 HAVE_CPP_CHAR16_T
8694 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8695 HAVE_CPP_PARTIAL_SPECIALIZATION
8696 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8697 HAVE_STATVFS
8698 HAVE_STATVFS64
8699 NEED_CPP_UNUSED_IMPLEMENTATIONS
8700 NEW_H
8701 HAVE_GETPAGESIZE
8702 HAVE_ICONV
8703 HAVE_ICONV_WITH_CONST_INPUT
8704 HAVE_MBRTOWC
8705 HAVE_SYS_MOUNT_H
8706 HAVE_SYS_VFS_H
8707 HAVE_WCRTOMB
8710 AC_CONFIG_HEADER(
8711 netwerk/necko-config.h
8712 xpcom/xpcom-config.h
8713 xpcom/xpcom-private.h
8716 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8717 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8718 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8719 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8720 # (apparently) only need this hack when egrep's "pattern" is particularly long
8721 # (as in the following code) and the first egrep on our $PATH is Apple's.  See
8722 # bug 655339.
8723 case "$host" in
8724 *-apple-darwin11*)
8725     FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8726     ;;
8728     FIXED_EGREP="egrep"
8729     ;;
8730 esac
8732 dnl Create a virtualenv where we can install local Python packages
8733 AC_MSG_RESULT([Creating Python virtualenv])
8734 rm -rf _virtualenv
8735 mkdir -p _virtualenv
8736 MACOSX_DEPLOYMENT_TARGET= PYTHONDONTWRITEBYTECODE= $PYTHON $_topsrcdir/python/virtualenv/virtualenv.py --system-site-packages ./_virtualenv
8737 case "$host_os" in
8738 mingw*)
8739     PYTHON=$MOZ_BUILD_ROOT/_virtualenv/Scripts/python.exe
8740     ;;
8742     PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python
8743     ;;
8744 esac
8746 AC_SUBST(PYTHON)
8748 # Populate the virtualenv
8749 AC_MSG_RESULT([Populating Python virtualenv])
8750 MACOSX_DEPLOYMENT_TARGET= LDFLAGS="${HOST_LDFLAGS}" \
8751   CC="${HOST_CC}" CXX="${HOST_CXX}" \
8752   CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" \
8753   $PYTHON $_topsrcdir/build/virtualenv/populate_virtualenv.py \
8754     $_topsrcdir $_topsrcdir/build/virtualenv/packages.txt \
8755   || exit 1
8757 dnl Load the list of Makefiles to generate.
8758 dnl   To add new Makefiles, edit allmakefiles.sh.
8759 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8760 . ${srcdir}/allmakefiles.sh
8762 echo $MAKEFILES > unallmakefiles
8764 AC_OUTPUT($MAKEFILES)
8766 # Generate Makefiles for WebRTC directly from .gyp files
8767 if test "${OS_TARGET}" = "WINNT"; then
8768    if test "$HAVE_64BIT_OS"; then
8769       OS_BITS=64
8770    else
8771       OS_BITS=32
8772    fi
8773    EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
8776 if test -n "$MOZ_WEBRTC"; then
8777    AC_MSG_RESULT("generating WebRTC Makefiles...")
8779    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}"
8781    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8782      $GYP_WEBRTC_OPTIONS \
8783      --generator-output=${_objdir}/media/webrtc/trunk \
8784      ${srcdir}/media/webrtc/trunk/peerconnection.gyp
8785    if test "$?" != 0; then
8786       AC_MSG_ERROR([failed to generate WebRTC Makefiles])
8787    fi
8789    # XXX disable until we land the tranche with signaling
8790    if test -n "$MOZ_WEBRTC_SIGNALING"; then
8791      AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
8792      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8793        $GYP_WEBRTC_OPTIONS \
8794        --generator-output=${_objdir}/media/webrtc/signaling \
8795        ${srcdir}/media/webrtc/signaling/signaling.gyp
8796      if test "$?" != 0; then
8797         AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
8798      fi
8799    fi
8801    AC_MSG_RESULT("generating gtest Makefiles...")
8802    # Ok to pass some extra -D's that are ignored here
8803    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8804      $GYP_WEBRTC_OPTIONS \
8805      --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
8806      ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
8807    if test "$?" != 0; then
8808       AC_MSG_ERROR([failed to generate gtest Makefiles])
8809    fi
8812 # Generate a JSON config file for unittest harnesses etc to read
8813 # build configuration details from in a standardized way.
8814 OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
8815 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
8816   $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
8817 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
8818   rm ./mozinfo.json.tmp
8819 else
8820   mv -f ./mozinfo.json.tmp ./mozinfo.json
8823 # Run jemalloc configure script
8825 if test "$MOZ_JEMALLOC" -a "$MOZ_MEMORY"; then
8826   ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
8827   if test "$OS_ARCH" = "Linux"; then
8828     MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
8829     MANGLED=
8830     JEMALLOC_WRAPPER=
8831     if test -n "$_WRAP_MALLOC"; then
8832       JEMALLOC_WRAPPER=__wrap_
8833     fi
8834     for mangle in ${MANGLE}; do
8835       if test -n "$MANGLED"; then
8836         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
8837       else
8838         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
8839       fi
8840     done
8841     ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
8842   fi
8843   unset CONFIG_FILES
8844   if test -z "$MOZ_TLS"; then
8845     ac_configure_args="$ac_configure_args --disable-tls"
8846   fi
8847   EXTRA_CFLAGS="$CFLAGS"
8848   for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
8849     ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
8850   done
8851   if test "$CROSS_COMPILE"; then
8852     ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
8853   fi
8854   _save_cache_file="$cache_file"
8855   cache_file=$_objdir/memory/jemalloc/src/config.cache
8856   AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
8857   cache_file="$_save_cache_file"
8858   ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8861 dnl Build libunwind for Android profiling builds
8862 if test "$OS_TARGET" = "Android" -a "$MOZ_PROFILING"; then
8863   old_ac_configure_arg="$ac_configure_args"
8864   ac_configure_args="--build=${build} --host=${target_alias} --disable-shared --enable-block-signals=no"
8865   if test "$MOZ_DEBUG"; then
8866     ac_configure_args="$ac_configure_args --enable-debug"
8867   fi
8868   if test "$DSO_PIC_CFLAGS"; then
8869     ac_configure_args="$ac_configure_args --with-pic"
8870   fi
8871   ac_configure_args="$ac_configure_args \
8872       CC=\"$CC\" \
8873       CXX=\"$CXX\" \
8874       CPP=\"$CPP\" \
8875       CFLAGS=\"$CFLAGS\" \
8876       CXXFLAGS=\"$CXXFLAGS\" \
8877       CPPFLAGS=\"$CPPFLAGS\" \
8878       LD=\"$LD\" \
8879       LDFLAGS=\"$LDFLAGS\" \
8880       AR=\"$AR\" \
8881       RANLIB=\"$RANLIB\" \
8882       STRIP=\"$STRIP\" \
8883       LIBS=\"$LIBS\""
8885   # Use a separate cache file for libunwind, since it does not use caching.
8886   mkdir -p $_objdir/tools/profiler/libunwind/src
8887   old_cache_file=$cache_file
8888   cache_file=$_objdir/tools/profiler/libunwind/src/config.cache
8889   old_config_files=$CONFIG_FILES
8890   unset CONFIG_FILES
8891   AC_OUTPUT_SUBDIRS(tools/profiler/libunwind/src)
8892   cache_file=$old_cache_file
8893   ac_configure_args="$old_ac_configure_args"
8894   CONFIG_FILES=$old_config_files
8897 # Run freetype configure script
8899 if test "$MOZ_TREE_FREETYPE"; then
8900    export CFLAGS="$CFLAGS -std=c99"
8901    export CPPFLAGS="$CPPFLAGS"
8902    export CXXFLAGS="$CXXFLAGS"
8903    export LDFLAGS="$LDFLAGS"
8904    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
8905    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
8906    AC_OUTPUT_SUBDIRS(modules/freetype2)
8909 if test -z "$direct_nspr_config"; then
8910     dnl ========================================================
8911     dnl = Setup a nice relatively clean build environment for
8912     dnl = sub-configures.
8913     dnl ========================================================
8914     CC="$_SUBDIR_CC"
8915     CXX="$_SUBDIR_CXX"
8916     CFLAGS="$_SUBDIR_CFLAGS"
8917     CPPFLAGS="$_SUBDIR_CPPFLAGS"
8918     CXXFLAGS="$_SUBDIR_CXXFLAGS"
8919     LDFLAGS="$_SUBDIR_LDFLAGS"
8920     HOST_CC="$_SUBDIR_HOST_CC"
8921     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8922     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8923     RC=
8926 unset MAKEFILES
8927 unset CONFIG_FILES
8929 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8930 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8932 export WRAP_LDFLAGS
8934 if test -n "$_WRAP_MALLOC"; then
8935     # Avoid doubling wrap malloc arguments
8936     _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
8939 if test -z "$MOZ_NATIVE_NSPR"; then
8940     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8941     if test -z "$MOZ_DEBUG"; then
8942         ac_configure_args="$ac_configure_args --disable-debug"
8943     else
8944         ac_configure_args="$ac_configure_args --enable-debug"
8945     fi
8946     if test "$MOZ_OPTIMIZE" = "1"; then
8947         ac_configure_args="$ac_configure_args --enable-optimize"
8948     elif test -z "$MOZ_OPTIMIZE"; then
8949         ac_configure_args="$ac_configure_args --disable-optimize"
8950     fi
8951     if test -n "$HAVE_64BIT_OS"; then
8952         ac_configure_args="$ac_configure_args --enable-64bit"
8953     fi
8954     if test -n "$USE_ARM_KUSER"; then
8955         ac_configure_args="$ac_configure_args --with-arm-kuser"
8956     fi
8957     ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
8958     if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no ; then
8959       # dladdr is supported by the new linker, even when the system linker doesn't
8960       # support it. Trick nspr into using dladdr when it's not supported.
8961       _SAVE_CPPFLAGS="$CPPFLAGS"
8962       export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
8963     fi
8964     _SAVE_LDFLAGS="$LDFLAGS"
8965     export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
8966     AC_OUTPUT_SUBDIRS(nsprpub)
8967     LDFLAGS="$_SAVE_LDFLAGS"
8968     if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no; then
8969       unset CPPFLAGS
8970       CPPFLAGS="$_SAVE_CFLAGS"
8971     fi
8972     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8975 dnl ========================================================
8976 dnl = Setup a nice relatively clean build environment for
8977 dnl = sub-configures.
8978 dnl ========================================================
8979 CC="$_SUBDIR_CC"
8980 CXX="$_SUBDIR_CXX"
8981 CFLAGS="$_SUBDIR_CFLAGS"
8982 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8983 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8984 LDFLAGS="$_SUBDIR_LDFLAGS"
8985 HOST_CC="$_SUBDIR_HOST_CC"
8986 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8987 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8990 # Run the SpiderMonkey 'configure' script.
8991 dist=$MOZ_BUILD_ROOT/dist
8992 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8993 ac_configure_args="$ac_configure_args --enable-threadsafe"
8994 if test "$BUILD_CTYPES"; then
8995     # Build js-ctypes on the platforms we can.
8996     ac_configure_args="$ac_configure_args --enable-ctypes"
8998 if test -z "$JS_SHARED_LIBRARY" ; then
8999     ac_configure_args="$ac_configure_args --disable-shared-js"
9001 if test -z "$MOZ_NATIVE_NSPR"; then
9002     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9003     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9005 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9006 ac_configure_args="$ac_configure_args --prefix=$dist"
9007 if test "$MOZ_MEMORY"; then
9008    ac_configure_args="$ac_configure_args --enable-jemalloc"
9010 if test -n "$MOZ_GLUE_LDFLAGS"; then
9011    export MOZ_GLUE_LDFLAGS
9013 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9014    export MOZ_GLUE_PROGRAM_LDFLAGS
9016 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9017    MOZ_ZLIB_LIBS=
9019 export MOZ_NATIVE_ZLIB
9020 export MOZ_ZLIB_CFLAGS
9021 export MOZ_ZLIB_LIBS
9022 export MOZ_APP_NAME
9023 export STLPORT_CPPFLAGS
9024 export STLPORT_LDFLAGS
9025 export STLPORT_LIBS
9026 AC_OUTPUT_SUBDIRS(js/src)
9027 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9029 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR