bug 818009 - canActivate: only click-to-play-type plugins are valid r=jaws
[gecko.git] / configure.in
blobf2295bf1d6388246e55f1fd2eefa344a6d8fef50
2 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
3 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
4 dnl This Source Code Form is subject to the terms of the Mozilla Public
5 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
6 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 dnl Process this file with autoconf to produce a configure script.
9 dnl ========================================================
11 AC_PREREQ(2.13)
12 AC_INIT(config/config.mk)
13 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
14 AC_CANONICAL_SYSTEM
15 TARGET_CPU="${target_cpu}"
16 TARGET_VENDOR="${target_vendor}"
17 TARGET_OS="${target_os}"
19 MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1`
20 AC_SUBST(MOZ_DEB_TIMESTAMP)
22 dnl ========================================================
23 dnl =
24 dnl = Don't change the following two lines.  Doing so breaks:
25 dnl =
26 dnl = CFLAGS="-foo" ./configure
27 dnl =
28 dnl ========================================================
29 CFLAGS="${CFLAGS=}"
30 CPPFLAGS="${CPPFLAGS=}"
31 CXXFLAGS="${CXXFLAGS=}"
32 LDFLAGS="${LDFLAGS=}"
33 HOST_CFLAGS="${HOST_CFLAGS=}"
34 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
35 HOST_LDFLAGS="${HOST_LDFLAGS=}"
37 dnl ========================================================
38 dnl = Preserve certain environment flags passed to configure
39 dnl = We want sub projects to receive the same flags
40 dnl = untainted by this configure script
41 dnl ========================================================
42 _SUBDIR_CC="$CC"
43 _SUBDIR_CXX="$CXX"
44 _SUBDIR_CFLAGS="$CFLAGS"
45 _SUBDIR_CPPFLAGS="$CPPFLAGS"
46 _SUBDIR_CXXFLAGS="$CXXFLAGS"
47 _SUBDIR_LDFLAGS="$LDFLAGS"
48 _SUBDIR_HOST_CC="$HOST_CC"
49 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
50 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
51 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
52 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
54 dnl Set the version number of the libs included with mozilla
55 dnl ========================================================
56 MOZJPEG=62
57 MOZPNG=10513
58 NSPR_VERSION=4
59 NSS_VERSION=3
61 dnl Set the minimum version of toolkit libs used by mozilla
62 dnl ========================================================
63 GLIB_VERSION=1.2.0
64 PERL_VERSION=5.006
65 CAIRO_VERSION=1.10
66 PANGO_VERSION=1.14.0
67 GTK2_VERSION=2.10.0
68 WINDRES_VERSION=2.14.90
69 W32API_VERSION=3.14
70 GNOMEVFS_VERSION=2.0
71 GNOMEUI_VERSION=2.2.0
72 GCONF_VERSION=1.2.1
73 GIO_VERSION=2.20
74 STARTUP_NOTIFICATION_VERSION=0.8
75 DBUS_VERSION=0.60
76 SQLITE_VERSION=3.7.14.1
78 MSMANIFEST_TOOL=
80 dnl Set various checks
81 dnl ========================================================
82 MISSING_X=
83 AC_PROG_AWK
85 dnl Initialize the Pthread test variables early so they can be
86 dnl  overridden by each platform.
87 dnl ========================================================
88 USE_PTHREADS=
89 _PTHREAD_LDFLAGS=""
91 dnl Do not allow a separate objdir build if a srcdir build exists.
92 dnl ==============================================================
93 _topsrcdir=`cd \`dirname $0\`; pwd`
94 _objdir=`pwd`
96 if test "$_topsrcdir" != "$_objdir"
97 then
98   # Check for a couple representative files in the source tree
99   _conflict_files=
100   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
101     if test -f $file; then
102       _conflict_files="$_conflict_files $file"
103     fi
104   done
105   if test "$_conflict_files"; then
106     echo "***"
107     echo "*   Your source tree contains these files:"
108     for file in $_conflict_files; do
109       echo "*         $file"
110     done
111     cat 1>&2 <<-EOF
112         *   This indicates that you previously built in the source tree.
113         *   A source tree build can confuse the separate objdir build.
114         *
115         *   To clean up the source tree:
116         *     1. cd $_topsrcdir
117         *     2. gmake distclean
118         ***
119         EOF
120     exit 1
121     break
122   fi
124 MOZ_BUILD_ROOT=`pwd`
126 dnl Do not allow building if a clobber is required
127 dnl ==============================================================
128 dnl TODO Make this better, ideally this would clobber automaticially
129 if test -e $_objdir/CLOBBER; then
130   if test $_topsrcdir/CLOBBER -nt $_objdir/CLOBBER; then
131     echo "      ***"
132     echo "      *       CLOBBER has been modified indicating a clobber is required:"
133     cat $_topsrcdir/CLOBBER | sed '/^#/d' | sed 's/^/   *       /'
134     echo "      ***"
135     exit 1
136     break;
137   fi
138 else
139   touch $_objdir/CLOBBER
142 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
143 if test -z "$PYTHON"; then
144     AC_MSG_ERROR([python was not found in \$PATH])
147 AC_MSG_RESULT([Creating Python environment])
148 dnl This verifies our Python version is sane and ensures the Python
149 dnl virtualenv is present and up to date. It sanitizes the environment
150 dnl for us, so we don't need to clean anything out.
151 $PYTHON $_topsrcdir/build/virtualenv/populate_virtualenv.py \
152     $_topsrcdir $MOZ_BUILD_ROOT/_virtualenv || exit 1
154 dnl Create a virtualenv where we can install local Python packages
155 case "$host_os" in
156 mingw*)
157     PYTHON=`cd $MOZ_BUILD_ROOT && pwd -W`/_virtualenv/Scripts/python.exe
158     ;;
160     PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python
161     ;;
162 esac
164 AC_SUBST(PYTHON)
166 MOZ_DEFAULT_COMPILER
168 COMPILE_ENVIRONMENT=1
169 MOZ_ARG_DISABLE_BOOL(compile-environment,
170 [  --disable-compile-environment
171                           Disable compiler/library checks.],
172     COMPILE_ENVIRONMENT= )
173 AC_SUBST(COMPILE_ENVIRONMENT)
175 MOZ_ARG_WITH_STRING(l10n-base,
176 [  --with-l10n-base=DIR    path to l10n repositories],
177     L10NBASEDIR=$withval)
178 if test -n "$L10NBASEDIR"; then
179     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
180         AC_MSG_ERROR([--with-l10n-base must specify a path])
181     elif test -d "$L10NBASEDIR"; then
182         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
183     else
184         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
185     fi
187 AC_SUBST(L10NBASEDIR)
189 dnl Check for Perl first -- needed for win32 SDK checks
190 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
191 if test -z "$PERL" -o "$PERL" = ":"; then
192     AC_MSG_ERROR([perl not found in \$PATH])
195 AC_SUBST(GAIADIR)
196 if test -n "$GAIADIR" ; then
197     AC_DEFINE(PACKAGE_GAIA)
200 MOZ_ARG_WITH_STRING(gonk,
201 [  --with-gonk=DIR
202                location of gonk dir],
203     gonkdir=$withval)
205 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
206 [  --with-gonk-toolchain-prefix=DIR
207                           prefix to gonk toolchain commands],
208     gonk_toolchain_prefix=$withval)
210 if test -n "$gonkdir" ; then
211     kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
212     android_source="$gonkdir"
213     ANDROID_SOURCE="$android_source"
214     ANDROID_NDK="${ANDROID_SOURCE}/ndk"
216     dnl set up compilers
217     TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
218     AS="$gonk_toolchain_prefix"as
219     CC="$gonk_toolchain_prefix"gcc
220     CXX="$gonk_toolchain_prefix"g++
221     CPP="$gonk_toolchain_prefix"cpp
222     LD="$gonk_toolchain_prefix"ld
223     AR="$gonk_toolchain_prefix"ar
224     RANLIB="$gonk_toolchain_prefix"ranlib
225     STRIP="$gonk_toolchain_prefix"strip
226     OBJCOPY="$gonk_toolchain_prefix"objcopy
228     STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/ -I$gonkdir/external/stlport/stlport/"
229     STLPORT_LIBS="-lstlport"
231     case "$target_cpu" in
232     arm)
233         ARCH_DIR=arch-arm
234         ;;
235     i?86)
236         ARCH_DIR=arch-x86
237         ;;
238     esac
240     CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice -I$gonkdir/frameworks/base/services/camera -I$gonkdir/system/media/wilhelm/include -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/dalvik/libnativehelper/include/nativehelper"
241     CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
242     CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
243     dnl Add -llog by default, since we use it all over the place.
244     LIBS="$LIBS -llog $STLPORT_LIBS"
246     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"
248     dnl prevent cross compile section from using these flags as host flags
249     if test -z "$HOST_CPPFLAGS" ; then
250         HOST_CPPFLAGS=" "
251     fi
252     if test -z "$HOST_CFLAGS" ; then
253         HOST_CFLAGS=" "
254     fi
255     if test -z "$HOST_CXXFLAGS" ; then
256         HOST_CXXFLAGS=" "
257     fi
258     if test -z "$HOST_LDFLAGS" ; then
259         HOST_LDFLAGS=" "
260     fi
262     AC_DEFINE(ANDROID)
263     AC_DEFINE(HAVE_SYS_UIO_H)
264     AC_DEFINE(HAVE_PTHREADS)
265     CROSS_COMPILE=1
266     MOZ_CHROME_FILE_FORMAT=omni
267     direct_nspr_config=1
268 else
269     MOZ_ANDROID_NDK
271     case "$target" in
272     *-android*|*-linuxandroid*)
273         if test -z "$ANDROID_PACKAGE_NAME" ; then
274             ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
275         fi
276         MOZ_CHROME_FILE_FORMAT=omni
277         ZLIB_DIR=yes
278         ;;
279     *-linux*)
280         AC_PATH_PROG(OBJCOPY,objcopy)
281         ;;
282     esac
285 AC_SUBST(ANDROID_SOURCE)
286 AC_SUBST(ANDROID_PACKAGE_NAME)
287 AC_SUBST(OBJCOPY)
289 dnl ========================================================
290 dnl Checks for compilers.
291 dnl ========================================================
292 dnl Set CROSS_COMPILE in the environment when running configure
293 dnl to use the cross-compile setup for now
294 dnl ========================================================
296 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
297 AR_FLAGS='cr $@'
299 if test "$COMPILE_ENVIRONMENT"; then
301 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
302     echo "cross compiling from $host to $target"
303     cross_compiling=yes
305     _SAVE_CC="$CC"
306     _SAVE_CFLAGS="$CFLAGS"
307     _SAVE_LDFLAGS="$LDFLAGS"
309     AC_MSG_CHECKING([for host c compiler])
310     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
311     if test -z "$HOST_CC"; then
312         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
313     fi
314     AC_MSG_RESULT([$HOST_CC])
315     AC_MSG_CHECKING([for host c++ compiler])
316     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
317     if test -z "$HOST_CXX"; then
318         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
319     fi
320     AC_MSG_RESULT([$HOST_CXX])
322     if test -z "$HOST_CFLAGS"; then
323         HOST_CFLAGS="$CFLAGS"
324     fi
325     if test -z "$HOST_CXXFLAGS"; then
326         HOST_CXXFLAGS="$CXXFLAGS"
327     fi
328     if test -z "$HOST_LDFLAGS"; then
329         HOST_LDFLAGS="$LDFLAGS"
330     fi
331     if test -z "$HOST_AR_FLAGS"; then
332         HOST_AR_FLAGS="$AR_FLAGS"
333     fi
334     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
335     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
336     CC="$HOST_CC"
337     CFLAGS="$HOST_CFLAGS"
338     LDFLAGS="$HOST_LDFLAGS"
340     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
341     AC_TRY_COMPILE([], [return(0);],
342         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
343         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
345     CC="$HOST_CXX"
346     CFLAGS="$HOST_CXXFLAGS"
348     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
349     AC_TRY_COMPILE([], [return(0);],
350         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
351         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
353     CC=$_SAVE_CC
354     CFLAGS=$_SAVE_CFLAGS
355     LDFLAGS=$_SAVE_LDFLAGS
357     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
358     unset ac_cv_prog_CC
359     AC_PROG_CC
360     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
361     unset ac_cv_prog_CXX
362     AC_PROG_CXX
364     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
365     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
366     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
367     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
368     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
369     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
370     AC_DEFINE(CROSS_COMPILE)
371 else
372     AC_PROG_CC
373     case "$target" in
374     *-mingw*)
375       # Work around the conftest.exe access problem on Windows
376       sleep 2
377     esac
378     AC_PROG_CXX
379     AC_PROG_RANLIB
380     MOZ_PATH_PROGS(AS, $AS as, $CC)
381     AC_CHECK_PROGS(AR, ar, :)
382     AC_CHECK_PROGS(LD, ld, :)
383     AC_CHECK_PROGS(STRIP, strip, :)
384     AC_CHECK_PROGS(WINDRES, windres, :)
385     if test -z "$HOST_CC"; then
386         HOST_CC="$CC"
387     fi
388     if test -z "$HOST_CFLAGS"; then
389         HOST_CFLAGS="$CFLAGS"
390     fi
391     if test -z "$HOST_CXX"; then
392         HOST_CXX="$CXX"
393     fi
394     if test -z "$HOST_CXXFLAGS"; then
395         HOST_CXXFLAGS="$CXXFLAGS"
396     fi
397     if test -z "$HOST_LDFLAGS"; then
398         HOST_LDFLAGS="$LDFLAGS"
399     fi
400     if test -z "$HOST_RANLIB"; then
401         HOST_RANLIB="$RANLIB"
402     fi
403     if test -z "$HOST_AR"; then
404         HOST_AR="$AR"
405     fi
406     if test -z "$HOST_AR_FLAGS"; then
407         HOST_AR_FLAGS="$AR_FLAGS"
408     fi
411 if test -n "$MOZ_WINCONSOLE"; then
412     AC_DEFINE(MOZ_WINCONSOLE)
415 MOZ_TOOL_VARIABLES
417 dnl ========================================================
418 dnl Special win32 checks
419 dnl ========================================================
421 MOZ_ARG_ENABLE_BOOL(metro,
422 [  --enable-metro           Enable Windows Metro build targets],
423     MOZ_METRO=1,
424     MOZ_METRO=)
425 if test -n "$MOZ_METRO"; then
426     AC_DEFINE(MOZ_METRO)
427     # Target the Windows 8 Kit
428     WINSDK_TARGETVER=602
429     WINVER=502
430     # toolkit/library/makefile.in needs these, see nsDllMain.
431     CRTDLLVERSION=110
432     CRTEXPDLLVERSION=1-1-0
433 else
434     # Target the Windows 7 SDK by default
435     WINSDK_TARGETVER=601
436     WINVER=502
439 AC_SUBST(CRTDLLVERSION)
440 AC_SUBST(CRTEXPDLLVERSION)
442 if test -n "$MOZ_METRO"; then
443   case "$target" in
444   *-mingw*)
445     ;;
446   *)
447     AC_MSG_ERROR([Metro builds only valid on the windows platform.]);
448     ;;
449   esac
452 MOZ_ARG_WITH_STRING(windows-version,
453 [  --with-windows-version=WINSDK_TARGETVER
454                           Windows SDK version to target. Lowest version
455                           currently allowed is 601 (Win7), highest is 602 (Win8)],
456   WINSDK_TARGETVER=$withval)
458 # Currently only two sdk versions allowed, 601 and 602
459 case "$WINSDK_TARGETVER" in
460 601|602)
461     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
462     ;;
465     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
466     ;;
467 esac
469 case "$target" in
470 *-mingw*)
471     if test "$GCC" != "yes"; then
472         # Check to see if we are really running in a msvc environemnt
473         _WIN32_MSVC=1
474         AC_CHECK_PROGS(MIDL, midl)
476         # Make sure compilers are valid
477         CFLAGS="$CFLAGS -TC -nologo"
478         CXXFLAGS="$CXXFLAGS -TP -nologo"
479         AC_LANG_SAVE
480         AC_LANG_C
481         AC_TRY_COMPILE([#include <stdio.h>],
482             [ printf("Hello World\n"); ],,
483             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
485         AC_LANG_CPLUSPLUS
486         AC_TRY_COMPILE([#include <new.h>],
487             [ unsigned *test = new unsigned(42); ],,
488             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
489         AC_LANG_RESTORE
491         changequote(,)
492         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
493         changequote([,])
495         # Determine compiler version
496         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
497         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
498         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
499         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
500         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
501         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
503         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
504         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
506         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
507             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
508         fi
510         if test "$_CC_MAJOR_VERSION" = "14"; then
511             dnl Require VC8SP1 or newer.
512             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
513             if test "$_CC_RELEASE" -lt 50727 -o \
514                     \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
515               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.])
516             fi
518             _CC_SUITE=8
519             _MSVS_VERSION=2005
520             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
521             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
522         elif test "$_CC_MAJOR_VERSION" = "15"; then
523             _CC_SUITE=9
524             _MSVS_VERSION=2008
525             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
526             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
527         elif test "$_CC_MAJOR_VERSION" = "16"; then
528             _CC_SUITE=10
529             _MSVS_VERSION=2010
530             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
531             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
532         elif test "$_CC_MAJOR_VERSION" = "17"; then
533             _CC_SUITE=11
534             _MSVS_VERSION=2012
535             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
536             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
537         else
538             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
539         fi
541         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
543         if test -n "$WIN32_REDIST_DIR"; then
544           if test ! -d "$WIN32_REDIST_DIR"; then
545             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
546           fi
547           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
548         fi
550         dnl Confirm we have the pri tools on win8 builds
551         if test -n "$MOZ_METRO"; then
552           AC_MSG_CHECKING([for makepri])
553           AC_CHECK_PROGS(MAKEPRI, makepri, "")
554           if test -z "MAKEPRI" ; then
555               AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
556           fi
557           AC_SUBST(MAKEPRI)
558         fi
560         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
561         dnl not something else like "magnetic tape manipulation utility".
562         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
563         if test -z "$MSMT_TOOL"; then
564           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
565         fi
567         changequote(,)
568         _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
569         changequote([,])
570         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
571         if test -z "$MSMANIFEST_TOOL_VERSION"; then
572           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
573         fi
575         MSMANIFEST_TOOL=1
576         unset MSMT_TOOL
578         # Check linker version
579         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
580         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
581         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
582             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
583         fi
585         INCREMENTAL_LINKER=1
587         # Check midl version
588         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
589         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
590         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
591         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
592         # Add flags if necessary
593         AC_MSG_CHECKING([for midl flags])
594         case "$target" in
595         i*86-*)
596             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
597                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
598                 # MIDL version 7.00.0500 or later has no problem.
599                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
600                 AC_MSG_RESULT([need -env win32])
601             else
602                 AC_MSG_RESULT([none needed])
603             fi
604             ;;
605         x86_64-*)
606             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
607             ;;
608         *)
609             AC_MSG_RESULT([none needed])
610             ;;
611         esac
613         # Identify which version of the SDK we're building with
614         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
615         # from there
616         MOZ_CHECK_HEADERS([winsdkver.h])
617         if test "$ac_cv_header_winsdkver_h" = "yes"; then
618             # Get the highest _WIN32_WINNT and NTDDI versions supported
619             # Take the higher of the two
620             # This is done because the Windows 7 beta SDK reports its
621             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
622             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
623                            ac_cv_winsdk_maxver,
624                            [cat > conftest.h <<EOF
625 #include <winsdkver.h>
626 #include <sdkddkver.h>
628 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
629 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
630 #else
631 #define WINSDK_MAXVER NTDDI_MAXVER
632 #endif
634 WINSDK_MAXVER
636                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
637                             rm -f conftest.h
638                            ])
639             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
640         else
641             # Any SDK which doesn't have WinSDKVer.h is too old.
642             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.])
643         fi
645         unset _MSVC_VER_FILTER
647         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
648             [
649                 AC_LANG_SAVE
650                 AC_LANG_CPLUSPLUS
651                 _SAVE_CXXFLAGS="$CXXFLAGS"
652                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
653                 AC_TRY_COMPILE([#include <exception>],
654                             [std::_Throw(std::exception()); return 0;],
655                             ac_cv_have_std__Throw="yes",
656                             ac_cv_have_std__Throw="no")
657                 CXXFLAGS="$_SAVE_CXXFLAGS"
658                 AC_LANG_RESTORE
659             ])
661         if test "$ac_cv_have_std__Throw" = "yes"; then
662             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
663                            ac_cv_have_dllimport_exception_bug,
664                 [
665                     AC_LANG_SAVE
666                     AC_LANG_CPLUSPLUS
667                     _SAVE_CXXFLAGS="$CXXFLAGS"
668                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
669                     AC_TRY_LINK([#include <vector>],
670                                 [std::vector<int> v; return v.at(1);],
671                                 ac_cv_have_dllimport_exception_bug="no",
672                                 ac_cv_have_dllimport_exception_bug="yes")
673                     CXXFLAGS="$_SAVE_CXXFLAGS"
674                     AC_LANG_RESTORE
675                 ])
676             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
677                 WRAP_STL_INCLUDES=1
678                 MOZ_MSVC_STL_WRAP__Throw=1
679                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
680             fi
681         else
682             AC_CACHE_CHECK(for overridable _RAISE,
683                            ac_cv_have__RAISE,
684                 [
685                     AC_LANG_SAVE
686                     AC_LANG_CPLUSPLUS
687                     _SAVE_CXXFLAGS="$CXXFLAGS"
688                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
689                     AC_TRY_COMPILE([#include <xstddef>
690                                     #undef _RAISE
691                                     #define _RAISE(x) externallyDefinedFunction((x).what())
692                                     #include <vector>
693                                    ],
694                                    [std::vector<int> v; return v.at(1);],
695                                    ac_cv_have__RAISE="no",
696                                    ac_cv_have__RAISE="yes")
697                     CXXFLAGS="$_SAVE_CXXFLAGS"
698                     AC_LANG_RESTORE
699                 ])
700             if test "$ac_cv_have__RAISE" = "yes"; then
701                 WRAP_STL_INCLUDES=1
702                 MOZ_MSVC_STL_WRAP__RAISE=1
703                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
704             else
705                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
706             fi
707         fi
709         if test "$WRAP_STL_INCLUDES" = "1"; then
710             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
711         fi
712     else
713         # Check w32api version
714         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
715         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
716         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
717         AC_TRY_COMPILE([#include <w32api.h>],
718             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
719                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
720                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
721                 #error "test failed."
722             #endif
723             , [ res=yes ], [ res=no ])
724         AC_MSG_RESULT([$res])
725         if test "$res" != "yes"; then
726             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
727         fi
728         # Check windres version
729         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
730         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
731         AC_MSG_RESULT([$_WINDRES_VERSION])
732         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
733         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
734         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
735         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
736         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
737         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
738         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
739                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
740                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
741                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
742                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
743                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
744         then
745             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
746         fi
748         AC_CHECK_PROGS(MIDL, $target-widl widl)
749         if test -n "$MIDL"; then
750             case "$target" in
751             i*86-*)
752                 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
753                 ;;
754             x86_64-*)
755                 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
756                 ;;
757             esac
758         fi
760         MOZ_WINSDK_MAXVER=0x06020000
761     fi # !GNU_CC
763     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
764     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
765     # Require OS features provided by IE 6.0 SP2 (XP SP2)
766     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
768     # If the maximum version supported by this SDK is lower than the target
769     # version, error out
770     AC_MSG_CHECKING([for Windows SDK being recent enough])
771     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
772         AC_MSG_RESULT("yes")
773     else
774         AC_MSG_RESULT("no")
775         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.])
776     fi
777     
778     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
779     # Definitions matching sdkddkver.h
780     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
781     ;;
782 esac
784 AC_PROG_CPP
785 AC_PROG_CXXCPP
787 if test -n "$_WIN32_MSVC"; then
788     SKIP_PATH_CHECKS=1
789     SKIP_COMPILER_CHECKS=1
790     SKIP_LIBRARY_CHECKS=1
792     # Since we're skipping compiler and library checks, hard-code
793     # some facts here.
794     AC_DEFINE(HAVE_IO_H)
795     AC_DEFINE(HAVE_SETBUF)
796     AC_DEFINE(HAVE_ISATTY)
799 fi # COMPILE_ENVIRONMENT
801 AC_SUBST(MIDL_FLAGS)
802 AC_SUBST(_MSC_VER)
804 AC_SUBST(GNU_AS)
805 AC_SUBST(GNU_LD)
806 AC_SUBST(GNU_CC)
807 AC_SUBST(GNU_CXX)
808 AC_SUBST(INTEL_CC)
809 AC_SUBST(INTEL_CXX)
811 AC_SUBST(STL_FLAGS)
812 AC_SUBST(WRAP_STL_INCLUDES)
813 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
814 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
816 dnl ========================================================
817 dnl Checks for programs.
818 dnl ========================================================
819 AC_PROG_INSTALL
820 AC_PROG_LN_S
822 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
823 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
824 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
825 _perl_res=$?
826 AC_MSG_RESULT([$_perl_version])
828 if test "$_perl_res" != 0; then
829     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
833 AC_MSG_CHECKING([for full perl installation])
834 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
835 _perl_res=$?
836 if test "$_perl_res" != 0; then
837     AC_MSG_RESULT([no])
838     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
839 else
840     AC_MSG_RESULT([yes])
843 MOZ_ARG_WITH_BOOL(system-ply,
844 [  --with-system-ply       Use system installed python ply library],
845     [if $PYTHON -c 'import ply' 2>&5; then
846          MOZ_SYSTEM_PLY=1
847      else
848          AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
849      fi])
851 AC_SUBST(MOZ_SYSTEM_PLY)
853 if test -z "$COMPILE_ENVIRONMENT"; then
854     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
856 AC_SUBST(NSINSTALL_BIN)
858 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
859 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
860 MOZ_PATH_PROGS(UNZIP, unzip)
861 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
862     AC_MSG_ERROR([unzip not found in \$PATH])
864 MOZ_PATH_PROGS(ZIP, zip)
865 if test -z "$ZIP" -o "$ZIP" = ":"; then
866     AC_MSG_ERROR([zip not found in \$PATH])
868 MOZ_PATH_PROG(XARGS, xargs)
869 if test -z "$XARGS" -o "$XARGS" = ":"; then
870     AC_MSG_ERROR([xargs not found in \$PATH .])
873 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
874 AC_SUBST(RPMBUILD)
876 if test "$COMPILE_ENVIRONMENT"; then
878 dnl ========================================================
879 dnl = Mac OS X toolchain support
880 dnl ========================================================
882 case "$target_os" in
883 darwin*)
884     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
885     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
886     dnl the environment and includedir purposes (when using an SDK, below),
887     dnl but remember the full version number for the libdir (SDK).
888     changequote(,)
889     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
890     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
891     changequote([,])
892     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
893         dnl Bug 280479, but this keeps popping up in bug 292530 too because
894         dnl 4.0.0/4061 is the default compiler in Tiger.
895         changequote(,)
896         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
897         changequote([,])
898         if test "$GCC_BUILD" = "4061" ; then
899             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
900 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
901 from building Mozilla. Upgrade to Xcode 2.1 or later.])
902         fi
903     fi
905     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
906     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
907     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
908     MOZ_PATH_PROGS(PBBUILD_BIN, pbbuild xcodebuild pbxbuild)
910     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
911     dnl it has moved into /usr/bin.
912     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
913     ;;
914 esac
916 AC_SUBST(GCC_VERSION)
918 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
919 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
920 dnl when we can run target binaries.
921 AC_SUBST(UNIVERSAL_BINARY)
922 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
924 dnl ========================================================
925 dnl Check for MacOS deployment target version
926 dnl ========================================================
928 MOZ_ARG_ENABLE_STRING(macos-target,
929                       [  --enable-macos-target=VER (default=10.6)
930                           Set the minimum MacOS version needed at runtime],
931                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
933 case "$target" in
934 *-darwin*)
935     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
936         dnl Use the specified value
937         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
938     else
939         dnl No value specified on the command line or in the environment,
940         dnl use architecture minimum.
941         export MACOSX_DEPLOYMENT_TARGET=10.6
942     fi
943     ;;
944 esac
946 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
948 dnl ========================================================
949 dnl = Mac OS X SDK support
950 dnl ========================================================
951 MACOS_SDK_DIR=
952 NEXT_ROOT=
953 MOZ_ARG_WITH_STRING(macos-sdk,
954 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
955     MACOS_SDK_DIR=$withval)
957 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
958 dnl NEXT_ROOT will be set and exported only if it's needed.
959 AC_SUBST(MACOS_SDK_DIR)
960 AC_SUBST(NEXT_ROOT)
962 if test "$MACOS_SDK_DIR"; then
963   dnl Sync this section with the ones in NSPR and NSS.
964   dnl Changes to the cross environment here need to be accounted for in
965   dnl the libIDL checks (below) and xpidl build.
967   if test ! -d "$MACOS_SDK_DIR"; then
968     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
969 specify a valid SDK.  SDKs are installed when the optional cross-development
970 tools are selected during the Xcode/Developer Tools installation.])
971   fi
973   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
974   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
975     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
976   else
977     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
978     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
980     dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
981     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
982     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
984     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
985       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
986       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
987       dnl be ignored and cause warnings when -syslibroot is specified.
988       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
989       dnl the -isysroot it receives, so this is only needed with 4.0.0.
990       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
991     fi
992   fi
994   AC_LANG_SAVE
995   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
996   AC_LANG_CPLUSPLUS
997   AC_TRY_COMPILE([#include <new>],[],
998    result=yes,
999    result=no)
1000   AC_LANG_RESTORE
1001   AC_MSG_RESULT($result)
1003   if test "$result" = "no" ; then
1004     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1005   fi
1008 fi # COMPILE_ENVIRONMENT
1010 AC_MSG_CHECKING([compiler version])
1011 # Just print it so it shows up in the logs.
1012 cc_version=$($CC --version)
1013 AC_MSG_RESULT([$cc_version])
1015 if test -n "$MAKE"; then
1016   if test `echo $MAKE | grep -c make.py` != 1; then
1017      NOT_PYMAKE=$MAKE
1018   fi
1021 case "$host_os" in
1022 mingw*)
1023     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1024     ;;
1026     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1027     ;;
1028 esac
1029 if test "$GMAKE" = ":"; then
1030    AC_MSG_ERROR([GNU make not found])
1032 AC_SUBST(GMAKE)
1034 if test -z "$MAKE"; then
1035   MAKE=$GMAKE
1038 if test "$COMPILE_ENVIRONMENT"; then
1040 AC_PATH_XTRA
1042 XCFLAGS="$X_CFLAGS"
1044 fi # COMPILE_ENVIRONMENT
1046 dnl ========================================================
1047 dnl set the defaults first
1048 dnl ========================================================
1049 AS_BIN=$AS
1050 AR_LIST='$(AR) t'
1051 AR_EXTRACT='$(AR) x'
1052 AR_DELETE='$(AR) d'
1053 AS='$(CC)'
1054 AS_DASH_C_FLAG='-c'
1055 DLL_PREFIX=lib
1056 LIB_PREFIX=lib
1057 DLL_SUFFIX=.so
1058 OBJ_SUFFIX=o
1059 LIB_SUFFIX=a
1060 ASM_SUFFIX=s
1061 IMPORT_LIB_SUFFIX=
1062 TARGET_MD_ARCH=unix
1063 DIRENT_INO=d_ino
1064 MOZ_USER_DIR=".mozilla"
1066 MOZ_JPEG_CFLAGS=
1067 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
1068 MOZ_BZ2_CFLAGS=
1069 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1070 MOZ_PNG_CFLAGS=
1071 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
1073 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1074 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1075 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1076 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1077 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1078 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1079 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1080 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1082 # These are specially defined on Windows only
1083 case "$target" in
1084 *-mingw*)
1085   XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1086   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
1087   ;;
1089   XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
1090   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
1091   ;;
1092 esac
1094 MOZ_FS_LAYOUT=unix
1096 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1098 USE_DEPENDENT_LIBS=1
1100 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1102 if test -n "$CROSS_COMPILE"; then
1103     OS_TARGET="${target_os}"
1104     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1105     OS_RELEASE=
1106     case "${target_os}" in
1107         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1108         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1109         gnu*)         OS_ARCH=GNU ;;
1110         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1111         mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
1112         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1113     esac
1114     case "${target}" in
1115         *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1116     esac
1117 else
1118     OS_TARGET=`uname -s`
1119     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1120     OS_RELEASE=`uname -r`
1123 # Before this used `uname -m` when not cross compiling
1124 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1125 OS_TEST="${target_cpu}"
1127 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1129 #######################################################################
1130 # Master "Core Components" macros for getting the OS target           #
1131 #######################################################################
1134 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1135 # cross-compilation.
1139 # Define and override various archtecture-specific variables, including
1140 # HOST_OS_ARCH
1141 # OS_ARCH
1142 # OS_TEST
1143 # OS_TARGET
1144 # OS_RELEASE
1145 # OS_MINOR_RELEASE
1148 case "$HOST_OS_ARCH" in
1149 mingw*)
1150     HOST_OS_ARCH=WINNT
1151     ;;
1152 darwin*)
1153     HOST_OS_ARCH=Darwin
1154     ;;
1155 linux*)
1156     HOST_OS_ARCH=Linux
1157     ;;
1158 solaris*)
1159     HOST_OS_ARCH=SunOS
1160     SOLARIS_SUNPRO_CC=
1161     SOLARIS_SUNPRO_CXX=
1162     if test -z "$GNU_CC"; then
1163         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1164             SOLARIS_SUNPRO_CC=1
1165        fi
1166     fi
1168     if test -z "$GNU_CXX"; then
1169        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1170            SOLARIS_SUNPRO_CXX=1
1171        fi
1172     fi
1173     AC_SUBST(SOLARIS_SUNPRO_CC)
1174     AC_SUBST(SOLARIS_SUNPRO_CXX)
1175     ;;
1176 OS_2)
1177     HOST_OS_ARCH=OS2
1178     ;;
1179 esac
1181 case "$OS_ARCH" in
1182 WINNT)
1183     if test -z "$CROSS_COMPILE" ; then
1184         OS_TEST=`uname -p`
1185     fi
1186     ;;
1187 Windows_NT)
1189 # If uname -s returns "Windows_NT", we assume that we are using
1190 # the uname.exe in MKS toolkit.
1192 # The -r option of MKS uname only returns the major version number.
1193 # So we need to use its -v option to get the minor version number.
1194 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1196     OS_ARCH=WINNT
1197     OS_TARGET=WINNT
1198     OS_MINOR_RELEASE=`uname -v`
1199     if test "$OS_MINOR_RELEASE" = "00"; then
1200         OS_MINOR_RELEASE=0
1201     fi
1202     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1203     ;;
1204 MINGW*_NT*)
1206 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1207 # the uname.exe in the MSYS tools.
1209     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1210     OS_ARCH=WINNT
1211     OS_TARGET=WINNT
1212     ;;
1213 AIX)
1214     OS_RELEASE=`uname -v`.`uname -r`
1215     OS_TEST=${target_cpu}
1216     ;;
1217 OS_2)
1218     OS_ARCH=OS2
1219     OS_TARGET=OS2
1220     OS_RELEASE=`uname -v`
1221     ;;
1222 Darwin)
1223     case "${target_cpu}" in
1224     powerpc*)
1225         OS_TEST=ppc
1226         ;;
1227     i*86*)
1228         OS_TEST=i386
1229         ;;
1230     x86_64)
1231         OS_TEST=x86_64
1232         ;;
1233     *)
1234         if test -z "$CROSS_COMPILE" ; then
1235             OS_TEST=`uname -p`
1236         fi
1237         ;;
1238     esac
1239     ;;
1240 esac
1242 # Only set CPU_ARCH if we recognize the value of OS_TEST
1244 case "$OS_TEST" in
1245 *86 | i86pc)
1246     CPU_ARCH=x86
1247     ;;
1249 powerpc64 | ppc64)
1250     CPU_ARCH=ppc64
1251     ;;
1253 powerpc | ppc | rs6000)
1254     CPU_ARCH=ppc
1255     ;;
1257 Alpha | alpha | ALPHA)
1258     CPU_ARCH=Alpha
1259     ;;
1261 s390)
1262     CPU_ARCH=s390
1263     ;;
1265 s390x)
1266     CPU_ARCH=s390x
1267     ;;
1269 hppa* | parisc)
1270     CPU_ARCH=hppa
1271     ;;
1273 sun4u | sparc*)
1274     CPU_ARCH=sparc
1275     ;;
1277 x86_64 | ia64)
1278     CPU_ARCH="$OS_TEST"
1279     ;;
1281 arm*)
1282     CPU_ARCH=arm
1283     ;;
1285 mips|mipsel)
1286     CPU_ARCH="mips"
1287     ;;
1288 esac
1290 if test -z "$OS_TARGET"; then
1291     OS_TARGET=$OS_ARCH
1293 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1295 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1296 dnl ===============================================================
1297 INTEL_ARCHITECTURE=
1298 case "$OS_TEST" in
1299     x86_64|i?86)
1300       INTEL_ARCHITECTURE=1
1301 esac
1303 dnl Configure platform-specific CPU architecture compiler options.
1304 dnl ==============================================================
1305 MOZ_ARCH_OPTS
1307 dnl =================================================================
1308 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1309 dnl which is bad when cross compiling.
1310 dnl =================================================================
1311 if test "$COMPILE_ENVIRONMENT"; then
1312 configure_static_assert_macros='
1313 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1314 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1315 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1318 dnl test that the macros actually work:
1319 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1320 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1321  [AC_LANG_SAVE
1322   AC_LANG_C
1323   ac_cv_static_assertion_macros_work="yes"
1324   AC_TRY_COMPILE([$configure_static_assert_macros],
1325                  [CONFIGURE_STATIC_ASSERT(1)],
1326                  ,
1327                  ac_cv_static_assertion_macros_work="no")
1328   AC_TRY_COMPILE([$configure_static_assert_macros],
1329                  [CONFIGURE_STATIC_ASSERT(0)],
1330                  ac_cv_static_assertion_macros_work="no",
1331                  )
1332   AC_LANG_CPLUSPLUS
1333   AC_TRY_COMPILE([$configure_static_assert_macros],
1334                  [CONFIGURE_STATIC_ASSERT(1)],
1335                  ,
1336                  ac_cv_static_assertion_macros_work="no")
1337   AC_TRY_COMPILE([$configure_static_assert_macros],
1338                  [CONFIGURE_STATIC_ASSERT(0)],
1339                  ac_cv_static_assertion_macros_work="no",
1340                  )
1341   AC_LANG_RESTORE
1342  ])
1343 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1344 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1345     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1347 fi # COMPILE_ENVIRONMENT
1349 dnl ========================================================
1350 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1351 dnl computed above.
1352 dnl ========================================================
1354 MOZ_ANDROID_STLPORT
1356 dnl ========================================================
1357 dnl Suppress Clang Argument Warnings
1358 dnl ========================================================
1359 if test -n "$CLANG_CC"; then
1360     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1361     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1363 if test -n "$CLANG_CXX"; then
1364     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1367 dnl ========================================================
1368 dnl = Use Address Sanitizer
1369 dnl ========================================================
1370 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1371 [  --enable-address-sanitizer       Enable Address Sanitizer (default=no)],
1372     MOZ_ASAN=1,
1373     MOZ_ASAN= )
1374 if test -n "$MOZ_ASAN"; then
1375     MOZ_LLVM_HACKS=1
1376     AC_DEFINE(MOZ_ASAN)
1378 AC_SUBST(MOZ_ASAN)
1380 dnl ========================================================
1381 dnl = Enable hacks required for LLVM instrumentations
1382 dnl ========================================================
1383 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1384 [  --enable-llvm-hacks       Enable workarounds required for several LLVM instrumentations (default=no)],
1385     MOZ_LLVM_HACKS=1,
1386     MOZ_LLVM_HACKS= )
1387 if test -n "$MOZ_LLVM_HACKS"; then
1388     MOZ_NO_WLZDEFS=1
1389     MOZ_CFLAGS_NSS=1
1391 AC_SUBST(MOZ_NO_WLZDEFS)
1392 AC_SUBST(MOZ_CFLAGS_NSS)
1394 dnl ========================================================
1395 dnl GNU specific defaults
1396 dnl ========================================================
1397 if test "$GNU_CC"; then
1398     # FIXME: Let us build with strict aliasing. bug 414641.
1399     CFLAGS="$CFLAGS -fno-strict-aliasing"
1400     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1401     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1402     DSO_LDOPTS='-shared'
1403     if test "$GCC_USE_GNU_LD"; then
1404         # Some tools like ASan use a runtime library that is only
1405         # linked against executables, so we must allow undefined
1406         # symbols for shared objects in some cases.
1407         if test -z "$MOZ_NO_WLZDEFS"; then
1408             # Don't allow undefined symbols in libraries
1409             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1410         fi
1411     fi
1412     WARNINGS_AS_ERRORS='-Werror -Wno-error=uninitialized'
1413     DSO_CFLAGS=''
1414     DSO_PIC_CFLAGS='-fPIC'
1415     ASFLAGS="$ASFLAGS -fPIC"
1416     AC_MSG_CHECKING([for --noexecstack option to as])
1417     _SAVE_CFLAGS=$CFLAGS
1418     CFLAGS="$CFLAGS -Wa,--noexecstack"
1419     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1420                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1421                      AC_MSG_RESULT([no]))
1422     CFLAGS=$_SAVE_CFLAGS
1423     AC_MSG_CHECKING([for -z noexecstack option to ld])
1424     _SAVE_LDFLAGS=$LDFLAGS
1425     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1426     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1427                   AC_MSG_RESULT([no])
1428                   LDFLAGS=$_SAVE_LDFLAGS)
1430     # Check for -mssse3 on $CC
1431     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1432     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1433     _SAVE_CFLAGS=$CFLAGS
1434     CFLAGS="$CFLAGS -mssse3"
1435     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1436                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1437                      AC_MSG_RESULT([no]))
1438     CFLAGS=$_SAVE_CFLAGS
1439     AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
1441     # Turn on GNU-specific warnings:
1442     # -Wall - turn on a lot of warnings
1443     # -pedantic - this is turned on below
1444     # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1445     # -Wdeclaration-after-statement - MSVC doesn't like these
1446     # -Werror=return-type - catches missing returns, zero false positives
1447     # -Wtype-limits - catches overflow bugs, few false positives
1448     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1449     #
1450     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1451     MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1452     MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1453     MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1454     
1455     # Turn off the following warnings that -Wall/-pedantic turn on:
1456     # -Wno-unused - lots of violations in third-party code
1457     # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1458     #
1459     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1460     MOZ_C_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_c_has_wno_overlength_strings)
1462     if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1463        # Don't use -Wcast-align with ICC or clang
1464        case "$CPU_ARCH" in
1465            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1466            hppa | ia64 | sparc | arm)
1467            ;;
1468            *)
1469         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1470            ;;
1471        esac
1472     fi
1474     dnl Turn pedantic on but disable the warnings for long long
1475     _PEDANTIC=1
1477     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1478     _USE_CPP_INCLUDE_FLAG=1
1480 elif test "$SOLARIS_SUNPRO_CC"; then
1481     DSO_CFLAGS=''
1482     if test "$CPU_ARCH" = "sparc"; then
1483         # for Sun Studio on Solaris/SPARC
1484         DSO_PIC_CFLAGS='-xcode=pic32'
1485     else
1486         DSO_PIC_CFLAGS='-KPIC'
1487     fi
1488     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1489 else
1490     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1491     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1493     DSO_LDOPTS='-shared'
1494     if test "$GNU_LD"; then
1495         # Don't allow undefined symbols in libraries
1496         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1497     fi
1499     DSO_CFLAGS=''
1500     DSO_PIC_CFLAGS='-KPIC'
1501     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1504 if test "$GNU_CXX"; then
1505     # FIXME: Let us build with strict aliasing. bug 414641.
1506     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1508     # Turn on GNU-specific warnings:
1509     # -Wall - turn on a lot of warnings
1510     # -pedantic - this is turned on below
1511     # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1512     # -Woverloaded-virtual - ???
1513     # -Werror=return-type - catches missing returns, zero false positives
1514     # -Wtype-limits - catches overflow bugs, few false positives
1515     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1516     #
1517     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1518     MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1519     MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1520     MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1522     # Turn off the following warnings that -Wall/-pedantic turn on:
1523     # -Wno-ctor-dtor-privacy - ???
1524     # -Wno-overlength-strings - we exceed the minimum maximum length frequently 
1525     # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1526     # -Wno-variadic-macros - ???
1527     #
1528     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-ctor-dtor-privacy"
1529     MOZ_CXX_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_cxx_has_wno_overlength_strings)
1530     MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1531     MOZ_CXX_SUPPORTS_WARNING(-Wno-, variadic-macros, ac_cxx_has_wno_variadic_macros)
1533     if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1534        # Don't use -Wcast-align with ICC or clang
1535        case "$CPU_ARCH" in
1536            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1537            hppa | ia64 | sparc | arm)
1538            ;;
1539            *)
1540         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1541            ;;
1542        esac
1543     fi
1545     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1546     _USE_CPP_INCLUDE_FLAG=1
1548     # Recent clang and gcc support C++11 deleted functions without warnings if
1549     # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1550     # versions).  We can't use -std=c++0x yet, so gcc's support must remain
1551     # unused.  But clang's warning can be disabled, so when compiling with clang
1552     # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1553     # deleted function syntax.
1554     if test "$CLANG_CXX"; then
1555         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1556         MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1557     fi
1559 else
1560     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1563 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1564 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1565 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1566 dnl normal behavior.
1567 dnl ========================================================
1568 MKSHLIB_FORCE_ALL=
1569 MKSHLIB_UNFORCE_ALL=
1571 if test "$COMPILE_ENVIRONMENT"; then
1572 if test "$GNU_CC"; then
1573   AC_MSG_CHECKING(whether ld has archive extraction flags)
1574   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1575    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1576     ac_cv_mkshlib_force_and_unforce="no"
1577     exec 3<&0 <<LOOP_INPUT
1578         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1579         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1580         force="-Wl,-all";              unforce="-Wl,-none"
1581 LOOP_INPUT
1582     while read line
1583     do
1584       eval $line
1585       LDFLAGS=$force
1586       LIBS=$unforce
1587       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1588     done
1589     exec 0<&3 3<&-
1590     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1591    ])
1592   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1593     AC_MSG_RESULT(no)
1594   else
1595     AC_MSG_RESULT(yes)
1596     eval $ac_cv_mkshlib_force_and_unforce
1597     MKSHLIB_FORCE_ALL=$force
1598     MKSHLIB_UNFORCE_ALL=$unforce
1599   fi
1600 fi # GNU_CC
1601 fi # COMPILE_ENVIRONMENT
1603 dnl ========================================================
1604 dnl Checking for 64-bit OS
1605 dnl ========================================================
1606 if test "$COMPILE_ENVIRONMENT"; then
1607 AC_LANG_SAVE
1608 AC_LANG_C
1609 AC_MSG_CHECKING(for 64-bit OS)
1610 AC_TRY_COMPILE([$configure_static_assert_macros],
1611                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1612                result="yes", result="no")
1613 AC_MSG_RESULT("$result")
1614 if test "$result" = "yes"; then
1615     AC_DEFINE(HAVE_64BIT_OS)
1616     HAVE_64BIT_OS=1
1618 AC_SUBST(HAVE_64BIT_OS)
1619 AC_LANG_RESTORE
1620 fi # COMPILE_ENVIRONMENT
1622 dnl ========================================================
1623 dnl Enable high-memory support on OS/2 by default.
1624 dnl ========================================================
1625 MOZ_OS2_HIGH_MEMORY=1
1626 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1627 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1628     MOZ_OS2_HIGH_MEMORY=,
1629     MOZ_OS2_HIGH_MEMORY=1 )
1630 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1632 dnl ========================================================
1633 dnl = Use profiling compile flags
1634 dnl ========================================================
1635 MOZ_ARG_ENABLE_BOOL(profiling,
1636 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1637     MOZ_PROFILING=1,
1638     MOZ_PROFILING= )
1640 # For profiling builds keep the symbol information
1641 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1642     STRIP_FLAGS="--strip-debug"
1645 dnl ========================================================
1646 dnl = Use incremental GC
1647 dnl ========================================================
1648 JSGC_INCREMENTAL=1
1649 MOZ_ARG_DISABLE_BOOL(gcincremental,
1650 [  --disable-gcincremental Disable incremental GC],
1651     JSGC_INCREMENTAL= )
1652 if test -n "$JSGC_INCREMENTAL"; then
1653     AC_DEFINE(JSGC_INCREMENTAL)
1656 dnl ========================================================
1657 dnl = Use generational GC
1658 dnl ========================================================
1659 MOZ_ARG_ENABLE_BOOL(gcgenerational,
1660 [  --enable-gcgenerational Enable generational GC],
1661     JSGC_GENERATIONAL=1,
1662     JSGC_GENERATIONAL= )
1663 if test -n "$JSGC_GENERATIONAL"; then
1664     AC_DEFINE(JSGC_GENERATIONAL)
1667 dnl ========================================================
1668 dnl = Perform moving GC stack rooting analysis
1669 dnl ========================================================
1670 MOZ_ARG_ENABLE_BOOL(root-analysis,
1671 [  --enable-root-analysis  Enable moving GC stack root analysis],
1672     JSGC_ROOT_ANALYSIS=1,
1673     JSGC_ROOT_ANALYSIS= )
1674 if test -n "$JSGC_ROOT_ANALYSIS"; then
1675     AC_DEFINE(JSGC_ROOT_ANALYSIS)
1678 dnl ========================================================
1679 dnl = Use exact stack rooting for GC
1680 dnl ========================================================
1681 MOZ_ARG_ENABLE_BOOL(exact-rooting,
1682 [  --enable-exact-rooting  Enable use of exact stack roots for GC],
1683     JSGC_USE_EXACT_ROOTING=1,
1684     JSGC_USE_EXACT_ROOTING= )
1685 if test -n "$JSGC_USE_EXACT_ROOTING"; then
1686     AC_DEFINE(JSGC_USE_EXACT_ROOTING)
1689 dnl ========================================================
1690 dnl = Use Valgrind
1691 dnl ========================================================
1692 MOZ_ARG_ENABLE_BOOL(valgrind,
1693 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
1694     MOZ_VALGRIND=1,
1695     MOZ_VALGRIND= )
1696 if test -n "$MOZ_VALGRIND"; then
1697     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1698         AC_MSG_ERROR(
1699             [--enable-valgrind specified but Valgrind is not installed]))
1700     AC_DEFINE(MOZ_VALGRIND)
1702 AC_SUBST(MOZ_VALGRIND)
1704 dnl ========================================================
1705 dnl = Enable DMDV
1706 dnl ========================================================
1707 MOZ_ARG_ENABLE_BOOL(dmdv,
1708 [  --enable-dmdv           Enable DMDV; also disables jemalloc (default=no)],
1709     MOZ_DMDV=1,
1710     MOZ_DMDV= )
1711 if test -n "$MOZ_DMDV"; then
1712     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1713         AC_MSG_ERROR(
1714             [--enable-dmdv specified but Valgrind is not installed]))
1715     AC_DEFINE(MOZ_DMDV)
1717 AC_SUBST(MOZ_DMDV)
1719 dnl ========================================================
1720 dnl jprof
1721 dnl ========================================================
1722 MOZ_ARG_ENABLE_BOOL(jprof,
1723 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1724     MOZ_JPROF=1,
1725     MOZ_JPROF= )
1726 if test -n "$MOZ_JPROF"; then
1727     MOZ_PROFILING=1
1728     AC_DEFINE(MOZ_JPROF)
1731 dnl ========================================================
1732 dnl SPS Profiler
1733 dnl ========================================================
1734 MOZ_ENABLE_PROFILER_SPS=1
1736 case "${OS_TARGET}" in
1737 Android)
1738     case "${CPU_ARCH}" in
1739     x86 | arm) ;;
1740     *)
1741         MOZ_ENABLE_PROFILER_SPS=
1742     esac
1743     ;;
1744 Linux)
1745     case "${CPU_ARCH}" in
1746     x86 | x86_64) ;;
1747     *)
1748         MOZ_ENABLE_PROFILER_SPS=
1749     esac
1750     ;;
1751 WINNT|Darwin) ;;
1753     MOZ_ENABLE_PROFILER_SPS=
1754     ;;
1755 esac
1757 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1758     AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1761 dnl ========================================================
1762 dnl shark
1763 dnl ========================================================
1764 MOZ_ARG_ENABLE_BOOL(shark,
1765 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
1766     MOZ_SHARK=1,
1767     MOZ_SHARK= )
1768 if test -n "$MOZ_SHARK"; then
1769     MOZ_PROFILING=1
1770     AC_DEFINE(MOZ_SHARK)
1773 dnl ========================================================
1774 dnl callgrind
1775 dnl ========================================================
1776 MOZ_ARG_ENABLE_BOOL(callgrind,
1777 [  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
1778     MOZ_CALLGRIND=1,
1779     MOZ_CALLGRIND= )
1780 if test -n "$MOZ_CALLGRIND"; then
1781     MOZ_PROFILING=1
1782     AC_DEFINE(MOZ_CALLGRIND)
1785 dnl ========================================================
1786 dnl vtune
1787 dnl ========================================================
1788 MOZ_ARG_ENABLE_BOOL(vtune,
1789 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
1790     MOZ_VTUNE=1,
1791     MOZ_VTUNE= )
1792 if test -n "$MOZ_VTUNE"; then
1793     MOZ_PROFILING=1
1794     AC_DEFINE(MOZ_VTUNE)
1797 dnl ========================================================
1798 dnl Profiling
1799 dnl ========================================================
1800 if test -n "$MOZ_PROFILING"; then
1801     AC_DEFINE(MOZ_PROFILING)
1804 dnl ========================================================
1805 dnl System overrides of the defaults for host
1806 dnl ========================================================
1807 case "$host" in
1808 *mingw*)
1809     if test -n "$_WIN32_MSVC"; then
1810         HOST_AR=lib
1811         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1812         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1813         HOST_RANLIB='echo ranlib'
1814     else
1815         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1816     fi
1817     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1818     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1819     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1820     HOST_BIN_SUFFIX=.exe
1821     case "$host" in
1822     *mingw*)
1823         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1824         ;;
1825     esac
1827     case "${host_cpu}" in
1828     i*86)
1829         if test -n "$_WIN32_MSVC"; then
1830             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1831         fi
1832         ;;
1833     x86_64)
1834         if test -n "$_WIN32_MSVC"; then
1835             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1836         fi
1837         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1838         ;;
1839     esac
1840     ;;
1842 *-darwin*)
1843     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1844     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1845     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1846     ;;
1848 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1849     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1850     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1851     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1852     ;;
1854 *os2*)
1855     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1856     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1857     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1858     HOST_BIN_SUFFIX=.exe
1859     MOZ_FIX_LINK_PATHS=
1860     ;;
1863     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1864     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1865     ;;
1866 esac
1868 dnl Check for using a custom <stdint.h> implementation
1869 dnl ========================================================
1870 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1871 if test "$MOZ_CUSTOM_STDINT_H"; then
1872   AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1873   AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1874 else
1875   AC_MSG_RESULT(none specified)
1878 dnl Get mozilla version from central milestone file
1879 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1880 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1882 dnl Get version of various core apps from the version files.
1883 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1885 if test -z "$FIREFOX_VERSION"; then
1886     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1889 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1890 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1891 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1893 MOZ_DOING_LTO(lto_is_enabled)
1895 dnl ========================================================
1896 dnl System overrides of the defaults for target
1897 dnl ========================================================
1899 case "$target" in
1900 *-aix*)
1901     AC_DEFINE(AIX)
1902     if test ! "$GNU_CC"; then
1903         if test ! "$HAVE_64BIT_OS"; then
1904             # Compiling with Visual Age C++ object model compat is the
1905             # default. To compile with object model ibm, add
1906             # AIX_OBJMODEL=ibm to .mozconfig.
1907             if test "$AIX_OBJMODEL" = "ibm"; then
1908                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1909             else
1910                 AIX_OBJMODEL=compat
1911             fi
1912         else
1913             AIX_OBJMODEL=compat
1914         fi
1915         AC_SUBST(AIX_OBJMODEL)
1916         DSO_LDOPTS='-qmkshrobj=1'
1917         DSO_CFLAGS='-qflag=w:w'
1918         DSO_PIC_CFLAGS=
1919         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1920         MOZ_FIX_LINK_PATHS=
1921         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1922         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1923         if test "$COMPILE_ENVIRONMENT"; then
1924             AC_LANG_SAVE
1925             AC_LANG_CPLUSPLUS
1926             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1927             AC_TRY_COMPILE([],
1928                 [#if (__IBMCPP__ < 900)
1929                  #error "Bad compiler"
1930                  #endif],
1931                 _BAD_COMPILER=,_BAD_COMPILER=1)
1932             if test -n "$_BAD_COMPILER"; then
1933                 AC_MSG_RESULT([no])
1934                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1935             else
1936                 AC_MSG_RESULT([yes])
1937             fi
1938             AC_LANG_RESTORE
1939             TARGET_COMPILER_ABI="ibmc"
1940             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1941             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1942         fi
1943     fi
1944     case "${target_os}" in
1945     aix4.1*)
1946         DLL_SUFFIX='_shr.a'
1947         ;;
1948     esac
1949     if test "$COMPILE_ENVIRONMENT"; then
1950         MOZ_CHECK_HEADERS(sys/inttypes.h)
1951     fi
1952     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1953     ;;
1955 *-darwin*)
1956     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1957     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1958     MOZ_OPTIMIZE_FLAGS="-O3"
1959     _PEDANTIC=
1960     # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
1961     if test "$HAVE_64BIT_OS"; then
1962         MOZ_MEMORY=1
1963     fi
1964     DLL_SUFFIX=".dylib"
1965     DSO_LDOPTS=''
1966     STRIP_FLAGS="$STRIP_FLAGS -x -S"
1967     # Check whether we're targeting OS X or iOS
1968     AC_CACHE_CHECK(for iOS target,
1969                    ac_cv_ios_target,
1970                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
1971 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1972 #error not iOS
1973 #endif],
1974                                    [],
1975                                    ac_cv_ios_target="yes",
1976                                    ac_cv_ios_target="no")])
1977     if test "$ac_cv_ios_target" = "yes"; then
1978         AC_DEFINE(XP_IOS)
1979         AC_DEFINE(XP_DARWIN)
1980         _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1981     else
1982         AC_DEFINE(XP_MACOSX)
1983         AC_DEFINE(XP_DARWIN)
1984         _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1985         # The ExceptionHandling framework is needed for Objective-C exception
1986         # logging code in nsObjCExceptions.h. Currently we only use that in debug
1987         # builds.
1988         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1989     fi
1990     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1993     if test "x$lto_is_enabled" = "xyes"; then
1994         echo "Skipping -dead_strip because lto is enabled."
1995     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1996     dnl ===================================================================
1997     elif test "x$enable_dtrace" = "xyes"; then
1998         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1999     else
2000         dnl check for the presence of the -dead_strip linker flag
2001         AC_MSG_CHECKING([for -dead_strip option to ld])
2002         _SAVE_LDFLAGS=$LDFLAGS
2003         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2004         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2005         if test -n "$_HAVE_DEAD_STRIP" ; then
2006             AC_MSG_RESULT([yes])
2007             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2008         else
2009             AC_MSG_RESULT([no])
2010         fi
2012         LDFLAGS=$_SAVE_LDFLAGS
2013     fi
2015     dnl With newer linkers we need to pass -allow_heap_execute because of
2016     dnl Microsoft Silverlight (5.1.10411.0 at least).
2017     AC_MSG_CHECKING([for -allow_heap_execute option to ld])
2018     _SAVE_LDFLAGS=$LDFLAGS
2019     LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
2020     AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
2021                 _HAVE_ALLOW_HEAP_EXECUTE=)
2022     if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
2023         AC_MSG_RESULT([yes])
2024         MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
2025     else
2026         AC_MSG_RESULT([no])
2027     fi
2028     LDFLAGS=$_SAVE_LDFLAGS
2030     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2031     ;;
2033 ia64*-hpux*)
2034     DLL_SUFFIX=".so"
2035     if test ! "$GNU_CC"; then
2036        DSO_LDOPTS='-b'
2037        DSO_CFLAGS=""
2038        DSO_PIC_CFLAGS=
2039        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2040        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2041        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2042     else
2043        DSO_LDOPTS='-b -E'
2044        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2045        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2046     fi
2047     MOZ_FIX_LINK_PATHS=
2048     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2049     AC_DEFINE(_LARGEFILE64_SOURCE)
2050     ;;
2052 *-hpux*)
2053     DLL_SUFFIX=".sl"
2054     if test ! "$GNU_CC"; then
2055         DSO_LDOPTS='-b -Wl,+s'
2056         DSO_CFLAGS=""
2057         DSO_PIC_CFLAGS="+Z"
2058         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2059         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2060         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2061     else
2062         DSO_LDOPTS='-b -E +s'
2063         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2064         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2065     fi
2066     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2067     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2068     ;;
2070 *-android*|*-linuxandroid*)
2071     AC_DEFINE(NO_PW_GECOS)
2072     no_x=yes
2073     if test -n "$gonkdir"; then
2074         _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2075         MOZ_B2G_RIL=1
2076         MOZ_B2G_BT=1
2077         MOZ_B2G_FM=1
2078     else
2079         _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2080         MOZ_LINKER=1
2081     fi
2082     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2084     MOZ_GFX_OPTIMIZE_MOBILE=1
2085     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2086     ;;
2088 *-*linux*)
2089     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2090     # Similarly for GNU_CXX and INTEL_CXX.
2091     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2092         # -Os has been broken on Intel's C/C++ compilers for quite a
2093         # while; Intel recommends against using it.
2094         MOZ_OPTIMIZE_FLAGS="-O2"
2095         MOZ_DEBUG_FLAGS="-g"
2096     elif test "$GNU_CC" -o "$GNU_CXX"; then
2097         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2098         case $GCC_VERSION in
2099         4.1.*|4.2.*|4.5.*)
2100             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2101             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2102         esac
2103         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2104         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2105         MOZ_DEBUG_FLAGS="-g"
2106     fi
2108     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2110     MOZ_MEMORY=1
2112     case "${target_cpu}" in
2113     alpha*)
2114         CFLAGS="$CFLAGS -mieee"
2115         CXXFLAGS="$CXXFLAGS -mieee"
2116     ;;
2117     i*86)
2118         USE_ELF_DYNSTR_GC=1
2119     ;;
2120     mips*)
2121         MOZ_DEBUG_FLAGS="-g" # We want inlining
2122     ;;
2123     esac
2125     if test -z "$MC"; then
2126         MC=mc.exe
2127     fi
2128     ;;
2129 *-mingw*)
2130     DSO_CFLAGS=
2131     DSO_PIC_CFLAGS=
2132     DLL_SUFFIX=.dll
2133     RC=rc.exe
2134     MC=mc.exe
2135     # certain versions of cygwin's makedepend barf on the
2136     # #include <string> vs -I./dist/include/string issue so don't use it
2137     if test -n "$GNU_CC"; then
2138         CC="$CC -mwindows"
2139         CXX="$CXX -mwindows"
2140         CPP="$CPP -mwindows"
2141         CFLAGS="$CFLAGS -mms-bitfields"
2142         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2143         DSO_LDOPTS='-shared'
2144         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2145         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2146         RC='$(WINDRES)'
2147         # Use temp file for windres (bug 213281)
2148         RCFLAGS='-O coff --use-temp-file'
2149         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2150         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2151         MOZ_FIX_LINK_PATHS=
2152         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2153         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2154         DLL_PREFIX=
2155         IMPORT_LIB_SUFFIX=dll.a
2156         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2158         # We use mix of both POSIX and Win32 printf format across the tree, so format
2159         # warnings are useless on mingw.
2160         MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2161         MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2162     else
2163         TARGET_COMPILER_ABI=msvc
2164         HOST_CC='$(CC)'
2165         HOST_CXX='$(CXX)'
2166         HOST_LD='$(LD)'
2167         if test "$AS_BIN"; then
2168             AS="$(basename "$AS_BIN")"
2169         fi
2170         AR='lib'
2171         AR_FLAGS='-NOLOGO -OUT:"$@"'
2172         AR_EXTRACT=
2173         RANLIB='echo not_ranlib'
2174         STRIP='echo not_strip'
2175         PKG_SKIP_STRIP=1
2176         XARGS=xargs
2177         ZIP=zip
2178         UNZIP=unzip
2179         DOXYGEN=:
2180         ASM_SUFFIX=asm
2181         OBJ_SUFFIX=obj
2182         LIB_SUFFIX=lib
2183         DLL_PREFIX=
2184         LIB_PREFIX=
2185         IMPORT_LIB_SUFFIX=lib
2186         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2187         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2188         MKSHLIB_FORCE_ALL=
2189         MKSHLIB_UNFORCE_ALL=
2190         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2191         _USE_CPP_INCLUDE_FLAG=1
2192         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2193         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2194         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2195         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2196         # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2197         # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2198         # MSVC warning C4800 warns when a value is implicitly cast to bool,
2199         # because this also forces narrowing to a single byte, which can be a
2200         # perf hit.  But this matters so little in practice (and often we want
2201         # that behavior) that it's better to turn it off.
2202         CXXFLAGS="$CXXFLAGS -wd4345 -wd4351 -wd4800"
2203         # make 'foo == bar;' error out
2204         CFLAGS="$CFLAGS -we4553"
2205         CXXFLAGS="$CXXFLAGS -we4553"
2206         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2207         MOZ_DEBUG_FLAGS='-Zi'
2208         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2209         WARNINGS_AS_ERRORS='-WX'
2210         MOZ_OPTIMIZE_FLAGS='-O1'
2211         MOZ_FIX_LINK_PATHS=
2212         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2213         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2214         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2215         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2216         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2217         dnl For profile-guided optimization
2218         PROFILE_GEN_CFLAGS="-GL"
2219         PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2220         dnl XXX: PGO builds can fail with warnings treated as errors,
2221         dnl specifically "no profile data available" appears to be
2222         dnl treated as an error sometimes. This might be a consequence
2223         dnl of using WARNINGS_AS_ERRORS in some modules, combined
2224         dnl with the linker doing most of the work in the whole-program
2225         dnl optimization/PGO case. I think it's probably a compiler bug,
2226         dnl but we work around it here.
2227         PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2228         dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2229         dnl Probably also a compiler bug, but what can you do?
2230         PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2231         LDFLAGS="$LDFLAGS -DYNAMICBASE"
2232     fi
2233     AC_DEFINE(HAVE_SNPRINTF)
2234     AC_DEFINE(_WINDOWS)
2235     AC_DEFINE(WIN32)
2236     AC_DEFINE(XP_WIN)
2237     AC_DEFINE(XP_WIN32)
2238     AC_DEFINE(HW_THREADS)
2239     AC_DEFINE(STDC_HEADERS)
2240     AC_DEFINE(NEW_H, <new>)
2241     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2242     TARGET_MD_ARCH=win32
2243     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2244     BIN_SUFFIX='.exe'
2245     MOZ_USER_DIR="Mozilla"
2247     dnl Hardcode to win95 for now - cls
2248     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2250     dnl set NO_X11 defines here as the general check is skipped on win32
2251     no_x=yes
2252     AC_DEFINE(NO_X11)
2254     case "$host" in
2255     *-mingw*)
2256         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2257         L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2258         ;;
2259     esac
2261     case "$host" in
2262     *-mingw*)
2263         if test -z "$MOZ_TOOLS"; then
2264             AC_MSG_ERROR([MOZ_TOOLS is not set])
2265         fi
2266         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2267         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2268             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2269         fi
2270         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2271         if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2272             AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2273         fi
2274         ;;
2275     esac
2277     case "$host_os" in
2278     cygwin*|msvc*|mks*)
2279         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.])
2280         ;;
2281     esac
2283     case "$target" in
2284     i*86-*)
2285         if test "$HAVE_64BIT_OS"; then
2286             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2287         fi
2289         if test -n "$GNU_CC"; then
2290             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2291             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2292             LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup"
2293         else
2294             AC_DEFINE(HAVE_STDCALL)
2295             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2296             LDFLAGS="$LDFLAGS -SAFESEH"
2297         fi
2299         AC_DEFINE(_X86_)
2300         ;;
2301     x86_64-*)
2302         if test -n "$_WIN32_MSVC"; then
2303             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2304         fi
2305         AC_DEFINE(_AMD64_)
2306         ;;
2307     *)
2308         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2309         ;;
2310     esac
2312     if test "$HAVE_64BIT_OS"; then
2313         AC_DEFINE(_WIN64)
2314     fi
2315     ;;
2317 *-netbsd*)
2318     DSO_CFLAGS=''
2319     CFLAGS="$CFLAGS -Dunix"
2320     CXXFLAGS="$CXXFLAGS -Dunix"
2321     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2322         DLL_SUFFIX=".so"
2323         DSO_PIC_CFLAGS='-fPIC -DPIC'
2324         DSO_LDOPTS='-shared'
2325         BIN_FLAGS='-Wl,--export-dynamic'
2326     else
2327         DSO_PIC_CFLAGS='-fPIC -DPIC'
2328         DLL_SUFFIX=".so.1.0"
2329         DSO_LDOPTS='-shared'
2330     fi
2331     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2332     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2333     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2334     if test "$LIBRUNPATH"; then
2335         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2336     fi
2337     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2338     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2339     ;;
2341 *-openbsd*)
2342     if test "$SO_VERSION"; then
2343         DLL_SUFFIX=".so.$SO_VERSION"
2344     else
2345         DLL_SUFFIX=".so.1.0"
2346     fi
2347     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2348     DSO_CFLAGS=''
2349     DSO_PIC_CFLAGS='-fPIC'
2350     DSO_LDOPTS='-shared -fPIC'
2351     if test "$LIBRUNPATH"; then
2352         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2353     fi
2354     ;;
2356 *-os2*)
2357     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2358     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2359     AC_DEFINE(OS2)
2360     AC_DEFINE(XP_OS2)
2361     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2362     AC_DEFINE(TCPV40HDRS)
2363     DLL_PREFIX=
2364     LIB_PREFIX=
2365     LIB_SUFFIX=lib
2366     BIN_SUFFIX=".exe"
2367     DLL_SUFFIX=".dll"
2368     IMPORT_LIB_SUFFIX=lib
2369     DSO_PIC_CFLAGS=
2370     AR=emxomfar
2371     AR_FLAGS='r $@'
2372     CFLAGS="$CFLAGS -Zomf"
2373     CXXFLAGS="$CXXFLAGS -Zomf"
2374     DSO_LDOPTS='-Zdll'
2375     BIN_FLAGS='-Zlinker /ST:0x100000'
2376     IMPLIB='emximp -o'
2377     FILTER='true'
2378     LDFLAGS='-Zmap'
2379     WARNINGS_AS_ERRORS='-Werror'
2380     MOZ_DEBUG_FLAGS="-g -fno-inline"
2381     MOZ_OPTIMIZE_FLAGS="-O2"
2382     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2383     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2384     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2385     TARGET_MD_ARCH=os2
2386     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2387     RC=rc.exe
2388     MC=mc.exe
2389     RCFLAGS='-n'
2390     MOZ_USER_DIR="Mozilla"
2391     ZIP="$ZIP -X"
2393     if test "$MOZTOOLS"; then
2394         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2395     else
2396         AC_MSG_ERROR([MOZTOOLS is not set])
2397     fi
2398     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2399         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2400         LDFLAGS="$LDFLAGS -Zhigh-mem"
2401         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2402         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2403     fi
2405     # GCC for OS/2 currently predefines these, but we don't want them
2406     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2407     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2409     AC_CACHE_CHECK(for __declspec(dllexport),
2410         ac_os2_declspec,
2411         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2412                         [return 0;],
2413                         ac_os2_declspec="yes",
2414                         ac_os2_declspec="no")])
2415     if test "$ac_os2_declspec" != "yes"; then
2416         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2417     fi
2418     ;;
2420 *-solaris*)
2421     AC_DEFINE(SOLARIS)
2422     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2423     MOZ_FIX_LINK_PATHS=
2424     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2425     # libraries one level up (e.g. libnspr4.so)
2426     if test "$SOLARIS_SUNPRO_CC"; then
2427        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2428        LIBS="-lCrun -lCstd -lc $LIBS"
2429        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2430        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2431        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2432        LDFLAGS="-xildoff $LDFLAGS"
2433        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2434            _SAVE_LDFLAGS=$LDFLAGS
2435            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2436            AC_TRY_LINK([#include <stdio.h>],
2437                        [printf("Hello World\n");],
2438                        ,
2439                        [LDFLAGS=$_SAVE_LDFLAGS])
2440        fi
2441        MOZ_OPTIMIZE_FLAGS="-xO4"
2442        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2443        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2444        MKSHLIB_FORCE_ALL='-z allextract'
2445        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2446        DSO_LDOPTS='-G'
2447        AR_LIST="$AR t"
2448        AR_EXTRACT="$AR x"
2449        AR_DELETE="$AR d"
2450        AR='$(CXX) -xar'
2451        AR_FLAGS='-o $@'
2452        AS='/usr/ccs/bin/as'
2453        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2454        AS_DASH_C_FLAG=''
2455        TARGET_COMPILER_ABI="sunc"
2456        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2457        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2458        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2459        AC_LANG_SAVE
2460        AC_LANG_CPLUSPLUS
2461        AC_TRY_COMPILE([],
2462            [#if (__SUNPRO_CC < 0x590)
2463            #error "Denied"
2464            #endif],
2465            _BAD_COMPILER=,_BAD_COMPILER=1)
2466        if test -n "$_BAD_COMPILER"; then
2467            _res="no"
2468            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2469        else
2470            _res="yes"
2471        fi
2472        AC_TRY_COMPILE([],
2473            [#if (__SUNPRO_CC >= 0x5100)
2474            #error "Sun C++ 5.10 or above"
2475            #endif],
2476            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2477        if test "$_ABOVE_SS12U1"; then
2478            # disable xannotate
2479            CXXFLAGS="$CXXFLAGS -xannotate=no"
2480        fi
2481        AC_MSG_RESULT([$_res])
2482        AC_LANG_RESTORE
2483     else
2484        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2485        LIBS="-lc $LIBS"
2486        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2487        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2488        ASFLAGS="$ASFLAGS -fPIC"
2489        DSO_LDOPTS='-shared'
2490        WARNINGS_AS_ERRORS='-Werror'
2491        _WARNINGS_CFLAGS=''
2492        _WARNINGS_CXXFLAGS=''
2493        if test "$OS_RELEASE" = "5.3"; then
2494            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2495        fi
2496     fi
2497     if test "$OS_RELEASE" = "5.5.1"; then
2498         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2499     fi
2500     ;;
2502 *-sunos*)
2503     DSO_LDOPTS='-Bdynamic'
2504     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2505     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2506     AC_DEFINE(SUNOS4)
2507     AC_DEFINE(SPRINTF_RETURNS_STRING)
2508     case "$(target_os)" in
2509     sunos4.1*)
2510         DLL_SUFFIX='.so.1.0'
2511         ;;
2512     esac
2513     ;;
2515 *-os2*)
2516     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2517     ;;
2519 esac
2521 AC_SUBST(MOZ_LINKER)
2522 if test -n "$MOZ_LINKER"; then
2523   AC_DEFINE(MOZ_LINKER)
2525 AC_SUBST(MOZ_ENABLE_SZIP)
2527 dnl Only one oddball right now (QNX), but this gives us flexibility
2528 dnl if any other platforms need to override this in the future.
2529 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2531 dnl ========================================================
2532 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2533 dnl by now will not have any way to link most binaries (tests
2534 dnl as well as viewer, apprunner, etc.), because some symbols
2535 dnl will be left out of the "composite" .so's by ld as unneeded.
2536 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2537 dnl they can link in the static libs that provide the missing
2538 dnl symbols.
2539 dnl ========================================================
2540 NO_LD_ARCHIVE_FLAGS=
2541 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2542     NO_LD_ARCHIVE_FLAGS=1
2544 case "$target" in
2545 *-os2*)
2546     NO_LD_ARCHIVE_FLAGS=
2547     ;;
2548 *-aix4.3*|*-aix5*)
2549     NO_LD_ARCHIVE_FLAGS=
2550     ;;
2551 *-mingw*)
2552     if test -z "$GNU_CC"; then
2553         NO_LD_ARCHIVE_FLAGS=
2554     fi
2555     ;;
2556 esac
2557 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2559 dnl ========================================================
2560 dnl = Flags to strip unused symbols from .so components and
2561 dnl = to export jemalloc symbols when linking a program
2562 dnl ========================================================
2563 case "$target" in
2564     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2565         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2566         ;;
2567     *-solaris*)
2568         if test -z "$GNU_CC"; then
2569          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2570         else
2571          if test -z "$GCC_USE_GNU_LD"; then
2572           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2573          else
2574           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2575          fi
2576         fi
2577         ;;
2578     *-darwin*)
2579         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2580         ;;
2581     *-mingw*)
2582         if test -n "$GNU_CC"; then
2583            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2584         fi
2585         ;;
2586 esac
2588 if test -z "$COMPILE_ENVIRONMENT"; then
2589     SKIP_COMPILER_CHECKS=1
2590     SKIP_LIBRARY_CHECKS=1
2593 MOZ_COMPILER_OPTS
2594 if test -z "$SKIP_COMPILER_CHECKS"; then
2595 dnl Checks for typedefs, structures, and compiler characteristics.
2596 dnl ========================================================
2597 AC_HEADER_STDC
2598 AC_C_CONST
2599 AC_TYPE_MODE_T
2600 AC_TYPE_OFF_T
2601 AC_TYPE_PID_T
2602 AC_TYPE_SIZE_T
2603 AC_LANG_CPLUSPLUS
2604 AC_MSG_CHECKING(for __stdcall)
2605 AC_CACHE_VAL(ac_cv___stdcall,
2606  [AC_TRY_COMPILE([template <typename Method> struct foo;
2607                   template <> struct foo<void (*)()> {};
2608                   template <> struct foo<void (__stdcall*)()> {};],
2609                  [],
2610                  [ac_cv___stdcall=true],
2611                  [ac_cv___stdcall=false])])
2612 if test "$ac_cv___stdcall" = true ; then
2613   AC_DEFINE(HAVE_STDCALL)
2614   AC_MSG_RESULT(yes)
2615 else
2616   AC_MSG_RESULT(no)
2618 AC_LANG_C
2619 AC_MSG_CHECKING(for ssize_t)
2620 AC_CACHE_VAL(ac_cv_type_ssize_t,
2621  [AC_TRY_COMPILE([#include <stdio.h>
2622                   #include <sys/types.h>],
2623                  [ssize_t foo = 0;],
2624                  [ac_cv_type_ssize_t=true],
2625                  [ac_cv_type_ssize_t=false])])
2626 if test "$ac_cv_type_ssize_t" = true ; then
2627   AC_DEFINE(HAVE_SSIZE_T)
2628   AC_MSG_RESULT(yes)
2629 else
2630   AC_MSG_RESULT(no)
2632 AC_STRUCT_ST_BLKSIZE
2633 AC_MSG_CHECKING(for siginfo_t)
2634 AC_CACHE_VAL(ac_cv_siginfo_t,
2635  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2636                   #include <signal.h>],
2637                  [siginfo_t* info;],
2638                  [ac_cv_siginfo_t=true],
2639                  [ac_cv_siginfo_t=false])])
2640 if test "$ac_cv_siginfo_t" = true ; then
2641   AC_DEFINE(HAVE_SIGINFO_T)
2642   AC_MSG_RESULT(yes)
2643 else
2644   AC_MSG_RESULT(no)
2647 dnl Check for int64, uint, and uint_t.
2648 dnl ========================================================
2649 AC_MSG_CHECKING(for int64)
2650 AC_CACHE_VAL(ac_cv_int64,
2651  [AC_TRY_COMPILE([#include <stdio.h>
2652                   #include <sys/types.h>],
2653                  [int64 foo = 0;],
2654                  [ac_cv_int64=true],
2655                  [ac_cv_int64=false])])
2656 if test "$ac_cv_int64" = true ; then
2657   AC_DEFINE(HAVE_INT64)
2658   AC_MSG_RESULT(yes)
2659 else
2660   AC_MSG_RESULT(no)
2662 AC_MSG_CHECKING(for uint)
2663 AC_CACHE_VAL(ac_cv_uint,
2664  [AC_TRY_COMPILE([#include <stdio.h>
2665                   #include <sys/types.h>],
2666                  [uint foo = 0;],
2667                  [ac_cv_uint=true],
2668                  [ac_cv_uint=false])])
2669 if test "$ac_cv_uint" = true ; then
2670   AC_DEFINE(HAVE_UINT)
2671   AC_MSG_RESULT(yes)
2672 else
2673   AC_MSG_RESULT(no)
2675 AC_MSG_CHECKING(for uint_t)
2676 AC_CACHE_VAL(ac_cv_uint_t,
2677  [AC_TRY_COMPILE([#include <stdio.h>
2678                   #include <sys/types.h>],
2679                  [uint_t foo = 0;],
2680                  [ac_cv_uint_t=true],
2681                  [ac_cv_uint_t=false])])
2682 if test "$ac_cv_uint_t" = true ; then
2683   AC_DEFINE(HAVE_UINT_T)
2684   AC_MSG_RESULT(yes)
2685 else
2686   AC_MSG_RESULT(no)
2689 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2690 dnl are defined when compiling C++ but not C.  Since the result of this
2691 dnl test is used only in C++, do it in C++.
2692 AC_LANG_CPLUSPLUS
2694 AC_MSG_CHECKING(for uname.domainname)
2695 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2696     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2697         [ struct utsname *res; char *domain;
2698             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2699         [ac_cv_have_uname_domainname_field=true],
2700         [ac_cv_have_uname_domainname_field=false])])
2702 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2703     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2704     AC_MSG_RESULT(yes)
2705 else
2706     AC_MSG_RESULT(no)
2709 AC_MSG_CHECKING(for uname.__domainname)
2710 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2711     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2712         [ struct utsname *res; char *domain;
2713             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2714         [ac_cv_have_uname_us_domainname_field=true],
2715         [ac_cv_have_uname_us_domainname_field=false])])
2717 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2718     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2719     AC_MSG_RESULT(yes)
2720 else
2721     AC_MSG_RESULT(no)
2724 dnl Check whether we can use gcc's c++0x mode
2725 AC_LANG_CPLUSPLUS
2727 if test "$GNU_CXX"; then
2728     _SAVE_CXXFLAGS=$CXXFLAGS
2729     CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2731     AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2732         ac_cv_cxx0x_headers_bug,
2733         [AC_TRY_COMPILE([#include <memory>], [],
2734                         ac_cv_cxx0x_headers_bug="no",
2735                         ac_cv_cxx0x_headers_bug="yes")])
2736     CXXFLAGS="$_SAVE_CXXFLAGS"
2737     if test "$ac_cv_cxx0x_headers_bug" = "no"; then
2738         CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2739     fi
2742 dnl Check for usable char16_t (2 bytes, unsigned)
2743 dnl (we might not need the unsignedness check anymore)
2744 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2745     ac_cv_have_usable_char16_t,
2746     [AC_TRY_COMPILE([$configure_static_assert_macros],
2747                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2748                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2749                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2750                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2751                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2752                     ac_cv_have_usable_char16_t="yes",
2753                     ac_cv_have_usable_char16_t="no")])
2754 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2755     AC_DEFINE(HAVE_CPP_CHAR16_T)
2756     HAVE_CPP_CHAR16_T=1
2757 elif test "$GNU_CXX"; then
2758     CXXFLAGS="$_SAVE_CXXFLAGS"
2761 dnl Check for usable wchar_t (2 bytes, unsigned)
2762 dnl (we really don't need the unsignedness check anymore)
2763 dnl ========================================================
2765 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2766     ac_cv_have_usable_wchar_v2,
2767     [AC_TRY_COMPILE([#include <stddef.h>
2768                      $configure_static_assert_macros],
2769                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2770                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2771                     ac_cv_have_usable_wchar_v2="yes",
2772                     ac_cv_have_usable_wchar_v2="no")])
2773 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2774     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2775     HAVE_CPP_2BYTE_WCHAR_T=1
2776 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2777 dnl This is really gcc-only
2778 dnl Do this test using CXX only since some versions of gcc
2779 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2780 dnl only have short-wchar support for c++.
2781 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2783     _SAVE_CXXFLAGS=$CXXFLAGS
2784     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2786     AC_CACHE_CHECK(for compiler -fshort-wchar option,
2787         ac_cv_have_usable_wchar_option_v2,
2788         [AC_TRY_LINK([#include <stddef.h>
2789                       $configure_static_assert_macros],
2790                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2791                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2792                      ac_cv_have_usable_wchar_option_v2="yes",
2793                      ac_cv_have_usable_wchar_option_v2="no")])
2795     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2796         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2797         HAVE_CPP_2BYTE_WCHAR_T=1
2798         if test "$OS_TARGET" = Android; then
2799             WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
2800             CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
2801             CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
2802             DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
2803         else
2804             WCHAR_CFLAGS="-fshort-wchar"
2805         fi
2806     else
2807         CXXFLAGS=$_SAVE_CXXFLAGS
2808     fi
2811 AC_LANG_C
2813 dnl Check for .hidden assembler directive and visibility attribute.
2814 dnl Borrowed from glibc configure.in
2815 dnl ===============================================================
2816 if test "$GNU_CC"; then
2817   AC_CACHE_CHECK(for visibility(hidden) attribute,
2818                  ac_cv_visibility_hidden,
2819                  [cat > conftest.c <<EOF
2820                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2822                   ac_cv_visibility_hidden=no
2823                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2824                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2825                       ac_cv_visibility_hidden=yes
2826                     fi
2827                   fi
2828                   rm -f conftest.[cs]
2829                  ])
2830   if test "$ac_cv_visibility_hidden" = "yes"; then
2831     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2833     AC_CACHE_CHECK(for visibility(default) attribute,
2834                    ac_cv_visibility_default,
2835                    [cat > conftest.c <<EOF
2836                     int foo __attribute__ ((visibility ("default"))) = 1;
2838                     ac_cv_visibility_default=no
2839                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2840                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2841                         ac_cv_visibility_default=yes
2842                       fi
2843                     fi
2844                     rm -f conftest.[cs]
2845                    ])
2846     if test "$ac_cv_visibility_default" = "yes"; then
2847       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2849       AC_CACHE_CHECK(for visibility pragma support,
2850                      ac_cv_visibility_pragma,
2851                      [cat > conftest.c <<EOF
2852 #pragma GCC visibility push(hidden)
2853                       int foo_hidden = 1;
2854 #pragma GCC visibility push(default)
2855                       int foo_default = 1;
2857                       ac_cv_visibility_pragma=no
2858                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2859                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2860                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2861                             ac_cv_visibility_pragma=yes
2862                           fi
2863                         fi
2864                       fi
2865                       rm -f conftest.[cs]
2866                     ])
2867       if test "$ac_cv_visibility_pragma" = "yes"; then
2868         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2869                        ac_cv_have_visibility_class_bug,
2870                        [cat > conftest.c <<EOF
2871 #pragma GCC visibility push(hidden)
2872 struct __attribute__ ((visibility ("default"))) TestStruct {
2873   static void Init();
2875 __attribute__ ((visibility ("default"))) void TestFunc() {
2876   TestStruct::Init();
2879                        ac_cv_have_visibility_class_bug=no
2880                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2881                          ac_cv_have_visibility_class_bug=yes
2882                        else
2883                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2884                            ac_cv_have_visibility_class_bug=yes
2885                          fi
2886                        fi
2887                        rm -rf conftest.{c,S}
2888                        ])
2890         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2891                        ac_cv_have_visibility_builtin_bug,
2892                        [cat > conftest.c <<EOF
2893 #pragma GCC visibility push(hidden)
2894 #pragma GCC visibility push(default)
2895 #include <string.h>
2896 #pragma GCC visibility pop
2898 __attribute__ ((visibility ("default"))) void Func() {
2899   char c[[100]];
2900   memset(c, 0, sizeof(c));
2903                        ac_cv_have_visibility_builtin_bug=no
2904                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2905                          ac_cv_have_visibility_builtin_bug=yes
2906                        else
2907                          if test `grep -c "@PLT" conftest.S` = 0; then
2908                            ac_cv_visibility_builtin_bug=yes
2909                          fi
2910                        fi
2911                        rm -f conftest.{c,S}
2912                        ])
2913         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2914                 "$ac_cv_have_visibility_class_bug" = "no"; then
2915           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2916           WRAP_SYSTEM_INCLUDES=1
2917           STL_FLAGS='-I$(DIST)/stl_wrappers'
2918           WRAP_STL_INCLUDES=1
2919         else
2920           VISIBILITY_FLAGS='-fvisibility=hidden'
2921         fi # have visibility pragma bug
2922       fi   # have visibility pragma
2923     fi     # have visibility(default) attribute
2924   fi       # have visibility(hidden) attribute
2925 fi         # GNU_CC
2927 # visibility hidden flag for Sun Studio on Solaris
2928 if test "$SOLARIS_SUNPRO_CC"; then
2929 VISIBILITY_FLAGS='-xldscope=hidden'
2930 fi         # Sun Studio on Solaris
2932 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2933 AC_SUBST(VISIBILITY_FLAGS)
2935 MOZ_GCC_PR49911
2936 MOZ_GCC_PR39608
2937 MOZ_LLVM_PR8927
2939 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2940 dnl ========================================================
2941 if test "$GNU_CC"; then
2942   CFLAGS_save="${CFLAGS}"
2943   CFLAGS="${CFLAGS} -Werror"
2944   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2945                  ac_cv_force_align_arg_pointer,
2946                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2947                                  [],
2948                                  ac_cv_force_align_arg_pointer="yes",
2949                                  ac_cv_force_align_arg_pointer="no")])
2950   CFLAGS="${CFLAGS_save}"
2951   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2952     HAVE_GCC_ALIGN_ARG_POINTER=1
2953   else
2954     HAVE_GCC_ALIGN_ARG_POINTER=
2955   fi
2957 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2959 dnl Checks for header files.
2960 dnl ========================================================
2961 AC_HEADER_DIRENT
2962 case "$target_os" in
2963 freebsd*|openbsd*)
2964 # for stuff like -lXshm
2965     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2966     ;;
2967 esac
2968 MOZ_CHECK_COMMON_HEADERS
2970 dnl These are all the places some variant of statfs can be hiding.
2971 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2973 dnl Quota support
2974 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2975 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2977 dnl SCTP support - needs various network include headers
2978 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2980 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2982 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2983 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2984                    ac_cv_sockaddr_in_sin_len,
2985                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2986                                     #include <sys/types.h>
2987                                     #endif
2988                                     #include <netinet/in.h>
2989                                     struct sockaddr_in x;
2990                                     void *foo = (void*) &x.sin_len;],
2991                                    [],
2992                                    [ac_cv_sockaddr_in_sin_len=true],
2993                                    [ac_cv_sockaddr_in_sin_len=false])])
2994 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2995   AC_DEFINE(HAVE_SIN_LEN)
2996 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2997   AC_DEFINE(HAVE_SCONN_LEN)
3000 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
3001                ac_cv_sockaddr_in6_sin6_len,
3002                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
3003                                 #include <sys/types.h>
3004                                 #endif
3005                                 #include <netinet/in.h>
3006                                 struct sockaddr_in6 x;
3007                                 void *foo = (void*) &x.sin6_len;],
3008                                [],
3009                                [ac_cv_sockaddr_in6_sin6_len=true],
3010                                [ac_cv_sockaddr_in6_sin6_len=false])])
3011 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
3012   AC_DEFINE(HAVE_SIN6_LEN)
3015 AC_CACHE_CHECK(for sockaddr.sa_len,
3016                ac_cv_sockaddr_sa_len,
3017                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
3018                                 #include <sys/types.h>
3019                                 #endif
3020                                 #include <sys/socket.h>
3021                                 struct sockaddr x;
3022                                 void *foo = (void*) &x.sa_len;],
3023                                [],
3024                                [ac_cv_sockaddr_sa_len=true],
3025                                [ac_cv_sockaddr_sa_len=false])])
3026 if test "$ac_cv_sockaddr_sa_len" = true ; then
3027   AC_DEFINE(HAVE_SA_LEN)
3030 dnl Check whether the compiler supports the new-style C++ standard
3031 dnl library headers (i.e. <new>) or needs the old "new.h"
3032 AC_LANG_CPLUSPLUS
3033 NEW_H=new.h
3034 MOZ_CHECK_HEADER(new, [NEW_H=new])
3035 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3036 AC_LANG_C
3038 AC_ARG_ENABLE(dtrace,
3039               [  --enable-dtrace         build with dtrace support if available (default=no)],
3040               [enable_dtrace="yes"],)
3041 if test "x$enable_dtrace" = "xyes"; then
3042   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3043   if test -n "$HAVE_DTRACE"; then
3044       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3045   else
3046       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3047   fi
3049 AC_SUBST(HAVE_DTRACE)
3051 case $target in
3052 *-aix4.3*|*-aix5*)
3053         ;;
3055         MOZ_CHECK_HEADERS(sys/cdefs.h)
3056         ;;
3057 esac
3059 MOZ_LINUX_PERF_EVENT
3061 dnl Checks for libraries.
3062 dnl ========================================================
3063 case $target in
3064 *-hpux11.*)
3065         ;;
3067         AC_CHECK_LIB(c_r, gethostbyname_r)
3068         ;;
3069 esac
3071 dnl We don't want to link with libdl even if it's present on OS X, since
3072 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3073 dnl in libc.
3074 dnl We don't want to link against libm or libpthread on Darwin since
3075 dnl they both are just symlinks to libSystem and explicitly linking
3076 dnl against libSystem causes issues when debugging (see bug 299601).
3077 case $target in
3078 *-darwin*)
3079     ;;
3080 *-os2*)
3081     ;;
3083     AC_SEARCH_LIBS(dlopen, dl,
3084         MOZ_CHECK_HEADER(dlfcn.h,
3085         AC_DEFINE(HAVE_DLOPEN)))
3086     ;;
3087 esac
3089 _SAVE_CFLAGS="$CFLAGS"
3090 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3091 AC_CHECK_FUNCS(dladdr memmem)
3092 CFLAGS="$_SAVE_CFLAGS"
3094 if test ! "$GNU_CXX"; then
3096     case $target in
3097     *-aix*)
3098         AC_CHECK_LIB(C_r, demangle)
3099         ;;
3100      *)
3101         AC_CHECK_LIB(C, demangle)
3102         ;;
3103      esac
3106 dnl OS/2 has socket in libc.
3107 case $target in
3108 *-os2*)
3109     ;;
3111     AC_CHECK_LIB(socket, socket)
3112 esac
3114 XLDFLAGS="$X_LIBS"
3115 XLIBS="$X_EXTRA_LIBS"
3117 dnl ========================================================
3118 dnl Checks for X libraries.
3119 dnl Ordering is important.
3120 dnl Xt is dependent upon SM as of X11R6
3121 dnl ========================================================
3122 if test "$no_x" = "yes"; then
3123     AC_DEFINE(NO_X11)
3124 else
3125     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3126         XLIBS="-lX11 $XLIBS"
3127         _SAVE_LDFLAGS="$LDFLAGS"
3128         LDFLAGS="$XLDFLAGS $LDFLAGS"
3129         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3130                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3131         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3132                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3134         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3135         unset ac_cv_lib_Xt_XtFree
3136             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3137             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3138         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3139                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3140         ])
3142     # AIX needs the motif library linked before libXt to prevent
3143     # crashes in plugins linked against Motif - Bug #98892
3144     case "${target_os}" in
3145     aix*)
3146         XT_LIBS="-lXm $XT_LIBS"
3147         ;;
3148     esac
3150     dnl ========================================================
3151     dnl = Check for XShm
3152     dnl ========================================================
3153     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3154         $XLIBS $XEXT_LIBS)
3156     dnl ========================================================
3157     dnl = Check for Xss
3158     dnl ========================================================
3159     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3160         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3161             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3162              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3164         LDFLAGS="$_SAVE_LDFLAGS"
3165 fi # $no_x
3167 AC_SUBST(XCFLAGS)
3168 AC_SUBST(XLDFLAGS)
3169 AC_SUBST(XLIBS)
3170 AC_SUBST(XEXT_LIBS)
3171 AC_SUBST(XT_LIBS)
3172 AC_SUBST(XSS_LIBS)
3174 dnl ========================================================
3175 dnl = pthread support
3176 dnl = Start by checking whether the system support pthreads
3177 dnl ========================================================
3178 case "$target_os" in
3179 darwin*)
3180     USE_PTHREADS=1
3181     ;;
3183     MOZ_CHECK_PTHREADS(pthreads,
3184         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3185         MOZ_CHECK_PTHREADS(pthread,
3186             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3187             MOZ_CHECK_PTHREADS(c_r,
3188                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3189                 MOZ_CHECK_PTHREADS(c,
3190                     USE_PTHREADS=1
3191                 )
3192             )
3193         )
3194     )
3195     ;;
3196 esac
3198 dnl ========================================================
3199 dnl Check the command line for --with-pthreads
3200 dnl ========================================================
3201 MOZ_ARG_WITH_BOOL(pthreads,
3202 [  --with-pthreads         Force use of system pthread library with NSPR ],
3203 [ if test "$USE_PTHREADS"x = x; then
3204     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3205 fi],
3206     USE_PTHREADS=
3207     _PTHREAD_LDFLAGS=
3210 dnl ========================================================
3211 dnl Do the platform specific pthread hackery
3212 dnl ========================================================
3213 if test "$USE_PTHREADS"x != x
3214 then
3215         dnl
3216         dnl See if -pthread is supported.
3217         dnl
3218         rm -f conftest*
3219         ac_cv_have_dash_pthread=no
3220         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3221         echo 'int main() { return 0; }' | cat > conftest.c
3222         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3223         if test $? -eq 0; then
3224                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3225                         ac_cv_have_dash_pthread=yes
3226                 case "$target_os" in
3227                 freebsd*)
3228 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3229                 ;;
3230                 *)
3231                             CFLAGS="$CFLAGS -pthread"
3232                             CXXFLAGS="$CXXFLAGS -pthread"
3233                 ;;
3234                 esac
3235                 fi
3236         fi
3237         rm -f conftest*
3238     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3240         dnl
3241         dnl See if -pthreads is supported.
3242         dnl
3243     ac_cv_have_dash_pthreads=no
3244     if test "$ac_cv_have_dash_pthread" = "no"; then
3245             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3246         echo 'int main() { return 0; }' | cat > conftest.c
3247             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3248         if test $? -eq 0; then
3249                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3250                             ac_cv_have_dash_pthreads=yes
3251                             CFLAGS="$CFLAGS -pthreads"
3252                             CXXFLAGS="$CXXFLAGS -pthreads"
3253                     fi
3254             fi
3255             rm -f conftest*
3256         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3257     fi
3259         case "$target" in
3260             *-*-freebsd*)
3261                         AC_DEFINE(_REENTRANT)
3262                         AC_DEFINE(_THREAD_SAFE)
3263                         dnl -pthread links in -lpthread, so don't specify it explicitly.
3264                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3265                                 _PTHREAD_LDFLAGS="-pthread"
3266                         fi
3267                         ;;
3269             *-*-openbsd*|*-*-bsdi*)
3270                         AC_DEFINE(_REENTRANT)
3271                         AC_DEFINE(_THREAD_SAFE)
3272                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3273                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3274                 _PTHREAD_LDFLAGS="-pthread"
3275                         fi
3276                         ;;
3278             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3279                         AC_DEFINE(_REENTRANT)
3280                         ;;
3282             *-aix4.3*|*-aix5*)
3283                         AC_DEFINE(_REENTRANT)
3284                         ;;
3286             *-hpux11.*)
3287                         AC_DEFINE(_REENTRANT)
3288                         ;;
3290             *-*-solaris*)
3291                         AC_DEFINE(_REENTRANT)
3292                         if test "$SOLARIS_SUNPRO_CC"; then
3293                                 CFLAGS="$CFLAGS -mt"
3294                                 CXXFLAGS="$CXXFLAGS -mt"
3295                         fi
3296                         ;;
3297         esac
3298     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3302 dnl Checks for library functions.
3303 dnl ========================================================
3304 AC_PROG_GCC_TRADITIONAL
3305 AC_FUNC_MEMCMP
3306 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf memmove rint stat64 lstat64 truncate64 setbuf isatty)
3307 AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
3308 AC_CHECK_FUNCS(flockfile getpagesize)
3309 AC_CHECK_FUNCS(localtime_r strtok_r)
3311 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3312 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3313                ac_cv_clock_monotonic,
3314                [for libs in "" -lrt; do
3315                     _SAVE_LIBS="$LIBS"
3316                     LIBS="$LIBS $libs"
3317                     AC_TRY_LINK([#include <time.h>],
3318                                  [ struct timespec ts;
3319                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
3320                                  ac_cv_clock_monotonic=$libs
3321                                  LIBS="$_SAVE_LIBS"
3322                                  break,
3323                                  ac_cv_clock_monotonic=no)
3324                     LIBS="$_SAVE_LIBS"
3325                 done])
3326 if test "$ac_cv_clock_monotonic" != "no"; then
3327     HAVE_CLOCK_MONOTONIC=1
3328     REALTIME_LIBS=$ac_cv_clock_monotonic
3329     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3330     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3331     AC_SUBST(REALTIME_LIBS)
3334 dnl check for wcrtomb/mbrtowc
3335 dnl =======================================================================
3336 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3337 AC_LANG_SAVE
3338 AC_LANG_CPLUSPLUS
3339 AC_CACHE_CHECK(for wcrtomb,
3340     ac_cv_have_wcrtomb,
3341     [AC_TRY_LINK([#include <wchar.h>],
3342                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3343                  ac_cv_have_wcrtomb="yes",
3344                  ac_cv_have_wcrtomb="no")])
3345 if test "$ac_cv_have_wcrtomb" = "yes"; then
3346     AC_DEFINE(HAVE_WCRTOMB)
3348 AC_CACHE_CHECK(for mbrtowc,
3349     ac_cv_have_mbrtowc,
3350     [AC_TRY_LINK([#include <wchar.h>],
3351                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3352                  ac_cv_have_mbrtowc="yes",
3353                  ac_cv_have_mbrtowc="no")])
3354 if test "$ac_cv_have_mbrtowc" = "yes"; then
3355     AC_DEFINE(HAVE_MBRTOWC)
3357 AC_LANG_RESTORE
3360 AC_CACHE_CHECK(
3361     [for res_ninit()],
3362     ac_cv_func_res_ninit,
3363     [AC_TRY_LINK([
3364         #ifdef linux
3365         #define _BSD_SOURCE 1
3366         #endif
3367         #include <resolv.h>
3368         ],
3369         [int foo = res_ninit(&_res);],
3370         [ac_cv_func_res_ninit=yes],
3371         [ac_cv_func_res_ninit=no])
3372     ])
3374 if test "$ac_cv_func_res_ninit" = "yes"; then
3375     AC_DEFINE(HAVE_RES_NINIT)
3376 dnl must add the link line we do something as foolish as this... dougt
3377 dnl else
3378 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3379 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3382 AC_LANG_CPLUSPLUS
3383 AC_CACHE_CHECK(
3384     [for gnu_get_libc_version()],
3385     ac_cv_func_gnu_get_libc_version,
3386     [AC_TRY_LINK([
3387         #ifdef HAVE_GNU_LIBC_VERSION_H
3388         #include <gnu/libc-version.h>
3389         #endif
3390         ],
3391         [const char *glibc_version = gnu_get_libc_version();],
3392         [ac_cv_func_gnu_get_libc_version=yes],
3393         [ac_cv_func_gnu_get_libc_version=no]
3394         )]
3395     )
3397 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3398     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3401 case $target_os in
3402     darwin*|mingw*|os2*)
3403         ;;
3404     *)
3406 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3407     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3408         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3409 _SAVE_LIBS=$LIBS
3410 LIBS="$LIBS $_ICONV_LIBS"
3411 AC_CACHE_CHECK(
3412     [for iconv()],
3413     ac_cv_func_iconv,
3414     [AC_TRY_LINK([
3415         #include <stdlib.h>
3416         #include <iconv.h>
3417         ],
3418         [
3419             iconv_t h = iconv_open("", "");
3420             iconv(h, NULL, NULL, NULL, NULL);
3421             iconv_close(h);
3422         ],
3423         [ac_cv_func_iconv=yes],
3424         [ac_cv_func_iconv=no]
3425         )]
3426     )
3427 if test "$ac_cv_func_iconv" = "yes"; then
3428     AC_DEFINE(HAVE_ICONV)
3429     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3430     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3431     LIBICONV="$_ICONV_LIBS"
3432     AC_CACHE_CHECK(
3433         [for iconv() with const input],
3434         ac_cv_func_const_iconv,
3435         [AC_TRY_COMPILE([
3436             #include <stdlib.h>
3437             #include <iconv.h>
3438             ],
3439             [
3440                 const char *input = "testing";
3441                 iconv_t h = iconv_open("", "");
3442                 iconv(h, &input, NULL, NULL, NULL);
3443                 iconv_close(h);
3444             ],
3445             [ac_cv_func_const_iconv=yes],
3446             [ac_cv_func_const_iconv=no]
3447             )]
3448         )
3449     if test "$ac_cv_func_const_iconv" = "yes"; then
3450         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3451     fi
3453 LIBS=$_SAVE_LIBS
3455     ;;
3456 esac
3458 AM_LANGINFO_CODESET
3460 AC_LANG_C
3462 dnl **********************
3463 dnl *** va_copy checks ***
3464 dnl **********************
3465 dnl we currently check for all three va_copy possibilities, so we get
3466 dnl all results in config.log for bug reports.
3467 AC_MSG_CHECKING(for an implementation of va_copy())
3468 AC_CACHE_VAL(ac_cv_va_copy,[
3469     AC_TRY_RUN([
3470         #include <stdarg.h>
3471         void f (int i, ...) {
3472             va_list args1, args2;
3473             va_start (args1, i);
3474             va_copy (args2, args1);
3475             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3476                 exit (1);
3477             va_end (args1); va_end (args2);
3478         }
3479         int main() { f (0, 42); return 0; }],
3480         ac_cv_va_copy=yes,
3481         ac_cv_va_copy=no,
3482         ac_cv_va_copy=no
3483     )
3485 AC_MSG_RESULT($ac_cv_va_copy)
3486 AC_MSG_CHECKING(for an implementation of __va_copy())
3487 AC_CACHE_VAL(ac_cv___va_copy,[
3488     AC_TRY_RUN([
3489         #include <stdarg.h>
3490         void f (int i, ...) {
3491             va_list args1, args2;
3492             va_start (args1, i);
3493             __va_copy (args2, args1);
3494             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3495                 exit (1);
3496             va_end (args1); va_end (args2);
3497         }
3498         int main() { f (0, 42); return 0; }],
3499         ac_cv___va_copy=yes,
3500         ac_cv___va_copy=no,
3501         ac_cv___va_copy=no
3502     )
3504 AC_MSG_RESULT($ac_cv___va_copy)
3505 AC_MSG_CHECKING(whether va_lists can be copied by value)
3506 AC_CACHE_VAL(ac_cv_va_val_copy,[
3507     AC_TRY_RUN([
3508         #include <stdarg.h>
3509         void f (int i, ...) {
3510             va_list args1, args2;
3511             va_start (args1, i);
3512             args2 = args1;
3513             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3514                 exit (1);
3515             va_end (args1); va_end (args2);
3516         }
3517         int main() { f (0, 42); return 0; }],
3518         ac_cv_va_val_copy=yes,
3519         ac_cv_va_val_copy=no,
3520         ac_cv_va_val_copy=yes
3521     )
3523 if test "x$ac_cv_va_copy" = "xyes"; then
3524     AC_DEFINE(VA_COPY, va_copy)
3525     AC_DEFINE(HAVE_VA_COPY)
3526 elif test "x$ac_cv___va_copy" = "xyes"; then
3527     AC_DEFINE(VA_COPY, __va_copy)
3528     AC_DEFINE(HAVE_VA_COPY)
3531 if test "x$ac_cv_va_val_copy" = "xno"; then
3532    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3534 AC_MSG_RESULT($ac_cv_va_val_copy)
3536 dnl ===================================================================
3537 dnl ========================================================
3538 dnl Put your C++ language/feature checks below
3539 dnl ========================================================
3540 AC_LANG_CPLUSPLUS
3542 ARM_ABI_PREFIX=
3543 if test "$GNU_CC"; then
3544   if test "$CPU_ARCH" = "arm" ; then
3545     AC_CACHE_CHECK(for ARM EABI,
3546         ac_cv_gcc_arm_eabi,
3547         [AC_TRY_COMPILE([],
3548                         [
3549 #if defined(__ARM_EABI__)
3550   return 0;
3551 #else
3552 #error Not ARM EABI.
3553 #endif
3554                         ],
3555                         ac_cv_gcc_arm_eabi="yes",
3556                         ac_cv_gcc_arm_eabi="no")])
3557     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3558         HAVE_ARM_EABI=1
3559         ARM_ABI_PREFIX=eabi-
3560     else
3561         ARM_ABI_PREFIX=oabi-
3562     fi
3563   fi
3565   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3568 dnl Check for support of modern template specialization syntax
3569 dnl Test code and requirement from scc@netscape.com.
3570 dnl Autoconf cut-and-paste job by waterson@netscape.com
3571 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3572                ac_cv_cpp_modern_specialize_template_syntax,
3573                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3574                                class Y {};
3575                                template <> struct X<Y> { double a; };,
3576                                X<int> int_x;
3577                                X<Y> y_x;,
3578                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3579                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3580 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
3581   AC_MSG_ERROR([The C++ compiler does not support template specialization])
3584 dnl Some compilers support only full specialization, and some don't.
3585 AC_CACHE_CHECK(whether partial template specialization works,
3586                ac_cv_cpp_partial_specialization,
3587                [AC_TRY_COMPILE(template <class T> class Foo {};
3588                                template <class T> class Foo<T*> {};,
3589                                return 0;,
3590                                ac_cv_cpp_partial_specialization=yes,
3591                                ac_cv_cpp_partial_specialization=no)])
3592 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3593   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3596 dnl Check to see if we can resolve ambiguity with |using|.
3597 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3598                ac_cv_cpp_ambiguity_resolving_using,
3599                [AC_TRY_COMPILE(class X {
3600                                  public: int go(const X&) {return 3;}
3601                                          int jo(const X&) {return 3;}
3602                                };
3603                                class Y : public X {
3604                                  public:  int go(int) {return 2;}
3605                                           int jo(int) {return 2;}
3606                                           using X::jo;
3607                                  private: using X::go;
3608                                };,
3609                                X x; Y y; y.jo(x);,
3610                                ac_cv_cpp_ambiguity_resolving_using=yes,
3611                                ac_cv_cpp_ambiguity_resolving_using=no)])
3612 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3613    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3616 dnl See if a dynamic_cast to void* gives the most derived object.
3617 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3618                ac_cv_cpp_dynamic_cast_void_ptr,
3619                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3620                             class Y { int j; public: virtual ~Y() { } };
3621                             class Z : public X, public Y { int k; };
3623                             int main() {
3624                                  Z mdo;
3625                                  X *subx = (X*)&mdo;
3626                                  Y *suby = (Y*)&mdo;
3627                                  return !((((void*)&mdo != (void*)subx) &&
3628                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3629                                           (((void*)&mdo != (void*)suby) &&
3630                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3631                             }],
3632                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3633                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3634                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3635 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3636    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3640 dnl note that this one is reversed - if the test fails, then
3641 dnl we require implementations of unused virtual methods. Which
3642 dnl really blows because it means we'll have useless vtable
3643 dnl bloat.
3644 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3645                ac_cv_cpp_unused_required,
3646                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3647                                X x;,
3648                                ac_cv_cpp_unused_required=no,
3649                                ac_cv_cpp_unused_required=yes)])
3650 if test "$ac_cv_cpp_unused_required" = yes ; then
3651    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3655 dnl Some compilers have trouble comparing a constant reference to a templatized
3656 dnl class to zero, and require an explicit operator==() to be defined that takes
3657 dnl an int. This test separates the strong from the weak.
3659 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3660                ac_cv_trouble_comparing_to_zero,
3661                [AC_TRY_COMPILE([#include <algorithm>
3662                                 template <class T> class Foo {};
3663                                 class T2;
3664                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3665                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3666                                [Foo<int> f; return (0 != f);],
3667                                ac_cv_trouble_comparing_to_zero=no,
3668                                ac_cv_trouble_comparing_to_zero=yes)])
3669 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3670   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3673 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3674 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3675 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3676 # linking XUL.
3677 _SAVE_LDFLAGS=$LDFLAGS
3678 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3679 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3680                ac_cv_thread_keyword,
3681                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3682                             [return tlsIsMainThread;],
3683                             ac_cv_thread_keyword=yes,
3684                             ac_cv_thread_keyword=no)])
3685 LDFLAGS=$_SAVE_LDFLAGS
3686 # The custom dynamic linker doesn't support TLS variables
3687 MOZ_TLS=
3688 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3689   # mips builds fail with TLS variables because of a binutils bug.
3690   # See bug 528687
3691   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3692   case "${target}" in
3693     mips*-*)
3694       :
3695       ;;
3696     *-android*|*-linuxandroid*)
3697       :
3698       ;;
3699     *-openbsd*)
3700       :
3701       ;;
3702     *)
3703       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3704       MOZ_TLS=1
3705       ;;
3706   esac
3709 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3710 if test -n "$MOZ_LINKER"; then
3711   if test "$CPU_ARCH" = arm; then
3712     dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
3713     ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
3714     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3715     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3716       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000"
3717       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000"
3718     fi
3719   fi
3722 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3723 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3724 dnl We however want to avoid these text relocations, and this can be done
3725 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3726 dnl doesn't contain anything at all, beside placeholders for some sections,
3727 dnl and crtbegin only contains a finalizer function that calls
3728 dnl __cxa_finalize. The custom linker actually takes care of calling
3729 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3730 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3731 dnl link crtbegin and crtend at all.
3732 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$OS_TARGET" = "Android"; then
3733   AC_CACHE_CHECK([whether the CRT objects have text relocations],
3734     ac_cv_crt_has_text_relocations,
3735     [echo 'int foo() { return 0; }' > conftest.cpp
3736      if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3737         test -s conftest${DLL_SUFFIX}; then
3738        if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3739          ac_cv_crt_has_text_relocations=yes
3740        else
3741          ac_cv_crt_has_text_relocations=no
3742        fi
3743      else
3744        AC_ERROR([couldn't compile a simple C file])
3745      fi
3746      rm -rf conftest*])
3747   if test "$ac_cv_crt_has_text_relocations" = yes; then
3748     dnl While we want libraries to skip the CRT files, we don't want
3749     dnl executables to be treated the same way. We thus set the flag
3750     dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3751     dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3752     dnl Using LDFLAGS in nspr is safe, since we only really build
3753     dnl libraries there.
3754     DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3755     NSPR_LDFLAGS=-nostartfiles
3756   fi
3759 dnl Check for the existence of various allocation headers/functions
3761 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3762 MALLOC_H=
3764 for file in $MALLOC_HEADERS; do
3765   MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3766   if test "$MALLOC_H" != ""; then
3767     AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3768     break
3769   fi
3770 done
3772 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3773 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3775 AC_CHECK_FUNCS(malloc_usable_size)
3777 dnl See if compiler supports some gcc-style attributes
3779 AC_CACHE_CHECK(for __attribute__((always_inline)),
3780                ac_cv_attribute_always_inline,
3781                [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3782                                [],
3783                                ac_cv_attribute_always_inline=yes,
3784                                ac_cv_attribute_always_inline=no)])
3786 AC_CACHE_CHECK(for __attribute__((malloc)),
3787                ac_cv_attribute_malloc,
3788                [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3789                                [],
3790                                ac_cv_attribute_malloc=yes,
3791                                ac_cv_attribute_malloc=no)])
3793 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3794                ac_cv_attribute_warn_unused,
3795                [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3796                                [],
3797                                ac_cv_attribute_warn_unused=yes,
3798                                ac_cv_attribute_warn_unused=no)])
3800 dnl End of C++ language/feature checks
3801 AC_LANG_C
3803 dnl ========================================================
3804 dnl =  Internationalization checks
3805 dnl ========================================================
3807 dnl Internationalization and Locale support is different
3808 dnl on various UNIX platforms.  Checks for specific i18n
3809 dnl features go here.
3811 dnl check for LC_MESSAGES
3812 AC_CACHE_CHECK(for LC_MESSAGES,
3813                 ac_cv_i18n_lc_messages,
3814                 [AC_TRY_COMPILE([#include <locale.h>],
3815                                 [int category = LC_MESSAGES;],
3816                                 ac_cv_i18n_lc_messages=yes,
3817                                 ac_cv_i18n_lc_messages=no)])
3818 if test "$ac_cv_i18n_lc_messages" = yes; then
3819    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3822 AC_HAVE_FUNCS(localeconv)
3823 fi # ! SKIP_COMPILER_CHECKS
3825 TARGET_XPCOM_ABI=
3826 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3827     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3830 dnl Mozilla specific options
3831 dnl ========================================================
3832 dnl The macros used for command line options
3833 dnl are defined in build/autoconf/altoptions.m4.
3835 dnl If the compiler supports these attributes, define them as
3836 dnl convenience macros.
3837 if test "$ac_cv_attribute_malloc" = yes ; then
3838   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3839 else
3840   AC_DEFINE(NS_ATTR_MALLOC,)
3843 if test "$ac_cv_attribute_warn_unused" = yes ; then
3844   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3845 else
3846   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3849 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3850 dnl features that Windows actually does support.
3852 if test -n "$SKIP_COMPILER_CHECKS"; then
3853    dnl Windows has malloc.h
3854    AC_DEFINE(MALLOC_H, [<malloc.h>])
3855    AC_DEFINE(HAVE_FORCEINLINE)
3856    AC_DEFINE(HAVE_LOCALECONV)
3857 fi # SKIP_COMPILER_CHECKS
3859 dnl ========================================================
3860 dnl =
3861 dnl = Check for external package dependencies
3862 dnl =
3863 dnl ========================================================
3864 MOZ_ARG_HEADER(External Packages)
3866 MOZ_ARG_WITH_STRING(libxul-sdk,
3867 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
3868   LIBXUL_SDK_DIR=$withval)
3870 if test "$LIBXUL_SDK_DIR" = "yes"; then
3871     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3872 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3873     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3875     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3876         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3877     fi
3880 AC_SUBST(LIBXUL_SDK)
3882 if test -n "$LIBXUL_SDK"; then
3883     LIBXUL_DIST="$LIBXUL_SDK"
3884 else
3885     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3887 AC_SUBST(LIBXUL_DIST)
3889 SYSTEM_LIBXUL=
3891 MOZ_ARG_WITH_BOOL(system-libxul,
3892 [  --with-system-libxul    Use system installed libxul SDK],
3893     SYSTEM_LIBXUL=1)
3895 dnl ========================================================
3896 dnl = If NSPR was not detected in the system,
3897 dnl = use the one in the source tree (mozilla/nsprpub)
3898 dnl ========================================================
3899 MOZ_ARG_WITH_BOOL(system-nspr,
3900 [  --with-system-nspr      Use system installed NSPR],
3901     _USE_SYSTEM_NSPR=1 )
3903 if test -n "$_USE_SYSTEM_NSPR"; then
3904     AM_PATH_NSPR(4.9.4, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
3907 if test -n "$MOZ_NATIVE_NSPR"; then
3908     _SAVE_CFLAGS=$CFLAGS
3909     CFLAGS="$CFLAGS $NSPR_CFLAGS"
3910     AC_TRY_COMPILE([#include "prtypes.h"],
3911                 [#ifndef PR_STATIC_ASSERT
3912                  #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3913                  #endif],
3914                 [MOZ_NATIVE_NSPR=1],
3915                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3916     AC_TRY_COMPILE([#include "prtypes.h"],
3917                 [#ifndef PR_UINT64
3918                  #error PR_UINT64 not defined or requires including prtypes.h
3919                  #endif],
3920                 [MOZ_NATIVE_NSPR=1],
3921                 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3922     CFLAGS=$_SAVE_CFLAGS
3923 else
3924     if test -z "$LIBXUL_SDK"; then
3925         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3926         if test -n "$GNU_CC"; then
3927             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3928         else
3929             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3930         fi
3931     else
3932         NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3933         NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3934     fi
3937 dnl system libevent Support
3938 dnl ========================================================
3939 MOZ_ARG_WITH_STRING(system-libevent,
3940 [  --with-system-libevent[=PFX]
3941                           Use system libevent [installed at prefix PFX]],
3942     LIBEVENT_DIR=$withval)
3944 _SAVE_CFLAGS=$CFLAGS
3945 _SAVE_LDFLAGS=$LDFLAGS
3946 _SAVE_LIBS=$LIBS
3947 if test "$LIBEVENT_DIR" = yes; then
3948     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3949         MOZ_NATIVE_LIBEVENT=1,
3950         LIBEVENT_DIR=/usr)
3952 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3953     MOZ_NATIVE_LIBEVENT=
3954 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3955     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3956     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3957     MOZ_CHECK_HEADER(event.h,
3958         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3959              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3960          fi],
3961         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3962     AC_CHECK_LIB(event, event_init,
3963                  [MOZ_NATIVE_LIBEVENT=1
3964                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3965                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3966                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3968 CFLAGS=$_SAVE_CFLAGS
3969 LDFLAGS=$_SAVE_LDFLAGS
3970 LIBS=$_SAVE_LIBS
3972 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3973 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
3974 AC_SUBST(MOZ_LIBEVENT_LIBS)
3976 dnl ========================================================
3977 dnl = If NSS was not detected in the system,
3978 dnl = use the one in the source tree (mozilla/security/nss)
3979 dnl ========================================================
3981 MOZ_ARG_WITH_BOOL(system-nss,
3982 [  --with-system-nss       Use system installed NSS],
3983     _USE_SYSTEM_NSS=1 )
3985 if test -n "$_USE_SYSTEM_NSS"; then
3986     AM_PATH_NSS(3.14, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3989 if test -n "$MOZ_NATIVE_NSS"; then
3990    NSS_LIBS="$NSS_LIBS -lcrmf"
3991 else
3992    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3993    NSS_DEP_LIBS="\
3994         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3995         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
3996         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
3997         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
3998         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4000    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
4001        NSS_LIBS="\
4002         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4003         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4004         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4005         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4006         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4007    else
4008        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4009    fi
4012 dnl ======================
4013 dnl Detect yasm
4014 dnl ======================
4016 AC_MSG_CHECKING([for YASM assembler])
4017 AC_CHECK_PROGS(YASM, yasm, "")
4019 if test -n "$YASM"; then
4020   dnl Pull out yasm's version string
4021   YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
4022   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4023   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4024   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4025   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4028 if test -z "$SKIP_LIBRARY_CHECKS"; then
4029 dnl system JPEG support
4030 dnl ========================================================
4031 MOZ_ARG_WITH_STRING(system-jpeg,
4032 [  --with-system-jpeg[=PFX]
4033                           Use system libjpeg [installed at prefix PFX]],
4034     JPEG_DIR=$withval)
4036 _SAVE_CFLAGS=$CFLAGS
4037 _SAVE_LDFLAGS=$LDFLAGS
4038 _SAVE_LIBS=$LIBS
4039 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4040     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4041     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4043 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4044     MOZ_NATIVE_JPEG=
4045 else
4046     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
4049 if test "$MOZ_NATIVE_JPEG" = 1; then
4050     AC_TRY_COMPILE([ #include <stdio.h>
4051                      #include <sys/types.h>
4052                      #include <jpeglib.h> ],
4053                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4054                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4055                      #endif
4056                      #ifndef JCS_EXTENSIONS
4057                      #error "libjpeg-turbo JCS_EXTENSIONS required"
4058                      #endif
4059                      ],
4060                    MOZ_NATIVE_JPEG=1,
4061                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
4063 CFLAGS=$_SAVE_CFLAGS
4064 LDFLAGS=$_SAVE_LDFLAGS
4065 LIBS=$_SAVE_LIBS
4067 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
4068     MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
4069     MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
4071 fi # SKIP_LIBRARY_CHECKS
4073 dnl system ZLIB support
4074 dnl ========================================================
4075 MOZ_ZLIB_CHECK([1.2.3])
4077 if test "$MOZ_NATIVE_ZLIB" != 1; then
4078     MOZ_ZLIB_CFLAGS=
4079     MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
4082 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
4083     AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4086 if test -z "$SKIP_LIBRARY_CHECKS"; then
4087 dnl system BZIP2 Support
4088 dnl ========================================================
4089 MOZ_ARG_WITH_STRING(system-bz2,
4090 [  --with-system-bz2[=PFX]
4091                           Use system libbz2 [installed at prefix PFX]],
4092     BZ2_DIR=$withval)
4094 _SAVE_CFLAGS=$CFLAGS
4095 _SAVE_LDFLAGS=$LDFLAGS
4096 _SAVE_LIBS=$LIBS
4097 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4098     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4099     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4101 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4102     MOZ_NATIVE_BZ2=
4103 else
4104     AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
4105         [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
4107 CFLAGS=$_SAVE_CFLAGS
4108 LDFLAGS=$_SAVE_LDFLAGS
4109 LIBS=$_SAVE_LIBS
4111 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
4112     MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
4113     MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4116 dnl system PNG Support
4117 dnl ========================================================
4118 MOZ_ARG_WITH_STRING(system-png,
4119 [  --with-system-png[=PFX]
4120                           Use system libpng [installed at prefix PFX]],
4121     PNG_DIR=$withval)
4123 _SAVE_CFLAGS=$CFLAGS
4124 _SAVE_LDFLAGS=$LDFLAGS
4125 _SAVE_LIBS=$LIBS
4126 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4127     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4128     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4130 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4131     MOZ_NATIVE_PNG=
4132 else
4133     AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
4134                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4135     AC_CHECK_LIB(png, png_get_acTL, ,
4136                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
4138 if test "$MOZ_NATIVE_PNG" = 1; then
4139     AC_TRY_COMPILE([ #include <stdio.h>
4140                      #include <sys/types.h>
4141                      #include <png.h> ],
4142                    [ #if PNG_LIBPNG_VER < $MOZPNG
4143                      #error "Insufficient libpng version ($MOZPNG required)."
4144                      #endif
4145                      #ifndef PNG_UINT_31_MAX
4146                      #error "Insufficient libpng version."
4147                      #endif ],
4148                    MOZ_NATIVE_PNG=1,
4149                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4151 CFLAGS=$_SAVE_CFLAGS
4152 LDFLAGS=$_SAVE_LDFLAGS
4153 LIBS=$_SAVE_LIBS
4155 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
4156     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
4157     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
4160 fi # SKIP_LIBRARY_CHECKS
4162 dnl system HunSpell Support
4163 dnl ========================================================
4164 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4165 [  --enable-system-hunspell
4166                           Use system hunspell (located with pkgconfig)],
4167     MOZ_NATIVE_HUNSPELL=1 )
4169 if test -n "$MOZ_NATIVE_HUNSPELL"; then
4170     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4173 AC_SUBST(MOZ_NATIVE_HUNSPELL)
4175 dnl ========================================================
4176 dnl system libffi Support
4177 dnl ========================================================
4178 MOZ_ARG_ENABLE_BOOL(system-ffi,
4179 [  --enable-system-ffi       Use system libffi (located with pkgconfig)],
4180     MOZ_NATIVE_FFI=1 )
4182 if test -n "$MOZ_NATIVE_FFI"; then
4183     # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4184     # for non-GCC compilers.
4185     if test -z "$GNU_CC"; then
4186         PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4187     else
4188         PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4189     fi
4190     MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4193 dnl ========================================================
4194 dnl Java SDK support
4195 dnl ========================================================
4197 JAVA_BIN_PATH=
4198 MOZ_ARG_WITH_STRING(java-bin-path,
4199 [  --with-java-bin-path=dir
4200                           Location of Java binaries (java, javac, jar)],
4201     JAVA_BIN_PATH=$withval)
4203 dnl ========================================================
4204 dnl =
4205 dnl = Application
4206 dnl =
4207 dnl ========================================================
4209 MOZ_ARG_HEADER(Application)
4211 ENABLE_TESTS=1
4212 ENABLE_SYSTEM_EXTENSION_DIRS=1
4213 MOZ_BRANDING_DIRECTORY=
4214 MOZ_OFFICIAL_BRANDING=
4215 MOZ_FEEDS=1
4216 MOZ_FLEXBOX=1
4217 MOZ_WEBAPP_RUNTIME=
4218 MOZ_JSDEBUGGER=1
4219 MOZ_AUTH_EXTENSION=1
4220 MOZ_OGG=1
4221 MOZ_RAW=
4222 MOZ_SYDNEYAUDIO=
4223 MOZ_SPEEX_RESAMPLER=1
4224 MOZ_SOUNDTOUCH=1
4225 MOZ_CUBEB=
4226 MOZ_VORBIS=
4227 MOZ_TREMOR=
4228 MOZ_WAVE=1
4229 MOZ_SAMPLE_TYPE_FLOAT32=
4230 MOZ_SAMPLE_TYPE_S16=
4231 MOZ_MEDIA=
4232 MOZ_OPUS=1
4233 MOZ_WEBM=1
4234 MOZ_DASH=
4235 MOZ_WEBRTC=1
4236 MOZ_PEERCONNECTION=
4237 MOZ_SRTP=
4238 MOZ_WEBRTC_SIGNALING=
4239 MOZ_WEBRTC_IN_LIBXUL=
4240 MOZ_SCTP=
4241 MOZ_MEDIA_PLUGINS=
4242 MOZ_MEDIA_NAVIGATOR=
4243 MOZ_OMX_PLUGIN=
4244 MOZ_VP8=
4245 MOZ_VP8_ERROR_CONCEALMENT=
4246 MOZ_VP8_ENCODER=
4247 VPX_AS=
4248 VPX_ASFLAGS=
4249 VPX_AS_DASH_C_FLAG=
4250 VPX_AS_CONVERSION=
4251 VPX_ASM_SUFFIX=
4252 VPX_X86_ASM=
4253 VPX_ARM_ASM=
4254 LIBJPEG_TURBO_AS=
4255 LIBJPEG_TURBO_ASFLAGS=
4256 LIBJPEG_TURBO_X86_ASM=
4257 LIBJPEG_TURBO_X64_ASM=
4258 LIBJPEG_TURBO_ARM_ASM=
4259 MOZ_PANGO=1
4260 MOZ_PERMISSIONS=1
4261 MOZ_PLACES=1
4262 MOZ_PREF_EXTENSIONS=1
4263 MOZ_PROFILELOCKING=1
4264 MOZ_PSM=1
4265 MOZ_REFLOW_PERF=
4266 MOZ_SAFE_BROWSING=
4267 MOZ_HELP_VIEWER=
4268 MOZ_SPELLCHECK=1
4269 MOZ_ANDROID_OMTC=
4270 MOZ_ONLY_TOUCH_EVENTS=
4271 MOZ_TOOLKIT_SEARCH=1
4272 MOZ_UI_LOCALE=en-US
4273 MOZ_UNIVERSALCHARDET=1
4274 MOZ_URL_CLASSIFIER=
4275 MOZ_XUL=1
4276 MOZ_ZIPWRITER=1
4277 NS_PRINTING=1
4278 MOZ_PDF_PRINTING=
4279 MOZ_DISABLE_DOMCRYPTO=
4280 NSS_DISABLE_DBM=
4281 NECKO_WIFI=1
4282 NECKO_COOKIES=1
4283 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4284 USE_ARM_KUSER=
4285 BUILD_CTYPES=1
4286 MOZ_USE_NATIVE_POPUP_WINDOWS=
4287 MOZ_ANDROID_HISTORY=
4288 MOZ_WEBSMS_BACKEND=
4289 MOZ_GRAPHITE=1
4290 ACCESSIBILITY=1
4291 MOZ_SYS_MSG=
4292 MOZ_TIME_MANAGER=
4293 MOZ_PAY=
4294 MOZ_AUDIO_CHANNEL_MANAGER=
4296 case "$target_os" in
4297     mingw*)
4298         NS_ENABLE_TSF=1
4299         AC_DEFINE(NS_ENABLE_TSF)
4300         ;;
4301 esac
4303 case "${target}" in
4304     *-android*|*-linuxandroid*)
4305         if test "$CPU_ARCH" = "arm" ; then
4306           USE_ARM_KUSER=1
4307         fi
4309         NSS_DISABLE_DBM=1
4310         if test -z "$gonkdir"; then
4311           NECKO_WIFI=
4312         else
4313           NECKO_WIFI=1
4314         fi
4315         MOZ_THEME_FASTSTRIPE=1
4316         MOZ_TREE_FREETYPE=1
4317         MOZ_MEMORY=1
4318         MOZ_RAW=1
4319         ;;
4321 esac
4323 MOZ_ARG_ENABLE_STRING(application,
4324 [  --enable-application=APP
4325                           Options include:
4326                             browser (Firefox)
4327                             xulrunner
4328                             tools/update-packaging (AUS-related packaging tools)],
4329 [ MOZ_BUILD_APP=$enableval ] )
4331 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4332 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4333   XULRUNNER_STUB_NAME=$withval)
4335 if test -z "$XULRUNNER_STUB_NAME"; then
4336   case "$target_os" in
4337   darwin*)
4338     XULRUNNER_STUB_NAME=xulrunner
4339     ;;
4340   *)
4341     XULRUNNER_STUB_NAME=xulrunner-stub
4342   esac
4344 AC_SUBST(XULRUNNER_STUB_NAME)
4346 AC_MSG_CHECKING([for application to build])
4347 if test -z "$MOZ_BUILD_APP"; then
4348   AC_MSG_RESULT([browser])
4349   MOZ_BUILD_APP=browser
4350 else
4351   # default mobile to be mobile/xul
4352   if test "$MOZ_BUILD_APP" = "mobile" ; then
4353     MOZ_BUILD_APP=mobile/xul
4354   fi
4355   # We have a valid application only if it has a build.mk file in its top
4356   # directory.
4357   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4358     AC_MSG_RESULT([none])
4359     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4360   else
4361     AC_MSG_RESULT([$MOZ_BUILD_APP])
4362   fi
4365 # Allow the application to influence configure with a confvars.sh script.
4367 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4368 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4369   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4370   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4371 else
4372   AC_MSG_RESULT([no])
4375 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4376 MOZ_ARG_WITH_STRING(app-name,
4377 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4378 WITH_APP_NAME=$withval,
4381 if test -n "$WITH_APP_NAME" ; then
4382     MOZ_APP_NAME="$WITH_APP_NAME"
4385 MOZ_ARG_WITH_STRING(app-basename,
4386 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4387 WITH_APP_BASENAME=$withval,
4390 if test -n "$WITH_APP_BASENAME" ; then
4391     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4394 # Now is a good time to test for logic errors, define mismatches, etc.
4395 case "$MOZ_BUILD_APP" in
4396 xulrunner)
4397   if test "$LIBXUL_SDK"; then
4398     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4399   fi
4400   ;;
4401 esac
4403 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4404 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4405 # MOZ_BUILD_APP.
4406 case "$MOZ_BUILD_APP" in
4407 browser)
4408   AC_DEFINE(MOZ_PHOENIX)
4409   ;;
4411 xulrunner)
4412   AC_DEFINE(MOZ_XULRUNNER)
4413   ;;
4414 b2g)
4415   AC_DEFINE(MOZ_B2G)
4416   ;;
4417 esac
4419 AC_SUBST(MOZ_BUILD_APP)
4420 AC_SUBST(MOZ_PHOENIX)
4421 AC_SUBST(MOZ_XULRUNNER)
4422 AC_SUBST(MOZ_B2G)
4424 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4426 dnl ========================================================
4427 dnl Check android sdk version depending on mobile target
4428 dnl ========================================================
4430 if test -z "$gonkdir" ; then
4431     # Minimum Android SDK API Level we require.
4432     case "$MOZ_BUILD_APP" in
4433     mobile/xul)
4434         android_min_api_level=13
4435         ;;
4436     mobile/android)
4437         android_min_api_level=16
4438         ;;
4439     esac
4441     MOZ_ANDROID_SDK($android_min_api_level)
4444 dnl ========================================================
4445 dnl =
4446 dnl = Toolkit Options
4447 dnl =
4448 dnl ========================================================
4449 MOZ_ARG_HEADER(Toolkit Options)
4451     dnl ========================================================
4452     dnl = Select the default toolkit
4453     dnl ========================================================
4454         MOZ_ARG_ENABLE_STRING(default-toolkit,
4455         [  --enable-default-toolkit=TK
4456                           Select default toolkit
4457                           Platform specific defaults:
4458                             Mac OS X - cairo-cocoa
4459                             OS/2 - cairo-os2
4460                             Win32 - cairo-windows
4461                             * - cairo-gtk2
4462                             * - cairo-qt],
4463     [ _DEFAULT_TOOLKIT=$enableval ],
4464     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4466     if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4467         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4468         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4469         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4470         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4471         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4472         -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4473         -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4474         -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4475     then
4476         dnl nglayout only supports building with one toolkit,
4477         dnl so ignore everything after the first comma (",").
4478         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4479     else
4480         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4481     fi
4483 MOZ_ARG_WITHOUT_BOOL(x,
4484 [  --without-x              Build without X11],
4485     WITHOUT_X11=1)
4487 dnl ========================================================
4488 dnl = Enable the toolkit as needed                         =
4489 dnl ========================================================
4491 MOZ_WIDGET_GTK=
4493 case "$MOZ_WIDGET_TOOLKIT" in
4495 cairo-windows)
4496     MOZ_WIDGET_TOOLKIT=windows
4497     MOZ_WEBGL=1
4498     MOZ_PDF_PRINTING=1
4499     MOZ_INSTRUMENT_EVENT_LOOP=1
4500     ;;
4502 cairo-gtk2|cairo-gtk2-x11)
4503     MOZ_WIDGET_TOOLKIT=gtk2
4504     MOZ_ENABLE_GTK2=1
4505     MOZ_ENABLE_XREMOTE=1
4506     MOZ_WEBGL=1
4507     MOZ_GL_DEFAULT_PROVIDER=GLX
4509     AC_DEFINE(MOZ_X11)
4510     MOZ_X11=1
4511     USE_FC_FREETYPE=1
4513     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4514     TK_LIBS='$(MOZ_GTK2_LIBS)'
4515     AC_DEFINE(MOZ_WIDGET_GTK2)
4516     MOZ_WIDGET_GTK=2
4517     AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4518     MOZ_PDF_PRINTING=1
4519     MOZ_INSTRUMENT_EVENT_LOOP=1
4520     ;;
4522 cairo-qt)
4523     MOZ_WIDGET_TOOLKIT=qt
4524     MOZ_ENABLE_QT=1
4525     if test -z "$WITHOUT_X11"; then
4526       MOZ_ENABLE_XREMOTE=1
4527       MOZ_GL_DEFAULT_PROVIDER=GLX
4528       MOZ_X11=1
4529       AC_DEFINE(MOZ_X11)
4530       XT_LIBS=
4531     fi
4533     MOZ_WEBGL=1
4534     USE_ELF_DYNSTR_GC=
4535     USE_FC_FREETYPE=1
4536     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4537     TK_LIBS='$(MOZ_QT_LIBS)'
4538     AC_DEFINE(MOZ_WIDGET_QT)
4539     MOZ_PDF_PRINTING=1
4540     ;;
4542 cairo-os2)
4543     MOZ_WIDGET_TOOLKIT=os2
4544     USE_FC_FREETYPE=1
4545     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4546     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4547     MOZ_PDF_PRINTING=1
4548     ;;
4550 cairo-cocoa)
4551     MOZ_WIDGET_TOOLKIT=cocoa
4552     AC_DEFINE(MOZ_WIDGET_COCOA)
4553     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4554     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4555     TK_CFLAGS="-DNO_X11"
4556     CFLAGS="$CFLAGS $TK_CFLAGS"
4557     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4558     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4559     MOZ_USER_DIR="Mozilla"
4560     MOZ_FS_LAYOUT=bundle
4561     MOZ_WEBGL=1
4562     MOZ_INSTRUMENT_EVENT_LOOP=1
4563     ;;
4565 cairo-uikit)
4566     MOZ_WIDGET_TOOLKIT=uikit
4567     AC_DEFINE(MOZ_WIDGET_UIKIT)
4568     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4569     TK_CFLAGS="-DNO_X11"
4570     TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4571     CFLAGS="$CFLAGS $TK_CFLAGS"
4572     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4573     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4574     MOZ_USER_DIR="Mozilla"
4575     MOZ_FS_LAYOUT=bundle
4576     ;;
4578 cairo-android)
4579     AC_DEFINE(MOZ_WIDGET_ANDROID)
4580     MOZ_WIDGET_TOOLKIT=android
4581     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4582     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4583     MOZ_WEBGL=1
4584     MOZ_PDF_PRINTING=1
4585     MOZ_INSTRUMENT_EVENT_LOOP=1
4586     if test "$MOZ_BUILD_APP" = "mobile/xul"; then
4587         MOZ_OLD_LINKER=1
4588     fi
4589     ;;
4591 cairo-gonk)
4592     AC_DEFINE(MOZ_WIDGET_GONK)
4593     AC_DEFINE(MOZ_TOUCH)
4594     MOZ_WIDGET_TOOLKIT=gonk
4595     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4596     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4597     MOZ_WEBGL=1
4598     MOZ_PDF_PRINTING=1
4599     MOZ_TOUCH=1
4600     ;;
4602 esac
4604 AC_SUBST(MOZ_OLD_LINKER)
4605 AC_SUBST(MOZ_PDF_PRINTING)
4606 if test "$MOZ_PDF_PRINTING"; then
4607    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4608    AC_DEFINE(MOZ_PDF_PRINTING)
4611 if test "$MOZ_ENABLE_XREMOTE"; then
4612     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4615 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4616    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4619 if test "$COMPILE_ENVIRONMENT"; then
4620   if test "$MOZ_ENABLE_GTK2"; then
4621     if test "$MOZ_X11"; then
4622       GDK_PACKAGES=gdk-x11-2.0
4623     fi
4625     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4626   fi
4628 fi # COMPILE_ENVIRONMENT
4630 AC_SUBST(MOZ_FS_LAYOUT)
4632 dnl ========================================================
4633 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4634 dnl their usage and use them in spidermonkey.
4635 dnl ========================================================
4636 MOZ_ARG_WITH_BOOL(arm-kuser,
4637 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4638     USE_ARM_KUSER=1,)
4639 if test -n "$USE_ARM_KUSER"; then
4640    AC_DEFINE(USE_ARM_KUSER)
4643 dnl ========================================================
4644 dnl = startup-notification support module
4645 dnl ========================================================
4647 if test "$MOZ_ENABLE_GTK2"
4648 then
4649     MOZ_ENABLE_STARTUP_NOTIFICATION=
4651     MOZ_ARG_ENABLE_BOOL(startup-notification,
4652     [  --enable-startup-notification
4653                           Enable startup-notification support (default: disabled) ],
4654         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4655         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4656     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4657     then
4658         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4659                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4660         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4661             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4662             then
4663                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4664             fi
4665             MOZ_ENABLE_STARTUP_NOTIFICATION=
4666         ])
4667     fi
4669     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4670         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4671     fi
4673     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4675 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4676 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4677 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4679 dnl ========================================================
4680 dnl = QT support
4681 dnl ========================================================
4682 if test "$MOZ_ENABLE_QT"
4683 then
4684     MOZ_ARG_WITH_STRING(qtdir,
4685     [  --with-qtdir=\$dir       Specify Qt directory ],
4686     [ QTDIR=$withval])
4688     if test -z "$QTDIR"; then
4689         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
4690         PKG_CHECK_MODULES(MOZ_QT5, QtWidgets QtMultimedia QtPrintSupport,
4691                       MOZ_ENABLE_QT5=1,
4692                       MOZ_ENABLE_QT5=)
4693         if test "$MOZ_ENABLE_QT5"; then
4694             echo "Using qt5"
4695             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
4696             MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
4697         fi
4699         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4700         AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4701     else
4702         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4704         MOZ_QT_CFLAGS="-DQT_SHARED"
4705         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4706         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4707         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4708         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4709         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4710         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4711         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4712         HOST_MOC="$QTDIR/bin/moc"
4713         HOST_RCC="$QTDIR/bin/rcc"
4715         # QtWidgets was introduced only in Qt5
4716         if test -d $QTDIR/include/QtWidgets; then
4717             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4718             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4719             MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtWidgets -lQtPrintSupport"
4720         fi
4721     fi
4722     if test -z "$HOST_MOC"; then
4723         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4724 incorrect])
4725     fi
4726     if test -z "$HOST_RCC"; then
4727         AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4728 incorrect])
4729     fi
4731     MOC=$HOST_MOC
4732     RCC=$HOST_RCC
4734     MOZ_ENABLE_QMSYSTEM2=
4735     PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4736                       MOZ_ENABLE_QMSYSTEM2=1,
4737                       MOZ_ENABLE_QMSYSTEM2=)
4739     if test "$MOZ_ENABLE_QMSYSTEM2"; then
4740       MOZ_ENABLE_QMSYSTEM2=1
4741       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4742       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4743       AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4744     fi
4746     MOZ_ENABLE_QTNETWORK=
4747     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4748                       MOZ_ENABLE_QTNETWORK=1,
4749                       MOZ_ENABLE_QTNETWORK=)
4751     if test "$MOZ_ENABLE_QTNETWORK"; then
4752       MOZ_ENABLE_QTNETWORK=1
4753       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4754     fi
4756     MOZ_ENABLE_QTMOBILITY=
4757     PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4758                       MOZ_ENABLE_QTMOBILITY=1,
4759                       MOZ_ENABLE_QTMOBILITY=)
4760     if test "$MOZ_ENABLE_QTMOBILITY"; then
4761        MOZ_ENABLE_QTMOBILITY=1
4762        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4763        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4764     else
4765        AC_CHECK_LIB(QtSensors, main, [
4766           MOZ_ENABLE_QTMOBILITY=1
4767           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4768           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4769           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4770           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4771           MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4772        ])
4773     fi
4774     if test "$MOZ_ENABLE_QTMOBILITY"; then
4775        AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4776     fi
4779 AC_SUBST(GTK_CONFIG)
4780 AC_SUBST(TK_CFLAGS)
4781 AC_SUBST(TK_LIBS)
4783 AC_SUBST(MOZ_ENABLE_GTK2)
4784 AC_SUBST(MOZ_ENABLE_QT)
4785 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4786 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4787 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4788 AC_SUBST(MOZ_ENABLE_XREMOTE)
4789 AC_SUBST(MOZ_GTK2_CFLAGS)
4790 AC_SUBST(MOZ_GTK2_LIBS)
4791 AC_SUBST(MOZ_WIDGET_GTK)
4792 AC_SUBST(MOZ_QT_CFLAGS)
4793 AC_SUBST(MOZ_QT_LIBS)
4795 AC_SUBST(MOC)
4796 AC_SUBST(RCC)
4798 AC_SUBST(MOZ_X11)
4800 dnl ========================================================
4801 dnl =
4802 dnl = Components & Features
4803 dnl =
4804 dnl ========================================================
4805 MOZ_ARG_HEADER(Components and Features)
4807 dnl ========================================================
4808 dnl = Localization
4809 dnl ========================================================
4810 MOZ_ARG_ENABLE_STRING(ui-locale,
4811 [  --enable-ui-locale=ab-CD
4812                           Select the user interface locale (default: en-US)],
4813     MOZ_UI_LOCALE=$enableval )
4814 AC_SUBST(MOZ_UI_LOCALE)
4816 dnl ========================================================
4817 dnl = Trademarked Branding
4818 dnl ========================================================
4819 MOZ_ARG_ENABLE_BOOL(official-branding,
4820 [  --enable-official-branding
4821                           Enable Official mozilla.org Branding
4822                           Do not distribute builds with
4823                           --enable-official-branding unless you have
4824                           permission to use trademarks per
4825                           http://www.mozilla.org/foundation/trademarks/ .],
4827   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4828     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4829   else
4830     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4831     MOZ_OFFICIAL_BRANDING=1
4832   fi
4833 ], MOZ_OFFICIAL_BRANDING=)
4835 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4836 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4837   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4840 MOZ_ARG_WITH_STRING(branding,
4841 [  --with-branding=dir     Use branding from the specified directory.],
4842     MOZ_BRANDING_DIRECTORY=$withval)
4844 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4845 if test -z "$REAL_BRANDING_DIRECTORY"; then
4846   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4849 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4850   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4853 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4855 dnl ========================================================
4856 dnl = Distribution ID
4857 dnl ========================================================
4858 MOZ_ARG_WITH_STRING(distribution-id,
4859 [  --with-distribution-id=ID
4860                           Set distribution-specific id (default=org.mozilla)],
4861 [ val=`echo $withval`
4862     MOZ_DISTRIBUTION_ID="$val"])
4864 if test -z "$MOZ_DISTRIBUTION_ID"; then
4865    MOZ_DISTRIBUTION_ID="org.mozilla"
4868 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4869 AC_SUBST(MOZ_DISTRIBUTION_ID)
4872 dnl ========================================================
4873 dnl complex text support off by default
4874 dnl ========================================================
4875 MOZ_ARG_DISABLE_BOOL(pango,
4876 [  --disable-pango         Disable usage of Pango ],
4877     MOZ_PANGO=,
4878     MOZ_PANGO=1)
4880 dnl ========================================================
4881 dnl = Pango
4882 dnl ========================================================
4883 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4884 then
4885     AC_SUBST(MOZ_PANGO)
4887     if test "$MOZ_PANGO"
4888     then
4889         PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4891         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4892         AC_SUBST(MOZ_PANGO_CFLAGS)
4893         AC_SUBST(MOZ_PANGO_LIBS)
4894         AC_DEFINE(MOZ_PANGO)
4895     else
4896         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
4897         AC_SUBST(FT2_CFLAGS)
4898         AC_SUBST(FT2_LIBS)
4899     fi
4902 dnl ========================================================
4903 dnl = GnomeVFS, GIO and GConf support module
4904 dnl ========================================================
4906 if test "$MOZ_X11"
4907 then
4908     dnl build the GIO extension by default only when the
4909     dnl GTK2 toolkit is in use.
4910     if test "$MOZ_ENABLE_GTK2"
4911     then
4912         MOZ_ENABLE_GIO=1
4913         MOZ_ENABLE_GCONF=1
4914     fi
4916     dnl ========================================================
4917     dnl = GnomeVFS support module
4918     dnl ========================================================
4919     MOZ_ARG_ENABLE_BOOL(gnomevfs,
4920     [  --enable-gnomevfs       Enable GnomeVFS support (default: disabled)],
4921         MOZ_ENABLE_GNOMEVFS=force,
4922         MOZ_ENABLE_GNOMEVFS=)
4924     if test "$MOZ_ENABLE_GNOMEVFS"
4925     then
4926         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4927             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4928             MOZ_ENABLE_GNOMEVFS=1
4929             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4930         ],[
4931             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4932             then
4933                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4934             fi
4935             MOZ_ENABLE_GNOMEVFS=
4936         ])
4937     fi
4939     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4940     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4941     AC_SUBST(MOZ_GNOMEVFS_LIBS)
4943     dnl ========================================================
4944     dnl = GIO support module
4945     dnl ========================================================
4946     MOZ_ARG_DISABLE_BOOL(gio,
4947     [  --disable-gio           Disable GIO support],
4948         MOZ_ENABLE_GIO=,
4949         MOZ_ENABLE_GIO=force)
4951     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
4952     then
4953         PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4954                           [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4955         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4956             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4957             MOZ_ENABLE_GIO=1
4958             AC_DEFINE(MOZ_ENABLE_GIO)
4959         ],[
4960             if test "$MOZ_ENABLE_GIO" = "force"
4961             then
4962                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4963             fi
4964             MOZ_ENABLE_GIO=
4965         ])
4966     fi
4968     AC_SUBST(MOZ_ENABLE_GIO)
4969     AC_SUBST(MOZ_GIO_CFLAGS)
4970     AC_SUBST(MOZ_GIO_LIBS)
4972     dnl ========================================================
4973     dnl = GConf support module
4974     dnl ========================================================
4975     MOZ_ARG_DISABLE_BOOL(gconf,
4976     [  --disable-gconf      Disable Gconf support ],
4977         MOZ_ENABLE_GCONF=,
4978         MOZ_ENABLE_GCONF=force)
4980     if test "$MOZ_ENABLE_GCONF"
4981     then
4982         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4983             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4984             MOZ_ENABLE_GCONF=1
4985         ],[
4986             if test "$MOZ_ENABLE_GCONF" = "force"
4987             then
4988                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4989             fi
4990             MOZ_ENABLE_GCONF=
4991         ])
4992     fi
4994     if test "$MOZ_ENABLE_GCONF"; then
4995         AC_DEFINE(MOZ_ENABLE_GCONF)
4996     fi
4998     AC_SUBST(MOZ_ENABLE_GCONF)
4999     AC_SUBST(MOZ_GCONF_CFLAGS)
5000     AC_SUBST(MOZ_GCONF_LIBS)
5003 dnl ========================================================
5004 dnl = libproxy support
5005 dnl ========================================================
5007 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5008 then
5009     MOZ_ENABLE_LIBPROXY=
5011     MOZ_ARG_ENABLE_BOOL(libproxy,
5012     [  --enable-libproxy         Enable libproxy support ],
5013     MOZ_ENABLE_LIBPROXY=1,
5014     MOZ_ENABLE_LIBPROXY=)
5016     if test "$MOZ_ENABLE_LIBPROXY"
5017     then
5018         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5019         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5020     fi
5022 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5023 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5024 AC_SUBST(MOZ_LIBPROXY_LIBS)
5026 dnl ========================================================
5027 dnl = GNOME component (mozgnome)
5028 dnl ========================================================
5030 if test "$MOZ_ENABLE_GTK2"
5031 then
5032     MOZ_ENABLE_GNOME_COMPONENT=1
5034 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5036 dnl ========================================================
5037 dnl = libgnomeui support module
5038 dnl ========================================================
5040 if test "$MOZ_ENABLE_GTK2"
5041 then
5042     MOZ_ARG_ENABLE_BOOL(gnomeui,
5043     [  --enable-gnomeui        Enable libgnomeui instead of GIO & GTK for icon theme support ],
5044         MOZ_ENABLE_GNOMEUI=force,
5045         MOZ_ENABLE_GNOMEUI=)
5047     if test "$MOZ_ENABLE_GNOMEUI"
5048     then
5049         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5050         [
5051             MOZ_ENABLE_GNOMEUI=1
5052         ],[
5053             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5054             then
5055                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5056             fi
5057             MOZ_ENABLE_GNOMEUI=
5058         ])
5059     fi
5061     if test "$MOZ_ENABLE_GNOMEUI"; then
5062         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5063     fi
5066 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5067 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5069 dnl ========================================================
5070 dnl = dbus support
5071 dnl ========================================================
5073 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5074 then
5075     MOZ_ENABLE_DBUS=1
5077     MOZ_ARG_DISABLE_BOOL(dbus,
5078     [  --disable-dbus          Disable dbus support ],
5079         MOZ_ENABLE_DBUS=,
5080         MOZ_ENABLE_DBUS=1)
5082     if test "$MOZ_ENABLE_DBUS"
5083     then
5084         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5085         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5086         AC_DEFINE(MOZ_ENABLE_DBUS)
5087     fi
5089 AC_SUBST(MOZ_ENABLE_DBUS)
5090 AC_SUBST(MOZ_DBUS_CFLAGS)
5091 AC_SUBST(MOZ_DBUS_LIBS)
5092 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5093 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5095 dnl ========================================================
5096 dnl = Enable Android History instead of Places
5097 dnl ========================================================
5098 if test -n "$MOZ_ANDROID_HISTORY"; then
5099     if test -z "$MOZ_PLACES"; then
5100         AC_DEFINE(MOZ_ANDROID_HISTORY)
5101     else
5102         AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
5103     fi
5106 dnl ========================================================
5107 dnl = Build with the Android compositor
5108 dnl ========================================================
5109 if test -n "$MOZ_ANDROID_OMTC"; then
5110      dnl Do this if defined in confvars.sh
5111      AC_DEFINE(MOZ_ANDROID_OMTC)
5114 dnl ========================================================
5115 dnl = Disable WebSMS backend
5116 dnl ========================================================
5117 MOZ_ARG_DISABLE_BOOL(websms-backend,
5118 [  --disable-websms-backend
5119                            Disable WebSMS backend],
5120     MOZ_WEBSMS_BACKEND=,
5121     MOZ_WEBSMS_BACKEND=1)
5123 if test -n "$MOZ_WEBSMS_BACKEND"; then
5124     AC_DEFINE(MOZ_WEBSMS_BACKEND)
5127 dnl ========================================================
5128 dnl = Build Personal Security Manager
5129 dnl ========================================================
5130 MOZ_ARG_DISABLE_BOOL(crypto,
5131 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5132     MOZ_PSM=,
5133     MOZ_PSM=1 )
5135 dnl ========================================================
5136 dnl = JS Debugger XPCOM component (js/jsd)
5137 dnl ========================================================
5138 MOZ_ARG_DISABLE_BOOL(jsd,
5139 [  --disable-jsd           Disable JavaScript debug library],
5140     MOZ_JSDEBUGGER=,
5141     MOZ_JSDEBUGGER=1)
5144 dnl ========================================================
5145 dnl = Enable IPDL's "expensive" unit tests
5146 dnl ========================================================
5147 MOZ_IPDL_TESTS=
5149 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5150 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5151     MOZ_IPDL_TESTS=1,
5152     MOZ_IPDL_TESTS=)
5154 if test -n "$MOZ_IPDL_TESTS"; then
5155     AC_DEFINE(MOZ_IPDL_TESTS)
5158 AC_SUBST(MOZ_IPDL_TESTS)
5160 dnl ========================================================
5161 dnl = Turns off code necessary for e10s compatibility
5162 dnl ========================================================
5163 dnl This is a temporary flag to be removed in bug 662601 when
5164 dnl it's no longer needed
5166 MOZ_E10S_COMPAT=
5168 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5169 [  --enable-e10s-compat     Turns off code for e10s compat],
5170     MOZ_E10S_COMPAT=1,
5171     MOZ_E10S_COMPAT=)
5173 if test -n "$MOZ_E10S_COMPAT"; then
5174     AC_DEFINE(MOZ_E10S_COMPAT)
5177 dnl ========================================================
5178 dnl = Disable building dbm
5179 dnl ========================================================
5180 MOZ_ARG_DISABLE_BOOL(dbm,
5181 [  --disable-dbm           Disable building dbm],
5182     NSS_DISABLE_DBM=1,
5183     NSS_DISABLE_DBM=)
5185 dnl bi-directional support always on
5186 IBMBIDI=1
5187 AC_DEFINE(IBMBIDI)
5189 dnl ========================================================
5190 dnl accessibility support on by default on all platforms
5191 dnl ========================================================
5192 MOZ_ARG_DISABLE_BOOL(accessibility,
5193 [  --disable-accessibility Disable accessibility support],
5194     ACCESSIBILITY=,
5195     ACCESSIBILITY=1 )
5196 if test "$ACCESSIBILITY"; then
5197     case "$target" in
5198     *-mingw*)
5199         if test -z "$MIDL"; then
5200             if test "$GCC" != "yes"; then
5201                 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5202             else
5203                 AC_MSG_ERROR([You have accessibility enabled, but widl could not be found. Add --disable-accessibility to your mozconfig or install widl. See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details.])
5204             fi
5205         fi
5206     esac
5207     AC_DEFINE(ACCESSIBILITY)
5210 dnl ========================================================
5211 dnl Disable printing
5212 dnl ========================================================
5213 MOZ_ARG_DISABLE_BOOL(printing,
5214 [  --disable-printing      Disable printing support],
5215     NS_PRINTING=,
5216     NS_PRINTING=1)
5218 if test "$NS_PRINTING"; then
5219     AC_DEFINE(NS_PRINTING)
5220     AC_DEFINE(NS_PRINT_PREVIEW)
5223 dnl Turn off webrtc for OS's we don't handle yet, but allow 
5224 dnl --enable-webrtc to override.  Can disable for everything in
5225 dnl the master list above.
5226 if test -n "$MOZ_WEBRTC"; then
5227     case "$target" in
5228     *-android*|*-linuxandroid*)
5229         dnl Make sure doesn't get matched by *-linux*
5230         MOZ_WEBRTC=
5231         ;;
5232     *-linux*|*-mingw*|*-darwin*)
5233         dnl Leave enabled
5234         ;;
5235     *)
5236         dnl default to disabled for all others
5237         MOZ_WEBRTC=
5238         ;;
5239     esac
5242 dnl ========================================================
5243 dnl = Disable WebRTC code
5244 dnl ========================================================
5245 MOZ_ARG_DISABLE_BOOL(webrtc,
5246 [  --disable-webrtc        Disable support for WebRTC],
5247     MOZ_WEBRTC=,
5248     MOZ_WEBRTC=1)
5250 if test -n "$MOZ_WEBRTC"; then
5251     AC_DEFINE(MOZ_WEBRTC)
5252     MOZ_MEDIA=1
5253     MOZ_RAW=1
5254     MOZ_VP8=1
5255     MOZ_VP8_ENCODER=1
5256     MOZ_VP8_ERROR_CONCEALMENT=1
5258     dnl OpenSLES is only available in Android 2.3 and later; we'll change this
5259     dnl hard dependency to a dynamic load with graceful runtime failure before
5260     dnl we make --enable-webrtc on by default in Android (bug 815905)
5261     dnl 
5262     if test "$OS_TARGET" = "Android"; then
5263        LDFLAGS="$LDFLAGS -lOpenSLES"
5264     fi
5265     case "$target" in
5266     *-android*|*-linuxandroid*)
5267        LDFLAGS="$LDFLAGS -lOpenSLES"
5268        ;;
5269     esac
5271 dnl enable once Signaling lands
5272     MOZ_WEBRTC_SIGNALING=1
5273     AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5274     if test "${OS_TARGET}" = "WINNT"; then
5275         MOZ_WEBRTC_IN_LIBXUL=1
5276     fi
5277 dnl enable once PeerConnection lands
5278     MOZ_PEERCONNECTION=1
5279     AC_DEFINE(MOZ_PEERCONNECTION)
5280     MOZ_SCTP=1
5281     MOZ_SRTP=1
5282     AC_DEFINE(MOZ_SCTP)
5283     AC_DEFINE(MOZ_SRTP)
5286 AC_SUBST(MOZ_WEBRTC)
5287 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5288 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5289 AC_SUBST(MOZ_PEERCONNECTION)
5290 AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
5291 AC_SUBST(MOZ_SCTP)
5292 AC_SUBST(MOZ_SRTP)
5294 case "$target_cpu" in
5295 arm*)
5296     MOZ_SAMPLE_TYPE_S16=1
5297     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5298     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5301     MOZ_SAMPLE_TYPE_FLOAT32=1
5302     AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5303     AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5305 esac
5307 dnl ========================================================
5308 dnl = Enable Raw Codecs
5309 dnl ========================================================
5310 MOZ_ARG_ENABLE_BOOL(raw,
5311 [  --enable-raw           Enable support for RAW media],
5312     MOZ_RAW=1,
5313     MOZ_RAW=)
5315 if test -n "$MOZ_RAW"; then
5316     AC_DEFINE(MOZ_RAW)
5317     MOZ_MEDIA=1
5320 AC_SUBST(MOZ_RAW)
5322 dnl ========================================================
5323 dnl = Disable Ogg Codecs
5324 dnl ========================================================
5325 MOZ_ARG_DISABLE_BOOL(ogg,
5326 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5327     MOZ_OGG=,
5328     MOZ_OGG=1)
5330 if test -n "$MOZ_OGG"; then
5331     AC_DEFINE(MOZ_OGG)
5332     MOZ_SYDNEYAUDIO=1
5333     MOZ_CUBEB=1
5334     MOZ_MEDIA=1
5336     dnl Checks for __attribute__(aligned()) directive
5337     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5338         [ac_cv_c_attribute_aligned],
5339         [ac_cv_c_attribute_aligned=0
5340          CFLAGS_save="${CFLAGS}"
5341          CFLAGS="${CFLAGS} -Werror"
5342          for ac_cv_c_attr_align_try in 64 32 16 8; do
5343            echo "trying $ac_cv_c_attr_align_try"
5344            AC_TRY_COMPILE([],
5345                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5346                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5347            if test "$ac_cv_c_attribute_aligned" != 0; then
5348              break;
5349            fi
5350          done
5351            CFLAGS="${CFLAGS_save}"])
5352     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5353       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5354                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5355     fi
5358 dnl ========================================================
5359 dnl = Disable Opus audio codec support
5360 dnl ========================================================
5361 MOZ_ARG_DISABLE_BOOL(opus,
5362 [  --disable-opus          Disable support for Opus audio],
5363     MOZ_OPUS=,
5364     MOZ_OPUS=1)
5366 dnl ========================================================
5367 dnl = Disable VP8 decoder support
5368 dnl ========================================================
5369 MOZ_ARG_DISABLE_BOOL(webm,
5370 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5371     MOZ_WEBM=,
5372     MOZ_WEBM=1)
5374 if test -n "$MOZ_WEBM"; then
5375     AC_DEFINE(MOZ_WEBM)
5376     MOZ_VP8=1
5379 dnl ========================================================
5380 dnl = Enable DASH-WebM support
5381 dnl ========================================================
5382 MOZ_ARG_ENABLE_BOOL(dash,
5383 [  --enable-dash          Enable support for DASH-WebM],
5384     MOZ_DASH=1,
5385     MOZ_DASH=)
5387 if test -n "$MOZ_DASH"; then
5388     if test -n "$MOZ_WEBM"; then
5389         AC_DEFINE(MOZ_DASH)
5390     else
5391         dnl Fail if WebM is not enabled as well as DASH.
5392         AC_MSG_ERROR([WebM is currently disabled and must be enabled for DASH
5393                      to work.])
5394     fi
5397 dnl ========================================================
5398 dnl = Enable media plugin support
5399 dnl ========================================================
5400 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5401   dnl Enable support on android by default
5402   MOZ_MEDIA_PLUGINS=1
5405 MOZ_ARG_ENABLE_BOOL(media-plugins,
5406 [  --enable-media-plugins  Enable support for media plugins],
5407     MOZ_MEDIA_PLUGINS=1,
5408     MOZ_MEDIA_PLUGINS=)
5410 if test -n "$MOZ_MEDIA_PLUGINS"; then
5411   AC_DEFINE(MOZ_MEDIA_PLUGINS)
5414 dnl ========================================================
5415 dnl = Enable getUserMedia support
5416 dnl ========================================================
5417 MOZ_ARG_ENABLE_BOOL(media-navigator,
5418 [  --enable-media-navigator  Enable support for getUserMedia],
5419     MOZ_MEDIA_NAVIGATOR=1,
5420     MOZ_MEDIA_NAVIGATOR=)
5422 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5423   AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5426 dnl ========================================================
5427 dnl = Enable building OMX media plugin (B2G or Android)
5428 dnl ========================================================
5429 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5430   dnl Enable support on android by default
5431   MOZ_OMX_PLUGIN=1
5434 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5435 [  --enable-omx-plugin      Enable building OMX plugin (B2G)],
5436     MOZ_OMX_PLUGIN=1,
5437     MOZ_OMX_PLUGIN=)
5439 if test -n "$MOZ_OMX_PLUGIN"; then
5440     if test "$OS_TARGET" = "Android"; then
5441         dnl Only allow building OMX plugin on Gonk (B2G) or Android
5442         AC_DEFINE(MOZ_OMX_PLUGIN)
5443     else
5444        dnl fail if we're not building on Gonk or Android
5445        AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5446     fi
5449 dnl system libvpx Support
5450 dnl ========================================================
5451 MOZ_ARG_WITH_BOOL(system-libvpx,
5452 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
5453     MOZ_NATIVE_LIBVPX=1)
5455 MOZ_LIBVPX_CFLAGS=
5456 MOZ_LIBVPX_LIBS=
5458 if test -n "$MOZ_VP8"; then
5459     AC_DEFINE(MOZ_VP8)
5460     if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5461         AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5462     fi
5463     if test -n "$MOZ_VP8_ENCODER" ; then
5464         AC_DEFINE(MOZ_VP8_ENCODER)
5465     fi
5467     if test -n "$MOZ_NATIVE_LIBVPX"; then
5468         dnl ============================
5469         dnl === libvpx Version check ===
5470         dnl ============================
5471         dnl Check to see if we have a system libvpx package.
5472         PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5474         MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [], 
5475          [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.])])
5477         _SAVE_LIBS=$LIBS
5478         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [], 
5479          [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5480         LIBS=$_SAVE_LIBS
5481     fi
5484 AC_SUBST(MOZ_NATIVE_LIBVPX)
5485 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5486 AC_SUBST(MOZ_LIBVPX_LIBS)
5488 if test "$MOZ_WEBM"; then
5489     MOZ_SYDNEYAUDIO=1
5490     MOZ_CUBEB=1
5491     MOZ_MEDIA=1
5492     if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5493         MOZ_VORBIS=1
5494     else
5495         MOZ_TREMOR=1
5496     fi
5499 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5501     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5502     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5503     dnl We currently require gcc on all arm platforms.
5504     VPX_AS=$YASM
5505     VPX_ASM_SUFFIX=asm
5506     VPX_NEED_OBJ_INT_EXTRACT=
5508     dnl See if we have assembly on this platform.
5509     case "$OS_ARCH:$CPU_ARCH" in
5510     Darwin:x86)
5511       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5512       VPX_X86_ASM=1
5513     ;;
5514     Darwin:x86_64)
5515       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5516       VPX_X86_ASM=1
5517     ;;
5518     WINNT:x86_64)
5519       VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5520       VPX_X86_ASM=1
5521     ;;
5522     WINNT:x86)
5523       dnl Check for yasm 1.1 or greater.
5524       if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5525         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.])
5526       elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5527         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.])
5528       else
5529         VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5530         VPX_X86_ASM=1
5531         dnl The encoder needs obj_int_extract to get asm offsets.
5532       fi
5533     ;;
5534     *:arm*)
5535       if test -n "$GNU_AS" ; then
5536         VPX_AS=$AS
5537         dnl These flags are a lie; they're just used to enable the requisite
5538         dnl opcodes; actual arch detection is done at runtime.
5539         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5540         VPX_DASH_C_FLAG="-c"
5541         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5542         VPX_ASM_SUFFIX="$ASM_SUFFIX"
5543         VPX_ARM_ASM=1
5544       fi
5545     ;;
5546     *:x86)
5547       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5548         VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5549         VPX_X86_ASM=1
5550       fi
5551     ;;
5552     *:x86_64)
5553       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5554         VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5555         VPX_X86_ASM=1
5556       fi
5557     ;;
5558     esac
5560     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5561       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.])
5562     fi
5564     if test -n "$MOZ_VP8_ENCODER" -a \
5565             -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5566       dnl We prefer to get asm offsets using inline assembler, which the above
5567       dnl compilers can do. When we're not using one of those, we have to fall
5568       dnl back to obj_int_extract, which reads them from a compiled object
5569       dnl file. Unfortunately, that only works if we're compiling on a system
5570       dnl with the header files for the appropriate object file format.
5571       VPX_NEED_OBJ_INT_EXTRACT=1
5572     fi
5574     if test -n "$VPX_X86_ASM"; then
5575       AC_DEFINE(VPX_X86_ASM)
5576     elif test -n "$VPX_ARM_ASM"; then
5577       AC_DEFINE(VPX_ARM_ASM)
5578     else
5579       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5580     fi
5583 dnl ========================================================
5584 dnl = Disable Wave decoder support
5585 dnl ========================================================
5586 MOZ_ARG_DISABLE_BOOL(wave,
5587 [  --disable-wave          Disable Wave decoder support],
5588     MOZ_WAVE=,
5589     MOZ_WAVE=1)
5591 if test -n "$MOZ_WAVE"; then
5592     AC_DEFINE(MOZ_WAVE)
5593     MOZ_SYDNEYAUDIO=1
5594     MOZ_CUBEB=1
5595     MOZ_MEDIA=1
5598 dnl ========================================================
5599 dnl = Handle dependent SYDNEYAUDIO, CUBEB, and MEDIA defines
5600 dnl ========================================================
5602 if test -n "$MOZ_SYDNEYAUDIO"; then
5603     AC_DEFINE(MOZ_SYDNEYAUDIO)
5606 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5607     AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5610 if test -n "$MOZ_SOUNDTOUCH"; then
5611     AC_DEFINE(MOZ_SOUNDTOUCH)
5614 if test -n "$MOZ_CUBEB"; then
5615     case "$target" in
5616     *-android*|*-linuxandroid*)
5617         if test -n "$gonkdir"; then
5618             AC_DEFINE(MOZ_CUBEB)
5619         fi
5620         dnl No Android implementation of libcubeb yet.
5621         ;;
5622     *-linux*)
5623         AC_DEFINE(MOZ_CUBEB)
5624         ;;
5625     *-mingw*)
5626         AC_DEFINE(MOZ_CUBEB)
5627         ;;
5628     *-darwin*)
5629         AC_DEFINE(MOZ_CUBEB)
5630         ;;
5631     *-openbsd*)
5632         AC_DEFINE(MOZ_CUBEB)
5633         ;;
5634     *)
5635         dnl Other targets will be enabled soon.
5636         ;;
5637     esac
5640 if test -n "$MOZ_MEDIA"; then
5641     AC_DEFINE(MOZ_MEDIA)
5644 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5645     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/])
5648 if test -n "$MOZ_VORBIS"; then
5649     AC_DEFINE(MOZ_VORBIS)
5652 if test -n "$MOZ_TREMOR"; then
5653     AC_DEFINE(MOZ_TREMOR)
5656 if test -n "$MOZ_OPUS"; then
5657     AC_DEFINE(MOZ_OPUS)
5660 dnl ========================================================
5661 dnl = Check alsa availability on Linux if using sydneyaudio
5662 dnl ========================================================
5664 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5665 if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
5666     MOZ_ALSA=1
5669 MOZ_ARG_ENABLE_BOOL(alsa,
5670 [  --enable-alsa          Enable Alsa support (default on Linux)],
5671 MOZ_ALSA=1,
5672 MOZ_ALSA=)
5674 if test -n "$MOZ_ALSA"; then
5675     AC_DEFINE(MOZ_CUBEB)
5676     PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5677          [echo "$MOZ_ALSA_PKG_ERRORS"
5678           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.)])])
5681 AC_SUBST(MOZ_ALSA)
5682 AC_SUBST(MOZ_ALSA_CFLAGS)
5683 AC_SUBST(MOZ_ALSA_LIBS)
5685 dnl ========================================================
5686 dnl = Enable PulseAudio
5687 dnl ========================================================
5689 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5690 [  --enable-pulseaudio          Enable PulseAudio support (experimental)],
5691 MOZ_PULSEAUDIO=1,
5692 MOZ_PULSEAUDIO=)
5694 if test -n "$MOZ_PULSEAUDIO"; then
5695     AC_DEFINE(MOZ_CUBEB)
5696     PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5697          [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5698           AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
5701 AC_SUBST(MOZ_PULSEAUDIO)
5702 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5703 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5705 dnl ========================================================
5706 dnl = Enable GStreamer
5707 dnl ========================================================
5708 MOZ_ARG_ENABLE_BOOL(gstreamer,
5709 [  --enable-gstreamer           Enable GStreamer support],
5710 MOZ_GSTREAMER=1,
5711 MOZ_GSTREAMER=)
5713 if test "$MOZ_GSTREAMER"; then
5714     # API version, eg 0.10, 1.0 etc
5715     GST_API_VERSION=0.10
5716     # core/base release number
5717     # depend on >= 0.10.33 as that's when the playbin2 source-setup signal was
5718     # introduced
5719     GST_VERSION=0.10.33
5720     PKG_CHECK_MODULES(GSTREAMER,
5721                       gstreamer-$GST_API_VERSION >= $GST_VERSION
5722                       gstreamer-app-$GST_API_VERSION
5723                       gstreamer-plugins-base-$GST_API_VERSION)
5724     if test -n "$GSTREAMER_LIBS"; then
5725        _SAVE_LDFLAGS=$LDFLAGS
5726        LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5727        AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5728        if test -n "$_HAVE_LIBGSTVIDEO" ; then
5729           GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5730        else
5731           AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
5732        fi
5733        LDFLAGS=$_SAVE_LDFLAGS
5734     else
5735        AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
5736     fi
5738 AC_SUBST(GSTREAMER_CFLAGS)
5739 AC_SUBST(GSTREAMER_LIBS)
5740 AC_SUBST(MOZ_GSTREAMER)
5742 if test -n "$MOZ_GSTREAMER"; then
5743    AC_DEFINE(MOZ_GSTREAMER)
5744    MOZ_MEDIA=1
5748 dnl ========================================================
5749 dnl Permissions System
5750 dnl ========================================================
5751 MOZ_ARG_DISABLE_BOOL(permissions,
5752 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5753     MOZ_PERMISSIONS=,
5754     MOZ_PERMISSIONS=1
5757 dnl ========================================================
5758 dnl NegotiateAuth
5759 dnl ========================================================
5760 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5761 [  --disable-negotiateauth Disable GSS-API negotiation ],
5762     MOZ_AUTH_EXTENSION=,
5763     MOZ_AUTH_EXTENSION=1 )
5765 dnl ========================================================
5766 dnl Pref extensions (autoconfig)
5767 dnl ========================================================
5768 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5769 [  --disable-pref-extensions
5770                           Disable pref extensions such as autoconfig],
5771   MOZ_PREF_EXTENSIONS=,
5772   MOZ_PREF_EXTENSIONS=1 )
5774 dnl ========================================================
5775 dnl Searching of system directories for extensions.
5776 dnl Note: this switch is meant to be used for test builds
5777 dnl whose behavior should not depend on what happens to be
5778 dnl installed on the local machine.
5779 dnl ========================================================
5780 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5781 [  --disable-system-extension-dirs
5782                           Disable searching system- and account-global
5783                           directories for extensions of any kind; use
5784                           only profile-specific extension directories],
5785   ENABLE_SYSTEM_EXTENSION_DIRS=,
5786   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5787 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5788   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5791 dnl ========================================================
5792 dnl = Universalchardet
5793 dnl ========================================================
5794 MOZ_ARG_DISABLE_BOOL(universalchardet,
5795 [  --disable-universalchardet
5796                           Disable universal encoding detection],
5797   MOZ_UNIVERSALCHARDET=,
5798   MOZ_UNIVERSALCHARDET=1 )
5800 if test -n "${JAVA_BIN_PATH}"; then
5801   dnl Look for javac and jar in the specified path.
5802   JAVA_PATH="$JAVA_BIN_PATH"
5803 else
5804   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5805   JAVA_PATH="$JAVA_HOME/bin:$PATH"
5808 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5809 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5810 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5812 if test -n "${JAVA_BIN_PATH}" -o \
5813   \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5814   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5815     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}])
5816   fi
5819 dnl ========================================================
5820 dnl = ANGLE OpenGL->D3D translator for WebGL
5821 dnl = * only applies to win32
5822 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5823 dnl ========================================================
5824 MOZ_ANGLE_RENDERER=
5825 MOZ_DIRECTX_SDK_PATH=
5826 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5827 MOZ_D3DX9_VERSION=
5828 MOZ_D3DX9_CAB=
5829 MOZ_D3DCOMPILER_CAB=
5830 MOZ_D3DX9_DLL=
5831 MOZ_D3DCOMPILER_DLL=
5832 case "$target_os" in
5833 *mingw*)
5834     MOZ_ANGLE_RENDERER=1
5835     ;;
5836 esac
5838 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5839 case "${target_cpu}" in
5840 i*86)
5841   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5842   ;;
5843 x86_64)
5844   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5845   ;;
5846 esac
5848 MOZ_ARG_DISABLE_BOOL(webgl,
5849 [  --disable-webgl     Disable building of the WebGL implementation],
5850     MOZ_WEBGL_DISABLED=1,
5851     MOZ_WEBGL_DISABLED=)
5853 if test -n "$MOZ_WEBGL_DISABLED"; then
5854   MOZ_WEBGL=
5855   MOZ_ANGLE_RENDERER=
5858 if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
5859   # Get the SDK path from the registry.
5860   # First try to get the June 2010 SDK
5861   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5862   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5863     # Otherwise just take whatever comes first
5864     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5865   fi
5867   if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5868     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.])
5869   else
5870     MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/' | sed 's,\\\\,/,g'`
5871   fi
5873   if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5874      test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5875          test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5876     AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5877   else
5878     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.])
5879   fi
5881   # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5882   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'`
5884   if test -z "$MOZ_D3DX9_VERSION" ; then
5885         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.])
5886   fi
5888   MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5889   MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5891   if test -z "$MOZ_D3DX9_CAB" -o -z "$MOZ_D3DCOMPILER_CAB"; then
5892     AC_MSG_ERROR([Couldn't find the DirectX redistributable files. Either reinstall the DirectX SDK (making sure the "DirectX Redistributable Files" option is selected), or reconfigure with --disable-webgl.])
5893   fi
5895   MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
5896   MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5899 dnl ========================================================
5900 dnl = Breakpad crash reporting (on by default on supported platforms)
5901 dnl ========================================================
5903 case $target in
5904 i?86-*-mingw*|x86_64-*-mingw*)
5905   MOZ_CRASHREPORTER=1
5906   ;;
5907 i?86-apple-darwin*|x86_64-apple-darwin*)
5908   MOZ_CRASHREPORTER=1
5909   ;;
5910 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5911   if test "$MOZ_ENABLE_GTK2"; then
5912     MOZ_CRASHREPORTER=1
5913   fi
5914   ;;
5915 *-android*|*-linuxandroid*)
5916   MOZ_CRASHREPORTER=1
5917   ;;
5918 *solaris*)
5919   MOZ_CRASHREPORTER=1
5920   ;;
5921 esac
5923 MOZ_ARG_DISABLE_BOOL(crashreporter,
5924 [  --disable-crashreporter Disable breakpad crash reporting],
5925     MOZ_CRASHREPORTER=,
5926     MOZ_CRASHREPORTER=1)
5928 if test -n "$MOZ_CRASHREPORTER"; then
5929    AC_DEFINE(MOZ_CRASHREPORTER)
5931   if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5932     test -z "$SKIP_LIBRARY_CHECKS"; then
5933     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5934     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5935     AC_SUBST(MOZ_GTHREAD_LIBS)
5937     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.])])
5938   fi
5940   if test "$OS_ARCH" != "$HOST_OS_ARCH"; then
5941     AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.  Use --disable-crashreporter.])
5942   fi
5944   if test "$OS_ARCH" = "WINNT" -a -z "$HAVE_64BIT_OS"; then
5945     MOZ_CRASHREPORTER_INJECTOR=1
5946     AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5947   fi
5950 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5951 [  --with-crashreporter-enable-percent=NN
5952                           Enable sending crash reports by default on NN% of users. (default=100)],
5953 [ val=`echo $withval | sed 's/[^0-9]//g'`
5954     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5956 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5957    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5959 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5961 dnl ========================================================
5962 dnl = libjpeg-turbo configuration
5963 dnl ========================================================
5964 MOZ_LIBJPEG_TURBO=
5965 if test -z "$MOZ_NATIVE_JPEG"; then
5966     MOZ_LIBJPEG_TURBO=1
5969 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5970 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
5971     MOZ_LIBJPEG_TURBO=,
5972     MOZ_LIBJPEG_TURBO=1)
5974 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
5975     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
5978 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
5979 dnl files.
5981 if test -n "$MOZ_LIBJPEG_TURBO"; then
5983   dnl Do we support libjpeg-turbo on this platform?
5984   case "$OS_ARCH:$OS_TEST" in
5985   Darwin:i?86)
5986     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
5987     LIBJPEG_TURBO_X86_ASM=1
5988   ;;
5989   Darwin:x86_64)
5990     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
5991     LIBJPEG_TURBO_X64_ASM=1
5992   ;;
5993   WINNT:x86|WINNT:i?86)
5994     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
5995     LIBJPEG_TURBO_X86_ASM=1
5996   ;;
5997   WINNT:x86_64)
5998     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
5999     LIBJPEG_TURBO_X64_ASM=1
6000   ;;
6001   *:arm*)
6002     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6003     LIBJPEG_TURBO_ARM_ASM=1
6004   ;;
6005   *:x86|*:i?86)
6006     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6007       LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6008       LIBJPEG_TURBO_X86_ASM=1
6009     fi
6010   ;;
6011   *:x86_64)
6012     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6013       LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6014       LIBJPEG_TURBO_X64_ASM=1
6015     fi
6016   ;;
6017   esac
6021 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6022 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6023 dnl it doesn't exist or we have too old of a version.
6024 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6025     AC_MSG_CHECKING([for Yasm assembler])
6026     AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
6028     if test -z "$LIBJPEG_TURBO_AS" ; then
6029         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.])
6030     fi
6032     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
6033     dnl on Linux and 1.1 or newer everywhere else.
6034     if test "$OS_ARCH" = "Linux" ; then
6035         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
6036             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.])
6037         fi
6038     else
6039         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6040             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.])
6041         fi
6042     fi
6045 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6046 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6047 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6048     echo "Using $AS as the assembler for ARM code."
6049     LIBJPEG_TURBO_AS=$AS
6052 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6053     AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6054 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6055     AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6056 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6057     AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6058 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6059     dnl Warn if we're not building the optimized routines, even though the user
6060     dnl didn't specify --disable-libjpeg-turbo.
6061     AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
6064 dnl ========================================================
6065 dnl = Enable compilation of specific extension modules
6066 dnl ========================================================
6068 MOZ_ARG_ENABLE_STRING(extensions,
6069 [  --enable-extensions     Enable extensions],
6070 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6071     if test "$option" = "yes" -o "$option" = "all"; then
6072         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6073     elif test "$option" = "no" -o "$option" = "none"; then
6074         MOZ_EXTENSIONS=""
6075     elif test "$option" = "default"; then
6076         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6077     elif test `echo "$option" | grep -c \^-` != 0; then
6078         option=`echo $option | sed 's/^-//'`
6079         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6080     else
6081         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6082     fi
6083 done],
6084     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6086 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6087     # Suppress warning on non-X11 platforms
6088     if test -n "$MOZ_X11"; then
6089         AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6090     fi
6091     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6094 dnl Do not build gnomevfs with libxul based apps
6095 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6096     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6099 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6100     # Suppress warning on non-X11 platforms
6101     if test -n "$MOZ_X11"; then
6102         AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6103     fi
6104     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6107 dnl Do not build gio with libxul based apps
6108 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6109     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6112 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6113     MOZ_GIO_COMPONENT=1
6114     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6116 AC_SUBST(MOZ_GIO_COMPONENT)
6118 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6119     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6120     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6123 dnl Remove dupes
6124 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6126 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6127 dnl when trying to build a nonexistent extension.
6128 for extension in $MOZ_EXTENSIONS; do
6129     if test ! -d "${srcdir}/extensions/${extension}"; then
6130         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6131     fi
6132 done
6134 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6135   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6138 dnl ========================================================
6139 dnl CSS3 Flexbox Support
6140 dnl ========================================================
6141 if test -n "$MOZ_FLEXBOX"; then
6142   AC_DEFINE(MOZ_FLEXBOX)
6145 dnl ========================================================
6146 dnl Build Freetype in the tree
6147 dnl ========================================================
6148 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6149 [  --enable-tree-freetype  Enable Tree FreeType],
6150     MOZ_TREE_FREETYPE=1,
6151     MOZ_TREE_FREETYPE= )
6152 if test -n "$MOZ_TREE_FREETYPE"; then
6153    if test -n "$_WIN32_MSVC"; then
6154       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6155    fi
6156    AC_DEFINE(MOZ_TREE_FREETYPE)
6157    AC_SUBST(MOZ_TREE_FREETYPE)
6158    MOZ_ENABLE_CAIRO_FT=1
6159    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6160    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6161    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6162    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6163    CAIRO_FT_OSLIBS=''
6164    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6165    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6166    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6167    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6168    AC_SUBST(CAIRO_FT_CFLAGS)
6171 dnl ========================================================
6172 dnl Installer
6173 dnl ========================================================
6174 dnl Abort Windows build if the required major version and
6175 dnl minimum minor version of Unicode NSIS isn't in the path
6176 dnl (unless in case of cross compiling, for which Unicode
6177 dnl is not yet sufficient).
6178 if test "$OS_ARCH" = "WINNT"; then
6179     REQ_NSIS_MAJOR_VER=2
6180     MIN_NSIS_MINOR_VER=33
6181     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6182     if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6183       AC_MSG_RESULT([yes])
6184       changequote(,)
6185       MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6186       changequote([,])
6187       if test ! "$MAKENSISU_VER" = ""; then
6188           MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6189           MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6190       fi
6191       AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6192       if test "$MAKENSISU_VER" = "" || \
6193          test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6194               ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6195           AC_MSG_RESULT([no])
6196           if test -z "$CROSS_COMPILE"; then
6197             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.])
6198           else
6199             MAKENSISU=
6200           fi
6201       fi
6202     elif test -z "$CROSS_COMPILE"; then
6203       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.])
6204     else
6205       MAKENSISU=
6206     fi
6209 dnl ========================================================
6210 dnl Web App Runtime
6211 dnl ========================================================
6212 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6213 [  --disable-webapp-runtime  Disable Web App Runtime],
6214     MOZ_WEBAPP_RUNTIME=,
6215     MOZ_WEBAPP_RUNTIME=1)
6216 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6217     MOZ_WEBAPP_RUNTIME=
6219 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6220     MOZ_WEBAPP_RUNTIME=
6222 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6223 if test "$MOZ_WEBAPP_RUNTIME"; then
6224     AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6227 AC_MSG_CHECKING([for tar archiver])
6228 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6229 if test -z "$TAR"; then
6230     AC_MSG_ERROR([no tar archiver found in \$PATH])
6232 AC_MSG_RESULT([$TAR])
6233 AC_SUBST(TAR)
6235 AC_MSG_CHECKING([for wget])
6236 AC_CHECK_PROGS(WGET, wget, "")
6237 AC_MSG_RESULT([$WGET])
6238 AC_SUBST(WGET)
6240 dnl ========================================================
6241 dnl Signing
6242 dnl ========================================================
6244 if test -n "$MOZ_SIGN_CMD"; then
6245     AC_DEFINE(MOZ_SIGNING)
6248 dnl ========================================================
6249 dnl Maintenance Service
6250 dnl ========================================================
6252 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6253 [  --enable-maintenance-service       Enable building of maintenanceservice],
6254     MOZ_MAINTENANCE_SERVICE=1,
6255     MOZ_MAINTENANCE_SERVICE= )
6257 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6258   if test "$OS_ARCH" = "WINNT"; then
6259     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6260   else
6261     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6262   fi
6265 dnl ========================================================
6266 dnl Verify MAR signatures
6267 dnl ========================================================
6269 MOZ_ARG_ENABLE_BOOL(verify-mar,
6270 [  --enable-verify-mar     Enable verifying MAR signatures],
6271     MOZ_VERIFY_MAR_SIGNATURE=1,
6272     MOZ_VERIFY_MAR_SIGNATURE= )
6274 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6275   if test "$OS_ARCH" = "WINNT"; then
6276     AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6277   else
6278     AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6279   fi
6282 dnl ========================================================
6283 dnl Enable building the signmar program.
6284 dnl This option is much different than the --enable-verify-mar option.
6285 dnl --enable-verify-mar is for enabling the verification check on MAR
6286 dnl files in the updater.  The --enable-signmar option is for building
6287 dnl the signmar program.
6288 dnl ========================================================
6290 MOZ_ARG_ENABLE_BOOL(signmar,
6291 [  --enable-signmar     Enable building the signmar program],
6292     MOZ_ENABLE_SIGNMAR=1,
6293     MOZ_ENABLE_SIGNMAR= )
6295 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6296   AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6299 dnl ========================================================
6300 dnl Updater
6301 dnl ========================================================
6303 MOZ_ARG_DISABLE_BOOL(updater,
6304 [  --disable-updater       Disable building of updater],
6305     MOZ_UPDATER=,
6306     MOZ_UPDATER=1 )
6308 if test -n "$MOZ_UPDATER"; then
6309     AC_DEFINE(MOZ_UPDATER)
6312 # app update channel is 'default' when not supplied.
6313 MOZ_ARG_ENABLE_STRING([update-channel],
6314 [  --enable-update-channel=CHANNEL
6315                           Select application update channel (default=default)],
6316     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6318 if test -z "$MOZ_UPDATE_CHANNEL"; then
6319     MOZ_UPDATE_CHANNEL=default
6321 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6322 AC_SUBST(MOZ_UPDATE_CHANNEL)
6324 # tools/update-packaging is not checked out by default.
6325 MOZ_ARG_ENABLE_BOOL(update-packaging,
6326 [  --enable-update-packaging
6327                           Enable tools/update-packaging],
6328     MOZ_UPDATE_PACKAGING=1,
6329     MOZ_UPDATE_PACKAGING= )
6330 AC_SUBST(MOZ_UPDATE_PACKAGING)
6332 dnl ========================================================
6333 dnl build the tests by default
6334 dnl ========================================================
6335 MOZ_ARG_DISABLE_BOOL(tests,
6336 [  --disable-tests         Do not build test libraries & programs],
6337     ENABLE_TESTS=,
6338     ENABLE_TESTS=1 )
6340 dnl ========================================================
6341 dnl parental controls (for Windows Vista)
6342 dnl ========================================================
6343 MOZ_ARG_DISABLE_BOOL(parental-controls,
6344 [  --disable-parental-controls
6345                           Do not build parental controls],
6346    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6347    MOZ_DISABLE_PARENTAL_CONTROLS=)
6348 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6349     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6352 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6354 dnl ========================================================
6355 dnl = Disable DOMCrypto
6356 dnl ========================================================
6357 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6358     AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6361 dnl ========================================================
6362 dnl =
6363 dnl = Module specific options
6364 dnl =
6365 dnl ========================================================
6366 MOZ_ARG_HEADER(Individual module options)
6368 dnl ========================================================
6369 dnl = Disable feed handling components
6370 dnl ========================================================
6371 MOZ_ARG_DISABLE_BOOL(feeds,
6372 [  --disable-feeds         Disable feed handling and processing components],
6373     MOZ_FEEDS=,
6374     MOZ_FEEDS=1 )
6375 if test -n "$MOZ_FEEDS"; then
6376     AC_DEFINE(MOZ_FEEDS)
6377 else
6378     if test "$MOZ_BUILD_APP" = "browser"; then
6379         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6380     fi
6383 dnl ========================================================
6384 dnl Check for sqlite
6385 dnl ========================================================
6387 MOZ_NATIVE_SQLITE=
6388 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6389 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6390 MOZ_NATIVE_SQLITE=1,
6391 MOZ_NATIVE_SQLITE= )
6393 if test -z "$MOZ_NATIVE_SQLITE"
6394 then
6395     SQLITE_CFLAGS=
6396     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6397 else
6398     dnl ============================
6399     dnl === SQLite Version check ===
6400     dnl ============================
6401     dnl Check to see if the system SQLite package is new enough.
6402     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6404     dnl ==================================
6405     dnl === SQLITE_SECURE_DELETE check ===
6406     dnl ==================================
6407     dnl Check to see if the system SQLite package is compiled with
6408     dnl SQLITE_SECURE_DELETE enabled.
6409     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6410     _SAVE_CFLAGS="$CFLAGS"
6411     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6412     _SAVE_LIBS="$LIBS"
6413     LIBS="$LIBS $SQLITE_LIBS"
6414     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6415         AC_TRY_RUN([
6416             #include "sqlite3.h"
6418             int main(int argc, char **argv){
6419               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6420             }],
6421             ac_cv_sqlite_secure_delete=yes,
6422             ac_cv_sqlite_secure_delete=no,
6423             ac_cv_sqlite_secure_delete=no
6424         )
6425     ])
6426     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6427     CFLAGS="$_SAVE_CFLAGS"
6428     LIBS="$_SAVE_LIBS"
6429     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6430         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6431     fi
6433     dnl ===============================
6434     dnl === SQLITE_THREADSAFE check ===
6435     dnl ===============================
6436     dnl Check to see if the system SQLite package is compiled with
6437     dnl SQLITE_THREADSAFE enabled.
6438     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6439     _SAVE_CFLAGS="$CFLAGS"
6440     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6441     _SAVE_LIBS="$LIBS"
6442     LIBS="$LIBS $SQLITE_LIBS"
6443     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6444         AC_TRY_RUN([
6445             #include "sqlite3.h"
6447             int main(int argc, char **argv){
6448               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6449             }],
6450             ac_cv_sqlite_threadsafe=yes,
6451             ac_cv_sqlite_threadsafe=no,
6452             ac_cv_sqlite_threadsafe=no
6453         )
6454     ])
6455     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6456     CFLAGS="$_SAVE_CFLAGS"
6457     LIBS="$_SAVE_LIBS"
6458     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6459         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6460     fi
6462     dnl ================================
6463     dnl === SQLITE_ENABLE_FTS3 check ===
6464     dnl ================================
6465     dnl check to see if the system SQLite package is compiled with
6466     dnl SQLITE_ENABLE_FTS3 enabled.
6467     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6468     _SAVE_CFLAGS="$CFLAGS"
6469     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6470     _SAVE_LIBS="$LIBS"
6471     LIBS="$LIBS $SQLITE_LIBS"
6472     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6473         AC_TRY_RUN([
6474             #include "sqlite3.h"
6476             int main(int argc, char **argv){
6477               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6478             }],
6479             ac_cv_sqlite_enable_fts3=yes,
6480             ac_cv_sqlite_enable_fts3=no,
6481             ac_cv_sqlite_enable_fts3=no
6482         )
6483     ])
6484     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6485     CFLAGS="$_SAVE_CFLAGS"
6486     LIBS="$_SAVE_LIBS"
6487     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6488         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6489     fi
6491     dnl =========================================
6492     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6493     dnl =========================================
6494     dnl check to see if the system SQLite package is compiled with
6495     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6496     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6497     _SAVE_CFLAGS="$CFLAGS"
6498     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6499     _SAVE_LIBS="$LIBS"
6500     LIBS="$LIBS $SQLITE_LIBS"
6501     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6502         AC_TRY_RUN([
6503             #include "sqlite3.h"
6505             int main(int argc, char **argv){
6506               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6507             }],
6508             ac_cv_sqlite_enable_unlock_notify=yes,
6509             ac_cv_sqlite_enable_unlock_notify=no,
6510             ac_cv_sqlite_enable_unlock_notify=no
6511         )
6512     ])
6513     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6514     CFLAGS="$_SAVE_CFLAGS"
6515     LIBS="$_SAVE_LIBS"
6516     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6517         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6518     fi
6521 if test -n "$MOZ_NATIVE_SQLITE"; then
6522     AC_DEFINE(MOZ_NATIVE_SQLITE)
6524 AC_SUBST(MOZ_NATIVE_SQLITE)
6526 dnl ========================================================
6527 dnl = Enable help viewer (off by default)
6528 dnl ========================================================
6529 if test -n "$MOZ_HELP_VIEWER"; then
6530      dnl Do this if defined in confvars.sh
6531      AC_DEFINE(MOZ_HELP_VIEWER)
6534 dnl ========================================================
6535 dnl = Enable safe browsing (anti-phishing)
6536 dnl ========================================================
6537 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6538 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6539     MOZ_SAFE_BROWSING=1,
6540     MOZ_SAFE_BROWSING= )
6541 if test -n "$MOZ_SAFE_BROWSING"; then
6542     AC_DEFINE(MOZ_SAFE_BROWSING)
6544 AC_SUBST(MOZ_SAFE_BROWSING)
6546 dnl ========================================================
6547 dnl = Enable url-classifier
6548 dnl ========================================================
6549 dnl Implicitly enabled by default if building with safe-browsing
6550 if test -n "$MOZ_SAFE_BROWSING"; then
6551     MOZ_URL_CLASSIFIER=1
6553 MOZ_ARG_ENABLE_BOOL(url-classifier,
6554 [  --enable-url-classifier Enable url classifier module],
6555     MOZ_URL_CLASSIFIER=1,
6556     MOZ_URL_CLASSIFIER= )
6557 if test -n "$MOZ_URL_CLASSIFIER"; then
6558     AC_DEFINE(MOZ_URL_CLASSIFIER)
6560 AC_SUBST(MOZ_URL_CLASSIFIER)
6562 dnl ========================================================
6563 dnl = Disable zipwriter
6564 dnl ========================================================
6565 MOZ_ARG_DISABLE_BOOL(zipwriter,
6566 [  --disable-zipwriter     Disable zipwriter component],
6567     MOZ_ZIPWRITER=,
6568     MOZ_ZIPWRITER=1 )
6569 AC_SUBST(MOZ_ZIPWRITER)
6571 dnl ========================================================
6572 dnl = libconic
6573 dnl ========================================================
6574 dnl superseded by QtNetwork starting from 4.7
6575 MOZ_ENABLE_LIBCONIC=1
6577 if test -n "$MOZ_ENABLE_QT"; then
6578   if test "$MOZ_ENABLE_QTNETWORK"; then
6579     MOZ_ENABLE_LIBCONIC=
6580   fi
6583 MOZ_ARG_DISABLE_BOOL(libconic,
6584 [  --disable-libconic      Disable libconic],
6585     MOZ_ENABLE_LIBCONIC=,
6586     MOZ_ENABLE_LIBCONIC=1 )
6588 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6589     PKG_CHECK_MODULES(LIBCONIC, conic,
6590                       MOZ_ENABLE_LIBCONIC=1,
6591                       MOZ_ENABLE_LIBCONIC=)
6593 if test "$MOZ_ENABLE_LIBCONIC"; then
6594     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6597 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6598 AC_SUBST(LIBCONIC_CFLAGS)
6599 AC_SUBST(LIBCONIC_LIBS)
6601 dnl ========================================================
6602 dnl = Maemo checks
6603 dnl ========================================================
6605 MAEMO_SDK_TARGET_VER=-1
6607 MOZ_ARG_WITH_STRING(maemo-version,
6608 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6609                           Maemo SDK Version],
6610   MAEMO_SDK_TARGET_VER=$withval)
6612 case "$MAEMO_SDK_TARGET_VER" in
6614     MOZ_PLATFORM_MAEMO=5
6615     ;;
6618     MOZ_PLATFORM_MAEMO=6
6619     ;;
6622     dnl We aren't compiling for Maemo, move on.
6623     ;;
6625     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6626     ;;
6627 esac
6629 if test $MOZ_PLATFORM_MAEMO; then
6630    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6632    if test -z "$MOZ_ENABLE_DBUS"; then
6633        AC_MSG_ERROR([DBus is required when building for Maemo])
6634    fi
6636    MOZ_GFX_OPTIMIZE_MOBILE=1
6637    MOZ_GL_DEFAULT_PROVIDER=EGL
6638    MOZ_MAEMO_LIBLOCATION=
6640    if test $MOZ_PLATFORM_MAEMO = 5; then
6641       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6642       MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6643           [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6644       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6645                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6647       AC_SUBST(XCOMPOSITE_LIBS)
6649       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6650       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6651       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6652       if test -z "$_LIB_FOUND"; then
6653          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6654       fi
6657       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6658       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6659       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6660       if test -z "$_LIB_FOUND"; then
6661          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6662       fi
6664       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6665       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6666       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6667       if test -z "$_LIB_FOUND"; then
6668          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6669       fi
6671    fi
6672    if test $MOZ_PLATFORM_MAEMO = 6; then
6674       PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6675                         _LIB_FOUND=1,
6676                         _LIB_FOUND=)
6677       if test "$_LIB_FOUND"; then
6678          MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6679          MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6680          MOZ_ENABLE_CONTENTMANAGER=1
6681          AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6682       else
6683          AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6684       fi
6685       AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6687       dnl ========================================================
6688       dnl = Enable meego libcontentaction
6689       dnl ========================================================
6690       MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6691       [  --enable-meegocontentaction           Enable meegocontentaction support],
6692          MOZ_MEEGOCONTENTACTION=1,
6693          MOZ_MEEGOCONTENTACTION=)
6695       if test -n "$MOZ_MEEGOCONTENTACTION"; then
6697          PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6698          if test "$_LIB_FOUND"; then
6699             MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6700             MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6701             MOZ_ENABLE_CONTENTACTION=1
6702             AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6703             AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6704          fi
6705       fi
6707       MOZ_ARG_ENABLE_BOOL(meegotouch,
6708       [  --enable-meegotouch  Enable meegotouch support],
6709          MOZ_MEEGOTOUCHENABLED=1,
6710          MOZ_MEEGOTOUCHENABLED=)
6712       if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6713           PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6714           if test "$_LIB_FOUND"; then
6715               MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6716               MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6717               AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6718           else
6719               AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6720           fi
6721       fi
6722    fi
6724    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6725    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6726    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6727    if test "$_LIB_FOUND"; then
6728       MOZ_MAEMO_LIBLOCATION=1
6729       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6730    else
6731       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6732    fi
6733    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6735    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6736    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6737    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6738    if test "$_LIB_FOUND"; then
6739       MOZ_ENABLE_MEEGOTOUCHSHARE=1
6740       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6741    else
6742       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6743    fi
6744    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6746    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6747    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6750 dnl ========================================================
6751 dnl GL provider
6752 dnl ========================================================
6753 MOZ_GL_PROVIDER=
6754 MOZ_ARG_WITH_STRING(gl-provider,
6755 [  --with-gl-provider=ID
6756                           Set GL provider backend type],
6757 [ val=`echo $withval`
6758     MOZ_GL_PROVIDER="$val"])
6760 if test -n "$MOZ_GL_PROVIDER"; then
6761 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6762 AC_SUBST(MOZ_GL_PROVIDER)
6763 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6765 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6766 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6768 dnl ========================================================
6769 dnl = faststripe theme
6770 dnl ========================================================
6771 MOZ_ARG_ENABLE_BOOL(faststripe,
6772 [  --enable-faststripe     Use faststripe theme],
6773     MOZ_THEME_FASTSTRIPE=1,
6774     MOZ_THEME_FASTSTRIPE= )
6775 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6777 dnl ========================================================
6778 dnl =
6779 dnl = Feature options that require extra sources to be pulled
6780 dnl =
6781 dnl ========================================================
6782 dnl MOZ_ARG_HEADER(Features that require extra sources)
6784 dnl ========================================================
6785 dnl =
6786 dnl = Debugging Options
6787 dnl =
6788 dnl ========================================================
6789 MOZ_ARG_HEADER(Debugging and Optimizations)
6791 dnl ========================================================
6792 dnl = Disable building with debug info.
6793 dnl = Debugging is OFF by default
6794 dnl ========================================================
6795 if test -z "$MOZ_DEBUG_FLAGS"; then
6796   MOZ_DEBUG_FLAGS="-g"
6799 MOZ_ARG_ENABLE_STRING(debug,
6800 [  --enable-debug[=DBG]    Enable building with developer debug info
6801                            (using compiler flags DBG)],
6802 [ if test "$enableval" != "no"; then
6803     MOZ_DEBUG=1
6804     if test -n "$enableval" -a "$enableval" != "yes"; then
6805         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6806         _MOZ_DEBUG_FLAGS_SET=1
6807     fi
6808   else
6809     MOZ_DEBUG=
6810   fi ],
6811   MOZ_DEBUG=)
6813 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6814 MOZ_ARG_WITH_STRING(debug-label,
6815 [  --with-debug-label=LABELS
6816                           Define DEBUG_<value> for each comma-separated
6817                           value given.],
6818 [ for option in `echo $withval | sed 's/,/ /g'`; do
6819     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6820 done])
6822 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6824 if test -n "$MOZ_DEBUG"; then
6825     AC_MSG_CHECKING([for valid debug flags])
6826     _SAVE_CFLAGS=$CFLAGS
6827     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6828     AC_TRY_COMPILE([#include <stdio.h>],
6829         [printf("Hello World\n");],
6830         _results=yes,
6831         _results=no)
6832     AC_MSG_RESULT([$_results])
6833     if test "$_results" = "no"; then
6834         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6835     fi
6836     CFLAGS=$_SAVE_CFLAGS
6839 dnl ========================================================
6840 dnl enable mobile optimizations
6841 dnl ========================================================
6842 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6843 [  --enable-mobile-optimize
6844                           Enable mobile optimizations],
6845     MOZ_GFX_OPTIMIZE_MOBILE=1)
6847 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6849 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6850     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6853 dnl ========================================================
6854 dnl = Enable code optimization. ON by default.
6855 dnl ========================================================
6856 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6857         MOZ_OPTIMIZE_FLAGS="-O"
6860 MOZ_ARG_ENABLE_STRING(optimize,
6861 [  --disable-optimize      Disable compiler optimization
6862   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6863 [ if test "$enableval" != "no"; then
6864     MOZ_OPTIMIZE=1
6865     if test -n "$enableval" -a "$enableval" != "yes"; then
6866         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6867         MOZ_OPTIMIZE=2
6868     fi
6869 else
6870     MOZ_OPTIMIZE=
6871 fi ], MOZ_OPTIMIZE=1)
6873 MOZ_SET_FRAMEPTR_FLAGS
6875 if test "$COMPILE_ENVIRONMENT"; then
6876 if test -n "$MOZ_OPTIMIZE"; then
6877     AC_MSG_CHECKING([for valid optimization flags])
6878     _SAVE_CFLAGS=$CFLAGS
6879     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6880     AC_TRY_COMPILE([#include <stdio.h>],
6881         [printf("Hello World\n");],
6882         _results=yes,
6883         _results=no)
6884     AC_MSG_RESULT([$_results])
6885     if test "$_results" = "no"; then
6886         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6887     fi
6888     CFLAGS=$_SAVE_CFLAGS
6890 fi # COMPILE_ENVIRONMENT
6892 AC_SUBST(MOZ_OPTIMIZE)
6893 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6894 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6895 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6896 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6897 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6898 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6900 dnl ========================================================
6901 dnl = Enable generation of debug symbols
6902 dnl ========================================================
6903 MOZ_ARG_ENABLE_STRING(debug-symbols,
6904 [  --enable-debug-symbols[=DBG]
6905                           Enable debugging symbols (using compiler flags DBG)],
6906 [ if test "$enableval" != "no"; then
6907       MOZ_DEBUG_SYMBOLS=1
6908       if test -n "$enableval" -a "$enableval" != "yes"; then
6909           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6910               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6911           else
6912               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6913           fi
6914       fi
6915   else
6916       MOZ_DEBUG_SYMBOLS=
6917   fi ],
6918   MOZ_DEBUG_SYMBOLS=1)
6920 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6921     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6922     export MOZ_DEBUG_SYMBOLS
6925 dnl ========================================================
6926 dnl = Enable any treating of compile warnings as errors
6927 dnl ========================================================
6928 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6929 [  --enable-warnings-as-errors
6930                           Enable treating of warnings as errors],
6931     MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6932     MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6933 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6934    WARNINGS_AS_ERRORS=''
6937 dnl ========================================================
6938 dnl = Disable runtime logging checks
6939 dnl ========================================================
6940 MOZ_ARG_DISABLE_BOOL(logging,
6941 [  --disable-logging       Disable logging facilities],
6942     NS_DISABLE_LOGGING=1,
6943     NS_DISABLE_LOGGING= )
6944 if test "$NS_DISABLE_LOGGING"; then
6945     AC_DEFINE(NS_DISABLE_LOGGING)
6946 else
6947     AC_DEFINE(MOZ_LOGGING)
6950 dnl ========================================================
6951 dnl = This will enable logging of addref, release, ctor, dtor.
6952 dnl ========================================================
6953 _ENABLE_LOGREFCNT=42
6954 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6955 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6956     _ENABLE_LOGREFCNT=1,
6957     _ENABLE_LOGREFCNT= )
6958 if test "$_ENABLE_LOGREFCNT" = "1"; then
6959     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6960 elif test -z "$_ENABLE_LOGREFCNT"; then
6961     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6964 dnl ========================================================
6965 dnl moz_dump_painting
6966 dnl ========================================================
6967 MOZ_ARG_ENABLE_BOOL(dump-painting,
6968 [  --enable-dump-painting          Enable paint debugging.],
6969     MOZ_DUMP_PAINTING=1,
6970     MOZ_DUMP_PAINTING= )
6971 if test -n "$MOZ_DUMP_PAINTING"; then
6972     AC_DEFINE(MOZ_DUMP_PAINTING)
6973     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6975 if test -n "$MOZ_DEBUG"; then
6976     AC_DEFINE(MOZ_DUMP_PAINTING)
6979 dnl ========================================================
6980 dnl = Enable trace malloc
6981 dnl ========================================================
6982 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6983 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6984 [  --enable-trace-malloc   Enable malloc tracing; also disables jemalloc],
6985     NS_TRACE_MALLOC=1,
6986     NS_TRACE_MALLOC= )
6987 if test "$NS_TRACE_MALLOC"; then
6988   # Please, Mr. Linker Man, don't take away our symbol names
6989   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6990   USE_ELF_DYNSTR_GC=
6991   AC_DEFINE(NS_TRACE_MALLOC)
6993 AC_SUBST(NS_TRACE_MALLOC)
6995 dnl ========================================================
6996 dnl = Enable jemalloc
6997 dnl ========================================================
6998 MOZ_ARG_ENABLE_BOOL(jemalloc,
6999 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7000     MOZ_MEMORY=1,
7001     MOZ_MEMORY=)
7003 if test "$NS_TRACE_MALLOC"; then
7004     MOZ_MEMORY=
7006 if test "$MOZ_DMDV"; then
7007     MOZ_MEMORY=
7010 if test "${OS_TARGET}" = "Android"; then
7011   dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
7012   :
7013 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
7014   dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
7015   if test -z "$GNU_CC"; then
7016     MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7017   else
7018     MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
7019   fi
7020 else
7021   dnl On other Unix systems, we only want to link executables against mozglue
7022   MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7023   dnl On other Unix systems, where mozglue is a static library, jemalloc is
7024   dnl separated for the SDK, so we need to add it here.
7025   if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
7026     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
7027   fi
7028   MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
7029   if test -n "$GNU_CC"; then
7030     dnl And we need mozglue symbols to be exported.
7031     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
7032   fi
7033   if test "$MOZ_LINKER" = 1; then
7034     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $ZLIB_LIBS"
7035   fi
7038 if test -z "$MOZ_MEMORY"; then
7039   if test -n "$MOZ_JEMALLOC"; then
7040     MOZ_NATIVE_JEMALLOC=1
7041     AC_CHECK_FUNCS(mallctl nallocm,,
7042       [MOZ_NATIVE_JEMALLOC=
7043        break])
7044     if test -n "$MOZ_NATIVE_JEMALLOC"; then
7045       MOZ_MEMORY=1
7046       AC_DEFINE(MOZ_MEMORY)
7047       AC_DEFINE(MOZ_JEMALLOC)
7048       AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7049     fi
7050   fi
7051   case "${target}" in
7052     *-mingw*)
7053       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7054         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.])
7055       fi
7056       ;;
7057   esac
7058 else
7059   dnl Don't try to run compiler tests on Windows
7060   if test "$OS_ARCH" = "WINNT"; then
7061     if test -z "$HAVE_64BIT_OS"; then
7062       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7063     else
7064       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7065     fi
7066   else
7067     AC_CHECK_SIZEOF([int *], [4])
7068     case "${ac_cv_sizeof_int_p}" in
7069     4)
7070       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7071       ;;
7072     8)
7073       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7074       ;;
7075     *)
7076       AC_MSG_ERROR([Unexpected pointer size])
7077       ;;
7078     esac
7079   fi
7081   AC_DEFINE(MOZ_MEMORY)
7082   if test -n "$MOZ_JEMALLOC"; then
7083     AC_DEFINE(MOZ_JEMALLOC)
7084   fi
7085   if test "x$MOZ_DEBUG" = "x1"; then
7086     AC_DEFINE(MOZ_MEMORY_DEBUG)
7087   fi
7088   dnl The generic feature tests that determine how to compute ncpus are long and
7089   dnl complicated.  Therefore, simply define special cpp variables for the
7090   dnl platforms we have special knowledge of.
7091   case "${target}" in
7092   *-darwin*)
7093     AC_DEFINE(MOZ_MEMORY_DARWIN)
7094     ;;
7095   *-*freebsd*)
7096     AC_DEFINE(MOZ_MEMORY_BSD)
7097     ;;
7098   *-android*|*-linuxandroid*)
7099     AC_DEFINE(MOZ_MEMORY_LINUX)
7100     AC_DEFINE(MOZ_MEMORY_ANDROID)
7101     if test -z "$gonkdir"; then
7102       _WRAP_MALLOC=1
7103     else
7104       AC_DEFINE(MOZ_MEMORY_GONK)
7105     fi
7106     MOZ_GLUE_LDFLAGS=
7107     ;;
7108   *-*linux*)
7109     AC_DEFINE(MOZ_MEMORY_LINUX)
7110     ;;
7111   *-netbsd*)
7112     AC_DEFINE(MOZ_MEMORY_BSD)
7113     ;;
7114   *-solaris*)
7115     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7116     ;;
7117   *-mingw*)
7118     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7119     if test -z "$MOZ_DEBUG"; then
7120       WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7121     else
7122       WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7123     fi
7124     dnl Look for a broken crtdll.obj
7125     WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7126     lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7127     if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7128       MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7129       dnl Also pass this to NSPR/NSS
7130       DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7131     else
7132       DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7133     fi
7134     rm crtdll.obj
7136     export DLLFLAGS
7137     ;;
7138   *)
7139     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7140     ;;
7141   esac
7142 fi # MOZ_MEMORY
7143 AC_SUBST(MOZ_MEMORY)
7144 AC_SUBST(MOZ_JEMALLOC)
7145 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7146 AC_SUBST(MOZ_GLUE_LDFLAGS)
7147 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7148 AC_SUBST(WIN32_CRT_LIBS)
7149 dnl Need to set this for make because NSS doesn't have configure
7150 AC_SUBST(DLLFLAGS)
7152 dnl We need to wrap dlopen and related functions on Android because we use
7153 dnl our own linker.
7154 if test "$OS_TARGET" = Android; then
7155     WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7156     if test -n "$MOZ_OLD_LINKER"; then
7157         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
7158     fi
7159     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7160     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7161     if test -z "$gonkdir"; then
7162         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7163     fi
7166 dnl ========================================================
7167 dnl = Use malloc wrapper lib
7168 dnl ========================================================
7169 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7170 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7171     _WRAP_MALLOC=1,
7172     _WRAP_MALLOC= )
7174 if test -n "$_WRAP_MALLOC"; then
7175     if test -n "$GNU_CC"; then
7176         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7177         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7178         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7179         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7180         dnl Wrap operator new and operator delete on Android.
7181         if test "$OS_TARGET" = "Android"; then
7182             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7183             dnl Wrap the nothrow variants too.
7184             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7185         fi
7186     else
7187         AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7188     fi
7191 dnl ========================================================
7192 dnl = Location of malloc wrapper lib
7193 dnl ========================================================
7194 MOZ_ARG_WITH_STRING(wrap-malloc,
7195 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7196     WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7198 dnl ========================================================
7199 dnl = Use JS Call tracing
7200 dnl ========================================================
7201 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7202 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7203     MOZ_TRACE_JSCALLS=1,
7204     MOZ_TRACE_JSCALLS= )
7205 if test -n "$MOZ_TRACE_JSCALLS"; then
7206     AC_DEFINE(MOZ_TRACE_JSCALLS)
7209 dnl ========================================================
7210 dnl = Use incremental GC
7211 dnl ========================================================
7212 JSGC_INCREMENTAL=1
7213 MOZ_ARG_DISABLE_BOOL(gcincremental,
7214 [  --disable-gcincremental Disable incremental GC],
7215     JSGC_INCREMENTAL= )
7216 if test -n "$JSGC_INCREMENTAL"; then
7217     AC_DEFINE(JSGC_INCREMENTAL)
7220 dnl ========================================================
7221 dnl ETW - Event Tracing for Windows
7222 dnl ========================================================
7223 MOZ_ARG_ENABLE_BOOL(ETW,
7224 [  --enable-ETW            Enable ETW (Event Tracing for Windows) event reporting],
7225     MOZ_ETW=1,
7226     MOZ_ETW= )
7227 if test -n "$MOZ_ETW"; then
7228     AC_DEFINE(MOZ_ETW)
7231 if test -n "$MOZ_ETW"; then
7232     if test -z "$MOZ_WINSDK_TARGETVER"; then
7233         AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7234     fi
7237 dnl ========================================================
7238 dnl Zealous JavaScript GC
7239 dnl ========================================================
7240 MOZ_ARG_ENABLE_BOOL(gczeal,
7241 [  --enable-gczeal         Enable zealous JavaScript GCing],
7242     JS_GC_ZEAL=1,
7243     JS_GC_ZEAL= )
7244 if test -n "$JS_GC_ZEAL"; then
7245     AC_DEFINE(JS_GC_ZEAL)
7248 dnl ========================================================
7249 dnl JS opt-mode assertions and minidump instrumentation
7250 dnl ========================================================
7251 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7252 [  --enable-js-diagnostics
7253                           Enable JS diagnostic assertions and breakpad data],
7254     JS_CRASH_DIAGNOSTICS=1,
7255     JS_CRASH_DIAGNOSTICS= )
7256 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7257     AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7260 MOZ_CHECK_CCACHE
7262 dnl ========================================================
7263 dnl = Enable static checking using gcc-dehydra
7264 dnl ========================================================
7266 MOZ_ARG_WITH_STRING(static-checking,
7267 [  --with-static-checking=path/to/gcc_dehydra.so
7268                           Enable static checking of code using GCC-dehydra],
7269     DEHYDRA_PATH=$withval,
7270     DEHYDRA_PATH= )
7272 if test -n "$DEHYDRA_PATH"; then
7273     if test ! -f "$DEHYDRA_PATH"; then
7274         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7275     fi
7276     AC_DEFINE(NS_STATIC_CHECKING)
7278 AC_SUBST(DEHYDRA_PATH)
7280 dnl ========================================================
7281 dnl = Enable stripping of libs & executables
7282 dnl ========================================================
7283 MOZ_ARG_ENABLE_BOOL(strip,
7284 [  --enable-strip          Enable stripping of libs & executables ],
7285     ENABLE_STRIP=1,
7286     ENABLE_STRIP= )
7288 dnl ========================================================
7289 dnl = Enable stripping of libs & executables when packaging
7290 dnl ========================================================
7291 MOZ_ARG_ENABLE_BOOL(install-strip,
7292 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7293     PKG_SKIP_STRIP= ,
7294     PKG_SKIP_STRIP=1)
7296 dnl ========================================================
7297 dnl = --enable-elf-dynstr-gc
7298 dnl ========================================================
7299 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7300 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7301     USE_ELF_DYNSTR_GC=1,
7302     USE_ELF_DYNSTR_GC= )
7304 dnl ========================================================
7305 dnl = --disable-elf-hack
7306 dnl ========================================================
7308 USE_ELF_HACK=1
7309 MOZ_ARG_DISABLE_BOOL(elf-hack,
7310 [  --disable-elf-hack      Disable elf hacks],
7311     USE_ELF_HACK=,
7312     USE_ELF_HACK=1)
7314 # Disable elf hack for profiling because the built in profiler
7315 # doesn't read the segments properly with elf hack. This is
7316 # temporary and should be fixed soon in the profiler.
7317 if test "$MOZ_PROFILING" = 1; then
7318   USE_ELF_HACK=
7321 # Only enable elfhack where supported
7322 if test "$USE_ELF_HACK" = 1; then
7323     case "${HOST_OS_ARCH},${OS_ARCH}" in
7324     Linux,Linux)
7325         case "${CPU_ARCH}" in
7326         arm | x86 | x86_64)
7327             USE_ELF_HACK=1
7328             ;;
7329         *)
7330             USE_ELF_HACK=
7331             ;;
7332         esac
7333         ;;
7334     *)
7335         USE_ELF_HACK=
7336         ;;
7337     esac
7340 if test "$USE_ELF_HACK" = 1; then
7341     dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7342     dnl memory addresses it maps to. The result is that by the time elfhack
7343     dnl kicks in, it is not possible to apply relocations because of that,
7344     dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7345     dnl segment. It makes elfhack mostly useless, so considering the problems
7346     dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7347     dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7348     dnl the linker creates PT_GNU_RELRO segments.
7349     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7350         LINK_WITH_PT_GNU_RELRO,
7351         [echo "int main() {return 0;}" > conftest.${ac_ext}
7352          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7353             test -s conftest${ac_exeext}; then
7354             if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7355                 LINK_WITH_PT_GNU_RELRO=yes
7356             else
7357                 LINK_WITH_PT_GNU_RELRO=no
7358             fi
7359          else
7360              dnl We really don't expect to get here, but just in case
7361              AC_ERROR([couldn't compile a simple C file])
7362          fi
7363          rm -rf conftest*])
7364     if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7365         AC_MSG_WARN([Disabling elfhack])
7366         USE_ELF_HACK=
7367     fi
7370 dnl ========================================================
7371 dnl = libstdc++ compatibility hacks
7372 dnl ========================================================
7374 STDCXX_COMPAT=
7375 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7376 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
7377     STDCXX_COMPAT=1)
7379 AC_SUBST(STDCXX_COMPAT)
7381 if test -n "$STDCXX_COMPAT"; then
7382    eval $(CXX="$CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7383    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7384    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7387 dnl ========================================================
7388 dnl =
7389 dnl = Profiling and Instrumenting
7390 dnl =
7391 dnl ========================================================
7392 MOZ_ARG_HEADER(Profiling and Instrumenting)
7394 dnl ========================================================
7395 dnl = Enable runtime visual profiling logger
7396 dnl ========================================================
7397 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7398 [  --enable-visual-event-tracer   Enable visual event tracer instrumentation],
7399     MOZ_VISUAL_EVENT_TRACER=1,
7400     MOZ_VISUAL_EVENT_TRACER=)
7401 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7402     AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7405 dnl ========================================================
7406 dnl Turn on reflow counting
7407 dnl ========================================================
7408 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7409 [  --enable-reflow-perf    Enable reflow performance tracing],
7410     MOZ_REFLOW_PERF=1,
7411     MOZ_REFLOW_PERF= )
7412 if test -n "$MOZ_REFLOW_PERF"; then
7413     AC_DEFINE(MOZ_REFLOW_PERF)
7416 dnl ========================================================
7417 dnl Enable code size metrics.
7418 dnl ========================================================
7419 MOZ_ARG_ENABLE_BOOL(codesighs,
7420 [  --enable-codesighs      Enable code size analysis tools],
7421     _ENABLE_CODESIGHS=1,
7422     _ENABLE_CODESIGHS= )
7423 if test -n "$_ENABLE_CODESIGHS"; then
7424     if test -d $srcdir/tools/codesighs; then
7425         MOZ_MAPINFO=1
7426     else
7427         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7428     fi
7431 dnl ========================================================
7432 dnl = Enable Radio Interface for B2G (Gonk usually)
7433 dnl ========================================================
7434 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7435 [  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7436     MOZ_B2G_RIL=1,
7437     MOZ_B2G_RIL= )
7438 if test -n "$MOZ_B2G_RIL"; then
7439     AC_DEFINE(MOZ_B2G_RIL)
7441 AC_SUBST(MOZ_B2G_RIL)
7443 dnl ========================================================
7444 dnl = Enable Radio FM for B2G (Gonk usually)
7445 dnl ========================================================
7446 if test -n "$MOZ_B2G_FM"; then
7447     AC_DEFINE(MOZ_B2G_FM)
7449 AC_SUBST(MOZ_B2G_FM)
7451 dnl ========================================================
7452 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7453 dnl ========================================================
7454 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7455 [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
7456     MOZ_B2G_BT=1,
7457     MOZ_B2G_BT= )
7458 if test -n "$MOZ_B2G_BT"; then
7459     AC_DEFINE(MOZ_B2G_BT)
7461 AC_SUBST(MOZ_B2G_BT)
7463 dnl ========================================================
7464 dnl = Enable Support for System Messages API
7465 dnl ========================================================
7466 if test -n "$MOZ_SYS_MSG"; then
7467     AC_DEFINE(MOZ_SYS_MSG)
7469 AC_SUBST(MOZ_SYS_MSG)
7471 dnl ========================================================
7472 dnl = Enable Support for Time Manager API
7473 dnl ========================================================
7474 if test -n "$MOZ_TIME_MANAGER"; then
7475     AC_DEFINE(MOZ_TIME_MANAGER)
7477 AC_SUBST(MOZ_TIME_MANAGER)
7479 dnl ========================================================
7480 dnl = Enable Camera Interface for B2G (Gonk usually)
7481 dnl ========================================================
7482 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7483 [  --enable-b2g-camera      Set compile flags necessary for compiling camera API for B2G ],
7484     MOZ_B2G_CAMERA=1,
7485     MOZ_B2G_CAMERA= )
7486 if test -n "$MOZ_B2G_CAMERA"; then
7487    AC_DEFINE(MOZ_B2G_CAMERA)
7489 AC_SUBST(MOZ_B2G_CAMERA)
7491 dnl ========================================================
7492 dnl = Enable Support for Payment API
7493 dnl ========================================================
7494 if test -n "$MOZ_PAY"; then
7495     AC_DEFINE(MOZ_PAY)
7497 AC_SUBST(MOZ_PAY)
7499 dnl ========================================================
7500 dnl = Enable Support for AudioChannelManager API
7501 dnl ========================================================
7502 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7503     AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7505 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7507 dnl ========================================================
7508 dnl = Support for demangling undefined symbols
7509 dnl ========================================================
7510 if test -z "$SKIP_LIBRARY_CHECKS"; then
7511     AC_LANG_SAVE
7512     AC_LANG_CPLUSPLUS
7513     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7514     AC_LANG_RESTORE
7517 # Demangle only for debug or trace-malloc builds
7518 MOZ_DEMANGLE_SYMBOLS=
7519 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7520     MOZ_DEMANGLE_SYMBOLS=1
7521     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7523 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7525 dnl ========================================================
7526 dnl = Support for gcc stack unwinding (from gcc 3.3)
7527 dnl ========================================================
7528 if test -z "$SKIP_LIBRARY_CHECKS"; then
7529     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7532 dnl ========================================================
7533 dnl JIT observers
7534 dnl ========================================================
7536 MOZ_ARG_WITH_STRING(jitreport-granularity,
7537 [  --jitreport-granularity=N
7538                            Default granularity at which to report JIT code
7539                            to external tools
7540                              0 - no info
7541                              1 - code ranges for whole functions only
7542                              2 - per-line information
7543                              3 - per-op information],
7544   JITREPORT_GRANULARITY=$withval,
7545   JITREPORT_GRANULARITY=3)
7547 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7549 dnl ========================================================
7550 dnl =
7551 dnl = Misc. Options
7552 dnl =
7553 dnl ========================================================
7554 MOZ_ARG_HEADER(Misc. Options)
7556 dnl ========================================================
7557 dnl update xterm title
7558 dnl ========================================================
7559 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7560 [  --enable-xterm-updates  Update XTERM titles with current command.],
7561     MOZ_UPDATE_XTERM=1,
7562     MOZ_UPDATE_XTERM= )
7564 dnl =========================================================
7565 dnl = Chrome format
7566 dnl =========================================================
7567 MOZ_ARG_ENABLE_STRING([chrome-format],
7568 [  --enable-chrome-format=jar|flat|both|symlink|omni
7569                           Select FORMAT of chrome files (default=jar)],
7570     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7572 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7573     MOZ_CHROME_FILE_FORMAT=jar
7576 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7577     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7578     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7579     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7580     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7581     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7584 dnl =========================================================
7585 dnl Omnijar packaging (bug 552121)
7586 dnl =========================================================
7587 dnl Omnijar packaging is compatible with flat packaging.
7588 dnl In unpackaged builds, omnijar looks for files as if
7589 dnl things were flat packaged. After packaging, all files
7590 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7591 dnl is set to flat since putting files into jars is only
7592 dnl done during packaging with omnijar.
7593 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7594     MOZ_OMNIJAR=1
7595     AC_DEFINE(MOZ_OMNIJAR)
7596     if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7597         MOZ_CHROME_FILE_FORMAT=flat
7598     else
7599         MOZ_CHROME_FILE_FORMAT=symlink
7600     fi
7601 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7602     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7605 OMNIJAR_NAME=omni.ja
7606 AC_SUBST(OMNIJAR_NAME)
7607 AC_SUBST(MOZ_OMNIJAR)
7609 dnl ========================================================
7610 dnl = Define default location for MOZILLA_FIVE_HOME
7611 dnl ========================================================
7612 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7613 [  --with-default-mozilla-five-home
7614                           Set the default value for MOZILLA_FIVE_HOME],
7615 [ val=`echo $withval`
7616   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7618 dnl ========================================================
7619 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7620 dnl ========================================================
7621 MOZ_ARG_WITH_STRING(user-appdir,
7622 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7623 [ val=`echo $withval`
7624 if echo "$val" | grep "\/" >/dev/null; then
7625     AC_MSG_ERROR("Homedir must be single relative path.")
7626 else
7627     MOZ_USER_DIR="$val"
7628 fi])
7630 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7632 dnl ========================================================
7633 dnl = Doxygen configuration
7634 dnl ========================================================
7635 dnl Use commas to specify multiple dirs to this arg
7636 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7637 MOZ_ARG_WITH_STRING(doc-input-dirs,
7638 [  --with-doc-input-dirs=DIRS
7639                           Header/idl dirs to create docs from],
7640 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7641 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7643 dnl Use commas to specify multiple dirs to this arg
7644 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7645 MOZ_ARG_WITH_STRING(doc-include-dirs,
7646 [  --with-doc-include-dirs=DIRS
7647                           Include dirs to preprocess doc headers],
7648 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7649 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7651 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7652 MOZ_ARG_WITH_STRING(doc-output-dir,
7653 [  --with-doc-output-dir=DIR
7654                           Dir to generate docs into],
7655 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7656 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7658 if test -z "$SKIP_COMPILER_CHECKS"; then
7659 dnl ========================================================
7660 dnl =
7661 dnl = Compiler Options
7662 dnl =
7663 dnl ========================================================
7664 MOZ_ARG_HEADER(Compiler Options)
7666 dnl ========================================================
7667 dnl Check for gcc -pipe support
7668 dnl ========================================================
7669 AC_MSG_CHECKING([for -pipe support])
7670 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7671     dnl Any gcc that supports firefox supports -pipe.
7672     CFLAGS="$CFLAGS -pipe"
7673     CXXFLAGS="$CXXFLAGS -pipe"
7674     AC_MSG_RESULT([yes])
7675 else
7676     AC_MSG_RESULT([no])
7679 dnl ========================================================
7680 dnl Profile guided optimization (gcc checks)
7681 dnl ========================================================
7682 dnl Test for profiling options
7683 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7685 _SAVE_CFLAGS="$CFLAGS"
7686 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7688 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7689 AC_TRY_COMPILE([], [return 0;],
7690                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7691                  result="yes" ], result="no")
7692 AC_MSG_RESULT([$result])
7694 if test $result = "yes"; then
7695   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7696   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7697   PROFILE_USE_LDFLAGS="-fprofile-use"
7700 CFLAGS="$_SAVE_CFLAGS"
7702 if test -n "$INTEL_CC"; then
7703   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7704   PROFILE_GEN_LDFLAGS=
7705   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7706   PROFILE_USE_LDFLAGS=
7709 dnl Sun Studio on Solaris
7710 if test "$SOLARIS_SUNPRO_CC"; then
7711   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7712   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7713   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7714   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7717 AC_SUBST(PROFILE_GEN_CFLAGS)
7718 AC_SUBST(PROFILE_GEN_LDFLAGS)
7719 AC_SUBST(PROFILE_USE_CFLAGS)
7720 AC_SUBST(PROFILE_USE_LDFLAGS)
7722 AC_LANG_CPLUSPLUS
7724 dnl ========================================================
7725 dnl Test for -pedantic bustage
7726 dnl ========================================================
7727 MOZ_ARG_DISABLE_BOOL(pedantic,
7728 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7729 _PEDANTIC= )
7730 if test "$_PEDANTIC"; then
7731     _SAVE_CXXFLAGS=$CXXFLAGS
7732     CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7733     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7734     AC_TRY_COMPILE([$configure_static_assert_macros],
7735                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7736                    result="no", result="yes" )
7737     AC_MSG_RESULT([$result])
7738     CXXFLAGS="$_SAVE_CXXFLAGS"
7740     case "$result" in
7741     no)
7742         _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
7743         _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7744         ;;
7745     yes)
7746         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7747         ;;
7748     esac
7751 dnl ========================================================
7752 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7753 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7754 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7755 dnl ========================================================
7756 _SAVE_CXXFLAGS=$CXXFLAGS
7757 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7758 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7759     ac_nscap_nonconst_opeq_bug,
7760     [AC_TRY_COMPILE([
7761                       template <class T>
7762                       class Pointer
7763                         {
7764                         public:
7765                           T* myPtr;
7766                         };
7768                       template <class T, class U>
7769                       int operator==(const Pointer<T>& rhs, U* lhs)
7770                         {
7771                           return rhs.myPtr == lhs;
7772                         }
7774                       template <class T, class U>
7775                       int operator==(const Pointer<T>& rhs, const U* lhs)
7776                         {
7777                           return rhs.myPtr == lhs;
7778                         }
7779                     ],
7780                     [
7781                       Pointer<int> foo;
7782                       const int* bar;
7783                       return foo == bar;
7784                     ],
7785                     ac_nscap_nonconst_opeq_bug="no",
7786                     ac_nscap_nonconst_opeq_bug="yes")])
7787 CXXFLAGS="$_SAVE_CXXFLAGS"
7789 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7790     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7792 fi # ! SKIP_COMPILER_CHECKS
7794 AC_DEFINE(CPP_THROW_NEW, [throw()])
7795 AC_LANG_C
7797 if test "$COMPILE_ENVIRONMENT"; then
7798 MOZ_EXPAND_LIBS
7799 fi # COMPILE_ENVIRONMENT
7801 dnl ========================================================
7802 dnl =
7803 dnl = Build depencency options
7804 dnl =
7805 dnl ========================================================
7806 MOZ_ARG_HEADER(Build dependencies)
7808 if test "$GNU_CC" -a "$GNU_CXX"; then
7809   _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
7810 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7811 elif test "$SOLARIS_SUNPRO_CC"; then
7812   _DEPEND_CFLAGS=
7813 else
7814   dnl Don't override this for MSVC
7815   if test -z "$_WIN32_MSVC"; then
7816     _USE_CPP_INCLUDE_FLAG=
7817     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7818     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7819   else
7820     echo '#include <stdio.h>' > dummy-hello.c
7821     changequote(,)
7822     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7823     changequote([,])
7824     if test -z "$CL_INCLUDES_PREFIX"; then
7825         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7826     fi
7827     AC_SUBST(CL_INCLUDES_PREFIX)
7828     rm -f dummy-hello.c
7829   fi
7832 dnl ========================================================
7833 dnl =
7834 dnl = Static Build Options
7835 dnl =
7836 dnl ========================================================
7837 MOZ_ARG_HEADER(Static build options)
7839 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7840 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
7841   ENABLE_SHARED_JS=1
7844 MOZ_ARG_ENABLE_BOOL(shared-js,
7845 [  --enable-shared-js
7846                           Create a shared JavaScript library.],
7847     ENABLE_SHARED_JS=1,
7848     ENABLE_SHARED_JS=)
7850 if test -n "$ENABLE_SHARED_JS"; then
7851   JS_SHARED_LIBRARY=1
7852   MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7853 else
7854   MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7855   AC_DEFINE(MOZ_STATIC_JS)
7857 AC_SUBST(JS_SHARED_LIBRARY)
7859 AC_SUBST(LIBXUL_LIBS)
7860 XPCOM_LIBS="$LIBXUL_LIBS"
7862 dnl ========================================================
7863 dnl =
7864 dnl = Standalone module options
7865 dnl =
7866 dnl ========================================================
7867 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7869 dnl Check for GLib.
7870 dnl ========================================================
7872 if test -z "$SKIP_PATH_CHECKS"; then
7873 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7874     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7875         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7876     fi
7880 if test -z "${GLIB_GMODULE_LIBS}" \
7881    -a -n "${GLIB_CONFIG}"\
7882     -a "${GLIB_CONFIG}" != no\
7883 ; then
7884     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7887 AC_SUBST(GLIB_CFLAGS)
7888 AC_SUBST(GLIB_LIBS)
7889 AC_SUBST(GLIB_GMODULE_LIBS)
7891 dnl ========================================================
7892 dnl Graphics checks.
7893 dnl ========================================================
7895 if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
7896 MOZ_ENABLE_SKIA=1
7897 else
7898 MOZ_ENABLE_SKIA=
7901 MOZ_ARG_ENABLE_BOOL(skia,
7902 [  --enable-skia   Enable use of Skia],
7903 MOZ_ENABLE_SKIA=1,
7904 MOZ_ENABLE_SKIA=)
7906 if test "$USE_FC_FREETYPE"; then
7907     if test "$COMPILE_ENVIRONMENT"; then
7908         dnl ========================================================
7909         dnl = Check for freetype2 and its functionality
7910         dnl ========================================================
7911         PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7913         if test "$_HAVE_FREETYPE2"; then
7914             _SAVE_LIBS="$LIBS"
7915             _SAVE_CFLAGS="$CFLAGS"
7916             LIBS="$LIBS $FT2_LIBS"
7917             CFLAGS="$CFLAGS $FT2_CFLAGS"
7919             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7920                 ac_cv_member_FT_Bitmap_Size_y_ppem,
7921                 [AC_TRY_COMPILE([#include <ft2build.h>
7922                                  #include FT_FREETYPE_H],
7923                                 [FT_Bitmap_Size s;
7924                                  if (sizeof s.y_ppem) return 0;
7925                                  return 1],
7926                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7927                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7928             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7929                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7930             else
7931                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7932             fi
7933             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7934                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7935                                [FT_Bitmap_Size structure includes y_ppem field])
7937             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
7939             LIBS="$_SAVE_LIBS"
7940             CFLAGS="$_SAVE_CFLAGS"
7941         fi
7943         _SAVE_CPPFLAGS="$CPPFLAGS"
7944         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7945         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7946             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7947         CPPFLAGS="$_SAVE_CPPFLAGS"
7948     else
7949         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7950     fi
7952     PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
7953     [
7954         if test "$MOZ_PANGO"; then
7955             MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
7956             MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
7957         else
7958             FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
7959             FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
7960         fi
7961     ])
7964 dnl ========================================================
7965 dnl Check for pixman and cairo
7966 dnl ========================================================
7968 MOZ_TREE_CAIRO=1
7969 MOZ_ARG_ENABLE_BOOL(system-cairo,
7970 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
7971 MOZ_TREE_CAIRO=,
7972 MOZ_TREE_CAIRO=1 )
7974 MOZ_TREE_PIXMAN=1
7975 MOZ_ARG_ENABLE_BOOL(system-pixman,
7976 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7977 MOZ_TREE_PIXMAN=,
7978 MOZ_TREE_PIXMAN=force,
7979 MOZ_TREE_PIXMAN=1 )
7981 # System cairo depends on system pixman
7982 if test "$MOZ_TREE_PIXMAN" = "force"; then
7983     if test -z "$MOZ_TREE_CAIRO"; then
7984         AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7985     else
7986         MOZ_TREE_PIXMAN=1
7987     fi
7988 elif test -z "$MOZ_TREE_CAIRO"; then
7989     MOZ_TREE_PIXMAN=
7992 if test "$MOZ_TREE_PIXMAN"; then
7993     AC_DEFINE(MOZ_TREE_PIXMAN)
7994     MOZ_PIXMAN_CFLAGS=""
7995     MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
7996 else
7997     PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
7998     MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
7999     MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8001 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8002 AC_SUBST(MOZ_PIXMAN_LIBS)
8004 # Check for headers defining standard int types.
8005 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8007 if test "$MOZ_TREE_CAIRO"; then
8008     MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8009     AC_DEFINE(MOZ_TREE_CAIRO)
8011     # For now we assume that we will have a uint64_t available through
8012     # one of the above headers or mozstdint.h.
8013     AC_DEFINE(HAVE_UINT64_T)
8015     # Define macros for cairo-features.h
8016     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8017     if test "$MOZ_X11"; then
8018         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8019         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8020         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8021         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8022         MOZ_ENABLE_CAIRO_FT=1
8023         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8024     fi
8025     case "$MOZ_WIDGET_TOOLKIT" in
8026       qt)
8027         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8028         ;;
8029       cocoa | uikit)
8030         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8031         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8032         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8033         ;;
8034       windows)
8035         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8036         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8037         if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8038             WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8039             WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8040             MOZ_ENABLE_D2D_SURFACE=1
8041             MOZ_ENABLE_DWRITE_FONT=1
8042         else
8043             WIN32_DWRITE_FONT_FEATURE=
8044             WIN32_D2D_SURFACE_FEATURE=
8045         fi
8047         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8049         dnl D3D10 Layers depend on D2D Surfaces.
8050         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8051           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8052         fi
8053         ;;
8054       os2)
8055         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8056         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8057         MOZ_ENABLE_CAIRO_FT=1
8058         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8059         CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8060         CAIRO_FT_LIBS=""
8061         ;;
8062     esac
8063     if test "$USE_FC_FREETYPE"; then
8064         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8065     fi
8066     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8067     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8068     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8069     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8070     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8071     AC_SUBST(CAIRO_FT_CFLAGS)
8073     AC_SUBST(PS_SURFACE_FEATURE)
8074     AC_SUBST(PDF_SURFACE_FEATURE)
8075     AC_SUBST(SVG_SURFACE_FEATURE)
8076     AC_SUBST(XLIB_SURFACE_FEATURE)
8077     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8078     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8079     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8080     AC_SUBST(WIN32_SURFACE_FEATURE)
8081     AC_SUBST(OS2_SURFACE_FEATURE)
8082     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8083     AC_SUBST(FT_FONT_FEATURE)
8084     AC_SUBST(FC_FONT_FEATURE)
8085     AC_SUBST(WIN32_FONT_FEATURE)
8086     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8087     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8088     AC_SUBST(QUARTZ_FONT_FEATURE)
8089     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8090     AC_SUBST(QT_SURFACE_FEATURE)
8091     AC_SUBST(TEE_SURFACE_FEATURE)
8093     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8094     MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8096     if test "$MOZ_X11"; then
8097         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8098     fi
8100     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8101 else
8102     PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8103     MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8104     MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8105     PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8106     if test "$MOZ_X11"; then
8107         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8108         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8109         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8110         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8111     fi
8114 AC_SUBST(MOZ_TREE_CAIRO)
8115 AC_SUBST(MOZ_CAIRO_CFLAGS)
8116 AC_SUBST(MOZ_CAIRO_LIBS)
8117 AC_SUBST(MOZ_CAIRO_OSLIBS)
8118 AC_SUBST(MOZ_TREE_PIXMAN)
8120 dnl ========================================================
8121 dnl qcms
8122 dnl ========================================================
8124 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8125 AC_SUBST(QCMS_LIBS)
8127 dnl ========================================================
8128 dnl HarfBuzz
8129 dnl ========================================================
8130 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8131 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8133 dnl ========================================================
8134 dnl SIL Graphite
8135 dnl ========================================================
8136 if test "$MOZ_GRAPHITE"; then
8137   MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8138   AC_DEFINE(MOZ_GRAPHITE)
8139 else
8140   MOZ_GRAPHITE_LIBS=
8142 AC_SUBST(MOZ_GRAPHITE)
8143 AC_SUBST(MOZ_GRAPHITE_LIBS)
8145 dnl ========================================================
8146 dnl OTS
8147 dnl ========================================================
8148 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8149 AC_SUBST(MOZ_OTS_LIBS)
8151 dnl ========================================================
8152 dnl Skia 
8153 dnl ========================================================
8154 if test "$MOZ_ENABLE_SKIA"; then
8155   MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8156   AC_DEFINE(MOZ_ENABLE_SKIA)
8157 else
8158   MOZ_SKIA_LIBS=
8160 AC_SUBST(MOZ_ENABLE_SKIA)
8161 AC_SUBST(MOZ_SKIA_LIBS)
8163 dnl ========================================================
8164 dnl disable xul
8165 dnl ========================================================
8166 MOZ_ARG_DISABLE_BOOL(xul,
8167 [  --disable-xul           Disable XUL],
8168     MOZ_XUL= )
8169 if test "$MOZ_XUL"; then
8170   AC_DEFINE(MOZ_XUL)
8171 else
8172   dnl remove extensions that require XUL
8173   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8176 AC_SUBST(MOZ_XUL)
8178 dnl ========================================================
8179 dnl disable profile locking
8180 dnl   do no use this in applications that can have more than
8181 dnl   one process accessing the profile directory.
8182 dnl ========================================================
8183 MOZ_ARG_DISABLE_BOOL(profilelocking,
8184 [  --disable-profilelocking
8185                           Disable profile locking],
8186     MOZ_PROFILELOCKING=,
8187     MOZ_PROFILELOCKING=1 )
8188 if test "$MOZ_PROFILELOCKING"; then
8189   AC_DEFINE(MOZ_PROFILELOCKING)
8192 dnl ========================================================
8193 dnl necko configuration options
8194 dnl ========================================================
8197 dnl option to disable various necko protocols
8199 MOZ_ARG_ENABLE_STRING(necko-protocols,
8200 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8201                           Enable/disable specific protocol handlers],
8202 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8203     if test "$option" = "yes" -o "$option" = "all"; then
8204         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8205     elif test "$option" = "no" -o "$option" = "none"; then
8206         NECKO_PROTOCOLS=""
8207     elif test "$option" = "default"; then
8208         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8209     elif test `echo "$option" | grep -c \^-` != 0; then
8210         option=`echo $option | sed 's/^-//'`
8211         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8212     else
8213         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8214     fi
8215 done],
8216     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8217 dnl Remove dupes
8218 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8219 AC_SUBST(NECKO_PROTOCOLS)
8220 for p in $NECKO_PROTOCOLS; do
8221     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8222     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8223 done
8226 dnl option to disable necko's wifi scanner
8228 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8229 [  --disable-necko-wifi    Disable necko wifi scanner],
8230     NECKO_WIFI=,
8231     NECKO_WIFI=1)
8233 if test "$OS_ARCH" = "OS2"; then
8234   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8235   NECKO_WIFI=
8237 if test "$NECKO_WIFI" -a \
8238         "$OS_ARCH" != "Linux" -a \
8239         "$OS_ARCH" != "Darwin" -a \
8240         "$OS_ARCH" != "SunOS" -a \
8241         "$OS_ARCH" != "WINNT"; then
8242   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8245 if test "$NECKO_WIFI"; then
8246   AC_DEFINE(NECKO_WIFI)
8247   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8249 AC_SUBST(NECKO_WIFI)
8252 dnl option to disable cookies
8254 MOZ_ARG_DISABLE_BOOL(cookies,
8255 [  --disable-cookies       Disable cookie support],
8256     NECKO_COOKIES=,
8257     NECKO_COOKIES=1)
8258 AC_SUBST(NECKO_COOKIES)
8259 if test "$NECKO_COOKIES"; then
8260     AC_DEFINE(NECKO_COOKIES)
8261     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8265 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8267 MOZ_ARG_DISABLE_BOOL(ctypes,
8268 [  --disable-ctypes        Disable js-ctypes],
8269     BUILD_CTYPES=,
8270     BUILD_CTYPES=1)
8271 AC_SUBST(BUILD_CTYPES)
8272 if test "$BUILD_CTYPES"; then
8273     AC_DEFINE(BUILD_CTYPES)
8276 dnl Build Places if required
8277 if test "$MOZ_PLACES"; then
8278   AC_DEFINE(MOZ_PLACES)
8281 dnl Build Apps in the Cloud (AITC) if required
8282 AC_SUBST(MOZ_SERVICES_AITC)
8283 if test -n "$MOZ_SERVICES_AITC"; then
8284   AC_DEFINE(MOZ_SERVICES_AITC)
8287 dnl Build Common JS modules provided by services.
8288 AC_SUBST(MOZ_SERVICES_COMMON)
8289 if test -n "$MOZ_SERVICES_COMMON"; then
8290   AC_DEFINE(MOZ_SERVICES_COMMON)
8293 dnl Build Services crypto component (used by Sync)
8294 AC_SUBST(MOZ_SERVICES_CRYPTO)
8295 if test -n "$MOZ_SERVICES_CRYPTO"; then
8296   AC_DEFINE(MOZ_SERVICES_CRYPTO)
8299 dnl Build Firefox Health Reporter Service
8300 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8301 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8302   AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8305 dnl Build Services metrics component
8306 AC_SUBST(MOZ_SERVICES_METRICS)
8307 if test -n "$MOZ_SERVICES_METRICS"; then
8308   AC_DEFINE(MOZ_SERVICES_METRICS)
8311 dnl Build Notifications if required
8312 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8313 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8314   AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8317 dnl Build Sync Services if required
8318 AC_SUBST(MOZ_SERVICES_SYNC)
8319 if test -n "$MOZ_SERVICES_SYNC"; then
8320   AC_DEFINE(MOZ_SERVICES_SYNC)
8323 dnl ========================================================
8324 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8325     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8328 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8329   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8332 if test "$MOZ_APP_COMPONENT_MODULES"; then
8333   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8336 dnl ========================================================
8337 dnl =
8338 dnl = Maintainer debug option (no --enable equivalent)
8339 dnl =
8340 dnl ========================================================
8342 AC_SUBST(AR)
8343 AC_SUBST(AR_FLAGS)
8344 AC_SUBST(AR_LIST)
8345 AC_SUBST(AR_EXTRACT)
8346 AC_SUBST(AR_DELETE)
8347 AC_SUBST(AS)
8348 AC_SUBST(ASFLAGS)
8349 AC_SUBST(AS_DASH_C_FLAG)
8350 AC_SUBST(LD)
8351 AC_SUBST(RC)
8352 AC_SUBST(RCFLAGS)
8353 AC_SUBST(MC)
8354 AC_SUBST(WINDRES)
8355 AC_SUBST(IMPLIB)
8356 AC_SUBST(FILTER)
8357 AC_SUBST(BIN_FLAGS)
8358 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8359 AC_SUBST(MOZ_UPDATE_XTERM)
8360 AC_SUBST(MOZ_PLATFORM_MAEMO)
8361 AC_SUBST(MOZ_AUTH_EXTENSION)
8362 AC_SUBST(MOZ_PERMISSIONS)
8363 AC_SUBST(MOZ_PREF_EXTENSIONS)
8364 AC_SUBST(MOZ_JS_LIBS)
8365 AC_SUBST(MOZ_PSM)
8366 AC_SUBST(MOZ_DEBUG)
8367 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8368 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8369 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8370 AC_SUBST(MOZ_DEBUG_FLAGS)
8371 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8372 AC_SUBST(WARNINGS_AS_ERRORS)
8373 AC_SUBST(MOZ_EXTENSIONS)
8374 AC_SUBST(MOZ_JSDEBUGGER)
8375 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8376 AC_SUBST(MOZ_JPROF)
8377 AC_SUBST(MOZ_SHARK)
8378 AC_SUBST(MOZ_CALLGRIND)
8379 AC_SUBST(MOZ_VTUNE)
8380 AC_SUBST(MOZ_ETW)
8381 AC_SUBST(MOZ_PROFILING)
8382 AC_SUBST(LIBICONV)
8383 AC_SUBST(MOZ_PLACES)
8384 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8385 AC_SUBST(MOZ_FEEDS)
8386 AC_SUBST(NS_PRINTING)
8387 AC_SUBST(MOZ_WEBGL)
8388 AC_SUBST(MOZ_HELP_VIEWER)
8389 AC_SUBST(TOOLCHAIN_PREFIX)
8391 AC_SUBST(JAVA)
8392 AC_SUBST(JAVAC)
8393 AC_SUBST(JAR)
8395 AC_SUBST(MOZ_PROFILELOCKING)
8397 AC_SUBST(ENABLE_TESTS)
8398 AC_SUBST(ENABLE_MARIONETTE)
8399 AC_SUBST(IBMBIDI)
8400 AC_SUBST(MOZ_UNIVERSALCHARDET)
8401 AC_SUBST(ACCESSIBILITY)
8402 AC_SUBST(MOZ_SPELLCHECK)
8403 AC_SUBST(MOZ_ANDROID_OMTC)
8404 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8405 AC_SUBST(MOZ_CRASHREPORTER)
8406 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8407 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8408 AC_SUBST(MOZ_STUB_INSTALLER)
8409 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8410 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8411 AC_SUBST(MOZ_UPDATER)
8412 AC_SUBST(MOZ_ANGLE_RENDERER)
8413 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8414 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8415 AC_SUBST(MOZ_D3DX9_VERSION)
8416 AC_SUBST(MOZ_D3DX9_CAB)
8417 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8418 AC_SUBST(MOZ_D3DX9_DLL)
8419 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8420 AC_SUBST(MOZ_METRO)
8422 AC_SUBST(MOZ_ANDROID_HISTORY)
8423 AC_SUBST(MOZ_WEBSMS_BACKEND)
8424 AC_SUBST(ENABLE_STRIP)
8425 AC_SUBST(PKG_SKIP_STRIP)
8426 AC_SUBST(STRIP_FLAGS)
8427 AC_SUBST(USE_ELF_DYNSTR_GC)
8428 AC_SUBST(USE_ELF_HACK)
8429 AC_SUBST(INCREMENTAL_LINKER)
8430 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8431 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8433 AC_SUBST(MOZ_FIX_LINK_PATHS)
8434 AC_SUBST(XPCOM_LIBS)
8435 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8436 AC_SUBST(XPCOM_GLUE_LDOPTS)
8437 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8438 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8439 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8441 AC_SUBST(USE_DEPENDENT_LIBS)
8443 AC_SUBST(MOZ_BUILD_ROOT)
8444 AC_SUBST(MOZ_OS2_TOOLS)
8446 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8447 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8448 AC_SUBST(MOZ_LINKER_EXTRACT)
8449 AC_SUBST(MOZ_PER_WINDOW_PRIVATE_BROWSING)
8451 if test -n "$MOZ_PER_WINDOW_PRIVATE_BROWSING" ; then
8452     AC_DEFINE(MOZ_PER_WINDOW_PRIVATE_BROWSING)
8455 dnl ========================================================
8456 dnl = Mac bundle name prefix
8457 dnl ========================================================
8458 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8459 [  --with-macbundlename-prefix=prefix
8460                           Prefix for MOZ_MACBUNDLE_NAME],
8461 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8463 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8464 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8465   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8468 if test "$MOZ_DEBUG"; then
8469   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8470 else
8471   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8473 AC_SUBST(MOZ_MACBUNDLE_NAME)
8475 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8476 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8477 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8478 if test "$MOZ_DEBUG"; then
8479   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8482 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8483 AC_SUBST(MOZ_MACBUNDLE_ID)
8485 # The following variables are available to branding and application
8486 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8487 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8488 # impacts profile location and user-visible fields.
8489 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8490 # versions of a given application (e.g. Aurora and Firefox both use
8491 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8492 # for application.ini's "Name" field, which controls profile location in
8493 # the absence of a "Profile" field (see below), and various system
8494 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8495 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8496 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8497 # builds (e.g. Aurora for Firefox).
8498 # - MOZ_APP_VERSION: Defines the application version number.
8499 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8500 # defaults to a lowercase form of MOZ_APP_BASENAME.
8501 # - MOZ_APP_PROFILE: When set, used for application.ini's
8502 # "Profile" field, which controls profile location.
8503 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8504 # crash reporter server url.
8505 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8506 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8508 if test -z "$MOZ_APP_NAME"; then
8509    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8512 # For extensions and langpacks, we require a max version that is compatible
8513 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8514 # 10.0a1 and 10.0a2 aren't affected
8515 # 10.0 becomes 10.0.*
8516 # 10.0.1 becomes 10.0.*
8517 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8518 if test -z "$IS_ALPHA"; then
8519   changequote(,)
8520   MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8521   changequote([,])
8522 else
8523   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8526 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8527 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8528 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8530 AC_SUBST(MOZ_APP_NAME)
8531 AC_SUBST(MOZ_APP_DISPLAYNAME)
8532 AC_SUBST(MOZ_APP_BASENAME)
8533 AC_SUBST(MOZ_APP_VENDOR)
8534 AC_SUBST(MOZ_APP_PROFILE)
8535 AC_SUBST(MOZ_APP_ID)
8536 AC_SUBST(MAR_CHANNEL_ID)
8537 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8538 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8539 AC_SUBST(MOZ_EXTENSION_MANAGER)
8540 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8541 AC_SUBST(MOZ_APP_UA_NAME)
8542 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8543 AC_SUBST(MOZ_APP_VERSION)
8544 AC_SUBST(MOZ_APP_MAXVERSION)
8545 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8546 AC_SUBST(FIREFOX_VERSION)
8547 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8548 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8549   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8551 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8552 AC_SUBST(MOZ_UA_BUILDID)
8554 # We can't use the static application.ini data when building against
8555 # a libxul SDK.
8556 if test -n "$LIBXUL_SDK"; then
8557     MOZ_APP_STATIC_INI=
8559 AC_SUBST(MOZ_APP_STATIC_INI)
8561 AC_SUBST(MOZ_PKG_SPECIAL)
8563 AC_SUBST(MOZILLA_OFFICIAL)
8565 if test "$MOZ_TELEMETRY_REPORTING"; then
8566     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8569 dnl win32 options
8570 AC_SUBST(MOZ_MAPINFO)
8571 AC_SUBST(MOZ_BROWSE_INFO)
8572 AC_SUBST(MOZ_TOOLS_DIR)
8573 AC_SUBST(WIN32_REDIST_DIR)
8574 AC_SUBST(MAKENSISU)
8576 dnl Echo the CFLAGS to remove extra whitespace.
8577 CFLAGS=`echo \
8578         $_WARNINGS_CFLAGS \
8579         $CFLAGS`
8581 CXXFLAGS=`echo \
8582         $_WARNINGS_CXXFLAGS \
8583         $CXXFLAGS`
8585 COMPILE_CFLAGS=`echo \
8586     $_DEFINES_CFLAGS \
8587         $_DEPEND_CFLAGS \
8588     $COMPILE_CFLAGS`
8590 COMPILE_CXXFLAGS=`echo \
8591     $_DEFINES_CXXFLAGS \
8592         $_DEPEND_CFLAGS \
8593     $COMPILE_CXXFLAGS`
8595 AC_SUBST(SYSTEM_LIBXUL)
8596 AC_SUBST(MOZ_NATIVE_JPEG)
8597 AC_SUBST(MOZ_NATIVE_PNG)
8598 AC_SUBST(MOZ_NATIVE_BZ2)
8600 AC_SUBST(MOZ_FLEXBOX)
8601 AC_SUBST(MOZ_JPEG_CFLAGS)
8602 AC_SUBST(MOZ_JPEG_LIBS)
8603 AC_SUBST(MOZ_BZ2_CFLAGS)
8604 AC_SUBST(MOZ_BZ2_LIBS)
8605 AC_SUBST(MOZ_PNG_CFLAGS)
8606 AC_SUBST(MOZ_PNG_LIBS)
8608 AC_SUBST(NSPR_CFLAGS)
8609 AC_SUBST(NSPR_LIBS)
8610 AC_SUBST(MOZ_NATIVE_NSPR)
8612 AC_SUBST(NSS_CFLAGS)
8613 AC_SUBST(NSS_LIBS)
8614 AC_SUBST(NSS_DEP_LIBS)
8615 AC_SUBST(MOZ_NATIVE_NSS)
8616 AC_SUBST(NSS_DISABLE_DBM)
8618 OS_CFLAGS="$CFLAGS"
8619 OS_CXXFLAGS="$CXXFLAGS"
8620 OS_CPPFLAGS="$CPPFLAGS"
8621 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8622 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8623 OS_LDFLAGS="$LDFLAGS"
8624 OS_LIBS="$LIBS"
8625 AC_SUBST(OS_CFLAGS)
8626 AC_SUBST(OS_CXXFLAGS)
8627 AC_SUBST(OS_CPPFLAGS)
8628 AC_SUBST(OS_COMPILE_CFLAGS)
8629 AC_SUBST(OS_COMPILE_CXXFLAGS)
8630 AC_SUBST(OS_LDFLAGS)
8631 AC_SUBST(OS_LIBS)
8632 AC_SUBST(CROSS_COMPILE)
8633 AC_SUBST(WCHAR_CFLAGS)
8635 AC_SUBST(HOST_CC)
8636 AC_SUBST(HOST_CXX)
8637 AC_SUBST(HOST_CFLAGS)
8638 AC_SUBST(HOST_CXXFLAGS)
8639 AC_SUBST(HOST_LDFLAGS)
8640 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8641 AC_SUBST(HOST_AR)
8642 AC_SUBST(HOST_AR_FLAGS)
8643 AC_SUBST(HOST_LD)
8644 AC_SUBST(HOST_RANLIB)
8645 AC_SUBST(HOST_NSPR_MDCPUCFG)
8646 AC_SUBST(HOST_BIN_SUFFIX)
8647 AC_SUBST(HOST_OS_ARCH)
8649 AC_SUBST(TARGET_CPU)
8650 AC_SUBST(TARGET_VENDOR)
8651 AC_SUBST(TARGET_OS)
8652 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8653 AC_SUBST(TARGET_MD_ARCH)
8654 AC_SUBST(TARGET_XPCOM_ABI)
8655 AC_SUBST(OS_TARGET)
8656 AC_SUBST(OS_ARCH)
8657 AC_SUBST(OS_RELEASE)
8658 AC_SUBST(OS_TEST)
8659 AC_SUBST(CPU_ARCH)
8660 AC_SUBST(INTEL_ARCHITECTURE)
8662 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8664 AC_SUBST(WRAP_LDFLAGS)
8665 AC_SUBST(MKSHLIB)
8666 AC_SUBST(MKCSHLIB)
8667 AC_SUBST(MKSHLIB_FORCE_ALL)
8668 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8669 AC_SUBST(DSO_CFLAGS)
8670 AC_SUBST(DSO_PIC_CFLAGS)
8671 AC_SUBST(DSO_LDOPTS)
8672 AC_SUBST(LIB_PREFIX)
8673 AC_SUBST(DLL_PREFIX)
8674 AC_SUBST(DLL_SUFFIX)
8675 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8676 AC_SUBST(LIB_SUFFIX)
8677 AC_SUBST(OBJ_SUFFIX)
8678 AC_SUBST(BIN_SUFFIX)
8679 AC_SUBST(ASM_SUFFIX)
8680 AC_SUBST(IMPORT_LIB_SUFFIX)
8681 AC_SUBST(USE_N32)
8682 AC_SUBST(CC_VERSION)
8683 AC_SUBST(CXX_VERSION)
8684 AC_SUBST(MSMANIFEST_TOOL)
8685 AC_SUBST(NS_ENABLE_TSF)
8686 AC_SUBST(MOZ_NSS_PATCH)
8687 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8688 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8690 AC_SUBST(MOZ_MEDIA)
8691 AC_SUBST(MOZ_SYDNEYAUDIO)
8692 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8693 AC_SUBST(MOZ_SOUNDTOUCH)
8694 AC_SUBST(MOZ_CUBEB)
8695 AC_SUBST(MOZ_WAVE)
8696 AC_SUBST(MOZ_VORBIS)
8697 AC_SUBST(MOZ_TREMOR)
8698 AC_SUBST(MOZ_OPUS)
8699 AC_SUBST(MOZ_WEBM)
8700 AC_SUBST(MOZ_DASH)
8701 AC_SUBST(MOZ_MEDIA_PLUGINS)
8702 AC_SUBST(MOZ_OMX_PLUGIN)
8703 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8704 AC_SUBST(MOZ_VP8_ENCODER)
8705 AC_SUBST(MOZ_VP8)
8706 AC_SUBST(MOZ_OGG)
8707 AC_SUBST(VPX_AS)
8708 AC_SUBST(VPX_ASFLAGS)
8709 AC_SUBST(VPX_DASH_C_FLAG)
8710 AC_SUBST(VPX_AS_CONVERSION)
8711 AC_SUBST(VPX_ASM_SUFFIX)
8712 AC_SUBST(VPX_X86_ASM)
8713 AC_SUBST(VPX_ARM_ASM)
8714 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8715 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8716 AC_SUBST(LIBJPEG_TURBO_AS)
8717 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8718 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8719 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8720 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8722 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8724 AC_MSG_CHECKING([for posix_fallocate])
8725 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8726   #include <fcntl.h>],
8727                  [posix_fallocate(0, 0, 0);],
8728                  [ac_cv___posix_fallocate=true],
8729                  [ac_cv___posix_fallocate=false])
8731 if test "$ac_cv___posix_fallocate" = true ; then
8732   AC_DEFINE(HAVE_POSIX_FALLOCATE)
8733   AC_MSG_RESULT(yes)
8734 else
8735   AC_MSG_RESULT(no)
8738 dnl Check for missing components
8739 if test "$COMPILE_ENVIRONMENT"; then
8740 if test "$MOZ_X11"; then
8741     if test "$WITHOUT_X11"; then
8742         AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8743     fi
8744     dnl ====================================================
8745     dnl = Check if X headers exist
8746     dnl ====================================================
8747     _SAVE_CFLAGS=$CFLAGS
8748     CFLAGS="$CFLAGS $XCFLAGS"
8749     AC_TRY_COMPILE([
8750         #include <stdio.h>
8751         #include <stdlib.h>
8752         #include <X11/Xlib.h>
8753         #include <X11/Intrinsic.h>
8754         #include <X11/extensions/XShm.h>
8755     ],
8756     [
8757         Display *dpy = 0;
8758         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8759             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8760             exit(1);
8761         }
8762     ], [],
8763     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8764     CFLAGS="$_SAVE_CFLAGS"
8766     if test -n "$MISSING_X"; then
8767         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8768     fi
8770 fi # MOZ_X11
8772 dnl Check for headers, etc. needed by WebGL.
8773 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8774     MOZ_CHECK_HEADER(GL/glx.h)
8775     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8776         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))])
8777     fi
8778 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8779 fi # COMPILE_ENVIRONMENT
8781 dnl Set various defines and substitutions
8782 dnl ========================================================
8784 if test "$OS_ARCH" = "Darwin"; then
8785   AC_DEFINE(XP_UNIX)
8786 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8787   AC_DEFINE(XP_UNIX)
8790 if test "$MOZ_DEBUG"; then
8791     AC_DEFINE(MOZ_REFLOW_PERF)
8792     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8795 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8796     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8797     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8798     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8799     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8800     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8801     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8802     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8803     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8806 AC_SUBST(MOZILLA_VERSION)
8808 AC_SUBST(ac_configure_args)
8810 dnl Spit out some output
8811 dnl ========================================================
8813 dnl The following defines are used by xpcom
8814 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8815 CPP_THROW_NEW
8816 HAVE_CPP_2BYTE_WCHAR_T
8817 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8818 HAVE_CPP_CHAR16_T
8819 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8820 HAVE_CPP_PARTIAL_SPECIALIZATION
8821 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8822 NEED_CPP_UNUSED_IMPLEMENTATIONS
8823 NEW_H
8824 HAVE_GETPAGESIZE
8825 HAVE_ICONV
8826 HAVE_ICONV_WITH_CONST_INPUT
8827 HAVE_MBRTOWC
8828 HAVE_WCRTOMB
8829 HAVE_STATVFS64
8830 HAVE_STATVFS
8831 HAVE_STATFS64
8832 HAVE_STATFS
8833 HAVE_SYS_STATVFS_H
8834 HAVE_SYS_STATFS_H
8835 HAVE_SYS_VFS_H
8836 HAVE_SYS_MOUNT_H
8839 AC_CONFIG_HEADER(
8840 netwerk/necko-config.h
8841 xpcom/xpcom-config.h
8842 xpcom/xpcom-private.h
8845 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8846 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8847 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8848 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8849 # (apparently) only need this hack when egrep's "pattern" is particularly long
8850 # (as in the following code) and the first egrep on our $PATH is Apple's.  See
8851 # bug 655339.
8852 case "$host" in
8853 *-apple-darwin11*)
8854     FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8855     ;;
8857     FIXED_EGREP="egrep"
8858     ;;
8859 esac
8861 dnl Load the list of Makefiles to generate.
8862 dnl   To add new Makefiles, edit allmakefiles.sh.
8863 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8864 . ${srcdir}/allmakefiles.sh
8866 echo $MAKEFILES > unallmakefiles
8868 AC_OUTPUT($MAKEFILES)
8870 # target_arch is from {ia32|x64|arm}
8871 case "$CPU_ARCH" in
8872 x86_64 | ia64)
8873     WEBRTC_TARGET_ARCH=x64
8874     ;;
8876 arm*)
8877     WEBRTC_TARGET_ARCH=arm
8878     ;;
8880 x86)
8881     WEBRTC_TARGET_ARCH=ia32
8882     ;;
8885 # unsupported arch for webrtc
8886     WEBRTC_TARGET_ARCH=unknown
8887     MOZ_WEBRTC=
8888     ;;
8890 esac
8892 # Generate Makefiles for WebRTC directly from .gyp files
8893 if test "${OS_TARGET}" = "WINNT"; then
8894    if test "$HAVE_64BIT_OS"; then
8895       OS_BITS=64
8896    else
8897       OS_BITS=32
8898    fi
8899    EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
8901 elif test "${OS_TARGET}" = "Android"; then
8902    EXTRA_GYP_DEFINES="-D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
8905 if test -n "$MOZ_WEBRTC"; then
8906    AC_MSG_RESULT("generating WebRTC Makefiles...")
8908 dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
8909 dnl so that regeneration via dependencies works correctly
8910    WEBRTC_CONFIG="-D build_with_mozilla=1 --include ${srcdir}/media/webrtc/webrtc_config.gypi -D FORCED_INCLUDE_FILE=${srcdir}/media/webrtc/webrtc_config.gypi"
8912    GYP_WEBRTC_OPTIONS="--format=mozmake ${WEBRTC_CONFIG} -D target_arch=${WEBRTC_TARGET_ARCH} ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
8914    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8915      $GYP_WEBRTC_OPTIONS \
8916      --generator-output=${_objdir}/media/webrtc/trunk \
8917      ${srcdir}/media/webrtc/trunk/peerconnection.gyp
8918    if test "$?" != 0; then
8919       AC_MSG_ERROR([failed to generate WebRTC Makefiles])
8920    fi
8922    # XXX disable until we land the tranche with signaling
8923    if test -n "$MOZ_WEBRTC_SIGNALING"; then
8924      AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
8925      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8926        $GYP_WEBRTC_OPTIONS \
8927        -D build_for_test=0 \
8928        --generator-output=${_objdir}/media/webrtc/signaling \
8929        ${srcdir}/media/webrtc/signaling/signaling.gyp
8930      if test "$?" != 0; then
8931         AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
8932      fi
8934      AC_MSG_RESULT("generating WebRTC/SignalingTest Makefiles...")
8935      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8936        $GYP_WEBRTC_OPTIONS \
8937        -D build_for_test=1 \
8938        --generator-output=${_objdir}/media/webrtc/signalingtest \
8939        ${srcdir}/media/webrtc/signaling/signaling.gyp
8940      if test "$?" != 0; then
8941        AC_MSG_ERROR([failed to generate WebRTC/SignalingTest Makefiles])
8942      fi
8943    fi
8945    AC_MSG_RESULT("generating gtest Makefiles...")
8946    # Ok to pass some extra -D's that are ignored here
8947    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8948      $GYP_WEBRTC_OPTIONS \
8949      --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
8950      ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
8951    if test "$?" != 0; then
8952       AC_MSG_ERROR([failed to generate gtest Makefiles])
8953    fi
8955    AC_MSG_RESULT("generating nrappkit Makefiles...")
8956    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8957      $GYP_WEBRTC_OPTIONS \
8958      --generator-output=${_objdir}/media/mtransport/third_party/nrappkit \
8959      ${srcdir}/media/mtransport/third_party/nrappkit/nrappkit.gyp
8960    if test "$?" != 0; then
8961       AC_MSG_ERROR([failed to generate nrappkit Makefiles])
8962    fi
8964    AC_MSG_RESULT("generating nICEr Makefiles...")
8965    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8966      $GYP_WEBRTC_OPTIONS \
8967      --generator-output=${_objdir}/media/mtransport/third_party/nICEr \
8968      ${srcdir}/media/mtransport/third_party/nICEr/nicer.gyp
8969    if test "$?" != 0; then
8970       AC_MSG_ERROR([failed to generate nICEr Makefiles])
8971    fi
8974 # Generate a JSON config file for unittest harnesses etc to read
8975 # build configuration details from in a standardized way.
8976 OS_TARGET=${OS_TARGET} \
8977 TARGET_CPU=${TARGET_CPU} \
8978 MOZ_DEBUG=${MOZ_DEBUG} \
8979 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} \
8980 UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
8981 MOZ_CRASHREPORTER=${MOZ_CRASHREPORTER} \
8982 MOZ_APP_NAME=${MOZ_APP_NAME} \
8983 MOZ_PER_WINDOW_PRIVATE_BROWSING=${MOZ_PER_WINDOW_PRIVATE_BROWSING} \
8984   $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
8985 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
8986   rm ./mozinfo.json.tmp
8987 else
8988   mv -f ./mozinfo.json.tmp ./mozinfo.json
8991 # Run jemalloc configure script
8993 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_JEMALLOC" -a "$MOZ_MEMORY" ; then
8994   ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
8995   case "$OS_ARCH" in
8996     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
8997       MANGLE="malloc calloc valloc free realloc posix_memalign"
8998       case "$OS_ARCH" in
8999         Linux)
9000           MANGLE="$MANGLE memalign malloc_usable_size"
9001           ;;
9002         FreeBSD)
9003           MANGLE="$MANGLE malloc_usable_size"
9004           ;;
9005       esac
9006       ;;
9007   esac
9008   if test -n "$MANGLE"; then
9009     MANGLED=
9010     JEMALLOC_WRAPPER=
9011     if test -n "$_WRAP_MALLOC"; then
9012       JEMALLOC_WRAPPER=__wrap_
9013     fi
9014     for mangle in ${MANGLE}; do
9015       if test -n "$MANGLED"; then
9016         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9017       else
9018         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9019       fi
9020     done
9021     ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9022   fi
9023   unset CONFIG_FILES
9024   if test -z "$MOZ_TLS"; then
9025     ac_configure_args="$ac_configure_args --disable-tls"
9026   fi
9027   EXTRA_CFLAGS="$CFLAGS"
9028   for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9029     ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9030   done
9031   if test "$CROSS_COMPILE"; then
9032     ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9033   fi
9034   _save_cache_file="$cache_file"
9035   cache_file=$_objdir/memory/jemalloc/src/config.cache
9036   AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9037   cache_file="$_save_cache_file"
9038   ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9041 dnl Build libunwind for Android profiling builds
9042 if test "$OS_TARGET" = "Android" -a "$MOZ_PROFILING"; then
9043   old_ac_configure_arg="$ac_configure_args"
9044   ac_configure_args="--build=${build} --host=${target_alias} --disable-shared --enable-block-signals=no"
9045   if test "$MOZ_DEBUG"; then
9046     ac_configure_args="$ac_configure_args --enable-debug"
9047   fi
9048   if test "$DSO_PIC_CFLAGS"; then
9049     ac_configure_args="$ac_configure_args --with-pic"
9050   fi
9051   ac_configure_args="$ac_configure_args \
9052       CC=\"$CC\" \
9053       CXX=\"$CXX\" \
9054       CPP=\"$CPP\" \
9055       CFLAGS=\"$CFLAGS\" \
9056       CXXFLAGS=\"$CXXFLAGS\" \
9057       CPPFLAGS=\"$CPPFLAGS\" \
9058       LD=\"$LD\" \
9059       LDFLAGS=\"$LDFLAGS\" \
9060       AR=\"$AR\" \
9061       RANLIB=\"$RANLIB\" \
9062       STRIP=\"$STRIP\" \
9063       LIBS=\"$LIBS\""
9065   # Use a separate cache file for libunwind, since it does not use caching.
9066   mkdir -p $_objdir/tools/profiler/libunwind/src
9067   old_cache_file=$cache_file
9068   cache_file=$_objdir/tools/profiler/libunwind/src/config.cache
9069   old_config_files=$CONFIG_FILES
9070   unset CONFIG_FILES
9071   AC_OUTPUT_SUBDIRS(tools/profiler/libunwind/src)
9072   cache_file=$old_cache_file
9073   ac_configure_args="$old_ac_configure_args"
9074   CONFIG_FILES=$old_config_files
9077 # Run freetype configure script
9079 if test "$MOZ_TREE_FREETYPE"; then
9080    export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9081    export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9082    export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9083    export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9084    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9085    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9086    AC_OUTPUT_SUBDIRS(modules/freetype2)
9089 if test -z "$direct_nspr_config"; then
9090     dnl ========================================================
9091     dnl = Setup a nice relatively clean build environment for
9092     dnl = sub-configures.
9093     dnl ========================================================
9094     CC="$_SUBDIR_CC"
9095     CXX="$_SUBDIR_CXX"
9096     CFLAGS="$_SUBDIR_CFLAGS"
9097     CPPFLAGS="$_SUBDIR_CPPFLAGS"
9098     CXXFLAGS="$_SUBDIR_CXXFLAGS"
9099     LDFLAGS="$_SUBDIR_LDFLAGS"
9100     HOST_CC="$_SUBDIR_HOST_CC"
9101     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9102     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9103     RC=
9106 unset MAKEFILES
9107 unset CONFIG_FILES
9109 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9110 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9112 export WRAP_LDFLAGS
9114 if test -n "$_WRAP_MALLOC"; then
9115     # Avoid doubling wrap malloc arguments
9116     _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9119 if test -z "$MOZ_NATIVE_NSPR"; then
9120     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9121     if test -z "$MOZ_DEBUG"; then
9122         ac_configure_args="$ac_configure_args --disable-debug"
9123     else
9124         ac_configure_args="$ac_configure_args --enable-debug"
9125     fi
9126     if test "$MOZ_OPTIMIZE" = "1"; then
9127         ac_configure_args="$ac_configure_args --enable-optimize"
9128     elif test -z "$MOZ_OPTIMIZE"; then
9129         ac_configure_args="$ac_configure_args --disable-optimize"
9130     fi
9131     if test -n "$HAVE_64BIT_OS"; then
9132         ac_configure_args="$ac_configure_args --enable-64bit"
9133     fi
9134     if test -n "$USE_ARM_KUSER"; then
9135         ac_configure_args="$ac_configure_args --with-arm-kuser"
9136     fi
9137     ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9138     if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9139       # dladdr is supported by the new linker, even when the system linker doesn't
9140       # support it. Trick nspr into using dladdr when it's not supported.
9141       _SAVE_CPPFLAGS="$CPPFLAGS"
9142       export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9143     fi
9144     _SAVE_LDFLAGS="$LDFLAGS"
9145     export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9146     AC_OUTPUT_SUBDIRS(nsprpub)
9147     LDFLAGS="$_SAVE_LDFLAGS"
9148     if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no; then
9149       unset CPPFLAGS
9150       CPPFLAGS="$_SAVE_CFLAGS"
9151     fi
9152     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9155 dnl ========================================================
9156 dnl = Setup a nice relatively clean build environment for
9157 dnl = sub-configures.
9158 dnl ========================================================
9159 CC="$_SUBDIR_CC"
9160 CXX="$_SUBDIR_CXX"
9161 CFLAGS="$_SUBDIR_CFLAGS"
9162 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9163 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9164 LDFLAGS="$_SUBDIR_LDFLAGS"
9165 HOST_CC="$_SUBDIR_HOST_CC"
9166 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9167 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9170 # Run the SpiderMonkey 'configure' script.
9171 dist=$MOZ_BUILD_ROOT/dist
9172 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9173 ac_configure_args="$ac_configure_args --enable-threadsafe"
9174 if test "$BUILD_CTYPES"; then
9175     # Build js-ctypes on the platforms we can.
9176     ac_configure_args="$ac_configure_args --enable-ctypes"
9178 if test -z "$JS_SHARED_LIBRARY" ; then
9179     ac_configure_args="$ac_configure_args --disable-shared-js"
9181 if test -z "$MOZ_NATIVE_NSPR"; then
9182     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9183     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9185 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9186 ac_configure_args="$ac_configure_args --prefix=$dist"
9187 if test "$MOZ_MEMORY"; then
9188    ac_configure_args="$ac_configure_args --enable-jemalloc"
9190 if test -n "$MOZ_GLUE_LDFLAGS"; then
9191    export MOZ_GLUE_LDFLAGS
9193 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9194    export MOZ_GLUE_PROGRAM_LDFLAGS
9196 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9197    MOZ_ZLIB_LIBS=
9199 export MOZ_NATIVE_ZLIB
9200 export MOZ_ZLIB_CFLAGS
9201 export MOZ_ZLIB_LIBS
9202 export MOZ_APP_NAME
9203 export STLPORT_CPPFLAGS
9204 export STLPORT_LDFLAGS
9205 export STLPORT_LIBS
9206 AC_OUTPUT_SUBDIRS(js/src)
9207 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9209 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR